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.

716 lines
30 KiB

4 years ago
define(function (require, exports, module) {
//let BaseBiz = require('apps/sos/common/base/sosbiz');
let BaseBiz = require('apps/rht/base/rhtBiz');
let UApp = require('../../comm/UApp');
//let BaseBiz = require('./ordBiz');
let Service = require('./sku080202service');
let rhtComm = require('../../comm/rhtComm');
// let multiWindow = require("system/views/pages/multiwindow/multiwindow.js");
let XWindow = require('system/views/pages/xlswindow/import-window');
//let PluService = require('apps/rht/comm/pluservice');
//let multiselectwindow = require("apps/sos/common/window/multiselectwindow.js");
//let CommonService = require('apps/sos/commonservice/commservice');
//let MultiSelectWindow = require('apps/sos/common/window/multwindow.js');
//let FeedBackWindow = require('./feedbackwin');
//let ExTend = require('system/base/extend');
/**
* 控制按钮的可用
* @param opCode 按钮编码
* @return [description]
*/
function Biz(vm) {
//继承第一步,构造继承
BaseBiz.call(this, vm);
}
//继承第二步,方法继承
inherits(Biz, BaseBiz);
//TODO 预置选项 枚举值还未确定
//SosPur_PurRtnPrintRule,0-不可打印1-只能打印审批单据3-不控制。需要新建选项。
let Dst_IsPsZcPlu = rhtComm.getRhtOptionValue('*','DST','Dst_IsPsZcPlu','0');
let ORD_EtpYhPluArea = rhtComm.getRhtOptionValue('*','ORD','ORD_EtpYhPluArea','0');
let Ord_CgjyDisAllPlu = rhtComm.getRhtOptionValue('*','ORD','Ord_CgjyDisAllPlu','0');
let Ord_CgjyXsDays = rhtComm.getRhtOptionValue('*','ORD','Ord_CgjyXsDays','7');
let Ord_IsYhDefPacket = rhtComm.getRhtOptionValue('*','ORD','Ord_IsYhDefPacket','1');
let Ord_IsGetKcPamsCgYh = rhtComm.getRhtOptionValue('*','ORD','Ord_IsGetKcPamsCgYh','0');
let ORD_YHCHKDSTTYPE = rhtComm.getRhtOptionValue('*','ORD','ORD_YHCHKDSTTYPE','0');
let Ord_YhDays = rhtComm.getRhtOptionValue('*','ORD','Ord_YhDays','1');
let ORD_CtlYhSglCount = rhtComm.getRhtOptionValue('*','ORD','ORD_CtlYhSglCount','1');
let IS_RULE = rhtComm.getRhtOptionValue('*','SKU','IS_RULE','0');
let PLU_CODE_LEN = rhtComm.getRhtOptionValue('*','SKU','PLU_CODE_LEN','8');
let PLU_WEIGHT_CODE_LEN = rhtComm.getRhtOptionValue('*','SKU','PLU_WEIGHT_CODE_LEN','5');
let PluCodeIsRuleCanEdit = rhtComm.getRhtOptionValue('*','SKU','PluCodeIsRuleCanEdit','0');
let SKU_IsPluInfoCheck = rhtComm.getRhtOptionValue('*','SKU','SKU_IsPluInfoCheck','0');
let Sku_IsAuditPlu = rhtComm.getRhtOptionValue('*','SKU','Sku_IsAuditPlu','0');
let SKU_CANZC = rhtComm.getRhtOptionValue('*','SKU','SKU_CANZC','0');
let SKU_IsInputBarCode = rhtComm.getRhtOptionValue('*','SKU','SKU_IsInputBarCode','0');
let OldClsID = "0";
let giIsBz = "0";
//单据删除前处理 需要调用过程更新台账
Biz.prototype.beforeDelete = function () {
let masterRow = this.dsMaster.currentRow;
let PluID = TypeUtil.toString(masterRow['PluID']);
let PluCode = TypeUtil.toString(masterRow['PluCode']);
let ret= Service.getSlideMenuData("DoDelete","USkuGetPluPropInfo",PluID,PluCode,"YwStatus","1","");
if (ret.result !== 1) {
masterRow.setColumnError('PluCode', ret.message);
return false;
}
if (ret.data.PluPropInfo == ""){
masterRow.setColumnError("PluCode", '当前组织没有经营此商品!');
return false;
}
if ((ret.data.PluPropInfo == "1") || (ret.data.PluPropInfo == "2")) {
masterRow.setColumnError("PluCode", '商品已审批通过且未被淘汰,不允许删除!');
return false;
}
if (ret.data.PluPropInfo == "3") {
let ret= Service.USkuSetPluStatus(PluID,PluCode,"3","99",Store.logOn.userId,Store.logOn.userCode,Store.logOn.userName,Store.logOn.orgCode,Store.logOn.orgName);
if (ret.result !== 1) {
masterRow.setColumnError('PluCode', ret.message);
return false;
}
let ret= Service.getSlideMenuData("DoDelete","UDelDisUsePluCntAcc",PluID,Store.logOn.orgCode,Store.logOn.userCode,"2","");
if (ret.result !== 1) {
masterRow.setColumnError('PluCode', '删除商品时记录台账出错!'+ret.message);
return false;
}
let ret= Service.getSlideMenuData("DoDelete","UDelCntSkuData",PluID,"","","","");
if (ret.result !== 1) {
masterRow.setColumnError('PluCode', '删除合同商品对应的商品信息出错!'+ret.message);
return false;
}
}
return "确定删除当前数据?";
};
//新增行后处理,默认值已经处理
Biz.prototype.afterNewRow = function (dataSrc, newRow) {
let sdate=new Date(Store.bizDao.getSysDate()).format('yyyy-MM-dd');
newRow.setColumnValue('OrgCode',Store.logOn.orgCode);
newRow.setColumnValue('OrgName',Store.logOn.orgName);
newRow.setColumnValue('LrOrgCode',Store.logOn.orgCode);
newRow.setColumnValue('LrorgName',Store.logOn.orgName);
newRow.setColumnValue('LrUserID',Store.logOn.userId);
newRow.setColumnValue('LrUserCode',Store.logOn.userCode);
newRow.setColumnValue('LrUserName',Store.logOn.userName);
newRow.setColumnValue('LrDate',sdate);
newRow.setColumnValue('IsSeason',"0");
newRow.setColumnValue('IsWeight',"0");
let PluID = rhtComm.GetNextId("8001","1","");
newRow.setColumnValue('PluID',PluID);
if (rhtComm.GetOrgType(Store.logOn.orgCode) == '1001'){
newRow.setColumnValue('DataSrc',"1");
}
if (SKU_IsPluInfoCheck == "1"){
newRow.setColumnValue('YwStatus',"5");
}
};
/*
//行删除前的校验
Biz.prototype.beforeDeleteRow=function(){
let masterRow = this.dsMaster.currentRow;
let AskType = TypeUtil.toString(masterRow['AskType']);
if ( (AskType == "3") || (AskType == "4") || (AskType == "5") ) {
masterRow.setColumnError("BillNo", '组合类要货不允许对要货记录进行删除!');
return false;
}
return true;
}
*/
//增加前校验
Biz.prototype.afterAdd = function () {
let masterRow = this.dsMaster.currentRow;
let OrgType = rhtComm.GetOrgType(Store.logOn.orgCode);
if ((OrgType = "1003") || (OrgType = "1004") || (OrgType = "1005") || (OrgType = "1006")){
masterRow.setColumnError('PluName', "系统已设置不允许门店新品申请!");
return false;
}
if (SKU_CANZC == "0") {
masterRow.setColumnText('PluName', ret.data.ps_supcode);
}
return true;
}
//保存前校验 计算主表合计数量等字段
Biz.prototype.beforeSave = function () {
let masterRow = this.dsMaster.currentRow;
let PluID = TypeUtil.toString(masterRow['PluID']);
let ClsID = TypeUtil.toString(masterRow['ClsID']);
let YwStatus = TypeUtil.toString(masterRow['YwStatus']);
let PluCode = TypeUtil.toString(masterRow['PluCode']);
let BarCode = TypeUtil.toString(masterRow['BarCode']);
let PluName = TypeUtil.toString(masterRow['PluName']);
let PluEName = TypeUtil.toString(masterRow['PluEName']);
let PluAbbrName = TypeUtil.toString(masterRow['PluAbbrName']);
let PluMN = TypeUtil.toString(masterRow['PluMN']);
let BzDays = TypeUtil.toString(masterRow['BzDays']);
let IsWeight = TypeUtil.toString(masterRow['IsWeight']);
let DotDecimal = TypeUtil.toString(masterRow['DotDecimal']);
let IsCoutQty = TypeUtil.toString(masterRow['IsCoutQty']);
let sPluEName= UApp.ChineseMN(PluName);
masterRow.setColumnValue('PluMN', sPluEName);
masterRow.setColumnValue('PluAbbrName', PluName.substring(0,5));
if ((((PluCode != "*") && (BarCode == "*")) || (BarCode == ""))&& (SKU_IsInputBarCode == "1")){
masterRow.setColumnError("BarCode", "请输入商品条码!");
return false;
}
if (OldClsID == "0"){
OldClsID=ClsID;
}
if (this._state=="add") {
if ((PluID == "") || (PluID == "0") || (PluID === null)){
let NewPluID = rhtComm.GetNextId("8001","1","");
masterRow.setColumnValue('PluID', NewPluID);
}
}
if (this._state=="edit") {
let ret= Service.getSlideMenuData("OnBeforeSave","ClsID",PluID,OldClsID,ClsID,"");
if (ret.result !== 1) {
masterRow.setColumnError(dc.fieldName, ret.message);
return false;
}
}
if ((PluName.indexOf(";") != -1) || (PluName.indexOf("''") != -1)){
masterRow.setColumnError("PluName", "商品名称含有非法字符;或者''");
return false;
}
if ((PluEName.indexOf(";") != -1) || (PluEName.indexOf("''") != -1)){
masterRow.setColumnError("PluEName", "商品英文名称含有非法字符;或者''");
return false;
}
if ((PluAbbrName.indexOf(";") != -1) || (PluAbbrName.indexOf("''") != -1)){
masterRow.setColumnError("PluAbbrName", "商品简称含有非法字符;或者''");
return false;
}
if ((PluMN.indexOf(";") != -1) || (PluMN.indexOf("''") != -1)){
masterRow.setColumnError("PluMN", "商品助记符含有非法字符;或者''");
return false;
}
if (BarCode.indexOf(";") != -1){
masterRow.setColumnError("BarCode", "商品条码含有非法字符;"+OldID);
return false;
}
if ((IS_RULE == "1") && (PluCode == "*")) {
let ret= Service.getSlideMenuData("DoOnMasterCalcRule","GetNewPluCodeByRule",IsWeight,Store.logOn.orgCode,ClsCode,BrandCode,PluID);
if (ret.result !== 1) {
masterRow.setColumnError(dc.fieldName, ret.message);
return false;
}
else {
masterRow.setColumnValue('PluCode', ret.data.PluCode);
}
}
if ((giIsBz == "1") && (BzDays == "0")){
masterRow.setColumnError(dc.fieldName, "选择的品类需要管理保质期,请录入商品的保质期!");
return false;
}
if (IsWeight == "1"){
if ((DotDecimal == "0") && (IsCoutQty == "0")){
masterRow.setColumnError("DotDecimal", "称重非计件商品小数精度不能为0");
return false;
}
}
return this.super('beforeSave');
}
//字段变化触发事件
Biz.prototype.fieldChanged = function (dataSrc, dr, dc) {
if (dataSrc.uiObjCode === this.dsMaster.uiObjCode) {
switch (dc.fieldName) {
case 'PluCode':
this.fieldChangedPluCode(dataSrc, dr, dc);
break;
case 'BarCode':
this.fieldChangedBarCode(dataSrc, dr, dc);
break;
case 'IsSeason':
this.fieldChangedIsSeason(dataSrc, dr, dc);
break;
case 'BzDays':
this.fieldChangedBzDays(dataSrc, dr, dc);
break;
case 'IsWeight':
this.fieldChangedIsWeight(dataSrc, dr, dc);
break;
case 'JTaxRate':
this.fieldChangedJTaxRate(dataSrc, dr, dc);
break;
case 'XTaxRate':
this.fieldChangedXTaxRate(dataSrc, dr, dc);
break;
case 'Price':
this.fieldChangedPrice(dataSrc, dr, dc);
break;
case 'HyPrice':
this.fieldChangedHyPrice(dataSrc, dr, dc);
break;
case 'MinThDays':
this.fieldChangedMinThDays(dataSrc, dr, dc);
break;
case 'IsSelfBrand':
this.fieldChangedIsSelfBrand(dataSrc, dr, dc);
break;
case 'IsNewPlu':
this.fieldChangedIsNewPlu(dataSrc, dr, dc);
break;
case 'IsKc':
this.fieldChangedIsKc(dataSrc, dr, dc);
break;
case 'ClsID':
this.fieldChangedClsID(dataSrc, dr, dc);
break;
}
}
this.super('fieldChanged');
};
//PluCode 字段变化执行事件
Biz.prototype.fieldChangedPluCode = function (dataSrc, dr, dc) {
let PluCode = TypeUtil.toString(dr['PluCode']);
let OldPluCode = TypeUtil.toString(dr.transData['PluCode']);
let IsWeight = TypeUtil.toString(dr['IsWeight']);
let PluCodeLen = PluCode.length;
if (this._state=="edit"){
dr.setColumnError(dc.fieldName, "编码规则已启用,商品编码不允许手工修改");
dr.setColumnValue(dc.fieldName, OldPluCode);
return false;
}
if ((IS_RULE =="1") && (PluCodeIsRuleCanEdit != "1")){
dr.setColumnError(dc.fieldName, "商品编码不允许手工录入");
return false;
}
if (PluCode != "*") {
if (IsWeight == "0") {
if (PluCodeLen != PLU_CODE_LEN) {
dr.setColumnError(dc.fieldName, "商品编码长度应该为:"+PLU_CODE_LEN+"位");
return false;
}
}
else {
if (PluCodeLen != PLU_WEIGHT_CODE_LEN) {
dr.setColumnError(dc.fieldName, "商品编码长度应该为:"+PLU_WEIGHT_CODE_LEN+"位");
return false;
}
}
};
return true;
};
//BarCode 字段变化执行事件
Biz.prototype.fieldChangedBarCode = function (dataSrc, dr, dc) {
let BarCode = TypeUtil.toString(dr['BarCode']);
let PluCode = TypeUtil.toString(dr['PluCode']);
let PluId = TypeUtil.toString(dr['PluId']);
if (SKU_IsInputBarCode !="1") {
dr.setColumnError(dc.fieldName, "条码不允许手工录入");
return false;
}
if ((BarCode !== '*') && (PluCode !== '*')) {
let ret= Service.getSlideMenuData("DoOnMasterCalcRule","BarCode",BarCode,PluCode,PluId,"","");
if (ret.result !== 1) {
dr.setColumnError(dc.fieldName, ret.message);
//Store.messager.tip(ret.message);
return false;
}
};
return true;
};
//IsSeason 字段变化执行事件
Biz.prototype.fieldChangedIsSeason = function (dataSrc, dr, dc) {
let IsSeason = TypeUtil.toString(dr['IsSeason']);
if (IsSeason == "0") {
dr.setColumnText('SaleSeason', "1111");
dr.setColumnValue('IsNewPlu', "0");
}
else{
dr.setColumnValue('IsNewPlu', "1");
}
return true;
};
//BzDays 字段变化执行事件
Biz.prototype.fieldChangedBzDays = function (dataSrc, dr, dc) {
let BzDays = TypeUtil.toFloat(dr['BzDays']);
if (BzDays <= 7) {
dr.setColumnText('JhBfBzDays', "0");
dr.setColumnValue('PsBfBzDays', "0");
}
else {
dr.setColumnText('JhBfBzDays', (BzDays/3).round(0));
dr.setColumnValue('PsBfBzDays', (BzDays*2/3).round(0));
}
return true;
};
//IsWeight 字段变化执行事件
Biz.prototype.fieldChangedIsWeight = function (dataSrc, dr, dc) {
let IsWeight = TypeUtil.toString(dr['IsWeight']);
let PluID = TypeUtil.toString(dr['PluID']);
let PluCode = TypeUtil.toString(dr['PluCode']);
let BrandCode = TypeUtil.toString(dr['BrandCode']);
let ClsCode = TypeUtil.toString(dr['ClsCode']);
if (IsWeight == "0") {
dr.setColumnValue('IsCoutQty', "0");
}
if ((IS_RULE == "1") && (PluCode != "*")) {
let ret= Service.getSlideMenuData("DoOnMasterCalcRule","GetNewPluCodeByRule",IsWeight,Store.logOn.orgCode,ClsCode,BrandCode,PluID);
if (ret.result !== 1) {
dr.setColumnError(dc.fieldName, ret.message);
return false;
}
else {
dr.setColumnValue('PluCode', ret.data.PluCode);
}
}
return true;
};
//JTaxRate 字段变化执行事件
Biz.prototype.fieldChangedJTaxRate = function (dataSrc, dr, dc) {
let JTaxRate = TypeUtil.toFloat(dr['JTaxRate']);
if ((JTaxRate < 0) || (JTaxRate > 100)) {
dr.setColumnError(dc.fieldName,"进项税率应在0-100之间。");
return false;
}
return true;
};
//XTaxRate 字段变化执行事件
Biz.prototype.fieldChangedXTaxRate = function (dataSrc, dr, dc) {
let XTaxRate = TypeUtil.toFloat(dr['XTaxRate']);
if ((XTaxRate < 0) || (XTaxRate > 100)) {
dr.setColumnError(dc.fieldName,"销项税率应在0-100之间。");
return false;
}
return true;
};
//Price 字段变化执行事件
Biz.prototype.fieldChangedPrice = function (dataSrc, dr, dc) {
let Price = TypeUtil.toFloat(dr['Price']);
let HyPrice = TypeUtil.toFloat(dr['HyPrice']);
if (HyPrice == 0) {
dr.setColumnValue('HyPrice', Price);
}
else {
if (HyPrice > Price) {
dr.setColumnValue('HyPrice', Price);
}
}
return true;
};
//HyPrice 字段变化执行事件
Biz.prototype.fieldChangedHyPrice = function (dataSrc, dr, dc) {
let Price = TypeUtil.toFloat(dr['Price']);
let HyPrice = TypeUtil.toFloat(dr['HyPrice']);
if (HyPrice > Price) {
dr.setColumnError(dc.fieldName,"建议会员价不能大于建议零售价");
return false;
}
return true;
};
//MinThDays 字段变化执行事件
Biz.prototype.fieldChangedMinThDays = function (dataSrc, dr, dc) {
let MaxThDays = TypeUtil.toFloat(dr['MaxThDays']);
let MinThDays = TypeUtil.toFloat(dr['MinThDays']);
if ((MinThDays != 0) && (MaxThDays == 0)) {
dr.setColumnError(dc.fieldName,"退货天数上限没有填价");
return false;
}
else {
if (MaxThDays < MinThDays) {
dr.setColumnError(dc.fieldName,"退货天数上限不能小于退货天数下限");
return false;
}
}
return true;
};
//IsSelfBrand 字段变化执行事件
Biz.prototype.fieldChangedIsSelfBrand = function (dataSrc, dr, dc) {
let IsSelfBrand = TypeUtil.toString(dr['IsSelfBrand']);
if (IsSelfBrand == "9") {
if (!Store.confirm("门店开放商品系统只管理销售流水不管理库存,确定要修改?")) {
return false;
}
}
return true;
};
//IsNewPlu 字段变化执行事件
Biz.prototype.fieldChangedIsNewPlu = function (dataSrc, dr, dc) {
let IsNewPlu = TypeUtil.toString(dr['IsNewPlu']);
let OldIsNewPlu = TypeUtil.toString(dr.transData['IsNewPlu']);
if (IsNewPlu != "1") {
if (!Store.confirm("商品修改为不在季后将不能进行进货和配送业务,确定要修改?")) {
dr.setColumnValue(dc.fieldName,OldIsNewPlu);
return false;
}
}
return true;
};
//IsKc 字段变化执行事件
Biz.prototype.fieldChangedIsKc = function (dataSrc, dr, dc) {
let PluID = TypeUtil.toString(dr['PluID']);
let IsKc = TypeUtil.toString(dr['IsKc']);
let OldIsKc = TypeUtil.toString(dr.transData['IsKc']);
if ((OldIsKc == "1") && (this._state=="edit")) {
let ret= Service.getSlideMenuData("DoOnMasterCalcRule","IsKc",PluID,"","","","");
if (ret.result !== 1) {
dr.setColumnError(dc.fieldName, ret.message);
return false;
}
}
return true;
};
//ClsID 字段变化执行事件
Biz.prototype.fieldChangedClsID = function (dataSrc, dr, dc) {
//获取上次品类ID 用于校验品类品项数
OldClsID = TypeUtil.toString(dr.transData['ClsID']);
let IsSeason = TypeUtil.toString(dr['IsSeason']);
let ClsCode = TypeUtil.toFloat(dr['ClsCode']);
let ret= Service.getSlideMenuData("DoOnMasterCalcRule","USkuGetPluClsInfo",ClsCode,"","","","");
if (ret.result !== 1) {
dr.setColumnError(dc.fieldName, ret.message);
return false;
}
giIsBz = ret.data.IsBz;
dr.setColumnValue('IsExPluCode', ret.data.IsExPluCode);
if (IsSeason != ret.data.IsSeason){
dr.setColumnText('IsSeason', ret.data.IsSeason);
}
dr.setColumnValue('IsCurrDay', ret.data.IsCurrDay);
dr.setColumnValue('PromDecimal', ret.data.PromDecimal);
dr.setColumnValue('PromFormula', ret.data.PromFormula);
if (ret.data.SaleSeason == ""){
dr.setColumnText('SaleSeason', ret.data.SaleSeason);
}
return true;
};
//按钮事件控制
Biz.prototype.doOp = function (opCode) {
let self = this;
if (opCode == 'assess') {
let ds = self.dsMaster;
this.onassess(self, ds);
}
if (opCode == 'newcheck') {
let ds = self.dsMaster;
this.onnewcheck(self, ds);
}
if (opCode == 'actimport') {
let dhead = self.dsMaster;
let dbody = self.dsDetail;
this.onimportexcelpl(self, dhead,dbody);
}
}
//审批事件处理
Biz.prototype.onassess = function (biz, ds) {
let dsrow=ds.currentRow;
let ClsCode = dsrow ? TypeUtil.toString(dsrow['ClsCode']) : '';
let PluCode = dsrow ? TypeUtil.toString(dsrow['PluCode']) : '';
let BarCode = dsrow ? TypeUtil.toString(dsrow['BarCode']) : '';
let BrandCode = dsrow ? TypeUtil.toString(dsrow['BrandCode']) : '';
let PluID = dsrow ? TypeUtil.toString(dsrow['PluID']) : '';
let IsWeight = dsrow ? TypeUtil.toString(dsrow['IsWeight']) : '';
let NewBarCode = "";
let sPluYwStatus = "";
if (ClsCode == '') {
dsrow.setColumnError("ClsCode","请先设置品类!");
return false;
}
if (!Store.confirm("确定要审批此商品吗?")) {
return false;
}
if (Store.confirm("是否审批通过?")) {
if ((IS_RULE == "1") && (PluCode == "*")){
let ret= Service.getSlideMenuData("DoOnMasterCalcRule","GetNewPluCodeByRule",IsWeight,Store.logOn.orgCode,ClsCode,BrandCode,PluID);
if (ret.result !== 1) {
dsrow.setColumnError("PluCode", ret.message);
return false;
}
else {
dsrow.setColumnValue("PluCode", ret.data.PluCode);
}
}
else {
if (PluCode == "*") {
dsrow.setColumnError("ClsCode","请先输入商品编码再审批!");
return false;
}
}
if ((BarCode == "*") || (BarCode == "") || (BarCode === null)) {
if (IsWeight == "0"){
NewBarCode = rhtComm.GetBarCode(PluCode,"common");
}
else {
NewBarCode = rhtComm.GetBarCode(PluCode,"weight");
}
dsrow.setColumnText("BarCode", NewBarCode);
}
if (SKU_IsPluInfoCheck == "1") {
sPluYwStatus = "5";
}
else {
sPluYwStatus = "1";
}
}
else {
sPluYwStatus = "4";
}
let ret= Service.USkuSetPluStatus(PluID,PluCode+";"+BarCode,"0",sPluYwStatus,Store.logOn.userId,Store.logOn.userCode,Store.logOn.userName,Store.logOn.orgCode,Store.logOn.orgName);
if (ret.result !== 1) {
masterRow.setColumnError('PluCode', "审批商品时出错!"+ret.message);
return false;
}
dsrow.setColumnText("YwStatus", sPluYwStatus);
ds.save();
Store.messager.tip("审批成功!");
return true;
}
//复核事件处理
Biz.prototype.onnewcheck = function (biz, ds) {
let smsgS=UAPP.ChineseMN(新品信息复核通过);
Store.messager.tip(smsgS);
let dsrow=ds.currentRow;
let PluID = dsrow ? TypeUtil.toString(dsrow['PluID']) : '';
let smsg="您确定要复核此商品吗?复核主要内容包括:\r\n"
+"1.商品主档信息 \r\n"
+"2.根据选项“是否所有商品必须设置多包装单位”检查是否录入商品多包装单位信息 \r\n"
+"3.根据选项“新品必须启用试销流程”检查是否设置了新品试销信息 \r\n"
+"4.不启用物流中心管理的企业检查是否设置了商品库位信息";
let ret= Service.getSlideMenuData("doOpBtnExecute","newcheck",PluID,"","","");
if (ret.result !== 1) {
dsrow.setColumnError("PluCode", ret.message);
return false;
}
Store.messager.tip("新品信息复核通过,商品状态已转为正常");
dsrow.setColumnText("YwStatus", "1");
ds.save();
return true;
}
//增加右键菜单按钮并控制按钮状态
Biz.prototype.getContextMenus = function (ds, source) {
let menus = this.super("getContextMenus", ds, source)
let edit = ds.getEditable();
let curRow = this.dsMaster.currentRow;
let iRow = this.dsMaster.rows.length;
menus.push({
text: 'Exl导入商品',
opCode: 'actimport',
disabled: edit
});
return menus;
};
//导入按钮事件
Biz.prototype.onimportexcelpl= function () {
let masterRow = this.dsMaster.currentRow;
let ds = this.dsDetail;
//校验数据
if (ds.currentRow) {
if (ds.validate(Store.messager.err) === false) {
return;
}
}
if (ds.rows.length > 0){
Store.messager.err('已经录入商品,不能导入!')
return false;
}
//执行导入
let win = new XWindow({}, function (data) {
(new ExcelHelper(this.biz, ds, data,masterRow)).import(); // 处理返回的excel data数据这里的数据已经是数组包含了读取的所有数据.
});
win.open();
};
//控制主界面按钮状态
Biz.prototype.getOpEnabled = function (opCode) {
let isOk = this.super('getOpEnabled', opCode);
if (!isOk) {
return false;
}
let self = this;
let curRow = this.dsMaster.currentRow;
if (opCode == 'assess') {
if (!curRow)
return false;
if (this.isEdit())
return false;
if (Sku_IsAuditPlu != "1" )
return false;
let YwStatus = curRow ? TypeUtil.toString(curRow['YwStatus']) : '0';
let OrgType = rhtComm.GetOrgType(Store.logOn.orgCode);
if ((OrgType.message!="1001") || (YwStatus!="0")){
return false;
}
}
if (opCode == 'newcheck') {
if (!curRow)
return false;
if (this.isEdit())
return false;
if (SKU_IsPluInfoCheck != "1" )
return false;
let YwStatus = curRow ? TypeUtil.toString(curRow['YwStatus']) : '0';
let OrgType = rhtComm.GetOrgType(Store.logOn.orgCode);
if ((OrgType.message!="1001") || (YwStatus!="5")){
return false;
}
}
if (opCode == 'copyrec') {
if (!curRow)
return false;
if (this.isEdit())
return false;
if (self.getState() !== 'add') {
return false;
}
}
return true;
};
/* actAssess.Enabled := Right.IsChecked and (OperateStat = msQuery) and not FPCDSPropertyMain.Fclientdataset.IsEmpty
and (FPCDSPropertyMain.Fclientdataset.FieldByName('YwStatus').AsString = '0')
and (CurDutyCode = '1001');
//Excel导入处理 增加到当前界面明细表中
function ExcelHelper(biz, ds, data,masterRow) {
let curIndex = 0;
let excelCols = [];
this.import = function () {
};
let YhType = TypeUtil.toString(masterRow['YhType']);
let EtpCode = TypeUtil.toString(masterRow['EtpCode']);
let ret= Service.getSlideMenuData("ImportExecute","InExcel",data,YhType,Store.logOn.orgCode,EtpCode,"");
if (ret.result !== 1) {
masterRow.setColumnError('BillNo', ret.message);
return false;
}
if (ret.data != null) {
for (let i = 0; i < ret.data.length; i++) {
let dr = ds.addRow();
tmp = ret.data[i];
dr.setColumnText('PluCode', tmp['plucode']);
dr.setColumnText('SglCount', tmp['yhcount']);
dr.setColumnText('YhCount', tmp['yhcount']);
dr.setColumnText('BarCode', tmp['barcode']);
dr.setColumnText('Remark', '导入');
}
Store.messager.tip( ret.message);
}
}
*/
return Biz;
});