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/MsOpAirnEdit.js

5834 lines
233 KiB
JavaScript

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

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,
MainOpStatus: 'add',
//HBLNO:"",
initUIComponents: function () {
this.serialNo = 0;
//this.bodyDel = [];
this.itemindex = 1;
this.initloaddata = 0;
this.accdatesameetd = 0;
this.MsPeriod = null;
this.CargoDel = [];
this.formname = "OpAirnEdit"; //页面名称
this.PRICETYPE = "分单";
//#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,
name: 'CUSTSERVICE',
valueField: 'UserName',
displayField: 'CodeAndName'
});
//揽货人
this.comboxSALE = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '揽货人',
store: this.storeOpCode,
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.comboxISSUEBY = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '填开人',
store: this.storeOpCode,
forceSelection: true,
name: 'ISSUEBY',
valueField: 'UserName',
displayField: 'CodeAndName'
});
//客户加载_委托单位
this.storeCustCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomVIPModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustom_SPPrice' }
});
//委托单位
this.comboxCustCode = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '委托单位',
store: this.storeCustCode,
forceSelection: 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 + "') )"} });
if (newValue!=oldValue){
Ext.getCmp("STLNAME").setValue("");
}
}
}
}
});
//委托单位_联系人
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,
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: '客户财务', hidden: true,
store: this.storeInfoClientContactFF,
forceSelection: 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();
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 );
}
}
},
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: '续程航班',
store: this.storeAIRLINES1,
forceSelection: true,
name: 'CY1',
valueField: 'CustCode',
displayField: 'CodeAndName',
listeners: {
blur: function (field, eOpts) {
if (field.lastValue != "") {
Ext.getCmp("TRANSFER_REMARK").allowBlank = false;
} else {
Ext.getCmp("TRANSFER_REMARK").allowBlank = true;
}
},
change: function (field, newValue, oldValue) {
if (newValue != "") {
Ext.getCmp("TRANSFER_REMARK").allowBlank = false;
} else {
Ext.getCmp("TRANSFER_REMARK").allowBlank = true;
}
},
scope: this
}
});
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',
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: '装运方式',
readOnly: true,
store: this.StoreBLTYPE,
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,
// 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: '来源明细', hidden: true,
store: this.storeSourceDetail,
// forceSelection: 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: '所属部门',
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,id:"STLNAME",
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 基本信息
var _this = this;
this.formHead = Ext.widget('form', {
region: 'north',
frame: true,
bodyPadding: 5,
collapsed: false,
collapsible: true,
trackResetOnLoad: true,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 70,
msgTarget: 'qtip'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '业务编号',
name: 'BSNO', hidden: true
}, {
fieldLabel: 'MASTERNO',
name: 'MASTERNO', hidden: true
}, {
fieldLabel: 'INPUTBY',
name: 'INPUTBY', hidden: true
}, {
fieldLabel: '时间戳',
name: 'TimeMark', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: '业务锁定', hidden: true,
disabled: true,
readOnly: true,
name: 'BSSTATUSREF'
}, {
fieldLabel: '费用锁定', hidden: true,
readOnly: true,
disabled: true,
name: 'FEESTATUSREF'
}, {
fieldLabel: 'CREATETIME', hidden: true,
readOnly: true,
disabled: true,
name: 'CREATETIME'
}, {
xtype: 'container',
layout: 'hbox',
flex: 1,
defaultType: 'textfield',
items: [
{
fieldLabel: '主单号',
readOnly: true,
name: 'MBLNO',
listeners: {
'render': function (_field, eOpts) {//自定义函数,定义双击事件
//var _this = this;
_field.getEl().on('dblclick', function (e, t, eOpts) {
var MBLNO = t.value;
//如果没号则不做处理
if (MBLNO == "" || MBLNO == null) {
//_this.MainOpStatus = 'add';
//DsOpenEditWin('/MvcShipping/MsOpAirn_Main/Edit');
}
//如果有号则打开主单
else {
_this.MainOpStatus = 'edit';
DsOpenEditWin('/MvcShipping/MsOpAirn_Main/Edit','国内主单:'+MBLNO);
//20161215 改为打开可用主单编号
}
});
}
}
}, {
xtype: 'button',
id: 'btnCUSTNO',
iconCls: "btncancel",
handler: function (button, event) {
this.ImportBs();
},
scope: this
}
]
}, {
fieldLabel: '分单号',
readOnly: true,
name: 'HBLNO'
}, {
fieldLabel: '会计期间',
xtype: 'monthfield',
name: 'ACCDATE'
}, this.comboxBLTYPE, {
fieldLabel: '发票号',
//readOnly: true,
name: 'INVOICENO'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxCustCode
,this.comboxStlName
, {
fieldLabel: '结算日期',
format: 'Y-m-d H:i:s',
flex: 1,
xtype: 'datefield',
name: 'STLDATE'
}
, this.comboxInfoClientContact, {
fieldLabel: 'TEL',
name: 'OPERATORTEL'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxOP, this.comboxCUSTSERVICE, this.comboxBSSOURCE, this.comboxBSSOURCEDETAIL, this.comboxSALE, this.comboxDept
/*{
fieldLabel: '付款方式',
name: 'STLNAME'
}*/]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '分单备注',
name: 'HDEMO'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '委托编号',
hidden: true,
//allowBlank: true,
name: 'CUSTNO'
}, {
fieldLabel: '订舱编号',
hidden: true,
name: 'ORDERNO'
}, { xtype: 'hiddenfield'}]
}, this.myCheckboxService, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '运费协议号',
hidden: true,
name: 'CONTRACTNO'
}//, { xtype: 'hiddenfield' }
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxClientFCContact, {
fieldLabel: 'TEL', hidden: true,
name: 'FINANCIALSTAFFTEL'
}, { xtype: 'hiddenfield', flex: 2}]
}
]//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: '续程目的站', labelWidth: 80,
store: this.storeport1,
name: 'PORT1',
valueField: 'PORTID',
displayField: 'CODEANDCNAME',
});
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',
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: 3,
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.storeFeeNameRef3.removeAll();
_this.storeFeeNameRef3.add(r);
_this.storeFeeNameRef2.removeAll();
_this.storeFeeNameRef2.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) {
var amount4 = this.formEdit_2.getForm().findField('OTFEE4AMOUNT').getValue();
if (amount4 == '') {
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) {
var amount5 = this.formEdit_2.getForm().findField('OTFEE5AMOUNT').getValue();
if (amount5 == '') {
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) {
var amount6 = this.formEdit_2.getForm().findField('OTFEE6AMOUNT').getValue();
if (amount6 == '') {
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) {
var amount7 = this.formEdit_2.getForm().findField('OTFEE7AMOUNT').getValue();
if (amount7 == '') {
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) {
var amount8 = this.formEdit_2.getForm().findField('OTFEE8AMOUNT').getValue();
if (amount8 == '') {
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();
_this.LoadFreightMain();
},
scope: this
}
}, this.comboxFORWARDER
, {
fieldLabel: '飞行时间', //labelWidth: 80,
flex: 1,
name: 'FLYTIME'
}
]
}
,
{
xtype: 'container',
layout: 'hbox',
flex: 1,
defaultType: 'textfield',
items: [
{
fieldLabel: '续程航班', //labelWidth: 80,
flex: 1,
name: 'CY1'
}
, this.comboxPORT1
, {
fieldLabel: '续航开航日期', labelWidth: 80,
flex: 1,xtype:'datefield',
name: 'FLYTIME1'
}, { xtype: 'hiddenfield', flex: 3 }
//, this.comboxAIRLINES2
//, this.comboxPORT2
//, this.comboxAIRLINES3
//, this.comboxPORT3
]
}
, {
xtype: 'container',
layout: 'hbox',
flex: 1,
defaultType: 'textfield',
items: [
{
flex: 1,
fieldLabel: '运价种类',
name: 'PRICETYPE'
}, {
xtype: 'checkbox', flex: 1,
fieldLabel: '监管',
name: 'SUPERVISE'
},
{
xtype: 'checkbox', flex: 1,
fieldLabel: '中转换单',
name: 'TRANSFER'
},
{
fieldLabel: '中转备注', id: "TRANSFER_REMARK",
flex: 1,
allowBlank: true,
name: 'TRANSFER_REMARK'
}
, this.comboxISSUEBY
//, { xtype: 'hiddenfield', flex: 3 }
, {
fieldLabel: '填开日期',
format: 'Y-m-d H:i:s',
flex: 1,
xtype: 'datefield',
name: 'ISSUEDATE'
}//, { xtype: 'hiddenfield' }
, {
fieldLabel: '填开地点', hidden: true,
flex: 1,
name: 'ISSUEPLACE'
}
,
{
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' }
{
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,
name: 'STREMARK'
}, {
fieldLabel: '运输注意事项', labelWidth: 80,
flex: 2,
name: 'TRANSREMARK'
}
]
}]
});
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,
name: 'POTFREIGHT',
readOnly:true,
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,
dataIndex: '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_2',
header: '主单重量',
width: 80
},
{
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,
dataIndex: 'PRICE',
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: '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, hidden: true,
dataIndex: 'PRICE_2',
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, hidden: true,
dataIndex: 'AMOUNT_2',
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: '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');
_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: '增加明细',
tooltip: '增加明细',
iconCls: "btnadddetail",
handler: function (button, event) {
this.onAddCargoClick(button, event);
},
scope: this
}, '-', {
text: '删除明细',
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
}, '-',
{
xtype: 'radiogroup',
id: "workinfo",
//name: 'workinfo',
vertical: true,
//fieldLabel: '要进行的工作', labelWidth: 80,
items: [
{ boxLabel: '分单运价', id: "QR", name: 'wi', inputValue: '0', width: 70, checked: true },
{ boxLabel: '主单运价', id: "QC", name: 'wi', inputValue: '1', width: 70 }
],
listeners: {
change: function (rd, newValue, oldValue, eOpts) {
if (newValue.wi.toString() == "0") {
_this.SetCargoPrice("分单");
_this.PRICETYPE="分单";
}
if (newValue.wi.toString() == "1") {
_this.SetCargoPrice("主单");
_this.PRICETYPE="主单";
}
}
}
}, '-', {
text: "VIP客户主单成本生成",
tooltip: '生成主单应收的地面运费和燃油费',
id: "MakeVIPFEE",
handler: function (button, event) {
this.MakeVIPFEE();
},
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: [
/*{
fieldLabel: '签单日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'ISSUEDATE'
}, {
fieldLabel: '签单地点',
name: 'ISSUEPLACE'
}*/]
}
, {
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('MBLNO');
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();
this.LoadPeriodStatus(this.opStatus);
} else {
this.opStatus = 'add';
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.panelAmendFee.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'
}
}
});
//主单运价方案 用于分单生成主单时计算费用;
this.storeDetail_Main = 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.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
}]
});
//#region 选择load 重新加载
this.gridListBs.getSelectionModel().on('select', function (model, record, index) {
var newMBLNO = record.data.TOTALNO;
//this.storeBodyChFee.load({ params: { billno: ContractNo} });
Ext.getCmp("newMBLNO").setValue(newMBLNO);
});
//#endregion
this.gridListBs.addListener('itemdblclick', function (dataview, record, item, index, e, b) {
var RECEIPT = record.data;
var NEWMBLNO=RECEIPT.TOTALNO;
var MASTERNO=RECEIPT.GID;
this.BeforeMakeMain(NEWMBLNO,MASTERNO);
/*
var NEWMBLNO="";
var basicForm = this.formEdit.getForm();
var basicForm2 = this.formHead.getForm();
if (!basicForm.isValid()) {
return;
}
if (!basicForm2.isValid()) {
return;
}
if (this.accdatesameetd == 1) {
var ETD = this.formEdit.getForm().findField('ETD').getRawValue();
if (ETD == '') {
} else {
var oDate1 = new Date(ETD);
var oDate2 = new Date(this.MsPeriod.FDAY);
if (oDate1.getTime() >= oDate2.getTime()) {
var mydatestr = Ext.util.Format.date(ETD, 'Y-m');
if (this.MsPeriod.CLOSEDAY != 0) {
var myday = Ext.util.Format.date(ETD, 'd');
if (myday > this.MsPeriod.CLOSEDAY) {
var mymonth = Ext.util.Format.date(ETD, 'm');
var myyear = Ext.util.Format.date(ETD, 'Y');
mymonth = parseInt(mymonth) + 1;
var mymonthstr = mymonth.toString();
if (mymonthstr.length == 1) mymonthstr = '0' + mymonthstr;
mydatestr = myyear.toString() + '-' + mymonthstr;
}
} else {
}
var field = this.formHead.getForm().findField('ACCDATE');
field.setValue(mydatestr);
}
}
}
//计算费用
this.SetFee();
var RECEIPT = record.data;
//var MBLNO=RECEIPT.TOTALNO;
//var HBLNO=this.formHead.getForm().findField('HBLNO').getValue();
var OLDMBLNO=this.formHead.getForm().findField('MBLNO').getValue();
//把选择的主单号设置到前台主单号格内
//this.formHead.getForm().findField('MBLNO').setValue(RECEIPT.TOTALNO);
NEWMBLNO=RECEIPT.TOTALNO;
var MASTERNO=RECEIPT.GID;
//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.formEdit.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) {
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') {
var arrNewRecords = this.StoreList.insert(0, returnData);
this.editRecord = this.StoreList.getAt(0);
this.opStatus = 'edit';
//basicForm2.findField('BSNO').setDisabled(true);
this.LoadPeriodStatus(this.opStatus);
this.storeCargo.load({
async:false,
params: { condition: " C.BSNO='" + returnData.BSNO + "'"}
});
this.MakeMain(returnData.BSNO,OLDMBLNO,NEWMBLNO,MASTERNO);
}
else if (this.opStatus == 'edit') {
var editp = Ext.create('MsOpAirnModel', returnData);
this.editRecord.fields.each(function (field) {
if (field.persist) {
name = field.name;
if (name != 'id')
this.editRecord.set(name, editp.get(name));
}
}, this);
this.editRecord.commit();
this.opStatus = 'edit';
this.LoadPeriodStatus(this.opStatus);
//basicForm2.findField('BSNO').setDisabled(true);
this.storeCargo.load({
async:false,
params: { condition: " C.BSNO='" + this.editRecord.get('BSNO') + "'"}
});
this.MakeMain(returnData.BSNO,OLDMBLNO,NEWMBLNO,MASTERNO);
}
} 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
});
}
}
});
//20161215 改为组织生成主单
//this.MakeMain(OLDMBLNO,MASTERNO);
*/
}, this);
this.LoadInitData();
// 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);
Ext.Ajax.request({
waitMsg: '',
url: '/MvcShipping/MsSysParamSet/GetData',
params: {
condition: "PARAMNAME='ACCDATESAMEETD'"
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (result.Success != true) {
} else {
var data = result.data;
if (data.PARAMVALUE == '1') {
this.accdatesameetd = 1;
} else {
}
}
} else {
}
},
scope: 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,
//tooltip: '注意,如需录入代理的主单号,请在此处直接输入并双击。',
xtype: 'textfield',
name: 'SNO',
listeners:
{
'change': function (field, e) {
//alert(field.lastValue);
_this.SetRECEIPT(field.lastValue);
},
'render': function (_field, eOpts) {//自定义函数,定义双击事件
_field.getEl().on('dblclick', function (e, t, eOpts) {
/*
Ext.MessageBox.confirm('提示', '直接生成主单,如果此主单号无库存,将不会影响主单库存情况。确定要生成吗?', function (btn) {
if (btn == 'yes') {
_this.BeforeMakeMain(_field.lastValue,_this.formHead.getForm().findField('BSNO').getValue())
}
}, this);
*/
});
}
}
}
],
items: [
this.gridListBs
],
bbar: [
{ id: "newMBLNO",
fieldLabel: "主单号",
labelWidth: 50,
//tooltip: '注意,如需录入代理的主单号,请在此处直接输入并双击。',
xtype: 'textfield',
name: 'newMBLNO'
}
]
});
}, //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];
if (this.isfen) this.MainEditRecord = ret[3];
}
if (this.opStatus == 'edit') {
condition = "B.BSNO='" + this.editRecord.get('BSNO') + "' and BLTYPE='" + BLTYPE + "'";
//this.storeBodyList.load({ params: { condition: condition} });
}
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;
if (this.isfen && 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,
BLTYPE: BLTYPE
},
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;
if (data.SALEDEPT == "") {
data.SALEDEPT = "业务部";
}
if (data.CUSTVALUE == "") { data.CUSTVALUE = "0"; }
if (data.INAMOUT == "") { data.INAMOUT = "0"; }
this.formHead.getForm().reset();
this.formHead.getForm().setValues(data);
this.formEdit.getForm().reset();
this.formEdit.getForm().setValues(data);
this.formEdit_2.getForm().reset();
this.formEdit_2.getForm().setValues(data);
if (this.opStatus == 'add') {
this.LoadDefValue();
}
this.LoadInit(data);
this.Editdata = data;
this.GetEditStatus();
this.storeCargo.load({ params: { condition: " C.BSNO='" + data.BSNO + "'"} });
this.LoadFreight();
this.LoadFreightMain();
document.title = "国内分单:" + data.HBLNO;
this.LoadPeriod(this.opStatus);
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
}
var billno = '*';
var gid = '*';
},
LoadPeriod: function (opstatus) {
Ext.Ajax.request({
waitMsg: '正在查询主表数据...',
url: '/Account/ChMonthClose/GetNowPeriod',
params: {
condition: ''
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
return;
}
data = result.data;
this.MsPeriod = data;
this.LoadPeriodStatus(opstatus);
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
},
LoadPeriodStatus: function (opstatus) {
var ETD = this.formEdit.getForm().findField('ETD').getRawValue();
if (ETD == '') {
this.formEdit.getForm().findField('ETD').setMinValue(this.MsPeriod.FDAY);
this.formEdit.getForm().findField('ETD').setReadOnly(false);
} else {
var oDate1 = new Date(ETD);
var oDate2 = new Date(this.MsPeriod.FDAY);
if (oDate1.getTime() >= oDate2.getTime()) {
this.formEdit.getForm().findField('ETD').setMinValue(this.MsPeriod.FDAY);
this.formEdit.getForm().findField('ETD').setReadOnly(false);
} else {
if (opstatus == 'add' || opstatus == 'copyadd') {
this.formEdit.getForm().findField('ETD').setMinValue(this.MsPeriod.FDAY);
this.formEdit.getForm().findField('ETD').setReadOnly(false);
}
else {
this.formEdit.getForm().findField('ETD').setMinValue('');
this.formEdit.getForm().findField('ETD').setReadOnly(true);
}
}
}
var ACCDATE = this.formHead.getForm().findField('ACCDATE').getValue();
var oDate1 = new Date(ACCDATE + '-01');
var oDate2 = new Date(this.MsPeriod.PERIOD + '-01');
if (oDate1.getTime() >= oDate2.getTime()) {
this.formHead.getForm().findField('ACCDATE').setMinValue(this.MsPeriod.PERIOD);
this.formHead.getForm().findField('ACCDATE').setReadOnly(false);
} else {
if (opstatus == 'add' || opstatus == 'copyadd') {
this.formHead.getForm().findField('ACCDATE').setMinValue(this.MsPeriod.PERIOD);
this.formHead.getForm().findField('ACCDATE').setReadOnly(false);
}
else {
this.formHead.getForm().findField('ACCDATE').setMinValue('');
this.formHead.getForm().findField('ACCDATE').setReadOnly(true);
}
}
},
// end LoadDate
//#endregion
LoadFreight: function () {
var AIRLINES = this.formEdit.getForm().findField('AIRLINES').getValue();
var ETD = this.formEdit.getForm().findField('ETD').getRawValue();
var BLTYPE = "国内分单";
var CUSTOMERNAME = this.formHead.getForm().findField('CUSTOMERNAME').getValue();
//var AIRLINES = this.formHead.getForm().findField('AIRLINES').getValue();
/*
var ISVIP = "0";
var VIPDJ = "0";
var VIPDP = "0"
////////
var currrecords = DsStoreQueryBy(this.storeCustCode, 'CustName', CUSTOMERNAME);
if (currrecords.getCount() > 0) {
var currdata = currrecords.getAt(0).data;
ISVIP = currdata.ISVIP;
VIPDJ = currdata.VIPDJ;
VIPDP = currdata.VIPDP;
} else {
}
*/
/*
if (ISVIP == "1") {
BLTYPE = "国内主单";
Ext.getCmp("MakeVIPFEE").setVisible(true);
}else{
Ext.getCmp("MakeVIPFEE").setVisible(false);
}*/
//if (ISVIP != "1") {
if (AIRLINES != "" && ETD != "" && AIRLINES != null && ETD != null) {
this.storeDetail.load({
async:false,
params: { start: 0, limit: 9999, CUSTOMERNAME: CUSTOMERNAME, BLTYPE: BLTYPE,
condition: " PLAN_GID in(select gid from OpAirn_FreightPlan where CUSTOMERNAME='" + AIRLINES + "' and inuse=1 and STARTDATE<='" + ETD + "' and (case p.ENDDATE when '1900-01-01' then '3000-11-11' else p.ENDDATE end)>='" + ETD + "' and BLTYPE='" + BLTYPE + "' ) "} });
}
//}
_this = this;
/*
if (ISVIP == "1") {
if (AIRLINES != "" && ETD != "" && AIRLINES != null && ETD != null) {
this.storeDetail.load({
params: { start: 0, limit: 999, CUSTOMERNAME: CUSTOMERNAME, BLTYPE: BLTYPE, condition: " PLAN_GID =(select top 1 gid from OpAirn_FreightPlan where CUSTOMERNAME='" + AIRLINES + "' and inuse=1 and STARTDATE<='" + ETD + "' and ENDDATE>='" + ETD + "' and BLTYPE='" + BLTYPE + "') " }
,
callback: function (r, options, success) {
if (success) {
if (r.length > 0) {
//var 主单附加成本=0;//燃油费
//
//if (AIRLINES!="吉祥航空"){//非
// 主单附加成本=Add(主单附加成本,0.2);//0.33地面费
//}
//if (AIRLINES!="东方航空"){//非
// 主单附加成本=Add(主单附加成本,0.33);//0.33地面费
//}
//VIPDJ=Add(VIPDJ,主单附加成本);
for (var _i=0; _i < _this.storeDetail.getCount(); _i++) {
var rec = _this.storeDetail.getAt(_i);
//rec.set('W_N', Add(rec.get('W_N'), 主单附加成本));
//rec.set('W_45', Add(rec.get('W_45'), 主单附加成本));
rec.set('W_100', Add(rec.get('W_100'), VIPDJ));
rec.set('W_300', Add(rec.get('W_300'), VIPDJ));
rec.set('W_500', Add(rec.get('W_500'), VIPDJ));
rec.set('W_1000', Add(rec.get('W_1000'), VIPDJ));
}
//Ext.Array.forEach(r, function (item, index, arr) {
//item.data.W_5 = Add(item.data.W_5, VIPDJ);
//item.data.W_10 = Add(item.data.W_10, VIPDJ);
//item.data.W_N = Add(item.data.W_N, VIPDJ);
//item.data.W_45 = Add(item.data.W_45, VIPDJ);
//item.data.W_100 = Add(item.data.W_100, VIPDJ);
//item.data.W_300 = Add(item.data.W_300, VIPDJ);
//item.data.W_500 = Add(item.data.W_500, VIPDJ);
//item.data.W_1000 = Add(item.data.W_1000, VIPDJ);
});
} else {
}
}
}
});
}
}
*/
},
LoadFreightMain: function () {
var AIRLINES = this.formEdit.getForm().findField('AIRLINES').getValue();
var ETD = this.formEdit.getForm().findField('ETD').getRawValue();
var BLTYPE = "国内主单";
var CUSTOMERNAME = this.formHead.getForm().findField('CUSTOMERNAME').getValue();
if (AIRLINES != "" && ETD != "" && AIRLINES != null && ETD != null) {
this.storeDetail_Main.load({
async:false,
params: { start: 0, limit: 9999, CUSTOMERNAME: CUSTOMERNAME, BLTYPE: BLTYPE,
condition: " PLAN_GID in(select gid from OpAirn_FreightPlan where CUSTOMERNAME='" + AIRLINES + "' and inuse=1 and STARTDATE<='" + ETD + "' and (case p.ENDDATE when '1900-01-01' then '3000-11-11' else p.ENDDATE end)>='" + ETD + "' and BLTYPE='" + BLTYPE + "' ) "}
});
}
},
LoadDefValue: function () {
this.storeDefValue.load({ params: { condition: "BSTYPE='国内空运'" },
callback: function (r, options, success) {
if (success) {
if (this.storeDefValue.getCount() > 0) {
for (var j = 0; j < this.storeDefValue.getCount(); j += 1) {
var member = this.storeDefValue.getAt(j);
var headfield = this.formHead.getForm().findField(member.data.FIELDNAME);
if (headfield != NaN && headfield != null)
headfield.setValue(member.data.DEFVALUE);
var headfield = this.formEdit.getForm().findField(member.data.FIELDNAME);
if (headfield != NaN && headfield != null)
headfield.setValue(member.data.DEFVALUE);
var headfield = this.formEdit_2.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' });
}
var headfield = this.formEdit_2.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
});
},
LoadInitData: function () {
_this=this;
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({
callback: function (r, options, success) {
if (success) {
this.storeport1.removeAll();
this.storeport2.removeAll();
this.storeport3.removeAll();
this.storeport1.add(r);
this.storeport2.add(r);
this.storeport3.add(r);
}
},
scope: this
});
},
//#region 保存
//print :0:不打印,1打印
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;
}
if (this.accdatesameetd == 1) {
var ETD = this.formEdit.getForm().findField('ETD').getRawValue();
if (ETD == '') {
} else {
var oDate1 = new Date(ETD);
var oDate2 = new Date(this.MsPeriod.FDAY);
if (oDate1.getTime() >= oDate2.getTime()) {
var mydatestr = Ext.util.Format.date(ETD, 'Y-m');
if (this.MsPeriod.CLOSEDAY != 0) {
var myday = Ext.util.Format.date(ETD, 'd');
if (myday > this.MsPeriod.CLOSEDAY) {
var mymonth = Ext.util.Format.date(ETD, 'm');
var myyear = Ext.util.Format.date(ETD, 'Y');
mymonth = parseInt(mymonth) + 1;
var mymonthstr = mymonth.toString();
if (mymonthstr.length == 1) mymonthstr = '0' + mymonthstr;
mydatestr = myyear.toString() + '-' + mymonthstr;
}
} else {
}
var field = this.formHead.getForm().findField('ACCDATE');
field.setValue(mydatestr);
}
}
}
//计算费用
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.formEdit.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') {
var arrNewRecords = this.StoreList.insert(0, returnData);
this.editRecord = this.StoreList.getAt(0);
if (type == '0') {
this.opStatus = 'edit';
//basicForm2.findField('BSNO').setDisabled(true);
this.LoadPeriodStatus(this.opStatus);
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);
this.editRecord.fields.each(function (field) {
if (field.persist) {
name = field.name;
if (name != 'id')
this.editRecord.set(name, editp.get(name));
}
}, this);
this.editRecord.commit();
if (type == '0') {
this.opStatus = 'edit';
this.LoadPeriodStatus(this.opStatus);
//basicForm2.findField('BSNO').setDisabled(true);
this.storeCargo.load({ params: { condition: " C.BSNO='" + this.editRecord.get('BSNO') + "'"} });
} 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 生成主单
BeforeMakeMain:function (NEWMBLNO,MASTERNO){
//var NEWMBLNO="";
var basicForm = this.formEdit.getForm();
var basicForm2 = this.formHead.getForm();
if (!basicForm.isValid()) {
return;
}
if (!basicForm2.isValid()) {
return;
}
if (this.accdatesameetd == 1) {
var ETD = this.formEdit.getForm().findField('ETD').getRawValue();
if (ETD == '') {
} else {
var oDate1 = new Date(ETD);
var oDate2 = new Date(this.MsPeriod.FDAY);
if (oDate1.getTime() >= oDate2.getTime()) {
var mydatestr = Ext.util.Format.date(ETD, 'Y-m');
if (this.MsPeriod.CLOSEDAY != 0) {
var myday = Ext.util.Format.date(ETD, 'd');
if (myday > this.MsPeriod.CLOSEDAY) {
var mymonth = Ext.util.Format.date(ETD, 'm');
var myyear = Ext.util.Format.date(ETD, 'Y');
mymonth = parseInt(mymonth) + 1;
var mymonthstr = mymonth.toString();
if (mymonthstr.length == 1) mymonthstr = '0' + mymonthstr;
mydatestr = myyear.toString() + '-' + mymonthstr;
}
} else {
}
var field = this.formHead.getForm().findField('ACCDATE');
field.setValue(mydatestr);
}
}
}
//计算费用
this.SetFee();
//var RECEIPT = record.data;
var OLDMBLNO=this.formHead.getForm().findField('MBLNO').getValue();
//把选择的主单号设置到前台主单号格内
//this.formHead.getForm().findField('MBLNO').setValue(RECEIPT.TOTALNO);
//改为参数
//NEWMBLNO=RECEIPT.TOTALNO;
//var MASTERNO=RECEIPT.GID;
//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.formEdit.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) {
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') {
var arrNewRecords = this.StoreList.insert(0, returnData);
this.editRecord = this.StoreList.getAt(0);
this.opStatus = 'edit';
//basicForm2.findField('BSNO').setDisabled(true);
this.LoadPeriodStatus(this.opStatus);
this.storeCargo.load({
async:false,
params: { condition: " C.BSNO='" + returnData.BSNO + "'"}
});
this.MakeMain(returnData.BSNO,OLDMBLNO,NEWMBLNO,MASTERNO);
}
else if (this.opStatus == 'edit') {
var editp = Ext.create('MsOpAirnModel', returnData);
this.editRecord.fields.each(function (field) {
if (field.persist) {
name = field.name;
if (name != 'id')
this.editRecord.set(name, editp.get(name));
}
}, this);
this.editRecord.commit();
this.opStatus = 'edit';
this.LoadPeriodStatus(this.opStatus);
//basicForm2.findField('BSNO').setDisabled(true);
this.storeCargo.load({
async:false,
params: { condition: " C.BSNO='" + this.editRecord.get('BSNO') + "'"}
});
this.MakeMain(returnData.BSNO,OLDMBLNO,NEWMBLNO,MASTERNO);
}
} 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
});
}
}
});
//20161215 改为组织生成主单
//this.MakeMain(OLDMBLNO,MASTERNO);
},
MakeMain: function (BSNO,OLDMBLNO,NEWMBLNO,MASTERNO) {
var type='0';
var basicForm = this.formEdit.getForm();
var basicForm2 = this.formHead.getForm();
if (!basicForm.isValid()) {
return;
}
if (!basicForm2.isValid()) {
return;
}
if (this.accdatesameetd == 1) {
var ETD = this.formEdit.getForm().findField('ETD').getRawValue();
if (ETD == '') {
} else {
var oDate1 = new Date(ETD);
var oDate2 = new Date(this.MsPeriod.FDAY);
if (oDate1.getTime() >= oDate2.getTime()) {
var mydatestr = Ext.util.Format.date(ETD, 'Y-m');
if (this.MsPeriod.CLOSEDAY != 0) {
var myday = Ext.util.Format.date(ETD, 'd');
if (myday > this.MsPeriod.CLOSEDAY) {
var mymonth = Ext.util.Format.date(ETD, 'm');
var myyear = Ext.util.Format.date(ETD, 'Y');
mymonth = parseInt(mymonth) + 1;
var mymonthstr = mymonth.toString();
if (mymonthstr.length == 1) mymonthstr = '0' + mymonthstr;
mydatestr = myyear.toString() + '-' + mymonthstr;
}
} else {
}
var field = this.formHead.getForm().findField('ACCDATE');
field.setValue(mydatestr);
}
}
}
//计算费用
//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.formEdit.getForm().findField('TRANSFER').getValue() ? 1 : 0;
//this.formHead.getForm().findField('BSNO').setDisabled(true);
data.BLTYPE="国内主单";
data.BSNO=NewGuid();
data.MASTERNO=MASTERNO;
data.SHIPPER="";
data.SHIPPERID="";
data.MBLNO=NEWMBLNO;
var Cargodatas = [];
var PFREIGHT=0;//data3.PFREIGHT
var _TWEIGHT=0;
var STREMARK="";
var TRANSREMARK="";
for (var i = 0; i < this.storeCargo.getCount(); i += 1) {
var Cargo = this.storeCargo.getAt(i);
//逐个处理商品信息
//Cargo.set('GID',NewGuid());
//防止重复生成商品信息
Cargo.set('BSNO',BSNO);
var AIRLINES = this.formEdit.getForm().findField('AIRLINES').getValue();
var ETD = this.formEdit.getForm().findField('ETD').getRawValue();
var CARGOGID = Cargo.data.CARGOGID;//e.record.get('CARGOGID');
var PORTDISCHARGEID = this.formEdit.getForm().findField('PORTDISCHARGEID').getValue();
var VESSEL = this.formEdit.getForm().findField('VESSEL').getValue();
var VESSELHEAD = this.formEdit.getForm().findField('VESSELHEAD').getValue();
var PLANDETAIL = "";
var PRICE = 0;
var AMOUNT = 0;
//如果没有合适的运价方案,提示
if (this.storeDetail_Main.count == 0 && (AIRLINES != null && AIRLINES != "" && ETD != null && ETD != "")) {
//alert("目前没有符合条件的主单运价方案");
//return;
}
//如果有
else {
//遍历看是不是有CARGOGID相同 目的地相同 航班号相同
for (var i = 0; i < this.storeDetail_Main.getCount(); i += 1) {
var member = this.storeDetail_Main.getAt(i);
if (member.data.CARGOGID == CARGOGID && member.data.PORTDISCHARGEID == PORTDISCHARGEID
&& member.data.VESSELHEAD == VESSELHEAD && member.data.VESSEL == VESSEL) {
PLANDETAIL = member.data;
continue;
}
}
//如有 按其计算费用
//如无 是不是有CARGOGID相同 目的地相同 无航班号
if (PLANDETAIL == "") {
for (var i = 0; i < this.storeDetail_Main.getCount(); i += 1) {
var member = this.storeDetail_Main.getAt(i);
if (member.data.CARGOGID == CARGOGID && member.data.PORTDISCHARGEID == PORTDISCHARGEID
&& member.data.VESSELHEAD == VESSELHEAD && (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_Main.getCount(); i += 1) {
var member = this.storeDetail_Main.getAt(i);
if (member.data.CARGOGID == CARGOGID
&& member.data.PORTDISCHARGEID == ""
&& member.data.VESSELHEAD == VESSELHEAD
&& (member.data.VESSEL == "" || member.data.VESSEL == "ALL" || member.data.VESSEL == "All")) {
PLANDETAIL = member.data;
continue;
}
}
}
//如有 按其计算
if (PLANDETAIL == "") {
alert("当前运价方案中没有合适的主单运价内容");
//不带价格过去
WEIGHT = Cargo.data.WEIGHT;
Cargo.set('PRICE_2', "0");
Cargo.set('AMOUNT_2',"0") ;
Cargo.set('WEIGHT_2',WEIGHT) ;
PFREIGHT="0";
_TWEIGHT=Add(_TWEIGHT,WEIGHT);
STREMARK="";
TRANSREMARK="机场自提,飞行时间:"+data2.FLYTIME ;
}
else {
WEIGHT = Cargo.data.WEIGHT;
if (WEIGHT < parseFloat(PLANDETAIL.MINWEIGHT)) {
WEIGHT = PLANDETAIL.MINWEIGHT;
}
var wm_n=parseFloat(PLANDETAIL.wm_n);
var wm_45=parseFloat(PLANDETAIL.wm_45);
var wm_100=parseFloat(PLANDETAIL.wm_100);
var wm_300=parseFloat(PLANDETAIL.wm_300);
var wm_500=parseFloat(PLANDETAIL.wm_500);
if (WEIGHT < wm_n) {
PRICE = PLANDETAIL.W_N;
} else if (WEIGHT >= wm_n && WEIGHT < wm_45) {
PRICE = PLANDETAIL.W_45;
if (WEIGHT<45){
WEIGHT=45;
}
} else if (WEIGHT >= wm_45 && WEIGHT < wm_100) {
PRICE = PLANDETAIL.W_100;
if (WEIGHT<100){
WEIGHT=100;
}
} else if (WEIGHT >= wm_100 && WEIGHT < wm_300) {
PRICE = PLANDETAIL.W_300;
if (WEIGHT<300){
WEIGHT=300;
}
} else if (WEIGHT >= wm_300 && WEIGHT < wm_500) {
PRICE = PLANDETAIL.W_500;
if (WEIGHT<500){
WEIGHT=500;
}
} else if (WEIGHT >= wm_500 ) {
PRICE = PLANDETAIL.W_1000;
if (WEIGHT<1000){
WEIGHT=1000;
}
}
AMOUNT = Mul(PRICE, WEIGHT);
Cargo.set('PRICE_2', PRICE);
if (parseFloat(AMOUNT) > parseFloat(PLANDETAIL.MINFEE)) {
//e.record.set('AMOUNT', AMOUNT);
} else {
AMOUNT = PLANDETAIL.MINFEE;
}
/*
if (parseFloat(AMOUNT) > parseFloat(PLANDETAIL.MINFEE)) {
e.record.set('AMOUNT', AMOUNT);
} else {
e.record.set('AMOUNT', PLANDETAIL.MINFEE);
}*/
AMOUNT=Math.round(AMOUNT);
Cargo.set('AMOUNT_2',AMOUNT) ;
Cargo.set('WEIGHT_2',WEIGHT) ;
//this.SetFee();
PFREIGHT=Add(PFREIGHT,AMOUNT);
_TWEIGHT=Add(_TWEIGHT,WEIGHT);
STREMARK=PLANDETAIL.REMARK_3;
TRANSREMARK=PLANDETAIL.REMARK_2+",机场自提,飞行时间:"+data2.FLYTIME ;
}
//如无 告警说没有合适的费用信息。
if (WEIGHT<45){
Cargo.set('PRICETYPE',"N");
}
if (AMOUNT == PLANDETAIL.MINFEE){
Cargo.set('PRICETYPE',"M");
}else if (WEIGHT>=45){
Cargo.set('PRICETYPE',"Q");
}
}
Cargodatas.push(Cargo);
}
data3.PFREIGHT=PFREIGHT;
data3.CFREIGHT="0";
data3.PVALUEFEE ="0";
data3.CVALUEFEE ="0";
data3.PCARRIEROT ="0";
data3.CCARRIEROT ="0";
data3.POTFREIGHT ="0";
data3.COTFREIGHT ="0";
data3.PTOTAL =PFREIGHT;
data3.CTOTAL ="0";
data3.OTFEE1 = "";
data3.OTFEE1AMOUNT = "0";
data3.OTFEE2 = "";
data3.OTFEE2AMOUNT = "0";
data3.OTFEE3 = "";
data3.OTFEE3AMOUNT = "0";
data3.OTFEE4 = "";
data3.OTFEE4AMOUNT = "0";
data3.OTFEE5 = "";
data3.OTFEE5AMOUNT = "0";
data3.OTFEE6 = "";
data3.OTFEE6AMOUNT = "0";
data3.OTFEE7 = "";
data3.OTFEE7AMOUNT = "0";
data3.OTFEE8 = "";
data3.OTFEE8AMOUNT = "0";
data3.SHIPPERID="机场顺达";
//data3.SHIPPER = "青岛机场顺达货运有限公司\r\n电话:0532-83787777/0532-83788377";
data3.SHIPPER = "青岛机场顺达货运有限公司\r\n电话:0532-67895750/0532-67895752";
data2.STREMARK=STREMARK;
data2.TRANSREMARK = TRANSREMARK;
let _this = this;
//data2.ISSUEDATE=
//20161218 计算主单的默认费用
if (AIRLINES=="山东航空"){
data3.OTFEE1="燃油费";
//向上取整
//data3.OTFEE1AMOUNT=Math.ceil(Mul(_TWEIGHT,0.2));
//改为四舍五入
data3.OTFEE1AMOUNT=Mul(_TWEIGHT,0.2,0);
if (parseFloat(data3.OTFEE1AMOUNT)<10)
{
data3.OTFEE1AMOUNT=10;
}
data3.OTFEE3="保险费";
data3.OTFEE3AMOUNT=7;
//data3.OTFEE5 = "地面费";
//data3.OTFEE5AMOUNT = _this.GetDMFAmount(_TWEIGHT);
} else if (AIRLINES=="青岛航空"){
data3.OTFEE1="燃油费";
data3.OTFEE1AMOUNT=Mul(_TWEIGHT,0.2,0);
if (parseFloat(data3.OTFEE1AMOUNT)<10)
{
data3.OTFEE1AMOUNT=10;
}
//data3.OTFEE3 = "地面费";
//data3.OTFEE3AMOUNT = _this.GetDMFAmount(_TWEIGHT);
//data3.PFREIGHT=Add(data3.PFREIGHT,data3.OTFEE1AMOUNT);
}else if (AIRLINES=="南方航空"){
data3.OTFEE1="燃油费";
//向上取整
data3.OTFEE1AMOUNT=Math.ceil(Mul(_TWEIGHT,0.2));
//改为四舍五入
//data3.OTFEE1AMOUNT=Mul(_TWEIGHT,0.2);
//data3.PFREIGHT=Add(data3.PFREIGHT,data3.OTFEE1AMOUNT);
}else if (AIRLINES=="春秋航空"){
data3.OTFEE1="燃油费";
data3.OTFEE1AMOUNT=Mul(_TWEIGHT,0.2,0);
data3.OTFEE3="制单成本费";
data3.OTFEE3AMOUNT = "1";
if (data3.OTFEE1AMOUNT < 1) data3.OTFEE1AMOUNT = 1;
//data3.OTFEE5 = "地面费";
//data3.OTFEE5AMOUNT = _this.GetDMFAmount(_TWEIGHT);
//data3.PFREIGHT=Add(Add(data3.PFREIGHT,data3.OTFEE1AMOUNT),OTFEE2AMOUNT);
}else if (AIRLINES=="吉祥航空"){
data3.OTFEE1="燃油费";
if (parseFloat(Mul(_TWEIGHT,0.2))<1){
data3.OTFEE1AMOUNT=1
}else{
data3.OTFEE1AMOUNT=Math.round(Mul(_TWEIGHT,0.2));
}
//data3.OTFEE3 = "地面费";
//data3.OTFEE3AMOUNT = _this.GetDMFAmount(_TWEIGHT);
}else if (AIRLINES=="深圳航空"){
data3.OTFEE1="燃油费";
if (parseFloat(Mul(_TWEIGHT,0.2))<1){
data3.OTFEE1AMOUNT=1
}else{
data3.OTFEE1AMOUNT=Math.round(Mul(_TWEIGHT,0.2));
}
//data3.OTFEE3 = "地面费";
//data3.OTFEE3AMOUNT = _this.GetDMFAmount(_TWEIGHT);
}else if (AIRLINES=="厦门航空"){
data3.OTFEE1="燃油费";
data3.OTFEE1AMOUNT=Math.round(Mul(_TWEIGHT,0.2));
if (data3.OTFEE1AMOUNT < 1) data3.OTFEE1AMOUNT = 1;
//data3.OTFEE3 = "地面费";
//data3.OTFEE3AMOUNT = _this.GetDMFAmount(_TWEIGHT);
}else {
data3.OTFEE1="燃油费";
data3.OTFEE1AMOUNT = Mul(_TWEIGHT, 0.2, 0);
//data3.OTFEE3 = "地面费";
//data3.OTFEE3AMOUNT = _this.GetDMFAmount(_TWEIGHT);
//data3.PFREIGHT=Add(data3.PFREIGHT,data3.OTFEE1AMOUNT);
}
//商品明细
var CargoBody = ConvertRecordsToJson(Cargodatas);
var CargoDelBody = ConvertRecordsToJsonAll(this.CargoDel);
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/MvcShipping/MsOpAirn/MakeMain',
scope: this,
params: {
opstatus: 'add',
data: Ext.JSON.encode(data),
data2: Ext.JSON.encode(data2),
data3: Ext.JSON.encode(data3),
CargoBody: CargoBody,
CargoDelBody: CargoDelBody,
OLDMBLNO:OLDMBLNO,
FDBSNO:BSNO
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
var returnData = jsonresult.Data;
this.formEdit.getForm().reset();
this.formEdit.getForm().setValues(returnData);
this.formHead.getForm().reset();
this.formHead.getForm().setValues(returnData);
this.Editdata = returnDat
winCustomDataShow.close();
this.storeCargo.load({ params: { condition: " C.BSNO='" + returnData.BSNO + "'" } });
//_this.MainOpStatus = 'edit';
//DsOpenEditWin('/MvcShipping/MsOpAirn_Main/Edit');
} else {
winCustomDataShow.close();
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
} else {
winCustomDataShow.close();
Ext.Msg.show({ title: '请重试',
msg: '服务器响应出错',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
}
}
});
}, //end save
//内贸空运-主单-委托信息-费用明细-订制增加自动生成DMF-地面费功能,
//地面费计算公式为计费重量*0.35结果小于10 按10生成大于10按实际生成开发工作量为2工作日开发计2000元/ 工作日 / 人项目单人开发费用为2000元 * 2=4000元
GetDMFAmount(_TWEIGHT) {
let Amount = 0.0;
Amount = Math.round(Mul(_TWEIGHT, 0.35));
if (Amount < 10) Amount = 10;
return Amount;
},
//#endregion
//生成对VIP客户应收的地面运费和燃油费
MakeVIPFEE:function(){
var _TWEIGHT=0;
var AIRLINES = this.formEdit.getForm().findField('AIRLINES').getValue();
for (var i = 0; i < this.storeCargo.getCount(); i += 1) {
var Cargo = this.storeCargo.getAt(i);
WEIGHT = Cargo.data.WEIGHT;
_TWEIGHT=Add(_TWEIGHT,WEIGHT);
}
var DMYF=0;
if (AIRLINES!="东方航空"){
DMYF=Math.ceil(Mul(_TWEIGHT,0.33));
if (DMYF<10){
DMYF=10;
}
}
this.formEdit_2.getForm().findField('PCARRIEROT').setValue(DMYF);
var RYF=0;
if (AIRLINES!="吉祥航空"){
RYF=Math.ceil(Mul(_TWEIGHT,0.2));
var FEENAME=this.formEdit_2.getForm().findField('OTFEE5').getValue();
if (FEENAME==""||FEENAME=="燃油费"){
this.formEdit_2.getForm().findField('OTFEE5').setValue("燃油费");
this.formEdit_2.getForm().findField('OTFEE5AMOUNT').setValue(RYF);
}else if (this.formEdit_2.getForm().findField('OTFEE7').getValue()==""||this.formEdit_2.getForm().findField('OTFEE7').getValue()=="燃油费"){
this.formEdit_2.getForm().findField('OTFEE7').setValue("燃油费");
this.formEdit_2.getForm().findField('OTFEE7AMOUNT').setValue(RYF);
}else if (this.formEdit_2.getForm().findField('OTFEE2').getValue()==""||this.formEdit_2.getForm().findField('OTFEE2').getValue()=="燃油费"){
this.formEdit_2.getForm().findField('OTFEE2').setValue("燃油费");
this.formEdit_2.getForm().findField('OTFEE2AMOUNT').setValue(RYF);
}else if (this.formEdit_2.getForm().findField('OTFEE4').getValue()==""||this.formEdit_2.getForm().findField('OTFEE4').getValue()=="燃油费"){
this.formEdit_2.getForm().findField('OTFEE4').setValue("燃油费");
this.formEdit_2.getForm().findField('OTFEE4AMOUNT').setValue(RYF);
}else if (this.formEdit_2.getForm().findField('OTFEE6').getValue()==""||this.formEdit_2.getForm().findField('OTFEE6').getValue()=="燃油费"){
this.formEdit_2.getForm().findField('OTFEE6').setValue("燃油费");
this.formEdit_2.getForm().findField('OTFEE6AMOUNT').setValue(RYF);
}else if (this.formEdit_2.getForm().findField('OTFEE8').getValue()==""||this.formEdit_2.getForm().findField('OTFEE8').getValue()=="燃油费"){
this.formEdit_2.getForm().findField('OTFEE8').setValue("燃油费");
this.formEdit_2.getForm().findField('OTFEE8AMOUNT').setValue(RYF);
}
}
},
getFenPlanDetail:function(CARGOGID){
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 VESSELHEAD = this.formEdit.getForm().findField('VESSELHEAD').getValue();
var PLANDETAIL = "";
var PRICE = 0;
var AMOUNT = 0;
//如果没有合适的运价方案,提示
if (this.storeDetail.getCount() == 0 && (AIRLINES != null && AIRLINES != "" && ETD != null && ETD != "" )) {
alert("目前没有符合条件的运价方案");
return;
//e.record.set('PRICETYPE',"无");
}
//如果有
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.VESSELHEAD == VESSELHEAD
&& 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.VESSELHEAD == VESSELHEAD
&& (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.VESSELHEAD == VESSELHEAD
&& (member.data.VESSEL == "" || member.data.VESSEL == "ALL" || member.data.VESSEL == "All")) {
PLANDETAIL = member.data;
continue;
}
}
}
//如有 按其计算
if (PLANDETAIL == "") {
alert("当前运价方案中没有合适的运价内容");
return PLANDETAIL;
} else {
return PLANDETAIL;
}
}
},
getMainPlanDetail:function(CARGOGID){
var AIRLINES = this.formEdit.getForm().findField('AIRLINES').getValue();
var ETD = this.formEdit.getForm().findField('ETD').getRawValue();
//var CARGOGID = Cargo.data.CARGOGID;//e.record.get('CARGOGID');
var PORTDISCHARGEID = this.formEdit.getForm().findField('PORTDISCHARGEID').getValue();
var VESSEL = this.formEdit.getForm().findField('VESSEL').getValue();
var VESSELHEAD = this.formEdit.getForm().findField('VESSELHEAD').getValue();
var PLANDETAIL = "";
var PRICE = 0;
var AMOUNT = 0;
//如果没有合适的运价方案,提示
if (this.storeDetail_Main.count == 0 && (AIRLINES != null && AIRLINES != "" && ETD != null && ETD != "")) {
//alert("目前没有符合条件的主单运价方案");
//return;
}
//如果有
else {
//遍历看是不是有CARGOGID相同 目的地相同 航班号相同
for (var i = 0; i < this.storeDetail_Main.getCount(); i += 1) {
var member = this.storeDetail_Main.getAt(i);
if (member.data.CARGOGID == CARGOGID && member.data.PORTDISCHARGEID == PORTDISCHARGEID
&& member.data.VESSELHEAD == VESSELHEAD
&& member.data.VESSEL == VESSEL) {
PLANDETAIL = member.data;
continue;
}
}
//如有 按其计算费用
//如无 是不是有CARGOGID相同 目的地相同 无航班号
if (PLANDETAIL == "") {
for (var i = 0; i < this.storeDetail_Main.getCount(); i += 1) {
var member = this.storeDetail_Main.getAt(i);
if (member.data.CARGOGID == CARGOGID && member.data.PORTDISCHARGEID == PORTDISCHARGEID
&& member.data.VESSELHEAD == VESSELHEAD
&& (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_Main.getCount(); i += 1) {
var member = this.storeDetail_Main.getAt(i);
if (member.data.CARGOGID == CARGOGID && member.data.PORTDISCHARGEID == ""
&& member.data.VESSELHEAD == VESSELHEAD
&& (member.data.VESSEL == "" || member.data.VESSEL == "ALL" || member.data.VESSEL == "All")) {
PLANDETAIL = member.data;
continue;
}
}
}
//如有 按其计算
if (PLANDETAIL == "") {
alert("当前运价方案中没有合适的运价内容");
return PLANDETAIL;
}
else {
return PLANDETAIL;
}
}
},
SetCargoPrice:function(PRICETYPE){
for (var i = 0; i < this.storeCargo.getCount(); i += 1) {
var member = this.storeCargo.getAt(i);
var PlanDetail="";
if (PRICETYPE=="分单"){
PLANDETAIL=this.getFenPlanDetail(member.data.CARGOGID);
}
if (PRICETYPE=="主单"){
PLANDETAIL=this.getMainPlanDetail(member.data.CARGOGID);
}
if (PLANDETAIL==""){
return;
}
WEIGHT=member.data.WEIGHT;
var PRICE=0;
if (WEIGHT < parseFloat(PLANDETAIL.MINWEIGHT)) {
WEIGHT = PLANDETAIL.MINWEIGHT;
}
if (WEIGHT < 45) {
PRICE = PLANDETAIL.W_N;
member.set('PRICETYPE',"N");
} else if (WEIGHT >= 45 && WEIGHT < 100) {
PRICE = PLANDETAIL.W_45;
member.set('PRICETYPE',"45");
} else if (WEIGHT >= 100 && WEIGHT < 300) {
PRICE = PLANDETAIL.W_100;
member.set('PRICETYPE',"100");
} else if (WEIGHT >= 300 && WEIGHT < 500) {
PRICE = PLANDETAIL.W_300;
member.set('PRICETYPE',"300");
} else if (WEIGHT >= 500 && WEIGHT < 1000) {
PRICE = PLANDETAIL.W_500;
member.set('PRICETYPE',"500");
} else if (WEIGHT >= 1000) {
PRICE = PLANDETAIL.W_1000;
member.set('PRICETYPE',"1000");
}
AMOUNT = Mul(PRICE, WEIGHT);
member.set('PRICE', PRICE);
if (parseFloat(AMOUNT) > parseFloat(PLANDETAIL.MINFEE)) {
//e.record.set('AMOUNT', AMOUNT);
} else {
AMOUNT = PLANDETAIL.MINFEE;
member.set('PRICETYPE',"M");
}
/*
if (parseFloat(AMOUNT) > parseFloat(PLANDETAIL.MINFEE)) {
e.record.set('AMOUNT', AMOUNT);
} else {
e.record.set('AMOUNT', PLANDETAIL.MINFEE);
}*/
member.set('AMOUNT',Math.round( AMOUNT) );
this.SetFee();
}
},
//#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('未锁定');
var myDate = new Date();
var mydatestr = Ext.util.Format.date(myDate, 'Y-m');
field = basicForm.findField('ACCDATE');
field.setValue(mydatestr);
this.LoadPeriod(this.opStatus);
field = basicForm.findField('MBLNO');
field.setValue('');
field = basicForm.findField('HBLNO');
field.setValue('');
//this.storeCargo.load({ params: { condition: " C.BSNO='" + data.BSNO + "'" } });
},
CopyNew: function () {
var basicForm2 = this.formHead.getForm();
if (!basicForm2.isValid()) {
return;
}
basicForm2.findField('BSNO').setDisabled(false);
let BSNO = 'topAirn' + NewGuid();
let field = basicForm2.findField('BSNO');
let oldbsno = field.getValue();
let oldmasterno = basicForm2.findField('MASTERNO').getValue();
field.setValue(BSNO);
if (oldbsno == oldmasterno) {
field = basicForm2.findField('MASTERNO');
field.setValue(BSNO);
}
basicForm2.findField('BSNO').setDisabled(true);
field = basicForm2.findField('MBLNO');
field.setValue('');
field = basicForm2.findField('HBLNO');
field.setValue('');
this.LoadPeriod(this.opStatus);
this.storeCargo.removeAll();
this.formEdit_2.getForm().reset();
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();
},
//#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 M_WEIGHT = parseFloat(e.record.get('M_WEIGHT'));
var CBM_WEIGHT = parseFloat(Mul(e.record.get('CBM'), "167"));
if (M_WEIGHT > CBM_WEIGHT) {
e.record.set('WEIGHT', M_WEIGHT);
e.record.set('WEIGHT_2', M_WEIGHT);
} else {
e.record.set('WEIGHT', CBM_WEIGHT);
e.record.set('WEIGHT_2', CBM_WEIGHT);
}
}
var WEIGHT = parseFloat(e.record.get('WEIGHT'));
if (e.field == 'WEIGHT'||e.field == 'CBM' ) {
if (WEIGHT > 0) {
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 = 0;
var AMOUNT = 0;
//如果没有合适的运价方案,提示
if (this.PRICETYPE=="分单")
{
PLANDETAIL=this.getFenPlanDetail(CARGOGID);
}else{
PLANDETAIL=this.getMainPlanDetail(CARGOGID);
}
if (PLANDETAIL==""){
return;
}
/*
if (this.storeDetail.count == 0 && (AIRLINES != null && AIRLINES != "" && ETD != null && ETD != "" && e.record.get('PRICETYPE')!="无" )) {
alert("目前没有符合条件的运价方案");
e.record.set('PRICETYPE',"无");
}
//如果有
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 < parseFloat(PLANDETAIL.MINWEIGHT)) {
WEIGHT = PLANDETAIL.MINWEIGHT;
}
if (WEIGHT < 45) {
PRICE = PLANDETAIL.W_N;
e.record.set('PRICETYPE',"N");
} else if (WEIGHT >= 45 && WEIGHT < 100) {
PRICE = PLANDETAIL.W_45;
e.record.set('PRICETYPE',"45");
} else if (WEIGHT >= 100 && WEIGHT < 300) {
PRICE = PLANDETAIL.W_100;
e.record.set('PRICETYPE',"100");
} else if (WEIGHT >= 300 && WEIGHT < 500) {
PRICE = PLANDETAIL.W_300;
e.record.set('PRICETYPE',"300");
} else if (WEIGHT >= 500 && WEIGHT < 1000) {
PRICE = PLANDETAIL.W_500;
e.record.set('PRICETYPE',"500");
} else if (WEIGHT >= 1000) {
PRICE = PLANDETAIL.W_1000;
e.record.set('PRICETYPE',"1000");
}
AMOUNT = Mul(PRICE, WEIGHT);
/*
if (WEIGHT < 100) {
var CUSTOMERNAME = this.formHead.getForm().findField('CUSTOMERNAME').getValue();
var ISVIP = "0";
var VIPDJ = "0";
var VIPDP = "0"
////////
var currrecords = DsStoreQueryBy(this.storeCustCode, 'CustName', CUSTOMERNAME);
if (currrecords.getCount() > 0) {
var currdata = currrecords.getAt(0).data;
ISVIP = currdata.ISVIP;
VIPDJ = currdata.VIPDJ;
VIPDP = currdata.VIPDP;
} else {
}
if (ISVIP == "1") {
AMOUNT = Add(AMOUNT, VIPDP);
}
}*/
e.record.set('PRICE', PRICE);
if (parseFloat(AMOUNT) > parseFloat(PLANDETAIL.MINFEE)) {
//e.record.set('AMOUNT', AMOUNT);
} else {
AMOUNT = PLANDETAIL.MINFEE;
e.record.set('PRICETYPE',"M");
}
/*
if (parseFloat(AMOUNT) > parseFloat(PLANDETAIL.MINFEE)) {
e.record.set('AMOUNT', AMOUNT);
} else {
e.record.set('AMOUNT', PLANDETAIL.MINFEE);
}*/
e.record.set('AMOUNT',Math.round( AMOUNT) );
this.SetFee();
//}
//如无 告警说没有合适的费用信息。
}
}
if (e.field == 'PRICE') {
if (WEIGHT > 0) {
var PRICE = e.record.get('PRICE');
var AMOUNT = Mul(PRICE, WEIGHT);
e.record.set('AMOUNT', Math.round(AMOUNT));
}
this.SetFee();
}
if (e.field == 'AMOUNT') {
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();
},
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
},
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);
}
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);
},
MakeFee: function (button, event) {
var _CustomerName = this.formHead.getForm().findField('CUSTOMERNAME').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);
}
} else {
Ext.Msg.show({ title: '请重试',
msg: '服务器响应出错',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
}
}
});
},
setChFee:function(_CustomerName,BSNO){
var BLTYPE = _this.formHead.getForm().findField('BLTYPE').getValue();
if (BLTYPE == "国内分单") {
var CFREIGHT = this.formEdit_2.getForm().findField('CFREIGHT').getValue();
if (parseFloat(CFREIGHT) > 0) {
this.addChFee(1, _CustomerName, BSNO, "RMB", "1", "空运费", CFREIGHT, 1, "到付空运费", "", "");
}
var CVALUEFEE = this.formEdit_2.getForm().findField('CVALUEFEE').getValue();
if (parseFloat(CVALUEFEE) > 0) {
this.addChFee(1, _CustomerName, BSNO, "RMB", "1", "声明价值附加费", CVALUEFEE, 1, "到付声明价值附加费", "", "");
}
var CCARRIEROT = this.formEdit_2.getForm().findField('CCARRIEROT').getValue();
if (parseFloat(CCARRIEROT) > 0) {
this.addChFee(1, _CustomerName, BSNO, "RMB", "1", "地面运费", CCARRIEROT, 1, "到付地面运费", "", "");
}
// var COTFREIGHT = this.formEdit_2.getForm().findField('COTFREIGHT').getValue();
// if (parseFloat(COTFREIGHT) > 0) {
// this.addChFee(1, _CustomerName, BSNO, "RMB", "1", "杂费", COTFREIGHT, 1, "到付杂费", "", "");
// }
///////////
var PFREIGHT = this.formEdit_2.getForm().findField('PFREIGHT').getValue();
if (parseFloat(PFREIGHT) > 0) {
this.addChFee(1, _CustomerName, BSNO, "RMB", "1", "空运费", PFREIGHT, 1, "预付空运费", "", "");
}
var PVALUEFEE = this.formEdit_2.getForm().findField('PVALUEFEE').getValue();
if (parseFloat(PVALUEFEE) > 0) {
this.addChFee(1, _CustomerName, BSNO, "RMB", "1", "声明价值附加费", PVALUEFEE, 1, "预付声明价值附加费", "", "");
}
var PCARRIEROT = this.formEdit_2.getForm().findField('PCARRIEROT').getValue();
if (parseFloat(PCARRIEROT) > 0) {
this.addChFee(1, _CustomerName, BSNO, "RMB", "1", "地面运费", PCARRIEROT, 1, "预付地面运费", "", "");
}
// var POTFREIGHT = this.formEdit_2.getForm().findField('POTFREIGHT').getValue();
// if (parseFloat(POTFREIGHT) > 0) {
// this.addChFee(1, _CustomerName, BSNO, "RMB", "1", "杂费", POTFREIGHT, 1, "预付杂费", "", "");
// }
//20220429 改为增加明细
for (var i = 1; i < 9; i += 1) {
var feename = this.GetOtFeeName(i);
var amount = this.GetOtFeeAmount(i);
if (feename != "" && amount != 0) {
this.addChFee(1, _CustomerName, BSNO, "RMB", "1", feename, amount, 1, "预付杂费", "", "");
}
}
}
},
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');
}
});
}
,
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 {
}
},
//#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 编辑时按钮等的状态
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');
if (enable) {
btnESave.enable();
btnESaveAndClose.enable();
btnESaveAndNew.enable();
} else {
btnESave.disable();
btnESaveAndClose.disable();
btnESaveAndNew.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';
var sql1 = "SET LANGUAGE 'us_english' SELECT * FROM op_Airn WHERE BSNO = '" + billNo + "'";
var sql2 = "";
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,
'WEIGHT_2': 0,
'CBM': 0,
'CBM_REMARK': '',
'PRICETYPE': '',
'PRICE': 0,
'AMOUNT': 0,
'PRICE_2': 0,
'AMOUNT_2': 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();
}
,
OprationSwap: function () {
var ret = new Array();
ret[0] = this.MainOpStatus;
ret[1] = [];
ret[2] = [];
ret[3] = this.formHead.getForm().findField('HBLNO').getValue();
ret[4] = 'OP_AIRN_Edit';
ret[5] = this.formHead.getForm();
ret[6] = this.formEdit.getForm();
return ret;
}
,
ImportBs: function () {
_this=this;
var BSNO = this.formHead.getForm().findField('BSNO').getValue();
var AIRLINES = this.formEdit.getForm().findField('AIRLINES').getValue();
if (AIRLINES != "" && AIRLINES != null) {
this.storeRECEIPT.load({
params: { strat:0,limit:9999,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 () {
var record="";
var newMBLNO=Ext.getCmp("newMBLNO").getValue();
var MASTERNO="";
for (var i = 0; i < _this.storeRECEIPT.getCount(); i += 1) {
var member = _this.storeRECEIPT.getAt(i);
if (member.data.TOTALNO==newMBLNO){
MASTERNO=member.data.GID;
}
}
_this.BeforeMakeMain(newMBLNO,MASTERNO);
//winCustomDataShow.close();
}
},
{
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);
}
});