|
|
@ -2780,147 +2780,158 @@ Ext.extend(Shipping.MsOpApplyEdit, Ext.Panel, {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var bodydatas = [];
|
|
|
|
var bodydatas = [];
|
|
|
|
|
|
|
|
var cansave = true;
|
|
|
|
for (var i = 0; i < this.storeBodyList.getCount(); i += 1) {
|
|
|
|
for (var i = 0; i < this.storeBodyList.getCount(); i += 1) {
|
|
|
|
var member = this.storeBodyList.getAt(i);
|
|
|
|
var member = this.storeBodyList.getAt(i);
|
|
|
|
bodydatas.push(member);
|
|
|
|
bodydatas.push(member);
|
|
|
|
|
|
|
|
if (member.data.GoodsName == "" || member.data.GoodsCode == "") {
|
|
|
|
|
|
|
|
cansave = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var jsonBody = ConvertRecordsToJsonAll(bodydatas);
|
|
|
|
if (!cansave)
|
|
|
|
var jsonDelBody = ConvertRecordsToJsonAll(this.bodyDel);
|
|
|
|
{
|
|
|
|
|
|
|
|
Ext.Msg.show({ title: Zi.LAN.JingGao, msg: '商品名称和商品编码不能为空!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
|
|
|
|
var bodyctndatas = [];
|
|
|
|
} else {
|
|
|
|
var cntrnostr = '';
|
|
|
|
|
|
|
|
var isnoctn = false;
|
|
|
|
var jsonBody = ConvertRecordsToJsonAll(bodydatas);
|
|
|
|
for (var i = 0; i < this.storeCtnBodyList.getCount(); i += 1) {
|
|
|
|
var jsonDelBody = ConvertRecordsToJsonAll(this.bodyDel);
|
|
|
|
var member = this.storeCtnBodyList.getAt(i);
|
|
|
|
|
|
|
|
var WEIGHDATE = member.data.WEIGHDATE;
|
|
|
|
var bodyctndatas = [];
|
|
|
|
if (WEIGHDATE != '')
|
|
|
|
var cntrnostr = '';
|
|
|
|
WEIGHDATE = Ext.util.Format.date(WEIGHDATE, 'Y-m-d');
|
|
|
|
var isnoctn = false;
|
|
|
|
member.data.WEIGHDATE = WEIGHDATE;
|
|
|
|
for (var i = 0; i < this.storeCtnBodyList.getCount(); i += 1) {
|
|
|
|
var cntrno = member.data.CNTRNO;
|
|
|
|
var member = this.storeCtnBodyList.getAt(i);
|
|
|
|
if (cntrno != '') {
|
|
|
|
var WEIGHDATE = member.data.WEIGHDATE;
|
|
|
|
var iscn = cntrno.match(/^[a-zA-Z]{4}[0-9]{7}$/);
|
|
|
|
if (WEIGHDATE != '')
|
|
|
|
if (iscn == null) {
|
|
|
|
WEIGHDATE = Ext.util.Format.date(WEIGHDATE, 'Y-m-d');
|
|
|
|
cntrnostr = cntrnostr + cntrno + ',';
|
|
|
|
member.data.WEIGHDATE = WEIGHDATE;
|
|
|
|
|
|
|
|
var cntrno = member.data.CNTRNO;
|
|
|
|
|
|
|
|
if (cntrno != '') {
|
|
|
|
|
|
|
|
var iscn = cntrno.match(/^[a-zA-Z]{4}[0-9]{7}$/);
|
|
|
|
|
|
|
|
if (iscn == null) {
|
|
|
|
|
|
|
|
cntrnostr = cntrnostr + cntrno + ',';
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//if (member.data.CTNALL == '') {
|
|
|
|
|
|
|
|
// isnoctn = true;
|
|
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
bodyctndatas.push(member);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//if (member.data.CTNALL == '') {
|
|
|
|
if (isnoctn) {
|
|
|
|
// isnoctn = true;
|
|
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
bodyctndatas.push(member);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (isnoctn) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Ext.Msg.show({ title: Zi.LAN.JingGao, msg: cntrnostr + '集装箱信息,箱型不能为空!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
|
|
|
|
Ext.Msg.show({ title: Zi.LAN.JingGao, msg: cntrnostr + '集装箱信息,箱型不能为空!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (cntrnostr != '') {
|
|
|
|
if (cntrnostr != '') {
|
|
|
|
|
|
|
|
|
|
|
|
Ext.Msg.show({ title: Zi.LAN.JingGao, msg: cntrnostr + '箱号不正确,请录入正确箱号再保存!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
|
|
|
|
Ext.Msg.show({ title: Zi.LAN.JingGao, msg: cntrnostr + '箱号不正确,请录入正确箱号再保存!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
var jsonCtnBody = ConvertRecordsToJsonAll(bodyctndatas);
|
|
|
|
var jsonCtnBody = ConvertRecordsToJsonAll(bodyctndatas);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.formHead.getForm().findField('BSNO').setDisabled(false);
|
|
|
|
this.formHead.getForm().findField('BSNO').setDisabled(false);
|
|
|
|
var data = this.formHead.getForm().getValues(false, false, false);
|
|
|
|
var data = this.formHead.getForm().getValues(false, false, false);
|
|
|
|
var data2 = this.formEdit.getForm().getValues(false, false, false);
|
|
|
|
var data2 = this.formEdit.getForm().getValues(false, false, false);
|
|
|
|
var data3 = this.formEdi.getForm().getValues(false, false, false);
|
|
|
|
var data3 = this.formEdi.getForm().getValues(false, false, false);
|
|
|
|
this.formHead.getForm().findField('BSNO').setDisabled(true);
|
|
|
|
this.formHead.getForm().findField('BSNO').setDisabled(true);
|
|
|
|
_this=this;
|
|
|
|
_this = this;
|
|
|
|
|
|
|
|
|
|
|
|
Ext.Msg.wait('正在保存数据, 请稍侯..');
|
|
|
|
Ext.Msg.wait('正在保存数据, 请稍侯..');
|
|
|
|
Ext.Ajax.request({
|
|
|
|
Ext.Ajax.request({
|
|
|
|
waitMsg: '正在保存数据...',
|
|
|
|
waitMsg: '正在保存数据...',
|
|
|
|
url: '/MvcShipping/MsOpApply/Save',
|
|
|
|
url: '/MvcShipping/MsOpApply/Save',
|
|
|
|
scope: this,
|
|
|
|
scope: this,
|
|
|
|
params: {
|
|
|
|
params: {
|
|
|
|
opstatus: this.opStatus,
|
|
|
|
opstatus: this.opStatus,
|
|
|
|
data: Ext.JSON.encode(data),
|
|
|
|
data: Ext.JSON.encode(data),
|
|
|
|
data2: Ext.JSON.encode(data2),
|
|
|
|
data2: Ext.JSON.encode(data2),
|
|
|
|
data3: Ext.JSON.encode(data3),
|
|
|
|
data3: Ext.JSON.encode(data3),
|
|
|
|
body: jsonBody,
|
|
|
|
body: jsonBody,
|
|
|
|
ctnbody:jsonCtnBody
|
|
|
|
ctnbody: jsonCtnBody
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
callback: function (options, success, response) {
|
|
|
|
callback: function (options, success, response) {
|
|
|
|
if (success) {
|
|
|
|
if (success) {
|
|
|
|
Ext.MessageBox.hide();
|
|
|
|
Ext.MessageBox.hide();
|
|
|
|
var jsonresult = Ext.JSON.decode(response.responseText);
|
|
|
|
var jsonresult = Ext.JSON.decode(response.responseText);
|
|
|
|
if (jsonresult.Success) {
|
|
|
|
if (jsonresult.Success) {
|
|
|
|
var returnData = jsonresult.Data;
|
|
|
|
var returnData = jsonresult.Data;
|
|
|
|
this.formEdit.getForm().reset();
|
|
|
|
this.formEdit.getForm().reset();
|
|
|
|
this.formEdit.getForm().setValues(returnData);
|
|
|
|
this.formEdit.getForm().setValues(returnData);
|
|
|
|
this.formHead.getForm().reset();
|
|
|
|
this.formHead.getForm().reset();
|
|
|
|
this.formHead.getForm().setValues(returnData);
|
|
|
|
this.formHead.getForm().setValues(returnData);
|
|
|
|
this.formEdi.getForm().reset();
|
|
|
|
this.formEdi.getForm().reset();
|
|
|
|
this.formEdi.getForm().setValues(returnData);
|
|
|
|
this.formEdi.getForm().setValues(returnData);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (this.opStatus == 'add') {
|
|
|
|
if (this.opStatus == 'add') {
|
|
|
|
var arrNewRecords = _this.StoreList.insert(0, returnData);
|
|
|
|
var arrNewRecords = _this.StoreList.insert(0, returnData);
|
|
|
|
this.editRecord = this.StoreList.getAt(0);
|
|
|
|
this.editRecord = this.StoreList.getAt(0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (this.opStatus == 'edit') {
|
|
|
|
else if (this.opStatus == 'edit') {
|
|
|
|
var editp = Ext.create('MsOpApply', returnData);
|
|
|
|
var editp = Ext.create('MsOpApply', returnData);
|
|
|
|
|
|
|
|
|
|
|
|
this.editRecord.fields.each(function (field) {
|
|
|
|
this.editRecord.fields.each(function (field) {
|
|
|
|
if (field.persist) {
|
|
|
|
if (field.persist) {
|
|
|
|
name = field.name;
|
|
|
|
name = field.name;
|
|
|
|
if (name != 'id')
|
|
|
|
if (name != 'id')
|
|
|
|
this.editRecord.set(name, editp.get(name));
|
|
|
|
this.editRecord.set(name, editp.get(name));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}, this);
|
|
|
|
|
|
|
|
this.editRecord.commit();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (type == '0') {
|
|
|
|
|
|
|
|
this.opStatus = 'edit';
|
|
|
|
|
|
|
|
basicForm2.findField('BSNO').setDisabled(true);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (var j = 0; j < this.storeBodyList.getCount(); j += 1) {
|
|
|
|
|
|
|
|
var memberbody = this.storeBodyList.getAt(j);
|
|
|
|
|
|
|
|
memberbody.set("BSNO", this.editRecord.get('BSNO'));
|
|
|
|
|
|
|
|
memberbody.commit();
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
for (var j = 0; j < this.storeCtnBodyList.getCount(); j += 1) {
|
|
|
|
|
|
|
|
var memberbody = this.storeCtnBodyList.getAt(j);
|
|
|
|
|
|
|
|
memberbody.set("BSNO", this.editRecord.get('BSNO'));
|
|
|
|
|
|
|
|
memberbody.commit();
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
this.LoadPeriodStatus(this.opStatus);
|
|
|
|
|
|
|
|
if (returnData.WMSNO != '') {
|
|
|
|
|
|
|
|
this.storeListWmsIn.load({ params: { wmsno: returnData.WMSNO } });
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else this.storeListWmsIn.load({ params: { wmsno: '' } });
|
|
|
|
|
|
|
|
if (returnData.MBLNO != '') {
|
|
|
|
|
|
|
|
this.storeListBsCustomNo.load({ params: { constr: " MBLNO='" + returnData.MBLNO + "' AND BSNO<>'" + returnData.BSNO + "'" } });
|
|
|
|
|
|
|
|
this.storeListWmsNo.load({ params: { constr: " w.BLNO='" + returnData.MBLNO + "'" } });
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}, this);
|
|
|
|
|
|
|
|
this.editRecord.commit();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (type == '0') {
|
|
|
|
|
|
|
|
this.opStatus = 'edit';
|
|
|
|
|
|
|
|
basicForm2.findField('BSNO').setDisabled(true);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (var j = 0; j < this.storeBodyList.getCount(); j += 1) {
|
|
|
|
|
|
|
|
var memberbody = this.storeBodyList.getAt(j);
|
|
|
|
|
|
|
|
memberbody.set("BSNO", this.editRecord.get('BSNO'));
|
|
|
|
|
|
|
|
memberbody.commit();
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
for (var j = 0; j < this.storeCtnBodyList.getCount(); j += 1) {
|
|
|
|
|
|
|
|
var memberbody = this.storeCtnBodyList.getAt(j);
|
|
|
|
|
|
|
|
memberbody.set("BSNO", this.editRecord.get('BSNO'));
|
|
|
|
|
|
|
|
memberbody.commit();
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
this.LoadPeriodStatus(this.opStatus);
|
|
|
|
|
|
|
|
if (returnData.WMSNO != '') {
|
|
|
|
|
|
|
|
this.storeListWmsIn.load({ params: { wmsno: returnData.WMSNO} });
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else this.storeListWmsIn.load({ params: { wmsno:''} });
|
|
|
|
|
|
|
|
if (returnData.MBLNO!=''){
|
|
|
|
|
|
|
|
this.storeListBsCustomNo.load({ params: { constr:" MBLNO='"+returnData.MBLNO+"' AND BSNO<>'"+returnData.BSNO+"'" }});
|
|
|
|
|
|
|
|
this.storeListWmsNo.load({ params: { constr:" w.BLNO='"+returnData.MBLNO+"'" }});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else if (type == '1') {
|
|
|
|
|
|
|
|
window.close();
|
|
|
|
|
|
|
|
} else if (type == '2') {
|
|
|
|
|
|
|
|
this.LoadData('add', '');
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else if (type == '1') {
|
|
|
|
|
|
|
|
window.close();
|
|
|
|
|
|
|
|
} else if (type == '2') {
|
|
|
|
|
|
|
|
this.LoadData('add', '');
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
|
|
|
|
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
|
|
|
|
Ext.Msg.show({
|
|
|
|
|
|
|
|
title: '请重试',
|
|
|
|
|
|
|
|
msg: '服务器响应出错',
|
|
|
|
|
|
|
|
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
|
|
|
|
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
|
|
|
|
Ext.Msg.show({ title: '请重试',
|
|
|
|
|
|
|
|
msg: '服务器响应出错',
|
|
|
|
|
|
|
|
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
} //end save
|
|
|
|
} //end save
|
|
|
|
,
|
|
|
|
,
|
|
|
|
|
|
|
|
|
|
|
|