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.

2602 lines
100 KiB
JavaScript

10 months ago
Ext.namespace('Shipping');
Shipping.MsOpRailwayEdit = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsOpRailwayEdit.superclass.constructor.call(this);
};
Ext.extend(Shipping.MsOpRailwayEdit, Ext.Panel, {
ParentWin: null,
OpStatus: 'add',
StoreList: null,
editRecord: null,
Editdata: null,
stroplb: '铁路运输',
initUIComponents: function () {
this.serialNo = 0;
//this.bodyDel = [];
this.itemindex = 1;
//#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.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/GetUserRefList' }
});
this.storeOpCode.load();
//客服
this.comboxCUSTSERVICE = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '客服',
store: this.storeOpCode,
forceSelection: true,
name: 'CUSTSERVICE',
valueField: 'UserName',
displayField: 'CodeAndName',
value: SHOWNAME
});
//揽货人
this.comboxSALE = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '揽货人',
store: this.storeOpCode,
forceSelection: true,
name: 'SALE',
valueField: 'UserName',
displayField: 'CodeAndName',
value: SHOWNAME
});
//操 作
this.comboxOP = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '操 作',
store: this.storeOpCode,
forceSelection: true,
name: 'OP',
valueField: 'UserName',
displayField: 'CodeAndName',
value: SHOWNAME
});
//单证
this.comboxDOC = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '单 证',
store: this.storeOpCode,
forceSelection: true,
name: 'DOC',
valueField: 'UserName',
displayField: 'CodeAndName',
value: SHOWNAME
});
//客户加载_委托单位
this.storeCustCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
this.storeCustCode.load({ params: { condition: "ISCONTROLLER='1'"} });
//委托单位
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.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: '客户财务',
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.storeCARRIER = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
this.storeCARRIER.load({ params: { condition: "ISCARRIER='1'"} });
//船公司
this.comboxCARRIER = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '承运人',
store: this.storeCARRIER,
// forceSelection: true,
name: 'CARRIER',
valueField: 'CustName',
displayField: 'CodeAndName'
});
//键值维护表_装运方式
this.StoreBLTYPE = Ext.create('Ext.data.Store', {
fields: ['BLTYPE']
});
this.StoreBLTYPE.add({ "BLTYPE": "铁路主票" });
this.StoreBLTYPE.add({ "BLTYPE": "铁路分票" });
this.StoreBLTYPE.add({ "BLTYPE": "铁路单票" });
this.comboxBLTYPE = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '装运方式',
store: this.StoreBLTYPE,
forceSelection: true,
name: 'BLTYPE',
valueField: 'BLTYPE',
displayField: 'BLTYPE',
value: '铁路单票'
});
//品名
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,
fieldLabel: '货物品名',
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: '来源明细',
store: this.storeSourceDetail,
flex: 0.5,
// 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,
flex: 0.5,
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: '包 装',
store: this.storeCodePackage,
name: 'KINDPKGS',
valueField: 'PKGS',
displayField: 'PKGS',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
var str_num = this.formEdit.getForm().findField('PKGS').getValue();
this.formEdit.getForm().findField('TOTALNO').setValue('SAY:' + ToEn(str_num).toUpperCase() + ' ' + combo.value + ' ONLY.');
}
}
}
});
// this.storeTransType = Ext.create('DsExt.ux.RefEnumStore', {});
// this.storeTransType.load({ params: { enumTypeId: 97013} });
// this.comboxTransType = Ext.create('DsExt.ux.RefEnumCombox', {
// fieldLabel: '发运形式',
// store: this.storeTransType,
// forceSelection: true,
// name: 'TRANSTYPE'
// });
this.storeTSysEnumValueCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.TSysEnumValueDataModel',
proxy: { url: '/CommMng/BasicDataRef/GetTSysEnumValueList' }
});
this.storeTSysEnumValueCode.load({ params: { condition: " and EnumTypeID=96004"} });
this.comboxTRANSTYPE = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '运输类型',
store: this.storeTSysEnumValueCode,
forceSelection: true,
name: 'TRANSTYPE',
valueField: 'EnumValueName',
displayField: 'EnumValueName'
});
this.storeTransDirect = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeTransDirect.load({ params: { enumTypeId: 97014} });
this.comboxTransDirect = Ext.create('DsExt.ux.RefEnumCombox', {
fieldLabel: '发车方向',
store: this.storeTransDirect,
forceSelection: true,
name: 'TRANSDIRECT'
});
this.storeCtnSource = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeCtnSource.load({ params: { enumTypeId: 97015} });
this.comboxCtnSource = Ext.create('DsExt.ux.RefEnumCombox', {
fieldLabel: '箱源',
store: this.storeCtnSource,
forceSelection: true,
name: 'CTNSOURCE'
});
this.storeCtnReType = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeCtnReType.load({ params: { enumTypeId: 97016} });
this.comboxCtnReType = Ext.create('DsExt.ux.RefEnumCombox', {
fieldLabel: '返箱方式',
store: this.storeCtnReType,
forceSelection: true,
name: 'RECTNTYPE'
});
//箱型_集装箱列表中的下拉框加载
this.storeCodeCtn = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CodeCtnModel',
proxy: { url: '/CommMng/BasicDataRef/GetCodeCtnList' }
});
this.storeCodeCtn.load();
this.comboxCTNALL = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '箱型',
store: this.storeCodeCtn,
forceSelection: true,
name: 'CTNALL',
valueField: 'CTN',
displayField: 'CTN'
});
this.StoreStlName = Ext.create('Ext.data.Store', {
fields: ['STLNAME']
});
this.StoreStlName.add({ "STLNAME": "票结" });
this.StoreStlName.add({ "STLNAME": "半月结" });
this.StoreStlName.add({ "STLNAME": "月结" });
this.StoreStlName.add({ "STLNAME": "周结" });
this.comboxStlName = Ext.create('DsExt.ux.RefTableCombox', {
store: this.StoreStlName,
fieldLabel: '结算方式',
forceSelection: true,
name: 'STLNAME',
valueField: 'STLNAME',
displayField: 'STLNAME'
});
this.storeSaleCompany = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsCompanysEntity',
proxy: { url: '/MvcShipping/MsCompanys/GetNoPicDataList' }
});
this.storeSaleCompany.load({ params: { condition: "" } });
this.comboxSaleCompany = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '所属分部', //'委托分公司',
store: this.storeSaleCompany,
forceSelection: true,
name: 'SALECORPID',
valueField: 'GID',
displayField: 'NAME'
});
//#endregion
//#region 编辑formHead 基本信息
this.formHead = Ext.widget('form', {
region: 'north',
frame: true,
bodyPadding: 5,
collapsed: false,
collapsible: true,
trackResetOnLoad: true,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 80,
msgTarget: 'qtip'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '业务编号',
name: 'BSNO', hidden: true
}, {
fieldLabel: 'INPUTBY',
name: 'INPUTBY', hidden: true
}, {
fieldLabel: 'CREATETIME',
name: 'CREATETIME', hidden: true
}, {
fieldLabel: 'CNTRNO',
name: 'CNTRNO', hidden: true
}, {
fieldLabel: '业务锁定',
disabled: true,
readOnly: true,
name: 'BSSTATUSREF'
}, {
fieldLabel: '费用锁定',
readOnly: true,
disabled: true,
name: 'FEESTATUSREF'
}, {
fieldLabel: '会计期间',
xtype: 'monthfield',
name: 'ACCDATE'
}, this.comboxBLTYPE]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxCustCode, this.comboxBSSOURCE, this.comboxBSSOURCEDETAIL, this.comboxDept, this.comboxSaleCompany]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxOP, this.comboxSALE, this.comboxDOC, this.comboxCUSTSERVICE]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: 'JOB NO.',
allowBlank: true,
name: 'CUSTNO'
}, {
fieldLabel: '客户参考信息',
name: 'ORDERNO'
}, {
fieldLabel: '主运单号',
name: 'MBLNO'
}, {
fieldLabel: '运输号码',
name: 'TRANSNO'
}, {
fieldLabel: '分运单号',
name: 'HBLNO'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxTRANSTYPE, this.comboxTransDirect, this.comboxStlName, {
fieldLabel: '结算日期',
format: 'Y-m-d',
flex: 1,
xtype: 'datefield',
name: 'STLDATE'
}, {
fieldLabel: '发票号',
name: 'INVNO'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxInfoClientContact, {
fieldLabel: 'TEL',
name: 'OPERATORTEL'
}, this.comboxClientFCContact, {
fieldLabel: 'TEL',
name: 'FINANCIALSTAFFTEL'
}]
}
]//end items(fieldset 1)
}); //end this.formEdit
//#endregion
this.storeCodeRECEIPT = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsCodeRailwayPort',
proxy: { url: '/MvcShipping/MsOpRailway/GetPortList' }
});
this.storeCodeRECEIPT.load();
this.comboxRECEIPT = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '收货地',
store: this.storeCodeRECEIPT,
// forceSelection: true,
name: 'PlACERECEIPT',
valueField: 'PORTENAME',
displayField: 'CODEANDNAME'
});
//国际港口(进口装货港、出口卸货港)
this.storeCodeDisport = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsCodeRailwayFrPort',
proxy: { url: '/MvcShipping/MsOpRailway/GetFrPortList' }
});
this.storeCodeDisport.load();
//国内港口(出口装货港、进口卸货港)
this.storeCodeLoadport = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsCodeRailwayPort',
proxy: { url: '/MvcShipping/MsOpRailway/GetPortList' }
});
this.storeCodeLoadport.load();
this.comboxPORTLOAD = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '发货站',
store: this.storeCodeLoadport,
// forceSelection: true,
name: 'PLACELOAD',
valueField: 'PORTCNAME',
displayField: 'CODEANDNAME',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
var selectrecords = DsStoreQueryBy(this.storeCodeLoadport, 'PORTCNAME', combo.value);
if (selectrecords.getCount() > 0) {
var selectdata = selectrecords.getAt(0).data;
this.formEdit.getForm().findField('PLACELOADID').setValue(selectdata.PORTID);
this.formEdit.getForm().findField('PLACELOADENAME').setValue(selectdata.PORTENAME);
} else {
this.formEdit.getForm().findField('PLACELOADID').setValue('');
this.formEdit.getForm().findField('PLACELOADENAME').setValue('');
}
}
}
}
});
this.comboxPORTDISCHARGE = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '到达站',
store: this.storeCodeDisport,
// forceSelection: true,
name: 'DESTINATIONENAME',
valueField: 'PORTENAME',
displayField: 'CODEANDNAME',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
var selectrecords = DsStoreQueryBy(this.storeCodeDisport, 'PORTENAME', combo.value);
if (selectrecords.getCount() > 0) {
var selectdata = selectrecords.getAt(0).data;
this.formEdit.getForm().findField('DESTINATIONID').setValue(selectdata.PORTID);
this.formEdit.getForm().findField('DESTINATION').setValue(selectdata.PORTCNAME);
var portdetail = selectdata.COUNTRYCODE + selectdata.PORTCNAME + ',' + selectdata.COUNTRYRCODE + selectdata.PORTRNAME + ',код:' + selectdata.PORTID;
this.formEdit.getForm().findField('DESTINATIONDETAIL').setValue(portdetail);
} else {
this.formEdit.getForm().findField('DESTINATIONID').setValue('');
this.formEdit.getForm().findField('DESTINATION').setValue('');
this.formEdit.getForm().findField('DESTINATIONDETAIL').setValue('');
}
}
}
}
});
this.StorePLACETRANSIT = Ext.create('Ext.data.Store', {
fields: ['PORT', 'PORTID']
});
this.StorePLACETRANSIT.add({ "PORT": "Dostyk-eks", "PORTID": "ALASHANKOU" });
this.StorePLACETRANSIT.add({ "PORT": "Grodekovo", "PORTID": "SUIFENHE" });
this.StorePLACETRANSIT.add({ "PORT": "Dzamiin-Üüd", "PORTID": "ERLIAN" });
this.StorePLACETRANSIT.add({ "PORT": "Zabaykal'sk", "PORTID": "MANZHOULI" });
this.StorePLACETRANSIT.add({ "PORT": "Xinuiju", "PORTID": "DANDONG" });
this.StorePLACETRANSIT.add({ "PORT": "Brest-Tsentral'nny(V PNR)", "PORTID": "PINGXIANG" });
this.StorePLACETRANSIT.add({ "PORT": "Altynko-eks", "PORTID": "HORGOS" });
this.StorePLACETRANSIT.add({ "PORT": "Huoerguosi Port", "PORTID": "HORGOS2" });
this.comboxPLACETRANSIT = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '边境口岸',
store: this.StorePLACETRANSIT,
forceSelection: true,
name: 'PLACETRANSIT',
valueField: 'PORTID',
displayField: 'PORT',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
var selectrecords = DsStoreQueryBy(this.StorePLACETRANSIT, 'PORTID', combo.value);
if (selectrecords.getCount() > 0) {
var selectdata = selectrecords.getAt(0).data;
this.formEdit.getForm().findField('PLACETRANSITENAME').setValue(selectdata.PORT);
} else {
this.formEdit.getForm().findField('PLACETRANSITENAME').setValue('');
}
}
}
}
});
this.storeCodeTransPort = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsCodeRailwayPort',
proxy: { url: '/MvcShipping/MsOpRailway/GetPortList' }
});
this.storeCodeTransPort.load();
this.comboxTransport = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '中转地',
store: this.storeCodeTransPort,
// forceSelection: true,
name: 'FRPLACETRANSIT',
valueField: 'PORTENAME',
displayField: 'CODEANDNAME'
});
this.formBasic = Ext.widget('form', {
region: 'north',
title: '业务基本信息',
frame: true,
bodyPadding: 0,
collapsed: false,
collapsible: true,
trackResetOnLoad: true,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 80,
msgTarget: 'qtip'
},
items: [
{//fieldset 1
xtype: 'fieldset',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxCTNALL, {
fieldLabel: '箱量',
name: 'CTNNUM'
}, this.comboxCtnSource, this.comboxCtnReType, {
fieldLabel: '订舱日期',
format: 'Y-m-d',
flex: 1,
xtype: 'datefield',
name: 'BSDATE'
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxRECEIPT, this.comboxPORTLOAD, {
fieldLabel: '发货地代码',
hidden: true,
name: 'PLACELOADID'
}, {
fieldLabel: '发货地英文',
hidden: true,
name: 'PLACELOADENAME'
}, this.comboxPLACETRANSIT, {
fieldLabel: '山口站代码',
hidden: true,
name: 'PLACETRANSITID'
}, {
fieldLabel: '山口站',
hidden: true,
name: 'PLACETRANSITENAME'
}, this.comboxTransport, this.comboxPORTDISCHARGE
]//end items(fieldset 1)
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '到达站代码',
name: 'DESTINATIONID'
}, {
fieldLabel: '到达站中文',
name: 'DESTINATION'
}, , {
fieldLabel: '到达站描述',
flex: 2,
name: 'DESTINATIONDETAIL'
}, { xtype: 'hiddenfield' }
]//end items(fieldset 1)
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '件数',
name: 'PKGS'
}, this.comboxKINDPKGS, {
fieldLabel: '重量',
name: 'KGS'
}, {
fieldLabel: '尺码',
name: 'CBM'
}, this.comboxGOODSNAME
]//end items(fieldset 1)
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
xtype: 'textareafield',
grow: true,
height: 65,
fieldLabel: '备注',
name: 'REMARK',
anchor: '100%'
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
}]
}); //
//#region 集装箱-数据集
this.comboxCTNALL2 = Ext.create('DsExt.ux.RefTableCombox', {
//fieldLabel: '箱型',
store: this.storeCodeCtn,
forceSelection: true,
valueField: 'CTN',
displayField: 'CTN'
});
this.storeBodyCtnList = Ext.create('Ext.data.Store', {
model: 'MsOpSeaeDetail',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsOpSeae/GetBodyList',
reader: {
id: 'BsNo,CTNCODE,CTN_ID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//明细表表格
this.gridListCtnCellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});
this.gridListCtn = new Ext.grid.GridPanel({
store: this.storeBodyCtnList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
plugins: [this.gridListCtnCellEditing],
selType: 'cellmodel',
tbar: [{
text: '增加',
tooltip: '增加',
id: "btnadddctn",
iconCls: "btnadddetail",
handler: function (button, event) {
this.onAddCtnClick(button, event);
},
scope: this
}, '-', {
text: '删除',
tooltip: '删除',
id: "btndelctn",
iconCls: "btndeletedetail",
handler: function (button, event) {
this.deleteCtn(button, event);
},
scope: this
}],
columns: [{
sortable: true,
dataIndex: 'CTN_ID',
header: '编号',
hidden: true,
width: 0
}, {
sortable: true,
dataIndex: 'BSNO',
header: '业务编号',
hidden: true,
width: 0
}, {
dataIndex: 'CTNALL',
header: '箱型',
width: 48,
editor: this.comboxCTNALL2
}, {
dataIndex: 'CNTRNO',
header: '箱号',
width: 120,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
}]
});
//#endregion
this.panelBodyCtn = new Ext.Panel({
title: '集装箱信息',
layout: "border",
region: "west",
width: 220,
//margin: '5 10',
frame: true,
items: [this.gridListCtn]
});
//#region 运踪管理-数据集
this.StoreCTNEF = Ext.create('Ext.data.Store', {
fields: ['CTNEF']
});
this.StoreCTNEF.add({ "CTNEF": "Full" });
this.StoreCTNEF.add({ "CTNEF": "Empty" });
this.comboxCTNEF = Ext.create('DsExt.ux.RefTableCombox', {
store: this.StoreCTNEF,
forceSelection: true,
name: 'EFCNTR',
valueField: 'CTNEF',
displayField: 'CTNEF',
value: 'Full'
});
this.comboxCNTRNO = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeBodyCtnList,
name: 'CNTRNO',
valueField: 'CNTRNO',
displayField: 'CNTRNO'
});
this.storeCodeLocation = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsCodeRailwayFrPort',
proxy: { url: '/MvcShipping/MsOpRailway/GetAllPortList' }
});
this.storeCodeLocation.load();
this.comboxLOCATION = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeCodeLocation,
forceSelection: true,
name: 'LOCATION',
valueField: 'PORTENAME',
displayField: 'CODEANDNAME'
});
this.storecoderailwaytracking = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsCodeRailwayTracking',
proxy: { url: '/MvcShipping/MsOpRailway/GetCodeTrackingList' }
});
this.storecoderailwaytracking.load();
this.comboxACTIVITY = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storecoderailwaytracking,
forceSelection: true,
name: 'ACTIVITY',
valueField: 'TRACKINGCODE',
displayField: 'TRACKINGCODE'
});
this.storeBodyList = Ext.create('Ext.data.Store', {
model: 'MsOpRailwayTracking',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsOpRailway/GetBodyTrackingList',
reader: {
id: 'TK_ID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//明细表表格
this.gridListCellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});
this.initctncolumns = [{
sortable: true,
dataIndex: 'TK_ID',
header: '编号',
hidden: true,
width: 0
}, {
sortable: true,
dataIndex: 'BSNO',
header: '业务编号',
hidden: true,
width: 0
}, {
dataIndex: 'CNTRNO',
header: 'CNTR NO',
width: 100,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
}, {
dataIndex: 'EFCNTR',
header: 'Empty/Full',
width: 70,
editor: this.comboxCTNEF
}, {
dataIndex: 'TRAINNO',
header: 'CN Wagon#',
width: 150,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
}, {
dataIndex: 'FRTRAINNO',
header: 'CIS Wagon#',
width: 150,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
}, {
dataIndex: 'ACTIVITY',
header: 'Activity',
width: 150,
editor: this.comboxACTIVITY
}, {
dataIndex: 'LOCATION',
header: 'Location',
width: 150,
editor: this.comboxLOCATION
}, {
dataIndex: 'LOCATIONID',
header: 'Location(RU)',
width: 150,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
}, {
sortable: true,
dataIndex: 'TRACKDATE',
header: 'Date',
allowBlank: false,
editor: {
xtype: 'datefield',
format: 'Y-m-d',
selectOnFocus: true
},
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
width: 120
}, {
dataIndex: 'DISTANCE',
header: 'To Border',
width: 80,
editor: {
xtype: 'numberfield',
selectOnFocus: true
}
}, {
dataIndex: 'DISTANCEDEST',
header: 'To Destination',
width: 80,
editor: {
xtype: 'numberfield',
selectOnFocus: true
}
}, {
dataIndex: 'REMARK',
header: 'Remark',
width: 250,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
}];
this.ctncolumns = this.initctncolumns;
this.gridList = new Ext.grid.GridPanel({
store: this.storeBodyList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
plugins: [this.gridListCellEditing],
selType: 'cellmodel',
tbar: [{
text: '增加明细',
tooltip: '增加明细',
id: "btnadddetail",
iconCls: "btnadddetail",
handler: function (button, event) {
this.onAddDetailClick(button, event);
},
scope: this
}, '-', {
text: '删除明细',
tooltip: '删除明细',
id: "btndeldetail",
iconCls: "btndeletedetail",
handler: function (button, event) {
this.onDelDetailClick(button, event);
},
scope: this
}, '-', {
text: "保存列表样式", //"保存列表样式",
menu: [
{
text: "保存", //"保存",
handler: function (button, event) {
_this.ctncolumns = DsTruck.SaveGridPanel(USERID, 'RAILWAYCTN', _this.gridList.columns, _this.ctncolumns, 0, true);
_this.gridList.reconfigure(this.storeBodyList, _this.ctncolumns);
}
}, {
text: "初始化", //"初始化",
handler: function (menu, event) {
_this.gridList.reconfigure(this.storeBodyList, _this.initctncolumns);
_this.ctncolumns = DsTruck.SaveGridPanel(USERID, 'RAILWAYCTN', _this.gridList.columns, _this.initctncolumns, 0, true);
}
}],
scope: this
}],
columns: this.ctncolumns
});
this.ctncolumns = DsTruck.GetGridPanel(USERID, 'RAILWAYCTN', this.ctncolumns, 1); //使用者id表名中间column数组跳过一开始的几列
this.gridList.reconfigure(this.storeBodyList, this.ctncolumns);
//#endregion
this.panelBodyTrack = new Ext.Panel({
title: '运踪信息',
layout: "border",
region: "center",
frame: true,
items: [this.gridList]
});
this.panelBody = new Ext.Panel({
layout: "border",
region: "center",
frame: true,
items: [this.panelBodyCtn, this.panelBodyTrack]
});
//#region 编辑formEdit 基本信息
this.formEdit = Ext.widget('form', {
region: 'north',
frame: true,
bodyPadding: 0,
layout: 'anchor',
trackResetOnLoad: true,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 70,
msgTarget: 'qtip'
},
items: [this.formBasic]
}); //end this.formEdit
//#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');
},
scope: this
}, {
id: 'btnESaveAndClose',
text: "保存并关闭",
handler: function (button, event) {
this.Save('1');
},
scope: this
}, {
id: 'btnESaveAndNew',
text: "保存并新建",
handler: function (button, event) {
this.Save('2');
},
scope: this
}, {
id: 'btnECopyNew',
text: "复制新建",
handler: function (button, event) {
var btnESave = Ext.getCmp('btnESave');
if (btnESave.isDisabled()) {
var basicForm = this.formHead.getForm();
this.opStatus = 'add';
basicForm.findField('BSNO').setDisabled(false);
var field = basicForm.findField('BSNO');
field.setValue('railway' + NewGuid());
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.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 == 'pnlmodNewOpSeaeInfo') {
// this.tabSeaepanel.setActiveTab(i);
} else {
children.items[i].close();
}
}
}
}
this.tabSeaepanel.doLayout();
} else {
this.CopyNew();
}
},
scope: this
}, '-', {
text: "关闭",
handler: function (button, event) {
window.close();
},
scope: this
}, {
text: "新建",
handler: function (button, event) {
this.LoadData('add', '');
var basicForm = this.formEdit.getForm();
basicForm.findField('BsNo').setDisabled(false);
},
scope: this
}, '-', {
text: "打印",
iconCls: "btnprint",
handler: function (button, event) {
this.Print();
},
scope: this
}]
}); //end 按钮Toolbar
//#endregion
//#region 框架结构
this.panelpage = new Ext.Panel({
title: '委托详细信息',
layout: "border",
region: 'center',
animate: true,
autoScroll: true,
// containerScroll: true,
frame: false,
items: [this.formEdit, this.panelBody]
});
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: 'pnlmodNewOpRailwayInfo',
layout: "border",
region: 'center',
animate: true,
autoScroll: true,
frame: false,
//closable:true,
items: [this.panelBtn, this.formHead, this.tabSeaeWTpanel]
});
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: '050EC856-95E8-4C54-A153-0DB16B296F53'
}
});
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('CUSTNO').getValue() == "") {
Ext.Msg.show({ title: '注意', msg: '请先保存业务信息后再打开其他模块!', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
} else {
if (record.data.NAME == 'modRailwayAllFee') {
var paneltabitems = new Shipping.RailwayFee({
id: 'pnl' + record.data.NAME,
layout: "border",
region: "center",
autoScroll: true,
frame: false,
closable: true,
title: record.data.DESCRIPTION
});
} else if (record.data.NAME == 'modRailwayAmendFee') {
var paneltabitems = new Shipping.RailwayAmendFee({
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.MsOpRailwayBillIndex({
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 == "pnlmodRailwayAllFee") {
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 == "pnlmodRailwayAmendFee") {
var feemodify = oldCard.panelFee.getModifyStatus();
if (feemodify) {
Ext.Msg.show({ title: '警告', msg: '费用未保存,请先保存费用!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
return false;
}
}
}
}
});
Ext.apply(this, {
items: [this.tabtree, this.tabSeaepanel]
});
//#endregion
//#region 其他
parentWin = window.parent.opener;
this.InitData();
//绑定事件
this.gridList.on('edit', function (editor, e, eOpts) {
this.gridAfterEdit(editor, e, eOpts);
}, this);
this.gridListCtn.on('edit', function (editor, e, eOpts) {
this.CtnGridAfterEdit(editor, e, eOpts);
}, this);
//#endregion
}, //end initUIComponents
//#region 加载事件
InitData: function () {
this.opStatus = 'add';
var condition = '';
_this = this;
if (parentWin) {
var ret = parentWin.OprationSwap();
this.opStatus = ret[0];
this.StoreList = ret[1];
this.editRecord = ret[2];
}
if (this.opStatus == 'edit') {
condition = "BSNO='" + this.editRecord.get('BSNO') + "'";
}
this.LoadData(this.opStatus, condition);
this.LoadMustBe();
}, //end InitData
LoadData: function (opstatus, condition) {
this.serialNo = 0;
//this.bodyDel = [];
this.opStatus = opstatus;
Ext.Ajax.request({
waitMsg: '正在查询主表数据...',
url: '/MvcShipping/MsOpRailway/GetData',
params: {
handle: opstatus,
condition: condition
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
Ext.Msg.show({
title: '提示',
msg: result.Message,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
return;
}
data = result.data;
this.formHead.getForm().reset();
this.formHead.getForm().setValues(data);
this.formEdit.getForm().reset();
this.formEdit.getForm().setValues(data);
if (this.opStatus == 'add') {
this.LoadDefValue();
}
this.LoadInit(data);
this.Editdata = data;
this.GetEditStatus();
this.LoadPeriod(this.opStatus);
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
var billno = '*';
var gid = '*';
if (this.opStatus == 'edit') {
this.storeBodyList.load({ params: { condition: condition, isfirst: false} });
this.storeBodyCtnList.load({ params: { condition: condition} });
} else {
condition = "BSNO='xx'";
}
}, // end LoadDate
//#endregion
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 ACCDATE = this.formHead.getForm().findField('ACCDATE').getValue();
var FEESTATUSREF = this.formHead.getForm().findField('FEESTATUSREF').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);
}
}
if (FEESTATUSREF == '锁定') {
this.formHead.getForm().findField('ACCDATE').setReadOnly(true);
}
},
//#region 保存
Save: function (type) {
var basicForm = this.formEdit.getForm();
var basicForm2 = this.formHead.getForm();
if (!basicForm.isValid()) {
return;
}
if (!basicForm2.isValid()) {
return;
}
//
//
this.formHead.getForm().findField('BSNO').setDisabled(false);
var data = this.formHead.getForm().getValues(false, false, false);
var data2 = this.formEdit.getForm().getValues(false, false, false);
this.formHead.getForm().findField('BSNO').setDisabled(true);
var bodydatas = [];
for (var i = 0; i < this.storeBodyList.getCount(); i += 1) {
var member = this.storeBodyList.getAt(i);
bodydatas.push(member);
}
//
var jsonBody = ConvertRecordsToJsonAll(bodydatas);
var Ctnbodydatas = [];
for (var i = 0; i < this.storeBodyCtnList.getCount(); i += 1) {
var member = this.storeBodyCtnList.getAt(i);
Ctnbodydatas.push(member);
}
//
var jsonCtnBody = ConvertRecordsToJsonAll(Ctnbodydatas);
//
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/MvcShipping/MsOpRailway/Save',
scope: this,
params: {
opstatus: this.opStatus,
data: Ext.JSON.encode(data),
data2: Ext.JSON.encode(data2),
body: jsonBody,
ctnbody: jsonCtnBody
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
var returnData = jsonresult.Data;
this.formEdit.getForm().reset();
this.formEdit.getForm().setValues(returnData);
this.formHead.getForm().reset();
this.formHead.getForm().setValues(returnData);
this.Editdata = returnData;
//
if (this.opStatus == 'add') {
var arrNewRecords = this.StoreList.add(returnData);
this.editRecord = arrNewRecords[0];
}
else if (this.opStatus == 'edit') {
var editp = Ext.create('MsOpRailwayModel', returnData);
this.editRecord.fields.each(function (field) {
if (field.persist) {
name = field.name;
if (name != 'id')
this.editRecord.set(name, editp.get(name));
}
}, this);
this.editRecord.commit();
}
if (type == '0') {
this.opStatus = 'edit';
basicForm2.findField('BSNO').setDisabled(true);
for (var j = 0; j < this.storeBodyList.getCount(); j += 1) {
var memberbody = this.storeBodyList.getAt(j);
memberbody.set("BSNO", this.editRecord.get('BSNO'));
memberbody.commit();
};
for (var j = 0; j < this.storeBodyCtnList.getCount(); j += 1) {
var memberbody = this.storeBodyCtnList.getAt(j);
memberbody.set("BSNO", this.editRecord.get('BSNO'));
memberbody.commit();
};
} 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 复制新建
CopyNew: function () {
var basicForm = this.formEdit.getForm();
var basicForm2 = this.formHead.getForm();
if (!basicForm.isValid()) {
return;
}
if (!basicForm2.isValid()) {
return;
}
this.formHead.getForm().findField('BSNO').setDisabled(false);
var data = this.formHead.getForm().getValues(false, false, false);
var data2 = this.formEdit.getForm().getValues(false, false, false);
this.formHead.getForm().findField('BSNO').setDisabled(true);
//
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/MvcShipping/MsOpRailway/Save',
scope: this,
params: {
opstatus: this.opStatus,
data: Ext.JSON.encode(data),
data2: Ext.JSON.encode(data2)
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
var returnData = jsonresult.Data;
this.formEdit.getForm().reset();
this.formEdit.getForm().setValues(returnData);
this.formHead.getForm().reset();
this.formHead.getForm().setValues(returnData);
//
if (this.opStatus == 'add') {
var arrNewRecords = this.StoreList.add(returnData);
this.editRecord = arrNewRecords[0];
}
else if (this.opStatus == 'edit') {
var editp = Ext.create('MsOpRailwayModel', 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();
}
var basicForm = this.formHead.getForm();
this.opStatus = 'add';
basicForm.findField('BSNO').setDisabled(false);
var field = basicForm.findField('BSNO');
field.setValue('topseae' + NewGuid());
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.storeBodyList.removeAll();
this.storeBodyCtnList.removeAll();
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 == 'pnlmodNewOpRailwayInfo') {
// this.tabSeaepanel.setActiveTab(i);
} else {
children.items[i].close();
}
}
}
}
this.tabSeaepanel.doLayout();
} 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 集装箱按钮事件
onAddDetailClick: function (button, event) {
this.addDetail();
}, //end onAddDetailClick
onDelDetailClick: function (button, event) {
this.deleteDetail();
}, //onDelDetailClick
onUpDetailClick: function (button, event) {
this.UpDetail();
}, //end onAddDetailClick
CtnGridAfterEdit: function (editor, e, eOpts) {
//需要自己实现里面的事件
if (e.field == 'CNTRNO') {
this.formHead.getForm().findField('CNTRNO').setValue(e.value);
}
},
gridAfterEdit: function (editor, e, eOpts) {
if (e.value == e.originalValue) return;
if (e.field == 'LOCATION') {
var LOCATION = e.record.data['LOCATION'];
var PLACETRANSIT = this.formEdit.getForm().findField('PLACETRANSIT').getValue();
var DESTINATIONENAME = this.formEdit.getForm().findField('DESTINATIONENAME').getValue();
var selectrecords = DsStoreQueryBy(this.storeCodeLocation, 'PORTENAME', LOCATION);
if (selectrecords.getCount() > 0) {
var selectdata = selectrecords.getAt(0).data;
var porttype = selectdata.PORTTYPE;
e.record.set('LOCATIONID', selectdata.PORTRNAME);
if (porttype == 'T') {
e.record.set('DISTANCE', 0);
var destrecords = DsStoreQueryBy(this.storeCodeLocation, 'PORTENAME', DESTINATIONENAME);
if (PLACETRANSIT == 'ALASHANKOU') {
if (destrecords.getCount() > 0) {
var destdata = destrecords.getAt(0).data;
e.record.set('DISTANCEDEST', parseFloat(destdata.DTALSHANKOU) - parseFloat(selectdata.DTALSHANKOU));
}
} else if (PLACETRANSIT == 'SUIFENHE') {
if (destrecords.getCount() > 0) {
var destdata = destrecords.getAt(0).data;
e.record.set('DISTANCEDEST', parseFloat(destdata.DTSUIFENHE) - parseFloat(selectdata.DTSUIFENHE));
}
} else if (PLACETRANSIT == 'ERLIAN') {
if (destrecords.getCount() > 0) {
var destdata = destrecords.getAt(0).data;
e.record.set('DISTANCEDEST', parseFloat(destdata.DTERLIAN) - parseFloat(selectdata.DTERLIAN));
}
} else if (PLACETRANSIT == 'MANZHOULI') {
if (destrecords.getCount() > 0) {
var destdata = destrecords.getAt(0).data;
e.record.set('DISTANCEDEST', parseFloat(destdata.DTMANZHOULI) - parseFloat(selectdata.DTMANZHOULI));
}
} else if (PLACETRANSIT == 'DANDONG') {
if (destrecords.getCount() > 0) {
var destdata = destrecords.getAt(0).data;
e.record.set('DISTANCEDEST', parseFloat(destdata.DTDANDONG) - parseFloat(selectdata.DTDANDONG));
}
} else if (PLACETRANSIT == 'PINGXIANG') {
if (destrecords.getCount() > 0) {
var destdata = destrecords.getAt(0).data;
e.record.set('DISTANCEDEST', parseFloat(destdata.DTPINGXIANG) - parseFloat(selectdata.DTPINGXIANG));
}
} else if (PLACETRANSIT == 'HORGOS') {
if (destrecords.getCount() > 0) {
var destdata = destrecords.getAt(0).data;
e.record.set('DISTANCEDEST', parseFloat(destdata.DTHORGOS) - parseFloat(selectdata.DTHORGOS));
}
}
} else {
var destrecords = DsStoreQueryBy(this.storeCodeLocation, 'PORTENAME', DESTINATIONENAME);
if (PLACETRANSIT == 'ALASHANKOU') {
e.record.set('DISTANCE', selectdata.DTALSHANKOU);
if (destrecords.getCount() > 0) {
var destdata = destrecords.getAt(0).data;
e.record.set('DISTANCEDEST', parseFloat(selectdata.DTALSHANKOU) + parseFloat(destdata.DTALSHANKOU));
}
} else if (PLACETRANSIT == 'SUIFENHE') {
e.record.set('DISTANCE', selectdata.DTSUIFENHE);
if (destrecords.getCount() > 0) {
var destdata = destrecords.getAt(0).data;
e.record.set('DISTANCEDEST', parseFloat(selectdata.DTSUIFENHE) + parseFloat(destdata.DTSUIFENHE));
}
} else if (PLACETRANSIT == 'ERLIAN') {
e.record.set('DISTANCE', selectdata.DTERLIAN);
if (destrecords.getCount() > 0) {
var destdata = destrecords.getAt(0).data;
e.record.set('DISTANCEDEST', parseFloat(selectdata.DTERLIAN) + parseFloat(destdata.DTERLIAN));
}
} else if (PLACETRANSIT == 'MANZHOULI') {
e.record.set('DISTANCE', selectdata.DTMANZHOULI);
if (destrecords.getCount() > 0) {
var destdata = destrecords.getAt(0).data;
e.record.set('DISTANCEDEST', parseFloat(selectdata.DTMANZHOULI) + parseFloat(destdata.DTMANZHOULI));
}
} else if (PLACETRANSIT == 'DANDONG') {
e.record.set('DISTANCE', selectdata.DTDANDONG);
if (destrecords.getCount() > 0) {
var destdata = destrecords.getAt(0).data;
e.record.set('DISTANCEDEST', parseFloat(selectdata.DTDANDONG) + parseFloat(destdata.DTDANDONG));
}
} else if (PLACETRANSIT == 'PINGXIANG') {
e.record.set('DISTANCE', selectdata.DTPINGXIANG);
if (destrecords.getCount() > 0) {
var destdata = destrecords.getAt(0).data;
e.record.set('DISTANCEDEST', parseFloat(selectdata.DTPINGXIANG) + parseFloat(destdata.DTPINGXIANG));
}
} else if (PLACETRANSIT == 'HORGOS') {
e.record.set('DISTANCE', selectdata.DTHORGOS);
if (destrecords.getCount() > 0) {
var destdata = destrecords.getAt(0).data;
e.record.set('DISTANCEDEST', parseFloat(selectdata.DTHORGOS) + parseFloat(destdata.DTHORGOS));
}
}
}
} else {
e.record.set('DISTANCE', 0);
e.record.set('FRDISTANCE', 0);
e.record.set('LOCATIONID', '');
}
}
},
addDetail: function () {
//var newSerialno = DsGetNewSerialNo(this.storeBodyList, this.serialNo);
var newSerialno = this.DsGetNewNo(this.storeBodyList);
this.serialNo = newSerialno;
var selections = this.gridListCtn.getSelectionModel().getSelection();
var CNTRNO = '';
if (selections.length == 0) {
} else {
var record = selections[0];
CNTRNO = record.data.CNTRNO;
}
var myDate = new Date();
var mydatestr = Ext.util.Format.date(myDate, 'Y-m-d');
var record = Ext.create('MsOpRailwayTracking', {
TK_ID: NewGuid(),
BSNO: '*',
SORTNO: newSerialno,
TRAINNO: '',
CNTRNO: CNTRNO,
SEALNO: '',
ACTIVITY: '',
EFCNTR: '',
TRACKDATE: mydatestr,
LOCATION: '',
LOCATIONID: '',
DISTANCE: 0,
REMARK: ''
});
this.storeBodyList.add(record);
var n = this.storeBodyList.getCount();
this.gridListCellEditing.startEditByPosition({ row: n - 1, column: 2 });
},
DsGetNewNo: function (store) {
var result = store.getCount();
if (result == 0) {
return 1;
}
// var record = store.getAt(result - 1).data.CTNCODE;
result = result + 1;
return result;
},
deleteDetail: function () {
var BSSTATUS = this.formHead.getForm().findField('BSSTATUSREF').getValue();
if (BSSTATUS == '锁定') {
Ext.Msg.show({ title: '警告', msg: '业务已锁定,不允许操作!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
return;
}
//this.serialNo = DsGetCurSerialNo(this.storeBodyList, this.serialNo);
var selectedRecords = this.gridList.selModel.getSelection();
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (rec.data.BSNO == "" || rec.data.BSNO == "*")//如果是新增但没有保存的数据,没有必要提交到后台
{
this.storeBodyList.remove(selectedRecords[i]);
}
else {
Ext.MessageBox.confirm('提示', '确定删除该记录吗?', function (btn) {
if (btn == 'yes') {
Ext.Msg.wait('正在删除数据...');
Ext.Ajax.request({
waitMsg: '正在删除数据...',
url: '/MvcShipping/MsOpRailway/DeleteTrackingDetail',
params: {
body: Ext.JSON.encode(rec.data)
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
this.storeBodyList.remove(rec);
Ext.Msg.show({ title: '提示', msg: jsonresult.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
else {
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
}
},
failure: function (response, options) {
Ext.Msg.show({ title: '警告', msg: '服务器响应出错,请重试', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
},
scope: this
}); //end Ext.Ajax.request
}
}, this);
}
//this.storeBodyList.remove(selectedRecords[i]);
}
},
onAddCtnClick: function (button, event) {
var newSerialno = this.DsGetNewNo(this.storeBodyCtnList);
this.serialNo = newSerialno;
var CTNALL = this.formEdit.getForm().findField('CTNALL').getValue();
var record = Ext.create('MsOpSeaeDetail', {
CTN_ID: NewGuid(),
BSNO: '*',
CTNCODE: newSerialno,
CTNALL: CTNALL,
CTNNUM: 1,
CNTRNO: '',
SEALNO: '',
PKGS: 0,
KINDPKGS: '',
KGS: 0,
TAREWEIGHT: 0,
CBM: 0,
REMARK: ''
});
this.storeBodyCtnList.add(record);
var n = this.storeBodyCtnList.getCount();
this.gridListCtnCellEditing.startEditByPosition({ row: n - 1, column: 3 });
},
deleteCtn: function (button, event) {
var BSSTATUS = this.formHead.getForm().findField('BSSTATUSREF').getValue();
if (BSSTATUS == '锁定') {
Ext.Msg.show({ title: '警告', msg: '业务已锁定,不允许操作!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
return;
}
//this.serialNo = DsGetCurSerialNo(this.storeBodyList, this.serialNo);
var selectedRecords = this.gridListCtn.selModel.getSelection();
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (rec.data.BSNO == "" || rec.data.BSNO == "*")//如果是新增但没有保存的数据,没有必要提交到后台
{
this.storeBodyCtnList.remove(selectedRecords[i]);
}
else {
Ext.MessageBox.confirm('提示', '确定删除该记录吗?', function (btn) {
if (btn == 'yes') {
Ext.Msg.wait('正在删除数据...');
Ext.Ajax.request({
waitMsg: '正在删除数据...',
url: '/MvcShipping/MsOpSeae/DeleteDetail',
params: {
data: Ext.JSON.encode(rec.data)
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
this.storeBodyCtnList.remove(rec);
Ext.Msg.show({ title: '提示', msg: jsonresult.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
else {
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
}
},
failure: function (response, options) {
Ext.Msg.show({ title: '警告', msg: '服务器响应出错,请重试', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
},
scope: this
}); //end Ext.Ajax.request
}
}, this);
}
//this.storeBodyList.remove(selectedRecords[i]);
}
},
//#endregion
//#region
LoadDefValue: function () {
this.storeDefValue.load({ params: { condition: "BSTYPE='铁路运输'" },
callback: function (r, options, success) {
if (success) {
if (this.storeDefValue.getCount() > 0) {
for (var j = 0; j < this.storeDefValue.getCount(); j += 1) {
var member = this.storeDefValue.getAt(j);
var headfield = this.formHead.getForm().findField(member.data.FIELDNAME);
if (headfield != NaN && headfield != null)
headfield.setValue(member.data.DEFVALUE);
var headfield = this.formEdit.getForm().findField(member.data.FIELDNAME);
if (headfield != NaN && headfield != null)
headfield.setValue(member.data.DEFVALUE);
};
} else {
}
}
},
scope: this
});
},
LoadMustBe: function () {
this.storeMustBe.load({ params: { condition: "BSTYPE='铁路运输'" },
callback: function (r, options, success) {
if (success) {
if (this.storeMustBe.getCount() > 0) {
for (var j = 0; j < this.storeMustBe.getCount(); j += 1) {
var member = this.storeMustBe.getAt(j);
var headfield = this.formHead.getForm().findField(member.data.FIELDNAME);
if (headfield != NaN && headfield != null) {
if (member.data.ISMUST == "1")
headfield.allowBlank = false;
if (member.data.ISCOLOR == "1")
headfield.setFieldStyle({ background: '#ffc' });
if (member.data.ISREADONLY == "1")
headfield.setReadOnly(true);
}
var headfield = this.formEdit.getForm().findField(member.data.FIELDNAME);
if (headfield != NaN && headfield != null) {
if (member.data.ISMUST == "1")
headfield.allowBlank = false;
if (member.data.ISCOLOR == "1")
headfield.setFieldStyle({ background: '#ffc' });
if (member.data.ISREADONLY == "1")
headfield.setReadOnly(true);
}
};
} else {
}
}
},
scope: this
});
},
LoadInit: function (data) {
var CUSTOMERNAME = this.formHead.getForm().findField('CUSTOMERNAME').getValue();
var s = " ISOPERATOR=1 and LINKID in (select gid from [info_client] where SHORTNAME='" + CUSTOMERNAME + "')";
this.storeInfoClientContact.load({ params: { condition: s} });
var sF = " ISFINANCIALSTAFF=1 and LINKID in (select gid from [info_client] where SHORTNAME='" + CUSTOMERNAME + "')";
this.storeInfoClientContactFF.load({ params: { condition: sF} });
},
//#endregion
//#region 转换成大写字符
onUpCaseClick: function (menu, event) {
this.formEdit.getForm().findField('SHIPPER').setValue(this.formEdit.getForm().findField('SHIPPER').getValue().toUpperCase());
this.formEdit.getForm().findField('CONSIGNEE').setValue(this.formEdit.getForm().findField('CONSIGNEE').getValue().toUpperCase());
this.formEdit.getForm().findField('NOTIFYPARTY').setValue(this.formEdit.getForm().findField('NOTIFYPARTY').getValue().toUpperCase());
this.formEdit.getForm().findField('AGENT').setValue(this.formEdit.getForm().findField('AGENT').getValue().toUpperCase());
this.formEdit.getForm().findField('MARKS').setValue(this.formEdit.getForm().findField('MARKS').getValue().toUpperCase());
this.formEdit.getForm().findField('DESCRIPTION').setValue(this.formEdit.getForm().findField('DESCRIPTION').getValue().toUpperCase());
},
//#endregion
//#region 编辑时按钮等的状态
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: "modOpRailwayOpwt" },
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: Zi.LAN.ZhengZaiChaXunShuJu, //'正在查询委托编号状态...',
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: '7'
// },
// 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 {
// Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
// }
// },
// scope: this
//});
},
GetStringNum: function (str) {
var num = 0;
if (str == null || str == '') return num;
if (str.length == 0) return num;
var if_find = false;
var str_num = '';
for (var i = 0; i < str.length; i += 1) {
var member = str.substr(i, 1);
if ((member == '0') || (member == '1') || (member == '2') || (member == '3')
|| (member == '4') || (member == '5') || (member == '6') || (member == '7')
|| (member == '8') || (member == '9') || (member == '.') || (member == '-')) {
if (!if_find) {
str_num = str_num + member;
}
} else {
if_find = true;
}
}
return str_num;
},
setSaveBtnStatus: function (enable) {
var btnESave = Ext.getCmp('btnESave');
var btnESaveAndClose = Ext.getCmp('btnESaveAndClose');
var btnESaveAndNew = Ext.getCmp('btnESaveAndNew');
var btnEAddDetail = Ext.getCmp('btnadddetail');
var btnEDeleteDetail = Ext.getCmp('btndeldetail');
if (enable) {
btnESave.enable();
btnESaveAndClose.enable();
btnESaveAndNew.enable();
btnEAddDetail.enable();
btnEDeleteDetail.enable();
} else {
btnESave.disable();
btnESaveAndClose.disable();
btnESaveAndNew.disable();
btnEAddDetail.disable();
btnEDeleteDetail.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 = 'MSOPSEAE';
var sql1 = "SET LANGUAGE 'us_english' SELECT * FROM op_seae 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 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 == 'pnlmodNewOpRailwayInfo') {
// 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 = "BSNO='" + this.editRecord.get('BSNO') + "'";
//this.storeBodyList.load({ params: { condition: condition} });
}
this.LoadData(this.opStatus, condition);
},
NextRecord: function () {
var j = this.StoreList.indexOf(this.editRecord);
if (j == (this.StoreList.count - 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 == 'pnlmodNewOpRailwayInfo') {
// 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 = "BSNO='" + this.editRecord.get('BSNO') + "'";
//this.storeBodyList.load({ params: { condition: condition} });
}
this.LoadData(this.opStatus, condition);
},
getIsModify: function () {
var feepanel = Ext.getCmp('pnlmodRailwayAllFee');
if (feepanel != NaN && feepanel != null) {
var feemodify = feepanel.panelFee.getModifyStatus();
if (feemodify) {
return '费用信息';
}
}
var feeamendpanel = Ext.getCmp('pnlmodRailwayAmendFee');
if (feeamendpanel != NaN && feeamendpanel != null) {
var feemodify = feeamendpanel.panelFee.getModifyStatus();
if (feemodify) {
return '更改单信息';
}
}
var drmodify = this.storeBodyList.getModifiedRecords();
var ctnmodify = this.storeBodyCtnList.getModifiedRecords();
if (panelEdit.formEdit.getForm().isDirty() == true || panelEdit.formHead.getForm().isDirty() == true || drmodify.length != 0 || ctnmodify.length != 0) {
return '业务信息';
}
else return '';
}
});