You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
DS7/DSWeb/Areas/MvcShipping/Viewsjs/MsOpAirn/MsOpAirnMainEdit.js

4606 lines
179 KiB
JavaScript

2 years ago
Ext.namespace('Shipping');
Shipping.MsOpAirnEdit = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsOpAirnEdit.superclass.constructor.call(this);
};
Ext.extend(Shipping.MsOpAirnEdit, Ext.Panel, {
ParentWin: null,
OpStatus: 'add',
StoreList: null,
editRecord: null,
Editdata: null,
MainEditRecord: null,
stroplb: '国内空运',
isfen: false,
HBLNO: "",
BSNO: "",
initUIComponents: function () {
this.serialNo = 0;
//this.bodyDel = [];
this.itemindex = 1;
this.initloaddata = 0;
this.CargoDel = [];
this.formname = "OpAirnMainEdit"; //页面名称
//#region 信息加载
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.storecodeservice = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsCodeOpService',
proxy: { url: '/MvcShipping/MsCodeOpService/GetDataList' }
});
//权限范围
this.StoreOpRange = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsOP',
proxy: { url: '/MvcShipping/MsBaseInfo/GetOpRang' }
});
this.StoreOpRange.load({ params: { optype: "modOrderManagement"} });
//人员信息加载
this.storeOpCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.UserRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetUserLinkRefList' }
});
//客服
this.comboxCUSTSERVICE = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '客服',
store: this.storeOpCode,
forceSelection: true,
//disabled: true,
readOnly: true,
//hidden: true,
2 years ago
name: 'CUSTSERVICE',
valueField: 'UserName',
displayField: 'CodeAndName'
});
//揽货人
this.comboxSALE = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '揽货人',
store: this.storeOpCode,
//disabled: true,
readOnly:true,
//hidden: true,
2 years ago
forceSelection: true,
name: 'SALE',
valueField: 'UserName',
displayField: 'CodeAndName'
});
//操 作
this.comboxOP = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '操 作',
store: this.storeOpCode,
forceSelection: true,
name: 'OP',
valueField: 'UserName',
displayField: 'CodeAndName'
});
//单证
this.comboxDOC = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '单 证',
store: this.storeOpCode,
forceSelection: true,
name: 'DOC',
valueField: 'UserName',
displayField: 'CodeAndName'
});
//客户加载_委托单位
this.storeCustCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
//委托单位
this.comboxCustCode = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '委托单位',
store: this.storeCustCode,
forceSelection: true,
hidden: true,
name: 'CUSTOMERNAME',
valueField: 'CustName',
displayField: 'CodeAndName',
//allowBlank: false,
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
var data = combo.value;
this.formHead.getForm().findField('SALE').setValue(records[0].data.SALE);
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.comboxInfoClientContact.setValue(member.data.SHOWNAME);
// this.formHead.getForm().findField('OPERATOREMAIL').setValue(member.data.EMAIL);
this.formHead.getForm().findField('OPERATORTEL').setValue(member.data.TEL);
// this.formHead.getForm().findField('OPERATORFAX').setValue(member.data.FAX);
} else {
this.comboxInfoClientContact.setValue('');
// this.formHead.getForm().findField('OPERATOREMAIL').setValue('');
this.formHead.getForm().findField('OPERATORTEL').setValue('');
// this.formHead.getForm().findField('OPERATORFAX').setValue('');
}
}
},
scope: this
});
var sF = " ISFINANCIALSTAFF=1 and LINKID in (select gid from [info_client] where SHORTNAME='" + combo.value + "')";
this.storeInfoClientContactFF.load({ params: { condition: sF },
callback: function (r, options, success) {
if (success) {
if (this.storeInfoClientContactFF.getCount() > 0) {
var member = this.storeInfoClientContactFF.getAt(0);
this.comboxClientFCContact.setValue(member.data.SHOWNAME);
// this.formHead.getForm().findField('FINANCIALSTAFFEMAIL').setValue(member.data.EMAIL);
this.formHead.getForm().findField('FINANCIALSTAFFTEL').setValue(member.data.TEL);
// this.formHead.getForm().findField('FINANCIALSTAFFFAX').setValue(member.data.FAX);
} else {
this.comboxClientFCContact.setValue('');
// this.formHead.getForm().findField('FINANCIALSTAFFEMAIL').setValue('');
this.formHead.getForm().findField('FINANCIALSTAFFTEL').setValue('');
// this.formHead.getForm().findField('FINANCIALSTAFFFAX').setValue('');
}
}
},
scope: this
});
this.storeShipper.load({ params: { condition: "shippertype=2 AND (ISPUBLIC=1 OR CODENAME IN (SELECT CODENAME FROM info_client WHERE SHORTNAME='" + combo.value + "') )"} });
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 + "') )"} });
this.storeagent.load({ params: { condition: "shippertype=4 AND (ISPUBLIC=1 OR CODENAME IN (SELECT CODENAME FROM info_client WHERE SHORTNAME='" + combo.value + "') )"} });
}
}
}
});
//委托单位_联系人
this.storeInfoClientContact = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.InfoClientContactModel',
proxy: { url: '/CommMng/BasicDataRef/GetInfoClientContactList' }
});
this.storeInfoClientContactFF = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.InfoClientContactModel',
proxy: { url: '/CommMng/BasicDataRef/GetInfoClientContactList' }
});
//this.storeInfoClientContact.load();
this.comboxInfoClientContact = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '客户操作',
store: this.storeInfoClientContact,
forceSelection: true,
hidden: true,
name: 'OPERATORCODE',
valueField: 'SHOWNAME',
displayField: 'SHOWNAME',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
var Cargoinforecords = DsStoreQueryBy(this.storeInfoClientContact, 'GID', records[0].data.GID);
if (Cargoinforecords.getCount() > 0) {
var Cargoinfodata = Cargoinforecords.getAt(0).data;
// this.formHead.getForm().findField('OPERATOREMAIL').setValue(Cargoinfodata.EMAIL);
this.formHead.getForm().findField('OPERATORTEL').setValue(Cargoinfodata.TEL);
// this.formHead.getForm().findField('OPERATORFAX').setValue(Cargoinfodata.FAX);
} else {
// this.formHead.getForm().findField('OPERATOREMAIL').setValue('');
this.formHead.getForm().findField('OPERATORTEL').setValue('');
// this.formHead.getForm().findField('OPERATORFAX').setValue('');
}
}
}
}
});
this.comboxClientFCContact = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '客户财务',
store: this.storeInfoClientContactFF,
forceSelection: true,
hidden: true,
name: 'FINANCIALSTAFFCODE',
valueField: 'SHOWNAME',
displayField: 'SHOWNAME',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
var Cargoinforecords = DsStoreQueryBy(this.storeInfoClientContactFF, 'GID', records[0].data.GID);
if (Cargoinforecords.getCount() > 0) {
var Cargoinfodata = Cargoinforecords.getAt(0).data;
// this.formHead.getForm().findField('FINANCIALSTAFFEMAIL').setValue(Cargoinfodata.EMAIL);
this.formHead.getForm().findField('FINANCIALSTAFFTEL').setValue(Cargoinfodata.TEL);
// this.formHead.getForm().findField('FINANCIALSTAFFFAX').setValue(Cargoinfodata.FAX);
} else {
// this.formHead.getForm().findField('FINANCIALSTAFFEMAIL').setValue('');
this.formHead.getForm().findField('FINANCIALSTAFFTEL').setValue('');
// this.formHead.getForm().findField('FINANCIALSTAFFFAX').setValue('');
}
}
}
}
});
//客户加载_船公司
this.storeAIRLINES = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.AirLinesModel',
proxy: { url: '/CommMng/BasicDataRef/GetAirLinesList' }
});
//船公司
this.comboxAIRLINES = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '航空公司',
store: this.storeAIRLINES,
forceSelection: true,
name: 'AIRLINES',
valueField: 'CustName',
displayField: 'CodeAndName',
listeners: {
blur: function (field, newValue, oldValue) {
if (field.displayTplData[0].ISSTOP == "True") {
alert("该往来单位已经停用");
}
_this.LoadFreight();
_this.LoadFreightMain();
},
change: function (field, newValue, oldValue) {
if (field.displayTplData[0].code != "") {
_this.storeCargoName.load({ params: { start: 0, limit: 9999, condition: " CLIENTGID=(select gid from info_client where codename='" + field.displayTplData[0].CustCode + "') "} });
if (field.displayTplData[0].ISAGENTCN == "True" || field.displayTplData[0].ISAGENTCN == "0") {
//alert(newValue);
//Ext.getCmp("VESSELHEAD").setValue( field.displayTplData[0].CustCode );
} else {
Ext.getCmp("VESSELHEAD").setValue(field.displayTplData[0].CustCode);
}
}
},
scope: this
}
});
this.storeAIRLINES1 = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
this.comboxAIRLINES1 = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '承运人1',
store: this.storeAIRLINES1,
forceSelection: true,
name: 'CY1',
valueField: 'CustCode',
displayField: 'CodeAndName'
});
this.storeAIRLINES2 = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
this.comboxAIRLINES2 = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '承运人2',
store: this.storeAIRLINES2,
forceSelection: true,
name: 'CY2',
valueField: 'CustCode',
displayField: 'CodeAndName'
});
this.storeAIRLINES3 = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
this.comboxAIRLINES3 = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '承运人3', hidden: true,
store: this.storeAIRLINES3,
forceSelection: true,
name: 'CY3',
valueField: 'CustCode',
displayField: 'CodeAndName'
});
//客户加载_订舱代理
this.storeFORWARDER = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
//船公司
this.comboxFORWARDER = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '订舱代理', hidden: true,
store: this.storeFORWARDER,
forceSelection: true,
name: 'FORWARDER',
valueField: 'CustName',
displayField: 'CodeAndName'
});
//客户加载_车队
this.storeTRUCKER = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
//车队
this.comboxTRUCKER = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '车队',
hidden: true,
store: this.storeTRUCKER,
forceSelection: true,
name: 'TRUCKER',
valueField: 'CustName',
displayField: 'CodeAndName'
});
//客户加载_报关报检
this.storeCUSTOMSER = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
//报关行
this.comboxCUSTOMSER = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '报关行',
store: this.storeCUSTOMSER,
hidden: true,
forceSelection: true,
name: 'CUSTOMSER',
valueField: 'CustName',
displayField: 'CodeAndName'
});
//键值维护表_装运方式
this.StoreBLTYPE = Ext.create('Ext.data.Store', {
fields: ['BLTYPE']
});
//this.StoreBLTYPE.add({ "BLTYPE": "空运单票" });
this.StoreBLTYPE.add({ "BLTYPE": "国内主单" });
this.StoreBLTYPE.add({ "BLTYPE": "国内分单" });
this.comboxBLTYPE = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '装运方式',
store: this.StoreBLTYPE,
readOnly: true,
forceSelection: true,
name: 'BLTYPE',
valueField: 'BLTYPE',
displayField: 'BLTYPE',
value: BLTYPE,
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
/*if (combo.value == "" || combo.value == "") {
}
else {
}*/
}
}
}
});
//品名
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', {
store: this.storeCodeGoodsList,
labelWidth: 250,
// forceSelection: true,
name: 'GOODSNAME',
valueField: 'GOODNAME',
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, hidden: true,
// 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,
hidden: true,
name: 'BSSOURCEDETAIL',
valueField: 'SourceDetail',
displayField: 'SourceDetail'
});
//所属部门
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: '所属部门',
hidden: true,
store: this.storeDept,
forceSelection: true,
name: 'SALEDEPT',
valueField: 'DeptName',
displayField: 'DeptName'
//,hidden: true
});
//件数包装
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: '包 装',
flex: 1,
store: this.storeCodePackage,
// padding: '0 0 0 10',
// forceSelection: true,
name: 'KINDPKGS',
valueField: 'PKGS',
displayField: 'PKGS'
});
//客户加载_发货人
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.formEdit.getForm().findField('SHIPPER').setValue(selectdata.SHIPPERDETAIL);
} else {
this.formEdit.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.formEdit.getForm().findField('CONSIGNEE').setValue(selectdata.SHIPPERDETAIL);
} else {
this.formEdit.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, hidden: true,
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.formEdit.getForm().findField('NOTIFYPARTY').setValue(selectdata.SHIPPERDETAIL);
} else {
this.formEdit.getForm().findField('NOTIFYPARTY').setValue('');
}
}
}
}
});
//客户加载_代理
this.storeagent = Ext.create('DsExt.ux.RefTableStore', {
model: 'OpSeaeShipper',
proxy: { url: '/MvcShipping/MsOpSeae/GetShipperList' }
});
// this.storeShipper.load({ params: { condition: "ISCONTROLLER='1'"} });
//收货人
this.comboxAgent = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '代 理', hidden: true,
store: this.storeagent,
labelWidth: 150,
labelAlign: 'left', // 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.formEdit.getForm().findField('AGENT').setValue(selectdata.SHIPPERDETAIL);
} else {
this.formEdit.getForm().findField('AGENT').setValue('');
}
}
}
}
});
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.StoreStlName.add({ "STLNAME": "现结买单" });
this.comboxStlName = Ext.create('DsExt.ux.RefTableCombox', {
store: this.StoreStlName,
fieldLabel: '结算方式',
forceSelection: true,
name: 'STLNAME',
valueField: 'STLNAME',
displayField: 'STLNAME'
});
this.StoreCURR = Ext.create('Ext.data.Store', {
fields: ['CURR']
});
this.StoreCURR.add({ "CURR": "USD" });
this.StoreCURR.add({ "CURR": "JPY" });
this.StoreCURR.add({ "CURR": "RMB" });
this.StoreCURR.add({ "CURR": "HKD" });
this.comboxCURR = Ext.create('DsExt.ux.RefTableCombox', {
store: this.StoreCURR,
fieldLabel: '币制',
name: 'CURR',
valueField: 'CURR',
displayField: 'CURR'
});
//#endregion
//#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: [this.comboxOP, {
fieldLabel: '业务编号',
name: 'BSNO', hidden: true
}, {
fieldLabel: 'MASTERNO',
name: 'MASTERNO', hidden: true
}, {
fieldLabel: 'INPUTBY',
name: 'INPUTBY', hidden: true
}, {
fieldLabel: '时间戳',
name: 'TimeMark', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: '业务锁定',
disabled: true,
readOnly: true,
name: 'BSSTATUSREF'
}, {
fieldLabel: '费用锁定',
readOnly: true,
disabled: true,
name: 'FEESTATUSREF'
}, {
fieldLabel: '会计期间',
xtype: 'monthfield',
name: 'ACCDATE'
}, this.comboxBLTYPE]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxCustCode, this.comboxBSSOURCE, this.comboxBSSOURCEDETAIL, this.comboxDept]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '委托编号',
hidden: true,
//allowBlank: true,
name: 'CUSTNO'
}, {
fieldLabel: '订舱编号',
hidden: true,
name: 'ORDERNO'
}, {
xtype: 'container',
layout: 'hbox',
flex: 1,
defaultType: 'textfield',
items: [{
fieldLabel: '主单号',
name: 'MBLNO',
allowBlank: true,
readOnly: true
}, {
xtype: 'button',
id: 'btnCUSTNO',
iconCls: "btncancel",
handler: function (button, event) {
this.ImportBs();
},
scope: this
}]
}, {
fieldLabel: '分单号',
name: 'HBLNO'
}, this.comboxStlName, {
fieldLabel: '结算日期',
format: 'Y-m-d',
flex: 1,
xtype: 'datefield',
name: 'STLDATE'
}, {
xtype: 'checkbox', flex: 1,
fieldLabel: '是否换单',
name: 'TRANSFER'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxSALE, this.comboxCUSTSERVICE, {xtype:"hiddenfield",flex:3}]
}
, this.myCheckboxService, {
2 years ago
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '运费协议号',
hidden: true,
name: 'CONTRACTNO'
}//, { xtype: 'hiddenfield' }
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxInfoClientContact, {
fieldLabel: 'TEL', hidden: true,
name: 'OPERATORTEL'
}, this.comboxClientFCContact, {
fieldLabel: 'TEL', hidden: true,
name: 'FINANCIALSTAFFTEL'
}]
}
]//end items(fieldset 1)
}); //end this.formEdit
//#endregion
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,
name: 'TRADETERM'
});
//#region 数据集
//国际港口(进口装货港、出口卸货港)
this.storeCodeDisport = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsCodeAirPort',
proxy: { url: '/MvcShipping/MsCodeAirPort/GetDataList' }
});
// this.storeCodeDisport.load();
this.storeCodeDisport2 = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsCodeAirPort',
proxy: { url: '/MvcShipping/MsCodeAirPort/GetDataList' }
});
this.storeport1 = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsCodeAirPort',
proxy: { url: '/MvcShipping/MsCodeAirPort/GetDataList' }
});
this.storeport2 = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsCodeAirPort',
proxy: { url: '/MvcShipping/MsCodeAirPort/GetDataList' }
});
this.storeport3 = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsCodeAirPort',
proxy: { url: '/MvcShipping/MsCodeAirPort/GetDataList' }
});
this.comboxPORTLOADID = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '始发地',
store: this.storeCodeDisport,
name: 'PORTLOADID',
valueField: 'PORTID',
displayField: 'CODEANDCNAME',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
var selectrecords = DsStoreQueryBy(this.storeCodeDisport, 'PORTID', combo.value);
if (selectrecords.getCount() > 0) {
var selectdata = selectrecords.getAt(0).data;
this.formEdit.getForm().findField('PORTLOAD').setValue(selectdata.PORTCNAME);
} else {
this.formEdit.getForm().findField('PORTLOAD').setValue('');
}
}
}
}
});
this.comboxPORTDISCHARGEID = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '目的站',
store: this.storeCodeDisport2,
name: 'PORTDISCHARGEID',
valueField: 'PORTID',
displayField: 'CODEANDCNAME',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
var selectrecords = DsStoreQueryBy(this.storeCodeDisport, 'PORTID', combo.value);
if (selectrecords.getCount() > 0) {
var selectdata = selectrecords.getAt(0).data;
this.formEdit.getForm().findField('PORTDISCHARGE').setValue(selectdata.PORTCNAME);
} else {
this.formEdit.getForm().findField('PORTDISCHARGE').setValue('');
}
}
}
}
});
this.comboxPORT1 = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '到达站1',
store: this.storeport1,
name: 'PORT1',
valueField: 'PORTID',
displayField: 'PORTID'
});
this.comboxPORT2 = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '到达站2',
store: this.storeport2,
name: 'PORT2',
valueField: 'PORTID',
displayField: 'PORTID'
});
this.comboxPORT3 = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '到达站3', hidden: true,
store: this.storeport3,
name: 'PORT3',
valueField: 'PORTID',
displayField: 'PORTID'
});
//付费方式
this.storeFrt = Ext.create('Ext.data.Store', {
fields: ['FRT']
});
this.storeFrt.add({ "FRT": "PP" });
this.storeFrt.add({ "FRT": "CC" });
this.comboxBLFRT = Ext.create('DsExt.ux.RefTableCombox', {
//fieldLabel: '付费方式',
store: this.storeFrt,
forceSelection: true,
name: 'BLFRT',
valueField: 'FRT',
displayField: 'FRT',
flex: 1,
listeners: {
scope: this,
change: function (field, newValue, oldValue, eOpts) {
/*
var ttl = parseFloatDef(this.formEdit.getForm().findField('TTLFREIGHT').getValue(), 0);
var BLFRT = this.formEdit.getForm().findField('BLFRT').getValue();
if (BLFRT == 'PP') {
if (ttl != 0)
this.formEdit.getForm().findField('PFREIGHT').setValue(ttl);
} else if (OTFRT == 'CC') {
if (ttl != 0)
this.formEdit.getForm().findField('PFREIGHT').setValue(ttl);
}*/
}
}
});
this.comboxOTBLFRT = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '杂费',
store: this.storeFrt,
forceSelection: true,
name: 'OTFRT',
valueField: 'FRT',
displayField: 'FRT',
listeners: {
scope: this,
change: function (field, newValue, oldValue, eOpts) {
this.otfeechange(field, newValue, oldValue, eOpts);
}
}
});
this.comboxHBLBLFRT = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeFrt,
forceSelection: true,
name: 'HBLBLFRT',
valueField: 'FRT',
displayField: 'FRT'
});
this.comboxHBLOTBLFRT = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeFrt,
forceSelection: true,
name: 'HBLOTBLFRT',
valueField: 'FRT',
displayField: 'FRT'
});
this.storeCrmKeyCodeCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CrmKeyCodeModel',
proxy: { url: '/CommMng/BasicDataRef/GetCrmKeyCodeList' }
});
this.storeCrmKeyCodeCode.load({ params: { condition: " and KEYTYPE='贸易方式'"} });
this.comboxTRADETYPE = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '贸易方式',
store: this.storeCrmKeyCodeCode,
forceSelection: true,
id: 'TRADETYPE',
name: 'TRADETYPE',
valueField: 'KEYVALUE',
displayField: 'KEYVALUE'
});
this.storeFeeNameRef = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.FeeTypeRefModel',
proxy: { url: '/MvcShipping/MsChFee/GetFeeTypeRefList' }
});
this.storeFeeNameRef2 = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.FeeTypeRefModel',
proxy: { url: '/MvcShipping/MsChFee/GetFeeTypeRefList' }
});
this.storeFeeNameRef3 = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.FeeTypeRefModel',
proxy: { url: '/MvcShipping/MsChFee/GetFeeTypeRefList' }
});
this.storeFeeNameRef4 = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.FeeTypeRefModel',
proxy: { url: '/MvcShipping/MsChFee/GetFeeTypeRefList' }
});
this.storeFeeNameRef5 = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.FeeTypeRefModel',
proxy: { url: '/MvcShipping/MsChFee/GetFeeTypeRefList' }
});
this.storeFeeNameRef6 = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.FeeTypeRefModel',
proxy: { url: '/MvcShipping/MsChFee/GetFeeTypeRefList' }
});
this.storeFeeNameRef7 = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.FeeTypeRefModel',
proxy: { url: '/MvcShipping/MsChFee/GetFeeTypeRefList' }
});
this.storeFeeNameRef8 = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.FeeTypeRefModel',
proxy: { url: '/MvcShipping/MsChFee/GetFeeTypeRefList' }
});
this.storeFeeNameRef.load({ params: { condition: "" }
, async: false
,
callback: function (r, options, success) {
if (success) {
_this.storeFeeNameRef2.removeAll();
_this.storeFeeNameRef2.add(r);
_this.storeFeeNameRef3.removeAll();
_this.storeFeeNameRef3.add(r);
_this.storeFeeNameRef4.removeAll();
_this.storeFeeNameRef4.add(r);
_this.storeFeeNameRef5.removeAll();
_this.storeFeeNameRef5.add(r);
_this.storeFeeNameRef6.removeAll();
_this.storeFeeNameRef6.add(r);
_this.storeFeeNameRef7.removeAll();
_this.storeFeeNameRef7.add(r);
_this.storeFeeNameRef8.removeAll();
_this.storeFeeNameRef8.add(r);
}
},
scope: this
});
this.comboxFeeName1 = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeFeeNameRef,
forceSelection: false,
name: 'OTFEE1',
valueField: 'Name',
displayField: 'CodeAndName',
listeners: {
scope: this,
change: function (field, newValue, oldValue, eOpts) {
var amount1 = this.formEdit_2.getForm().findField('OTFEE1AMOUNT').getValue();
if (amount1 == '') {
this.formEdit_2.getForm().findField('OTFEE1AMOUNT').setValue(0);
}
}
}
});
this.comboxFeeName2 = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeFeeNameRef2,
forceSelection: false,
name: 'OTFEE2',
valueField: 'Name',
displayField: 'CodeAndName',
listeners: {
scope: this,
change: function (field, newValue, oldValue, eOpts) {
var amount2 = this.formEdit_2.getForm().findField('OTFEE2AMOUNT').getValue();
if (amount2 == '') {
this.formEdit_2.getForm().findField('OTFEE2AMOUNT').setValue(0);
}
}
}
});
this.comboxFeeName3 = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeFeeNameRef3,
forceSelection: false,
name: 'OTFEE3',
valueField: 'Name',
displayField: 'CodeAndName',
listeners: {
scope: this,
change: function (field, newValue, oldValue, eOpts) {
var amount3 = this.formEdit_2.getForm().findField('OTFEE3AMOUNT').getValue();
if (amount3 == '') {
this.formEdit_2.getForm().findField('OTFEE3AMOUNT').setValue(0);
}
}
}
});
this.comboxFeeName4 = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeFeeNameRef4,
forceSelection: false,
name: 'OTFEE4',
valueField: 'Name',
displayField: 'CodeAndName',
listeners: {
scope: this,
change: function (field, newValue, oldValue, eOpts) {
this.formEdit_2.getForm().findField('OTFEE4AMOUNT').setValue(0);
}
}
});
this.comboxFeeName5 = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeFeeNameRef5,
forceSelection: false,
name: 'OTFEE5',
valueField: 'Name',
displayField: 'CodeAndName',
listeners: {
scope: this,
change: function (field, newValue, oldValue, eOpts) {
this.formEdit_2.getForm().findField('OTFEE5AMOUNT').setValue(0);
}
}
});
this.comboxFeeName6 = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeFeeNameRef6,
forceSelection: false,
name: 'OTFEE6',
valueField: 'Name',
displayField: 'CodeAndName',
listeners: {
scope: this,
change: function (field, newValue, oldValue, eOpts) {
this.formEdit_2.getForm().findField('OTFEE6AMOUNT').setValue(0);
}
}
});
this.comboxFeeName7 = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeFeeNameRef7,
forceSelection: false,
name: 'OTFEE7',
valueField: 'Name',
displayField: 'CodeAndName',
listeners: {
scope: this,
change: function (field, newValue, oldValue, eOpts) {
this.formEdit_2.getForm().findField('OTFEE7AMOUNT').setValue(0);
}
}
});
this.comboxFeeName8 = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeFeeNameRef8,
forceSelection: false,
name: 'OTFEE8',
valueField: 'Name',
displayField: 'CodeAndName',
listeners: {
scope: this,
change: function (field, newValue, oldValue, eOpts) {
this.formEdit_2.getForm().findField('OTFEE8AMOUNT').setValue(0);
}
}
});
me = this;
//#endregion
//#region 编辑formEdit 基本信息
this.panelAIRLINES = new Ext.Panel({
layout: 'anchor',
bodyPadding: 5,
frame: true,
trackResetOnLoad: true,
fieldDefaults: {
margins: '0 0 0 0',
labelAlign: 'right',
flex: 1,
labelWidth: 70,
msgTarget: 'qtip'
},
items: [{
xtype: 'container',
layout: 'hbox',
flex: 1,
defaultType: 'textfield',
items: [
this.comboxPORTLOADID,
{ hidden: true,
name: 'PORTLOAD'
},
this.comboxPORTDISCHARGEID,
{ hidden: true,
name: 'PORTDISCHARGE'
}
, this.comboxAIRLINES
, { labelWidth: 60,
fieldLabel: '航班',
name: 'VESSELHEAD', id: "VESSELHEAD",
value: "",
flex: 0.6
}
, {
flex: 0.4,
name: 'VESSEL'
}, {
fieldLabel: '航班日期',
format: 'Y-m-d',
flex: 1,
xtype: 'datefield',
name: 'ETD',
listeners: {
blur: function (field, newValue, oldValue) {
_this.LoadFreight();
},
scope: this
}
}, this.comboxFORWARDER
, {
xtype: 'checkbox', flex: 1,
fieldLabel: '包量包舱',
name: 'SUPERVISE'
}
]
}
,
{
xtype: 'container',
layout: 'hbox',
flex: 1,
defaultType: 'textfield',
items: [
this.comboxAIRLINES1
, this.comboxPORT1
, this.comboxAIRLINES2
, this.comboxPORT2
, {
fieldLabel: '签单日期',
format: 'Y-m-d H:i:s',
//flex: 1,
xtype: 'datefield',
name: 'ISSUEDATE'
}, {
fieldLabel: '签单地点',
name: 'ISSUEPLACE'
}
, this.comboxAIRLINES3
, this.comboxPORT3
]
}
, {
xtype: 'container',
layout: 'hbox',
flex: 1,
defaultType: 'textfield',
items: [
//this.comboxCUSTOMSER, this.comboxTRUCKER, { xtype: 'hiddenfield' }
{
fieldLabel: '运输声明价值', labelWidth: 80,
flex: 1, xtype: 'numberfield', minValue: 0,
name: 'CUSTVALUE'
}, {
fieldLabel: '保险金额', //labelWidth: 80,
flex: 1, xtype: 'numberfield', minValue: 0,
name: 'INAMOUT',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
try {
var lsValue = usMoney(value, 2, '', false);
if (lsValue != "NaN") {
value = lsValue; if (parseFloat(lsValue) < 0) {
return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
}
},
{
fieldLabel: '结算注意事项', labelWidth: 80,
flex: 2, id: "STREMARK",
name: 'STREMARK'
}, {
fieldLabel: '运输注意事项', labelWidth: 80,
flex: 2, id: "TRANSREMARK",
name: 'TRANSREMARK'
}
]
}
, {
xtype: 'container',
layout: 'hbox',
flex: 1,
defaultType: 'textfield',
items: [
{
fieldLabel: '',
flex: 1, hidden: true,
name: 'TRANSFER_REMARK'
}, { xtype: 'hiddenfield', flex: 3 }
,
{
fieldLabel: '到港日期',
hidden: true,
format: 'Y-m-d',
flex: 1,
xtype: 'datefield',
name: 'ETA'
}]
}
, {
xtype: 'container',
layout: 'hbox',
flex: 1,
defaultType: 'textfield',
items: [this.comboxCUSTOMSER, this.comboxTRUCKER, { xtype: 'hiddenfield'}]
}]
});
this.panelOTFEE = new Ext.Panel({
layout: 'anchor',
bodyPadding: 5,
frame: true,
trackResetOnLoad: true,
height: 160,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 0,
msgTarget: 'qtip'
},
items: [{
xtype: 'container',
layout: 'anchor',
flex: 3,
defaultType: 'textfield',
items: [{
xtype: 'container',
layout: 'hbox',
flex: 1,
defaultType: 'textfield',
height: 27,
items: [{
xtype: 'label',
flex: 1,
text: '费用名称'
}, {
xtype: 'label',
flex: 1,
text: '金额',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
try {
var lsValue = usMoney(value, 2, '', false);
if (lsValue != "NaN") {
value = lsValue; if (parseFloat(lsValue) < 0) {
return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
}
}, {
xtype: 'label',
flex: 1,
text: '费用名称'
}, {
xtype: 'label',
flex: 1,
text: '金额',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
try {
var lsValue = usMoney(value, 2, '', false);
if (lsValue != "NaN") {
value = lsValue; if (parseFloat(lsValue) < 0) {
return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
}
}]
}
, {
xtype: 'container',
layout: 'hbox',
flex: 1,
defaultType: 'textfield',
items: [this.comboxFeeName1, {
flex: 1,
name: 'OTFEE1AMOUNT',
listeners: {
scope: this,
change: function (field, newValue, oldValue, eOpts) {
var otfee1 = this.formEdit_2.getForm().findField('OTFEE1').getValue();
if (otfee1 == '') {
this.formEdit_2.getForm().findField('OTFEE1AMOUNT').setValue(0);
} else {
this.otfeechange(field, newValue, oldValue, eOpts);
}
}
}
}, this.comboxFeeName2, {
flex: 1,
name: 'OTFEE2AMOUNT',
listeners: {
scope: this,
change: function (field, newValue, oldValue, eOpts) {
var otfee2 = this.formEdit_2.getForm().findField('OTFEE2').getValue();
if (otfee2 == '') {
this.formEdit_2.getForm().findField('OTFEE2AMOUNT').setValue(0);
} else {
this.otfeechange(field, newValue, oldValue, eOpts);
}
}
}
}]
}
, {
xtype: 'container',
layout: 'hbox',
flex: 1,
defaultType: 'textfield',
items: [this.comboxFeeName3, {
flex: 1,
name: 'OTFEE3AMOUNT',
listeners: {
scope: this,
change: function (field, newValue, oldValue, eOpts) {
var otfee3 = this.formEdit_2.getForm().findField('OTFEE3').getValue();
if (otfee3 == '') {
this.formEdit_2.getForm().findField('OTFEE3AMOUNT').setValue(0);
} else {
this.otfeechange(field, newValue, oldValue, eOpts);
}
}
}
}, this.comboxFeeName4, {
flex: 1,
name: 'OTFEE4AMOUNT',
listeners: {
scope: this,
change: function (field, newValue, oldValue, eOpts) {
var otfee4 = this.formEdit_2.getForm().findField('OTFEE4').getValue();
if (otfee4 == '') {
this.formEdit_2.getForm().findField('OTFEE4AMOUNT').setValue(0);
} else {
this.otfeechange(field, newValue, oldValue, eOpts);
}
}
}
}]
}
, {
xtype: 'container',
layout: 'hbox',
flex: 1,
defaultType: 'textfield',
items: [this.comboxFeeName5, {
flex: 1,
name: 'OTFEE5AMOUNT',
listeners: {
scope: this,
change: function (field, newValue, oldValue, eOpts) {
var otfee5 = this.formEdit_2.getForm().findField('OTFEE5').getValue();
if (otfee5 == '') {
this.formEdit_2.getForm().findField('OTFEE5AMOUNT').setValue(0);
} else {
this.otfeechange(field, newValue, oldValue, eOpts);
}
}
}
}, this.comboxFeeName6, {
flex: 1,
name: 'OTFEE6AMOUNT',
listeners: {
scope: this,
change: function (field, newValue, oldValue, eOpts) {
var otfee6 = this.formEdit_2.getForm().findField('OTFEE6').getValue();
if (otfee6 == '') {
this.formEdit_2.getForm().findField('OTFEE6AMOUNT').setValue(0);
} else {
this.otfeechange(field, newValue, oldValue, eOpts);
}
}
}
}]
}
, {
xtype: 'container',
layout: 'hbox',
flex: 1,
defaultType: 'textfield',
items: [this.comboxFeeName7, {
flex: 1,
name: 'OTFEE7AMOUNT',
listeners: {
scope: this,
change: function (field, newValue, oldValue, eOpts) {
var otfee7 = this.formEdit_2.getForm().findField('OTFEE7').getValue();
if (otfee7 == '') {
this.formEdit_2.getForm().findField('OTFEE7AMOUNT').setValue(0);
} else {
this.otfeechange(field, newValue, oldValue, eOpts);
}
}
}
}, this.comboxFeeName8, {
flex: 1,
name: 'OTFEE8AMOUNT',
listeners: {
scope: this,
change: function (field, newValue, oldValue, eOpts) {
var otfee8 = this.formEdit_2.getForm().findField('OTFEE8').getValue();
if (otfee8 == '') {
this.formEdit_2.getForm().findField('OTFEE8AMOUNT').setValue(0);
} else {
this.otfeechange(field, newValue, oldValue, eOpts);
}
}
}
}]
}]
}]
});
this.panelFEETOTAL = new Ext.Panel({
layout: 'anchor',
bodyPadding: 5,
height: 160,
frame: true,
trackResetOnLoad: true,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 70,
msgTarget: 'qtip'
},
items: [{
xtype: 'container',
layout: 'anchor',
flex: 3,
defaultType: 'textfield',
items: [
{
xtype: 'container',
layout: 'hbox',
flex: 1,
defaultType: 'textfield',
items: [
{ xtype: 'hiddenfield', flex: 1 }
, { xtype: "label", text: "预付", flex: 1 }
, this.comboxBLFRT
, { xtype: 'hiddenfield', flex: 1 }
, { xtype: "label", text: "到付", flex: 1 }
]
}
, {
xtype: 'container',
layout: 'hbox',
flex: 1,
defaultType: 'textfield',
items: [{
fieldLabel: '',
flex: 1,
name: 'PFREIGHT',
listeners: {
scope: this,
change: function (field, newValue, oldValue, eOpts) {
if (newValue == null || newValue == '') return;
if (newValue != oldValue) {
/*
var pfreight = parseFloatDef(newValue, 0);
var PCARRIEROT = this.formEdit.getForm().findField('PCARRIEROT').getValue();
var ttl = Add(pfreight, parseFloatDef(PCARRIEROT, 0));
var POTFREIGHT = this.formEdit.getForm().findField('POTFREIGHT').getValue();
ttl = Add(ttl, parseFloatDef(POTFREIGHT, 0));
if (ttl != 0)
this.formEdit.getForm().findField('PTOTAL').setValue(ttl);
*/
this.SetFee();
}
}
}
}, { xtype: 'hiddenfield', flex: 0.3 }, { xtype: 'label', text: "运费", flex: 0.8, align: 'center' }, {
fieldLabel: '',
flex: 1,
name: 'CFREIGHT',
listeners: {
scope: this,
change: function (field, newValue, oldValue, eOpts) {
if (newValue == null || newValue == '') return;
if (newValue != oldValue) {
/*
var pfreight = parseFloatDef(newValue, 0);
var PCARRIEROT = this.formEdit.getForm().findField('CCARRIEROT').getValue();
var ttl = Add(pfreight, parseFloatDef(PCARRIEROT, 0));
var POTFREIGHT = this.formEdit.getForm().findField('COTFREIGHT').getValue();
ttl = Add(ttl, parseFloatDef(POTFREIGHT, 0));
if (ttl != 0)
this.formEdit.getForm().findField('CTOTAL').setValue(ttl);
*/
this.SetFee();
}
}
}
}]
}
, {
xtype: 'container',
layout: 'hbox',
flex: 1,
defaultType: 'textfield',
items: [{
fieldLabel: '',
flex: 1,
name: 'PVALUEFEE',
listeners: {
scope: this,
change: function (field, newValue, oldValue, eOpts) {
if (newValue == null || newValue == '') return;
if (newValue != oldValue) {
/*
var pfreight = parseFloatDef(newValue, 0);
var PCARRIEROT = this.formEdit.getForm().findField('PCARRIEROT').getValue();
var ttl = Add(pfreight, parseFloatDef(PCARRIEROT, 0));
var POTFREIGHT = this.formEdit.getForm().findField('POTFREIGHT').getValue();
ttl = Add(ttl, parseFloatDef(POTFREIGHT, 0));
if (ttl != 0)
this.formEdit.getForm().findField('PTOTAL').setValue(ttl);
*/
this.SetFee();
}
}
}
}, { xtype: 'hiddenfield', flex: 0.3 }, { xtype: 'label', text: "声明价值附加费", flex: 0.8, align: 'center' }, {
fieldLabel: '',
flex: 1,
name: 'CVALUEFEE',
listeners: {
scope: this,
change: function (field, newValue, oldValue, eOpts) {
if (newValue == null || newValue == '') return;
if (newValue != oldValue) {
/*
var pfreight = parseFloatDef(newValue, 0);
var PCARRIEROT = this.formEdit.getForm().findField('CCARRIEROT').getValue();
var ttl = Add(pfreight, parseFloatDef(PCARRIEROT, 0));
var POTFREIGHT = this.formEdit.getForm().findField('COTFREIGHT').getValue();
ttl = Add(ttl, parseFloatDef(POTFREIGHT, 0));
if (ttl != 0)
this.formEdit.getForm().findField('CTOTAL').setValue(ttl);
*/
this.SetFee();
}
}
}
}]
}
, {
xtype: 'container',
layout: 'hbox',
flex: 1,
defaultType: 'textfield',
items: [{
fieldLabel: '',
flex: 1,
name: 'PCARRIEROT',
listeners: {
scope: this,
change: function (field, newValue, oldValue, eOpts) {
if (newValue == null || newValue == '') return;
if (newValue != oldValue) {
/*
var pfreight = parseFloatDef(newValue, 0);
var PCARRIEROT = this.formEdit.getForm().findField('PCARRIEROT').getValue();
var ttl = Add(pfreight, parseFloatDef(PCARRIEROT, 0));
var POTFREIGHT = this.formEdit.getForm().findField('POTFREIGHT').getValue();
ttl = Add(ttl, parseFloatDef(POTFREIGHT, 0));
if (ttl != 0)
this.formEdit.getForm().findField('PTOTAL').setValue(ttl);
*/
this.SetFee();
}
}
}
}, { xtype: 'hiddenfield', flex: 0.3 }, { xtype: 'label', text: "地面运费", flex: 0.8, align: 'center' }, {
fieldLabel: '',
flex: 1,
name: 'CCARRIEROT',
listeners: {
scope: this,
change: function (field, newValue, oldValue, eOpts) {
if (newValue == null || newValue == '') return;
if (newValue != oldValue) {
/*
var pfreight = parseFloatDef(newValue, 0);
var PCARRIEROT = this.formEdit.getForm().findField('CCARRIEROT').getValue();
var ttl = Add(pfreight, parseFloatDef(PCARRIEROT, 0));
var POTFREIGHT = this.formEdit.getForm().findField('COTFREIGHT').getValue();
ttl = Add(ttl, parseFloatDef(POTFREIGHT, 0));
if (ttl != 0)
this.formEdit.getForm().findField('CTOTAL').setValue(ttl);
*/
this.SetFee();
}
}
}
}]
}
, {
xtype: 'container',
layout: 'hbox',
flex: 1,
defaultType: 'textfield',
items: [{
fieldLabel: '',
flex: 1,
readOnly: true,
name: 'POTFREIGHT',
listeners: {
scope: this,
change: function (field, newValue, oldValue, eOpts) {
if (newValue == null || newValue == '') return;
if (newValue != oldValue) {
/*
var PCARRIEROT = newValue;
var pfreight = this.formEdit.getForm().findField('PFREIGHT').getValue();
var ttl = Add(parseFloatDef(pfreight, 0), parseFloatDef(PCARRIEROT, 0));
var POTFREIGHT = this.formEdit.getForm().findField('POTFREIGHT').getValue();
ttl = Add(ttl, parseFloatDef(POTFREIGHT, 0));
if (ttl != 0)
this.formEdit.getForm().findField('PTOTAL').setValue(ttl);
*/
this.SetFee();
}
}
}
}, { xtype: 'hiddenfield', flex: 0.3 }, { xtype: 'label', text: "杂费", flex: 0.8, align: 'center' }, {
fieldLabel: '',
flex: 1,
name: 'COTFREIGHT',
listeners: {
scope: this,
change: function (field, newValue, oldValue, eOpts) {
if (newValue == null || newValue == '') return;
if (newValue != oldValue) {
/*
var PCARRIEROT = newValue;
var pfreight = this.formEdit.getForm().findField('CFREIGHT').getValue();
var ttl = Add(parseFloatDef(pfreight, 0), parseFloatDef(PCARRIEROT, 0));
var POTFREIGHT = this.formEdit.getForm().findField('COTFREIGHT').getValue();
ttl = Add(ttl, parseFloatDef(POTFREIGHT, 0));
if (ttl != 0)
this.formEdit.getForm().findField('CTOTAL').setValue(ttl);
*/
this.SetFee();
}
}
}
}]
}
, {
xtype: 'container',
layout: 'hbox',
flex: 1,
defaultType: 'textfield',
items: [{
fieldLabel: '',
flex: 1,
name: 'PTOTAL'
}, { xtype: 'hiddenfield', flex: 0.3 }, { xtype: 'label', text: "合计", flex: 0.8, labelAlign: 'center' }, {
fieldLabel: '',
flex: 1,
name: 'CTOTAL'
}]
}
]
}]
});
this.storeEnterpCode = Ext.create('DsExt.ux.RefTableStore', {
fields: [
{ name: 'CUSTOMER', type: 'string' },
{ name: 'ENTERPID', type: 'string' }
],
proxy: { url: '/MvcShipping/MsOpApply/GetENTERPLIST' }
});
this.storeEnterpCode.load();
this.comboxEnterp = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '经营单位',
store: this.storeEnterpCode,
name: 'ENTERP',
valueField: 'CUSTOMER',
displayField: 'CUSTOMER',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
var Cargoinforecords = DsStoreQueryBy(this.storeEnterpCode, 'CUSTOMER', combo.value);
if (Cargoinforecords.getCount() > 0) {
var Cargoinfodata = Cargoinforecords.getAt(0).data;
this.formEdit.getForm().findField('ENTERPID').setValue(Cargoinfodata.ENTERPID);
} else {
this.formEdit.getForm().findField('ENTERPID').setValue('');
}
}
}
}
});
//#region 商品信息
//数据集
this.storeCargo = Ext.create('Ext.data.Store', {
model: 'MsOpAirnCargomb',
remoteSort: false,
pruneModifiedRecords: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsOpAirn/GetCargoList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//#region 枚举类型
this.storeCargoName = Ext.create('DsExt.ux.RefTableStore', {
model: 'CargoNamemb',
proxy: { url: '/Import/CargoName/GetCargoNameList' }
});
//this.storeDetailName.load({ params: { start: 0, limit: 9999, condition: " isnull(codename,'')<>'' "} });
this.comboxCargoName = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeCargoName,
name: 'CARGOGID',
valueField: 'GID',
displayField: 'CODEandNAME',
matchFieldWidth: false
});
//#endregion
//表格
this.CargoColumns = [
{
sortable: true, hidden: true,
dataIndex: 'GID',
header: 'GID',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'BSNO',
header: 'BSNO',
width: 80
}, {
dataIndex: 'SEQUENCE',
header: '序号',
width: 44,
editor: {
xtype: 'numberfield', //numberfield textfield
selectOnFocus: true
}
},
{
sortable: true,
dataIndex: 'CARGOGID',
header: '商品代码',
renderer: function (value, p, record) {
if (value == null || value == '') return '';
else return record.data.CARGO_CODE;
},
editor: this.comboxCargoName,
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'CARGO_CODE',
header: 'CARGO_CODE',
width: 80
},
{
sortable: true,
dataIndex: 'CARGONAME',
header: '商品名称',
width: 80,
editor: {
xtype: 'textfield', //numberfield textfield
selectOnFocus: true
}
},
{
sortable: true,
dataIndex: 'BOXCOUNT',
header: '件数',
width: 80,
renderer: Ext.util.Format.numberRenderer('0000'),
editor: {
xtype: 'numberfield', //numberfield textfield
selectOnFocus: true,
allowDecimals: false,
decimalPrecision: 0
}
},
{
sortable: true,
dataIndex: 'M_WEIGHT',
header: '重量',
width: 80,
renderer: Ext.util.Format.numberRenderer('0000'),
editor: {
xtype: 'numberfield', //numberfield textfield
selectOnFocus: true,
allowDecimals: false,
decimalPrecision: 0
}
},
{
sortable: true, hidden: true,
dataIndex: 'WEIGHT',
header: '分单计费重量',
width: 80,
renderer: Ext.util.Format.numberRenderer('0000'),
editor: {
xtype: 'numberfield', //numberfield textfield
selectOnFocus: true,
allowDecimals: false,
decimalPrecision: 0
}
},
{
sortable: true,
dataIndex: 'WEIGHT_2',
header: '主单计费重量',
width: 80,
renderer: Ext.util.Format.numberRenderer('0000'),
editor: {
xtype: 'numberfield', //numberfield textfield
selectOnFocus: true,
allowDecimals: false,
decimalPrecision: 0
}
},
{
sortable: true,
dataIndex: 'CBM',
header: '体积',
width: 80,
editor: {
xtype: 'numberfield', //numberfield textfield
selectOnFocus: true
}
},
{
sortable: true,
dataIndex: 'CBM_REMARK',
header: '尺寸',
width: 80,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
},
{
sortable: true, hidden: true,
dataIndex: 'PRICETYPE',
header: 'PRICETYPE',
width: 80,
editor: {
xtype: 'textfield', //numberfield textfield
selectOnFocus: true
}
},
{
sortable: true, hidden: true,
dataIndex: 'PRICE',
header: '价格',
width: 80,
editor: {
xtype: 'numberfield', //numberfield textfield
selectOnFocus: true
}
},
{
sortable: true, hidden: true,
dataIndex: 'AMOUNT',
header: '金额',
width: 80,
editor: {
xtype: 'numberfield', //numberfield textfield
selectOnFocus: true
},
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
try {
var lsValue = usMoney(value, 2, '', false);
if (lsValue != "NaN") {
value = lsValue; if (parseFloat(lsValue) < 0) {
return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
}
},
{
sortable: true,
dataIndex: 'PRICE_2',
header: '价格',
width: 80,
editor: {
xtype: 'numberfield', //numberfield textfield
selectOnFocus: true
}
},
{
sortable: true,
dataIndex: 'AMOUNT_2',
header: '航空运费',
width: 80,
editor: {
xtype: 'numberfield', //numberfield textfield
selectOnFocus: true
}
},
{
sortable: true,
dataIndex: 'PACKAGE',
header: '包装',
width: 80,
editor: {
xtype: 'textfield', //numberfield textfield
selectOnFocus: true
}
},
{
sortable: true,
dataIndex: 'TH1',
header: '特货代码1',
width: 80,
editor: {
xtype: 'textfield', //numberfield textfield
selectOnFocus: true
}
},
{
sortable: true,
dataIndex: 'TH2',
header: '特货代码2',
width: 80,
editor: {
xtype: 'textfield', //numberfield textfield
selectOnFocus: true
}
}
];
this.cellEditingCargo = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});
this.cargoCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
var _this = this;
this.formCargo = new Ext.grid.GridPanel({
store: this.storeCargo,
enableHdMenu: false,
layout: 'border',
region: 'center', //bodyStyle: 'background:#FFF',
trackResetOnLoad: true,
//height: 160,
autoScroll: true,
//title: '商品信息',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
plugins: [this.cellEditingCargo],
selModel: this.cargoCheckBoxModel,
selType: 'cellmodel',
tbar: [{
xtype: 'label',
width: 60,
text: '商品信息'
}, {
text: '增加明细', hidden: true,
tooltip: '增加明细',
iconCls: "btnadddetail",
handler: function (button, event) {
this.onAddCargoClick(button, event);
},
scope: this
}, {
text: '删除明细', hidden: true,
tooltip: '删除明细',
iconCls: "btndeletedetail",
handler: function (button, event) {
this.onDelCargoClick(button, event);
},
scope: this
}, {
text: '自动费用',
tooltip: '在单内计算费用',
iconCls: "btnMakeFee", hidden: true,
handler: function (button, event) {
//this.onbtnCWStartClick(button, event);
},
scope: this
}, {
text: '生成应收应付',
tooltip: '生成应收应付',
iconCls: "btnSaveFee", hidden: true,
handler: function (button, event) {
//this.onbtnCWStartClick(button, event);
},
scope: this
}, '-', {
text: "保存列表样式",
id: "btnSaveTable",
handler: function (button, event) {
//this.column = DsTruck.SaveGridPanel(GID, this.formname, this.gridList.columns, this.column, 1, true);
var tempcolumns = this.formCargo.columns;
DsTruck.SaveGridPanel(USERID, this.formname, tempcolumns, this.CargoColumns, 0, true);
},
scope: this
}],
columns: this.CargoColumns
});
/////////////以下部分为获取存储的gridpanel显示样式
this.CargoColumns = DsTruck.GetGridPanel(USERID, this.formname, this.CargoColumns, 1); //使用者id表名中间column数组跳过一开始的几列
this.CargoColumns.unshift(new Ext.grid.RowNumberer());
this.formCargo.reconfigure(this.storeCargo, this.CargoColumns);
////////////////////////////////////////////////
//#endregion
this.formEdit = Ext.widget('form', {
region: 'north',
frame: true,
bodyPadding: 5,
layout: 'anchor',
trackResetOnLoad: true,
fieldDefaults: {
margins: '1 1 1 1',
labelAlign: 'right',
flex: 1,
labelWidth: 70,
msgTarget: 'qtip'
},
items: [{
xtype: 'container',
layout: 'anchor',
flex: 2,
defaultType: 'textfield',
items: [this.panelAIRLINES
,
{
xtype: 'fieldset',
defaultType: 'textfield',
layout: 'hbox',
defaults: {
anchor: '96%'
},
items: [
{
xtype: 'container',
layout: 'anchor',
flex: 2,
defaultType: 'textfield',
items: [
this.comboxShipper, {
xtype: 'textareafield',
grow: true,
labelWidth: 0,
height: 70,
name: 'SHIPPER',
anchor: '100%'
}]
}
, {
xtype: 'container',
layout: 'anchor',
flex: 2,
defaultType: 'textfield',
items: [this.comboxConsignee, {
xtype: 'textareafield',
grow: true,
labelWidth: 0,
height: 70,
name: 'CONSIGNEE',
anchor: '100%'
}]
}]
}
]
}]
});
this.formEdit_2 = Ext.widget('form', {
region: 'south',
frame: true,
bodyPadding: 5,
layout: 'anchor',
trackResetOnLoad: true,
fieldDefaults: {
margins: '1 1 1 1',
labelAlign: 'right',
flex: 1,
labelWidth: 70,
msgTarget: 'qtip'
},
items: [
{
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.5,
defaultType: 'textfield',
items: [
this.panelFEETOTAL
]
}
, {
xtype: 'container',
layout: 'anchor',
flex: 1.5,
defaultType: 'textfield',
items: [
this.panelOTFEE
]
}, {
xtype: 'container',
layout: 'anchor',
flex: 1,
defaultType: 'textfield',
items: [
{
xtype: 'textareafield',
grow: true,
fieldLabel: '备 注',
height: 160,
name: 'REMARK',
anchor: '100%'
}
]
}
]
}
,
{
xtype: 'container',
defaultType: 'textfield',
layout: 'hbox', hidden: true,
items: [
]
}
, {
xtype: 'container',
defaultType: 'textfield',
hidden: true,
layout: 'hbox',
items: [{
xtype: 'container',
layout: 'anchor',
flex: 3,
defaultType: 'textfield',
items: [{
xtype: 'container',
layout: 'hbox',
flex: 1,
defaultType: 'textfield',
items: [{
fieldLabel: '报关单号',
name: 'CUSTOMNO'
}, {
fieldLabel: '报关日期',
format: 'Y-m-d',
flex: 1,
xtype: 'datefield',
name: 'CUSTOMDATE'
}, this.comboxTRADETYPE, {
fieldLabel: '商检单号',
name: 'INSPECTIONNO'
}]
}, {
xtype: 'container',
layout: 'hbox',
flex: 1,
defaultType: 'textfield',
items: [{
fieldLabel: '商检日期',
format: 'Y-m-d',
flex: 1,
xtype: 'datefield',
name: 'INSPECTIONDATE'
}, this.comboxEnterp, {
fieldLabel: '单位编码',
name: 'ENTERPID'
}, this.comboxTRADETERM]
}
]
}]
}]
}
]
});
//#endregion
//#region 按钮Toolbar
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [{
id: 'btnEPrev',
text: "上一票",
// iconCls: "btnsave",
handler: function (button, event) {
this.PrevRecord();
},
scope: this
}, {
id: 'btnENext',
text: "下一票",
// iconCls: "btnsave",
handler: function (button, event) {
this.NextRecord();
},
scope: this
}, {
id: 'btnESave',
text: "保存",
iconCls: "btnsave",
handler: function (button, event) {
this.Save('0', '0');
},
scope: this
}, {
id: 'btnESaveAndClose',
text: "保存并关闭",
handler: function (button, event) {
this.Save('1', '0');
},
scope: this
}, {
id: 'btnESaveAndNew',
text: "保存并新建",
handler: function (button, event) {
this.Save('2', '0');
},
scope: this
}, {
id: 'btnECopyNew',
text: "复制新建",
handler: function (button, event) {
var btnESave = Ext.getCmp('btnESave');
if (btnESave.isDisabled() || this.getIsModify == '') {
var basicForm = this.formHead.getForm();
this.opStatus = 'add';
basicForm.findField('BSNO').setDisabled(false);
var BSNO = 'topAirn' + NewGuid();
var field = basicForm.findField('BSNO');
var oldbsno = field.getValue();
var oldmasterno = basicForm.findField('MASTERNO').getValue();
field.setValue(BSNO);
if (oldbsno == oldmasterno) {
field = basicForm.findField('MASTERNO');
field.setValue(BSNO);
}
basicForm.findField('BSNO').setDisabled(true);
field = basicForm.findField('CUSTNO');
field.setValue('');
field = basicForm.findField('ORDERNO');
field.setValue('');
field = basicForm.findField('INPUTBY');
field.setValue(SHOWNAME);
field = basicForm.findField('OP');
field.setValue(SHOWNAME);
var field = basicForm.findField('BSSTATUSREF');
field.setValue('未锁定');
var field = basicForm.findField('FEESTATUSREF');
field.setValue('未锁定');
var myDate = new Date();
var mydatestr = Ext.util.Format.date(myDate, 'Y-m');
field = basicForm.findField('ACCDATE');
field.setValue(mydatestr);
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 == 'pnlmodNewOpAirnInfo') {
// this.tabSeaepanel.setActiveTab(i);
} else {
children.items[i].close();
}
}
}
}
this.tabSeaepanel.doLayout();
} else {
this.CopyNew();
}
},
scope: this
}, '-', {
text: "关闭",
handler: function (button, event) {
window.close();
},
scope: this
}, {
text: "新建",
handler: function (button, event) {
this.LoadData('add', '');
var basicForm = this.formEdit.getForm();
basicForm.findField('BsNo').setDisabled(false);
},
scope: this
}, '-', {
text: "打印",
tooltip: '点击时先自动保存然后进行打印',
iconCls: "btnprint",
handler: function (button, event) {
this.Save("0", '1');
},
scope: this
}, '-', {
text: "生成应付",
tooltip: '国内分单生成应收,国内主单生成应付',
iconCls: "",
handler: function (button, event) {
this.MakeFee();
},
scope: this
}
]
}); //end 按钮Toolbar
//#endregion
//#region 框架结构
this.panelCargo = new Ext.Panel({
//title: '委托详细信息',
layout: "border",
region: 'center',
animate: true,
//autoScroll: true,
// containerScroll: true,
frame: false,
items: [this.formCargo]
});
this.panelpage = new Ext.Panel({
//title: '委托详细信息',
layout: "border",
region: 'center',
animate: true,
autoScroll: true,
// containerScroll: true,
frame: false,
items: [this.formEdit, this.panelCargo, this.formEdit_2]
});
/*
this.tabSeaeWTpanel = new Ext.TabPanel({
activeTab: 0,
autoWidth: true,
border: true,
frame: false,
region: 'center',
enableTabScroll: true,
items:
[
this.panelpage
]
});*/
this.panelSeae = new Ext.Panel({
title: '委托信息',
id: 'pnlmodNewOpAirnInfo',
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: 'D1941422-4705-491E-87E6-261222930D05'
}
});
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('BSNO').getValue() == "") {
Ext.Msg.show({ title: '注意', msg: '请先保存业务信息后再打开其他模块!', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
} else {
if (record.data.NAME == 'modAirnAllFee') {
var paneltabitems = new Shipping.AirnFee({
id: 'pnl' + record.data.NAME,
layout: "border",
region: "center",
autoScroll: true,
frame: false,
closable: true,
title: record.data.DESCRIPTION
});
} else if (record.data.NAME == 'modAirnAmendFee') {
var paneltabitems = new Shipping.AirnAmendFee({
id: 'pnl' + record.data.NAME,
layout: "border",
region: "center",
autoScroll: true,
frame: false,
closable: true,
title: record.data.DESCRIPTION
});
// } else if (record.data.NAME == 'BILLOFLOADING') {
// var paneltabitems = new Shipping.MsOpBillIndex({
// id: 'pnl' + record.data.NAME,
// layout: "border",
// region: "center",
// autoScroll: true,
// frame: false,
// closable: true,
// title: record.data.DESCRIPTION
// });
} else if (record.data.NAME == 'modOpAirnFenList') {
var paneltabitems = new Shipping.MsOpAirnFenIndex({
id: 'pnl' + record.data.NAME,
layout: "border",
region: "center",
autoScroll: true,
frame: false,
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: ' <iframe scrolling="auto" frameborder="0" width="100%" height="100%" src="' + record.data.MODULEURL + '"> </iframe>'
});
}
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
],
listeners: {
scope: this,
'beforetabchange': function (tabPanel, newCard, oldCard, eOpts) {
if (oldCard.id == "pnlmodAirnAllFee") {
var feemodify = oldCard.panelFee.getModifyStatus();
if (feemodify) {
Ext.Msg.show({ title: '警告', msg: '费用未保存,请先保存费用!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
return false;
}
}
if (oldCard.id == "pnlmodAirnAmendFee") {
var feemodify = oldCard.panelFee.getModifyStatus();
if (feemodify) {
Ext.Msg.show({ title: '警告', msg: '费用未保存,请先保存费用!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
return false;
}
}
}
}
});
Ext.apply(this, {
items: [this.tabtree, this.tabSeaepanel]
});
//#endregion
//#region 运费方案
this.storeDetail = Ext.create('Ext.data.Store', {
model: 'FreightDetailmb',
remoteSort: false,
pruneModifiedRecords: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsOpAirn_Freight/GetBodyList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//#endregion
//#region 待用主单
this.storeRECEIPT = Ext.create('Ext.data.Store', {
model: 'op_airn_RECEIPTmb',
remoteSort: false,
pruneModifiedRecords: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsOpAirn_RECEIPTWMS/GetBodyList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.storeRECEIPTshow = Ext.create('Ext.data.Store', {
model: 'op_airn_RECEIPTmb',
remoteSort: false,
pruneModifiedRecords: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsOpAirn_RECEIPTWMS/GetBodyList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//#endregion
this.LoadInitData();
//#region 其他
// parentWin = window.parent.opener._this;
parentWin = window.parent.opener._thisfenlist;
if (parentWin == NaN || parentWin == null) {
parentWin = window.parent.opener._this;
} else {
this.isfen = true;
}
this.InitData();
this.formCargo.on('edit', function (editor, e, eOpts) {
this.CargoAfterEdit(editor, e, eOpts);
}, this);
this.gridListBs = new Ext.grid.GridPanel({
store: this.storeRECEIPTshow,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
selType: 'cellmodel',
columns: [
{
sortable: true, hidden: true,
dataIndex: 'GID',
header: 'GID',
width: 130
},
{
sortable: true,
dataIndex: 'TOTALNO',
header: '业务编号',
width: 130
}]
});
this.gridListBs.addListener('itemdblclick', function (dataview, record, item, index, e, b) {
var RECEIPT = record.data;
this.formHead.getForm().findField('MBLNO').setValue(RECEIPT.TOTALNO);
this.formHead.getForm().findField('MASTERNO').setValue(RECEIPT.GID);
}, this);
this.panelBs = new Ext.Panel({
title: '可用主单',
layout: "border",
region: 'center',
frame: true,
split: true,
collapsed: false,
collapsible: true,
trackResetOnLoad: true,
tbar: [
{ id: "SNO",
fieldLabel: "查询主单号",
labelWidth: 75,
xtype: 'textfield',
name: 'SNO',
listeners:
{
'change': function (field, e) {
//alert(field.lastValue);
_this.SetRECEIPT(field.lastValue);
}
}
}
],
items: [this.gridListBs]
});
}, //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.HBLNO = ret[3];
this.parenttype = ret[4];
this._Head = ret[5];
this._Edit = ret[6];
/*
if (parenttype == "OP_AIRN_Edit") {
this.formHead.getForm().findField('HBLNO').setValue(ret[3]);
}*/
/*
ret[1] = [];
ret[2] = [];
ret[3] = this.formHead.getForm().findField('HBLNO').getValue();
ret[4] = 'OP_AIRN_Edit';
ret[5] = this.storePLList;*/
if (this.isfen) this.MainEditRecord = ret[3];
}
if (this.opStatus == 'edit' && this.parenttype == "OP_AIRN_Edit") {
var MBLNO = this._Head.findField('MBLNO').getValue();
var HBLNO = this._Head.findField('HBLNO').getValue();
condition = "MBLNO='" + MBLNO + "' and HBLNO='" + HBLNO + "' and BLTYPE='" + BLTYPE + "'";
} else if (this.opStatus == 'edit') {
condition = "B.BSNO='" + this.editRecord.get('BSNO') + "' and BLTYPE='" + BLTYPE + "'";
//this.storeBodyList.load({ params: { condition: condition} });
}
if (this.parenttype == "OP_AIRN_Edit") {
this.StoreList = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
model: 'MsOpAirnModel',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsOpAirn/GetDataList',
reader: {
id: 'BSNO',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.editRecord = Ext.create('MsOpAirnModel');
}
if (this.opStatus == 'copyadd') {
this.CopyNewData();
} else {
this.LoadData(this.opStatus, condition);
}
this.LoadMustBe();
// if (this.initloaddata == 0) {
// this.LoadInitData();
// this.initloaddata = 1;
// };
}, //end InitData
LoadData: function (opstatus, condition) {
this.serialNo = 0;
//this.bodyDel = [];
this.opStatus = opstatus;
let _this = this;
/* if (this.parenttype == "OP_AIRN_Edit" && this.opStatus == 'add') {
this.formEdit.getForm().reset();
this.formEdit.getForm().setValues(this.MainEditRecord.data);
this.formHead.getForm().reset();
this.formHead.getForm().setValues(this.MainEditRecord.data);
var newBsNo = NewGuid();
//this.formHead.getForm().findField('BSNO').setValue(newBsNo);
//this.formHead.getForm().findField('BLTYPE').setValue('空运分票');
this.formHead.getForm().findField('BLTYPE').readOnly = true;
this.formHead.getForm().findField('CUSTNO').setValue('');
this.LoadInit(this.MainEditRecord.data);
} else {*/
Ext.Ajax.request({
waitMsg: '正在查询主表数据...',
url: '/MvcShipping/MsOpAirn/GetData',
params: {
handle: opstatus,
condition: condition,
parenttype: _this.parenttype
},
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;
data.BLTYPE = BLTYPE;
this.formHead.getForm().reset();
this.formHead.getForm().setValues(data);
this.formEdit.getForm().reset();
this.formEdit.getForm().setValues(data);
this.formEdit_2.getForm().reset();
var t = setTimeout(this.formEdit_2.getForm().setValues(data), 3000);
//alert(data.OTFEE1 + ',' + data.OTFEE1AMOUNT + '#' + data.OTFEE3 + ',' + data.OTFEE3AMOUNT);
if (this.opStatus == 'add') {
this.LoadDefValue();
}
if (this.parenttype == "OP_AIRN_Edit" && this.opStatus == 'add') {
this.formHead.getForm().findField('HBLNO').setValue(this._Head.findField('HBLNO').getValue());
this.formEdit.getForm().findField('AIRLINES').setValue(this._Edit.findField('AIRLINES').getValue());
this.formEdit.getForm().findField('PORTLOADID').setValue(this._Edit.findField('PORTLOADID').getValue());
this.formEdit.getForm().findField('PORTDISCHARGEID').setValue(this._Edit.findField('PORTDISCHARGEID').getValue());
this.formEdit.getForm().findField('VESSEL').setValue(this._Edit.findField('VESSEL').getValue());
this.formEdit.getForm().findField('ETD').setValue(this._Edit.findField('ETD').getValue());
this.formEdit.getForm().findField('SHIPPERID').setValue(this._Edit.findField('SHIPPERID').getValue());
this.formEdit.getForm().findField('SHIPPER').setValue(this._Edit.findField('SHIPPER').getValue());
this.formEdit.getForm().findField('CONSIGNEEID').setValue(this._Edit.findField('CONSIGNEEID').getValue());
this.formEdit.getForm().findField('CONSIGNEE').setValue(this._Edit.findField('CONSIGNEE').getValue());
data.HBLNO = this._Head.findField('HBLNO').getValue();
data.AIRLINES = this._Edit.findField('AIRLINES').getValue()
data.PORTLOADID = this._Edit.findField('AIRLINES').getValue()
data.PORTDISCHARGEID = this._Edit.findField('PORTDISCHARGEID').getValue();
data.VESSEL = this._Edit.findField('VESSEL').getValue();
data.ETD = this._Edit.findField('ETD').getValue();
data.SHIPPERID = this._Edit.findField('SHIPPERID').getValue();
data.SHIPPER = this._Edit.findField('SHIPPER').getValue();
data.CONSIGNEEID = this._Edit.findField('CONSIGNEEID').getValue();
data.CONSIGNEE = this._Edit.findField('CONSIGNEE').getValue();
this.SetOTFee();
}
this.LoadInit(data);
this.Editdata = data;
this.BSNO = data.BSNO;
this.GetEditStatus();
this.onLoadCargo();
this.storeCargo.load({
params: { condition: " C.BSNO in (select BSNO from OP_AIRN where HBLNO='" + data.HBLNO + "' and HBLNO<>'')" }
,
callback: function (r, options, success) {
if (success) {
this.SetFuelFee();
}
}
});
this.LoadFreight();
document.title = "国内主单:" + data.MBLNO;
if (this.parenttype == "OP_AIRN_Edit") {
var arrNewRecords = this.StoreList.insert(0, this.Editdata);
this.editRecord.data = this.Editdata;
}
//如果已经作废 则禁止保存
if (data.ISVOID == "1") {
this.setSaveBtnStatus(false);
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
//}
var billno = '*';
var gid = '*';
}, // end LoadDate
//#endregion
LoadFreight: function () {
var AIRLINES = this.formEdit.getForm().findField('AIRLINES').getValue();
var ETD = this.formEdit.getForm().findField('ETD').getRawValue();
var BLTYPE = "国内主单";
if (AIRLINES != "" && ETD != "" && AIRLINES != null && ETD != null) {
this.storeDetail.load({ params: { start: 0, limit: 999, condition: " PLAN_GID in(select gid from OpAirn_FreightPlan where CUSTOMERNAME='" + AIRLINES + "' and inuse=1 and STARTDATE<='" + ETD + "' and ENDDATE>='" + ETD + "' and BLTYPE='" + BLTYPE + "') "} });
}
},
LoadInitData: function () {
this.storeCustCode.load({ params: { condition: "ISCONTROLLER='1'"} });
this.storeOpCode.load();
this.storeAIRLINES.load({ params: { condition: "ISAIRLINES='1'" }
,
callback: function (r, options, success) {
if (success) {
_this.storeAIRLINES1.removeAll();
_this.storeAIRLINES1.add(r);
_this.storeAIRLINES2.removeAll();
_this.storeAIRLINES2.add(r);
_this.storeAIRLINES3.removeAll();
_this.storeAIRLINES3.add(r);
}
},
scope: this
});
this.storeFORWARDER.load({ params: { condition: "ISBOOKING='1'"} });
this.storeCUSTOMSER.load({ params: { condition: "ISCUSTOM='1'"} });
this.storeTRUCKER.load({ params: { condition: "ISTRUCK='1'"} });
this.storeCodeDisport.load();
this.storeCodeDisport2.load();
},
//#region 保存
Save: function (type, print) {
var _this = this;
var basicForm = this.formEdit.getForm();
var basicForm2 = this.formHead.getForm();
if (!basicForm.isValid()) {
return;
}
if (!basicForm2.isValid()) {
return;
}
//计算费用
this.SetFee();
this.formHead.getForm().findField('BSNO').setDisabled(false);
var data = this.formHead.getForm().getValues(false, false, false);
var data2 = this.formEdit.getForm().getValues(false, false, false);
var data3 = this.formEdit_2.getForm().getValues(false, false, false);
data2.SUPERVISE = this.formEdit.getForm().findField('SUPERVISE').getValue() ? 1 : 0;
data2.TRANSFER = this.formHead.getForm().findField('TRANSFER').getValue() ? 1 : 0;
this.formHead.getForm().findField('BSNO').setDisabled(true);
var Cargodatas = [];
for (var i = 0; i < this.storeCargo.getCount(); i += 1) {
var member = this.storeCargo.getAt(i);
Cargodatas.push(member);
}
//商品明细
var CargoBody = ConvertRecordsToJson(Cargodatas);
var CargoDelBody = ConvertRecordsToJsonAll(this.CargoDel);
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/MvcShipping/MsOpAirn/Save',
scope: this,
params: {
opstatus: this.opStatus,
data: Ext.JSON.encode(data),
data2: Ext.JSON.encode(data2),
data3: Ext.JSON.encode(data3),
CargoBody: CargoBody,
CargoDelBody: CargoDelBody
},
callback: function (options, success, response) {
if (success) {
if (print == '1') { _this.Print(); }
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.Editdata = returnData;
//
if (this.opStatus == 'add') {
this.BSNO = returnData.BSNO;
//this.HBLNO = returnData.BSNO;
//if (this.parenttype != "OP_AIRN_Edit") {
var arrNewRecords = this.StoreList.insert(0, returnData);
this.editRecord = this.StoreList[0];
//} else {
// this.editRecord.data = returnData;
//}
if (type == '0') {
this.opStatus = 'edit';
basicForm2.findField('BSNO').setDisabled(true);
this.onLoadCargo();
//this.storeCargo.load({ params: { condition: " C.BSNO='" + returnData.BSNO + "'"} });
} else if (type == '1') {
window.close();
} else if (type == '2') {
this.LoadData('add', '');
}
if (type == '0') {
this.opStatus = 'edit';
basicForm2.findField('BSNO').setDisabled(true);
} else if (type == '1') {
window.close();
} else if (type == '2') {
this.LoadData('add', '');
}
}
else if (this.opStatus == 'edit') {
var editp = Ext.create('MsOpAirnModel', returnData);
if (this.parenttype != "OP_AIRN_Edit") {
this.editRecord.fields.each(function (field) {
if (field.persist) {
name = field.name;
if (name != 'id')
this.editRecord.set(name, editp.get(name));
}
}, this);
} else {
var arrNewRecords = this.StoreList.insert(0, returnData);
this.editRecord = this.StoreList[0];
}
if (this.parenttype != "OP_AIRN_Edit") {
this.editRecord.commit();
}
if (type == '0') {
this.opStatus = 'edit';
basicForm2.findField('BSNO').setDisabled(true);
this.onLoadCargo();
//this.storeCargo.load({ params: { condition: " C.BSNO in (select BSNO from OP_AIRN where HBLNO='" + editp.get('HBLNO') + "')"} });
} 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
});
}
}
});
}, //end save
//#endregion
//#region 复制新建
CopyNewData: function () {
var data = this.editRecord.data;
var basicForm = this.formHead.getForm();
this.formHead.getForm().reset();
this.formHead.getForm().setValues(data);
this.formEdit.getForm().reset();
this.formEdit.getForm().setValues(data);
this.opStatus = 'add';
basicForm.findField('BSNO').setDisabled(false);
var BSNO = 'topAirn' + NewGuid();
var field = basicForm.findField('BSNO');
var oldbsno = field.getValue();
var oldmasterno = basicForm.findField('MASTERNO').getValue();
field.setValue(BSNO);
if (oldbsno == oldmasterno) {
field = basicForm.findField('MASTERNO');
field.setValue(BSNO);
}
basicForm.findField('BSNO').setDisabled(true);
field = basicForm.findField('CUSTNO');
field.setValue('');
field = basicForm.findField('INPUTBY');
field.setValue(SHOWNAME);
field = basicForm.findField('OP');
field.setValue(SHOWNAME);
var field = basicForm.findField('BSSTATUSREF');
field.setValue('未锁定');
var field = basicForm.findField('FEESTATUSREF');
field.setValue('未锁定');
field = basicForm.findField('MBLNO');
field.setValue('');
field = basicForm.findField('HBLNO');
field.setValue('');
var myDate = new Date();
var mydatestr = Ext.util.Format.date(myDate, 'Y-m');
field = basicForm.findField('ACCDATE');
field.setValue(mydatestr);
},
CopyNew: function () {
/*
var basicForm = this.formEdit.getForm();
var basicForm2 = this.formHead.getForm();
if (!basicForm.isValid()) {
return;
}
if (!basicForm2.isValid()) {
return;
}
this.formHead.getForm().findField('BSNO').setDisabled(false);
var data = this.formHead.getForm().getValues(false, false, false);
var data2 = this.formEdit.getForm().getValues(false, false, false);
this.formHead.getForm().findField('BSNO').setDisabled(true);
*/
var basicForm = this.formHead.getForm();
this.opStatus = 'add';
basicForm.findField('BSNO').setDisabled(false);
var BSNO = 'topAirn' + NewGuid();
var field = basicForm.findField('BSNO');
var oldbsno = field.getValue();
var oldmasterno = basicForm.findField('MASTERNO').getValue();
field.setValue(BSNO);
if (oldbsno == oldmasterno) {
field = basicForm.findField('MASTERNO');
field.setValue(BSNO);
}
basicForm.findField('BSNO').setDisabled(true);
field = basicForm.findField('CUSTNO');
field.setValue('');
field = basicForm.findField('INPUTBY');
field.setValue(SHOWNAME);
field = basicForm.findField('OP');
field.setValue(SHOWNAME);
var field = basicForm.findField('BSSTATUSREF');
field.setValue('未锁定');
var field = basicForm.findField('FEESTATUSREF');
field.setValue('未锁定');
field = basicForm.findField('MBLNO');
field.setValue('');
field = basicForm.findField('HBLNO');
field.setValue('');
var myDate = new Date();
var mydatestr = Ext.util.Format.date(myDate, 'Y-m');
field = basicForm.findField('ACCDATE');
field.setValue(mydatestr);
this.storeCargo.removeAll();
this.formEdit_2.getForm().reset();
}, //end save
//#endregion
CargoAfterEdit: function (editor, e, eOpts) {
if (e.field == 'CARGOGID') {
var Cargorecords = DsStoreQueryBy(this.storeCargoName, 'GID', e.value);
if (Cargorecords.getCount() > 0) {
var Cargodata = Cargorecords.getAt(0).data;
e.record.set('CARGO_CODE', Cargodata.CODENAME);
//e.record.set('CARGO_CODE', Cargodata.CODENAME);
} else {
e.record.set('CARGO_CODE', '');
}
}
if (e.field == 'M_WEIGHT' || e.field == 'CBM') {
var WEIGHT_2 = parseFloat(e.record.get('M_WEIGHT'));
var CBM_WEIGHT = parseFloat(Mul(e.record.get('CBM'), "167"));
if (WEIGHT_2 > CBM_WEIGHT) {
e.record.set('WEIGHT', WEIGHT_2);
e.record.set('WEIGHT_2', WEIGHT_2);
} else {
e.record.set('WEIGHT', CBM_WEIGHT);
e.record.set('WEIGHT_2', CBM_WEIGHT);
}
}
var WEIGHT_2 = parseFloat(e.record.get('WEIGHT_2'));
//this.SetDMFAmount(WEIGHT_2);
if (WEIGHT_2 > 0 && (e.field == 'WEIGHT_2' || e.field == 'CBM' || e.field == 'M_WEIGHT')) {
var AIRLINES = this.formEdit.getForm().findField('AIRLINES').getValue();
var ETD = this.formEdit.getForm().findField('ETD').getRawValue();
var CARGOGID = e.record.get('CARGOGID');
var PORTDISCHARGEID = this.formEdit.getForm().findField('PORTDISCHARGEID').getValue();
var VESSEL = this.formEdit.getForm().findField('VESSEL').getValue();
var PLANDETAIL = "";
var PRICE_2 = 0;
var AMOUNT_2 = 0;
//如果没有合适的运价方案,提示
if (this.storeDetail.count == 0 && (AIRLINES != null && AIRLINES != "" && ETD != null && ETD != "")) {
alert("目前没有符合条件的运价方案");
}
//如果有
else {
//遍历看是不是有CARGOGID相同 目的地相同 航班号相同
for (var i = 0; i < this.storeDetail.getCount(); i += 1) {
var member = this.storeDetail.getAt(i);
if (member.data.CARGOGID == CARGOGID && member.data.PORTDISCHARGEID == PORTDISCHARGEID && member.data.VESSEL == VESSEL) {
PLANDETAIL = member.data;
continue;
}
}
//如有 按其计算费用
//如无 是不是有CARGOGID相同 目的地相同 无航班号
if (PLANDETAIL == "") {
for (var i = 0; i < this.storeDetail.getCount(); i += 1) {
var member = this.storeDetail.getAt(i);
if (member.data.CARGOGID == CARGOGID && member.data.PORTDISCHARGEID == PORTDISCHARGEID && (member.data.VESSEL == "" || member.data.VESSEL == "ALL" || member.data.VESSEL == "All")) {
PLANDETAIL = member.data;
continue;
}
}
}
//如有 按其计算
//如无 看是不是有cargogid相同的 无目的地无航班号的
if (PLANDETAIL == "") {
for (var i = 0; i < this.storeDetail.getCount(); i += 1) {
var member = this.storeDetail.getAt(i);
if (member.data.CARGOGID == CARGOGID && member.data.PORTDISCHARGEID == "" && (member.data.VESSEL == "" || member.data.VESSEL == "ALL" || member.data.VESSEL == "All")) {
PLANDETAIL = member.data;
continue;
}
}
}
//如有 按其计算
if (PLANDETAIL == "") {
alert("当前运价方案中没有合适的运价内容");
} else {
//设置储运注意事项和结算注意事项
if (WEIGHT_2 < parseFloat(PLANDETAIL.MINWEIGHT)) {
WEIGHT_2 = PLANDETAIL.MINWEIGHT;
}
var wm_n = parseFloat(PLANDETAIL.wm_n);
var wm_45 = parseFloat(PLANDETAIL.wm_45); //wm_45代表 按照45kg报送 总价格低于下一档的最大重量值 下同
var wm_100 = parseFloat(PLANDETAIL.wm_100);
var wm_300 = parseFloat(PLANDETAIL.wm_300);
var wm_500 = parseFloat(PLANDETAIL.wm_500);
if (WEIGHT_2 < 45) {
PRICE_2 = PLANDETAIL.W_N;
} else if (WEIGHT_2 >= 45 && WEIGHT_2 < 100) {
PRICE_2 = PLANDETAIL.W_45;
} else if (WEIGHT_2 >= 100 && WEIGHT_2 < 300) {
PRICE_2 = PLANDETAIL.W_100;
} else if (WEIGHT_2 >= 300 && WEIGHT_2 < 500) {
PRICE_2 = PLANDETAIL.W_300;
} else if (WEIGHT_2 >= 500 && WEIGHT_2 < 1000) {
PRICE_2 = PLANDETAIL.W_500;
}
if (WEIGHT_2 < wm_n) {
//PRICE_2 = PLANDETAIL.W_N;
} else if (WEIGHT_2 >= wm_n && WEIGHT_2 < 45) {
alert("重量较大改为45kg报送会比较合适。");
//PRICE_2 = PLANDETAIL.W_45;
//if (WEIGHT_2 < 45) {
// WEIGHT_2 = 45;
//}
} else if (WEIGHT_2 >= wm_45 && WEIGHT_2 < 100) {
alert("重量较大改为100kg报送会比较合适。");
//PRICE_2 = PLANDETAIL.W_100;
//if (WEIGHT_2 < 100) {
// WEIGHT_2 = 100;
//}
} else if (WEIGHT_2 >= wm_100 && WEIGHT_2 < 300) {
alert("重量较大改为300kg报送会比较合适。");
//PRICE_2 = PLANDETAIL.W_300;
//if (WEIGHT_2 < 300) {
// WEIGHT_2 = 300;
//}
} else if (WEIGHT_2 >= wm_300 && WEIGHT_2 < 500) {
alert("重量较大改为500kg报送会比较合适。");
//PRICE_2 = PLANDETAIL.W_500;
//if (WEIGHT_2 < 500) {
// WEIGHT_2 = 500;
//}
} else if (WEIGHT_2 >= wm_500 && WEIGHT_2 < 1000) {
alert("重量较大改为1000kg报送会比较合适。");
//PRICE_2 = PLANDETAIL.W_1000;
//if (WEIGHT_2 < 1000) {
// WEIGHT_2 = 1000;
//}
}
AMOUNT_2 = Mul(PRICE_2, WEIGHT_2);
if (parseFloat(AMOUNT_2) > parseFloat(PLANDETAIL.MINFEE)) {
//e.record.set('AMOUNT', AMOUNT);
} else {
AMOUNT_2 = PLANDETAIL.MINFEE;
}
e.record.set('AMOUNT_2', Math.round(AMOUNT_2));
e.record.set('PRICE_2', PRICE_2);
e.record.set('WEIGHT_2', WEIGHT_2);
this.SetFuelFee();
this.SetFee();
//this.SetDMFAmount(WEIGHT_2);
//Ext.getCmp("STREMARK").setValue(PLANDETAIL.REMARK_3);
//Ext.getCmp("TRANSREMARK").setValue(PLANDETAIL.REMARK_2);
}
//如无 告警说没有合适的费用信息。
}
}
if (e.field == 'PRICE_2' && WEIGHT_2 > 0) {
var PRICE_2 = e.record.get('PRICE_2');
var AMOUNT_2 = Mul(PRICE_2, WEIGHT_2);
e.record.set('AMOUNT_2', Math.round(AMOUNT_2));
this.SetFee();
}
if (e.field == 'AMOUNT_2') {
this.SetFee();
}
}
,
otfeechange: function (field, newValue, oldValue, eOpts) {
if (newValue == oldValue) return;
var s = '';
var ttl = 0.0;
var otfee1amount = parseFloatDef(this.formEdit_2.getForm().findField('OTFEE1AMOUNT').getValue(), 0);
var otfee1 = this.formEdit_2.getForm().findField('OTFEE1').getValue();
if (otfee1 != '' && otfee1amount >= 0) {
s = s + otfee1 + ':' + otfee1amount + ';';
ttl = Add(ttl, otfee1amount);
}
otfee1amount = parseFloatDef(this.formEdit_2.getForm().findField('OTFEE2AMOUNT').getValue(), 0);
otfee1 = this.formEdit_2.getForm().findField('OTFEE2').getValue();
if (otfee1 != '' && otfee1amount >= 0) {
s = s + otfee1 + ':' + otfee1amount + ';';
ttl = Add(ttl, otfee1amount);
}
otfee1amount = parseFloatDef(this.formEdit_2.getForm().findField('OTFEE3AMOUNT').getValue(), 0);
otfee1 = this.formEdit_2.getForm().findField('OTFEE3').getValue();
if (otfee1 != '' && otfee1amount >= 0) {
s = s + otfee1 + ':' + otfee1amount + ';';
ttl = Add(ttl, otfee1amount);
}
otfee1amount = parseFloatDef(this.formEdit_2.getForm().findField('OTFEE4AMOUNT').getValue(), 0);
otfee1 = this.formEdit_2.getForm().findField('OTFEE4').getValue();
if (otfee1 != '' && otfee1amount >= 0) {
s = s + otfee1 + ':' + otfee1amount + ';';
ttl = Add(ttl, otfee1amount);
}
otfee1amount = parseFloatDef(this.formEdit_2.getForm().findField('OTFEE5AMOUNT').getValue(), 0);
otfee1 = this.formEdit_2.getForm().findField('OTFEE5').getValue();
if (otfee1 != '' && otfee1amount >= 0) {
s = s + otfee1 + ':' + otfee1amount + ';';
ttl = Add(ttl, otfee1amount);
}
otfee1amount = parseFloatDef(this.formEdit_2.getForm().findField('OTFEE6AMOUNT').getValue(), 0);
otfee1 = this.formEdit_2.getForm().findField('OTFEE6').getValue();
if (otfee1 != '' && otfee1amount >= 0) {
s = s + otfee1 + ':' + otfee1amount + ';';
ttl = Add(ttl, otfee1amount);
}
otfee1amount = parseFloatDef(this.formEdit_2.getForm().findField('OTFEE7AMOUNT').getValue(), 0);
otfee1 = this.formEdit_2.getForm().findField('OTFEE7').getValue();
if (otfee1 != '' && otfee1amount >= 0) {
s = s + otfee1 + ':' + otfee1amount + ';';
ttl = Add(ttl, otfee1amount);
}
otfee1amount = parseFloatDef(this.formEdit_2.getForm().findField('OTFEE8AMOUNT').getValue(), 0);
otfee1 = this.formEdit_2.getForm().findField('OTFEE8').getValue();
if (otfee1 != '' && otfee1amount >= 0) {
s = s + otfee1 + ':' + otfee1amount + ';';
ttl = Add(ttl, otfee1amount);
}
var BLFRT = this.formEdit_2.getForm().findField('BLFRT').getValue();
if (BLFRT == 'PP') {
if (ttl >= 0)
this.formEdit_2.getForm().findField('POTFREIGHT').setValue(ttl);
} else if (BLFRT == 'CC') {
if (ttl >= 0)
this.formEdit_2.getForm().findField('COTFREIGHT').setValue(ttl);
}
//this.formEdit_2.getForm().findField('OTFEE').setValue(s);
this.SetFee();
},
//计算燃油费
SetFuelFee: function () {
var weight = 0;
for (var i = 0; i < this.storeCargo.getCount(); i += 1) {
var member = this.storeCargo.getAt(i);
weight = Add(weight, member.data.WEIGHT_2);
}
var AIRLINES = this.formEdit.getForm().findField('AIRLINES').getValue();
var fee1Amount = 0;
if (AIRLINES == "山东航空") {
//data3.OTFEE1 = "燃油费";
//向上取整
//data3.OTFEE1AMOUNT=Math.ceil(Mul(_TWEIGHT,0.2));
//改为四舍五入
fee1Amount = Mul(weight, 0.2, 0);
if (parseFloat(fee1Amount) < 10) {
fee1Amount = 10;
}
//data3.OTFEE3 = "保险费";
// data3.OTFEE3AMOUNT = 7;
} else if (AIRLINES == "青岛航空") {
// data3.OTFEE1 = "燃油费";
fee1Amount = Mul(weight, 0.2, 0);
if (parseFloat(fee1Amount) < 10) {
fee1Amount = 10;
}
//data3.PFREIGHT=Add(data3.PFREIGHT,data3.OTFEE1AMOUNT);
} else if (AIRLINES == "南方航空") {
//data3.OTFEE1 = "燃油费";
//向上取整
fee1Amount = Math.ceil(Mul(weight, 0.2));
//改为四舍五入
//data3.OTFEE1AMOUNT=Mul(_TWEIGHT,0.2);
//data3.PFREIGHT=Add(data3.PFREIGHT,data3.OTFEE1AMOUNT);
} else if (AIRLINES == "春秋航空") {
//data3.OTFEE1 = "燃油费";
fee1Amount = Mul(weight, 0.2);
if (fee1Amount < 1) fee1Amount = 1;
fee1Amount = fee1Amount.toFixed(0);
//data3.OTFEE3 = "制单成本费";
//data3.OTFEE3AMOUNT = "1";
//data3.PFREIGHT=Add(Add(data3.PFREIGHT,data3.OTFEE1AMOUNT),OTFEE2AMOUNT);
} else if (AIRLINES == "吉祥航空") {
//data3.OTFEE1 = "燃油费";
if (parseFloat(Mul(weight, 0.2)) < 1) {
fee1Amount = 1
} else {
fee1Amount = Math.round(Mul(weight, 0.2));
}
} else if (AIRLINES == "深圳航空") {
//data3.OTFEE1 = "燃油费";
if (parseFloat(Mul(weight, 0.2)) < 1) {
fee1Amount = 1
} else {
fee1Amount = Math.round(Mul(weight, 0.2));
}
} else if (AIRLINES == "厦门航空") {
//data3.OTFEE1 = "燃油费";
fee1Amount = Mul(weight, 0.2);
if (fee1Amount < 1) fee1Amount = 1;
fee1Amount = fee1Amount.toFixed(0);
} else {
//data3.OTFEE1 = "燃油费";
fee1Amount = Mul(weight, 0.2, 0);
//data3.PFREIGHT=Add(data3.PFREIGHT,data3.OTFEE1AMOUNT);
}
var otfee1 = this.formEdit_2.getForm().findField('OTFEE1').getValue();
if (otfee1 == '燃油费') {
this.formEdit_2.getForm().findField('OTFEE1AMOUNT').setValue(fee1Amount);
}
},
SetFee: function () {
var YF = 0;
for (var i = 0; i < this.storeCargo.getCount(); i += 1) {
var member = this.storeCargo.getAt(i);
YF = Add(YF, member.data.AMOUNT_2);
}
var BLFRT = this.formEdit_2.getForm().findField('BLFRT').getValue();
if (BLFRT == 'PP') {
if (YF != 0)
this.formEdit_2.getForm().findField('PFREIGHT').setValue(YF);
} else if (BLFRT == 'CC') {
if (YF != 0)
this.formEdit_2.getForm().findField('CFREIGHT').setValue(YF);
}
var PTOTAL = 0;
var CTOTAL = 0;
var CFREIGHT = this.formEdit_2.getForm().findField('CFREIGHT').getValue();
var CVALUEFEE = this.formEdit_2.getForm().findField('CVALUEFEE').getValue();
var CCARRIEROT = this.formEdit_2.getForm().findField('CCARRIEROT').getValue();
var COTFREIGHT = this.formEdit_2.getForm().findField('COTFREIGHT').getValue();
//var CTOTAL = this.formEdit_2.getForm().findField('CTOTAL').getValue();
var PFREIGHT = this.formEdit_2.getForm().findField('PFREIGHT').getValue();
var PVALUEFEE = this.formEdit_2.getForm().findField('PVALUEFEE').getValue();
var PCARRIEROT = this.formEdit_2.getForm().findField('PCARRIEROT').getValue();
var POTFREIGHT = this.formEdit_2.getForm().findField('POTFREIGHT').getValue();
//var PTOTAL = this.formEdit_2.getForm().findField('PTOTAL').getValue();
PTOTAL = Add(Add(PFREIGHT, PVALUEFEE), Add(PCARRIEROT, POTFREIGHT));
CTOTAL = Add(Add(CFREIGHT, CVALUEFEE), Add(CCARRIEROT, COTFREIGHT));
this.formEdit_2.getForm().findField('PTOTAL').setValue(PTOTAL);
this.formEdit_2.getForm().findField('CTOTAL').setValue(CTOTAL);
},
SetOTFee: function () {
var AIRLINES = this.formEdit.getForm().findField('AIRLINES').getValue();
//山航主单其他费用:燃油费+保险费7元
//春秋主单其他费用:燃油费 + 制单成本费1元
if (AIRLINES == "山东航空") {
var OTFEE3 = "保险费";
var OTFEE3AMOUNT = 7;
this.formEdit.getForm().findField('OTFEE3').setValue(OTFEE3);
this.formEdit.getForm().findField('OTFEE3AMOUNT').setValue(OTFEE3AMOUNT);
}
if (AIRLINES == "山东航空") {
var OTFEE3 = "制单成本费";
var OTFEE3AMOUNT = 1;
this.formEdit.getForm().findField('OTFEE3').setValue(OTFEE3);
this.formEdit.getForm().findField('OTFEE3AMOUNT').setValue(OTFEE3AMOUNT);
}
},
SetOTFEEByName: function (FEENAME,AMOUNT) {
var basicForm = this.formEdit_2.getForm();
for (var i = 1; i < 9; i++) {
var otffield = 'OTFEE' + i;
//var feename = basicForm.findField(otffield);
if (basicForm.findField(otffield).getValue() == FEENAME) {
basicForm.findField(otffield + 'AMOUNT').setValue(AMOUNT);
}
}
},
//内贸空运-主单-委托信息-费用明细-订制增加自动生成DMF-地面费功能,
//地面费计算公式为计费重量*0.35结果小于10 按10生成大于10按实际生成开发工作量为2工作日开发计2000元/ 工作日 / 人项目单人开发费用为2000元 * 2=4000元
SetDMFAmount(_TWEIGHT) {
let Amount = 0.0;
Amount = Math.round(Mul(_TWEIGHT, 0.35));
if (Amount < 10) Amount = 10;
this.SetOTFEEByName("地面费", Amount);
},
MakeFee: function (button, event) {
//var _CustomerName = this.formHead.getForm().findField('CUSTOMERNAME').getValue();
var _CustomerName = this.formEdit.getForm().findField('AIRLINES').getValue();
var BSNO = this.formHead.getForm().findField('BSNO').getValue();
var _this = this;
//判断是否存在已有的费用
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/Import/ImportSync/CheckHasFeeWithBSNO',
scope: this,
params: {
BSNO: BSNO
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
var alreayHave = result.Success;
Ext.MessageBox.hide();
if (alreayHave) {
Ext.MessageBox.confirm('提示', '已存在相关费用,确定要重复生成吗?', function (btn) {
if (btn != 'yes') {
return;
} else {
_this.setChFee(_CustomerName, BSNO);
}
})
} else {
_this.setChFee(_CustomerName, BSNO);
}
}
}
});
},
setChFee: function (_CustomerName, BSNO) {
var CFREIGHT = this.formEdit_2.getForm().findField('CFREIGHT').getValue();
if (parseFloat(CFREIGHT) > 0) {
this.addChFee(2, _CustomerName, BSNO, "RMB", "1", "空运费", CFREIGHT, 1, "到付空运费", "", "");
}
var CVALUEFEE = this.formEdit_2.getForm().findField('CVALUEFEE').getValue();
if (parseFloat(CVALUEFEE) > 0) {
this.addChFee(2, _CustomerName, BSNO, "RMB", "1", "声明价值附加费", CVALUEFEE, 1, "到付声明价值附加费", "", "");
}
var CCARRIEROT = this.formEdit_2.getForm().findField('CCARRIEROT').getValue();
if (parseFloat(CCARRIEROT) > 0) {
this.addChFee(2, _CustomerName, BSNO, "RMB", "1", "地面运费", CCARRIEROT, 1, "到付地面运费", "", "");
}
var COTFREIGHT = this.formEdit_2.getForm().findField('COTFREIGHT').getValue();
if (parseFloat(COTFREIGHT) > 0) {
this.addChFee(2, _CustomerName, BSNO, "RMB", "1", "杂费", COTFREIGHT, 1, "到付杂费", "", "");
}
///////////
var PFREIGHT = this.formEdit_2.getForm().findField('PFREIGHT').getValue();
if (parseFloat(PFREIGHT) > 0) {
this.addChFee(2, _CustomerName, BSNO, "RMB", "1", "空运费", PFREIGHT, 1, "预付空运费", "", "");
}
var PVALUEFEE = this.formEdit_2.getForm().findField('PVALUEFEE').getValue();
if (parseFloat(PVALUEFEE) > 0) {
this.addChFee(2, _CustomerName, BSNO, "RMB", "1", "声明价值附加费", PVALUEFEE, 1, "预付声明价值附加费", "", "");
}
var PCARRIEROT = this.formEdit_2.getForm().findField('PCARRIEROT').getValue();
if (parseFloat(PCARRIEROT) > 0) {
this.addChFee(2, _CustomerName, BSNO, "RMB", "1", "地面运费", PCARRIEROT, 1, "预付地面运费", "", "");
}
// var POTFREIGHT = this.formEdit_2.getForm().findField('POTFREIGHT').getValue();
// if (parseFloat(POTFREIGHT) > 0) {
// this.addChFee(2, _CustomerName, BSNO, "RMB", "1", "杂费", POTFREIGHT, 1, "预付杂费", "", "");
// }
for (var i = 1; i < 9; i += 1) {
var feename = this.GetOtFeeName(i);
var amount = this.GetOtFeeAmount(i);
if (feename != "" && amount != 0) {
this.addChFee(2, _CustomerName, BSNO, "RMB", "1", feename, amount, 1, "预付杂费", "", "");
}
}
},
GetOtFeeName(order) {
feename = this.formEdit_2.getForm().findField('OTFEE' + order).getValue();
return feename;
},
GetOtFeeAmount(order) {
feeamount = parseFloatDef(this.formEdit_2.getForm().findField('OTFEE' + order + 'AMOUNT').getValue(), 0);
return feeamount
},
addChFee: function (FeeType, _CustomerName, BSNO, Currency, Exchangerate, FeeName, price, Quantity, Remark, FeeDescription, feedate) {
var _Amount = 0;
function GetDateStr(AddDayCount) {
var dd = new Date();
dd.setDate(dd.getDate() + AddDayCount); //获取AddDayCount天后的日期
var y = dd.getFullYear();
var m = dd.getMonth() + 1; //获取当前月份的日期
var d = dd.getDate();
return y + "-" + m + "-" + d;
}
var EnterDate = GetDateStr(0);
if (feedate == "" || typeof (feedate) == "undefined") {
EnterDate = GetDateStr(0);
} else {
EnterDate = feedate;
}
//var ContractNo = Ext.getCmp("ContractNo").getValue();
var field = " (GId,BsNo,FeeStatus,FeeType,FeeName,FeeDescription,CustomerType,CustomerName,Unit,UnitPrice,NOTAXAMOUNT,TAXUNITPRICE,Quantity "
field = field + " ,Amount,Currency,ExChangerate,Reason,Remark,Commissionrate,Settlement,Invoice,OrderAmount,OrderInvoice "
field = field + " ,Auditoperator,EnterOperator,EnterDate,DebitNo,IsDebit,IsOpen,IsAdvancedpay,IsInvoice,FeeFrt,IsCrmOrderFee,AuditStatus,SALESNO) "
var _value = " values ('" + NewGuid() + "','" + BSNO + "',1," + FeeType + ",'" + FeeName + "','','','" + _CustomerName + "',''," + price + "," + price + "," + price + "," + Quantity + ""
_value = _value + "," + price + "*" + Quantity + ",'" + Currency + "'," + Exchangerate + ",'','" + Remark + "',0,0,0,0,0 "
_value = _value + ",'','" + USERID + "','" + EnterDate + "','',0,0,0,0,'PP',0,0,'')"
var SQL = " Insert into ch_fee " + field + _value;
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/Import/ImportSync/SaveSync',
scope: this,
params: {
SQL: SQL
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
//刷新费用列表
//this.storeBodyChFee.load({ params: { SALESNO: SALESNO} });
} else {
Ext.Msg.show({ title: '请重试',
msg: '服务器响应出错',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
}
//alert('03');
}
});
}
,
//#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);
};
} 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' });
}
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' });
}
};
} else {
}
}
},
scope: this
});
},
LoadInit: function (data) {
var CUSTOMERNAME = this.formHead.getForm().findField('CUSTOMERNAME').getValue();
var s = " ISOPERATOR=1 and LINKID in (select gid from [info_client] where SHORTNAME='" + CUSTOMERNAME + "')";
this.storeInfoClientContact.load({ params: { condition: s} });
var sF = " ISFINANCIALSTAFF=1 and LINKID in (select gid from [info_client] where SHORTNAME='" + CUSTOMERNAME + "')";
this.storeInfoClientContactFF.load({ params: { condition: sF} });
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.formEdit.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.formEdit.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.formEdit.getForm().findField('NOTIFYPARTYID').setValue(data.NOTIFYPARTYID);
}
},
scope: this
});*/
/*
this.storeagent.load({ params: { condition: "shippertype=4 AND (ISPUBLIC=1 OR CODENAME IN (SELECT CODENAME FROM info_client WHERE SHORTNAME='" + CUSTOMERNAME + "') )" },
callback: function (r, options, success) {
if (success) {
this.formEdit.getForm().findField('AGENTID').setValue(data.AGENTID);
}
},
scope: this
});*/
var BLTYPE = this.formHead.getForm().findField('BLTYPE').getValue();
if (BLTYPE == "空运单票" || BLTYPE == "空运分票") {
}
else {
}
},
//#endregion
//#region 转换成大写字符
onUpCaseClick: function (menu, event) {
this.formEdit.getForm().findField('SHIPPER').setValue(this.formEdit.getForm().findField('SHIPPER').getValue().toUpperCase());
this.formEdit.getForm().findField('CONSIGNEE').setValue(this.formEdit.getForm().findField('CONSIGNEE').getValue().toUpperCase());
this.formEdit.getForm().findField('NOTIFYPARTY').setValue(this.formEdit.getForm().findField('NOTIFYPARTY').getValue().toUpperCase());
this.formEdit.getForm().findField('AGENT').setValue(this.formEdit.getForm().findField('AGENT').getValue().toUpperCase());
this.formEdit.getForm().findField('MARKS').setValue(this.formEdit.getForm().findField('MARKS').getValue().toUpperCase());
this.formEdit.getForm().findField('DESCRIPTION').setValue(this.formEdit.getForm().findField('DESCRIPTION').getValue().toUpperCase());
},
//#endregion
//#region 保存报关
SaveBG: function (type) {
var basicForm = this.formEdit.getForm();
var basicForm2 = this.formHead.getForm();
if (!basicForm.isValid()) {
return;
}
if (!basicForm2.isValid()) {
return;
}
this.formHead.getForm().findField('BSNO').setDisabled(false);
var data = this.formHead.getForm().getValues(false, false, false);
var data2 = this.formEdit.getForm().getValues(false, false, false);
this.formHead.getForm().findField('BSNO').setDisabled(true);
Ext.Msg.wait('正在生成数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在生成数据...',
url: '/MvcShipping/MsOpAirn/SaveBG',
scope: this,
params: {
data: Ext.JSON.encode(data),
data2: Ext.JSON.encode(data2)
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
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 });
}
} else {
Ext.Msg.show({ title: '请重试',
msg: '服务器响应出错',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
}
}
});
}, //end save
//#endregion
//#region 编辑时按钮等的状态
GetEditStatus: function () {
var canedit = false;
//var bsStatus = this.formHead.getForm().findField('BSSTATUS').getValue();
var BSSTATUS = this.formHead.getForm().findField('BSSTATUSREF').getValue();
var inputby = this.formHead.getForm().findField('INPUTBY').getValue();
var op = this.formHead.getForm().findField('OP').getValue();
_this = this;
if (BSSTATUS == '锁定') {
canedit = false;
this.setSaveBtnStatus(canedit);
} else {
this.StoreOpRange.load({ params: { optype: "modOpAirnList" },
callback: function (r, options, success) {
if (success) {
if (r.length != 0) {
var records = DsStoreQueryBy(_this.StoreOpRange, 'OPID', op);
if (records.getCount() > 0) {
canedit = true;
} else {
var recordins = DsStoreQueryBy(_this.StoreOpRange, 'OPID', inputby);
if (recordins.getCount() > 0) {
canedit = true;
} else {
canedit = false;
}
}
} else { canedit = false; }
//_this.setSaveBtnStatus(canedit);
}
}
});
}
_this = this;
Ext.Ajax.request({
waitMsg: '正在查询委托编号状态...',
url: '/MvcShipping/MsSysBillNoSet/GetData',
params: {
condition: "OPLBNAME='空运出口' AND RULEBLNO='委托编号'",
handle: 'edit'
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (result.Success != true) {
var custno = _this.formHead.getForm().findField('CUSTNO');
custno.setReadOnly(true);
} else {
var data = result.data;
if (data.ISEDIT == '1') {
var custno = _this.formHead.getForm().findField('CUSTNO');
custno.setReadOnly(false);
} else {
if (data.RULEBLNO == '') {
var custno = _this.formHead.getForm().findField('CUSTNO');
custno.setReadOnly(false);
} else {
var custno = _this.formHead.getForm().findField('CUSTNO');
custno.setReadOnly(true);
}
}
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
Ext.Ajax.request({
waitMsg: '正在查询委托编号状态...',
url: '/MvcShipping/MsBaseInfo/GetRuleEdit',
params: {
rulename: '分提单号',
ruletype: '1'
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (result.Success != true) {
var hblno = _this.formHead.getForm().findField('HBLNO');
hblno.setReadOnly(true);
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
},
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;
},
setSaveBtnStatus: function (enable) {
var btnESave = Ext.getCmp('btnESave');
var btnESaveAndClose = Ext.getCmp('btnESaveAndClose');
var btnESaveAndNew = Ext.getCmp('btnESaveAndNew');
var btnECopyNew = Ext.getCmp('btnECopyNew');
if (enable) {
btnESave.enable();
btnESaveAndClose.enable();
btnESaveAndNew.enable();
//btnECopyNew.enable();
} else {
btnESave.disable();
btnESaveAndClose.disable();
btnESaveAndNew.disable();
//btnECopyNew.disable();
}
},
//#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 = 'MsOpAirn_Main';
var sql1 = "SET LANGUAGE 'us_english' SELECT * FROM op_Airn WHERE BSNO = '" + billNo + "'";
var sql2 = "select REGISTRATIONNO 代理号码 from info_client where shortname=(select airlines from op_airn where bsno='" + billNo + "')";
var sql3 = "";
var sql4 = "";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
},
//#endregion
PrevRecord: function () {
var modifystr = this.getIsModify();
if (modifystr != "") {
Ext.Msg.show({ title: '警告', msg: modifystr + '未保存,如果离开此页,将丢失未保存的更改 ', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
return;
}
var j = this.StoreList.indexOf(this.editRecord);
if (j == 0) {
Ext.Msg.show({ title: '警告', msg: '已是最前一票', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
return;
}
if (j == this.StoreList.count) {
Ext.Msg.show({ title: '警告', msg: '已是最后一票', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
return;
}
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 == 'pnlmodNewOpAirnInfo') {
} else {
children.items[i].close();
}
}
}
}
this.tabSeaepanel.doLayout();
j = j - 1;
this.editRecord = this.StoreList.getAt(j);
if (this.opStatus == 'edit') {
condition = "B.BSNO='" + this.editRecord.get('BSNO') + "'";
//this.storeBodyList.load({ params: { condition: condition} });
}
this.LoadData(this.opStatus, condition);
},
NextRecord: function () {
var modifystr = this.getIsModify();
if (modifystr != "") {
Ext.Msg.show({ title: '警告', msg: modifystr + '未保存,如果离开此页,将丢失未保存的更改 ', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
return;
}
var j = this.StoreList.indexOf(this.editRecord);
if (j == (this.StoreList.data.length - 1)) {
Ext.Msg.show({ title: '警告', msg: '已是最后一票', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
return;
}
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 == 'pnlmodNewOpAirnInfo') {
// this.tabSeaepanel.setActiveTab(i);
} else {
children.items[i].close();
}
}
}
}
this.tabSeaepanel.doLayout();
j = j + 1;
this.editRecord = this.StoreList.getAt(j);
if (this.opStatus == 'edit') {
condition = "B.BSNO='" + this.editRecord.get('BSNO') + "'";
//this.storeBodyList.load({ params: { condition: condition} });
}
this.LoadData(this.opStatus, condition);
},
getIsModify: function () {
var feepanel = Ext.getCmp('pnlmodAirnAllFee');
if (feepanel != NaN && feepanel != null) {
var feemodify = feepanel.panelFee.getModifyStatus();
if (feemodify) {
return '费用信息';
}
}
var feeamendpanel = Ext.getCmp('pnlmodAirnAmendFee');
if (feeamendpanel != NaN && feeamendpanel != null) {
var feemodify = feeamendpanel.panelFee.getModifyStatus();
if (feemodify) {
return '更改单信息';
}
}
if (panelEdit.formEdit.getForm().isDirty() == true || panelEdit.formHead.getForm().isDirty() == true) {
return '业务信息';
}
else return '';
}
,
reLine: function (button, event) {
var _L = 1;
this.storeCargo.each(function (record) {
var ln = _L + "";
_L = _L + 1;
record.set('SEQUENCE', ln);
});
},
onAddCargoClick: function (button, event) {
var linenum = this.storeCargo.getCount() + 1;
var _r = this.reLine();
var record = Ext.create('MsOpAirnCargomb', {
'id': '',
'GID': NewGuid(),
'BSNO': '',
'SEQUENCE': linenum,
'CARGOGID': '',
'CARGO_CODE': '',
'CARGONAME': '',
'BOXCOUNT': 0,
'M_WEIGHT': 0,
'WEIGHT': 0,
'CBM': 0,
'CBM_REMARK': '',
'PRICETYPE': '',
'PRICE': 0,
'AMOUNT': 0,
'PACKAGE': '',
'TH1': '',
'TH2': ''
});
this.storeCargo.add(record);
var n = this.storeCargo.getCount();
this.cellEditingCargo.startEditByPosition({ row: n - 1, column: 2 });
//aftereditform();
},
onDelCargoClick: function (button, event) {
var selectedRecords = this.formCargo.selModel.getSelection();
Ext.MessageBox.confirm('提示', '确定删除记录吗?', function (btn) {
if (btn == 'yes') {
var _Used = 0;
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
var cargo_id = rec.data.id;
if (cargo_id == "" || cargo_id == null) {
//continue;
} else {
Ext.Ajax.request({
waitMsg: '正在查询数据...',
url: '/CommMng/BasicDataRef/GeneralSelect',
scope: this,
async: false,
params: { condition: "select Count(*) GVALUE,'' as GID from Import_appstate where isnull(cancellation,0)=0 and cargo_id=" + cargo_id + " " },
waitMsg: "正在查询数据...",
callback: function (options, success, response) {
var result = Ext.JSON.decode(response.responseText);
_Used = parseFloat(result.data[0].GVALUE);
}
});
}
if (parseFloat(_Used) > 0) {
alert("此商品已配证,不能删除");
} else {
if (rec.ContractNo != "" || rec.ContractNo != "*") //如果是新增但没有保存的数据,没有必要提交到后台
{
this.CargoDel.push(rec);
}
this.storeCargo.remove(selectedRecords[i]);
}
}
var _r = this.reLine();
}
}, this);
//aftereditform();
}
,
ImportBs: function () {
var BSNO = this.formHead.getForm().findField('BSNO').getValue();
var AIRLINES = this.formEdit.getForm().findField('AIRLINES').getValue();
if (AIRLINES != "" && AIRLINES != null) {
this.storeRECEIPT.load({
params: { condition: " BSNO in(select GID from op_airn_RECEIPTWMS where CUSTOMERNAME='" + AIRLINES + "' ) and RSTATUS='领用' " },
callback: function (r, options, success) {
if (success) {
this.storeRECEIPTshow.removeAll();
this.storeRECEIPTshow.add(r);
}
},
scope: this
});
} else {
alert("请先选择航空公司");
return;
}
winCustomDataShow = Ext.create('Ext.window.Window', {
title: "",
// closeAction: 'hide',
width: 200,
height: 500,
layout: 'fit',
resizable: true,
modal: true,
closeAction: 'close',
closable: true,
items: [this.panelBs],
buttons: [{
text: "关闭",
minWidth: 70,
handler: function () {
winCustomDataShow.close();
}
}]
});
winCustomDataShow.show();
},
SetRECEIPT: function (SNO) {
var records = [];
this.storeRECEIPT.each(function (r) {
if (typeof (SNO) != "undefined" && SNO != null && SNO.length != 0
) {
if (r.data.RECEIPTNO.indexOf(SNO) != -1) {
records.push(r.copy());
}
} else
records.push(r.copy());
});
this.storeRECEIPTshow.removeAll();
//store2.add(records);
this.storeRECEIPTshow.add(records);
},
onLoadCargo: function () {
let HBLNO=this.editRecord.get('HBLNO')
this.storeCargo.load({ params: { condition: " C.BSNO in (select BSNO from OP_AIRN where HBLNO='" + HBLNO+"')" } });
}
});