define(function (require, exports, module) { //引入业务类基类 let BaseBiz = require('apps/rht/base/rhtBiz'); let rhtComm = require('apps/rht/comm/rhtComm'); var ScDateWindow = require('system/views/pages/scdatewindow/scdatewindow'); //引入业务服务 let Service = require('./stk180302service'); /** * 定义业务类对象 * @param vm 界面相关ViewModule */ function Biz(vm) { //继承第一步,构造继承 BaseBiz.call(this, vm); } //继承第二步,方法继承 inherits(Biz, BaseBiz); //取部门核算级别 let accLength = rhtComm.getOptionOrgAccLevel(); //控制是否允许删除明细 0-否 1-是(允许) //let Isdel = "0"; let OrgType = rhtComm.GetOrgType(Store.logOn.orgCode); let IsMdKwMng = rhtComm.getRhtOptionValue(Store.logOn.orgCode, 'STK', 'IsMdKwMng', '1'); let OptIsDepUnion = rhtComm.getRhtOptionValue("*", 'STK', 'IsDepUnion', '0'); let Stk_IsCheckKc = rhtComm.getRhtOptionValue("*", 'STK', 'Stk_IsCheckKc', '1'); let DbSupportOutAndIn = rhtComm.getRhtOptionValue("*", 'STK', 'DbSupportOutAndIn', '0'); let IsDbAccNeedCheck = rhtComm.getRhtOptionValue("*", 'STK', 'IsDbAccNeedCheck', '0'); let CvsDbKcQrType = rhtComm.getRhtOptionValue("*", 'STK', 'CvsDbKcQrType', '0'); if (CvsDbKcQrType != "2") { IsDbAccNeedCheck = "0"; } let IsMulScDate = rhtComm.getRhtOptionValue("*",'SYS','SYS_IsMulScDate','0'); //新增行后处理,默认值已经处理 Biz.prototype.afterNewRow = function (dataSrc, newRow) { if (dataSrc.uiObjCode === this.dsMaster.uiObjCode) { if ((OrgType != "1001") && (OrgType != "1002") && (OrgType != "9999")) { newRow.setColumnText('OrgCode', Store.logOn.orgCode); newRow.setColumnValue('OrgName', Store.logOn.orgName); newRow.setColumnValue('InOrgCode', Store.logOn.inOrgCode); } } this.super('afterNewRow', dataSrc, newRow); }; //单据编辑前处理 Biz.prototype.beforeEdit = function () { let masterRow = this.dsMaster.currentRow; let OriginType = masterRow ? TypeUtil.toString(masterRow['OriginType']) : ''; let IsDepUnion = masterRow ? TypeUtil.toString(masterRow['IsDepUnion']) : ''; if (OriginType == "1") { masterRow.setColumnError("BillNo", '便利店端发起的调拨单不允许手工修改。'); return false; } if ((OptIsDepUnion == "0") && (IsDepUnion == "1")) { masterRow.setColumnValue('IsDepUnion', "0"); } return this.super('beforeEdit'); }; //行删除前的校验 Biz.prototype.beforeDeleteRow = function () { let masterRow = this.dsMaster.currentRow; let OriginType = TypeUtil.toString(masterRow['OriginType']); if (OriginType == "1") { masterRow.setColumnError("BillNo", '便利店端发起的调拨单不允许手工删除!'); return false; } return true; } //保存前校验 计算主表合计数量等字段 Biz.prototype.beforeSave = function () { let masterRow = this.dsMaster.currentRow; if (masterRow) { let YwStatus = masterRow ? TypeUtil.toString(masterRow['YwStatus']) : ''; let ShCkCode = masterRow ? TypeUtil.toString(masterRow['ShCkCode']) : ''; let IsDepUnion = masterRow ? TypeUtil.toString(masterRow['IsDepUnion']) : ''; let OrgCode = masterRow ? TypeUtil.toString(masterRow['OrgCode']) : ''; let ShOrgCode = masterRow ? TypeUtil.toString(masterRow['ShOrgCode']) : ''; let DbCount = 0.0; let STotal = 0.0; if (IsDepUnion == "1") { if (OrgCode != ShOrgCode) { masterRow.setColumnError('OrgCode', "组织间调拨不允许进行部门合并,请修改后重试!"); return false; } } if (YwStatus == "1") { if (ShCkCode == "") { masterRow.setColumnError('ShCkCode', "调入仓库不能为空!"); return false; } for (let i = 0; i < this.dsDetail.rows.length; i++) { let row = this.dsDetail.rows[i]; let ShDepCode = row ? TypeUtil.toString(row['ShDepCode']) : ''; if (ShDepCode == "") { masterRow.setColumnError('ShCkCode', "表体中存在调入部门为空的数据,请检查!"); return false; } } } else { let DepCode = masterRow ? TypeUtil.toString(masterRow['DepCode']) : ''; let CkCode = masterRow ? TypeUtil.toString(masterRow['CkCode']) : ''; if (OrgCode == ShOrgCode) { if (DepCode == ShDepCode) { masterRow.setColumnError('DepCode', "同组织同部门不允许调拨!"); return false; } if (ShCkCode == "") { masterRow.setColumnError('ShCkCode', "内部调拨必须填写调入仓库!"); return false; } for (let i = 0; i < this.dsDetail.rows.length; i++) { let row = this.dsDetail.rows[i]; let ShDepCode = row ? TypeUtil.toString(row['ShDepCode']) : ''; if (ShDepCode == DepCode) { if (CkCode == ShCkCode) { masterRow.setColumnError('ShCkCode', "内部调拨,存在同部门之间的数据,不允许调拨,请检查!"); return false; } } } } } for (let i = 0; i < this.dsDetail.rows.length; i++) { let row = this.dsDetail.rows[i]; DbCount = DbCount + TypeUtil.toFloat(row['DbCount']); STotal = STotal + TypeUtil.toFloat(row['STotal']); } masterRow.setColumnValue('DbCount', DbCount); masterRow.setColumnValue('STotal', STotal); } return this.super('beforeSave'); }; //明细行单行提交触发的校验 Biz.prototype.dataRowValidate = function (dataSrc, dr) { if (dataSrc.uiObjCode === this.dsDetail.uiObjCode) { let masterRow = this.dsMaster.currentRow; let BillNo = masterRow ? TypeUtil.toString(masterRow['BillNo']) : ''; let OrgCode = masterRow ? TypeUtil.toString(masterRow['OrgCode']) : ''; let ShOrgCode = masterRow ? TypeUtil.toString(masterRow['ShOrgCode']) : ''; let DepId = masterRow ? TypeUtil.toString(masterRow['DepId']) : ''; let DepCode = masterRow ? TypeUtil.toString(masterRow['DepCode']) : ''; let DepName = masterRow ? TypeUtil.toString(masterRow['DepName']) : ''; let CkCode = masterRow ? TypeUtil.toString(masterRow['CkCode']) : ''; let IsDepUnion = masterRow ? TypeUtil.toString(masterRow['IsDepUnion']) : ''; let YwStatus = masterRow ? TypeUtil.toString(masterRow['YwStatus']) : ''; let InOrgCode = masterRow ? TypeUtil.toString(masterRow['InOrgCode']) : ''; let ShDepCode = dr ? TypeUtil.toString(dr['ShDepCode']) : ''; let PluId = TypeUtil.toString(dr['PluId']); let PluCode = TypeUtil.toString(dr['PluCode']); let PluName = TypeUtil.toString(dr['PluName']); let ExPluCode = TypeUtil.toString(dr['ExPluCode']); let PluType = TypeUtil.toString(dr['PluType']); let DbCount = TypeUtil.toFloat(dr['DbCount']); let Price = TypeUtil.toFloat(dr['Price']); if (PluCode.length <= 0) { return "商品编码不能为空!"; } if ((DbCount <= 0) && (IsDepUnion != "1")) { return "调拨数量应该大于0!"; } if (OrgCode == ShOrgCode) { if (ShDepCode == "") { return "内部调拨必须填写调入部门!"; } } if ((accLength > 0) && (DepCode != ShDepCode)) { return "核算级别为部门,调入调出部门必须相同!"; } if ((YwStatus != "1") && (Stk_IsCheckKc == "1")) { let Params = BillNo + ";" + "1804;*;" + InOrgCode + ";" + DepId + ";" + CkCode + ";" + PluId + ";" + ExPluCode + ";" + PluType + ";*"; let JSONObject = { DataType: "6", Params: Params }; let retKyCount = Service.getSlideMenuData("pubsysBaseBL", "MSysGetLsKcKyCount", JSONObject, "", "", "", ""); if (retKyCount.result === 1) { if (DbCount > TypeUtil.toFloat(retKyCount.message)) { let errmsg = "商品[" + PluCode + "-" + PluName + "]的调拨数量不能多于商品的库存[组织:" + InOrgCode + "、仓库:" + CkCode + "、部门:" + DepCode + "-" + DepName + "、商品类型:" + PluType + "]
当前可用数量:" + retKyCount.message; return errmsg; } } else { return "查询商品库存失败:" + retKyCount.message; } } dr.setColumnValue('STotal', DbCount * Price); } return true; }; //记账前的处理 校验商品信息并提示 Biz.prototype.beforeAcc = function () { let masterRow = this.dsMaster.currentRow; let BillNo = TypeUtil.toString(masterRow['BillNo']); if (BillNo.length > 1) { let OrgCode = masterRow ? TypeUtil.toString(masterRow['OrgCode']) : ''; let ShOrgCode = masterRow ? TypeUtil.toString(masterRow['ShOrgCode']) : ''; let YwStatus = masterRow ? TypeUtil.toString(masterRow['YwStatus']) : ''; let ShCkCode = masterRow ? TypeUtil.toString(masterRow['ShCkCode']) : ''; let YwBillNo = masterRow ? TypeUtil.toString(masterRow['YwBillNo']) : ''; let OriginType = masterRow ? TypeUtil.toString(masterRow['OriginType']) : ''; if (YwStatus == "1") { if (ShCkCode == "") { masterRow.setColumnError('BillNo', "调入仓库不能为空!"); return false; } //masterRow.setColumnText('YwStatus', "2"); let ret = Service.getSlideMenuData("actExecute", "beforeAcc", "tStkDbBody", BillNo, "", "", ""); if (ret.result === 1) { if (ret.data != null) { masterRow.setColumnError('BillNo', "表体中存在调入部门为空的数据,请检查!"); return false; } } else { masterRow.setColumnError('BillNo', ret.message); return false; } } /* 记账前不能改数据 先注释吧 后期有问题再说 if (YwStatus == "0") { if (ShCkCode == ShOrgCode) { masterRow.setColumnText('YwStatus', "2"); } else { masterRow.setColumnText('YwStatus', "1"); } }*/ let msOrgType = rhtComm.GetOrgType(OrgCode); if ((msOrgType == "1001") || (msOrgType == "2001") || (msOrgType == "2002")) { masterRow.setColumnError('BillNo', "调出组织不能是连锁总部、物流总部、物流中心!"); return false; } if (YwBillNo != "") { if ((OriginType == "1") && (CvsDbKcQrType != "2")) { masterRow.setColumnError('BillNo', "便利店端发起的调拨单不需要手工记账!"); return false; } let ret = Service.getSlideMenuData("actExecute", "beforeAcc", "tStkDbTzHead", YwBillNo, "", "", ""); if (ret.result === 1) { if ((ret.data === null) && (CvsDbKcQrType != "2")) { masterRow.setColumnError('BillNo', "参照的调拨通知单已不存在或已终止,不能记账!"); return false; } } else { masterRow.setColumnError('BillNo', ret.message); return false; } } } return true; } /** * @description 数据发生变化时调用 * @param dataSrc 数据集 * @param dr 数据行 * @param dc 数据列 */ Biz.prototype.fieldChanged = function (dataSrc, dr, dc) { let self = this; let currentRow = self.dsMaster.currentRow; if (currentRow === null) return false; if (dataSrc.uiObjCode === this.dsMaster.uiObjCode) { switch (dc.fieldName) { case 'OrgCode': this.fieldChangedOrgCode(dataSrc, dr, dc); break; case 'ShOrgCode': this.fieldChangedShOrgCode(dataSrc, dr, dc); break; case 'ChOrgCode': this.fieldChangedChOrgCode(dataSrc, dr, dc); break; case 'DbDate': this.fieldChangedDbDate(dataSrc, dr, dc); break; case 'CkCode': this.fieldChangedCkCode(dataSrc, dr, dc); break; case 'ShCkCode': this.fieldChangedShCkCode(dataSrc, dr, dc); break; } } if (dataSrc.uiObjCode === this.dsDetail.uiObjCode) { switch (dc.fieldName) { case 'PluCode': this.fieldChangedPluCode(dataSrc, dr, dc); break; case 'SglCount': this.fieldChangedSglCount(dataSrc, dr, dc); break; case 'PackCount': this.fieldChangedPackCount(dataSrc, dr, dc); break; case 'PackUnit': this.fieldChangedPackUnit(dataSrc, dr, dc); break; } } this.super('fieldChanged'); }; //OrgCode 字段变化执行事件 Biz.prototype.fieldChangedOrgCode = function (dataSrc, dr, dc) { let self = this; let currentRow = self.dsMaster.currentRow; let OrgCode = currentRow ? TypeUtil.toString(currentRow['OrgCode']) : ''; let InOrgCode = rhtComm.GetInOrgCode(OrgCode).message; dr.setColumnValue('InOrgCode', InOrgCode); dr.setColumnValue('DepCode', ""); dr.setColumnValue('CkCode', ""); dr.setColumnValue('ShOrgCode', ""); dr.setColumnValue('ShCkCode', ""); return true; }; //ShOrgCode 字段变化执行事件 Biz.prototype.fieldChangedShOrgCode = function (dataSrc, dr, dc) { let self = this; let currentRow = self.dsMaster.currentRow; let ShOrgCode = currentRow['ShOrgCode']; let ChOrgCode = currentRow ? TypeUtil.toString(currentRow['ChOrgCode']) : ''; let InOrgCode = rhtComm.GetInOrgCode(ShOrgCode).message; dr.setColumnValue('InShOrgCode', InOrgCode); dr.setColumnValue('ShCkCode', ""); if (ChOrgCode.length > 0) { if (ShOrgCode == ChOrgCode) { dr.setColumnError('ShOrgCode', "调入组织和调出组织不能重复!"); return false; } } return true; }; //ChOrgCode 字段变化执行事件 Biz.prototype.fieldChangedChOrgCode = function (dataSrc, dr, dc) { let self = this; let currentRow = self.dsMaster.currentRow; let ChOrgCode = currentRow['ChOrgCode']; let ShOrgCode = currentRow ? TypeUtil.toString(currentRow['ShOrgCode']) : ''; if (ShOrgCode.length > 0) { if (ShOrgCode == ChOrgCode) { dr.setColumnError('ChOrgCode', "调入组织和调出组织不能重复!"); return false; } } return true; }; //DbDate 字段变化执行事件 Biz.prototype.fieldChangedDbDate = function (dataSrc, dr, dc) { let self = this; let currentRow = self.dsMaster.currentRow; let sdate = rhtComm.GetServerDate(0); let DbDate = currentRow ? TypeUtil.toString(currentRow['DbDate']) : ''; if (DbDate > sdate) { dr.setColumnError('DbDate', "调拨到货日期不能早于当前日期!"); return false; } return true; }; //CkCode 字段变化执行事件 Biz.prototype.fieldChangedCkCode = function (dataSrc, dr, dc) { let self = this; let currentRow = self.dsMaster.currentRow; let CkCode = currentRow['CkCode']; let InOrgCode = currentRow ? TypeUtil.toString(currentRow['InOrgCode']) : ''; if ((this.dsDetail.rows.length > 0) && (IsMdKwMng == "1")) { let ret = Service.getSlideMenuData("DoOnMasterRule", "CkCode", CkCode, InOrgCode, "", "", ""); if (ret.result === 1) { if (ret.data.CkType == "1") { for (let i = 0; i < this.dsDetail.rows.length; i++) { let row = this.dsDetail.rows[i]; let PluId = row ? TypeUtil.toString(row['PluId']) : ''; let retKw = Service.getSlideMenuData("DoOnMasterRule", "GetPluKw", CkCode, InOrgCode, PluId, "", ""); if (retKw.result === 1) { if (retKw.data !== null) { row.setColumnValue('OutKwCode', retKw.data.KwCode); } } } } else { for (let i = 0; i < this.dsDetail.rows.length; i++) { let row = this.dsDetail.rows[i]; row.setColumnValue('OutKwCode', retKw.data.KwCode); } } } else { currentRow.setColumnError('CkCode', ret.message) return false; } } return true; }; //ShCkCode 字段变化执行事件 Biz.prototype.fieldChangedShCkCode = function (dataSrc, dr, dc) { let self = this; let currentRow = self.dsMaster.currentRow; let ShCkCode = currentRow['ShCkCode']; let InOrgCode = currentRow ? TypeUtil.toString(currentRow['ShOrgCode']) : ''; if ((this.dsDetail.rows.length > 0) && (IsMdKwMng == "1")) { let ret = Service.getSlideMenuData("DoOnMasterRule", "ShCkCode", ShCkCode, InOrgCode, "", "", ""); if (ret.result === 1) { if (ret.data.CkType == "1") { for (let i = 0; i < this.dsDetail.rows.length; i++) { let row = this.dsDetail.rows[i]; let PluId = row ? TypeUtil.toString(row['PluId']) : ''; let retKw = Service.getSlideMenuData("DoOnMasterRule", "GetPluKw", ShCkCode, InOrgCode, PluId, "", ""); if (retKw.result === 1) { if (retKw.data !== null) { row.setColumnValue('InKwCode', retKw.data.KwCode); } } } } else { for (let i = 0; i < this.dsDetail.rows.length; i++) { let row = this.dsDetail.rows[i]; row.setColumnValue('InKwCode', retKw.data.KwCode); } } } else { currentRow.setColumnError('ShCkCode', ret.message) return false; } } return true; }; //PluCode 字段变化执行事件 Biz.prototype.fieldChangedPluCode = function (dataSrc, dr, dc) { let PluCode = dr['PluCode']; if (PluCode.length > 0) { dr.setColumnValue("PackUnit", ""); let self = this; let currentRow = self.dsMaster.currentRow; let RefShDepCode = currentRow ? TypeUtil.toString(currentRow['RefShDepCode']) : ''; let OrgCode = currentRow ? TypeUtil.toString(currentRow['OrgCode']) : ''; let InOrgCode = currentRow ? TypeUtil.toString(currentRow['InOrgCode']) : ''; let CkCode = currentRow ? TypeUtil.toString(currentRow['CkCode']) : ''; let ShCkCode = currentRow ? TypeUtil.toString(currentRow['ShCkCode']) : ''; let InShOrgCode = currentRow ? TypeUtil.toString(currentRow['InShOrgCode']) : ''; let RefShDepId = currentRow ? TypeUtil.toString(currentRow['RefShDepId']) : ''; let ret = Service.getSlideMenuData("DoOnDetailCalcRule", "PluCode", RefShDepCode, PluCode, OrgCode, InShOrgCode, RefShDepId); if (ret.result !== 1) { dr.setColumnError(dc.fieldName, ret.message); return false; } if (ret.data != null) { dr.setColumnValue('Price', ret.data.Price); } if (IsMdKwMng == "1") { let PluId = dr ? TypeUtil.toString(dr['PluId']) : ''; let retKw = Service.getSlideMenuData("DoOnMasterRule", "GetPluKw", CkCode, InOrgCode, PluId, "", ""); if (retKw.result === 1) { if (retKw.data !== null) { dr.setColumnValue('OutKwCode', retKw.data.KwCode); } } retKw = Service.getSlideMenuData("DoOnMasterRule", "GetPluKw", ShCkCode, InShOrgCode, PluId, "", ""); if (retKw.result === 1) { if (retKw.data !== null) { dr.setColumnValue('InKwCode', retKw.data.KwCode); } } if (RefShDepCode != "") { dr.setColumnText('ShDepCode', RefShDepCode); } } } return true; }; //SglCount 字段变化执行事件 Biz.prototype.fieldChangedSglCount = function (dataSrc, dr, dc) { let PackQty = TypeUtil.toFloat(dr['PackQty']); let PackCount = TypeUtil.toFloat(dr['PackCount']); let SglCount = TypeUtil.toFloat(dr['SglCount']); let DotDecimal = TypeUtil.toFloat(dr['R_DotDecimal']); let sdl = 0; if (SglCount.toString().indexOf(".") > -1) { sdl = SglCount.toString().split(".")[1].length || 0; } if (DotDecimal < sdl) { dr.setColumnError(dc.fieldName, "此商品的小数精度是" + dr['R_DotDecimal']); return false; } dr.setColumnValue("DbCount", (PackCount * PackQty) + SglCount); return true; }; //PackCount 字段变化执行事件 Biz.prototype.fieldChangedPackCount = function (dataSrc, dr, dc) { let PackQty = TypeUtil.toFloat(dr['PackQty']); let PackCount = TypeUtil.toFloat(dr['PackCount']); let SglCount = TypeUtil.toFloat(dr['SglCount']); let DotDecimal = TypeUtil.toFloat(dr['R_DotDecimal']); let sdl = 0; if (SglCount.toString().indexOf(".") > -1) { sdl = SglCount.toString().split(".")[1].length || 0; } if (DotDecimal < sdl) { dr.setColumnError(dc.fieldName, "此商品的小数精度是" + dr['R_DotDecimal']); return false; } dr.setColumnValue("DbCount", (PackCount * PackQty) + SglCount); return true; }; //PackUnit 字段变化执行事件 Biz.prototype.fieldChangedPackUnit = function (dataSrc, dr, dc) { let PackUnit = TypeUtil.toFloat(dr['PackUnit']); if (PackUnit == "") { dr.setColumnValue("PackQty", "0"); } dr.setColumnText("PackCount", "0"); return true; }; //增加右键菜单按钮并控制按钮状态 Biz.prototype.getContextMenus = function (ds, source) { let menus = this.super("getContextMenus", ds, source); if (ds.uiObjCode === this.dsDetail.uiObjCode) { let edit = ds.getEditable(); if ((!edit) && (IsMulScDate =='1')){ let curBodyRow = this.dsDetail.currentRow; let PluCode = curBodyRow ? TypeUtil.toString(curBodyRow['PluCode']) : ''; if (PluCode != ''){ menus.push({ text: '生产日期管理', opCode: 'scdate', disabled: false }); } } } return menus; }; //控制主界面按钮状态 Biz.prototype.getOpEnabled = function (opCode) { let isOk = this.super('getOpEnabled', opCode); if (!isOk) return false; let curRow = this.dsMaster.currentRow; let IsChecked = curRow ? TypeUtil.toString(curRow['IsChecked']) : ''; let TjDate = curRow ? TypeUtil.toString(curRow['TjDate']) : ''; let JzDate = curRow ? TypeUtil.toString(curRow['JzDate']) : ''; let InOrgCode = curRow ? TypeUtil.toString(curRow['InOrgCode']) : ''; let InShOrgCode = curRow ? TypeUtil.toString(curRow['InShOrgCode']) : ''; let CurInOrgCode = rhtComm.GetInOrgCode(Store.logOn.orgCode).message; if (DbSupportOutAndIn == "1") { if (opCode == 'edit') { if (!curRow) return false; if ((JzDate != '') || (TjDate != '')) return false; } if (opCode == 'delete') { if (!curRow) return false; if ((JzDate != '') || (TjDate != '')) return false; } if (opCode == 'acc') { if (!curRow) return false; if ((JzDate != '') || (TjDate == '') || (CurInOrgCode != InShOrgCode)) return false; } if (opCode == 'refer') { if (!curRow) return false; if ((JzDate != '') || (TjDate != '') || (CurInOrgCode != InOrgCode)) return false; } if (opCode == 'dboutcancle') { if (!curRow) return false; if ((JzDate != '') || (TjDate == '') || (CurInOrgCode != InOrgCode)) return false; } } else { if (opCode == 'refer') { return false; } } if ((IsDbAccNeedCheck == "1") && (CvsDbKcQrType == "2")) { if (opCode == 'checkpass') { if (!curRow) return false; if (JzDate != '') return false; if ((IsChecked != '0') && (IsChecked != '3')) return false; } if (opCode == 'checkreject') { if (!curRow) return false; if (JzDate != '') return false; if ((IsChecked != '0') && (IsChecked != '3')) return false; } if (opCode == 'undocheck') { if (!curRow) return false; if (JzDate != '') return false; if (IsChecked != '1') return false; } } else { if ((opCode == 'checkpass') || (opCode == 'checkreject') || (opCode == 'undocheck')) { return false; } } return true; }; //按钮事件控制 Biz.prototype.doOp = function (opCode) { let self = this; if (opCode == 'checkpass') { let ds = self.dsMaster; this.oncheckpass(self, ds); } if (opCode == 'checkreject') { let ds = self.dsMaster; this.oncheckreject(self, ds); } if (opCode == 'undocheck') { let ds = self.dsMaster; this.onundocheck(self, ds); } if (opCode == 'refer') { let ds = self.dsMaster; this.onrefer(self, ds); } if (opCode == 'dboutcancle') { let ds = self.dsMaster; this.ondboutcancle(self, ds); } if (opCode == 'scdate') { let dhead = self.dsMaster; let dbodyrow = self.dsDetail.currentRow; this.onscdate(self, dhead,dbodyrow); } }; //按钮事件 Biz.prototype.oncheckpass = function (biz, ds) { let dsrow = ds.currentRow; let BillNo = dsrow ? TypeUtil.toString(dsrow['BillNo']) : ''; if (BillNo.length > 0) { let ret = Service.getSlideMenuData("actExecute", "checkpass", BillNo, Store.logOn.userid, Store.logOn.userCode, Store.logOn.userName, ""); if (ret.result !== 1) { dsrow.setColumnError('BillNo', ret.message); return false; } else { Store.messager.tip('操作成功!'); //刷新当前行 biz.dsMaster.updateRow(); } } return true; }; //checkreject按钮事件 Biz.prototype.oncheckreject = function (biz, ds) { let dsrow = ds.currentRow; let BillNo = dsrow ? TypeUtil.toString(dsrow['BillNo']) : ''; if (BillNo.length > 0) { let ret = Service.getSlideMenuData("actExecute", "checkreject", BillNo, Store.logOn.userid, Store.logOn.userCode, Store.logOn.userName, ""); if (ret.result !== 1) { dsrow.setColumnError('BillNo', ret.message); return false; } else { Store.messager.tip('操作成功!'); //刷新当前行 biz.dsMaster.updateRow(); } } return true; }; //undocheck按钮事件 Biz.prototype.onundocheck = function (biz, ds) { let dsrow = ds.currentRow; let BillNo = dsrow ? TypeUtil.toString(dsrow['BillNo']) : ''; if (BillNo.length > 0) { let ret = Service.getSlideMenuData("actExecute", "undocheck", BillNo, Store.logOn.userid, Store.logOn.userCode, Store.logOn.userName, ""); if (ret.result !== 1) { dsrow.setColumnError('BillNo', ret.message); return false; } else { Store.messager.tip('操作成功!'); //刷新当前行 biz.dsMaster.updateRow(); } } return true; }; //refer按钮事件 Biz.prototype.onrefer = function (biz, ds) { let dsrow = ds.currentRow; let BillNo = dsrow ? TypeUtil.toString(dsrow['BillNo']) : ''; if (BillNo.length > 0) { let ret = Service.getSlideMenuData("actExecute", "refer", BillNo, Store.logOn.userid, Store.logOn.userCode, Store.logOn.userName, ""); if (ret.result !== 1) { dsrow.setColumnError('BillNo', ret.message); return false; } else { Store.messager.tip('操作成功!'); //刷新当前行 biz.dsMaster.updateRow(); } } return true; }; //dboutcancle 按钮事件 Biz.prototype.ondboutcancle = function (biz, ds) { let dsrow = ds.currentRow; let BillNo = dsrow ? TypeUtil.toString(dsrow['BillNo']) : ''; if (BillNo.length > 0) { let ret = Service.getSlideMenuData("actExecute", "dboutcancle", BillNo, Store.logOn.userid, Store.logOn.userCode, Store.logOn.userName, ""); if (ret.result !== 1) { dsrow.setColumnError('BillNo', ret.message); return false; } else { Store.messager.tip('操作成功!'); //刷新当前行 biz.dsMaster.updateRow(); } } return true; }; //生产日期信息按钮事件处理 Biz.prototype.onscdate = function (self, dhead, dbodyrow) { let curRow = self.dsMaster.currentRow; let YwType = curRow ? TypeUtil.toString(curRow['YwType']) : '*'; let DataStatus = curRow ? TypeUtil.toString(curRow['DataStatus']) : '0'; if (IsMulScDate !=='1'){ Store.messager.err("系统没有开启多生产日期管理,请先开启后再执行本操作!"); return false; } //定义窗口界面 let param = { uiObjCode: self.dsMaster.funcCode, billNo: dbodyrow.BillNo, ywType: YwType, toSerialNo: dbodyrow.SerialNo, pluInf: dbodyrow.PluCode+'-'+dbodyrow.PluName, recCount: dbodyrow.DbCount, biz: self, pk: "BillNo,YwType,ToSerialNo,SerialNo", fixQuery: { 'ToSerialNo': dbodyrow.SerialNo, 'BillNo': dbodyrow.BillNo, 'YwType': YwType }, showCheckColumn: true, isToEdit: (DataStatus ==='0'), enablePager: false, funcCode: self.FuncCode, ds: dbodyrow }; //new多选窗体 并打开 let myWindow = new ScDateWindow(param); myWindow.open(); }; return Biz; });