Ext.namespace('Shipping'); Shipping.MsOp_InternalTradeEdit = function (config) { Ext.applyIf(this, config); this.initUIComponents(); window.Shipping.MsOp_InternalTradeEdit.superclass.constructor.call(this); }; Ext.extend(Shipping.MsOp_InternalTradeEdit, Ext.Panel, { parentWin: null, OpStatus: 'add', StoreList: null, editRecord: null, Editdata: null, MainEditRecord: null, stroplb: '内贸海运管理',///与视图 V_op_bs 的OPLBNAME相同 依赖于枚举类型96005 isfen: false, panelFee_Name: 'modOp_InternalTrade_AllFee',//对应sys_module.name panelAmend_Name:'modOp_InternalTrade_AmendFee', initUIComponents: function () { this.serialNo = 0; //this.bodyDel = []; this.itemindex = 1; this.initloaddata = 0; this.accdatesameetd = 0; this.MsPeriod = null; this.SALEORDERDEPTBYOP = 0; this.formname = "MsOp_InternalTradeEdit"; _this = this; parentWin = window.parent.opener; mainWin = getMainForm(parentWin); opflex = 0.6;//上方几个用户下拉框 《操作》等的宽度 ViaWidth = 90;//中转港信息的的标签宽度 //#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/GetOpIDRang' } }); //this.StoreOpRange.load({ params: { optype: "modOrderManagement" } }); //#region 客户 往来单位 相关【委托单位 收货人 船公司 车队 场站】 //委托单位 //this.storeCustCode = window.parent.GetPubStore("InfoClient_ISCONTROLLER"); this.storeCustCode = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CustomRefModel', proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' } }); //this.storeCustCode.loadData(mainWin.GetPubStore("INFOCLIENT_ISCONTROLLER").data.items); this.storeCustCode.load(); this.comboxCustCode = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '委托单位', matchFieldWidth: false, store: this.storeCustCode, forceSelection: true, queryMode: 'local', flex: 1, //queryParam: 'CODENAME', name: 'CUSTOMERNAME', valueField: 'CustName', displayField: 'CodeAndName', listeners: { scope: this, //blur: function (field, The, eOpts) { // if (isNullorEmpty(field.rawValue.toUpperCase().trim())) { // field.setRawValue(""); // field.value = ""; // } //}, //'beforequery': function (e) { // return FilterCombox(e);//在beforequery使用此方法 //}, 'select': function (combo, records, eOpts) { if (records.length > 0) { 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('OPERATORTEL').setValue(member.data.TEL); } else { this.comboxInfoClientContact.setValue(''); //this.formHead.getForm().findField('OPERATORTEL').setValue(''); } } }, scope: this }); } } } }); //收货人 this.storeCONSIGNEE = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CustomRefModel', proxy: { url: '/CommMng/BasicDataRef/GetCustomRefListCARRIER' } }); this.comboxCONSIGNEE = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '收货人', store: this.storeCONSIGNEE, //queryMode: 'remote', //minChars: 1, //queryParam: 'CODENAME', name: 'CONSIGNEE', valueField: 'CustName', displayField: 'CodeAndName', listeners: { scope: this, 'beforequery': function (e) { return FilterCombox(e);//在beforequery使用此方法 } } }); //船公司 this.storeCARRIER = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CustomRefModel', proxy: { url: '/CommMng/BasicDataRef/GetCustomRefListCARRIER' } }); this.comboxCARRIER = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '船公司', store: this.storeCARRIER, //queryMode: 'remote', //minChars: 1, //queryParam: 'CODENAME', name: 'CARRIER', valueField: 'CustName', displayField: 'CodeAndName', listeners: { scope: this, 'beforequery': function (e) { return FilterCombox(e);//在beforequery使用此方法 }, blur: function (field, The, eOpts) { if (isNullorEmpty(field.rawValue.toUpperCase().trim())) { field.setRawValue(""); field.value = ""; } } } }); //车队 this.storeTRUCK = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CustomRefModel', proxy: { url: '/CommMng/BasicDataRef/GetCustomRefListCARRIER' } }); this.comboxTRUCK = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '车队', store: this.storeTRUCK, //queryMode: 'remote', //minChars: 1, //queryParam: 'CODENAME', name: 'TRUCKER', valueField: 'CustName', displayField: 'CodeAndName', listeners: { scope: this, blur: function (field, The, eOpts) { if (isNullorEmpty(field.rawValue.toUpperCase().trim())) { field.setRawValue(""); field.value = ""; } }, 'beforequery': function (e) { return FilterCombox(e);//在beforequery使用此方法 } } }); //场站 this.storeYARD = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CustomRefModel', proxy: { url: '/CommMng/BasicDataRef/GetCustomRefListCARRIER' } }); this.comboxYARD = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '场站', store: this.storeYARD, //queryMode: 'remote', //minChars: 1, //queryParam: 'CODENAME', name: 'YARD', valueField: 'CustName', displayField: 'CodeAndName', listeners: { scope: this, blur: function (field, The, eOpts) { if (isNullorEmpty(field.rawValue.toUpperCase().trim())) { field.setRawValue(""); field.value = ""; } }, 'beforequery': function (e) { return FilterCombox(e);//在beforequery使用此方法 } } }); //场站 this.storeRETURNYARD = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CustomRefModel', proxy: { url: '/CommMng/BasicDataRef/GetCustomRefListYARD' } }); this.storeRETURNYARD.load(); this.comboxRETURNYARD = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '回箱场站', store: this.storeRETURNYARD, //queryMode: 'remote', //minChars: 1, //queryParam: 'CODENAME', name: 'RETURNYARD', valueField: 'CustName', displayField: 'CodeAndName', listeners: { scope: this, blur: function (field, The, eOpts) { if (isNullorEmpty(field.rawValue.toUpperCase().trim())) { field.setRawValue(""); field.value = ""; } }, 'beforequery': function (e) { return FilterCombox(e);//在beforequery使用此方法 } } }); //#region 往来单位联系人 this.storeInfoClientContact = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.InfoClientContactModel', proxy: { url: '/CommMng/BasicDataRef/GetInfoClientContactList' } }); this.comboxInfoClientContact = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '客户联系人', store: this.storeInfoClientContact, flex: opflex, forceSelection: false, name: 'OPERATOR', valueField: 'SHOWNAME', displayField: 'SHOWNAME', listeners: { scope: this, blur: function (field, The, eOpts) { if (isNullorEmpty(field.rawValue.toUpperCase().trim())) { field.setRawValue(""); field.value = ""; } }, 'beforequery': function (e) { return FilterCombox(e);//在beforequery使用此方法 }, 'select': function (combo, records, eOpts) { if (records.length > 0) { } } } }); //#endregion //#endregion //#region 结算方式 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: '结算方式', readOnly: true, forceSelection: true, name: 'STLNAME', valueField: 'STLNAME', displayField: 'STLNAME' }); //#endregion //#region 业务来源 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, flex:1, name: 'BSSOURCE', valueField: 'SourceName', displayField: 'SourceName', listeners: { scope: this, 'select': function (combo, records, eOpts) { if (records.length > 0) { var recs = DsStoreQueryBy(this.storeSource, 'SourceID', records[0].data.SourceID); if (recs.getCount() > 0) { var data = recs.getAt(0).data; var s = "SOURCEID='" + data.SourceID + "'"; this.storeSourceDetail.load({ params: { condition: s } }); } else { var BSSOURCEDETAIL = this.formHead.getForm().findField('BSSOURCEDETAIL'); BSSOURCEDETAIL.setValue(''); } } } } }); this.storeSourceDetail.load(); this.comboxBSSOURCEDETAIL = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '贸易条款', store: this.storeSourceDetail, // forceSelection: true, flex:1, name: 'BSSOURCEDETAIL', valueField: 'SourceDetail', displayField: 'SourceDetail' }); //#endregion //#region 分公司 所属分部 this.storeCompany = Ext.create('DsExt.ux.RefTableStore', { model: 'MsCompanysEntity', proxy: { url: '/MvcShipping/MsCompanys/GetNoPicDataList' } }); this.comboxCompany = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '所属分部', store: this.storeCompany, flex:1, name: 'CORPID', valueField: 'gid', displayField: 'name', listeners: { scope: this, 'select': function (combo, records, eOpts) { if (records.length > 0) { this.storeUser.load({ params: { condition: "CORPID='" + combo.value + "'", dbname: records[0].data.DBNAME } , callback: function (options, success, response) { if (success) { //.... } } }); } } } }); //#endregion //#region 系统用户:操作 客服 销售 this.storeUser = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.UserRefModel', proxy: { url: '/CommMng/BasicDataRef/GetUserRefList' } }); this.comboxOP = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '操作', //renderTo: 'basicBoxselect', //autoHeight:true, name: 'OP', autosize: true, bodyPadding: 1, flex: opflex, //height:60, //labelWidth: 90, store: this.storeUser, queryMode: 'local', //stacked: true, //pinList: false, triggerOnClick: false, valueField: 'GID', displayField: 'CodeAndName' }); this.comboxCUSTSERVICE = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '客服', //renderTo: 'basicBoxselect', //autoHeight:true, name: 'CUSTSERVICE', autosize: true, bodyPadding: 1, flex: opflex, //height:60, //labelWidth: 90, store: this.storeUser, queryMode: 'local', //stacked: true, //pinList: false, triggerOnClick: false, valueField: 'GID', displayField: 'CodeAndName' }); this.comboxSALE = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '销售', //renderTo: 'basicBoxselect', //autoHeight:true, name: 'SALE', autosize: true, bodyPadding: 1, flex: opflex, //height:60, //labelWidth: 90, store: this.storeUser, queryMode: 'local', //stacked: true, //pinList: false, triggerOnClick: false, valueField: 'GID', displayField: 'CodeAndName' }); //#endregion //#region 部门 this.storeDept = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.DeptModel', proxy: { url: '/CommMng/BasicDataRef/GetDeptList' } }); this.comboxDept = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '所属部门', store: this.storeDept, flex: 1, //labelWidth: 55, forceSelection: true, name: 'SALEDEPT', valueField: 'DeptName', displayField: 'DeptName' //,hidden: true }); //#endregion //#region 船名 this.storeVESSEL = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.DICModel', proxy: { url: '/CommMng/TruckBasicDataRef/GetCommaWord' } }); this.comboxVESSEL = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '船名', store: this.storeVESSEL, forceSelection: false, name: 'VESSEL', valueField: 'KEYFIELD', displayField: 'KEYFIELD', listeners: { scope: this, blur: function (field, The, eOpts) { if (isNullorEmpty(field.rawValue.toUpperCase().trim())) { field.setRawValue(""); field.value = ""; } }, 'beforequery': function (e) { return FilterCombox(e);//在beforequery使用此方法 } } }); this.storeVIA_VESSEL = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.DICModel', proxy: { url: '/CommMng/TruckBasicDataRef/GetCommaWord' } }); this.storeVIA_VESSEL.load({ params: { tablename: "Op_InternalTrade", columnname: "VIA_VESSEL", condition: " BSDATE>DATEADD(day,-15, getdate()) " } }); this.comboxVIA_VESSEL = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '船名', store: this.storeVIA_VESSEL, forceSelection: false, name: 'VIA_VESSEL', valueField: 'KEYFIELD', displayField: 'KEYFIELD', listeners: { scope: this, blur: function (field, The, eOpts) { if (isNullorEmpty(field.rawValue.toUpperCase().trim())) { field.setRawValue(""); field.value = ""; } }, 'beforequery': function (e) { return FilterCombox(e);//在beforequery使用此方法 } } }); this.storeVIA2_VESSEL = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.DICModel', proxy: { url: '/CommMng/TruckBasicDataRef/GetCommaWord' } }); this.storeVIA2_VESSEL.load({ params: { tablename: "Op_InternalTrade", columnname: "VIA2_VESSEL", condition: " BSDATE>DATEADD(day,-15, getdate()) " } }); this.comboxVIA2_VESSEL = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '船名', store: this.storeVIA2_VESSEL, forceSelection: false, name: 'VIA2_VESSEL', valueField: 'KEYFIELD', displayField: 'KEYFIELD', listeners: { scope: this, blur: function (field, The, eOpts) { if (isNullorEmpty(field.rawValue.toUpperCase().trim())) { field.setRawValue(""); field.value = ""; } }, 'beforequery': function (e) { return FilterCombox(e);//在beforequery使用此方法 } } }); this.storeVIA3_VESSEL = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.DICModel', proxy: { url: '/CommMng/TruckBasicDataRef/GetCommaWord' } }); this.storeVIA3_VESSEL.load({ params: { tablename: "Op_InternalTrade", columnname: "VIA3_VESSEL", condition: " BSDATE>DATEADD(day,-15, getdate()) " } }); this.comboxVIA3_VESSEL = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '船名', store: this.storeVIA3_VESSEL, forceSelection: false, name: 'VIA3_VESSEL', valueField: 'KEYFIELD', displayField: 'KEYFIELD', listeners: { scope: this, blur: function (field, The, eOpts) { if (isNullorEmpty(field.rawValue.toUpperCase().trim())) { field.setRawValue(""); field.value = ""; } }, 'beforequery': function (e) { return FilterCombox(e);//在beforequery使用此方法 } } }); //#endregion //#region 航次 this.storeVOYNO = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.DICModel', proxy: { url: '/CommMng/TruckBasicDataRef/GetCommaWord' } }); this.comboxVOYNO = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '航次', store: this.storeVOYNO, forceSelection: false, name: 'VOYNO', valueField: 'KEYFIELD', displayField: 'KEYFIELD', listeners: { scope: this, blur: function (field, The, eOpts) { if (isNullorEmpty(field.rawValue.toUpperCase().trim())) { field.setRawValue(""); field.value = ""; } }, 'beforequery': function (e) { return FilterCombox(e);//在beforequery使用此方法 } } }); this.storeVIA_VOYNO = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.DICModel', proxy: { url: '/CommMng/TruckBasicDataRef/GetCommaWord' } }); this.storeVIA_VOYNO.load({ params: { tablename: "Op_InternalTrade", columnname: "VIA_VOYNO", condition: " BSDATE>DATEADD(day,-15, getdate()) " } }); this.comboxVIA_VOYNO = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '航次', store: this.storeVIA_VOYNO, forceSelection: false, name: 'VIA_VOYNO', valueField: 'KEYFIELD', displayField: 'KEYFIELD', listeners: { scope: this, blur: function (field, The, eOpts) { if (isNullorEmpty(field.rawValue.toUpperCase().trim())) { field.setRawValue(""); field.value = ""; } }, 'beforequery': function (e) { return FilterCombox(e);//在beforequery使用此方法 } } }); this.storeVIA2_VOYNO = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.DICModel', proxy: { url: '/CommMng/TruckBasicDataRef/GetCommaWord' } }); this.storeVIA2_VOYNO.load({ params: { tablename: "Op_InternalTrade", columnname: "VIA2_VOYNO", condition: " BSDATE>DATEADD(day,-15, getdate()) " } }); this.comboxVIA2_VOYNO = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '航次', store: this.storeVIA2_VOYNO, forceSelection: false, name: 'VIA2_VOYNO', valueField: 'KEYFIELD', displayField: 'KEYFIELD', listeners: { scope: this, blur: function (field, The, eOpts) { if (isNullorEmpty(field.rawValue.toUpperCase().trim())) { field.setRawValue(""); field.value = ""; } }, 'beforequery': function (e) { return FilterCombox(e);//在beforequery使用此方法 } } }); this.storeVIA3_VOYNO = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.DICModel', proxy: { url: '/CommMng/TruckBasicDataRef/GetCommaWord' } }); this.storeVIA3_VOYNO.load({ params: { tablename: "Op_InternalTrade", columnname: "VIA3_VOYNO", condition: " BSDATE>DATEADD(day,-15, getdate()) " } }); this.comboxVIA3_VOYNO = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '航次', store: this.storeVIA3_VOYNO, forceSelection: false, name: 'VIA3_VOYNO', valueField: 'KEYFIELD', displayField: 'KEYFIELD', listeners: { scope: this, blur: function (field, The, eOpts) { if (isNullorEmpty(field.rawValue.toUpperCase().trim())) { field.setRawValue(""); field.value = ""; } }, 'beforequery': function (e) { return FilterCombox(e);//在beforequery使用此方法 } } }); //#endregion //#region 起运港 中转港 目的港 this.storeCodeLoadport = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CodeLoadportModel', proxy: { url: '/CommMng/BasicDataRef/GetCodeLoadportList' } }); this.comboxPORTLOAD = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '起运港', store: this.storeCodeLoadport, name: 'PORTLOADID', valueField: 'PORT', displayField: 'CodeAndName', listeners: { scope: this, blur: function (field, The, eOpts) { if (isNullorEmpty(field.rawValue.toUpperCase().trim())) { field.setRawValue(""); field.value = ""; } }, 'beforequery': function (e) { return FilterCombox(e);//在beforequery使用此方法 }, 'select': function (combo, records, eOpts) { if (records.length > 0) { this.formHead.getForm().findField('PORTLOAD').setValue(records[0].data.PORT); } } } }); this.comboxVIA = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '中转港1', store: this.storeCodeLoadport, name: 'VIA', valueField: 'PORT', displayField: 'CodeAndName', listeners: { scope: this, blur: function (field, The, eOpts) { if (isNullorEmpty(field.rawValue.toUpperCase().trim())) { field.setRawValue(""); field.value = ""; } }, 'beforequery': function (e) { return FilterCombox(e);//在beforequery使用此方法 } } }); this.comboxVIA2 = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '中转港2', store: this.storeCodeLoadport, name: 'VIA2', valueField: 'PORT', displayField: 'CodeAndName', listeners: { scope: this, blur: function (field, The, eOpts) { if (isNullorEmpty(field.rawValue.toUpperCase().trim())) { field.setRawValue(""); field.value = ""; } }, 'beforequery': function (e) { return FilterCombox(e);//在beforequery使用此方法 } } }); this.comboxVIA3 = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '中转港3', store: this.storeCodeLoadport, name: 'VIA3', valueField: 'PORT', displayField: 'CodeAndName', listeners: { scope: this, blur: function (field, The, eOpts) { if (isNullorEmpty(field.rawValue.toUpperCase().trim())) { field.setRawValue(""); field.value = ""; } }, 'beforequery': function (e) { return FilterCombox(e);//在beforequery使用此方法 } } }); this.comboxPORTDISCHARGE = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '目的港', store: this.storeCodeLoadport, name: 'PORTDISCHARGEID', valueField: 'PORT', displayField: 'CodeAndName', listeners: { scope: this, blur: function (field, The, eOpts) { if (isNullorEmpty(field.rawValue.toUpperCase().trim())) { field.setRawValue(""); field.value = ""; } }, 'beforequery': function (e) { return FilterCombox(e);//在beforequery使用此方法 }, 'select': function (combo, records, eOpts) { if (records.length > 0) { this.formHead.getForm().findField('PORTDISCHARGE').setValue(records[0].data.PORT); } } } }); this.storeCtn = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CodeCtnModel', proxy: { url: '/CommMng/BasicDataRef/GetCodeCtnList' } }); //this.storeCtn.load(); //箱型 this.comboxCTN = Ext.create('DsExt.ux.RefTableCombox', { store: this.storeCtn, flex: 1, forceSelection: true, fieldLabel: '箱型', allowBlank: true, name: 'CTNALL', valueField: 'CTN', displayField: 'CTN' }); //#endregion //加载业务信息 //#endregion //#region 主表信息 this.formHead = Ext.widget('form', { //layout: "border", region: 'north', // title:'内贸海运业务信息', //height:300, frame: true, bodyPadding: 5, collapsed: false, collapsible: true, trackResetOnLoad: true, fieldDefaults: { margins: '2 2 2 0', labelAlign: 'right', flex: 1, labelWidth: 65, msgTarget: 'qtip' }, items: [ { //第一格 xtype: 'fieldset', title:'委托信息', defaultType: 'textfield', layout: 'anchor', defaults: { anchor: '100%' }, items: [ { xtype: 'container', layout: 'hbox', hidden: true, defaultType: 'textfield', items: [ { fieldLabel: 'BSNO', name: 'BSNO' }, { fieldLabel: 'TIMEMARK', name: 'TIMEMARK' }, { fieldLabel: 'BSDATE', name: 'BSDATE' }, { fieldLabel: 'CREATOR', name: 'CREATOR' }, { fieldLabel: 'MASTERNO', name: 'MASTERNO' } //, { // fieldLabel: 'PORTLOADSTORAGEPERIOD', // name: 'PORTLOADSTORAGEPERIOD', hidden: true //}, { // fieldLabel: 'FBPPORTLOAD', // name: 'FBPPORTLOAD', hidden: true //}, { // fieldLabel: 'VIA_STORAGEPERIOD', // name: 'VIA_STORAGEPERIOD', hidden: true //}, { // fieldLabel: 'VIA2_STORAGEPERIOD', // name: 'VIA2_STORAGEPERIOD', hidden: true //}, { // fieldLabel: 'VIA3_STORAGEPERIOD', // name: 'VIA3_STORAGEPERIOD', hidden: true //} ] } , { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [ this.comboxCustCode//委托单位 , { fieldLabel: '费用锁定', readOnly: true, //format: 'Y-m-d', hidden:true, flex: 1, //labelWidth: 55, //xtype: 'datefield', name: 'FEESTATUS' }, { fieldLabel: '费用锁定', readOnly: true, //format: 'Y-m-d', flex: 1, //labelWidth: 55, //xtype: 'datefield', name: 'FEESTATUSREF' }, { fieldLabel: '业务锁定', readOnly: true, //format: 'Y-m-d', hidden: true, flex: 1, //labelWidth: 55, //xtype: 'datefield', name: 'BSSTATUS' }, { fieldLabel: '业务锁定', readOnly: true, //format: 'Y-m-d', flex: 1, //labelWidth: 55, //xtype: 'datefield', name: 'BSSTATUSREF' }, { fieldLabel: '用箱天数', readOnly: true, //format: 'Y-m-d', flex: 1, //labelWidth: 55, //xtype: 'datefield', name: 'CONTAINERDAYS' }, { fieldLabel: '会计期间', format: 'Y-m', flex: 1, //labelWidth: 55, xtype: 'monthfield', name: 'ACCDATE' } ] } , { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [ { xtype: 'container', layout: 'hbox', flex: 1, defaultType: 'textfield', items: [{ fieldLabel: '委托编号', allowBlank: true, name: 'CUSTNO' }, { xtype: 'button', id: 'btnCUSTNO', iconCls: "btncancel", handler: function () { this.ClearCustNo(); }, scope: this }] }, { fieldLabel: '主提单号', name: 'MBLNO', flex: 1 }, { xtype: 'container', layout: 'hbox', flex: 1, defaultType: 'textfield', items: [this.comboxStlName , { fieldLabel: '结算日期', readOnly: true, format: 'Y-m-d', name: 'STLDATE', xtype: 'datefield' }] } , this.comboxBSSOURCE , this.comboxBSSOURCEDETAIL ] } , { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [ { fieldLabel: '发货编号', flex: 0.6, name: 'TRANSNO' } , this.comboxOP , this.comboxCUSTSERVICE , this.comboxSALE , this.comboxoper , this.comboxInfoClientContact , this.comboxCompany , this.comboxDept //, {xtype:"hiddenfield",flex:1} ] } ] }, { //第2格 xtype: 'fieldset', title: '发运信息', defaultType: 'textfield', layout: 'anchor', defaults: { anchor: '100%' }, items: [ { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [ this.comboxCARRIER , this.comboxVESSEL , this.comboxVOYNO , this.comboxPORTLOAD , { fieldLabel: '开船日期', name: 'ETD', format: 'Y-m-d', xtype: 'datefield', listeners: { //添加日期选择事件 "change": function () { _this.Duicuntianshu(); }, scope: this } } , this.comboxYARD ] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [ { fieldLabel: '重箱回场时间', name: 'LOADEDCTNRETURNDATE', labelWidth: ViaWidth, format: 'Y-m-d', xtype: 'datefield', listeners: { //添加日期选择事件 "change": function () { _this.Duicuntianshu(); }, scope: this } }, { fieldLabel: '提箱日期', name: 'EMPTYCTNTOSHIPPERDATE', labelWidth: ViaWidth, format: 'Y-m-d', xtype: 'datefield', listeners: { //添加日期选择事件 "change": function () { _this.YongxiangTianshu(); }, scope: this } } , this.comboxTRUCK , { fieldLabel: '车牌号', name: 'TRUCKNO' }, { fieldLabel: '箱号', name: 'CNTRNO' }, { fieldLabel: '封号', name: 'SEALNO' } ] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [ { fieldLabel: '起运港堆存天数', labelWidth: ViaWidth, name: 'PORTLOADSTORAGEPERIOD', readOnly:true }, { fieldLabel: '起运港免箱日期', labelWidth: ViaWidth, name: 'FBPPORTLOAD', readOnly: true } , this.comboxCTN , { fieldLabel: '备注', flex:3, name: 'PORTLOADREMARK' } ] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [ { fieldLabel: '装箱日期', labelWidth: ViaWidth, name: 'LOADCTNDATE', format: 'Y-m-d', xtype: 'datefield', }, { fieldLabel: '实际装货重量', labelWidth: 100, name: 'LOADCTNKGS' }, { fieldLabel: '送货重量', name: 'LOADCARGOKGS' }, this.comboxRETURNYARD,{ fieldLabel: '空返提单号', flex: 2, name: 'I_MBLNO' } ] } ] }, { //第3格 xtype: 'fieldset', title: '中转港信息', defaultType: 'textfield', layout: 'anchor', defaults: { anchor: '100%' }, items: [ { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [ this.comboxVIA ,{ fieldLabel: '中转港到港日期', labelWidth: ViaWidth, name: 'VIA_ETA', format: 'Y-m-d', xtype: 'datefield', listeners: { //添加日期选择事件 "change": function () { _this.VIADAY(); }, scope: this } } , this.comboxVIA_VESSEL , this.comboxVIA_VOYNO , { fieldLabel: '中转港开船日期', labelWidth: ViaWidth, name: 'VIA_ETD', format: 'Y-m-d', xtype: 'datefield', listeners: { //添加日期选择事件 "change": function () { _this.VIADAY(); }, scope: this } } ,{ fieldLabel: '中转港堆存天数', labelWidth: ViaWidth, name: 'VIA_STORAGEPERIOD', readOnly: true } ] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [ this.comboxVIA2 , { fieldLabel: '中转港到港日期', labelWidth: ViaWidth, name: 'VIA2_ETA', format: 'Y-m-d', xtype: 'datefield', listeners: { //添加日期选择事件 "change": function () { _this.VIA2DAY(); }, scope: this } } , this.comboxVIA2_VESSEL , this.comboxVIA2_VOYNO , { fieldLabel: '中转港开船日期', labelWidth: ViaWidth, name: 'VIA2_ETD', format: 'Y-m-d', xtype: 'datefield', listeners: { //添加日期选择事件 "change": function () { _this.VIA2DAY(); }, scope: this } } , { fieldLabel: '中转港堆存天数', labelWidth: ViaWidth, name: 'VIA2_STORAGEPERIOD', readOnly: true } ] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [ this.comboxVIA3 , { fieldLabel: '中转港到港日期', labelWidth: ViaWidth, name: 'VIA3_ETA', format: 'Y-m-d', xtype: 'datefield', listeners: { //添加日期选择事件 "change": function () { _this.VIA3DAY(); }, scope: this } } , this.comboxVIA3_VESSEL , this.comboxVIA3_VOYNO , { fieldLabel: '中转港开船日期', labelWidth: ViaWidth, name: 'VIA3_ETD', format: 'Y-m-d', xtype: 'datefield', listeners: { //添加日期选择事件 "change": function () { _this.VIA3DAY(); }, scope: this } } , { fieldLabel: '中转港堆存天数', labelWidth: ViaWidth, name: 'VIA3_STORAGEPERIOD', readOnly: true } ] }, { fieldLabel: '备注', name: 'VIA_MARK' } ] }, { //第4格 xtype: 'fieldset', title: '目的港信息', defaultType: 'textfield', layout: 'anchor', defaults: { anchor: '100%' }, items: [ { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [ this.comboxPORTDISCHARGE , { fieldLabel: '收货地址', flex: 2, name: 'PlACERECEIPT' }, { fieldLabel: '车队名称', name: 'TRUCKER2' }, { fieldLabel: '派单日期', name: 'DISPATCHDATE', format: 'Y-m-d', xtype: 'datefield' }, { fieldLabel: '到港日期', name: 'ETA', format: 'Y-m-d', xtype: 'datefield' } ] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [ this.comboxCONSIGNEE , { fieldLabel: '收货联系人', flex: 0.8, name: 'CONSIGNEECONTACT' }, { fieldLabel: '电话', flex: 1.2, name: 'CONSIGNEETEL' }, { fieldLabel: '车牌号', name: 'TRUCKNO2' }, { fieldLabel: '提货日期', name: 'DELIVERYDATE', format: 'Y-m-d', xtype: 'datefield' }, { fieldLabel: '到厂时间', name: 'RECEIVEDATE', format: 'Y-m-d', xtype: 'datefield', listeners: { //添加日期选择事件 "change": function () { _this.YongxiangTianshu(); }, scope: this } } ] }, { fieldLabel: '备注', name: 'DISCHARGEREMARK' } ] } ]//end items(fieldset 1) }); //end this.formHead //#endregion //#region 商品明细 this.cellEditing = Ext.create('Ext.grid.plugin.CellEditing', { clicksToEdit: 1 }); //this.cargoCheckBoxModel = Ext.create('Ext.selection.CheckboxModel'); this.column = [ { dataIndex: 'GID', header: 'GID', width: 80, hidden: true }, { sortable: true, dataIndex: 'BSNO', header: 'BSNO', width: 80, hidden: true }, { sortable: true, dataIndex: 'SEQUENCE', header: '顺序号', width: 40, editor: { xtype: 'numberfield', selectOnFocus: true, //得到焦点时自动选择文本 allowDecimals: false //允许输入小数 //decimalPrecision: 2 //允许保留的小数位数,并四舍五入 } }, { sortable: true, dataIndex: 'ORDERNO', header: '系统订单号', width: 80, editor: { xtype: 'textfield' } }, { sortable: true, dataIndex: 'LOTNO', header: '批次号', width: 80, editor: { xtype: 'textfield', selectOnFocus: true } }, { sortable: true, dataIndex: 'GOODSNAME', header: '品名', width: 200, editor: { xtype: 'textfield', selectOnFocus: true } }, { sortable: true, dataIndex: 'PACKEGS', header: '单柜数量', width: 80, editor: { xtype: 'numberfield', selectOnFocus: true, //得到焦点时自动选择文本 allowDecimals: false //允许输入小数 //decimalPrecision: 2 //允许保留的小数位数,并四舍五入 } }, { dataIndex: 'LOADDATE', header: '装箱时间', width: 110, renderer: Ext.util.Format.dateRenderer('Y-m-d'), editor: { xtype: 'datefield', selectOnFocus: true } }, { sortable: true, dataIndex: 'LOADADDR', header: '装箱地点', width: 160, editor: { xtype: 'textfield', selectOnFocus: true } } ]; this.storeBody = Ext.create('Ext.data.Store', { pageSize: this.PageSize, model: 'MsOp_InternalTrade_Detailmb', remoteSort: false, //groupField: 'GroupDate', proxy: { type: 'ajax', //url: '/TruckMng/MsRptPcHeadOperate/QryData_ADL', url: '/MvcShipping/MsOp_InternalTrade/GetBodyList', //this.storeList.proxy.url = '/TruckMng/MsRptPcHeadOperate/QryData_ADL'; reader: { id: 'GID', root: 'data', totalProperty: 'totalCount' } } }); this.formDetail = new Ext.grid.GridPanel({ store: this.storeBody, enableHdMenu: false, region: 'center', //height: 160, title: '商品明细', loadMask: { msg: "数据加载中,请稍等..." }, trackMouseOver: true, disableSelection: false, plugins: [this.cellEditing], //selModel: //this.cargoCheckBoxModel, selType: 'cellmodel', features: [{ ftype: 'summary'//Ext.grid.feature.Summary表格汇总特性 }], tbar: [ { text: '增加明细', tooltip: '增加明细', iconCls: "btnadddetail", handler: function (button, event) { this.onAddDetailClick(button, event); }, scope: this }, '-', { id:'btndeletedetail', text: '删除明细', tooltip: '删除明细', iconCls: "btndeletedetail", handler: function (button, event) { this.onDelDetailClick(button, event); }, scope: this } ], columns: this.column }); this.column = DsTruck.GetGridPanel(USERID, this.formname, this.column); //使用者id,表名 ,中间column数组,跳过一开始的几列 this.formDetail.reconfigure(this.storeBody, this.column); //#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 }, { text: "关闭", handler: function (button, event) { window.close(); }, scope: this } , '-', { id: 'btnCopyNew', text: "复制新建", handler: function (button, event) { this.Save('2'); }, scope: this }, '-', { id: 'btnSubmit', text: "提交审核", iconCls: "btnprint", handler: function (button, event) { //this.PushState("3000"); this.Submit(); }, scope: this }, { id: 'btnSubmitBack', text: "撤回提交", iconCls: "btnprint", handler: function (button, event) { this.PushState("30011"); }, scope: this }, { text: "驳回提交", iconCls: "btnprint", handler: function (button, event) { this.PushState("30011"); }, scope: this }, { text: "审核通过", iconCls: "btnprint", handler: function (button, event) { this.PushState("3001"); }, scope: this }, '-', { text: "生成费用",id:"btnMAKEFEE", handler: function (button, event) { this.MakeFee(); }, scope: this }, '-', { text: "打印", iconCls: "btnprint", handler: function (button, event) { this.Print(); }, scope: this }] }); //end 按钮Toolbar //#endregion //#region 框架结构 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: 'A44A8005-CC7D-4FC5-83DA-5DB7168E55FA' } }); 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: Zi.LAN.DESCRIPTION2, //'模块名称', width: 178, dataIndex: 'DESCRIPTION' }], listeners: { scope: this, 'itemclick': function (_this, record, item, index, e, eOpts) { var finded = false; if (record.data.MODULEURL == '@') { this.tabOpPanel.setActiveTab(0); } else if (record.data.MODULEURL != '#') { var children = this.tabOpPanel.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.tabOpPanel.setActiveTab(i); finded = true; } } } } if (finded == false) { if (this.formHead.getForm().findField('BSNO').getValue() == "") { Ext.Msg.show({ title: Zi.LAN.JingGao, msg: Zi.LAN.QingXianBaoCunYeWu, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });//'请先保存业务信息后再打开其他模块!' } else { if (record.data.NAME == _this.panelFee_Name) { var paneltabitems = new Shipping.SeaeFee({ id: 'pnl' + record.data.NAME, layout: "border", region: "center", autoScroll: true, frame: false, closable: true, title: record.data.DESCRIPTION }); } else if (record.data.NAME == _this.panelAmend_Name) { var paneltabitems = new Shipping.SeaeAmendFee({ 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: ' ' }); } this.tabOpPanel.add(paneltabitems); this.tabOpPanel.setActiveTab(paneltabitems); this.tabOpPanel.doLayout(); } } } } } }); this.panelEdit = new Ext.Panel({ title: '委托信息', id: 'pnlmodNewOpInternalTradeInfo', layout: "border", region: 'center', animate: true, autoScroll: true, frame: false, //closable:true, items: [this.panelBtn, this.formHead, this.formDetail] }); this.tabOpPanel = new Ext.TabPanel({ activeTab: 0, width: 100, layout: 'border', border: true, frame: false, region: 'center', id: "TabOpPanel", enableTabScroll: true, items: [ this.panelEdit ], listeners: { scope: this, 'beforetabchange': function (tabPanel, newCard, oldCard, eOpts) { if (oldCard.id == _this.panelFee_Name) { var feemodify = oldCard.panelFee.getModifyStatus(); if (feemodify) { Ext.Msg.show({ title: Zi.LAN.JingGao, msg: Zi.LAN.QingXianBaoCunFeiYong, icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });//'费用未保存,请先保存费用!' return false; } } if (newCard.id == _this.panelFee_Name) { newCard.panelFee.loadUnit(); } if (oldCard.id == _this.panelAmend_Name) { var feemodify = oldCard.panelAmendFee.getModifyStatus(); if (feemodify) { Ext.Msg.show({ title: Zi.LAN.JingGao, msg: Zi.LAN.QingXianBaoCunFeiYong, icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });//'费用未保存,请先保存费用!' return false; } } if (newCard.id == _this.panelAmend_Name) { newCard.panelAmendFee.loadUnit(); } } } }); Ext.apply(this, { items: [ this.tabtree, this.tabOpPanel ] }); //#endregion parentWin = window.parent.opener; this.LoadInitData(); this.InitData(); //#region 其他 this.formDetail.on('edit', function (editor, e, eOpts) { this.AfterEdit(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]; //ret[3] = this.storeCustCode; //ret[4] = this.storeCompany; //ret[5] = this.storeUser; //ret[6] = this.storeDept; //ret[7] = this.storeCARRIER; //ret[8] = this.storeCodeLoadport; //ret[9] = this.storeVESSEL; //ret[10] = this.storeVOYNO; //ret[11] = this.storeTRUCK; //ret[12] = this.storeYARD; //_storeCustCode = ret[3]; //this.storeCustCode.loadData(_storeCustCode.data.items); _storeCompany = ret[4]; this.storeCompany.loadData(_storeCompany.data.items); _storeUser = ret[5]; this.storeUser.loadData(_storeUser.data.items); _storeDept = ret[6]; this.storeDept.loadData(_storeDept.data.items); _storeCARRIER = ret[7]; this.storeCARRIER.loadData(_storeCARRIER.data.items); _storeCodeLoadport = ret[8]; this.storeCodeLoadport.loadData(_storeCodeLoadport.data.items); _storeVESSEL = ret[9]; this.storeVESSEL.loadData(_storeVESSEL.data.items); _storeVOYNO = ret[10]; this.storeVOYNO.loadData(_storeVOYNO.data.items); _storeTRUCK = ret[11]; this.storeTRUCK.loadData(_storeTRUCK.data.items); _storeYARD = ret[12]; this.storeYARD.loadData(_storeYARD.data.items); //ret[13] = this.storeCONSIGNEE; _storeCONSIGNEE = ret[13]; this.storeCONSIGNEE.loadData(_storeCONSIGNEE.data.items); _storeCtn = ret[14] this.storeCtn.loadData(_storeCtn.data.items); } if (this.opStatus == 'edit') { Headcondition = "BSNO='" + this.editRecord.get('BSNO') + "'"; Bodycondition = "D.BSNO='" + this.editRecord.get('BSNO') + "'"; //this.storeBodyList.load({ params: { condition: condition} }); } else { Headcondition = ""; Bodycondition = "1=2"; } this.LoadData(this.opStatus, Headcondition, Bodycondition); }, //end InitData LoadData: function (opstatus, condition, Bodycondition) { this.serialNo = 0; //this.bodyDel = []; this.opStatus = opstatus; if (this.opStatus == 'edit') { var CUSTNO = this.editRecord.get('CUSTNO').toString().trim(); if (CUSTNO != "") { document.title = "委托编号:" + this.editRecord.get('CUSTNO').toString().trim(); } } Ext.Ajax.request({ waitMsg: '正在查询主表数据...', url: '/MvcShipping/MsOp_InternalTrade/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; } this.Editdata = result.data; //this.LoadInit(data); this.formHead.getForm().reset(); this.formHead.getForm().setValues(this.Editdata); this.SetLockStatus(this.Editdata); this.GetEditStatus(); var _this = this; } else { Ext.MessageBox.alert('请求出现错误,请重试', response.responseText); } }, scope: this }); this.loadBody(Bodycondition); var billno = '*'; var gid = '*'; }, SetLockStatus: function (data) { if (isTrue(data.FEESTATUS)) this.formHead.getForm().findField('FEESTATUSREF').setValue("是"); else this.formHead.getForm().findField('FEESTATUSREF').setValue("否"); if (isTrue(data.BSSTATUS)) this.formHead.getForm().findField('BSSTATUSREF').setValue("是"); else this.formHead.getForm().findField('BSSTATUSREF').setValue("否"); }, loadBody: function (condition) { this.storeBody.load({ params: { condition: condition } }); }, // end LoadDate //#endregion LoadInitData: function () { //this.storeCustCode.load({ params: { condition: "" } }); }, //#region 保存/添加/删除 Save: function (type) { var Form = this.formHead.getForm(); if (!Form.isValid() ) { return; } var data = Form.getValues(); var Bodydatas = []; for (var i = 0; i < this.storeBody.getCount(); i += 1) { var member = this.storeBody.getAt(i); Bodydatas.push(member); } var jsonBody = ConvertRecordsToJson(Bodydatas); Ext.Msg.wait('正在保存数据, 请稍侯..'); Ext.Ajax.request({ waitMsg: '正在保存数据...', url: '/MvcShipping/MsOp_InternalTrade/Save', scope: this, params: { opstatus: this.opStatus, data: Ext.JSON.encode(data), Body: jsonBody }, callback: function (options, success, response) { if (success) { Ext.MessageBox.hide(); var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { var returnData = jsonresult.Data; this.Editdata = returnData; this.formHead.getForm().reset(); this.formHead.getForm().setValues(this.Editdata); if (this.opStatus == 'add') { var arrNewRecords = this.StoreList.add(returnData); this.editRecord = arrNewRecords[0]; this.opStatus = 'edit'; } else if (this.opStatus == 'edit') { var editp = Ext.create('MsOp_InternalTrademb', returnData); this.editRecord.fields.each(function (field) { if (field.persist) { name = field.name; if (name != 'BSNO') this.editRecord.set(name, editp.get(name)); } }, this); this.editRecord.commit(); //this.Editdata = result.data; } this.loadBody(" D.BSNO='" + this.editRecord.get('BSNO').toString().trim() + "'"); //this.LoadInit(data); this.GetEditStatus(); if (type == '0') { //this.opStatus = 'edit'; } else if (type == '1') { window.close(); } else if (type == '2') { _this.CopyNew(); } } 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 CopyNew: function () { this.opStatus = 'add'; var basicForm = this.formHead.getForm(); //basicForm.findField('BSNO').setDisabled(false); basicForm.findField('BSNO').setValue(NewGuid()); basicForm.findField('CUSTNO').setValue(); var children = this.tabOpPanel.items; if (children) { for (var i = children.length - 1, len = 0; i >= len; i--) { if (children.items[i].id) { if (children.items[i].id == 'pnlmodNewOpInternalTradeInfo') { // this.tabSeaepanel.setActiveTab(i); } else { children.items[i].close(); } } } } this.tabOpPanel.doLayout(); } , onAddDetailClick: function (button, event) { //20191009 首先判断是否已选中一行 如有 则将其作为参数 传递给onCopy 以实现复制添加 var selectedRecords = this.formDetail.selModel.getSelection(); if (selectedRecords.length > 0) { record = selectedRecords[0]; this.onCopyAddClick(record.data); //return; } else { var linenum = this.storeBody.getCount() + 1; var _r = this.reLine(); var record = Ext.create('MsOp_InternalTrade_Detailmb', { 'GID': NewGuid(), 'SEQUENCE': linenum, 'BSNO': '', 'ORDERNO': '', 'LOTNO': '', 'GOODSNAME': '', 'PACKEGS': '0', 'LOADDATE': '', 'LOADADDR': '' }); this.storeBody.add(record); var n = this.storeBody.getCount(); this.cellEditing.startEditByPosition({ row: n - 1, column: 4 }); } //aftereditform(); }, onCopyAddClick: function (oldrecord) { var linenum = this.storeBody.getCount() + 1; var _r = this.reLine(); var record = Ext.create('MsOp_InternalTrade_Detailmb', { 'GID': NewGuid(), 'SEQUENCE': linenum, 'BSNO': '', 'ORDERNO': oldrecord.ORDERNO, 'LOTNO': oldrecord.LOTNO, 'GOODSNAME': oldrecord.GOODSNAME, 'PACKEGS': oldrecord.PACKEGS, 'LOADDATE': oldrecord.LOADDATE, 'LOADADDR': oldrecord.LOADADDR }); this.storeBody.add(record); var n = this.storeBody.getCount(); this.cellEditing.startEditByPosition({ row: n - 1, column: 4 }); //aftereditform(); }, onDelDetailClick: function (button, event) { var selectedRecords = this.formDetail.selModel.getSelection(); Ext.MessageBox.confirm('提示', '确定删除记录吗?', function (btn) { if (btn == 'yes') { var GIDList = ""; for (var i = 0; i < selectedRecords.length; i++) { var rec = selectedRecords[i]; if (GIDList != "") { GIDList += ","; } GIDList += "'" + rec.data.GID + "'"; } Ext.Msg.wait('正在保存数据, 请稍侯..'); Ext.Ajax.request({ waitMsg: '正在保存数据...', url: '/MvcShipping/MsOp_InternalTrade/DelDetail', scope: this, params: { data: Ext.JSON.encode(this.Editdata), GID: GIDList }, callback: function (options, success, response) { Ext.MessageBox.hide(); var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { var returnData = jsonresult.Data; this.Editdata = returnData; this.loadBody("D.BSNO='" + this.editRecord.get('BSNO') + "'"); var editp = Ext.create('MsOp_InternalTrademb', returnData); this.editRecord.fields.each(function (field) { if (field.persist) { name = field.name; if (name != 'BSNO') this.editRecord.set(name, editp.get(name)); } }, this); this.editRecord.commit(); this.formHead.getForm().reset(); this.formHead.getForm().setValues(this.Editdata); this.loadBody(" D.BSNO='" + this.editRecord.get('BSNO').toString().trim() + "'"); } else { Ext.Msg.show({ title: '请重试', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } } }); } }, this); }, reLine: function (button, event) { var _L = 1; this.storeBody.each(function (record) { var ln = _L + ""; _L = _L + 1; record.set('SEQUENCE', ln); }); }, //#endregion //#region 载入初始信息 LoadInit: function (data) { }, //#endregion //#region 编辑时按钮等的状态 GetEditStatus: function () { var canedit = false; _this = this; var op = USERID; this.StoreOpRange.load({ params: { optype: "modOp_InternalTrade" }, 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 { canedit = false; } _this.setSaveBtnStatus(canedit); } } }); }, GetStringNum: function (str) { var num = 0; if (str == null || str == '') return num; if (str.length == 0) return num; var if_find = false; var str_num = ''; for (var i = 0; i < str.length; i += 1) { var member = str.substr(i, 1); if ((member == '0') || (member == '1') || (member == '2') || (member == '3') || (member == '4') || (member == '5') || (member == '6') || (member == '7') || (member == '8') || (member == '9') || (member == '.') || (member == '-')) { if (!if_find) { str_num = str_num + member; } } else { if_find = true; } } return str_num; }, setSaveBtnStatus: function (enable) { var btnESave = Ext.getCmp('btnESave'); var btnESaveAndClose = Ext.getCmp('btnESaveAndClose'); var btndeletedetail = Ext.getCmp('btndeletedetail'); if (enable) { btnESave.enable(); btnESaveAndClose.enable(); btndeletedetail.enable(); } else { btnESave.disable(); btnESaveAndClose.disable(); btndeletedetail.disable(); } }, //#endregion //#region 上一票下一票 PrevRecord: function () { if (this.opStatus == 'add') { Ext.Msg.show({ title: '警告', msg: '请先保存当前业务', 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; } j = j - 1; this.editRecord = this.StoreList.getAt(j); if (this.opStatus == 'edit') { Headcondition = "BSNO='" + this.editRecord.get('BSNO') + "'"; Bodycondition = "D.BSNO='" + this.editRecord.get('BSNO') + "'"; this.LoadData(this.opStatus, Headcondition, Bodycondition); //this.LoadData(this.opStatus, condition); } }, NextRecord: function () { if (this.opStatus == 'add') { Ext.Msg.show({ title: '警告', msg: '请先保存当前业务', 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; } j = j + 1; this.editRecord = this.StoreList.getAt(j); if (this.opStatus == 'edit') { Headcondition = "BSNO='" + this.editRecord.get('BSNO') + "'"; Bodycondition = "D.BSNO='" + this.editRecord.get('BSNO') + "'"; this.LoadData(this.opStatus, Headcondition, Bodycondition); //this.LoadData(this.opStatus, condition); } }, //#endregion //#region 打印 Print: function () { var basicForm = this.formHead.getForm(); var BSNO = basicForm.findField('BSNO').value; if (BSNO == '*' || BSNO == '') { Ext.Msg.show({ title: '错误', msg: '单据还没有保存,请保存后再打印', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); return; } var printType = 'MSOP_InternalTrade'; var sql1 = ""; var sql2 = ""; var sql3 = ""; var sql4 = ""; var sql5 = ""; var sql6 = ""; Ext.Ajax.request({ waitMsg: '正在查询主表数据...', url: '/MvcShipping/MsOp_InternalTrade/GetPrintSql', params: { printname: "Print1", BSNOList: "'" + BSNO+"'" }, 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; } //this.Editdata = result.data; //this.LoadInit(data); sql1 = result.Data.sql1; sql2 = result.Data.sql2; PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6); } else { Ext.MessageBox.alert('请求出现错误,请重试', response.responseText); } }, scope: this }); }, //#endregion AfterEdit: function (editor, e, eOpts) { //if (e.value==e.originalValue){return;} function decimal(str, length) { var _r = round2(str, length); return (_r); } } , //清空委托编号 ClearCustNo: function () { var CUSTNO = this.formHead.getForm().findField('CUSTNO').getValue(); Ext.Ajax.request({ waitMsg: '正在查询委托编号状态...', url: '/MvcShipping/MsSysBillNoSet/DeleteBsNo', params: { custno: CUSTNO }, callback: function (options, success, response) { if (success) { var result = Ext.JSON.decode(response.responseText); if (result.Success != true) { } else { this.formHead.getForm().findField('CUSTNO').setValue(''); //this.Save('0'); } } else { Ext.MessageBox.alert('请求出现错误,请重试', response.responseText); } }, scope: this }); } //#region 前台编辑后计算方法 //通过开船日期和重箱回场日期计算堆存天数 , Duicuntianshu: function () { var Form = this.formHead.getForm(); if (!Form.isValid()) { return; } //var data = Form.getValues(false, false, false); ETD = Form.findField('ETD'); LOADEDCTNRETURNDATE = Form.findField('LOADEDCTNRETURNDATE'); PORTLOADSTORAGEPERIOD = Form.findField('PORTLOADSTORAGEPERIOD'); days = datediff(LOADEDCTNRETURNDATE.getValue(), ETD.getValue()); PORTLOADSTORAGEPERIOD.setValue(days); } , YongxiangTianshu: function () { var Form = this.formHead.getForm(); if (!Form.isValid()) { return; } //var data = Form.getValues(false, false, false); RECEIVEDATE = Form.findField('RECEIVEDATE'); EMPTYCTNTOSHIPPERDATE = Form.findField('EMPTYCTNTOSHIPPERDATE'); CONTAINERDAYS = Form.findField('CONTAINERDAYS'); days = datediff(EMPTYCTNTOSHIPPERDATE.getValue(), RECEIVEDATE.getValue()); CONTAINERDAYS.setValue(days); } , VIADAY: function () { var Form = this.formHead.getForm(); VIA_ETD = Form.findField('VIA_ETD'); VIA_ETA = Form.findField('VIA_ETA'); if (isNullorEmpty(VIA_ETD.getValue()) || isNullorEmpty(VIA_ETA.getValue())) return; VIA_STORAGEPERIOD = Form.findField('VIA_STORAGEPERIOD'); days = datediff(VIA_ETA.getValue(), VIA_ETD.getValue()); VIA_STORAGEPERIOD.setValue(days); } , VIA2DAY: function () { var Form = this.formHead.getForm(); VIA_ETD = Form.findField('VIA2_ETD'); VIA_ETA = Form.findField('VIA2_ETA'); if (isNullorEmpty(VIA_ETD.getValue()) || isNullorEmpty(VIA_ETA.getValue())) return; VIA_STORAGEPERIOD = Form.findField('VIA2_STORAGEPERIOD'); days = datediff(VIA_ETA.getValue(), VIA_ETD.getValue()); VIA_STORAGEPERIOD.setValue(days); } , VIA3DAY: function () { var Form = this.formHead.getForm(); VIA_ETD = Form.findField('VIA3_ETD'); VIA_ETA = Form.findField('VIA3_ETA'); if (isNullorEmpty(VIA_ETD.getValue()) || isNullorEmpty(VIA_ETA.getValue())) return; VIA_STORAGEPERIOD = Form.findField('VIA3_STORAGEPERIOD'); days = datediff(VIA_ETA.getValue(), VIA_ETD.getValue()); VIA_STORAGEPERIOD.setValue(days); } //#endregion });