|
|
|
|
///<reference path="../../../../Views/../TruckMng/Scripts/vswd-ext_2.0.2.js" />
|
|
|
|
|
Ext.namespace('DsTruck');
|
|
|
|
|
|
|
|
|
|
var C_cargoinfo_id="";
|
|
|
|
|
var HTHCount=0;
|
|
|
|
|
var APPUsingCount=0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DsTruck.MsOpAirn_RECEIPTWMSEdit = function (config) {
|
|
|
|
|
Ext.applyIf(this, config);
|
|
|
|
|
this.initUIComponents();
|
|
|
|
|
window.DsTruck.MsOpAirn_RECEIPTWMSEdit.superclass.constructor.call(this);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
Date.prototype.format = function (format) {
|
|
|
|
|
var o = {
|
|
|
|
|
"M+": this.getMonth() + 1, //month
|
|
|
|
|
"d+": this.getDate(), //day
|
|
|
|
|
"h+": this.getHours(), //hour
|
|
|
|
|
"m+": this.getMinutes(), //minute
|
|
|
|
|
"s+": this.getSeconds(), //second
|
|
|
|
|
"q+": Math.floor((this.getMonth() + 3) / 3), //quarter
|
|
|
|
|
"S": this.getMilliseconds() //millisecond
|
|
|
|
|
}
|
|
|
|
|
if (/(y+)/.test(format)) format = format.replace(RegExp.$1,
|
|
|
|
|
(this.getFullYear() + "").substr(4 - RegExp.$1.length));
|
|
|
|
|
for (var k in o) if (new RegExp("(" + k + ")").test(format))
|
|
|
|
|
format = format.replace(RegExp.$1,
|
|
|
|
|
RegExp.$1.length == 1 ? o[k] :
|
|
|
|
|
("00" + o[k]).substr(("" + o[k]).length));
|
|
|
|
|
return format;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var xhr = new XMLHttpRequest();
|
|
|
|
|
var currdate = new Date();
|
|
|
|
|
if (!xhr) {
|
|
|
|
|
//...其他生成xmlhttprequest方法
|
|
|
|
|
}
|
|
|
|
|
xhr.open("HEAD", location.href, true);
|
|
|
|
|
xhr.onreadystatechange = function () {
|
|
|
|
|
if (xhr.readyState == 4 && xhr.status == 200) {
|
|
|
|
|
var datestr = xhr.getResponseHeader("Date");
|
|
|
|
|
currdate = new Date(datestr);
|
|
|
|
|
// alert(currdate.format('yyyy-MM-dd'));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
xhr.send(null);
|
|
|
|
|
|
|
|
|
|
function getSaved(){
|
|
|
|
|
var cargodirty = DsTruck.GetDirty(panelEdit.storeDetail, panelEdit.DetailDel);
|
|
|
|
|
|
|
|
|
|
if (panelEdit.formEdit.getForm().isDirty()== true || cargodirty==true)
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
else return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Ext.extend(DsTruck.MsOpAirn_RECEIPTWMSEdit, Ext.Panel, {
|
|
|
|
|
parentWin: null,
|
|
|
|
|
OpStatus: 'add',
|
|
|
|
|
StoreList: null,
|
|
|
|
|
editRecord: null,
|
|
|
|
|
// parentfunction: null,
|
|
|
|
|
_First: true,
|
|
|
|
|
PLAN_GID: "",
|
|
|
|
|
AIRLINES: "",
|
|
|
|
|
|
|
|
|
|
initUIComponents: function () {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.DetailDel = [];
|
|
|
|
|
|
|
|
|
|
this.feeSerialNo = 0;
|
|
|
|
|
this.feeBodyDel = [];
|
|
|
|
|
this.DetailListName = "Airn_RECEIPTDetail";
|
|
|
|
|
|
|
|
|
|
this.FactoryNo = "";
|
|
|
|
|
|
|
|
|
|
//#region 枚举参照相关(编辑form)
|
|
|
|
|
|
|
|
|
|
var _this = this;
|
|
|
|
|
this.storeSeller = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
|
|
model: 'Tradermb',
|
|
|
|
|
proxy: { url: '/CommMng/BasicDataRef/GetTrader' }
|
|
|
|
|
});
|
|
|
|
|
this.storeSeller.load({ params: { condition: " isairlines=1"} });
|
|
|
|
|
this.comboxSeller = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
|
|
fieldLabel: '结算对象',
|
|
|
|
|
forceSelection: true,
|
|
|
|
|
store: this.storeSeller,
|
|
|
|
|
name: 'CUSTOMERNAME',
|
|
|
|
|
valueField: 'name',
|
|
|
|
|
displayField: 'codename',
|
|
|
|
|
listeners: {
|
|
|
|
|
blur: function (field, newValue, oldValue) {
|
|
|
|
|
if (field.displayTplData[0].ISSTOP == "True") {
|
|
|
|
|
alert("该往来单位已经停用");
|
|
|
|
|
}
|
|
|
|
|
Ext.getCmp("CUSTOMERNAME").setValue(field.displayTplData[0].name);
|
|
|
|
|
if (field.displayTplData[0].code != "") {
|
|
|
|
|
//_this.storeDetailName.load({ params: { start: 0, limit: 9999, condition: " CLIENTGID=(select gid from info_client where codename='" + field.displayTplData[0].code + "') "} });
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
scope: this
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.storeUser = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
|
|
model: 'DsTruckMng.ux.UserRefModel',
|
|
|
|
|
proxy: { url: '/CommMng/BasicDataRef/GetUserRefList' }
|
|
|
|
|
});
|
|
|
|
|
this.storeUser.load({ params: { condition: ""} });
|
|
|
|
|
this.comboxCreator = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
|
|
fieldLabel: '接单人',
|
|
|
|
|
forceSelection: true,
|
|
|
|
|
store: this.storeUser,
|
|
|
|
|
name: 'creator',
|
|
|
|
|
valueField: 'UserName',
|
|
|
|
|
displayField: 'CodeAndName',
|
|
|
|
|
allowBlank: false
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
this.storeOP = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
|
|
model: 'DsTruckMng.ux.UserRefModel',
|
|
|
|
|
proxy: { url: '/CommMng/BasicDataRef/GetUserRefList' }
|
|
|
|
|
});
|
|
|
|
|
this.storeOP.load({ params: { condition: ""} });
|
|
|
|
|
this.comboxOP = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
|
|
fieldLabel: '录入人',
|
|
|
|
|
forceSelection: true,
|
|
|
|
|
store: this.storeOP,
|
|
|
|
|
name: 'OP',
|
|
|
|
|
valueField: 'UserName',
|
|
|
|
|
displayField: 'CodeAndName'
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
this.storeBLTYPE = Ext.create('DsExt.ux.RefEnumStore', {});
|
|
|
|
|
this.storeBLTYPE.load({ params: { enumTypeId: 38} });
|
|
|
|
|
this.comboxBLTYPE = Ext.create('DsExt.ux.RefEnumCombox', {
|
|
|
|
|
fieldLabel: '运单类型',
|
|
|
|
|
forceSelection: true,
|
|
|
|
|
store: this.storeBLTYPE,
|
|
|
|
|
valueField: 'EnumValueName',
|
|
|
|
|
displayField: 'EnumValueName',
|
|
|
|
|
name: 'BLTYPE'
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//#endregion
|
|
|
|
|
|
|
|
|
|
//编辑form:formEdit
|
|
|
|
|
this.formEdit = Ext.widget('form', {
|
|
|
|
|
// layout: "border",
|
|
|
|
|
region: 'center',
|
|
|
|
|
frame: true,
|
|
|
|
|
bodyPadding: 5,
|
|
|
|
|
trackResetOnLoad: true, //不加的话load之后isdirty即变为true
|
|
|
|
|
fieldDefaults: {
|
|
|
|
|
margins: '2 2 2 2',
|
|
|
|
|
labelAlign: 'right',
|
|
|
|
|
flex: 1,
|
|
|
|
|
labelWidth: 90,
|
|
|
|
|
msgTarget: 'qtip'
|
|
|
|
|
//,split:true
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
items: [
|
|
|
|
|
{//fieldset 1
|
|
|
|
|
xtype: 'fieldset',
|
|
|
|
|
defaultType: 'textfield',
|
|
|
|
|
layout: 'anchor',
|
|
|
|
|
defaults: {
|
|
|
|
|
anchor: '100%'
|
|
|
|
|
},
|
|
|
|
|
items: [{
|
|
|
|
|
xtype: 'container',
|
|
|
|
|
layout: 'hbox',
|
|
|
|
|
defaultType: 'textfield',
|
|
|
|
|
items: [{
|
|
|
|
|
fieldLabel: 'GID',
|
|
|
|
|
hidden: true,
|
|
|
|
|
name: 'GID'
|
|
|
|
|
}
|
|
|
|
|
, this.comboxSeller
|
|
|
|
|
, {
|
|
|
|
|
fieldLabel: '票证类型',
|
|
|
|
|
allowBlank: false,
|
|
|
|
|
name: 'RTYPE',
|
|
|
|
|
flex: 1
|
|
|
|
|
}, {
|
|
|
|
|
fieldLabel: '前缀',
|
|
|
|
|
allowBlank: false,
|
|
|
|
|
xtype: 'textfield',
|
|
|
|
|
name: 'FIRSTCODE',
|
|
|
|
|
flex: 1
|
|
|
|
|
}, {
|
|
|
|
|
fieldLabel: '时间戳',
|
|
|
|
|
name: 'TimeMark', flex: 0, hidden: true, margins: '0'
|
|
|
|
|
}, {
|
|
|
|
|
fieldLabel: 'DEPTGID',
|
|
|
|
|
name: 'DEPTGID', flex: 0, hidden: true, margins: '0'
|
|
|
|
|
}, { xtype: 'hiddenfield', flex: 1 }
|
|
|
|
|
]
|
|
|
|
|
}, //container_1 end
|
|
|
|
|
{
|
|
|
|
|
xtype: 'container',
|
|
|
|
|
layout: 'hbox',
|
|
|
|
|
defaultType: 'textfield',
|
|
|
|
|
items: [
|
|
|
|
|
{
|
|
|
|
|
xtype: 'container',
|
|
|
|
|
layout: 'hbox',
|
|
|
|
|
flex: 1,
|
|
|
|
|
defaultType: 'textfield',
|
|
|
|
|
items: [{
|
|
|
|
|
fieldLabel: '开始编号',
|
|
|
|
|
xtype: 'textfield',
|
|
|
|
|
name: 'STARTNO',
|
|
|
|
|
flex: 8,
|
|
|
|
|
listeners: {
|
|
|
|
|
blur: function (field, eOpts) {
|
|
|
|
|
if (parseFloat(field.lastValue) != "NaN") {
|
|
|
|
|
|
|
|
|
|
//if (field.lastValue != "") {
|
|
|
|
|
this.MakeNo("start");
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
change: function (field, newValue, oldValue) {
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
scope: this
|
|
|
|
|
}
|
|
|
|
|
}, { name: 'WH1', id: "WH1", value: "0", flex: 1, readOnly: true }
|
|
|
|
|
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
, {
|
|
|
|
|
xtype: 'container',
|
|
|
|
|
layout: 'hbox',
|
|
|
|
|
flex: 1,
|
|
|
|
|
defaultType: 'textfield',
|
|
|
|
|
items: [{
|
|
|
|
|
fieldLabel: '结束编号',
|
|
|
|
|
xtype: 'textfield',
|
|
|
|
|
name: 'ENDNO',
|
|
|
|
|
flex: 8,
|
|
|
|
|
listeners: {
|
|
|
|
|
blur: function (field, eOpts) {
|
|
|
|
|
if (parseFloat(field.lastValue) != "NaN") {
|
|
|
|
|
this.MakeNo("end");
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
change: function (field, newValue, oldValue) {
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
scope: this
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
, { name: 'WH2', id: "WH2", value: "0", flex: 1, readOnly: true }
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
, {
|
|
|
|
|
fieldLabel: '数量',
|
|
|
|
|
xtype: 'numberfield',
|
|
|
|
|
name: 'RCOUNT',
|
|
|
|
|
flex: 1,
|
|
|
|
|
listeners: {
|
|
|
|
|
blur: function (field, eOpts) {
|
|
|
|
|
if (parseFloat(field.lastValue) != "NaN") {
|
|
|
|
|
this.MakeNo("count");
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
change: function (field, newValue, oldValue) {
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
scope: this
|
|
|
|
|
}
|
|
|
|
|
}, {
|
|
|
|
|
xtype: 'checkbox', flex: 1,
|
|
|
|
|
fieldLabel: '是否包仓单',
|
|
|
|
|
name: 'ISBAOCANG'
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
xtype: 'container',
|
|
|
|
|
layout: 'hbox',
|
|
|
|
|
defaultType: 'textfield',
|
|
|
|
|
items: [
|
|
|
|
|
this.comboxOP
|
|
|
|
|
, {
|
|
|
|
|
fieldLabel: '入库时间',
|
|
|
|
|
format: 'Y-m-d H:i:s',
|
|
|
|
|
xtype: 'datefield',
|
|
|
|
|
renderer: Ext.util.Format.dateRenderer('Y-m-d H:i:s'),
|
|
|
|
|
name: 'OPDATE'
|
|
|
|
|
}, { xtype: 'hiddenfield', flex: 2 }
|
|
|
|
|
]
|
|
|
|
|
}, {
|
|
|
|
|
xtype: 'container',
|
|
|
|
|
layout: 'hbox',
|
|
|
|
|
defaultType: 'textfield',
|
|
|
|
|
items: [
|
|
|
|
|
////
|
|
|
|
|
]
|
|
|
|
|
}, {
|
|
|
|
|
xtype: 'container',
|
|
|
|
|
layout: 'hbox',
|
|
|
|
|
defaultType: 'textfield',
|
|
|
|
|
items: [
|
|
|
|
|
////
|
|
|
|
|
]
|
|
|
|
|
}, {
|
|
|
|
|
xtype: 'container',
|
|
|
|
|
layout: 'hbox',
|
|
|
|
|
defaultType: 'textfield',
|
|
|
|
|
items: [
|
|
|
|
|
////
|
|
|
|
|
]
|
|
|
|
|
}, {
|
|
|
|
|
xtype: 'container',
|
|
|
|
|
layout: 'hbox',
|
|
|
|
|
defaultType: 'textfield',
|
|
|
|
|
items: [
|
|
|
|
|
////
|
|
|
|
|
]
|
|
|
|
|
}, {
|
|
|
|
|
xtype: 'container',
|
|
|
|
|
layout: 'hbox',
|
|
|
|
|
defaultType: 'textfield',
|
|
|
|
|
items: [
|
|
|
|
|
|
|
|
|
|
////
|
|
|
|
|
]
|
|
|
|
|
}]
|
|
|
|
|
}]
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
//////////////////////////////////
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//#region 方案明细
|
|
|
|
|
//#region 相关参照
|
|
|
|
|
this.storeDetailinfo = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
|
|
model: 'CargoTax',
|
|
|
|
|
proxy: { url: '/CommMng/BasicDataRef/GetCargoTax' }
|
|
|
|
|
});
|
|
|
|
|
// this.storeDetailinfo.load({ params: { condition: ""} });
|
|
|
|
|
this.comboxCargoinfo = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
|
|
store: this.storeDetailinfo,
|
|
|
|
|
forceSelection: true,
|
|
|
|
|
name: 'Cargoinfo_id',
|
|
|
|
|
valueField: 'id',
|
|
|
|
|
displayField: 'codeandname'
|
|
|
|
|
//HS代码
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
this.storeDetailciq = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
|
|
model: 'CargociqRef',
|
|
|
|
|
proxy: { url: '/CommMng/BasicDataRef/GetCargociqRefList' }
|
|
|
|
|
});
|
|
|
|
|
//this.storeDetailciq.load({ params: { condition: ""} });
|
|
|
|
|
this.comboxCargociq = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
|
|
store: this.storeDetailciq,
|
|
|
|
|
forceSelection: true,
|
|
|
|
|
name: 'Cargociq_id',
|
|
|
|
|
valueField: 'id',
|
|
|
|
|
displayField: 'codeandname',
|
|
|
|
|
async: false
|
|
|
|
|
//ciq代码
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
///币别代码币别
|
|
|
|
|
this.storecurr = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
|
|
model: 'currRef',
|
|
|
|
|
proxy: { url: '/CommMng/BasicDataRef/GetcurrRefList' }
|
|
|
|
|
});
|
|
|
|
|
this.storecurr.load({ params: { condition: ""} });
|
|
|
|
|
this.comboxcurr = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
|
|
store: this.storecurr,
|
|
|
|
|
name: 'currid',
|
|
|
|
|
valueField: 'gid',
|
|
|
|
|
displayField: 'codename'
|
|
|
|
|
//币别
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//枚举参照
|
|
|
|
|
this.storeUnit = Ext.create('DsExt.ux.RefEnumStore', {});
|
|
|
|
|
this.storeUnit.load({ params: { enumTypeId: 11} });
|
|
|
|
|
this.comboxUnit = Ext.create('DsExt.ux.RefEnumCombox', {
|
|
|
|
|
store: this.storeUnit,
|
|
|
|
|
forceSelection: true,
|
|
|
|
|
name: 'Unit'
|
|
|
|
|
, value: '2'
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
this.storepaypart = Ext.create('DsExt.ux.RefEnumStore', {});
|
|
|
|
|
this.storepaypart.load({ params: { enumTypeId: 12} });
|
|
|
|
|
this.comboxpaypart = Ext.create('DsExt.ux.RefEnumCombox', {
|
|
|
|
|
store: this.storepaypart,
|
|
|
|
|
forceSelection: true,
|
|
|
|
|
name: 'paypart'
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
this.storeExporter = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
|
|
model: 'Tradermb',
|
|
|
|
|
proxy: { url: '/CommMng/BasicDataRef/GetTrader' }
|
|
|
|
|
});
|
|
|
|
|
this.storeExporter.load({ params: { condition: " isenterp=1 and isnull(ISSTOP,0)=0 "} });
|
|
|
|
|
this.comboxExporter = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
|
|
//fieldLabel: '出口商',
|
|
|
|
|
//forceSelection: true,
|
|
|
|
|
store: this.storeExporter,
|
|
|
|
|
name: 'Exporter',
|
|
|
|
|
valueField: 'name',
|
|
|
|
|
displayField: 'codename'
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.storeDetailName = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
|
|
model: 'CargoNamemb',
|
|
|
|
|
proxy: { url: '/Import/CargoName/GetCargoNameList' }
|
|
|
|
|
});
|
|
|
|
|
//this.storeDetailName.load({ params: { start: 0, limit: 9999, condition: " isnull(codename,'')<>'' "} });
|
|
|
|
|
this.comboxCargoName = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
|
|
//fieldLabel: '出口商',
|
|
|
|
|
//forceSelection: true,
|
|
|
|
|
store: this.storeDetailName,
|
|
|
|
|
name: 'CARGOGID',
|
|
|
|
|
valueField: 'GID',
|
|
|
|
|
displayField: 'CODEandNAME'
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.storeDetailType = Ext.create('DsExt.ux.RefEnumStore', {});
|
|
|
|
|
this.storeDetailType.load({ params: { enumTypeId: 30} });
|
|
|
|
|
this.comboxCargoType = Ext.create('DsExt.ux.RefEnumCombox', {
|
|
|
|
|
store: this.storeDetailType,
|
|
|
|
|
forceSelection: true,
|
|
|
|
|
name: 'CargoType',
|
|
|
|
|
valueField: 'EnumValueName',
|
|
|
|
|
displayField: 'EnumValueName'
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
//商品规格 20160420
|
|
|
|
|
this.storeSPECIFICATIONS = Ext.create('DsExt.ux.RefEnumStore', {});
|
|
|
|
|
this.storeSPECIFICATIONS.load({ params: { enumTypeId: 34} });
|
|
|
|
|
this.comboxSPECIFICATIONS = Ext.create('DsExt.ux.RefEnumCombox', {
|
|
|
|
|
store: this.storeSPECIFICATIONS,
|
|
|
|
|
forceSelection: true,
|
|
|
|
|
name: 'SPECIFICATIONS',
|
|
|
|
|
valueField: 'EnumValueName',
|
|
|
|
|
displayField: 'EnumValueName'
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
this.storeCodeDisport = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
|
|
model: 'DsShipping.ux.MsCodeAirPort',
|
|
|
|
|
proxy: { url: '/MvcShipping/MsCodeAirPort/GetDataList' }
|
|
|
|
|
});
|
|
|
|
|
this.storeCodeDisport.load();
|
|
|
|
|
this.storeCodeDisport2 = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
|
|
model: 'DsShipping.ux.MsCodeAirPort',
|
|
|
|
|
proxy: { url: '/MvcShipping/MsCodeAirPort/GetDataList' }
|
|
|
|
|
});
|
|
|
|
|
this.storeCodeDisport2.load();
|
|
|
|
|
|
|
|
|
|
this.comboxPORTLOADID = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
|
|
//fieldLabel: '始发地',
|
|
|
|
|
store: this.storeCodeDisport,
|
|
|
|
|
name: 'PORTLOADID',
|
|
|
|
|
valueField: 'PORTID',
|
|
|
|
|
displayField: 'CODEANDCNAME'/*,
|
|
|
|
|
listeners: {
|
|
|
|
|
scope: this,
|
|
|
|
|
'select': function (combo, records, eOpts) {
|
|
|
|
|
if (records.length > 0) {
|
|
|
|
|
var selectrecords = DsStoreQueryBy(this.storeCodeDisport, 'PORTID', combo.value);
|
|
|
|
|
if (selectrecords.getCount() > 0) {
|
|
|
|
|
var selectdata = selectrecords.getAt(0).data;
|
|
|
|
|
this.formEdit.getForm().findField('PORTLOAD').setValue(selectdata.PORTENAME);
|
|
|
|
|
} else {
|
|
|
|
|
this.formEdit.getForm().findField('PORTLOAD').setValue('');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}*/
|
|
|
|
|
});
|
|
|
|
|
this.comboxPORTDISCHARGEID = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
|
|
//fieldLabel: '到达地',
|
|
|
|
|
store: this.storeCodeDisport2,
|
|
|
|
|
name: 'PORTDISCHARGEID',
|
|
|
|
|
valueField: 'PORTID',
|
|
|
|
|
displayField: 'CODEANDCNAME'
|
|
|
|
|
});
|
|
|
|
|
//#endregion
|
|
|
|
|
|
|
|
|
|
//#region 领用子窗口
|
|
|
|
|
this.storeOP = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
|
|
model: 'DsTruckMng.ux.UserRefModel',
|
|
|
|
|
proxy: { url: '/CommMng/BasicDataRef/GetUserRefList' }
|
|
|
|
|
});
|
|
|
|
|
this.storeOP.load({ params: { condition: "(ISDELETED=0 and ISDISABLE=0)"} });
|
|
|
|
|
this.comboxOP = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
|
|
fieldLabel: '操作人',
|
|
|
|
|
forceSelection: true,
|
|
|
|
|
store: this.storeOP,
|
|
|
|
|
name: 'OP', id: "DOOP",
|
|
|
|
|
valueField: 'UserName',
|
|
|
|
|
displayField: 'CodeAndName'
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
this.formSTORAGE = Ext.widget('form', {
|
|
|
|
|
frame: true,
|
|
|
|
|
region: 'center',
|
|
|
|
|
bodyPadding: 5,
|
|
|
|
|
fieldDefaults: {
|
|
|
|
|
margins: '2 2 2 2',
|
|
|
|
|
labelAlign: 'right',
|
|
|
|
|
flex: 1,
|
|
|
|
|
labelWidth: 90,
|
|
|
|
|
msgTarget: 'qtip'
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
items: [
|
|
|
|
|
{
|
|
|
|
|
xtype: "label",
|
|
|
|
|
height: 20,
|
|
|
|
|
text: "请选择领取人:"
|
|
|
|
|
},
|
|
|
|
|
this.comboxOP
|
|
|
|
|
,
|
|
|
|
|
{
|
|
|
|
|
fieldLabel: '操作日期', id: "WMSDATE", hidden: true,
|
|
|
|
|
format: 'Y-m-d',
|
|
|
|
|
xtype: 'datefield',
|
|
|
|
|
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
|
|
|
|
|
name: 'WMSDATE',
|
|
|
|
|
listeners: {
|
|
|
|
|
change: function (field, eOpts) {
|
|
|
|
|
|
|
|
|
|
if (field.lastValue != "") {
|
|
|
|
|
|
|
|
|
|
//this.formHead.getForm().findField('STOCKDATE_1').setValue(field.rawValue);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
scope: this
|
|
|
|
|
}
|
|
|
|
|
}]
|
|
|
|
|
});
|
|
|
|
|
me = this;
|
|
|
|
|
this.winSTORAGEShow = Ext.create('Ext.window.Window', {
|
|
|
|
|
title: "领用/取消领用/退仓/取消退仓",
|
|
|
|
|
width: 650,
|
|
|
|
|
//height : 120,
|
|
|
|
|
//plain : true,
|
|
|
|
|
iconCls: "addicon",
|
|
|
|
|
resizable: false,
|
|
|
|
|
// 是否可以拖动
|
|
|
|
|
// draggable:false,
|
|
|
|
|
collapsible: true, // 允许缩放条
|
|
|
|
|
closeAction: 'close',
|
|
|
|
|
closable: true,
|
|
|
|
|
modal: 'true',
|
|
|
|
|
buttonAlign: "center",
|
|
|
|
|
bodyStyle: "padding:0 0 0 0",
|
|
|
|
|
items: [this.formSTORAGE],
|
|
|
|
|
buttons: [
|
|
|
|
|
{
|
|
|
|
|
text: "领用",
|
|
|
|
|
minWidth: 70,
|
|
|
|
|
handler: function () {
|
|
|
|
|
//遍历所有选中的记录 修改状态和操作人 然后触发保存
|
|
|
|
|
|
|
|
|
|
me.onLYClick("领用", Ext.getCmp("DOOP").getValue());
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}, {
|
|
|
|
|
text: "取消领用",
|
|
|
|
|
minWidth: 70,
|
|
|
|
|
handler: function () {
|
|
|
|
|
//遍历所有选中的记录 修改状态和操作人 然后触发保存
|
|
|
|
|
me.onLYClick("取消领用", Ext.getCmp("DOOP").getValue());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
text: "退单",
|
|
|
|
|
minWidth: 70,
|
|
|
|
|
handler: function () {
|
|
|
|
|
//遍历所有选中的记录 修改状态和操作人 然后触发保存
|
|
|
|
|
|
|
|
|
|
me.onLYClick("退单", Ext.getCmp("DOOP").getValue());
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}, {
|
|
|
|
|
text: "取消退单",
|
|
|
|
|
minWidth: 70,
|
|
|
|
|
handler: function () {
|
|
|
|
|
//遍历所有选中的记录 修改状态和操作人 然后触发保存
|
|
|
|
|
me.onLYClick("取消退单", Ext.getCmp("DOOP").getValue());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}, {
|
|
|
|
|
text: "*取消",
|
|
|
|
|
minWidth: 70,
|
|
|
|
|
handler: function () {
|
|
|
|
|
me.winSTORAGEShow.close();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
});
|
|
|
|
|
//#endregion
|
|
|
|
|
|
|
|
|
|
//数据集
|
|
|
|
|
this.storeDetail = Ext.create('Ext.data.Store', {
|
|
|
|
|
model: 'op_airn_RECEIPTmb',
|
|
|
|
|
remoteSort: false,
|
|
|
|
|
pruneModifiedRecords: true,
|
|
|
|
|
proxy: {
|
|
|
|
|
type: 'ajax',
|
|
|
|
|
url: '/MvcShipping/MsOpAirn_RECEIPTWMS/GetBodyList',
|
|
|
|
|
reader: {
|
|
|
|
|
id: 'GID',
|
|
|
|
|
root: 'data',
|
|
|
|
|
totalProperty: 'totalCount'
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
//表格
|
|
|
|
|
this.DetailColumns = [
|
|
|
|
|
{
|
|
|
|
|
sortable: true, hidden: true,
|
|
|
|
|
dataIndex: 'GID',
|
|
|
|
|
header: 'GID',
|
|
|
|
|
width: 80
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
sortable: true, hidden: true,
|
|
|
|
|
dataIndex: 'BSNO',
|
|
|
|
|
header: 'BSNO',
|
|
|
|
|
width: 80
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
sortable: true,
|
|
|
|
|
dataIndex: 'FIRSTCODE',
|
|
|
|
|
header: '前缀',
|
|
|
|
|
width: 80,
|
|
|
|
|
editor: {
|
|
|
|
|
xtype: 'numberfield'
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
sortable: true,
|
|
|
|
|
dataIndex: 'RECEIPTNO',
|
|
|
|
|
header: '单号',
|
|
|
|
|
width: 80,
|
|
|
|
|
editor: {
|
|
|
|
|
xtype: 'numberfield'
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
sortable: true, hidden: true,
|
|
|
|
|
dataIndex: 'RTYPE',
|
|
|
|
|
header: '单据类型',
|
|
|
|
|
width: 80
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
sortable: true, hidden: true,
|
|
|
|
|
dataIndex: 'ISBAOCANG',
|
|
|
|
|
header: '是否包仓',
|
|
|
|
|
width: 80
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
sortable: true, hidden: true,
|
|
|
|
|
dataIndex: 'ISWMS',
|
|
|
|
|
header: '是否已入库',
|
|
|
|
|
width: 80
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
sortable: true,
|
|
|
|
|
dataIndex: 'RSTATUS',
|
|
|
|
|
header: '单据状态',
|
|
|
|
|
width: 80/*,
|
|
|
|
|
editor: {
|
|
|
|
|
xtype: 'textfield'
|
|
|
|
|
}*/
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
sortable: true,
|
|
|
|
|
dataIndex: 'OP',
|
|
|
|
|
header: '最近操作人',
|
|
|
|
|
width: 80
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
sortable: true,
|
|
|
|
|
dataIndex: 'OPDATE',
|
|
|
|
|
header: '最近操作时间',
|
|
|
|
|
width: 140
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
sortable: true,
|
|
|
|
|
dataIndex: 'REMARK',
|
|
|
|
|
header: '备注',
|
|
|
|
|
width: 80
|
|
|
|
|
} /*
|
|
|
|
|
{
|
|
|
|
|
sortable: true,
|
|
|
|
|
dataIndex: 'VESSEL',
|
|
|
|
|
header: '航班号',
|
|
|
|
|
width: 80,
|
|
|
|
|
editor: {
|
|
|
|
|
xtype: 'textfield'
|
|
|
|
|
}
|
|
|
|
|
},*/
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
this.cellEditingCargo = Ext.create('Ext.grid.plugin.CellEditing', {
|
|
|
|
|
clicksToEdit: 1
|
|
|
|
|
});
|
|
|
|
|
this.cargoCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
|
|
|
|
|
var _this = this;
|
|
|
|
|
this.formDetail = new Ext.grid.GridPanel({
|
|
|
|
|
store: this.storeDetail,
|
|
|
|
|
enableHdMenu: false,
|
|
|
|
|
layout: 'border',
|
|
|
|
|
region: 'center', //bodyStyle: 'background:#FFF',
|
|
|
|
|
trackResetOnLoad: true,
|
|
|
|
|
//height: 160,
|
|
|
|
|
autoScroll: true,
|
|
|
|
|
title: '主单信息',
|
|
|
|
|
loadMask: { msg: "数据加载中,请稍等..." },
|
|
|
|
|
trackMouseOver: true,
|
|
|
|
|
disableSelection: false,
|
|
|
|
|
plugins: [this.cellEditingCargo],
|
|
|
|
|
selModel: this.cargoCheckBoxModel,
|
|
|
|
|
selType: 'cellmodel',
|
|
|
|
|
tbar: [{
|
|
|
|
|
text: '增加明细',
|
|
|
|
|
tooltip: '增加明细',
|
|
|
|
|
iconCls: "btnadddetail",
|
|
|
|
|
handler: function (button, event) {
|
|
|
|
|
this.onAddDetailClick(button, event);
|
|
|
|
|
},
|
|
|
|
|
scope: this
|
|
|
|
|
}, '-', {
|
|
|
|
|
text: '删除明细',
|
|
|
|
|
tooltip: '删除明细',
|
|
|
|
|
iconCls: "btndeletedetail",
|
|
|
|
|
handler: function (button, event) {
|
|
|
|
|
this.onDelDetailClick(button, event);
|
|
|
|
|
},
|
|
|
|
|
scope: this
|
|
|
|
|
}, {
|
|
|
|
|
text: '库存初始化',
|
|
|
|
|
tooltip: '库存初始化',
|
|
|
|
|
iconCls: "btnKCStart", hidden: true,
|
|
|
|
|
handler: function (button, event) {
|
|
|
|
|
this.onKCStartClick(button, event);
|
|
|
|
|
},
|
|
|
|
|
scope: this
|
|
|
|
|
}, {
|
|
|
|
|
text: '生成应收应付',
|
|
|
|
|
tooltip: '生成应收应付',
|
|
|
|
|
iconCls: "btnCWStart", hidden: true,
|
|
|
|
|
handler: function (button, event) {
|
|
|
|
|
this.onbtnCWStartClick(button, event);
|
|
|
|
|
},
|
|
|
|
|
scope: this
|
|
|
|
|
}, {
|
|
|
|
|
text: "保存列表样式",
|
|
|
|
|
id: "btnsavelist",
|
|
|
|
|
handler: function (button, event) {
|
|
|
|
|
|
|
|
|
|
var tempcolumns = this.formDetail.columns;
|
|
|
|
|
DsTruck.SaveGridPanel(USERID, _this.DetailListName, tempcolumns);
|
|
|
|
|
},
|
|
|
|
|
scope: this
|
|
|
|
|
}, {
|
|
|
|
|
text: '领用/取消领用(退回)',
|
|
|
|
|
tooltip: '',
|
|
|
|
|
iconCls: "btnCargoLock", id: "CargoLock",
|
|
|
|
|
handler: function (button, event) {
|
|
|
|
|
//this.CargoLock(button, event);
|
|
|
|
|
//var formHead = this.formHead.getForm();
|
|
|
|
|
|
|
|
|
|
this.winSTORAGEShow.show();
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
scope: this
|
|
|
|
|
}],
|
|
|
|
|
columns: this.DetailColumns
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
this.DetailColumns = DsTruck.GetGridPanel(USERID, this.DetailListName, this.DetailColumns);
|
|
|
|
|
//使用者id,表名 ,中间column数组,跳过一开始的几列
|
|
|
|
|
this.DetailColumns.unshift(new Ext.grid.RowNumberer());
|
|
|
|
|
this.formDetail.reconfigure(this.storeDetail, this.DetailColumns);
|
|
|
|
|
|
|
|
|
|
//#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//公共按钮Toolbar:panelBtn
|
|
|
|
|
this.panelBtn = new Ext.Panel({
|
|
|
|
|
region: "north",
|
|
|
|
|
tbar: [
|
|
|
|
|
{
|
|
|
|
|
// id: "saveandclose",
|
|
|
|
|
text: "保存",
|
|
|
|
|
handler: function (button, event) {
|
|
|
|
|
this.Save('0');
|
|
|
|
|
},
|
|
|
|
|
scope: this
|
|
|
|
|
}, {
|
|
|
|
|
// id: "saveandclose",
|
|
|
|
|
text: "保存并关闭",
|
|
|
|
|
handler: function (button, event) {
|
|
|
|
|
this.Save('1');
|
|
|
|
|
},
|
|
|
|
|
scope: this
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
// id: "saveandclose",
|
|
|
|
|
text: "关闭",
|
|
|
|
|
handler: function (button, event) {
|
|
|
|
|
window.close();
|
|
|
|
|
},
|
|
|
|
|
scope: this
|
|
|
|
|
}, '-',
|
|
|
|
|
{
|
|
|
|
|
text: "依单号范围生成主单并保存",
|
|
|
|
|
tooltip: '注意:重复生成单号会无法保存。',
|
|
|
|
|
//iconCls: "btnexportexcel",
|
|
|
|
|
handler: function (button, event) {
|
|
|
|
|
|
|
|
|
|
this.MakeDetail();
|
|
|
|
|
},
|
|
|
|
|
scope: this
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}); //end 按钮Toolbar
|
|
|
|
|
|
|
|
|
|
//布局
|
|
|
|
|
/* 3 */
|
|
|
|
|
this.panelTop = new Ext.Panel({
|
|
|
|
|
layout: "border",
|
|
|
|
|
region: "north",
|
|
|
|
|
height: 140,
|
|
|
|
|
items: [this.panelBtn, this.formEdit]
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
this.panelCargoandApp = new Ext.Panel({
|
|
|
|
|
layout: "border",
|
|
|
|
|
region: 'center',
|
|
|
|
|
split: true,
|
|
|
|
|
height: 500,
|
|
|
|
|
margin: '1 1',
|
|
|
|
|
items: [this.formDetail
|
|
|
|
|
]
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Ext.apply(this, {
|
|
|
|
|
items: [this.panelTop, this.panelCargoandApp]
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
parentWin = window.parent.opener;
|
|
|
|
|
this.InitData();
|
|
|
|
|
|
|
|
|
|
//集中绑定编辑后事件
|
|
|
|
|
this.formDetail.on('edit', function (editor, e, eOpts) {
|
|
|
|
|
this.DetailAfterEdit(editor, e, eOpts);
|
|
|
|
|
}, this);
|
|
|
|
|
}, //end initUIComponents
|
|
|
|
|
|
|
|
|
|
////////<<<商品>>>明细表相关方法
|
|
|
|
|
reLine: function (button, event) {
|
|
|
|
|
var _L = 1;
|
|
|
|
|
this.storeDetail.each(function (record) {
|
|
|
|
|
var ln = _L + "";
|
|
|
|
|
_L = _L + 1;
|
|
|
|
|
record.set('SEQUENCE', ln);
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
onAddDetailClick: function (button, event) {
|
|
|
|
|
|
|
|
|
|
var record = Ext.create('op_airn_RECEIPTmb', {
|
|
|
|
|
'GID': NewGuid(),
|
|
|
|
|
'BSNO': '',
|
|
|
|
|
'FIRSTCODE': this.formEdit.getForm().findField('FIRSTCODE').getValue(),
|
|
|
|
|
'RECEIPTNO': '',
|
|
|
|
|
'RTYPE': '',
|
|
|
|
|
'ISBAOCANG': '0',
|
|
|
|
|
'ISWMS': '0',
|
|
|
|
|
'RSTATUS': '入库',
|
|
|
|
|
'OP': SHOWNAME,
|
|
|
|
|
'OPDATE': currdate.format('yyyy-MM-dd hh:mm:ss'),
|
|
|
|
|
'REMARK': ''
|
|
|
|
|
});
|
|
|
|
|
this.storeDetail.add(record);
|
|
|
|
|
|
|
|
|
|
var n = this.storeDetail.getCount();
|
|
|
|
|
this.cellEditingCargo.startEditByPosition({ row: n - 1, column: 2 });
|
|
|
|
|
//aftereditform();
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
onDelDetailClick: function (button, event) {
|
|
|
|
|
var selectedRecords = this.formDetail.selModel.getSelection();
|
|
|
|
|
Ext.MessageBox.confirm('提示', '确定删除记录吗?', function (btn) {
|
|
|
|
|
if (btn == 'yes') {
|
|
|
|
|
for (var i = 0; i < selectedRecords.length; i++) {
|
|
|
|
|
var rec = selectedRecords[i];
|
|
|
|
|
if (rec.PLAN_GID != "" || rec.PLAN_GID != "*") //如果是新增但没有保存的数据,没有必要提交到后台
|
|
|
|
|
{
|
|
|
|
|
this.DetailDel.push(rec);
|
|
|
|
|
}
|
|
|
|
|
this.storeDetail.remove(selectedRecords[i]);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}, this);
|
|
|
|
|
//aftereditform();
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
CargoBeforeEdit: function (editor, e) {
|
|
|
|
|
|
|
|
|
|
var cargo_id = e.record.get('id');
|
|
|
|
|
if (cargo_id == "" || cargo_id == null) { cargo_id = -1; }
|
|
|
|
|
var canedit = true;
|
|
|
|
|
this.APPUsingCount = 0;
|
|
|
|
|
|
|
|
|
|
Ext.Ajax.request({
|
|
|
|
|
waitMsg: '正在查询数据...',
|
|
|
|
|
url: '/Import/UseApproval/Getused',
|
|
|
|
|
scope: this,
|
|
|
|
|
async: false,
|
|
|
|
|
params: { cargo_id: cargo_id },
|
|
|
|
|
waitMsg: "正在查询数据...",
|
|
|
|
|
callback: function (options, success, response) {
|
|
|
|
|
if (success) {
|
|
|
|
|
var jsonresult = Ext.JSON.decode(response.responseText);
|
|
|
|
|
var returnData = jsonresult.data;
|
|
|
|
|
//alert(returnData.Count);
|
|
|
|
|
this.APPUsingCount = parseInt(returnData.Count);
|
|
|
|
|
} else {
|
|
|
|
|
Ext.Msg.show({ title: '请重试',
|
|
|
|
|
msg: '服务器响应出错',
|
|
|
|
|
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
|
|
|
|
|
});
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (e.field == 'cargoinfo_id' || e.field == 'cargociq_id' || e.field == 'Unit'
|
|
|
|
|
|| e.field == 'U_weight' || e.field == 'FactoryNo' || e.field == 'Exporter') {
|
|
|
|
|
if (this.APPUsingCount > 0) {
|
|
|
|
|
canedit = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (e.field == 'cargociq_id') {
|
|
|
|
|
//20150112
|
|
|
|
|
var cargoinfoid = e.record.get('cargoinfo_id');
|
|
|
|
|
if (cargoinfoid != "" && cargoinfoid != null) {
|
|
|
|
|
var s = " cargoinfoid=" + cargoinfoid;
|
|
|
|
|
this.storeDetailciq.load({ params: { condition: s} });
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (e.field == 'FactoryNo') {
|
|
|
|
|
if (e.record.get('Exporter') == "") {
|
|
|
|
|
//canedit=false;
|
|
|
|
|
//alert("请先选择出口商!");
|
|
|
|
|
} else {
|
|
|
|
|
//this.storeFactoryNo.load({ params: { condition: " CLIENTGID=(select gid from info_client where shortname='"+e.record.get('Exporter')+"') "} });
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (e.field == 'name') {
|
|
|
|
|
var HS_ID = e.record.get('cargoinfo_id');
|
|
|
|
|
if (HS_ID == null) { HS_ID = ""; }
|
|
|
|
|
if (e.record.get('FactoryNo') == "" || e.record.get('FactoryNo') == null) {
|
|
|
|
|
|
|
|
|
|
var Ename = e.record.get('Ename');
|
|
|
|
|
|
|
|
|
|
if (Ename == "" || Ename == null) {
|
|
|
|
|
if (HS_ID == "" || this.APPUsingCount == 0) {
|
|
|
|
|
this.storeDetailName.load({ params: {
|
|
|
|
|
start: 0, limit: 5000, sort: '',
|
|
|
|
|
condition: ""
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
this.storeDetailName.load({ params: {
|
|
|
|
|
start: 0, limit: 5000, sort: '',
|
|
|
|
|
condition: "HS_ID=" + e.record.get('cargoinfo_id')
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (HS_ID == "" || this.APPUsingCount == 0) {
|
|
|
|
|
this.storeDetailName.load({ params: {
|
|
|
|
|
start: 0, limit: 5000, sort: '',
|
|
|
|
|
condition: " ENNAME='" + Ename + "'"
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
this.storeDetailName.load({ params: {
|
|
|
|
|
start: 0, limit: 5000, sort: '',
|
|
|
|
|
condition: " ENNAME='" + Ename + "' and HS_ID=" + e.record.get('cargoinfo_id')
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
//if (this.FactoryNo!=e.record.get('FactoryNo'))
|
|
|
|
|
if (HS_ID == "" || this.APPUsingCount == 0) {
|
|
|
|
|
this.storeDetailName.load({ params: {
|
|
|
|
|
start: 0, limit: 5000, sort: '',
|
|
|
|
|
condition: " FACTORYNOGID=(select gid from import_factoryno where factoryno='" + e.record.get('FactoryNo') + "') "
|
|
|
|
|
} //
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
this.storeDetailName.load({ params: {
|
|
|
|
|
start: 0, limit: 5000, sort: '',
|
|
|
|
|
condition: " FACTORYNOGID=(select gid from import_factoryno where factoryno='" + e.record.get('FactoryNo') + "') and HS_ID=" + e.record.get('cargoinfo_id')
|
|
|
|
|
} //
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.FactoryNo = e.record.get('FactoryNo');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (e.field == 'Ename') {
|
|
|
|
|
var HS_ID = e.record.get('cargoinfo_id');
|
|
|
|
|
if (HS_ID == null) { HS_ID = ""; }
|
|
|
|
|
if (e.record.get('FactoryNo') == "" || e.record.get('FactoryNo') == null) {
|
|
|
|
|
|
|
|
|
|
var name = e.record.get('name');
|
|
|
|
|
|
|
|
|
|
if (name == "" || name == null) {
|
|
|
|
|
if (HS_ID == "" || this.APPUsingCount == 0) {
|
|
|
|
|
this.storeDetailName.load({ params: {
|
|
|
|
|
start: 0, limit: 5000, sort: '',
|
|
|
|
|
condition: ""
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
this.storeDetailName.load({ params: {
|
|
|
|
|
start: 0, limit: 5000, sort: '',
|
|
|
|
|
condition: "HS_ID=" + e.record.get('cargoinfo_id')
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (HS_ID == "" || this.APPUsingCount == 0) {
|
|
|
|
|
this.storeDetailName.load({ params: {
|
|
|
|
|
start: 0, limit: 5000, sort: '',
|
|
|
|
|
condition: " CNNAME='" + Ename + "'"
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
this.storeDetailName.load({ params: {
|
|
|
|
|
start: 0, limit: 5000, sort: '',
|
|
|
|
|
condition: " CNNAME='" + Ename + "' and HS_ID=" + e.record.get('cargoinfo_id')
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
//if (this.FactoryNo!=e.record.get('FactoryNo'))
|
|
|
|
|
if (HS_ID == "" || this.APPUsingCount == 0) {
|
|
|
|
|
this.storeDetailName.load({ params: {
|
|
|
|
|
start: 0, limit: 5000, sort: '',
|
|
|
|
|
condition: " FACTORYNOGID=(select gid from import_factoryno where factoryno='" + e.record.get('FactoryNo') + "') "
|
|
|
|
|
} //
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
this.storeDetailName.load({ params: {
|
|
|
|
|
start: 0, limit: 5000, sort: '',
|
|
|
|
|
condition: " FACTORYNOGID=(select gid from import_factoryno where factoryno='" + e.record.get('FactoryNo') + "') and HS_ID=" + e.record.get('cargoinfo_id')
|
|
|
|
|
} //
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.FactoryNo = e.record.get('FactoryNo');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//20150505 当合同状态为审单或更往后的状态 禁止修改单价和重量。
|
|
|
|
|
if (this.opStatus == 'edit') {
|
|
|
|
|
var Mainstate = parseInt(this.editRecord.get('Mainstate'));
|
|
|
|
|
if (Mainstate > 1 && (e.field == 'weight' || e.field == 'price' || e.field == 'price_agio' || e.field == 'price_limit')) {
|
|
|
|
|
canedit = false;
|
|
|
|
|
alert("审单之后即不能修改重量和价格");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (e.field == 'Cargoinfo_id' || e.field == 'Cargociq_id') {
|
|
|
|
|
var countryid = this.formEdit.getForm().findField('countryid').getRawValue();
|
|
|
|
|
if (countryid == "") {
|
|
|
|
|
alert("添加货物之前必须先选择进口国");
|
|
|
|
|
canedit = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (e.field == 'SPECIFICATIONS') {
|
|
|
|
|
var cicodeandname = e.record.get('cicodeandname');
|
|
|
|
|
if (cicodeandname != "0203290090_其他冻藏猪肉") {
|
|
|
|
|
//alert("只有HS代码为0203290090的商品才能修改规格");
|
|
|
|
|
canedit = false;
|
|
|
|
|
} else {
|
|
|
|
|
if (this.APPUsingCount > 0) {
|
|
|
|
|
canedit = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (e.field == 'cargoinfo_id') {
|
|
|
|
|
var FactoryNo = e.record.get('FactoryNo');
|
|
|
|
|
var name = e.record.get('name');
|
|
|
|
|
if ((FactoryNo == "" || FactoryNo == null) && (name != "" && name != null)) {
|
|
|
|
|
//如果没选厂号 选了中文品名
|
|
|
|
|
//根据品名确定范围
|
|
|
|
|
var s = " countryid='" + this.formEdit.getForm().findField('countryid').getValue() + "'";
|
|
|
|
|
|
|
|
|
|
s = s + " and ci.id in(select hs_id from Import_Cargoname where CNNAME='" + name + "')"
|
|
|
|
|
this.storeDetailinfo.load({ params: { condition: s} });
|
|
|
|
|
} else
|
|
|
|
|
if ((FactoryNo != "" && FactoryNo != null) && (name != "" && name != null)) {
|
|
|
|
|
//如果选了厂号 选了中文品名
|
|
|
|
|
//根据厂号和品名确定范围
|
|
|
|
|
var s = " countryid='" + this.formEdit.getForm().findField('countryid').getValue() + "'";
|
|
|
|
|
|
|
|
|
|
s = s + " and ci.id in(select hs_id from Import_Cargoname where CNNAME='" + name + "' and FactoryNoGID in(select GID from Import_Factoryno where FactoryNo='" + FactoryNo + "')) "
|
|
|
|
|
this.storeDetailinfo.load({ params: { condition: s} });
|
|
|
|
|
} else {
|
|
|
|
|
this.storeDetailinfo.load({ params: { condition: ""} });
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return canedit;
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
DetailAfterEdit: function (editor, e, eOpts) {
|
|
|
|
|
|
|
|
|
|
if (e.field == 'CARGOGID') {
|
|
|
|
|
var Cargoinforecords = DsStoreQueryBy(this.storeDetailName, 'GID', e.value);
|
|
|
|
|
if (Cargoinforecords.getCount() > 0) {
|
|
|
|
|
var Cargoinfodata = Cargoinforecords.getAt(0).data;
|
|
|
|
|
|
|
|
|
|
e.record.set('CARGO_CODE', Cargoinfodata.CODEandNAME);
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
e.record.set('CARGO_CODE', '');
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (e.field == 'PORTLOADID') {
|
|
|
|
|
var Cargoinforecords = DsStoreQueryBy(this.storeCodeDisport, 'PORTID', e.value);
|
|
|
|
|
if (Cargoinforecords.getCount() > 0) {
|
|
|
|
|
var Cargoinfodata = Cargoinforecords.getAt(0).data;
|
|
|
|
|
|
|
|
|
|
e.record.set('PORTLOADID_REF', Cargoinfodata.PORTCNAME);
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
e.record.set('PORTLOADID_REF', '');
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (e.field == 'PORTDISCHARGEID') {
|
|
|
|
|
var Cargoinforecords = DsStoreQueryBy(this.storeCodeDisport2, 'PORTID', e.value);
|
|
|
|
|
if (Cargoinforecords.getCount() > 0) {
|
|
|
|
|
var Cargoinfodata = Cargoinforecords.getAt(0).data;
|
|
|
|
|
|
|
|
|
|
e.record.set('PORTDISCHARGEID_REF', Cargoinfodata.PORTCNAME);
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
e.record.set('PORTDISCHARGEID_REF', '');
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
onLYClick: function (RSTATUS, USERNAME) {
|
|
|
|
|
if (USERNAME == "") {
|
|
|
|
|
alert("请选择操作发起人!");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
var selectedRecords = this.formDetail.selModel.getSelection();
|
|
|
|
|
Ext.MessageBox.confirm('提示', '确定进行' + RSTATUS + '吗?', function (btn) {
|
|
|
|
|
if (btn == 'yes') {
|
|
|
|
|
var LYList = [];
|
|
|
|
|
for (var i = 0; i < selectedRecords.length; i++) {
|
|
|
|
|
var member = selectedRecords[i];
|
|
|
|
|
LYList.push(member);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var LYBody = ConvertRecordsToJsonAll(LYList);
|
|
|
|
|
|
|
|
|
|
Ext.Ajax.request({
|
|
|
|
|
waitMsg: '正在保存数据...',
|
|
|
|
|
url: '/MvcShipping/MsOpAirn/DoLY',
|
|
|
|
|
scope: this,
|
|
|
|
|
params: {
|
|
|
|
|
RSTATUS: RSTATUS,
|
|
|
|
|
USERNAME: USERNAME,
|
|
|
|
|
LYBody: LYBody
|
|
|
|
|
},
|
|
|
|
|
callback: function (options, success, response) {
|
|
|
|
|
if (success) {
|
|
|
|
|
this.winSTORAGEShow.close();
|
|
|
|
|
Ext.MessageBox.hide();
|
|
|
|
|
var jsonresult = Ext.JSON.decode(response.responseText);
|
|
|
|
|
if (jsonresult.Success) {
|
|
|
|
|
this.storeDetail.load({ params: { start: 0, limit: 9999, condition: " BSNO='" + this.editRecord.get('GID') + "'"} });
|
|
|
|
|
} else {
|
|
|
|
|
if (this.opStatus == 'edit') {
|
|
|
|
|
this.storeDetail.load({ params: { start: 0, limit: 9999, condition: " BSNO='" + data.GID + "'"} });
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
this.winSTORAGEShow.close();
|
|
|
|
|
Ext.Msg.show({ title: '请重试',
|
|
|
|
|
msg: '服务器响应出错',
|
|
|
|
|
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
//alert('03');
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}, this);
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
parentfunction: function (button, event) {
|
|
|
|
|
var ret1 = window.parent.opener.OprationSwap();
|
|
|
|
|
// alert(this.First);
|
|
|
|
|
ret1[3]();
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
InitData: function () {
|
|
|
|
|
|
|
|
|
|
this.opStatus = 'add';
|
|
|
|
|
var condition = '';
|
|
|
|
|
|
|
|
|
|
if (parentWin) {
|
|
|
|
|
var ret = parentWin.OprationSwap();
|
|
|
|
|
this.opStatus = ret[0];
|
|
|
|
|
this.StoreList = ret[1];
|
|
|
|
|
this.editRecord = ret[2];
|
|
|
|
|
// this.parentfunction = ret[3];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (this.opStatus == 'edit')
|
|
|
|
|
condition = " GID='" + this.editRecord.get('GID') + "'";
|
|
|
|
|
|
|
|
|
|
this.LoadData(this.opStatus, condition);
|
|
|
|
|
|
|
|
|
|
}, //end InitData
|
|
|
|
|
|
|
|
|
|
//载入数据
|
|
|
|
|
LoadData: function (opstatus, condition) {
|
|
|
|
|
this.opStatus = opstatus;
|
|
|
|
|
Ext.Ajax.request({
|
|
|
|
|
waitMsg: '正在查询主表数据...',
|
|
|
|
|
url: '/MvcShipping/MsOpAirn_RECEIPTWMS/GetData',
|
|
|
|
|
params: {
|
|
|
|
|
handle: opstatus,
|
|
|
|
|
condition: condition
|
|
|
|
|
},
|
|
|
|
|
callback: function (options, success, response) {
|
|
|
|
|
if (success) {
|
|
|
|
|
var result = Ext.JSON.decode(response.responseText);
|
|
|
|
|
if (!result.Success) {
|
|
|
|
|
Ext.Msg.show({
|
|
|
|
|
title: '提示',
|
|
|
|
|
msg: result.Message,
|
|
|
|
|
icon: Ext.MessageBox.ERROR,
|
|
|
|
|
buttons: Ext.Msg.OK
|
|
|
|
|
});
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var data = result.data;
|
|
|
|
|
this.formEdit.getForm().reset();
|
|
|
|
|
|
|
|
|
|
if (data.INUSE == "1") {
|
|
|
|
|
data.INUSE = '1';
|
|
|
|
|
} else { data.INUSE = '0' };
|
|
|
|
|
|
|
|
|
|
if (data.RTYPE == "" || typeof (data.RTYPE) == "undefined") {
|
|
|
|
|
data.RTYPE = "国内主单";
|
|
|
|
|
}
|
|
|
|
|
this.formEdit.getForm().setValues(data);
|
|
|
|
|
this.SetWH(data.STARTNO, data.ENDNO);
|
|
|
|
|
} else {
|
|
|
|
|
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
scope: this
|
|
|
|
|
}); //request over
|
|
|
|
|
|
|
|
|
|
if (this.opStatus == 'edit') {
|
|
|
|
|
|
|
|
|
|
this.storeDetail.load({ params: { start: 0, limit: 9999, condition: " BSNO='" + this.editRecord.get('GID') + "'"} });
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}, // end LoadDate
|
|
|
|
|
ReflashEdt: function (GID) {
|
|
|
|
|
|
|
|
|
|
this.OpStatus = 'edit';
|
|
|
|
|
condition = " GID='" + GID + "'";
|
|
|
|
|
|
|
|
|
|
this.storeDetail.load({ params: { start: 0, limit: 9999, condition: condition} });
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}, //end InitData
|
|
|
|
|
checkedit: function () {
|
|
|
|
|
var _r = true;
|
|
|
|
|
|
|
|
|
|
if (this.HTHCount > 0) {
|
|
|
|
|
alert("合同号重复");
|
|
|
|
|
_r = false;
|
|
|
|
|
} else {
|
|
|
|
|
var ContractStatus = this.formEdit.getForm().findField('ContractStatus').getValue() ? 1 : 0
|
|
|
|
|
if (ContractStatus == 1) {
|
|
|
|
|
alert("已经锁定");
|
|
|
|
|
_r = false;
|
|
|
|
|
} else
|
|
|
|
|
{ } //return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (this.storeDetail.getCount() == 0) { } //return true;
|
|
|
|
|
else {
|
|
|
|
|
for (var i = 0; i < this.storeDetail.getCount(); i += 1) {
|
|
|
|
|
var cargomember = this.storeDetail.getAt(i).data;
|
|
|
|
|
if (cargomember.weight == "0") {
|
|
|
|
|
alert("请填写货物重量,请注意单位是千克");
|
|
|
|
|
_r = false;
|
|
|
|
|
} else
|
|
|
|
|
if (cargomember.name == "") {
|
|
|
|
|
alert("请填写货名。");
|
|
|
|
|
_r = false;
|
|
|
|
|
} else
|
|
|
|
|
if (cargomember.cicodeandname == '0203290090_其他冻藏猪肉' && (cargomember.SPECIFICATIONS == "" || cargomember.SPECIFICATIONS == null)) {
|
|
|
|
|
alert("0203290090_其他冻藏猪肉的商品必须选择商品规格(去骨/带骨)");
|
|
|
|
|
_r = false;
|
|
|
|
|
}
|
|
|
|
|
} //end for
|
|
|
|
|
} //end if
|
|
|
|
|
/* if (e.field == 'SPECIFICATIONS'){
|
|
|
|
|
var cicodeandname=e.record.get('cicodeandname');
|
|
|
|
|
if (cicodeandname!="0202300090_其他冻藏猪肉" ){
|
|
|
|
|
//alert("只有HS代码为0203290090的商品才能修改规格");
|
|
|
|
|
canedit=false;
|
|
|
|
|
}else{
|
|
|
|
|
//canedit=true;
|
|
|
|
|
}
|
|
|
|
|
}*/
|
|
|
|
|
|
|
|
|
|
_form = this.formEdit.getForm();
|
|
|
|
|
|
|
|
|
|
var seller_name = _form.findField('seller').getValue();
|
|
|
|
|
if (CheckISSTOP(this.storeSeller, 'name', seller_name) == true) {
|
|
|
|
|
alert("你选择的贸易商已经停用");
|
|
|
|
|
_r = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var buyer_name = _form.findField('buyer').getValue();
|
|
|
|
|
var buyer = DsStoreQueryBy(this.storeBuyer, 'name', buyer_name);
|
|
|
|
|
if (buyer.getCount() > 0) {
|
|
|
|
|
var buyerdata = buyer.getAt(0).data;
|
|
|
|
|
if (buyerdata.ISSTOP == "True") {
|
|
|
|
|
alert("你选择的购货商已经停用");
|
|
|
|
|
//return;
|
|
|
|
|
_r = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
var TRADINGAGENCY_name = _form.findField('TRADINGAGENCY').getValue();
|
|
|
|
|
var TRADINGAGENCY = DsStoreQueryBy(this.storeTRADINGAGENCY, 'name', TRADINGAGENCY_name);
|
|
|
|
|
if (TRADINGAGENCY.getCount() > 0) {
|
|
|
|
|
var buyerdata = TRADINGAGENCY.getAt(0).data;
|
|
|
|
|
if (buyerdata.ISSTOP == "True") {
|
|
|
|
|
alert("你选择的中间商已经停用");
|
|
|
|
|
//return;
|
|
|
|
|
_r = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return _r;
|
|
|
|
|
},
|
|
|
|
|
Save: function (type) {
|
|
|
|
|
var basicForm = this.formEdit.getForm();
|
|
|
|
|
if (!basicForm.isValid()) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//basicForm.findField('ContractNo').setDisabled(false);
|
|
|
|
|
var data = this.formEdit.getForm().getValues();
|
|
|
|
|
//var HTH = data.HTH;
|
|
|
|
|
//var ContractNo = data.ContractNo;
|
|
|
|
|
//basicForm.findField('ContractNo').setDisabled(true);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var Cargodatas = [];
|
|
|
|
|
for (var i = 0; i < this.storeDetail.getCount(); i += 1) {
|
|
|
|
|
var member = this.storeDetail.getAt(i);
|
|
|
|
|
Cargodatas.push(member);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//商品明细
|
|
|
|
|
var DetailBody = ConvertRecordsToJson(Cargodatas);
|
|
|
|
|
var DetailDelBody = ConvertRecordsToJsonAll(this.DetailDel);
|
|
|
|
|
|
|
|
|
|
//将复选框值转化为1/0
|
|
|
|
|
//data.ContractStatus=this.formEdit.getForm().findField('ContractStatus').getValue()?1:0;
|
|
|
|
|
//data.HaveContract=this.formEdit.getForm().findField('HaveContract').getValue()?1:0;
|
|
|
|
|
data.ISBAOCANG = this.formEdit.getForm().findField('ISBAOCANG').getValue() ? 1 : 0;
|
|
|
|
|
|
|
|
|
|
var _this = this;
|
|
|
|
|
Ext.Msg.wait('正在保存数据, 请稍侯..');
|
|
|
|
|
Ext.Ajax.request({
|
|
|
|
|
waitMsg: '正在保存数据...',
|
|
|
|
|
url: '/MvcShipping/MsOpAirn_RECEIPTWMS/Save',
|
|
|
|
|
scope: this,
|
|
|
|
|
params: {
|
|
|
|
|
opstatus: this.opStatus,
|
|
|
|
|
data: Ext.JSON.encode(data),
|
|
|
|
|
DetailBody: DetailBody,
|
|
|
|
|
DetailDelBody: DetailDelBody
|
|
|
|
|
},
|
|
|
|
|
callback: function (options, success, response) {
|
|
|
|
|
if (success) {
|
|
|
|
|
Ext.MessageBox.hide();
|
|
|
|
|
var jsonresult = Ext.JSON.decode(response.responseText);
|
|
|
|
|
if (jsonresult.Success) {
|
|
|
|
|
this.storeDetail.commitChanges();
|
|
|
|
|
|
|
|
|
|
var returnData = jsonresult.Data;
|
|
|
|
|
this.formEdit.getForm().setValues(returnData);
|
|
|
|
|
|
|
|
|
|
if (this.opStatus == 'add') {
|
|
|
|
|
var arrNewRecords = this.StoreList.add(returnData);
|
|
|
|
|
this.editRecord = arrNewRecords[0];
|
|
|
|
|
// alert(editRecord.get('ContractNo'));
|
|
|
|
|
}
|
|
|
|
|
else if (this.opStatus == 'edit') {
|
|
|
|
|
var editp = Ext.create('op_airn_RECEIPTWMSmb', returnData);
|
|
|
|
|
this.editRecord.fields.each(function (field) {
|
|
|
|
|
if (field.persist) {
|
|
|
|
|
name = field.name;
|
|
|
|
|
//alert(name + ' -- ' + editp.get(name));
|
|
|
|
|
if (name != 'id')
|
|
|
|
|
this.editRecord.set(name, editp.get(name));
|
|
|
|
|
}
|
|
|
|
|
}, this);
|
|
|
|
|
this.editRecord.commit();
|
|
|
|
|
}
|
|
|
|
|
if (type == '0') {
|
|
|
|
|
this.opStatus = 'edit';
|
|
|
|
|
|
|
|
|
|
this.storeDetail.load({ params: { start: 0, limit: 9999, condition: " BSNO='" + this.editRecord.get('GID') + "'"} });
|
|
|
|
|
|
|
|
|
|
} else if (type == '1') {//保存并关闭
|
|
|
|
|
window.close();
|
|
|
|
|
} else if (type == '2') {//保存并全部新建
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (this.opStatus == 'edit') {
|
|
|
|
|
this.storeDetail.load({ params: { start: 0, limit: 9999, condition: " BSNO='" + data.GID + "'"} });
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
|
|
Ext.Msg.show({ title: '请重试',
|
|
|
|
|
msg: '服务器响应出错',
|
|
|
|
|
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
//alert('03');
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
,
|
|
|
|
|
MakeNo: function (TYPE) {
|
|
|
|
|
|
|
|
|
|
var form = this.formEdit.getForm();
|
|
|
|
|
|
|
|
|
|
// DdCode =form.findField('DdCode').value;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var STARTNO = parseInt(form.findField('STARTNO').getValue());
|
|
|
|
|
var ENDNO = parseInt(form.findField('ENDNO').getValue());
|
|
|
|
|
var RCOUNT = parseInt(form.findField('RCOUNT').getValue());
|
|
|
|
|
|
|
|
|
|
this.SetWH(STARTNO, ENDNO);
|
|
|
|
|
//alert(STARTNO + '_' + ENDNO + '_' + RCOUNT);
|
|
|
|
|
|
|
|
|
|
if (TYPE == "start" && STARTNO == "NaN") {// || STARTNO < 1000000
|
|
|
|
|
alert("开始编号不符合编号规则");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (TYPE == "end" && ENDNO == "NaN") {// || ENDNO < 1000000
|
|
|
|
|
alert("结束编号不符合编号规则");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (TYPE == "start") {
|
|
|
|
|
//填写开始 如有末尾数则 计算数量
|
|
|
|
|
if (ENDNO != "NaN") {//&& ENDNO >= 1000000
|
|
|
|
|
RCOUNT = this.GetCount(STARTNO, ENDNO);
|
|
|
|
|
} else {
|
|
|
|
|
//如无 且有数量 则计算末尾数
|
|
|
|
|
if (RCOUNT != "NaN" && parseInt(RCOUNT) > 0) {
|
|
|
|
|
ENDNO = this.GetEnd(STARTNO, RCOUNT);
|
|
|
|
|
} else {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (TYPE == "end") {
|
|
|
|
|
//填写结束 如有开始数则计算 数量
|
|
|
|
|
if (STARTNO != "NaN") {// && STARTNO >= 1000000
|
|
|
|
|
RCOUNT = this.GetCount(STARTNO, ENDNO);
|
|
|
|
|
} else {
|
|
|
|
|
//如无 且有数量 则计算开始数
|
|
|
|
|
if (RCOUNT != "NaN" && parseInt(RCOUNT) > 0) {
|
|
|
|
|
STARTNO = this.GetStart(ENDNO, RCOUNT);
|
|
|
|
|
} else {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (TYPE == "count") {
|
|
|
|
|
//填写数量 如有开始数 则计算末尾数
|
|
|
|
|
if (STARTNO != "NaN" && RCOUNT != "NaN" && parseInt(RCOUNT) > 0) {//&& STARTNO >= 1000000
|
|
|
|
|
ENDNO = this.GetEnd(STARTNO, RCOUNT);
|
|
|
|
|
} else {
|
|
|
|
|
//如无 且有结束数 则计算开始数
|
|
|
|
|
if (RCOUNT != "NaN" && parseInt(RCOUNT) > 0) {
|
|
|
|
|
STARTNO = this.GetStart(ENDNO, RCOUNT);
|
|
|
|
|
} else {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
form.findField('STARTNO').setValue(this.padNumber(STARTNO, 7));
|
|
|
|
|
form.findField('ENDNO').setValue(this.padNumber(ENDNO, 7));
|
|
|
|
|
form.findField('RCOUNT').setValue(this.padNumber(RCOUNT, 7));
|
|
|
|
|
this.SetWH(STARTNO, ENDNO);
|
|
|
|
|
}
|
|
|
|
|
,
|
|
|
|
|
padNumber: function (num, fill) {
|
|
|
|
|
//改自:http://blog.csdn.net/aimingoo/article/details/4492592
|
|
|
|
|
var len = ('' + num).length;
|
|
|
|
|
return (Array(
|
|
|
|
|
fill > len ? fill - len + 1 || 0 : 0
|
|
|
|
|
).join(0) + num);
|
|
|
|
|
}
|
|
|
|
|
, GetCount: function (STARTNO, ENDNO) {
|
|
|
|
|
if (STARTNO > ENDNO) {
|
|
|
|
|
return 0;
|
|
|
|
|
} else {
|
|
|
|
|
return Add(Cut(ENDNO, STARTNO), 1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
, GetStart: function (ENDNO, RCOUNT) {
|
|
|
|
|
|
|
|
|
|
return Add(Cut(ENDNO, RCOUNT), 1);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
, GetEnd: function (STARTNO, RCOUNT) {
|
|
|
|
|
|
|
|
|
|
return Cut(Add(STARTNO, RCOUNT), 1);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
, SetWH: function (STARTNO, ENDNO) {
|
|
|
|
|
//if (STARTNO >= 1000000) {
|
|
|
|
|
var WH1 = STARTNO % 7;
|
|
|
|
|
var form = this.formEdit.getForm();
|
|
|
|
|
|
|
|
|
|
form.findField('WH1').setValue(WH1);
|
|
|
|
|
//}
|
|
|
|
|
//if (ENDNO >= 1000000) {
|
|
|
|
|
var WH2 = ENDNO % 7;
|
|
|
|
|
var form = this.formEdit.getForm();
|
|
|
|
|
|
|
|
|
|
form.findField('WH2').setValue(WH2);
|
|
|
|
|
//}
|
|
|
|
|
}
|
|
|
|
|
,
|
|
|
|
|
MakeDetail: function () {
|
|
|
|
|
var form = this.formEdit.getForm();
|
|
|
|
|
|
|
|
|
|
var STARTNO = parseInt(form.findField('STARTNO').getValue());
|
|
|
|
|
var ENDNO = parseInt(form.findField('ENDNO').getValue());
|
|
|
|
|
var RCOUNT = parseInt(form.findField('RCOUNT').getValue());
|
|
|
|
|
if (STARTNO != "NaN" && ENDNO != "NaN" && RCOUNT != "NaN" && parseInt(RCOUNT) > 0) {// && STARTNO >= 1000000 && ENDNO >= 1000000
|
|
|
|
|
for (var i = STARTNO; i <= ENDNO; i++) {
|
|
|
|
|
|
|
|
|
|
RECEIPTNO = i + '' + i % 7;
|
|
|
|
|
var record = Ext.create('op_airn_RECEIPTmb', {
|
|
|
|
|
'GID': NewGuid(),
|
|
|
|
|
'BSNO': '',
|
|
|
|
|
'FIRSTCODE': this.formEdit.getForm().findField('FIRSTCODE').getValue(),
|
|
|
|
|
'RECEIPTNO': this.padNumber(RECEIPTNO, 8),
|
|
|
|
|
'RTYPE': '',
|
|
|
|
|
'ISBAOCANG': '0',
|
|
|
|
|
'ISWMS': '0',
|
|
|
|
|
'RSTATUS': '入库',
|
|
|
|
|
'OP': '', //SHOWNAME,
|
|
|
|
|
'OPDATE': '', //currdate.format('yyyy-MM-dd hh:mm:ss'),
|
|
|
|
|
'REMARK': ''
|
|
|
|
|
});
|
|
|
|
|
this.storeDetail.add(record);
|
|
|
|
|
|
|
|
|
|
var n = this.storeDetail.getCount();
|
|
|
|
|
this.cellEditingCargo.startEditByPosition({ row: n - 1, column: 2 });
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.storeDetail.each(function (r) {
|
|
|
|
|
if (r.data.OP == "") {
|
|
|
|
|
r.set('OP', SHOWNAME);
|
|
|
|
|
r.set('OPDATE', currdate.format('yyyy-MM-dd hh:mm:ss'));
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
this.Save('0');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|