You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

108 lines
4.0 KiB

4 years ago
define(function (require, exports, module) {
//引入业务类基类
let BaseBiz = require('apps/rht/base/rhtBiz');
let rhtComm = require('apps/rht/comm/rhtComm');
let Service = require('./stk180309service');
/**
* 定义业务类对象
* @param vm 界面相关ViewModule
*/
function Biz(vm) {
//继承第一步,构造继承
BaseBiz.call(this, vm);
}
//继承第二步,方法继承
inherits(Biz, BaseBiz);
//新增行后处理,默认值已经处理
Biz.prototype.afterNewRow = function (dataSrc, newRow) {
if (dataSrc.uiObjCode === this.dsMaster.uiObjCode) {
let InOrgCode = rhtComm.GetInOrgCode(Store.logOn.orgCode).message;
newRow.setColumnValue('InOrgCode', InOrgCode);
}
this.super('afterNewRow', dataSrc, newRow);
};
//保存前校验
Biz.prototype.beforeSave = function () {
let curRow = this.dsMaster.currentRow;
if(curRow){
let sCkCode = curRow ? TypeUtil.toString(curRow['CkCode']) : '';
let sDepCode = curRow ? TypeUtil.toString(curRow['DepCode']) : '';
let sEmpCode = curRow ? TypeUtil.toString(curRow['EmpCode']) : '';
if (sCkCode.length <= 0){
Store.messager.err("主表必须录入仓库!");
return false;
}
if (sDepCode.length <= 0){
Store.messager.err("主表必须录入部门!");
return false;
}
if (sEmpCode.length <= 0){
Store.messager.err("主表必须录入经手人!");
return false;
}
}
return this.super('beforeSave');
};
//明细行单行提交触发的校验
Biz.prototype.dataRowValidate = function (dataSrc, dr) {
if (dataSrc.uiObjCode === this.dsDetail.uiObjCode) {
let self = this;
let curMaster = self.dsMaster.currentRow;
let fTzCount = TypeUtil.toFloat(dr['TzCount']);
let sNewPacketID = TypeUtil.toString(dr['NewPacketID']);
let sDepID = TypeUtil.toString(dr['DepID']);
if (fTzCount <= 0) {
return "调整数量应该大于0";
}
if (sNewPacketID == '0') {
return "请录入新包装单位信息!";
}
if (sDepID == '0') {
return "请录入正确的部门信息!";
}
let MRow = curMaster.getData();
let DRow = dr.getData();
let ret= Service.getSlideMenuData("DoOnDetailCalcRule","CheckKc", MRow,DRow,"","","");
if (ret.result !== 1) {
return ret.message;
}
}
return true;
};
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 'HOrgCode':
dr.setColumnValue('CkCode', '');
dr.setColumnValue('DepCode', '');
break;
}
}
if (dataSrc.uiObjCode === this.dsDetail.uiObjCode) {
switch (dc.fieldName) {
case 'PcNO':
if (dr['PcNo'] == '*'){
dr.setColumnValue('PcNo', '*');
}
break;
case 'PackUnit':
dr.setColumnText('PcNo', '*');
break;
case 'DepCode':
case 'PluCode':
dr.setColumnText('PackUnit', '');
dr.setColumnText('NewPackUnit', '');
dr.setColumnText('PcNo', '*');
break;
}
}
this.super('fieldChanged');
};
return Biz;
});