|
|
|
@ -2780,147 +2780,158 @@ Ext.extend(Shipping.MsOpApplyEdit, Ext.Panel, {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var bodydatas = [];
|
|
|
|
|
var cansave = true;
|
|
|
|
|
for (var i = 0; i < this.storeBodyList.getCount(); i += 1) {
|
|
|
|
|
var member = this.storeBodyList.getAt(i);
|
|
|
|
|
bodydatas.push(member);
|
|
|
|
|
if (member.data.GoodsName == "" || member.data.GoodsCode == "") {
|
|
|
|
|
cansave = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var jsonBody = ConvertRecordsToJsonAll(bodydatas);
|
|
|
|
|
var jsonDelBody = ConvertRecordsToJsonAll(this.bodyDel);
|
|
|
|
|
|
|
|
|
|
var bodyctndatas = [];
|
|
|
|
|
var cntrnostr = '';
|
|
|
|
|
var isnoctn = false;
|
|
|
|
|
for (var i = 0; i < this.storeCtnBodyList.getCount(); i += 1) {
|
|
|
|
|
var member = this.storeCtnBodyList.getAt(i);
|
|
|
|
|
var WEIGHDATE = member.data.WEIGHDATE;
|
|
|
|
|
if (WEIGHDATE != '')
|
|
|
|
|
WEIGHDATE = Ext.util.Format.date(WEIGHDATE, 'Y-m-d');
|
|
|
|
|
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 (!cansave)
|
|
|
|
|
{
|
|
|
|
|
Ext.Msg.show({ title: Zi.LAN.JingGao, msg: '商品名称和商品编码不能为空!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
|
|
var jsonBody = ConvertRecordsToJsonAll(bodydatas);
|
|
|
|
|
var jsonDelBody = ConvertRecordsToJsonAll(this.bodyDel);
|
|
|
|
|
|
|
|
|
|
var bodyctndatas = [];
|
|
|
|
|
var cntrnostr = '';
|
|
|
|
|
var isnoctn = false;
|
|
|
|
|
for (var i = 0; i < this.storeCtnBodyList.getCount(); i += 1) {
|
|
|
|
|
var member = this.storeCtnBodyList.getAt(i);
|
|
|
|
|
var WEIGHDATE = member.data.WEIGHDATE;
|
|
|
|
|
if (WEIGHDATE != '')
|
|
|
|
|
WEIGHDATE = Ext.util.Format.date(WEIGHDATE, 'Y-m-d');
|
|
|
|
|
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 == '') {
|
|
|
|
|
// isnoctn = true;
|
|
|
|
|
//}
|
|
|
|
|
bodyctndatas.push(member);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (isnoctn) {
|
|
|
|
|
if (isnoctn) {
|
|
|
|
|
|
|
|
|
|
Ext.Msg.show({ title: Zi.LAN.JingGao, msg: cntrnostr + '集装箱信息,箱型不能为空!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
|
|
|
|
|
return;
|
|
|
|
|
Ext.Msg.show({ title: Zi.LAN.JingGao, msg: cntrnostr + '集装箱信息,箱型不能为空!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (cntrnostr != '') {
|
|
|
|
|
if (cntrnostr != '') {
|
|
|
|
|
|
|
|
|
|
Ext.Msg.show({ title: Zi.LAN.JingGao, msg: cntrnostr + '箱号不正确,请录入正确箱号再保存!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
var jsonCtnBody = ConvertRecordsToJsonAll(bodyctndatas);
|
|
|
|
|
Ext.Msg.show({ title: Zi.LAN.JingGao, msg: cntrnostr + '箱号不正确,请录入正确箱号再保存!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
var jsonCtnBody = ConvertRecordsToJsonAll(bodyctndatas);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.formHead.getForm().findField('BSNO').setDisabled(false);
|
|
|
|
|
var data = this.formHead.getForm().getValues(false, false, false);
|
|
|
|
|
var data2 = this.formEdit.getForm().getValues(false, false, false);
|
|
|
|
|
var data3 = this.formEdi.getForm().getValues(false, false, false);
|
|
|
|
|
this.formHead.getForm().findField('BSNO').setDisabled(true);
|
|
|
|
|
_this=this;
|
|
|
|
|
this.formHead.getForm().findField('BSNO').setDisabled(false);
|
|
|
|
|
var data = this.formHead.getForm().getValues(false, false, false);
|
|
|
|
|
var data2 = this.formEdit.getForm().getValues(false, false, false);
|
|
|
|
|
var data3 = this.formEdi.getForm().getValues(false, false, false);
|
|
|
|
|
this.formHead.getForm().findField('BSNO').setDisabled(true);
|
|
|
|
|
_this = this;
|
|
|
|
|
|
|
|
|
|
Ext.Msg.wait('正在保存数据, 请稍侯..');
|
|
|
|
|
Ext.Ajax.request({
|
|
|
|
|
waitMsg: '正在保存数据...',
|
|
|
|
|
url: '/MvcShipping/MsOpApply/Save',
|
|
|
|
|
scope: this,
|
|
|
|
|
params: {
|
|
|
|
|
opstatus: this.opStatus,
|
|
|
|
|
data: Ext.JSON.encode(data),
|
|
|
|
|
data2: Ext.JSON.encode(data2),
|
|
|
|
|
data3: Ext.JSON.encode(data3),
|
|
|
|
|
body: jsonBody,
|
|
|
|
|
ctnbody:jsonCtnBody
|
|
|
|
|
Ext.Msg.wait('正在保存数据, 请稍侯..');
|
|
|
|
|
Ext.Ajax.request({
|
|
|
|
|
waitMsg: '正在保存数据...',
|
|
|
|
|
url: '/MvcShipping/MsOpApply/Save',
|
|
|
|
|
scope: this,
|
|
|
|
|
params: {
|
|
|
|
|
opstatus: this.opStatus,
|
|
|
|
|
data: Ext.JSON.encode(data),
|
|
|
|
|
data2: Ext.JSON.encode(data2),
|
|
|
|
|
data3: Ext.JSON.encode(data3),
|
|
|
|
|
body: jsonBody,
|
|
|
|
|
ctnbody: jsonCtnBody
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
callback: function (options, success, response) {
|
|
|
|
|
if (success) {
|
|
|
|
|
Ext.MessageBox.hide();
|
|
|
|
|
var jsonresult = Ext.JSON.decode(response.responseText);
|
|
|
|
|
if (jsonresult.Success) {
|
|
|
|
|
var returnData = jsonresult.Data;
|
|
|
|
|
this.formEdit.getForm().reset();
|
|
|
|
|
this.formEdit.getForm().setValues(returnData);
|
|
|
|
|
this.formHead.getForm().reset();
|
|
|
|
|
this.formHead.getForm().setValues(returnData);
|
|
|
|
|
this.formEdi.getForm().reset();
|
|
|
|
|
this.formEdi.getForm().setValues(returnData);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (this.opStatus == 'add') {
|
|
|
|
|
var arrNewRecords = _this.StoreList.insert(0, returnData);
|
|
|
|
|
this.editRecord = this.StoreList.getAt(0);
|
|
|
|
|
}
|
|
|
|
|
else if (this.opStatus == 'edit') {
|
|
|
|
|
var editp = Ext.create('MsOpApply', returnData);
|
|
|
|
|
|
|
|
|
|
this.editRecord.fields.each(function (field) {
|
|
|
|
|
if (field.persist) {
|
|
|
|
|
name = field.name;
|
|
|
|
|
if (name != 'id')
|
|
|
|
|
this.editRecord.set(name, editp.get(name));
|
|
|
|
|
},
|
|
|
|
|
callback: function (options, success, response) {
|
|
|
|
|
if (success) {
|
|
|
|
|
Ext.MessageBox.hide();
|
|
|
|
|
var jsonresult = Ext.JSON.decode(response.responseText);
|
|
|
|
|
if (jsonresult.Success) {
|
|
|
|
|
var returnData = jsonresult.Data;
|
|
|
|
|
this.formEdit.getForm().reset();
|
|
|
|
|
this.formEdit.getForm().setValues(returnData);
|
|
|
|
|
this.formHead.getForm().reset();
|
|
|
|
|
this.formHead.getForm().setValues(returnData);
|
|
|
|
|
this.formEdi.getForm().reset();
|
|
|
|
|
this.formEdi.getForm().setValues(returnData);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (this.opStatus == 'add') {
|
|
|
|
|
var arrNewRecords = _this.StoreList.insert(0, returnData);
|
|
|
|
|
this.editRecord = this.StoreList.getAt(0);
|
|
|
|
|
}
|
|
|
|
|
else if (this.opStatus == 'edit') {
|
|
|
|
|
var editp = Ext.create('MsOpApply', returnData);
|
|
|
|
|
|
|
|
|
|
this.editRecord.fields.each(function (field) {
|
|
|
|
|
if (field.persist) {
|
|
|
|
|
name = field.name;
|
|
|
|
|
if (name != 'id')
|
|
|
|
|
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 {
|
|
|
|
|
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
|
|
|
|
|
,
|
|
|
|
|
|
|
|
|
|