Ext.namespace('Shipping');
Shipping.MsSeaeOrderEdit = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsSeaeOrderEdit.superclass.constructor.call(this);
};
Ext.extend(Shipping.MsSeaeOrderEdit, Ext.Panel, {
ParentWin: null,
OpStatus: 'add',
StoreList: null,
EditRecord: null,
Editdata: null,
isAudit: null,
accdate: null,
MsPeriod: null,
seaeop: "",
seaecustservice: "",
FORWARDER: "",
reason: "",
initUIComponents: function () {
this.serialNo = 0;
//this.bodyDel = [];
this.itemindex = 1;
_thissaleorder = this;
this.issubmit = true;
this.SALEORDERDEPTBYOP = 0;
this.SaleOrderAuditSelf = 0;
this.ISMUSTBECNTR = '0';
this.ISMUSTBEFEE= '0';
//#region 信息加载
//航线
this.storeLANE = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.Lane',
proxy: { url: '/CommMng/BasicDataRef/GetCodeLaneList' }
});
this.storeLANE.load();
this.comboxLANE = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '航线',
store: this.storeLANE,
// forceSelection: true,
name: 'LANE',
valueField: 'LANE',
displayField: 'LANE'
});
this.storeDefValue = Ext.create('Ext.data.Store', {
model: 'DsShipping.ux.OpDefValue',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsCodeOpDef/GetDataList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.storeMustBe = Ext.create('Ext.data.Store', {
model: 'DsShipping.ux.OpDefValue',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsCodeOpMustField/GetDataList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//权限范围
this.StoreOpRange = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsOP',
proxy: { url: '/MvcShipping/MsBaseInfo/GetOpRang' }
});
this.StoreOpRange.load({ params: { optype: "modSeaeOrderList"} });
//人员信息加载
this.storeSERVICECode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.UserRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetUserLinkRefListRm' }
});
this.storeSERVICECode.on('beforeload', function (store) {
var sql = " u.GID IN (SELECT USERID FROM user_userattribute WHERE ATTRIBUTEID='D4BF2204-F0AC-4F12-B02C-6520D57BF806' and VALUE='true' ) ";
Ext.apply(store.proxy.extraParams, { condition: sql });
}, this);
var sql = " u.GID IN (SELECT USERID FROM user_userattribute WHERE ATTRIBUTEID='D4BF2204-F0AC-4F12-B02C-6520D57BF806' and VALUE='true' ) ";
this.storeSERVICECode.load({ params: { condition: sql} });
//客服
this.comboxCUSTSERVICE = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '客服',
store: this.storeSERVICECode,
forceSelection: true,
queryMode: 'remote',
//flex: 0.5,
minChars: 0,
queryParam: 'CODENAME',
name: 'CUSTSERVICE',
valueField: 'UserName',
displayField: 'CodeAndName'
});
//this.storeSERVICECode.on('beforeload', function (store) {
// var condition = "";
// var corpid = this.formHead.getForm().findField('SALECORPID').getValue();
// if (corpid != '' && corpid != null) condition = " c.companyid='" + corpid + "'";
// Ext.apply(store.proxy.extraParams, { condition: condition });
//}, this);
//揽货人
this.storeSaleCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.UserRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetUserLinkRefListRm' }
});
this.storeSaleCode.load();
this.comboxSALE = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '揽货人',
store: this.storeSaleCode,
forceSelection: true,
queryMode: 'remote',
//flex: 0.5,
minChars: 0,
queryParam: 'CODENAME',
name: 'SALE',
valueField: 'UserName',
displayField: 'CodeAndName',
value: SHOWNAME,
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
if (this.SALEORDERDEPTBYOP == 0)
this.formHead.getForm().findField('SALEDEPT').setValue(records[0].data.DEPTNAME);
}
}
}
});
this.storeSaleCode.on('beforeload', function (store) {
var condition = "";
var corpid = this.formHead.getForm().findField('SALECORPID').getValue();
if (corpid != '' && corpid != null) condition = " c.companyid='" + corpid + "'";
Ext.apply(store.proxy.extraParams, { condition: condition });
}, this);
//所属部门
this.storeDept = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.DeptModel',
proxy: { url: '/CommMng/BasicDataRef/GetDeptList' }
});
this.storeDept.load();
this.comboxDept = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '所属部门', //'所属部门',
store: this.storeDept,
// flex: 0.5,
forceSelection: true,
name: 'SALEDEPT',
value:DEPTNAME,
valueField: 'DeptName',
displayField: 'DeptName'
//,hidden: true
});
//操 作
this.storeOpCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.UserRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetUserLinkRefListRm' }
});
this.storeOpCode.load();
this.comboxOP = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '操 作',
store: this.storeOpCode,
forceSelection: true,
queryMode: 'remote',
//flex: 0.5,
minChars: 0,
queryParam: 'CODENAME',
name: 'OP',
valueField: 'UserName',
displayField: 'CodeAndName',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
if (this.SALEORDERDEPTBYOP == 1)
this.formHead.getForm().findField('SALEDEPT').setValue(records[0].data.DEPTNAME);
}
}
}
});
this.storeOpCode.on('beforeload', function (store) {
var condition = "";
var corpid = this.formHead.getForm().findField('SALECORPID').getValue();
if (corpid != '' && corpid != null) condition = " c.companyid='" + corpid + "'";
Ext.apply(store.proxy.extraParams, { condition: condition });
}, this);
//单证
this.storeDocCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.UserRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetUserLinkRefListRm' }
});
this.storeDocCode.load();
this.comboxDOC = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '单证',
store: this.storeDocCode,
forceSelection: true,
queryMode: 'remote',
//flex: 0.5,
minChars: 0,
queryParam: 'CODENAME',
name: 'DOC',
valueField: 'UserName',
displayField: 'CodeAndName'
});
//单证
this.storeFRCUSTSERVICECode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.UserRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetUserLinkRefListRm' }
});
this.storeFRCUSTSERVICECode.load();
this.comboxFRCUSTSERVICE = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '海外客服',
store: this.storeFRCUSTSERVICECode,
forceSelection: true,
queryMode: 'remote',
//flex: 0.5,
minChars: 0,
queryParam: 'CODENAME',
name: 'FRCUSTSERVICE',
valueField: 'UserName',
displayField: 'CodeAndName'
});
this.storeAuditCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.UserRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetUserActionRefListRm' }
});
this.storeAuditCode.on('beforeload', function (store) {
Ext.apply(store.proxy.extraParams, { MODULENAME:'modSaleOrderAudit' });
}, this);
this.storeAuditCode.load();
this.comboxAUDITOPERATOR = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '审核人',
store: this.storeAuditCode,
forceSelection: true,
name: 'AUDITOPERATOR',
valueField: 'UserName',
displayField: 'CodeAndName'
});
//客户加载_委托单位
this.storeCustCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefListController' }
});
// this.storeCustCode.load({ params: { condition: "ISCONTROLLER='1'"} });
//委托单位
this.comboxCustCode = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '委托单位',
store: this.storeCustCode,
queryMode: 'remote',
forceSelection: true,
minChars: 1,
queryParam: 'CODENAME',
name: 'CUSTOMERNAME',
id: 'CUSTOMERNAME',
valueField: 'CustName',
displayField: 'CodeAndName',
allowBlank: false,
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
var data = combo.value;
if (this.formBill.getForm().findField('SHIPPER').getValue()=='') {
this.storeShipper.load({
params: { condition: "shippertype=2 AND (CODENAME IN (SELECT CODENAME FROM info_client WHERE SHORTNAME='" + combo.value + "') )" },
callback: function (r, options, success) {
if (success) {
if (this.storeShipper.getCount() > 0) {
var member = this.storeShipper.getAt(0);
this.formBill.getForm().findField('SHIPPERID').setValue(member.data.SHORTNAME);
this.formBill.getForm().findField('SHIPPER').setValue(member.data.SHIPPERDETAIL);
} else {
this.formBill.getForm().findField('SHIPPERID').setValue('');
this.formBill.getForm().findField('SHIPPER').setValue('');
}
}
},
scope: this
});
}
if (records[0].data.SALE != '') {
this.formHead.getForm().findField('SALE').setValue(records[0].data.SALE);
}
if (records[0].data.OP != '') {
this.formHead.getForm().findField('OP').setValue(records[0].data.OP);
}
if (records[0].data.DOC != '') {
this.formHead.getForm().findField('DOC').setValue(records[0].data.DOC);
}
if (records[0].data.CUSTSERVICE != '') {
this.formHead.getForm().findField('CUSTSERVICE').setValue(records[0].data.CUSTSERVICE);
}
this.storeConsignee.load({ params: { condition: "shippertype=1 AND (ISPUBLIC=1 OR CODENAME IN (SELECT CODENAME FROM info_client WHERE SHORTNAME='" + combo.value + "') )"} });
this.storenotifyparty.load({ params: { condition: "shippertype=3 AND (ISPUBLIC=1 OR CODENAME IN (SELECT CODENAME FROM info_client WHERE SHORTNAME='" + combo.value + "') )"} });
var s = " ISOPERATOR=1 and LINKID in (select gid from [info_client] where SHORTNAME='" + combo.value + "')";
this.storeInfoClientContact.load({ params: { condition: s },
callback: function (r, options, success) {
if (success) {
if (this.storeInfoClientContact.getCount() > 0) {
var member = this.storeInfoClientContact.getAt(0);
this.formHead.getForm().findField('OPERATOR').setValue(member.data.SHOWNAME);
this.formHead.getForm().findField('OPERATORTEL').setValue(member.data.TEL);
this.formHead.getForm().findField('OPERATOREMAIL').setValue(member.data.EMAIL);
} else {
this.formHead.getForm().findField('OPERATOR').setValue('');
this.formHead.getForm().findField('OPERATORTEL').setValue('');
this.formHead.getForm().findField('OPERATOREMAIL').setValue('');
}
}
},
scope: this
});
if (records[0].data.BSSOURCE != '') {
this.formHead.getForm().findField('BSSOURCE').setValue(records[0].data.BSSOURCE);
var recs = DsStoreQueryBy(this.storeSource, 'SourceName', records[0].data.BSSOURCE);
if (recs.getCount() > 0) {
var data = recs.getAt(0).data;
var s = "SOURCEID='" + data.SourceID + "'";
this.storeSourceDetail.load({ params: { condition: s } });
} else {
var BSSOURCEDETAIL = this.formHead.getForm().findField('BSSOURCEDETAIL');
BSSOURCEDETAIL.setValue('');
}
}
}
}
}
});
this.storeInfoClientContact = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.InfoClientContactModel',
proxy: { url: '/CommMng/BasicDataRef/GetInfoClientContactList' }
});
this.comboxInfoClientContact = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '联系人',
store: this.storeInfoClientContact,
name: 'OPERATOR',
valueField: 'SHOWNAME',
displayField: 'SHOWNAME',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
this.formHead.getForm().findField('OPERATORTEL').setValue(records[0].data.TEL);
this.formHead.getForm().findField('OPERATOREMAIL').setValue(records[0].data.EMAIL);
}
}
}
});
//客户加载_船公司
this.storeCARRIER = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefListCARRIER' }
});
// this.storeCARRIER.load({ params: { condition: "ISCARRIER='1'"} });
//船公司
this.comboxCARRIER = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '船公司',
store: this.storeCARRIER,
queryMode: 'remote',
forceSelection: true,
minChars: 1,
queryParam: 'CODENAME',
name: 'CARRIER',
valueField: 'CustName',
displayField: 'CodeAndName',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
var s = " ISOPERATOR=1 and LINKID in (select gid from [info_client] where SHORTNAME='" + combo.value + "')";
this.storeInfoClientContactCARRIER.load({ params: { condition: s },
callback: function (r, options, success) {
if (success) {
if (this.storeInfoClientContactCARRIER.getCount() > 0) {
var member = this.storeInfoClientContactCARRIER.getAt(0);
this.formHead.getForm().findField('CARRIERATTN').setValue(member.data.SHOWNAME);
this.formHead.getForm().findField('CARRIERTEL').setValue(member.data.TEL);
this.formHead.getForm().findField('CARRIEREMAIL').setValue(member.data.EMAIL);
} else {
this.formHead.getForm().findField('CARRIERATTN').setValue('');
this.formHead.getForm().findField('CARRIERTEL').setValue('');
this.formHead.getForm().findField('CARRIEREMAIL').setValue('');
}
}
},
scope: this
});
}
}
}
});
this.storeInfoClientContactCARRIER = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.InfoClientContactModel',
proxy: { url: '/CommMng/BasicDataRef/GetInfoClientContactList' }
});
this.comboxInfoClientContactCARRIER = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '联系人',
store: this.storeInfoClientContactCARRIER,
name: 'CARRIERATTN',
valueField: 'SHOWNAME',
displayField: 'SHOWNAME',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
this.formHead.getForm().findField('CARRIERTEL').setValue(records[0].data.TEL);
this.formHead.getForm().findField('CARRIEREMAIL').setValue(records[0].data.EMAIL);
}
}
}
});
//客户加载_订舱代理
this.storeFORWARDER = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefListFORWARDER' }
});
// this.storeFORWARDER.load({ params: { condition: "ISBOOKING='1'"} });
//船公司
this.comboxFORWARDER = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '订舱代理',
store: this.storeFORWARDER,
queryMode: 'remote',
forceSelection: true,
minChars: 1,
queryParam: 'CODENAME',
name: 'FORWARDER',
valueField: 'CustName',
displayField: 'CodeAndName',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
var s = " ISOPERATOR=1 and LINKID in (select gid from [info_client] where SHORTNAME='" + combo.value + "')";
this.storeInfoClientContactFORWARDER.load({ params: { condition: s },
callback: function (r, options, success) {
if (success) {
if (this.storeInfoClientContactFORWARDER.getCount() > 0) {
var member = this.storeInfoClientContactFORWARDER.getAt(0);
this.formHead.getForm().findField('FORWARDERATTN').setValue(member.data.SHOWNAME);
this.formHead.getForm().findField('FORWARDERTEL').setValue(member.data.TEL);
this.formHead.getForm().findField('FORWARDEREMAIL').setValue(member.data.EMAIL);
} else {
this.formHead.getForm().findField('FORWARDERATTN').setValue('');
this.formHead.getForm().findField('FORWARDERTEL').setValue('');
this.formHead.getForm().findField('FORWARDEREMAIL').setValue('');
}
}
},
scope: this
});
}
}
}
});
this.storeInfoClientContactFORWARDER = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.InfoClientContactModel',
proxy: { url: '/CommMng/BasicDataRef/GetInfoClientContactList' }
});
this.comboxInfoClientContactFORWARDER = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '联系人',
store: this.storeInfoClientContactFORWARDER,
name: 'FORWARDERATTN',
valueField: 'SHOWNAME',
displayField: 'SHOWNAME',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
this.formHead.getForm().findField('FORWARDERTEL').setValue(records[0].data.TEL);
this.formHead.getForm().findField('FORWARDEREMAIL').setValue(records[0].data.EMAIL);
}
}
}
});
this.storePKGTYPE = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsExtEnumModel',
proxy: { url: '/CommMng/PubSys/GetEnumValueList' }
});
this.storePKGTYPE.load({ params: { enumTypeId: 97011} });
this.comboxPKGTYPE = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '装箱类型',
store: this.storePKGTYPE,
forceSelection: true,
name: 'PACKINGTYPE',
valueField: 'EnumValueName',
displayField: 'EnumValueName'
});
this.StoreCargoid = Ext.create('Ext.data.Store', {
fields: ['ID', 'NAME']
});
this.StoreCargoid.add({ "ID": "S", "NAME": "S普通货" });
this.StoreCargoid.add({ "ID": "R", "NAME": "R冻柜" });
this.StoreCargoid.add({ "ID": "D", "NAME": "D危险品" });
this.StoreCargoid.add({ "ID": "O", "NAME": "O超限箱" });
this.comboxCargoid = Ext.create('DsExt.ux.RefTableCombox', {
store: this.StoreCargoid,
fieldLabel: '货物标示',
forceSelection: true,
name: 'CARGOID',
valueField: 'ID',
displayField: 'NAME',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
if (combo.value == 'R') {
this.panelBodyDr.setVisible(false);
this.panelBodyRf.setVisible(true);
} else if (combo.value == 'D') {
this.panelBodyDr.setVisible(true);
this.panelBodyRf.setVisible(false);
} else {
this.panelBodyDr.setVisible(false);
this.panelBodyRf.setVisible(false);
}
}
}
}
});
//键值维护表_装运方式
this.StoreBLTYPE = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsExtEnumModel',
proxy: { url: '/CommMng/PubSys/GetEnumValueList' }
});
this.StoreBLTYPE.load({ params: { enumTypeId: 97042} });
this.comboxBLTYPE = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '装运方式',
store: this.StoreBLTYPE,
forceSelection: true,
name: 'BLTYPE',
valueField: 'EnumValueName',
displayField: 'EnumValueName',
value: '整箱',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
if (combo.value == "拼箱单票" || combo.value == "拼箱分票") {
if (this.storeBodyList.getCount() > 0) {
combo.setValue(combo.originalValue);
alert("拼箱单票、拼箱分票是不允许添加集装箱信息的,因此请先删除集装箱信息!");
return;
}
else {
this.panelBodyCtn.hide();
}
}
else {
this.panelBodyCtn.show();
}
}
}
}
});
//品名
this.storeCodeGoodsList = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CodeGoodsModel',
proxy: { url: '/CommMng/BasicDataRef/GetCodeGoodsList' }
});
this.storeCodeGoodsList.load();
this.comboxGOODSNAME = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: 'Description of Goods (包装种类与货名)',
store: this.storeCodeGoodsList,
flex: 1.5,
labelWidth: 250,
// forceSelection: true,
name: 'GOODSNAME',
valueField: 'GOODNAME',
displayField: 'CodeAndName'
});
this.StoreStlName = Ext.create('Ext.data.Store', {
fields: ['STLNAME']
});
this.StoreStlName.add({ "STLNAME": "票结" });
this.StoreStlName.add({ "STLNAME": "半月结" });
this.StoreStlName.add({ "STLNAME": "月结" });
this.StoreStlName.add({ "STLNAME": "周结" });
this.comboxStlName = Ext.create('DsExt.ux.RefTableCombox', {
store: this.StoreStlName,
fieldLabel: '结算方式',
forceSelection: true,
name: 'STLNAME',
valueField: 'STLNAME',
displayField: 'STLNAME'
});
//件数包装
this.storeCodePackage = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CodePackageModel',
proxy: { url: '/CommMng/BasicDataRef/GetCodePackageList' }
});
this.storeCodePackage.load();
this.comboxKINDPKGS = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '包 装',
store: this.storeCodePackage,
forceSelection: true,
name: 'KINDPKGS',
valueField: 'PKGS',
displayField: 'PKGS',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
var str_num = this.formEdit.getForm().findField('PKGS').getValue();
this.formBill.getForm().findField('TOTALNO').setValue('SAY:' + ToEn(str_num).toUpperCase() + ' ' + combo.value + ' ONLY.');
}
}
}
});
//件数包装_集装箱列表中的下拉框加载
this.comboxKINDPKGS_CTN = Ext.create('DsExt.ux.RefTableCombox', {
//fieldLabel: '件数包装',
store: this.storeCodePackage,
forceSelection: true,
name: 'KINDPKGS',
valueField: 'PKGS',
displayField: 'PKGS'
});
//箱型_集装箱列表中的下拉框加载
this.storeCodeCtn = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CodeCtnModel',
proxy: { url: '/CommMng/BasicDataRef/GetCodeCtnList' }
});
this.storeCodeCtn.load();
this.comboxCTNALL = Ext.create('DsExt.ux.RefTableCombox', {
//fieldLabel: '箱型',
store: this.storeCodeCtn,
forceSelection: true,
name: 'CTNALL',
valueField: 'CTN',
displayField: 'CTN'
});
//客户加载_发货人
this.storeShipper = Ext.create('DsExt.ux.RefTableStore', {
model: 'OpSeaeShipper',
proxy: { url: '/MvcShipping/MsOpSeae/GetShipperList' }
});
// this.storeShipper.load({ params: { condition: "ISCONTROLLER='1'"} });
//发货人
this.comboxShipper = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: 'Shipper (发货人)',
store: this.storeShipper,
forceSelection: true,
labelWidth: 150,
labelAlign: 'left',
name: 'SHIPPERID',
valueField: 'SHORTNAME',
displayField: 'CodeAndName',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
var selectrecords = DsStoreQueryBy(this.storeShipper, 'SHORTNAME', combo.value);
if (selectrecords.getCount() > 0) {
var selectdata = selectrecords.getAt(0).data;
this.formBill.getForm().findField('SHIPPER').setValue(selectdata.SHIPPERDETAIL);
} else {
this.formBill.getForm().findField('SHIPPER').setValue('');
}
}
}
}
});
//客户加载_收货人
this.storeConsignee = Ext.create('DsExt.ux.RefTableStore', {
model: 'OpSeaeShipper',
proxy: { url: '/MvcShipping/MsOpSeae/GetShipperList' }
});
// this.storeShipper.load({ params: { condition: "ISCONTROLLER='1'"} });
//收货人
this.comboxConsignee = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: 'Consignee (收货人)',
labelWidth: 150,
labelAlign: 'left',
store: this.storeConsignee,
forceSelection: true,
name: 'CONSIGNEEID',
valueField: 'SHORTNAME',
displayField: 'CodeAndName',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
var selectrecords = DsStoreQueryBy(this.storeConsignee, 'SHORTNAME', combo.value);
if (selectrecords.getCount() > 0) {
var selectdata = selectrecords.getAt(0).data;
this.formBill.getForm().findField('CONSIGNEE').setValue(selectdata.SHIPPERDETAIL);
} else {
this.formBill.getForm().findField('CONSIGNEE').setValue('');
}
}
}
}
});
//客户加载_通知人
this.storenotifyparty = Ext.create('DsExt.ux.RefTableStore', {
model: 'OpSeaeShipper',
proxy: { url: '/MvcShipping/MsOpSeae/GetShipperList' }
});
// this.storeShipper.load({ params: { condition: "ISCONTROLLER='1'"} });
//通知人
this.comboxNotifyParty = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: 'Notify Party (通知人)',
store: this.storenotifyparty,
labelWidth: 150,
labelAlign: 'left',
forceSelection: true,
name: 'NOTIFYPARTYID',
valueField: 'SHORTNAME',
displayField: 'CodeAndName',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
var selectrecords = DsStoreQueryBy(this.storenotifyparty, 'SHORTNAME', combo.value);
if (selectrecords.getCount() > 0) {
var selectdata = selectrecords.getAt(0).data;
this.formBill.getForm().findField('NOTIFYPARTY').setValue(selectdata.SHIPPERDETAIL);
} else {
this.formBill.getForm().findField('NOTIFYPARTY').setValue('');
}
}
}
}
});
this.myCheckboxService = new Ext.form.CheckboxGroup({
id: 'myService',
xtype: 'checkboxgroup',
fieldLabel: '服务项目',
columns: 8,
items: [{
boxLabel: '熏蒸',
inputValue: true,
name: 'ISFUMIGATION',
id: 'ISFUMIGATION'
}, {
boxLabel: '仓储',
inputValue: true,
name: 'ISSTORAGE',
id: 'ISSTORAGE'
}, {
boxLabel: '陆运',
inputValue: true,
name: 'ISLAND',
id: 'ISLAND'
}, {
boxLabel: '报关',
inputValue: true,
name: 'ISCUSTOMS',
id: 'ISCUSTOMS'
}, {
boxLabel: '报检',
inputValue: true,
name: 'ISINSPECTION',
id: 'ISINSPECTION'
}, {
boxLabel: '订舱',
inputValue: true,
name: 'ISBOOKING',
id: 'ISBOOKING'
}, {
boxLabel: '使用代理',
inputValue: true,
name: 'ISAGENT',
id: 'ISAGENT'
}, {
boxLabel: '分单签单',
inputValue: true,
name: 'ISHBLNO',
id: 'ISHBLNO'
}
]
});
//付费方式
this.storeFrt = Ext.create('DsExt.ux.RefTableStore', {
model: 'CODE_FRT',
proxy: { url: '/CommMng/BasicDataRef/GetCodeFrtList' }
});
this.storeFrt.load({ params: { condition: ""} });
this.comboxBLFRT = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '付费方式',
store: this.storeFrt,
forceSelection: true,
name: 'BLFRT',
valueField: 'FRT',
displayField: 'FRT',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
if (combo.value == "FREIGHT PREPAID") {
var portload = this.formEdit.getForm().findField('PORTLOAD').getValue();
this.formBill.getForm().findField('PREPARDAT').setValue(portload);
this.formBill.getForm().findField('PAYABLEAT').setValue('');
} else if (combo.value == "FREIGHT COLLECT") {
var PORTDISCHARGE = this.formEdit.getForm().findField('PORTDISCHARGE').getValue();
this.formBill.getForm().findField('PREPARDAT').setValue('');
this.formBill.getForm().findField('PAYABLEAT').setValue(PORTDISCHARGE);
}
}
}
}
});
//客户加载_代理
this.storeagent = Ext.create('DsExt.ux.RefTableStore', {
model: 'OpSeaeShipper',
proxy: { url: '/MvcShipping/MsOpSeae/GetShipperList' }
});
this.storeagent.load({ params: { condition: "shippertype=4 " },
callback: function (r, options, success) {
if (success) {
// this.formEdit.getForm().findField('AGENTID').setValue(data.AGENTID);
}
},
scope: this
});
// this.storeShipper.load({ params: { condition: "ISCONTROLLER='1'"} });
//收货人
this.comboxAgent = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '国外代理', //'代 理',
store: this.storeagent,
// forceSelection: true,
name: 'AGENTID',
valueField: 'SHORTNAME',
displayField: 'CodeAndName',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
var selectrecords = DsStoreQueryBy(this.storeagent, 'SHORTNAME', combo.value);
if (selectrecords.getCount() > 0) {
var selectdata = selectrecords.getAt(0).data;
this.formBill.getForm().findField('AGENT').setValue(selectdata.SHIPPERDETAIL);
} else {
this.formBill.getForm().findField('AGENT').setValue('');
}
}
}
}
});
//#endregion
//运输条款
this.storeSERVICE = Ext.create('DsExt.ux.RefTableStore', {
model: 'CODE_SERVICE',
proxy: { url: '/CommMng/BasicDataRef/GetCodeServiceList' }
});
this.storeSERVICE.load({ params: { condition: ""} });
this.comboxSERVICE = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '运输条款',
store: this.storeSERVICE,
forceSelection: true,
name: 'SERVICE',
valueField: 'SERVICE',
displayField: 'SERVICE'
});
this.ORREMARK = '';
//客户加载_场站
this.storeYARD = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefListYARD' }
});
this.storeYARD.load();
//
this.comboxYARD = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '场站', //'场站',
store: this.storeYARD,
forceSelection: true,
queryMode: 'remote',
minChars: 0,
queryParam: 'CODENAME',
name: 'YARD',
valueField: 'CustName',
displayField: 'CodeAndName'
});
//业务来源
this.storeSource = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.SourceModel',
proxy: { url: '/CommMng/BasicDataRef/GetSource' }
});
this.storeSource.load();
this.storeSourceDetail = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.SourceDetailModel',
proxy: { url: '/CommMng/BasicDataRef/GetSourceDetail2' }
});
this.comboxBSSOURCE = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '业务来源', //'业务来源',
store: this.storeSource,
// forceSelection: true,
name: 'BSSOURCE',
valueField: 'SourceName',
displayField: 'SourceName',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
var recs = DsStoreQueryBy(this.storeSource, 'SourceID', records[0].data.SourceID);
if (recs.getCount() > 0) {
var data = recs.getAt(0).data;
var s = "SOURCEID='" + data.SourceID + "'";
this.storeSourceDetail.load({ params: { condition: s } });
} else {
var BSSOURCEDETAIL = this.formHead.getForm().findField('BSSOURCEDETAIL');
BSSOURCEDETAIL.setValue('');
}
}
}
}
});
this.storeSourceDetail.load();
this.comboxBSSOURCEDETAIL = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '来源明细', //'来源明细',
store: this.storeSourceDetail,
// forceSelection: true,
name: 'BSSOURCEDETAIL',
valueField: 'SourceDetail',
displayField: 'SourceDetail'
});
this.storeSaleCompany = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsCompanysEntity',
proxy: { url: '/MvcShipping/MsCompanys/GetNoPicDataList' }
});
this.storeSaleCompany.load({ params: { condition: "" } });
this.comboxSaleCompany = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel:'所属分部', //'委托分公司',
store: this.storeSaleCompany,
forceSelection: true,
name: 'SALECORPID',
valueField: 'GID',
displayField: 'NAME',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
this.storeSERVICECode.load();
this.storeSaleCode.load();
this.storeOpCode.load();
}
}
}
});
this.storeTRADETERM = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeTRADETERM.load({ params: { enumTypeId: 97023 } });
this.comboxTRADETERM = Ext.create('DsExt.ux.RefEnumCombox', {
fieldLabel:'贸易条款',
store: this.storeTRADETERM,
forceSelection: true,
//flex: 0.5,
name: 'TRADETERM'
});
//#region 编辑formHead 基本信息
this.formHead = Ext.widget('form', {
region: 'north',
frame: true,
bodyPadding: 5,
// collapsed: false,
// collapsible: true,
trackResetOnLoad: true,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 70,
msgTarget: 'qtip'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '业务编号',
name: 'BSNO', hidden: true
}, {
fieldLabel: 'INPUTBY',
name: 'INPUTBY', hidden: true
}, {
fieldLabel: 'ORSTATUS',
name: 'ORSTATUS', hidden: true
}, {
fieldLabel: 'DEFSALE',
name: 'DEFSALE', hidden: true
}, {
fieldLabel: 'CONFIRMOP',
name: 'CONFIRMOP', hidden: true
}, {
fieldLabel: 'CONFIRMDATE',
name: 'CONFIRMDATE', hidden: true
}, {
fieldLabel: '订舱单号',
readOnly: true,
disabled: true,
name: 'ORDNO'
}, {
fieldLabel: '订舱状态',
readOnly: true,
name: 'ORSTATUSREF'
}, {
fieldLabel: '主提单号',
name: 'MBLNO'
}, this.comboxBLTYPE, this.comboxCargoid, this.comboxBLFRT]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '委托编号',
readOnly: true,
disabled: true,
name: 'CUSTNO'
}, this.comboxSALE, this.comboxOP, this.comboxCUSTSERVICE, this.comboxDOC, this.comboxFRCUSTSERVICE]
}, this.myCheckboxService, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxCustCode, this.comboxInfoClientContact, {
fieldLabel: '电话',
name: 'OPERATORTEL'
}, {
fieldLabel: '邮箱',
name: 'OPERATOREMAIL'
}, {
fieldLabel: '结算方式',
readOnly: true,
disabled: true,
name: 'STLNAME'
}, {
fieldLabel: '结算日期',
disabled: true,
name: 'STLDATE'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxCARRIER, this.comboxInfoClientContactCARRIER, {
fieldLabel: '电话',
name: 'CARRIERTEL'
}, {
fieldLabel: '邮箱',
name: 'CARRIEREMAIL'
}, this.comboxAUDITOPERATOR, {
fieldLabel: '审核日期',
readOnly: true,
name: 'AUDITDATE'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxFORWARDER, this.comboxInfoClientContactFORWARDER, {
fieldLabel: '电话',
name: 'FORWARDERTEL'
}, {
fieldLabel: '发票号',
name: 'INVNO'
}, {
fieldLabel: '服务合同号',
name: 'SERVICECONTRACTNO'
}, {
xtype: 'container',
layout: 'hbox',
flex: 1,
defaultType: 'textfield',
items: [{
fieldLabel: '运费协议号',
name: 'CONTRACTNO'
}, {
xtype: 'button',
iconCls: "btnedit",
handler: function (button, event) {
this.GetContractFee();
},
scope: this
}]
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxBSSOURCE, this.comboxBSSOURCEDETAIL, this.comboxDept, this.comboxSaleCompany, this.comboxTRADETERM, { xtype: 'hiddenfield' }]
}
]//end items(fieldset 1)
}); //end this.formEdit
//#endregion
//#region 集装箱-数据集
this.storeBodyList = Ext.create('Ext.data.Store', {
model: 'MsSeaeOrderCtn',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsSeaeOrder/GetBodyList',
reader: {
id: 'ORDNO,CTN_ID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//明细表表格
this.gridListCellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});
this.gridList = new Ext.grid.GridPanel({
store: this.storeBodyList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
plugins: [this.gridListCellEditing],
selType: 'cellmodel',
tbar: [{
text: '增加明细',
tooltip: '增加明细',
id: "btnadddetail",
iconCls: "btnadddetail",
handler: function (button, event) {
this.onAddDetailClick(button, event);
},
scope: this
}, '-', {
text: '删除明细',
tooltip: '删除明细',
id: "btndeldetail",
iconCls: "btndeletedetail",
handler: function (button, event) {
this.onDelDetailClick(button, event);
},
scope: this
}],
columns: [{
sortable: true,
dataIndex: 'CTN_ID',
header: '编号',
hidden: true,
width: 0
}, {
sortable: true,
dataIndex: 'ORDNO',
header: '业务编号',
hidden: true,
width: 0
}, {
dataIndex: 'CTNALL', //CTNEXHIBIT
header: '箱型',
width: 70,
editor: this.comboxCTNALL
}, {
dataIndex: 'CTNNUM',
header: '箱量',
width: 50,
editor: {
xtype: 'numberfield',
allowBlank: false,
selectOnFocus: true
}
}, {
dataIndex: 'REMARK',
header: '备注',
width: 150,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
}]
});
//#endregion
this.panelBodyCtn = new Ext.Panel({
title: '集装箱信息',
layout: "border",
height: 130,
//margin: '5 10',
frame: true,
items: [this.gridList]
});
// this.panelORREASON = new Ext.Panel({
// title: "驳回原因",
// layout: "border",
// height: 60,
// flex: 1,
// //margin: '5 10',
// frame: true,
// items: [{
// xtype: 'textareafield',
// grow: true,
// fieldLabel: '',
// labelSeparator: '',
// labelWidth: 0,
// height: 100,
// name: 'ORREASON',
// anchor: '100%'
// }]
// });
this.panelBodyDr = new Ext.Panel({
title: '危险品信息',
layout: "border",
hidden: true,
height: 60,
frame: true,
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
defaults: {
anchor: '96%'
},
items: [{
fieldLabel: '危险品等级',
flex: 1,
labelWidth: 70,
name: 'DCLASS'
}, {
fieldLabel: '危险品编号',
flex: 1,
labelWidth: 70,
name: 'DUNNO'
}, {
fieldLabel: '危险品页号',
flex: 1,
labelWidth: 70,
name: 'DPAGE'
}, {
fieldLabel: '危险品标签',
flex: 1,
labelWidth: 70,
name: 'DLABEL'
}, {
fieldLabel: '危险品联系人',
flex: 1,
labelWidth: 90,
name: 'LINKMAN'
}]
}]
});
this.StoreTemp = Ext.create('Ext.data.Store', {
fields: ['ID', 'NAME']
});
this.StoreTemp.add({ "ID": "C", "NAME": "C摄氏" });
this.StoreTemp.add({ "ID": "F", "NAME": "F华氏" });
this.comboxTemp = Ext.create('DsExt.ux.RefTableCombox', {
store: this.StoreTemp,
fieldLabel: '温度单位',
forceSelection: true,
name: 'TEMPID',
valueField: 'ID',
displayField: 'NAME'
});
this.panelBodyRf = new Ext.Panel({
title: '冻柜信息',
layout: "border",
hidden: true,
height: 60,
//margin: '5 10',
frame: true,
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '冷藏通风量',
name: 'REEFERF'
}, {
fieldLabel: '设置温度',
name: 'TEMPSET'
}, this.comboxTemp]
}]
});
this.storeVoyVeg = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.VesselModel',
proxy: { url: '/CommMng/BasicDataRef/GetVesselList' }
});
this.storeVoyVeg.load({ params: { condition: ""} });
this.comboxVoyVeg = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '船 名',
store: this.storeVoyVeg,
name: 'VESSEL',
valueField: 'VESSEL',
flex: 2,
displayField: 'VESSEL',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
var selectrecords = DsStoreQueryBy(this.storeVoyVeg, 'VoyName', combo.value);
if (selectrecords.getCount() > 0) {
var selectdata = selectrecords.getAt(0).data;
this.formBill.getForm().findField('VESSELID').setValue(selectdata.EDICODE);
} else {
this.formBill.getForm().findField('VESSELID').setValue('');
}
}
}
}
});
//国际港口(进口装货港、出口卸货港)
this.storeCodeDisport = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CodeDisportModel',
proxy: { url: '/CommMng/BasicDataRef/GetCodeDisportListRm' }
});
// this.storeCodeDisport.load();
this.storeCodeDisport2 = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CodeDisportModel',
proxy: { url: '/CommMng/BasicDataRef/GetCodeDisportListRm' }
});
// this.storeCodeDisport2.load();
this.storeCodeDisport3 = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CodeDisportModel',
proxy: { url: '/CommMng/BasicDataRef/GetCodeDisportListRm' }
});
// this.storeCodeDisport3.load();
this.storeCodeDisport4 = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CodeDisportModel',
proxy: { url: '/CommMng/BasicDataRef/GetCodeDisportListRm' }
});
this.storeCodeDisport5 = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CodeDisportModel',
proxy: { url: '/CommMng/BasicDataRef/GetCodeDisportListRm' }
});
// this.storeCodeDisport4.load();
//国内港口(出口装货港、进口卸货港)
this.storeCodeLoadport = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CodeLoadportModel',
proxy: { url: '/CommMng/BasicDataRef/GetCodeLoadportListRm' }
});
this.storeCodeLoadport.load();
this.comboxPORTLOAD = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '装货港',
store: this.storeCodeLoadport,
queryMode: 'remote',
minChars: 2,
queryParam: 'PORT',
name: 'PORTLOAD',
valueField: 'PORT',
displayField: 'CodeAndName',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
var selectrecords = DsStoreQueryBy(this.storeCodeLoadport, 'PORT', combo.value);
if (selectrecords.getCount() > 0) {
var selectdata = selectrecords.getAt(0).data;
this.formBill.getForm().findField('PORTLOADID').setValue(selectdata.EDICODE);
} else {
this.formBill.getForm().findField('PORTLOADID').setValue('');
}
}
}
}
});
this.comboxPORTDISCHARGE = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '卸货港',
store: this.storeCodeDisport,
name: 'PORTDISCHARGE',
valueField: 'PORT',
queryMode: 'remote',
matchFieldWidth: false,
minChars: 1,
queryParam: 'PORT',
displayField: 'CodeAndName',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
var selectrecords = DsStoreQueryBy(this.storeCodeDisport, 'PORT', combo.value);
if (selectrecords.getCount() > 0) {
var selectdata = selectrecords.getAt(0).data;
this.formBill.getForm().findField('PORTDISCHARGEID').setValue(selectdata.EDICODE);
var DESTINATION = this.formBill.getForm().findField('DESTINATIONID').getValue();
if (DESTINATION == null || DESTINATION == '') {
this.formEdit.getForm().findField('DESTINATION').setValue(combo.value);
this.formBill.getForm().findField('DESTINATIONID').setValue(selectdata.EDICODE);
}
var PLACEDELIVERY = this.formBill.getForm().findField('PLACEDELIVERYID').getValue();
if (PLACEDELIVERY == null || PLACEDELIVERY == '') {
this.formEdit.getForm().findField('PLACEDELIVERY').setValue(combo.value);
this.formBill.getForm().findField('PLACEDELIVERYID').setValue(selectdata.EDICODE);
}
this.formEdit.getForm().findField('LANE').setValue(records[0].data.LANE);
} else {
this.formBill.getForm().findField('PORTDISCHARGEID').setValue('');
}
}
},
change: function (field, newValue, oldValue, eOpts) {
if (newValue == null || newValue == '') {
this.formBill.getForm().findField('PORTDISCHARGEID').setValue('');
}
}
}
});
this.comboxDESTINATION = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '目的地',
store: this.storeCodeDisport2,
name: 'DESTINATION',
queryMode: 'remote',
minChars: 1,
matchFieldWidth: false,
queryParam: 'PORT',
valueField: 'PORT',
displayField: 'CodeAndName',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
var selectrecords = DsStoreQueryBy(this.storeCodeDisport2, 'PORT', combo.value);
if (selectrecords.getCount() > 0) {
var selectdata = selectrecords.getAt(0).data;
this.formBill.getForm().findField('DESTINATIONID').setValue(selectdata.EDICODE);
var PLACEDELIVERY = this.formBill.getForm().findField('PLACEDELIVERYID').getValue();
if (PLACEDELIVERY == null || PLACEDELIVERY == '') {
this.formEdit.getForm().findField('PLACEDELIVERY').setValue(combo.value);
this.formBill.getForm().findField('PLACEDELIVERYID').setValue(selectdata.EDICODE);
}
} else {
this.formBill.getForm().findField('DESTINATIONID').setValue('');
}
}
},
change: function (field, newValue, oldValue, eOpts) {
if (newValue == null || newValue == '') {
this.formBill.getForm().findField('DESTINATIONID').setValue('');
}
}
}
});
this.comboxPLACEDELIVERY = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '交货地',
store: this.storeCodeDisport3,
name: 'PLACEDELIVERY',
matchFieldWidth: false,
queryMode: 'remote',
minChars: 1,
queryParam: 'PORT',
valueField: 'PORT',
displayField: 'CodeAndName',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
var selectrecords = DsStoreQueryBy(this.storeCodeDisport3, 'PORT', combo.value);
if (selectrecords.getCount() > 0) {
var selectdata = selectrecords.getAt(0).data;
this.formBill.getForm().findField('PLACEDELIVERYID').setValue(selectdata.EDICODE);
} else {
this.formBill.getForm().findField('PLACEDELIVERYID').setValue('');
}
}
},
change: function (field, newValue, oldValue, eOpts) {
if (newValue == null || newValue == '') {
this.formBill.getForm().findField('PLACEDELIVERYID').setValue('');
}
}
}
});
this.comboxPLACERECEIPT = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '收货地',
store: this.storeCodeDisport3,
name: 'PLACERECEIPT',
queryMode: 'remote',
matchFieldWidth: false,
minChars: 1,
queryParam: 'PORT',
valueField: 'PORT',
displayField: 'CodeAndName',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
var selectrecords = DsStoreQueryBy(this.storeCodeDisport3, 'PORT', combo.value);
if (selectrecords.getCount() > 0) {
var selectdata = selectrecords.getAt(0).data;
this.formBill.getForm().findField('PLACERECEIPTID').setValue(selectdata.EDICODE);
} else {
this.formBill.getForm().findField('PLACERECEIPTID').setValue('');
}
}
},
change: function (field, newValue, oldValue, eOpts) {
if (newValue == null || newValue == '') {
this.formBill.getForm().findField('PLACERECEIPTID').setValue('');
}
}
}
});
this.comboxTRANSPORT = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '中转港',
store: this.storeCodeDisport5,
name: 'TRANSPORT',
valueField: 'PORT',
queryMode: 'remote',
minChars: 1,
queryParam: 'PORT',
displayField: 'PORT'
});
this.comboxISSUEPLACE = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '签单地点',
store: this.storeCodeDisport3,
name: 'ISSUEPLACE',
queryMode: 'remote',
minChars: 1,
queryParam: 'PORT',
valueField: 'PORT',
displayField: 'PORT',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
var selectrecords = DsStoreQueryBy(this.storeCodeDisport3, 'PORT', combo.value);
if (selectrecords.getCount() > 0) {
var selectdata = selectrecords.getAt(0).data;
this.formBill.getForm().findField('ISSUEPLACEID').setValue(selectdata.EDICODE);
} else {
this.formBill.getForm().findField('ISSUEPLACEID').setValue('');
}
}
}
}
});
//签单方式
this.storeISSUETYPE = Ext.create('DsExt.ux.RefTableStore', {
model: 'CODE_BLTYPE',
proxy: { url: '/CommMng/BasicDataRef/GetCodeBLTYPEList' }
});
this.storeISSUETYPE.load({ params: { condition: ""} });
this.comboxISSUETYPE = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '签单方式',
store: this.storeISSUETYPE,
forceSelection: true,
name: 'ISSUETYPE',
valueField: 'BLTYPE',
displayField: 'BLTYPE'
});
this.StoreBLNUM = Ext.create('Ext.data.Store', {
fields: ['NUM']
});
this.StoreBLNUM.add({ "NUM": "ZERO" });
this.StoreBLNUM.add({ "NUM": "ONE" });
this.StoreBLNUM.add({ "NUM": "TWO" });
this.StoreBLNUM.add({ "NUM": "THREE" });
this.StoreBLNUM.add({ "NUM": "FOUR" });
this.StoreBLNUM.add({ "NUM": "FIVE" });
this.StoreBLNUM.add({ "NUM": "SIX" });
this.StoreBLNUM.add({ "NUM": "SEVEN" });
this.StoreBLNUM.add({ "NUM": "EIGHT" });
this.StoreBLNUM.add({ "NUM": "NINE" });
this.StoreBLNUM.add({ "NUM": "TEN" });
this.comboxBLNUM = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '提单份数',
store: this.StoreBLNUM,
forceSelection: true,
name: 'NOBILL',
valueField: 'NUM',
displayField: 'NUM'
});
//#region 编辑formEdit 基本信息
this.formEdit = Ext.widget('form', {
region: 'north',
frame: true,
bodyPadding: 5,
height: 180,
layout: 'anchor',
trackResetOnLoad: true,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 70,
msgTarget: 'qtip'
},
items: [{
xtype: 'fieldset',
defaultType: 'textfield',
layout: 'hbox',
defaults: {
anchor: '96%'
},
items: [{
xtype: 'container',
layout: 'anchor',
flex: 3,
defaultType: 'textfield',
items: [{
xtype: 'container',
defaultType: 'textfield',
layout: 'hbox',
items: [{
fieldLabel: '开船日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'ETD'
}, this.comboxPORTLOAD, this.comboxPORTDISCHARGE, this.comboxDESTINATION]
}, {
xtype: 'container',
defaultType: 'textfield',
layout: 'hbox',
items: [ this.comboxPLACEDELIVERY,{
fieldLabel: '总件数',
labelWidth: 70,
name: 'PKGS',
listeners: {
scope: this,
blur: function (field, The, eOpts) {
var str_num = this.formEdit.getForm().findField('PKGS').getValue();
var KINDPKGS = this.formEdit.getForm().findField('KINDPKGS').getValue();
this.formBill.getForm().findField('TOTALNO').setValue('SAY:' + ToEn(str_num).toUpperCase() + ' ' + KINDPKGS + ' ONLY.');
}
}
}, this.comboxKINDPKGS, {
labelWidth: 70,
fieldLabel: '总重量',
name: 'KGS'
}, {
labelWidth: 70,
fieldLabel: '总尺码',
name: 'CBM'
}]
}, {
xtype: 'container',
defaultType: 'textfield',
layout: 'hbox',
items: [this.comboxISSUETYPE, this.comboxPKGTYPE, {
fieldLabel: '免箱天数',
// flex: 0.5,
name: 'FBP'
}, {
fieldLabel: '目的港免箱天数',
labelWidth: 100,
// flex: 0.8,
name: 'DESTFBP'
}, {
fieldLabel: '限重',
// flex: 0.7,
name: 'MAXWEIGHT'
}]
}, {
xtype: 'container',
defaultType: 'textfield',
layout: 'hbox',
items: [{
fieldLabel: '卖价',
name: 'PLANPROFIT'
}, this.comboxAgent, this.comboxLANE, this.comboxTRANSPORT, this.comboxYARD]
}, {
xtype: 'container',
defaultType: 'textfield',
layout: 'hbox',
items: [{
xtype: 'textareafield',
grow: true,
flex: 2,
fieldLabel: '订舱备注',
height: 40,
name: 'REMARK',
anchor: '100%'
}, {
xtype: 'textareafield',
grow: true,
fieldLabel: '驳回原因',
height: 40,
name: 'ORREASON',
anchor: '100%'
}]
}
]
}, {
xtype: 'container',
layout: 'anchor',
flex: 1,
defaultType: 'textfield',
items: [this.panelBodyCtn
]
}
]
}]
}); //end this.formEdit
//#endregion
//#region 编辑formbill 基本信息
this.formBill = Ext.widget('form', {
region: 'north',
frame: true,
bodyPadding: 5,
layout: 'anchor',
trackResetOnLoad: true,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 70,
msgTarget: 'qtip'
},
items: [{
xtype: 'fieldset',
defaultType: 'textfield',
layout: 'hbox',
defaults: {
anchor: '96%'
},
items: [{
xtype: 'container',
layout: 'anchor',
flex: 1,
defaultType: 'textfield',
items: [this.comboxShipper, {
xtype: 'textareafield',
grow: true,
labelWidth: 0,
height: 90,
name: 'SHIPPER',
anchor: '100%'
}, this.comboxConsignee, {
xtype: 'textareafield',
grow: true,
labelWidth: 0,
height: 90,
name: 'CONSIGNEE',
anchor: '100%'
}, this.comboxNotifyParty, {
xtype: 'textareafield',
grow: true,
labelWidth: 0,
height: 90,
name: 'NOTIFYPARTY',
anchor: '100%'
}
]
}, {
xtype: 'container',
layout: 'anchor',
flex: 1,
defaultType: 'textfield',
defaults: {
anchor: '99%'
},
items: [{
xtype: 'container',
defaultType: 'textfield',
layout: 'hbox',
items: [this.comboxVoyVeg, {
fieldLabel: '航次',
flex: 1,
name: 'VOYNO'
}]
}, {
xtype: 'container',
defaultType: 'textfield',
layout: 'hbox',
items: [this.comboxPLACERECEIPT, {
fieldLabel: '收货地代码',
name: 'PLACERECEIPTID'
}]
}, {
xtype: 'container',
defaultType: 'textfield',
layout: 'hbox',
items: [ {
fieldLabel: '交货代码',
name: 'PLACEDELIVERYID'
}, { xtype: 'hiddenfield' }]
}, {
xtype: 'container',
defaultType: 'textfield',
layout: 'hbox',
items: [{
fieldLabel: '装港代码',
name: 'PORTLOADID'
}, {
fieldLabel: '卸港代码',
name: 'PORTDISCHARGEID'
}]
}, {
xtype: 'container',
defaultType: 'textfield',
layout: 'hbox',
items: [{
fieldLabel: '目的代码',
name: 'DESTINATIONID'
}, this.comboxSERVICE]
}, {
xtype: 'container',
defaultType: 'textfield',
layout: 'hbox',
items: [{
xtype: 'textareafield',
grow: true,
fieldLabel: '国外代理',
labelSeparator: '',
// labelWidth: 20,
height: 120,
name: 'AGENT',
anchor: '100%'
}]
}
]
}
]
}, {
xtype: 'container',
layout: 'anchor',
flex: 1,
defaultType: 'textfield',
defaults: {
anchor: '99%'
},
items: [{
xtype: 'container',
defaultType: 'textfield',
layout: 'hbox',
items: [{
xtype: 'container',
layout: 'anchor',
flex: 1,
defaultType: 'textfield',
items: [{
xtype: 'label',
html: 'Seal No.(封志号)
Marks & Nos.(标记与号码) ' //'Seal No.(封志号)
Marks & Nos.(标记与号码) '
}, {
xtype: 'textareafield',
grow: true,
height: 250,
name: 'MARKS',
anchor: '100%'
}
]
}, {
xtype: 'container',
layout: 'anchor',
flex: 3,
defaultType: 'textfield',
items: [{
xtype: 'container',
defaultType: 'textfield',
layout: 'hbox',
defaults: {
anchor: '100%'
},
items: [this.comboxGOODSNAME]
}, {
xtype: 'textareafield',
grow: true,
fieldLabel: '  ',
labelSeparator: '',
labelWidth: 20,
height: 250,
name: 'DESCRIPTION',
anchor: '100%'
}]
}, {
xtype: 'container',
layout: 'anchor',
flex: 1,
defaultType: 'textfield',
items: [{
xtype: 'label',
html: '         No.of containers or pkgs.
         (箱数或件数)' //'         No.of containers or pkgs.
         (箱数或件数)'
}, {
xtype: 'textareafield',
grow: true,
fieldLabel: '  ',
labelWidth: 20,
labelSeparator: '',
height: 40,
name: 'NOPKGS',
anchor: '100%',
listeners: {
scope: this,
change: function (field, newValue, oldValue, eOpts) {
if (newValue == null || newValue == '') return;
if (newValue != oldValue) {
var SS = newValue;
var i = SS.indexOf("\n");
var num = 0;
if (i > 0) {
var slist = SS.split("\n");
for (var i = 0; i < slist.length; i += 1) {
var member = slist[i];
var str_num = this.GetStringNum(member);
if (i == 0) {
var str_kind = member.substring(str_num.length);
}
num = parseFloat(num).add(parseFloat(str_num));
}
this.formEdit.getForm().findField('PKGS').setValue(num);
this.formEdit.getForm().findField('KINDPKGS').setValue(str_kind);
this.formBill.getForm().findField('TOTALNO').setValue('SAY:' + ToEn(num).toUpperCase() + ' ' + str_kind + ' ONLY.');
} else {
var str_num = this.GetStringNum(SS);
var str_kind = SS.substring(str_num.length);
this.formEdit.getForm().findField('PKGS').setValue(str_num);
this.formEdit.getForm().findField('KINDPKGS').setValue(str_kind);
this.formBill.getForm().findField('TOTALNO').setValue('SAY:' + ToEn(str_num).toUpperCase() + ' ' + str_kind + ' ONLY.');
}
}
}
}
}, {
xtype: 'label',
html: '          Gross Weight 毛重(公斤)' //'          Gross Weight 毛重(公斤)'
}, {
xtype: 'textareafield',
grow: true,
height: 40,
labelWidth: 20,
labelSeparator: '',
fieldLabel: '  ',
name: 'GROSSWEIGHT',
anchor: '100%',
listeners: {
scope: this,
change: function (field, newValue, oldValue, eOpts) {
if (newValue == null || newValue == '') return;
if (newValue != oldValue) {
var SS = newValue;
var i = SS.indexOf("\n");
var num = 0;
if (i > 0) {
var slist = SS.split("\n");
for (var i = 0; i < slist.length; i += 1) {
var member = slist[i];
var str_num = this.GetStringNum(member);
num = parseFloat(num).add(parseFloat(str_num));
}
this.formEdit.getForm().findField('KGS').setValue(num);
} else {
var str_num = this.GetStringNum(SS);
this.formEdit.getForm().findField('KGS').setValue(str_num);
}
}
}
}
}, {
xtype: 'label',
html: '          Measurement 尺码(立方米)' //'          Measurement 尺码(立方米)'
}, {
xtype: 'textareafield',
grow: true,
height: 40,
labelWidth: 20,
labelSeparator: '',
fieldLabel: '  ',
name: 'MEASUREMENT',
anchor: '100%',
listeners: {
scope: this,
change: function (field, newValue, oldValue, eOpts) {
if (newValue == null || newValue == '') return;
if (newValue != oldValue) {
var SS = newValue;
var i = SS.indexOf("\n");
var num = 0;
if (i > 0) {
var slist = SS.split("\n");
for (var i = 0; i < slist.length; i += 1) {
var member = slist[i];
var str_num = this.GetStringNum(member);
num = parseFloat(num).add(parseFloat(str_num));
}
this.formEdit.getForm().findField('CBM').setValue(num);
} else {
var str_num = this.GetStringNum(SS);
this.formEdit.getForm().findField('CBM').setValue(str_num);
}
}
}
}
}
]
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '件数大写',
name: 'TOTALNO'
}]
}, this.panelBodyDr, this.panelBodyRf, {
xtype: 'container',
defaultType: 'textfield',
layout: 'hbox',
items: [{
fieldLabel: '签单日期', //'签单日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'ISSUEDATE'
}, this.comboxISSUEPLACE, {
fieldLabel: '签单地代码', //'签单地点',
name: 'ISSUEPLACEID'
}, this.comboxBLNUM]
}, {
xtype: 'container',
defaultType: 'textfield',
layout: 'hbox',
items: [{
fieldLabel: '预付地点', //'预付地点',
name: 'PREPARDAT'
}, {
fieldLabel: '到付地点', //'到付地点',
name: 'PAYABLEAT'
}]
}]
}
]
}); //end this.formEdit
//#endregion
this.panelBill = new Ext.Panel({
title: '委托信息', //'舱单信息',
layout: "border",
region: 'center',
animate: true,
autoScroll: true,
containerScroll: true,
frame: false,
items: [this.formBill]
});
//#region 审核或驳回界面
this.storeUser = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.UserRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetUserLinkRefListRm' }
});
this.storeUser.load({ params: { condition: ""} });
this.comboxSeaeOp = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '操作',
store: this.storeUser,
forceSelection: true,
queryMode: 'remote',
//flex: 0.5,
minChars: 0,
queryParam: 'CODENAME',
name: 'OP',
valueField: 'UserName',
displayField: 'CodeAndName'
});
this.storeCustService = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.UserRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetUserRefList' }
});
this.storeCustService.load({ params: { condition: "" } });
this.comboxSeaeCustService = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '客服',
store: this.storeCustService,
forceSelection: true,
name: 'CUSTSERVICE',
valueField: 'UserCode',
displayField: 'CodeAndName'
});
//客户加载_订舱代理
this.storeFORWARDER2 = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
this.storeFORWARDER2.load({ params: { condition: "ISBOOKING='1'"} });
//船公司
this.comboxFORWARDER2 = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '订舱代理',
store: this.storeFORWARDER2,
forceSelection: true,
name: 'FORWARDER',
valueField: 'CustName',
displayField: 'CodeAndName'
});
this.formAudit = Ext.widget('form', {
frame: true,
region: 'center',
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 90,
msgTarget: 'qtip'
},
items: [
{//fieldset 1
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '会计期间',
xtype: 'monthfield',
name: 'ACCDATE'
}, this.comboxSeaeOp
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxSeaeCustService
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxFORWARDER2
]
}, {
xtype: 'textareafield',
grow: true,
fieldLabel: '备注',
//labelWidth: 0,
height: 90,
name: 'REMARK',
anchor: '100%'
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
});
me = this;
this.winAuditShow = Ext.create('Ext.window.Window', {
title: "接受销售订舱",
width: 450,
//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.formAudit],
buttons: [{
text: "确认接受",
minWidth: 70,
handler: function () {
var form = me.formAudit.getForm();
var ACCDATE = form.findField('ACCDATE').getRawValue();
if (ACCDATE == '' || ACCDATE == null || ACCDATE == undefined) {
Ext.Msg.show({ title: '提示', msg: '会计期间为必填!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
me.accdate = ACCDATE;
var User = me.comboxSeaeOp.getValue();
if (User == '' || User == null || User == undefined) {
Ext.Msg.show({ title: '提示', msg: '操作员为必填!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
me.seaeop = User;
me.seaecustservice = me.comboxSeaeCustService.getValue();
if (me.seaecustservice == '' || me.seaecustservice == null || me.seaecustservice == undefined) {
Ext.Msg.show({ title: '提示', msg: '客服不能为空!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
me.FORWARDER = me.comboxFORWARDER2.getValue();
me.ORREMARK = form.findField('REMARK').getValue();
me.onAuditPassClick();
}
}, {
text: "关闭",
minWidth: 70,
handler: function () {
me.winAuditShow.close();
}
}]
});
this.formAuditBack = Ext.widget('form', {
frame: true,
region: 'center',
title: "驳回原因",
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 90,
msgTarget: 'qtip'
},
items: [{
xtype: 'textareafield',
grow: true,
fieldLabel: '',
labelSeparator: '',
labelWidth: 0,
height: 100,
name: 'ORREASON',
anchor: '100%'
}
]//end root items
});
me = this;
this.winAuditBackShow = Ext.create('Ext.window.Window', {
title: "驳回销售订舱",
width: 450,
//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.formAuditBack],
buttons: [{
text: "确认驳回",
minWidth: 70,
handler: function () {
var form = me.formAuditBack.getForm();
var ORREASON = form.findField('ORREASON').getRawValue();
if (ORREASON == '' || ORREASON == null || ORREASON == undefined) {
Ext.Msg.show({ title: '提示', msg: '驳回原因为必填!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
me.reason = ORREASON;
me.onAuditBack();
}
}, {
text: "关闭",
minWidth: 70,
handler: function () {
me.winAuditBackShow.close();
}
}]
});
//#endregion
//#region
this.panelFee = new Shipping.OrderFeeGrid({
region: 'center',
layout: 'border'
});
this.panelFee.StoreCustType.add({ "SCUSTTYPE": "WTDW-委托单位", "CUSTTYPE": "委托单位", "CUSTNAME": "CUSTOMERNAME" });
this.panelFee.StoreCustType.add({ "SCUSTTYPE": "CGS-船公司", "CUSTTYPE": "船公司", "CUSTNAME": "CARRIER" });
this.panelFee.StoreCustType.add({ "SCUSTTYPE": "DCDL-订舱代理", "CUSTTYPE": "订舱代理", "CUSTNAME": "FORWARDER" });
this.panelFee.StoreCustType.add({ "SCUSTTYPE": "FHR-发货人", "CUSTTYPE": "发货人", "CUSTNAME": "SHIPPERID" });
this.panelFee.StoreCustType.add({ "SCUSTTYPE": "SHR-收货人", "CUSTTYPE": "收货人", "CUSTNAME": "CONSIGNEEID" });
this.panelFee.StoreCustType.add({ "SCUSTTYPE": "TZR-通知人", "CUSTTYPE": "通知人", "CUSTNAME": "NOTIFYPARTYID" });
this.panelFee.StoreDrOpRange.load({ params: { optype: "modSeaeOrderList"} });
this.panelFee.StoreCrOpRange.load({ params: { optype: "modSeaeOrderList"} });
this.panelFee.storeFeeNameRef.load({ params: { condition: "ISSEA='1' "} });
this.panelFee.storeFeeNameRefCr.load({ params: { condition: "ISSEA='1' "} });
//#endregion
//#region 按钮Toolbar
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [{
id: 'btnESave',
text: "保存",
iconCls: "btnsave",
handler: function (button, event) {
this.Save('0');
},
scope: this
}, {
id: 'btnESaveAndClose',
text: "保存并关闭",
handler: function (button, event) {
this.Save('1');
},
scope: this
}, {
id: 'btnESaveAndNew',
text: "保存并新建",
handler: function (button, event) {
this.Save('2');
this.panelOcr.hide();
},
scope: this
}, {
id: 'btnECopyNew',
text: "复制新建",
handler: function (button, event) {
var basicForm = this.formHead.getForm();
this.opStatus = 'add';
basicForm.findField('BSNO').setDisabled(false);
var field = basicForm.findField('BSNO');
var BSNO = NewGuid();
field.setValue(BSNO);
basicForm.findField('BSNO').setDisabled(true);
field = basicForm.findField('ORDNO');
field.setValue('');
field = basicForm.findField('INPUTBY');
field.setValue(SHOWNAME);
field = basicForm.findField('ORSTATUS');
field.setValue('9');
field = basicForm.findField('ORSTATUSREF');
field.setValue('录入状态');
field = basicForm.findField('MBLNO');
field.setValue('');
this.panelFee.strBSNO = BSNO;
for (var j = 0; j < this.storeBodyList.getCount(); j += 1) {
var memberbody = this.storeBodyList.getAt(j);
memberbody.set("ORDNO", '*');
memberbody.commit();
};
for (var j = 0; j < this.panelFee.storeDrChFee.getCount(); j += 1) {
var memberbody = this.panelFee.storeDrChFee.getAt(j);
memberbody.set("GId", NewGuid());
memberbody.set("BsNo", '*');
memberbody.commit();
};
for (var j = 0; j < this.panelFee.storeCrChFee.getCount(); j += 1) {
var memberbody = this.panelFee.storeCrChFee.getAt(j);
memberbody.set("GId", NewGuid());
memberbody.set("BsNo", '*');
memberbody.commit();
};
this.GetEditStatus();
var children = this.tabSeaepanel.items;
if (children) {
for (var i = children.length - 1, len = 0; i >= len; i--) {
if (children.items[i].id) {
if (children.items[i].id == 'pnlmodSeaeOrderInfo') {
this.tabSeaepanel.setActiveTab(i);
}
}
}
}
this.tabSeaepanel.doLayout();
this.panelOcr.hide();
},
scope: this
}, '-', {
text: "关闭",
handler: function (button, event) {
window.close();
},
scope: this
}, {
id: 'btnENew',
text: "新建",
handler: function (button, event) {
this.LoadData('add', '');
var basicForm = this.formEdit.getForm();
basicForm.findField('BsNo').setDisabled(false);
this.panelOcr.hide();
},
scope: this
}, '-', {
id: 'btnSubmitAudit',
text: '提交审核',
tooltip: '提交审核',
handler: function (button, event) {
this.onSubmitAuditClick();
},
scope: this
}, {
id: 'btnSubmitAuditBack',
text: '撤销提交',
tooltip: '撤销提交',
handler: function (button, event) {
this.onSubmitAuditBackClick();
},
scope: this
}, '-', {
id: 'btnAccAudit',
text: '审核通过',
tooltip: '审核通过',
handler: function (button, event) {
this.onAccAudit();
},
scope: this
},
{
text: "驳回提交",
id: 'btnAuditBack',
iconCls: "btndelete",
handler: function (button, event) {
var billstatus = this.formHead.getForm().findField('ORSTATUS').getValue();
if ((billstatus != "1") && (billstatus != "0")) {
Ext.Msg.show({ title: '提示', msg: '当前状态无法驳回!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
this.winAuditBackShow.show();
},
scope: this
}, {
text: "确认订舱",
id: 'btnAudit',
iconCls: "btnadd",
handler: function (button, event) {
var billstatus = this.formHead.getForm().findField('ORSTATUS').getValue();
if (billstatus != "0") {
Ext.Msg.show({ title: '提示', msg: '当前状态无法确认订舱!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var form = this.formAudit.getForm();
var VoucherDate = form.findField('ACCDATE');
var thisday = this.getToMonth();
VoucherDate.setRawValue(thisday)
var basicForm = this.formHead.getForm();
this.comboxSeaeOp.setValue(basicForm.findField('OP').getValue());
this.comboxSeaeCustService.setValue(basicForm.findField('CUSTSERVICE').getValue());
this.comboxFORWARDER2.setValue(basicForm.findField('FORWARDER').getValue());
this.winAuditShow.show();
},
scope: this
}, {
id: 'btnEPrint',
text: "打印",
iconCls: "btnprint",
handler: function (button, event) {
this.Print();
},
scope: this
}, '-', {
text: 'OCR', //快速录入,
handler: function (button, event) {
this.tabtree.hide();
this.tabSeaepanel.setActiveTab(1);
this.panelOcr.body.dom.children[0].src = "/MvcShipping/Ocr/UpOcrAuto";
if (this.panelOcr.isHidden()) {
this.panelOcr.show();
}
if (this.panelOcr.width < 2) {
var wSeaePanel = this.tabSeaepanel.getWidth();
this.panelOcr.setWidth(wSeaePanel * 0.6);
}
},
scope: this
}]
}); //end 按钮Toolbar
//#endregion
//#region 框架结构
this.panelpage = new Ext.Panel({
// title: '订舱说明',
layout: "border",
region: 'center',
animate: true,
autoScroll: true,
// containerScroll: true,
frame: false,
items: [this.formEdit, this.panelFee]
});
this.panelSeae = new Ext.Panel({
title: '订舱信息',
id: 'pnlmodSeaeOrderInfo',
layout: "border",
region: 'center',
animate: true,
autoScroll: true,
frame: false,
//closable:true,
items: [this.panelBtn, this.formHead, this.panelpage]
});
this.treestore = new Ext.data.TreeStore({
model: 'DsShipping.ux.ModuleModel',
nodeParam: 'PARENTID',
proxy: {
type: 'ajax',
url: '/MvcShipping/MsBaseInfo/GetModuTreeRefList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
},
autoLoad: true,
root: {
name: '根节点',
expanded: true,
id: 'A619ED40-4F44-4330-9208-5114F173B934'
}
});
this.tabtree = new Ext.tree.Panel({
region: 'west',
title: '业务信息',
split: true,
width: 180,
collapsible: true,
margins: '0 0 0 0',
store: this.treestore,
rootVisible: false,
hideHeaders: true,
animate: false,
lines: false,
columns: [{
xtype: 'treecolumn',
text: '模块名称',
width: 178,
dataIndex: 'DESCRIPTION'
}],
listeners: {
scope: this,
'itemclick': function (_this, record, item, index, e, eOpts) {
var finded = false;
if (record.data.MODULEURL == '@') {
this.tabSeaepanel.setActiveTab(0);
} else if (record.data.MODULEURL != '#') {
var children = this.tabSeaepanel.items;
if (children) {
for (var i = 0, len = children.length; i < len; i++) {
if (children.items[i].id) {
if (children.items[i].id == 'pnl' + record.data.NAME) {
this.tabSeaepanel.setActiveTab(i);
finded = true;
}
}
}
}
if (finded == false) {
if (this.formHead.getForm().findField('ORDNO').getValue() == "") {
Ext.Msg.show({ title: '注意', msg: '请先保存业务信息后再打开其他模块!', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
} else {
if (record.data.NAME == 'modSeaeOrderFee') {
var paneltabitems = new Shipping.SeaeFee({
id: 'pnl' + record.data.NAME,
layout: "border",
region: "center",
autoScroll: true,
frame: true,
closable: true,
title: record.data.DESCRIPTION
});
} else {
var paneltabitems = new Ext.Panel({
id: 'pnl' + record.data.NAME,
layout: "fit",
region: "center",
autoScroll: true,
frame: false,
closable: true,
title: record.data.DESCRIPTION,
html: ' '
});
}
this.tabSeaepanel.add(paneltabitems);
this.tabSeaepanel.setActiveTab(paneltabitems);
this.tabSeaepanel.doLayout();
}
}
}
}
}
});
this.tabSeaepanel = new Ext.TabPanel({
activeTab: 0,
autoWidth: true,
border: true,
frame: false,
region: 'center',
id: "TabSeaePanel",
enableTabScroll: true,
items:
[
this.panelSeae,
this.panelBill
]
});
this.panelOcr = new Ext.Panel({
title: 'OCR',
id: 'panelOcr',
width: 0,
visible: false,
region: 'east',
animate: true,
autoScroll: true,
split: true,
closeAction: 'hide',
closable: true,
html: ''
});
this.panelOcr.on({
hide: function () {
this.tabtree.show();
},
scope: this
});
Ext.apply(this, {
items: [this.tabtree, this.tabSeaepanel, this.panelOcr]
});
//#endregion
//#region 其他
parentWin = window.parent.opener;
this.InitData();
Ext.Ajax.request({
waitMsg: '',
url: '/MvcShipping/MsBaseInfo/GetUserModuleEnable',
params: {
modulename: "modSaleOrderNoSaleFEE"
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (result.Success == true) {
_this.panelFee.setVisible(false);
} else {
//
}
} else {
}
},
scope: this
});
Ext.Ajax.request({
waitMsg: '',
url: '/MvcShipping/MsSysParamSet/GetData',
params: {
condition: "PARAMNAME='SALEORDERDEPTBYOP'"
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (result.Success != true) {
} else {
var data = result.data;
if (data.PARAMVALUE == '1') {
this.SALEORDERDEPTBYOP = 1;
} else {
}
}
} else {
}
},
scope: this
});
Ext.Ajax.request({
waitMsg: '',
url: '/MvcShipping/MsBaseInfo/GetUserModuleEnable',
params: {
modulename: "modSaleOrderAuditSelf"
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (result.Success != true) {
this.SaleOrderAuditSelf = 0;
} else {
this.SaleOrderAuditSelf = 1;
}
} else {
}
},
scope: this
});
if (this.isAudit) {
Ext.Ajax.request({
waitMsg: '',
url: '/MvcShipping/MsSysParamSet/GetData',
params: {
condition: "PARAMNAME='SALEORDERAUDITHIDECUST'"
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (result.Success != true) {
} else {
var data = result.data;
if (data.PARAMVALUE == '1') {
Ext.getCmp('CUSTOMERNAME').hide();
//Ext.getCmp('CustomerName').setVisible(false);
var columnindex = 0;
for (var j = 0; j < this.panelFee.girdDrcolums.length; j++) {
if (this.panelFee.girdDrcolums[j].dataIndex == 'CustomerName') {
columnindex = j;
}
}
this.panelFee.girdDrcolums.splice(columnindex, 1);
this.panelFee.gridDrChFee.reconfigure(this.panelFee.storeDrChFee, this.panelFee.girdDrcolums);
} else {
}
}
} else {
}
},
scope: this
});
}
//#endregion
}, //end initUIComponents
//#region 加载事件
InitData: function () {
this.opStatus = 'add';
var condition = '';
_this = this;
if (parentWin) {
var ret = parentWin.OprationSwap();
this.opStatus = ret[0];
this.StoreList = ret[1];
this.editRecord = ret[2];
this.isAudit = ret[3];
}
this.setAuditBtnStatus(this.isAudit);
if (this.opStatus == 'edit' || this.opStatus == 'copyadd') {
condition = "ORDNO='" + this.editRecord.get('ORDNO') + "'";
//2018年2月6日10:56:45 李进举 鼎世 集装箱列表不可见
this.storeBodyList.load({ params: { condition: condition} });
}
if (this.opStatus == 'edit') {
document.title = "销售订舱-" + this.editRecord.get('MBLNO').toString().trim();
}
else {
document.title = "销售订舱-新增";
}
this.LoadData(this.opStatus, condition);
this.LoadMustBe();
}, //end InitData
LoadData: function (opstatus, condition) {
this.serialNo = 0;
//this.bodyDel = [];
this.opStatus = opstatus;
Ext.Ajax.request({
waitMsg: '正在查询主表数据...',
url: '/MvcShipping/MsSeaeOrder/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;
}
data = result.data;
if (this.opStatus == 'copyadd') {
//复制新建时不保留主提单号
data.MBLNO = "";
}
this.LoadInit(data);
this.formHead.getForm().reset();
this.formHead.getForm().setValues(data);
this.formEdit.getForm().reset();
this.formEdit.getForm().setValues(data);
this.formBill.getForm().reset();
this.formBill.getForm().setValues(data);
this.GetEditStatus();
this.LoadPeriod(this.opStatus);
if (this.opStatus == 'add') {
this.LoadDefValue();
}
if (this.opStatus == 'copyadd') {
this.storeBodyList.load({ params: { condition: condition },
callback: function (r, options, success) {
if (success) {
if (this.storeBodyList.getCount() > 0) {
for (var j = 0; j < _this.storeBodyList.getCount(); j += 1) {
var memberbody = _this.storeBodyList.getAt(j);
memberbody.set("CTN_ID", NewGuid());
memberbody.set("ORDNO", "*");
memberbody.commit();
}
} else {
_this.storeBodyList.removeAll();
}
_this.opStatus = 'add';
}
},
scope: this
});
this.opStatus = 'add';
} else if (this.opStatus == 'edit') {
this.storeBodyList.load({ params: { condition: condition} });
} else if (this.opStatus == 'add') {
condition = "ORDNO='XX'";
this.storeBodyList.load({ params: { condition: condition} });
}
this.panelFee.EditRecord = this.editRecord;
this.panelFee.stroplb = 'op_Seae';
this.panelFee.strBSNO = this.editRecord.get('BSNO');
this.panelFee.StoreDateCurr.load({ params: { optype: "op_Seae", bsno: data.ORDNO} });
this.panelFee.StoreUnit.load({ params: { bsno: data.ORDNO, bstype: "crm_seaeorder"} });
this.panelFee.storeDrChFee.load({ params: { billno: data.BSNO, type: 1, optype: "op_Seae"} });
this.panelFee.storeCrChFee.load({ params: { billno: data.BSNO, type: 2, optype: "op_Seae"} });
this.panelFee.storeBodySum.load({ params: { bsno: data.BSNO} });
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
}, // end LoadDate
//#endregion
//#region 保存
Save: function (type) {
var basicForm = this.formEdit.getForm();
var basicForm2 = this.formHead.getForm();
var basicForm3 = this.formBill.getForm();
var btnSubmitAudit = Ext.getCmp('btnSubmitAudit');
btnSubmitAudit.disable();
if (!basicForm.isValid()) {
Ext.Msg.show({ title: '警告', msg: '基本信息有必须项目不能为空!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
return;
}
if (!basicForm2.isValid()) {
Ext.Msg.show({ title: '警告', msg: '基本信息有必须项目不能为空!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
return;
}
if (!basicForm3.isValid()) {
Ext.Msg.show({ title: '警告', msg: '委托信息有必须项目不能为空!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
return;
}
//
var bodydatas = [];
var isnoctn = false;
for (var i = 0; i < this.storeBodyList.getCount(); i += 1) {
var member = this.storeBodyList.getAt(i);
if (member.data.CTNALL == '') {
isnoctn = true;
}
bodydatas.push(member);
}
if (this.ISMUSTBECNTR == '1') {
if (this.storeBodyList.getCount() == 0) {
Ext.Msg.show({ title: '警告', msg: '集装箱信息为必填,不能为空!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
return;
}
//if ((this.panelFee.storeDrChFee.getCount() == 0) && (this.panelFee.storeCrChFee.getCount() == 0)) {
// Ext.Msg.show({ title: '警告', msg: '费用信息为必填,不能为空!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
// return;
//}
}
if (isnoctn) {
Ext.Msg.show({ title: '警告', msg: '集装箱信息,箱型不能为空!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
return;
}
//
var jsonBody = ConvertRecordsToJsonAll(bodydatas);
//var jsonDelBody = ConvertRecordsToJsonAll(this.bodyDel);
this.formHead.getForm().findField('BSNO').setDisabled(false);
this.formHead.getForm().findField('ORDNO').setDisabled(false);
var data = this.formHead.getForm().getValues(false, false, false);
var data2 = this.formEdit.getForm().getValues(false, false, false);
var data3 = this.formBill.getForm().getValues(false, false, false);
this.formHead.getForm().findField('ORDNO').setDisabled(true);
this.formHead.getForm().findField('BSNO').setDisabled(true);
//
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/MvcShipping/MsSeaeOrder/Save',
scope: this,
params: {
opstatus: this.opStatus,
data: Ext.JSON.encode(data),
data2: Ext.JSON.encode(data2),
data3: Ext.JSON.encode(data3),
body: jsonBody
},
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.formBill.getForm().reset();
this.formBill.getForm().setValues(returnData);
//
if (this.opStatus == 'add') {
var arrNewRecords = this.StoreList.add(returnData);
this.editRecord = arrNewRecords[0];
}
else if (this.opStatus == 'edit') {
var editp = Ext.create('MsSeaeOrderModel', 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 (this.issubmit)
btnSubmitAudit.enable();
// var feemodify = this.panelFee.getModifyStatus();
// if (feemodify) {
// this.panelFee..onPostDetailClick(button, event, 1);
// this.panelFee..onPostDetailClick(button, event, 1);
// }
if (type == '0') {
this.opStatus = 'edit';
basicForm2.findField('ORDNO').setDisabled(true);
for (var j = 0; j < this.storeBodyList.getCount(); j += 1) {
var memberbody = this.storeBodyList.getAt(j);
memberbody.set("ORDNO", this.editRecord.get('ORDNO'));
memberbody.commit();
};
this.panelFee.EditRecord = this.editRecord;
this.panelFee.stroplb = 'op_Seae';
this.panelFee.strBSNO = this.editRecord.get('BSNO');
this.panelFee.StoreUnit.load({ params: { bsno: this.editRecord.get('ORDNO'), bstype: "crm_seaeorder"} });
this.panelFee.StoreDateCurr.load({ params: { optype: "op_Seae", bsno: this.editRecord.get('ORDNO')} });
} 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: '服务器响应出错',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
}
this.panelFee.onPostDetailClick('', '', 1);
this.panelFee.onPostDetailClick('', '', 2);
}
});
}, //end save
//#endregion
//#region 集装箱按钮事件
onAddDetailClick: function (button, event) {
this.addDetail();
}, //end onAddDetailClick
onDelDetailClick: function (button, event) {
this.deleteDetail();
}, //onDelDetailClick
addDetail: function () {
var record = Ext.create('MsSeaeOrderCtn', {
CTN_ID: NewGuid(),
ORDNO: '*',
CTNALL: '',
CTNNUM: 0,
REMARK: ''
});
this.storeBodyList.add(record);
var n = this.storeBodyList.getCount();
this.gridListCellEditing.startEditByPosition({ row: n - 1, column: 2 });
},
deleteDetail: function () {
var ORSTATUS = this.formHead.getForm().findField('ORSTATUS').getValue();
if (ORSTATUS == '0') {
Ext.Msg.show({ title: '警告', msg: '业务已提交审核,不允许操作!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
return;
}
//this.serialNo = DsGetCurSerialNo(this.storeBodyList, this.serialNo);
var selectedRecords = this.gridList.selModel.getSelection();
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (rec.data.ORDNO == "" || rec.data.ORDNO == "*")//如果是新增但没有保存的数据,没有必要提交到后台
{
this.storeBodyList.remove(selectedRecords[i]);
}
else {
Ext.MessageBox.confirm('提示', '确定删除该记录吗?', function (btn) {
if (btn == 'yes') {
Ext.Msg.wait('正在删除数据...');
Ext.Ajax.request({
waitMsg: '正在删除数据...',
url: '/MvcShipping/MsSeaeOrder/DeleteDetail',
params: {
data: Ext.JSON.encode(rec.data)
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
this.storeBodyList.remove(rec);
Ext.Msg.show({ title: '提示', msg: jsonresult.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
else {
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
}
},
failure: function (response, options) {
Ext.Msg.show({ title: '警告', msg: '服务器响应出错,请重试', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
},
scope: this
}); //end Ext.Ajax.request
}
}, this);
}
//this.storeBodyList.remove(selectedRecords[i]);
}
},
GetContractFee:function(){
var ORSTATUS = this.formHead.getForm().findField('ORSTATUS').getValue();
if (ORSTATUS == '0') {
Ext.Msg.show({ title: '警告', msg: '业务已提交审核,不允许操作!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
return;
}
if (this.formHead.getForm().findField('ORDNO').getValue() == "") {
Ext.Msg.show({ title: '注意', msg: '请先保存业务信息后再提取费用!', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
return;
}
var CONTRACTNO = this.formHead.getForm().findField('CONTRACTNO').getValue();
if (CONTRACTNO == '') {
Ext.Msg.show({ title: '警告', msg: '约号为空,不能提取费用!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
return;
}
var CARRIER = this.formHead.getForm().findField('CARRIER').getValue();
if (CARRIER == '') {
Ext.Msg.show({ title: '警告', msg: '船公司为空,不能提取费用!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
return;
}
var PORTLOAD = this.formEdit.getForm().findField('PORTLOAD').getValue();
if (PORTLOAD == '') {
Ext.Msg.show({ title: '警告', msg: '装货港为空,不能提取费用!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
return;
}
var PORTDISCHARGE = this.formEdit.getForm().findField('PORTDISCHARGE').getValue();
if (PORTDISCHARGE == '') {
Ext.Msg.show({ title: '警告', msg: '卸货港为空,不能提取费用!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
return;
}
if (this.storeBodyList.getCount() == 0) {
Ext.Msg.show({ title: '警告', msg: '集装箱信息为空,不能提取费用!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
return;
}
var bodydatas = [];
var isnoctn = false;
for (var i = 0; i < this.storeBodyList.getCount() ; i += 1) {
var member = this.storeBodyList.getAt(i);
if (member.data.CTNALL == '') {
isnoctn = true;
}
bodydatas.push(member);
}
if (isnoctn) {
Ext.Msg.show({ title: '警告', msg: '集装箱信息,箱型不能为空!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
return;
}
// DsOpenEditWin('/MvcShipping/MsCrmPriceCarrierList/ImpIndex');
DsOpenEditWin('/MvcShipping/MsCrmPriceCarrierList/ImpIndex', "", "400", "1300"); //this.editRecord.get('BSNO').toString()
},
//#endregion
//#region
LoadInit: function (data) {
var CUSTOMERNAME = this.formHead.getForm().findField('CUSTOMERNAME').getValue();
this.storeShipper.load({ params: { condition: "shippertype=2 AND (ISPUBLIC=1 OR CODENAME IN (SELECT CODENAME FROM info_client WHERE SHORTNAME='" + CUSTOMERNAME + "') )" },
callback: function (r, options, success) {
if (success) {
this.formBill.getForm().findField('SHIPPERID').setValue(data.SHIPPERID);
}
},
scope: this
});
this.storeConsignee.load({ params: { condition: "shippertype=1 AND (ISPUBLIC=1 OR CODENAME IN (SELECT CODENAME FROM info_client WHERE SHORTNAME='" + CUSTOMERNAME + "') )" },
callback: function (r, options, success) {
if (success) {
this.formBill.getForm().findField('CONSIGNEEID').setValue(data.CONSIGNEEID);
}
},
scope: this
});
this.storenotifyparty.load({ params: { condition: "shippertype=3 AND (ISPUBLIC=1 OR CODENAME IN (SELECT CODENAME FROM info_client WHERE SHORTNAME='" + CUSTOMERNAME + "') )" },
callback: function (r, options, success) {
if (success) {
this.formBill.getForm().findField('NOTIFYPARTYID').setValue(data.NOTIFYPARTYID);
}
},
scope: this
});
var BLTYPE = this.formHead.getForm().findField('BLTYPE').getValue();
if (BLTYPE == "拼箱单票" || BLTYPE == "拼箱分票") {
this.panelBodyCtn.hide();
}
else {
this.panelBodyCtn.show();
}
var ORSTATUS = this.formHead.getForm().findField('ORSTATUS').getValue();
// if (ORSTATUS == "2") {
// this.panelORREASON.show();
// }
// else {
// this.panelORREASON.hide();
// }
var CARGOID = this.formHead.getForm().findField('CARGOID').getValue();
if (CARGOID == 'R') {
this.panelBodyDr.setVisible(false);
this.panelBodyRf.setVisible(true);
} else if (CARGOID == 'D') {
this.panelBodyDr.setVisible(true);
this.panelBodyRf.setVisible(false);
} else {
this.panelBodyDr.setVisible(false);
this.panelBodyRf.setVisible(false);
}
if (data.CUSTOMERNAME != '') {
var recordCustCode = Ext.create('DsShipping.ux.CustomRefModel', {
GId: NewGuid(),
CustCode: data.CUSTOMERNAME,
CustName: data.CUSTOMERNAME,
CodeAndName: data.CUSTOMERNAME
});
this.storeCustCode.add(recordCustCode);
}
if (data.CARRIER != '') {
var recordCustCode = Ext.create('DsShipping.ux.CustomRefModel', {
GId: NewGuid(),
CustCode: data.CARRIER,
CustName: data.CARRIER,
CodeAndName: data.CARRIER
});
this.storeCARRIER.add(recordCustCode);
}
if (data.FORWARDER != '') {
var recordCustCode = Ext.create('DsShipping.ux.CustomRefModel', {
GId: NewGuid(),
CustCode: data.FORWARDER,
CustName: data.FORWARDER,
CodeAndName: data.FORWARDER
});
this.storeFORWARDER.add(recordCustCode);
}
},
//#endregion
onSubmitAuditClick: function () {
var btnESave = Ext.getCmp('btnESave');
var btnESaveAndClose = Ext.getCmp('btnESaveAndClose');
var btnESaveAndNew = Ext.getCmp('btnESaveAndNew');
btnESave.disable();
btnESaveAndClose.disable();
btnESaveAndNew.disable();
var BSNO = this.formHead.getForm().findField('BSNO').getValue();
var billstatus = this.formHead.getForm().findField('ORSTATUS').getValue();
if ((billstatus != "9") && (billstatus != "2")) {
Ext.Msg.show({ title: '提示', msg: '当前状态无法提交审核!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var isnoctn = false;
var bodydatas = [];
for (var i = 0; i < this.storeBodyList.getCount(); i += 1) {
var member = this.storeBodyList.getAt(i);
if (member.data.CTNALL == '') {
isnoctn = true;
}
bodydatas.push(member);
}
//
var jsonBody = ConvertRecordsToJsonAll(bodydatas);
if (this.ISMUSTBECNTR == '1') {
if (this.storeBodyList.getCount() == 0) {
Ext.Msg.show({ title: '警告', msg: '集装箱信息为必填,不能为空!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
return;
}
//if ((this.panelFee.storeDrChFee.getCount() == 0) && (this.panelFee.storeCrChFee.getCount() == 0)) {
// Ext.Msg.show({ title: '警告', msg: '费用信息为必填,不能为空!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
// return;
//}
if (this.ISMUSTBEFEE == '1') {
if ((this.panelFee.storeDrChFee.getCount() == 0) && (this.panelFee.storeCrChFee.getCount() == 0)) {
Ext.Msg.show({ title: '警告', msg: '费用信息为必填,不能为空!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
return;
}
}
}
if (isnoctn) {
Ext.Msg.show({ title: '警告', msg: '集装箱信息,箱型不能为空!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
return;
}
//var jsonDelBody = ConvertRecordsToJsonAll(this.bodyDel);
this.formHead.getForm().findField('BSNO').setDisabled(false);
this.formHead.getForm().findField('ORDNO').setDisabled(false);
this.formHead.getForm().findField('STLNAME').setDisabled(false);
this.formHead.getForm().findField('STLDATE').setDisabled(false);
var data = this.formHead.getForm().getValues(false, false, false);
var data2 = this.formEdit.getForm().getValues(false, false, false);
var data3 = this.formBill.getForm().getValues(false, false, false);
this.formHead.getForm().findField('BSNO').setDisabled(true);
this.formHead.getForm().findField('ORDNO').setDisabled(true);
this.formHead.getForm().findField('STLNAME').setDisabled(true);
this.formHead.getForm().findField('STLDATE').setDisabled(true);
var basicForm = this.formEdit.getForm();
var basicForm2 = this.formHead.getForm();
var basicForm3 = this.formBill.getForm();
if (!basicForm.isValid()) {
return;
}
if (!basicForm2.isValid()) {
return;
}
if (!basicForm3.isValid()) {
return;
}
_this = this;
Ext.Ajax.request({
waitMsg: '正在添加数据...',
url: '/MvcShipping/MsSeaeOrder/SubmitAuditForm',
params: {
opstatus: this.opStatus,
data: Ext.JSON.encode(data),
data2: Ext.JSON.encode(data2),
data3: Ext.JSON.encode(data3),
body: jsonBody
},
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;
} else {
_this.opStatus = 'edit';
Ext.Ajax.request({
waitMsg: '正在查询主表数据...',
url: '/MvcShipping/MsSeaeOrder/GetData',
params: {
handle: 'edit',
condition: " ORDNO='" + result.Data + "'"
},
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.formHead.getForm().reset();
_this.formHead.getForm().setValues(data);
_this.formEdit.getForm().reset();
_this.formEdit.getForm().setValues(data);
_this.formBill.getForm().reset();
_this.formBill.getForm().setValues(data);
var editp = Ext.create('MsSeaeOrderModel', data);
_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();
for (var j = 0; j < _this.storeBodyList.getCount(); j += 1) {
var memberbody = _this.storeBodyList.getAt(j);
memberbody.set("ORDNO", _this.editRecord.get('ORDNO'));
memberbody.commit();
};
btnESave.enable();
btnESaveAndClose.enable();
btnESaveAndNew.enable();
_this.GetEditStatus();
_this.panelFee.EditRecord = _this.editRecord;
_this.panelFee.stroplb = 'op_Seae';
_this.panelFee.strBSNO = _this.editRecord.get('BSNO');
_this.panelFee.StoreUnit.load({ params: { bsno: _this.editRecord.get('ORDNO'), bstype: "crm_seaeorder"} });
_this.panelFee.StoreDateCurr.load({ params: { optype: "op_Seae", bsno: _this.editRecord.get('ORDNO')} });
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
},
onSubmitAuditBackClick: function () {
var Duino = this.formHead.getForm().findField('ORDNO').getValue();
var billstatus = this.formHead.getForm().findField('ORSTATUS').getValue();
if (Duino == '*') {
Ext.Msg.show({ title: '提示', msg: '请先保存付费申请,然后才能提交审核!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
if (billstatus != "1") {
Ext.Msg.show({ title: '提示', msg: '当前状态无法撤销提交!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var bodydatas = [];
for (var i = 0; i < this.storeBodyList.getCount(); i += 1) {
var member = this.storeBodyList.getAt(i);
bodydatas.push(member);
}
var jsonBody = ConvertRecordsToJsonAll(bodydatas);
this.formHead.getForm().findField('BSNO').setDisabled(false);
this.formHead.getForm().findField('ORDNO').setDisabled(false);
var data = this.formHead.getForm().getValues(false, false, false);
var data2 = this.formEdit.getForm().getValues(false, false, false);
var data3 = this.formBill.getForm().getValues(false, false, false);
this.formHead.getForm().findField('BSNO').setDisabled(true);
_this = this;
Ext.Ajax.request({
waitMsg: '正在添加数据...',
url: '/MvcShipping/MsSeaeOrder/SubmitAuditBackForm',
params: {
data: Ext.JSON.encode(data),
data2: Ext.JSON.encode(data2),
data3: Ext.JSON.encode(data3),
body: jsonBody
},
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;
} else {
Ext.Ajax.request({
waitMsg: '正在查询主表数据...',
url: '/MvcShipping/MsSeaeOrder/GetData',
params: {
handle: 'edit',
condition: " ORDNO='" + Duino + "'"
},
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.formHead.getForm().reset();
_this.formHead.getForm().setValues(data);
_this.formEdit.getForm().reset();
_this.formEdit.getForm().setValues(data);
_this.formBill.getForm().reset();
_this.formBill.getForm().setValues(data);
var editp = Ext.create('MsSeaeOrderModel', data);
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();
_this.GetEditStatus();
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
},
onAuditPassClick: function () {
var SALE = this.formHead.getForm().findField('SALE').getValue();
var DEFSALE = this.formHead.getForm().findField('DEFSALE').getValue();
if (this.SaleOrderAuditSelf == 1) {
if (DEFSALE == '' || DEFSALE == SALE || SALE == SHOWNAME) {
} else {
Ext.Msg.show({ title: '警告', msg: '你仅能接受揽货人和默认揽货人是自己的业务!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
return;
}
}
var Duino = this.formHead.getForm().findField('ORDNO').getValue();
this.formHead.getForm().findField('BSNO').setDisabled(false);
this.formHead.getForm().findField('ORDNO').setDisabled(false);
var data = this.formHead.getForm().getValues(false, false, false);
var data2 = this.formEdit.getForm().getValues(false, false, false);
var data3 = this.formBill.getForm().getValues(false, false, false);
this.formHead.getForm().findField('ORDNO').setDisabled(true);
this.formHead.getForm().findField('BSNO').setDisabled(true);
_this = this;
Ext.MessageBox.confirm('提示', '确定审核通过选中的业务吗?', function (btn) {
if (btn == 'yes') {
Ext.Msg.wait('正在审核数据...');
Ext.Ajax.request({
waitMsg: '正在审核数据...',
url: '/MvcShipping/MsSeaeOrder/AuditOrderForm',
params: {
data: Ext.JSON.encode(data),
data2: Ext.JSON.encode(data2),
data3: Ext.JSON.encode(data3),
accdate: _this.accdate,
op: _this.seaeop,
custservice: _this.seaecustservice,
FORWARDER: _this.FORWARDER,
ORREMARK: _this.ORREMARK
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
Ext.Ajax.request({
waitMsg: '正在查询主表数据...',
url: '/MvcShipping/MsSeaeOrder/GetData',
params: {
handle: 'edit',
condition: " ORDNO='" + Duino + "'"
},
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.formHead.getForm().reset();
_this.formHead.getForm().setValues(data);
_this.formEdit.getForm().reset();
_this.formEdit.getForm().setValues(data);
_this.formBill.getForm().reset();
_this.formBill.getForm().setValues(data);
var editp = Ext.create('MsSeaeOrderModel', data);
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();
_this.GetEditStatus();
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
Ext.Msg.show({ title: '提示', msg: '审核成功!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
else {
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
_this.winAuditShow.close()
}
},
failure: function (response, options) {
Ext.Msg.show({ title: '警告', msg: '服务器响应出错,请重试', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
},
success: function (response, options) {
},
scope: this
}); //end Ext.Ajax.request
}
}, this);
},
LoadPeriod: function (opstatus) {
Ext.Ajax.request({
waitMsg: Zi.LAN.ZhengZaiChaXunShuJu, //'正在查询主表数据...',
url: '/Account/ChMonthClose/GetNowPeriod',
params: {
condition: ''
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
return;
}
data = result.data;
this.MsPeriod = data;
this.LoadPeriodStatus(opstatus);
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
},
LoadPeriodStatus: function (opstatus) {
var ETD = this.formEdit.getForm().findField('ETD').getRawValue();
if (ETD == '') {
this.formEdit.getForm().findField('ETD').setMinValue(this.MsPeriod.FDAY);
this.formEdit.getForm().findField('ETD').setReadOnly(false);
} else {
var oDate1 = new Date(ETD);
var oDate2 = new Date(this.MsPeriod.FDAY);
if (oDate1.getTime() >= oDate2.getTime()) {
this.formEdit.getForm().findField('ETD').setMinValue(this.MsPeriod.FDAY);
this.formEdit.getForm().findField('ETD').setReadOnly(false);
} else {
if (opstatus == 'add' || opstatus == 'copyadd') {
this.formEdit.getForm().findField('ETD').setValue('');
this.formEdit.getForm().findField('ETD').setMinValue(this.MsPeriod.FDAY);
this.formEdit.getForm().findField('ETD').setReadOnly(false);
}
else {
this.formEdit.getForm().findField('ETD').setMinValue('');
this.formEdit.getForm().findField('ETD').setReadOnly(true);
}
}
}
},
onAuditBack: function () {
var Duino = this.formHead.getForm().findField('ORDNO').getValue();
this.formHead.getForm().findField('ORDNO').setDisabled(false);
var data = this.formHead.getForm().getValues(false, false, false);
var data2 = this.formEdit.getForm().getValues(false, false, false);
var data3 = this.formBill.getForm().getValues(false, false, false);
this.formHead.getForm().findField('ORDNO').setDisabled(true);
_this = this;
Ext.MessageBox.confirm('提示', '确定驳回选中的业务吗?', function (btn) {
if (btn == 'yes') {
Ext.Msg.wait('正在驳回数据...');
Ext.Ajax.request({
waitMsg: '正在驳回数据...',
url: '/MvcShipping/MsSeaeOrder/AuditBackOrderForm',
params: {
data: Ext.JSON.encode(data),
data2: Ext.JSON.encode(data2),
data3: Ext.JSON.encode(data3),
orreason: _this.reason
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
Ext.Ajax.request({
waitMsg: '正在查询主表数据...',
url: '/MvcShipping/MsSeaeOrder/GetData',
params: {
handle: 'edit',
condition: " ORDNO='" + Duino + "'"
},
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.formHead.getForm().reset();
_this.formHead.getForm().setValues(data);
_this.formEdit.getForm().reset();
_this.formEdit.getForm().setValues(data);
_this.formBill.getForm().reset();
_this.formBill.getForm().setValues(data);
var editp = Ext.create('MsSeaeOrderModel', data);
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();
_this.GetEditStatus();
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
Ext.Msg.show({ title: '提示', msg: '驳回成功!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
else {
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
_this.winAuditBackShow.close();
}
},
failure: function (response, options) {
Ext.Msg.show({ title: '警告', msg: '服务器响应出错,请重试', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
},
success: function (response, options) {
},
scope: this
}); //end Ext.Ajax.request
}
}, this);
},
onAccAudit: function () {
var billstatus = this.formHead.getForm().findField('ORSTATUS').getValue();
if (billstatus != "1") {
Ext.Msg.show({ title: '提示', msg: '当前状态无法审核通过!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var SALE = this.formHead.getForm().findField('SALE').getValue();
var DEFSALE = this.formHead.getForm().findField('DEFSALE').getValue();
if (this.SaleOrderAuditSelf == 1) {
if (DEFSALE == '' || DEFSALE ==SALE ||SALE == SHOWNAME) {
} else {
Ext.Msg.show({ title: '警告', msg: '你仅能接受揽货人和默认揽货人是自己的业务!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
return;
}
}
this.formHead.getForm().findField('BSNO').setDisabled(false);
this.formHead.getForm().findField('ORDNO').setDisabled(false);
var data = this.formHead.getForm().getValues(false, false, false);
var data2 = this.formEdit.getForm().getValues(false, false, false);
var data3 = this.formBill.getForm().getValues(false, false, false);
this.formHead.getForm().findField('ORDNO').setDisabled(true);
this.formHead.getForm().findField('BSNO').setDisabled(true);
var Duino = this.formHead.getForm().findField('ORDNO').getValue();
_this = this;
Ext.MessageBox.confirm('提示', '确定审核通过此票业务吗?', function (btn) {
if (btn == 'yes') {
Ext.Msg.wait('正在审核数据...');
Ext.Ajax.request({
waitMsg: '正在审核数据...',
url: '/MvcShipping/MsSeaeOrder/AccAuditForm',
params: {
data: Ext.JSON.encode(data),
data2: Ext.JSON.encode(data2),
data3: Ext.JSON.encode(data3)
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
Ext.Ajax.request({
waitMsg: '正在查询主表数据...',
url: '/MvcShipping/MsSeaeOrder/GetData',
params: {
handle: 'edit',
condition: " ORDNO='" + Duino + "'"
},
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.formHead.getForm().reset();
_this.formHead.getForm().setValues(data);
_this.formEdit.getForm().reset();
_this.formEdit.getForm().setValues(data);
_this.formBill.getForm().reset();
_this.formBill.getForm().setValues(data);
var editp = Ext.create('MsSeaeOrderModel', data);
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();
_this.GetEditStatus();
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
Ext.Msg.show({ title: '提示', msg: '审核成功!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
else {
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
}
},
failure: function (response, options) {
Ext.Msg.show({ title: '警告', msg: '服务器响应出错,请重试', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
},
success: function (response, options) {
},
scope: this
}); //end Ext.Ajax.request
}
}, this);
},
getToMonth: function () {
var now = new Date();
var year = now.getFullYear(); //年
var month = now.getMonth() + 1; //月
var clock = year + "-";
if (month < 10)
clock = clock + "0" + month;
else
clock = clock + month;
return (clock);
},
//#region 默认值和必填项
LoadDefValue: function () {
this.storeDefValue.load({ params: { condition: "BSTYPE='销售订舱'" },
callback: function (r, options, success) {
if (success) {
if (this.storeDefValue.getCount() > 0) {
for (var j = 0; j < this.storeDefValue.getCount(); j += 1) {
var member = this.storeDefValue.getAt(j);
var headfield = this.formHead.getForm().findField(member.data.FIELDNAME);
if (headfield != NaN && headfield != null)
headfield.setValue(member.data.DEFVALUE);
var headfield = this.formEdit.getForm().findField(member.data.FIELDNAME);
if (headfield != NaN && headfield != null)
headfield.setValue(member.data.DEFVALUE);
var fieldname = member.data.FIELDNAME;
if (fieldname == 'PlACERECEIPT') fieldname = 'PLACERECEIPT';
if (fieldname == 'PlACERECEIPTID') fieldname = 'PLACERECEIPTID';
var headfield = this.formBill.getForm().findField(fieldname);
if (headfield != NaN && headfield != null)
headfield.setValue(member.data.DEFVALUE);
};
} else {
}
}
},
scope: this
});
},
LoadMustBe: function () {
this.storeMustBe.load({ params: { condition: "BSTYPE='销售订舱'" },
callback: function (r, options, success) {
if (success) {
if (this.storeMustBe.getCount() > 0) {
for (var j = 0; j < this.storeMustBe.getCount(); j += 1) {
var member = this.storeMustBe.getAt(j);
var headfield = this.formHead.getForm().findField(member.data.FIELDNAME);
if (headfield != NaN && headfield != null) {
if (member.data.ISMUST == "1")
headfield.allowBlank = false;
if (member.data.ISCOLOR == "1")
headfield.setFieldStyle({ background: '#ffc' });
if (member.data.ISREADONLY == "1")
headfield.setReadOnly(true);
}
var headfield = this.formEdit.getForm().findField(member.data.FIELDNAME);
if (headfield != NaN && headfield != null) {
if (member.data.ISMUST == "1")
headfield.allowBlank = false;
if (member.data.ISCOLOR == "1")
headfield.setFieldStyle({ background: '#ffc' });
if (member.data.ISREADONLY == "1")
headfield.setReadOnly(true);
}
var fieldname = member.data.FIELDNAME;
if (fieldname == 'PlACERECEIPT') fieldname = 'PLACERECEIPT';
var headfield = this.formBill.getForm().findField(fieldname);
if (headfield != NaN && headfield != null) {
if (member.data.ISMUST == "1")
headfield.allowBlank = false;
if (member.data.ISCOLOR == "1")
headfield.setFieldStyle({ background: '#ffc' });
if (member.data.ISREADONLY == "1")
headfield.setReadOnly(true);
}
if (fieldname == 'CNTRTOTAL') {
if (member.data.ISMUST == "1") {
this.ISMUSTBECNTR = '1';
}
}
if (fieldname == 'OCEANFEE') {
if (member.data.ISMUST == "1") {
this.ISMUSTBEFEE = '1';
}
}
};
} else {
}
}
},
scope: this
});
},
//#endregion
//#region 编辑时按钮等的状态
GetEditStatus: function () {
var canedit = false;
var BSSTATUS = this.formHead.getForm().findField('ORSTATUS').getValue();
var inputby = this.formHead.getForm().findField('INPUTBY').getValue();
var op = this.formHead.getForm().findField('OP').getValue();
_this = this;
if (BSSTATUS == "0" || BSSTATUS == "1" || BSSTATUS == "8") {
canedit = false;
this.setSaveBtnStatus(canedit);
} else {
this.StoreOpRange.load({ params: { optype: "modSeaeOrderList" },
callback: function (r, options, success) {
if (success) {
if (r.length != 0) {
var records = DsStoreQueryBy(_this.StoreOpRange, 'OPID', inputby);
if (records.getCount() > 0) {
canedit = true;
} else {
var recordins = DsStoreQueryBy(_this.StoreOpRange, 'OPID', op);
if (recordins.getCount() > 0) {
canedit = true;
} else {
canedit = false;
}
}
} else { canedit = false; }
_this.setSaveBtnStatus(canedit);
}
}
});
}
},
GetStringNum: function (str) {
var num = 0;
if (str == null || str == '') return num;
if (str.length == 0) return num;
var if_find = false;
var str_num = '';
for (var i = 0; i < str.length; i += 1) {
var member = str.substr(i, 1);
if ((member == '0') || (member == '1') || (member == '2') || (member == '3')
|| (member == '4') || (member == '5') || (member == '6') || (member == '7')
|| (member == '8') || (member == '9') || (member == '.') || (member == '-')) {
if (!if_find) {
str_num = str_num + member;
}
} else {
if_find = true;
}
}
return str_num;
},
OprationSwap: function () {
var ret = new Array();
ret[0] = this.editRecord;
ret[1] = this.storeBodyList;
ret[2] = '销售管理';
return ret;
},
setAuditBtnStatus: function (enable) {
var btnESave = Ext.getCmp('btnESave');
var btnESaveAndClose = Ext.getCmp('btnESaveAndClose');
var btnESaveAndNew = Ext.getCmp('btnESaveAndNew');
var btnEAddDetail = Ext.getCmp('btnadddetail');
var btnEDeleteDetail = Ext.getCmp('btndeldetail');
var btnENew = Ext.getCmp('btnENew');
var btnECopyNew = Ext.getCmp('btnECopyNew');
var btnSubmitAudit = Ext.getCmp('btnSubmitAudit');
var btnSubmitAuditBack = Ext.getCmp('btnSubmitAuditBack');
//var btnEPrint = Ext.getCmp('btnEPrint');
var btnAudit = Ext.getCmp('btnAudit');
var btnAuditBack = Ext.getCmp('btnAuditBack');
var btnAccAudit = Ext.getCmp('btnAccAudit');
btnESave.setVisible(!enable); ;
btnESaveAndClose.setVisible(!enable);
btnESaveAndNew.setVisible(!enable);
btnEAddDetail.setVisible(!enable);
btnEDeleteDetail.setVisible(!enable);
btnENew.setVisible(!enable); ;
btnECopyNew.setVisible(!enable);
btnSubmitAudit.setVisible(!enable);
btnSubmitAuditBack.setVisible(!enable);
//btnEPrint.setVisible(!enable);
btnAccAudit.setVisible(enable);
btnAudit.setVisible(enable);
btnAuditBack.setVisible(enable);
if (enable) {
Ext.Ajax.request({
waitMsg: '',
url: '/MvcShipping/MsBaseInfo/GetUserModuleEnable',
params: {
modulename: "modSaleOrderAudit"
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (result.Success != true) {
btnAuditBack.disable();
} else {
btnAuditBack.enable();
}
} else {
}
},
scope: this
});
Ext.Ajax.request({
waitMsg: '',
url: '/MvcShipping/MsBaseInfo/GetUserModuleEnable',
params: {
modulename: "modSaleOrderAuditBack"
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (result.Success != true) {
btnAuditBack.disable();
} else {
btnAuditBack.enable();
}
} else {
}
},
scope: this
});
Ext.Ajax.request({
waitMsg: '',
url: '/MvcShipping/MsBaseInfo/GetUserModuleEnable',
params: {
modulename: "modSaleOrderConfirm"
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (result.Success != true) {
btnAudit.disable();
} else {
btnAudit.enable();
}
} else {
}
},
scope: this
});
};
},
setSaveBtnStatus: function (enable) {
var btnESave = Ext.getCmp('btnESave');
var btnESaveAndClose = Ext.getCmp('btnESaveAndClose');
var btnESaveAndNew = Ext.getCmp('btnESaveAndNew');
var btnEAddDetail = Ext.getCmp('btnadddetail');
var btnEDeleteDetail = Ext.getCmp('btndeldetail');
var btnadddrfee = Ext.getCmp('btnadddrfee');
var btnpostdrfee = Ext.getCmp('btnpostdrfee');
var btndeldrfee = Ext.getCmp('btndeldrfee');
var btnaddhsdrfee = Ext.getCmp('btnaddhsdrfee');
var btnaddcrfee = Ext.getCmp('btnaddcrfee');
var btnpostcrfee = Ext.getCmp('btnpostcrfee');
var btndelcrfee = Ext.getCmp('btndelcrfee');
var btnaddhscrfee = Ext.getCmp('btnaddhscrfee');
if (enable) {
btnESave.enable();
btnESaveAndClose.enable();
btnESaveAndNew.enable();
btnEAddDetail.enable();
btnEDeleteDetail.enable();
// btnadddrfee.enable();
// btnpostdrfee.enable();
// btndeldrfee.enable();
// btnaddhsdrfee.enable();
// btnaddcrfee.enable();
// btnpostcrfee.enable();
// btndelcrfee.enable();
// btnaddhscrfee.enable();
} else {
btnESave.disable();
btnESaveAndClose.disable();
btnESaveAndNew.disable();
btnEAddDetail.disable();
btnEDeleteDetail.disable();
// btnadddrfee.disable();
// btnpostdrfee.disable();
// btndeldrfee.disable();
// btnaddhsdrfee.disable();
// btnaddcrfee.disable();
// btnpostcrfee.disable();
// btndelcrfee.disable();
// btnaddhscrfee.disable();
}
Ext.Ajax.request({
waitMsg: '',
url: '/MvcShipping/MsBaseInfo/GetUserModuleEnable',
params: {
modulename: "modSaleOrderNoSubMit"
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (result.Success == true) {
Ext.getCmp('btnSubmitAudit').disable();
Ext.getCmp('btnSubmitAuditBack').disable();
this.issubmit = false;
} else {
//
}
} else {
}
},
scope: this
});
},
//#endregion
//#region 打印
Print: function () {
var basicForm = this.formHead.getForm();
var billNo = basicForm.findField('BSNO').value;
if (billNo == '*' || billNo == '') {
Ext.Msg.show({ title: '错误', msg: '单据还没有保存,请保存后再打印', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
return;
}
var printType = 'MSOPSEAEORDER';
var sql1 = "SET LANGUAGE 'us_english' SELECT * FROM crm_seaeorder WHERE BSNO = '" + billNo + "'";
var sql2 = "";
var sql3 = "";
var sql4 = "";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
}
//#endregion
});