define(function (require, exports, module) { //引入业务类基类 let BaseBiz = require('apps/rht/base/rhtBiz'); let rhtComm = require('apps/rht/comm/rhtComm'); //引入业务服务 let Service = require('./stk180305service'); /** * 定义业务类对象 * @param vm 界面相关ViewModule */ function Biz(vm) { //继承第一步,构造继承 BaseBiz.call(this, vm); } //继承第二步,方法继承 inherits(Biz, BaseBiz); let IsMdKwMng = rhtComm.getRhtOptionValue(Store.logOn.orgCode,'STK','IsMdKwMng','1'); //新增行后处理,默认值已经处理 Biz.prototype.afterNewRow = function (dataSrc, newRow) { if (dataSrc.uiObjCode === this.dsMaster.uiObjCode) { let InOrgCode = rhtComm.GetInOrgCode(Store.logOn.orgCode).message; newRow.setColumnText('InOrgCode', InOrgCode); } this.super('afterNewRow', dataSrc, newRow); }; //单据删除前处理 Biz.prototype.beforeDelete = function () { let masterRow = this.dsMaster.currentRow; let BillNo = masterRow ? TypeUtil.toString(masterRow['BillNo']) : ''; let ret= Service.getSlideMenuData("DoOnMasterRule","DoLsYkKcLock",BillNo,"1808","1","",""); if (ret.result !== 1) { masterRow.setColumnError('BillNo', '删除锁定库存失败:'+ret.message); return false; } return this.super('beforeDelete'); }; //保存前校验 计算主表合计数量等字段 Biz.prototype.beforeSave = function () { let masterRow = this.dsMaster.currentRow; if(masterRow){ let YkCount = 0.0; for(let i=0;i 0){ if (NewCkCode == OldCkCode) { dr.setColumnError(dc.fieldName, "移出仓库与移入仓库不能相同!"); return false; } } return true; }; //NewCkCode 字段变化执行事件 Biz.prototype.fieldChangedNewCkCode = function (dataSrc, dr, dc) { let OldCkCode = dr ? TypeUtil.toString(dr['OldCkCode']) : ''; let NewCkCode = dr ? TypeUtil.toString(dr['NewCkCode']) : ''; if (NewCkCode.length > 0){ if (NewCkCode == OldCkCode) { dr.setColumnError(dc.fieldName, "移入仓库与移出仓库不能相同!"); return false; } } return true; }; //IsPcNo 字段变化执行事件 Biz.prototype.fieldChangedIsPcNo = function (dataSrc, dr, dc) { let IsPcNo = dr ? TypeUtil.toString(dr['IsPcNo']) : ''; if (IsPcNo == "1"){ dr.setColumnText("IsPluType", "0"); } else{ dr.setColumnText("IsPluType", "1"); } return true; }; //PluCode 字段变化执行事件 Biz.prototype.fieldChangedPluCode = function (dataSrc, dr, dc) { let PluCode = dr ? TypeUtil.toString(dr['PluCode']) : ''; if (PluCode.length > 0){ let self = this; let currentRow = self.dsMaster.currentRow; let InOrgCode = currentRow ? TypeUtil.toString(currentRow['InOrgCode']) : ''; let OldCkCode = currentRow ? TypeUtil.toString(currentRow['OldCkCode']) : ''; let NewCkCode = currentRow ? TypeUtil.toString(currentRow['NewCkCode']) : ''; let CurInOrgCode = rhtComm.GetInOrgCode(Store.logOn.orgCode).message; let fPrice = 0.0; let ret= Service.getSlideMenuData("DoOnDetailCalcRule","PluCode","",PluCode,CurInOrgCode,"",""); if (ret.result !== 1) { dr.setColumnError(dc.fieldName, ret.message); return false; } if (ret.data != null) { fPrice = TypeUtil.toFloat(ret.data.Price); } if (IsMdKwMng == "1"){ let PluId = dr ? TypeUtil.toString(dr['PluId']) : ''; let retKw= Service.getSlideMenuData("DoOnMasterRule","GetPluKw",OldCkCode,InOrgCode,PluId,"",""); if (retKw.result === 1) { if (retKw.data !== null) { dr.setColumnValue('OutKwCode', retKw.data.KwCode); } } retKw= Service.getSlideMenuData("DoOnMasterRule","GetPluKw",NewCkCode,InOrgCode,PluId,"",""); if (retKw.result === 1) { if (retKw.data !== null) { dr.setColumnValue('InKwCode', retKw.data.KwCode); } } } let JSONObject={psPluCode:PluCode,psYwType:"1808"}; let retPacket= Service.getSlideMenuData("pubsysBaseBL","GetDefaultPluPackUnitByYwType",JSONObject,PluCode,"","",""); if (retPacket.result === 1) { if (retPacket.data != null) { dr.setColumnValue('PackUnit', retPacket.data.Unit); dr.setColumnValue('PackQty', retPacket.data.Qty); } } dr.setColumnValue("PackCount", "0"); dr.setColumnText("SglCount", "0"); dr.setColumnValue("Price", fPrice); } 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 YkCount = (PackCount*PackQty)+SglCount; let DotDecimal = TypeUtil.toFloat(dr['R_DotDecimal']); dr.setColumnValue("YkCount", YkCount); 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; } 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 YkCount = (PackCount*PackQty)+SglCount; let DotDecimal = TypeUtil.toFloat(dr['R_DotDecimal']); dr.setColumnValue("YkCount", YkCount); let sdl= 0; if (YkCount.toString().indexOf(".") !== -1) { sdl= YkCount.toString().split(".")[1].length || 0; } if (DotDecimal < sdl){ dr.setColumnError(dc.fieldName, "此商品的小数精度是" + dr['R_DotDecimal'] ); return false; } return true; }; return Biz; });