Ext.namespace('Shipping'); Shipping.MsOpCtnApplyAddCtnEdit = function (config) { Ext.applyIf(this, config); this.initUIComponents(); window.Shipping.MsOpCtnApplyAddCtnEdit.superclass.constructor.call(this); }; Ext.extend(Shipping.MsOpCtnApplyAddCtnEdit, Ext.Panel, { ParentWin: null, OpStatus: 'add', StoreList: null, editRecord: null, editFactryRecord: null, FactryStatus: 'add', initUIComponents: function () { this.serialNo = 0; this.workSerialNo = 0; this.bodyDel = []; //#region 编辑form //枚举参照相关(编辑form) //权限范围 this.storeListGood = Ext.create('Ext.data.Store', { model: 'MsCodeMSDS', remoteSort: true, proxy: { type: 'ajax', url: '/MvcContainer/MsCodeMSDS/GetData', reader: { id: 'GID', root: 'data', totalProperty: 'totalCount' } } }); this.storeListGood.load({ params: { handle: 'edit', condition: ""} }); //人员信息加载 this.storeOpCode = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.UserRefModel', proxy: { url: '/CommMng/BasicDataRef/GetUserLinkRefList' } }); this.storeOpCode.load(); //客服 this.comboxAGENTINPUTBY = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '维护人', store: this.storeOpCode, forceSelection: true, name: 'AGENTINPUTBY', valueField: 'GID', displayField: 'CodeAndName' }); //运输条款 this.storeSERVICE = Ext.create('DsExt.ux.RefTableStore', { model: 'CODE_SERVICE', proxy: { url: '/CommMng/BasicDataRef/GetCodeServiceList' } }); this.comboxSERVICE = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '运输条款', flex: 1, store: this.storeSERVICE, forceSelection: true, name: 'SERVICE', valueField: 'SERVICE', displayField: 'SERVICE' }); //表参照相关(编辑form) this.formGoodsAudit = Ext.widget('form', { region: 'north', title: '适货审核', region: 'north', frame: true, bodyPadding: 5, autoScroll: true, collapsed: true, collapsible: true, trackResetOnLoad: true, fieldDefaults: { margins: '2 2 2 2', labelAlign: 'right', flex: 1, labelWidth: 90, msgTarget: 'qtip' }, items: [{ xtype: 'container', layout: 'anchor', defaultType: 'textfield', items: [{ xtype: 'container', layout: 'hbox', flex: 1, defaultType: 'textfield', items: [{ fieldLabel: '货物是否与MSDS一致', inputValue: true, labelWidth: 180, xtype: 'checkboxfield', name: 'ISGOODSNAMESAME' }, { fieldLabel: '工厂其他产品', flex: 3, name: 'PRODUCTGOODSNAME' }, { fieldLabel: 'PH', readOnly: true, name: 'PH' }] }, { xtype: 'container', layout: 'hbox', flex: 1, defaultType: 'textfield', items: [{ fieldLabel: '密度', readOnly: true, name: 'DENSITY' }, { fieldLabel: 'UN', readOnly: true, name: 'UNNO' }, { fieldLabel: '危险品等级', readOnly: true, name: 'DCLASS' }, { fieldLabel: '副危险品等级', readOnly: true, name: 'SDCLASS' }, { fieldLabel: 'PACKING GROUP', labelWidth: 110, readOnly: true, name: 'PACKINGGROUP' }] }, { xtype: 'container', layout: 'hbox', flex: 1, defaultType: 'textfield', items: [{ fieldLabel: '是否海洋污染物', inputValue: true, readOnly: true, xtype: 'checkboxfield', name: 'ISPOLLUTEOCEAN' }, { fieldLabel: '是否存在危险', inputValue: true, readOnly: true, xtype: 'checkboxfield', name: 'ISDANGEROUS' }, { fieldLabel: '熔点', readOnly: true, name: 'MELTINGPOINT' }, { fieldLabel: '沸点', readOnly: true, name: 'BOILINGPOINT' }, { fieldLabel: '闪点', readOnly: true, name: 'FLASHPOINT' }, { fieldLabel: 'IMDG', readOnly: true, name: 'IMDG' }] }, { xtype: 'container', layout: 'hbox', flex: 1, defaultType: 'textfield', items: [{ fieldLabel: '审核状态', readOnly: true, name: 'AUDITSTATUS' }, { fieldLabel: '审核人', readOnly: true, name: 'AUDITBYREF' }, { fieldLabel: '审核时间', readOnly: true, name: 'AUDITTIME' }, { fieldLabel: '审核反馈', flex: 2, name: 'AUDITRESULT' }] }]//end items(fieldset 1) }] }); //end this.formEdit this.formCost = Ext.widget('form', { region: 'north', title: '成本核算', region: 'north', frame: true, bodyPadding: 5, // autoScroll: true, trackResetOnLoad: true, collapsed: true, collapsible: true, fieldDefaults: { margins: '2 2 2 2', labelAlign: 'right', flex: 1, labelWidth: 90, msgTarget: 'qtip' }, items: [{ xtype: 'container', layout: 'anchor', defaultType: 'textfield', items: [{ xtype: 'container', layout: 'hbox', flex: 1, defaultType: 'textfield', items: [this.comboxAGENTINPUTBY, { fieldLabel: '周期', name: 'CYCLEDAYS' }, { fieldLabel: '超期箱使费佣金比例', labelWidth: 115, name: 'CHANGERATE' }, { fieldLabel: '重箱免堆天数', labelWidth: 100, name: 'FULL_CTN_FREE_STORAGE_DAY' }, { fieldLabel: '重箱超期堆存费', labelWidth: 100, name: 'FULL_CTN_OVER_STORAGE_RATE' }, { fieldLabel: 'OWNERCTN', name: 'OWNERCTN', flex: 0, hidden: true, margins: '0' }] }, { xtype: 'container', layout: 'hbox', flex: 1, defaultType: 'textfield', items: [{ fieldLabel: '清洗免堆天数', labelWidth: 100, name: 'CLEAR_CTN_FREE_STORAGE_DAY' }, { fieldLabel: '清洗超期堆存费', labelWidth: 100, name: 'CLEAR_CTN_OVER_STORAGE_RATE' }, { fieldLabel: '不清洗免堆天数', labelWidth: 100, name: 'NO_CLEAR_CTN_FREE_STORAGE_DAY' }, { fieldLabel: '不清洗超期堆存费', labelWidth: 100, name: 'NO_CLEAR_CTN_OVER_STORAGE_RATE' }, { xtype: 'hiddenfield'}] }]//end items(fieldset 1) }] }); //end this.formEdit this.formAudit = Ext.widget('form', { region: 'north', title: '成本审批', region: 'north', frame: true, bodyPadding: 5, // autoScroll: true, trackResetOnLoad: true, collapsed: false, collapsible: true, fieldDefaults: { margins: '2 2 2 2', labelAlign: 'right', flex: 1, labelWidth: 90, msgTarget: 'qtip' }, items: [{ xtype: 'container', layout: 'anchor', defaultType: 'textfield', items: [{ xtype: 'container', layout: 'hbox', flex: 1, defaultType: 'textfield', items: [{ fieldLabel: '审核状态', readOnly: true, name: 'COSTAUDITSTATUS' }, { fieldLabel: '审核人', readOnly: true, name: 'COSTAUDITBYREF' }, { fieldLabel: '审核时间', readOnly: true, name: 'COSTAUDITTIME' }, { fieldLabel: '审核反馈',flex:0.75, readOnly: true, name: 'COSTAUDITRESULT' }, { fieldLabel: '罐箱价格', flex: 0.75, readOnly: true, labelWidth: 100, name: 'CTN_PRICE' }, { fieldLabel: '币别', flex: 0.5, readOnly: true, labelWidth: 60, name: 'CURRENCY' }] }, { xtype: 'container', layout: 'hbox', flex: 1, defaultType: 'textfield', items: [{ fieldLabel: '内部租金收入', labelWidth: 100, name: 'CTN_INCOME' }, { fieldLabel: '起运港免箱使天数', labelWidth: 110, name: 'LOAD_FREE_USECTNE_DAY' }, { fieldLabel: '起运港超期箱使费', labelWidth: 110, name: 'LOAD_OVER_USECTNE_RATE' }, { fieldLabel: '目的港免箱使天数', labelWidth: 110, name: 'DEST_FREE_USECTNE_DAY' }, { fieldLabel: '目的港超期箱使费', labelWidth: 110, name: 'DEST_OVER_USECTNE_RATE' }] }]//end items(fieldset 1) }] }); //end this.formEdit //编辑form this.formEdit = Ext.widget('form', { region: 'center', frame: true, bodyPadding: 5, // height: 160, // autoScroll: true, trackResetOnLoad: true, fieldDefaults: { margins: '2 2 2 2', labelAlign: 'right', flex: 1, labelWidth: 90, msgTarget: 'qtip' }, items: [ {//fieldset 1 xtype: 'container', defaultType: 'textfield', layout: 'anchor', defaults: { anchor: '100%' }, items: [{ xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: 'GID', name: 'GID', flex: 0, hidden: true, margins: '0' }, { fieldLabel: 'COMPANYID', name: 'COMPANYID', flex: 0, hidden: true, margins: '0' }, { fieldLabel: 'INPUTBY', name: 'INPUTBY', flex: 0, hidden: true, margins: '0' }, { fieldLabel: '申请编号', readOnly: true, allowBlank: true, name: 'BSNO' }, { fieldLabel: '申请日期', readOnly: true, name: 'BSDATE' }, { fieldLabel: '揽货人', readOnly: true, name: 'SALE' }, { fieldLabel: '操作', readOnly: true, name: 'OP' }] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: '委托单位', readOnly: true, name: 'CUSTOMERNAME' }, { fieldLabel: '品名', readOnly: true, name: 'GOODSNAME', listeners: { 'render': function (_field, eOpts) {//自定义函数,定义双击事件 var _this = this; _field.getEl().on('dblclick', function (e, t, eOpts) { var openSet = "height=700, width=1224, toolbar=no, menubar=no,scrollbars=1, resizable=1,location=no, status=no,Top= " + (screen.height - 750) / 2 + ",Left= " + (screen.width - 1100) / 2 var openType = "_blank"; var openUrl = ""; openUrl = "../MsCodeMSDS/MsdsView?handle=check&goodsname=" + t.value; window.open(openUrl, openType, openSet); }); } } }, { fieldLabel: '货物类别', readOnly: true, name: 'GOODTYPE' }, { fieldLabel: '起运港', readOnly: true, name: 'PORTLOAD' } ] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: '目的港', readOnly: true, name: 'PORTDISCHARGE' }, { fieldLabel: '是否我司订舱', inputValue: true, readOnly: true, xtype: 'checkboxfield', name: 'ISOWNERBOOKING' }, { fieldLabel: '箱型', readOnly: true, name: 'CTNALL' }, { fieldLabel: '箱量', readOnly: true, name: 'CTNNUM' }] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: '计划用箱日期', format: 'Y-m-d', readOnly: true, flex: 1, xtype: 'datefield', name: 'PLANCTNDATE' }, { fieldLabel: '工厂名称', readOnly: true, name: 'FACTORYNAME' }, { fieldLabel: '工厂地址', readOnly: true, name: 'FACTORYADDR' }, { fieldLabel: '申请状态', readOnly: true, name: 'BSSTATUS' }] }, { xtype: 'container', layout: 'hbox', flex: 1, defaultType: 'textfield', items: [{ fieldLabel: '起运港免箱使天数', readOnly: true, labelWidth: 110, name: 'SLOAD_FREE_USECTNE_DAY' }, { fieldLabel: '起运港超期箱使费', readOnly: true, labelWidth: 110, name: 'SLOAD_OVER_USECTNE_RATE' }, { fieldLabel: '目的港免箱使天数', readOnly: true, labelWidth: 110, name: 'SDEST_FREE_USECTNE_DAY' }, { fieldLabel: '目的港超期箱使费', readOnly: true, labelWidth: 110, name: 'SDEST_OVER_USECTNE_RATE' }] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: '录入人', readOnly: true, flex: 1, disabled: true, name: 'INPUTBYREF' }, { fieldLabel: '录入日期', readOnly: true, flex: 1, disabled: true, name: 'INPUTTIME' }, { fieldLabel: '按进港日计算超期箱使', inputValue: true, labelWidth: 140, flex: 2, readOnly: true, xtype: 'checkboxfield', name: 'ISPORTLOADDATE' }] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [ this.comboxSERVICE //运输条款 , { fieldLabel: '是否加热', flex: 1, inputValue: true, xtype: 'checkboxfield', name: 'NEEDBEHEATED' }, { fieldLabel: '重量', flex: 1, xtype: 'numberfield', allowDecimals: true, //允许输入小数 decimalPrecision: 3, name: 'WEIGHT' }, { fieldLabel: '预计开船日期', format: 'Y-m-d', allowBlank: true, flex: 1, xtype: 'datefield', name: 'PREI_ETD' }, { fieldLabel: '空箱调拨', flex: 1, inputValue: true, xtype: 'checkboxfield', name: 'EMPTYCTNALLOCATION' } ] },{ xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [ { fieldLabel: '备注', flex: 2, readOnly: true, name: 'REMARKS' }] } ]//end items(fieldset 1) }//end fieldset 1 ]//end root items }); //end this.formEdit //#endregion //#region 按钮Toolbar this.tbuttons = [{ 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: 'btnSubmitAudit', text: '配箱完成', tooltip: '配箱完成', handler: function (button, event) { this.onSubmitAuditClick(); }, scope: this }, '-', { id: 'btnSubmitAuditBack', text: '撤销配箱', tooltip: '撤销配箱', handler: function (button, event) { this.onSubmitAuditBackClick(); }, scope: this } ]; this.panelBtn = new Ext.Panel({ region: "north", tbar: this.tbuttons }); //end 按钮Toolbar //#endregion //#region 明细 this.storeBodyList = Ext.create('Ext.data.Store', { model: 'MsOpCtnApplySaleItems', remoteSort: true, proxy: { type: 'ajax', url: '/MvcContainer/MsOpCtnApply/GetCtnApplySaleItemsList', reader: { id: 'GID', root: 'data', totalProperty: 'totalCount' } } }); //明细表表格 this.gridListCellEditing = Ext.create('Ext.grid.plugin.CellEditing', { clicksToEdit: 1 }); this.gridListBody = new Ext.grid.GridPanel({ store: this.storeBodyList, enableHdMenu: false, region: 'center', loadMask: { msg: "数据加载中,请稍等..." }, trackMouseOver: true, disableSelection: false, plugins: [this.gridListCellEditing], selType: 'cellmodel', columns: [{ sortable: true, dataIndex: 'GID', header: '编号', hidden: true, width: 0 }, { sortable: true, dataIndex: 'LINKGID', header: '业务编号', hidden: true, width: 0 }, { sortable: true, dataIndex: 'ITEMSNO', header: '序号', align: 'right', width: 30 }, { sortable: true, dataIndex: 'ITEMNAME', header: '项目名称', width: 140 }, { sortable: true, dataIndex: 'REMARK', header: '备注', width: 250 }] }); this.gridListBody.on('edit', function (editor, e, eOpts) { this.gridListAfterEdit(editor, e, eOpts); }, this); this.panelBody = new Ext.Panel({ title: '改装要求', layout: "border", region: 'east', width: 200, animate: true, // autoScroll: true, // containerScroll: true, frame: false, items: [this.gridListBody] }); this.panelEDIpage = new Ext.Panel({ title: '申请内容', layout: "border", region: 'north', animate: true, autoScroll: true, collapsed: false, collapsible: true, height: 245, // containerScroll: true, frame: false, items: [this.formEdit, this.panelBody] }); //#endregion //#region 报价信息 this.storeBodyCostList = Ext.create('Ext.data.Store', { model: 'MsOpCtnApplyCostItems', remoteSort: true, proxy: { type: 'ajax', url: '/MvcContainer/MsOpCtnApply/GetCtnApplyCostItemsList', reader: { id: 'GID', root: 'data', totalProperty: 'totalCount' } } }); //明细表表格 this.gridListCostBody = new Ext.grid.GridPanel({ store: this.storeBodyCostList, enableHdMenu: false, region: 'center', loadMask: { msg: "数据加载中,请稍等..." }, trackMouseOver: true, disableSelection: false, selType: 'cellmodel', columns: [{ sortable: true, dataIndex: 'GID', header: '编号', hidden: true, width: 0 }, { sortable: true, dataIndex: 'LINKGID', header: '业务编号', hidden: true, width: 0 }, { sortable: true, dataIndex: 'ITEMSNO', header: '序号', renderer: Ext.util.Format.numberRenderer('00'), align: 'right', width: 60 }, { sortable: true, dataIndex: 'FEENAME', header: '费用名称', width: 140 }, { sortable: true, dataIndex: 'UNIT', header: '标准', width: 100 }, { sortable: true, dataIndex: 'CURRENCY', header: '币别', width: 100 }, { sortable: true, dataIndex: 'UNITPRICE', header: '单价', renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '' + lsValue + ''; } } else { return value; } } catch (e) { return value; } return value; }, align: 'right', width: 110 }, { sortable: true, dataIndex: 'QUANTITY', header: '数量', renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '' + lsValue + ''; } } else { return value; } } catch (e) { return value; } return value; }, align: 'right', width: 110 }, { sortable: true, dataIndex: 'AMOUNT', header: '金额', renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '' + lsValue + ''; } } else { return value; } } catch (e) { return value; } return value; }, align: 'right', width: 110 }, { sortable: true, dataIndex: 'REMARK', header: '备注', width: 250 }, { sortable: true, dataIndex: 'INPUTBYREF', header: '引入人', width: 80 }, { sortable: true, dataIndex: 'INPUTTIME', header: '引入时间', width: 100 }] }); this.storeBodyCostSum = Ext.create('Ext.data.Store', { model: 'MsOpCtnApplyCostItems', remoteSort: true, proxy: { type: 'ajax', url: '/MvcContainer/MsOpCtnApply/GetCtnApplyCostSum', reader: { id: 'GID', root: 'data', totalProperty: 'totalCount' } } }); this.gridListCostSum = new Ext.grid.GridPanel({ store: this.storeBodyCostSum, enableHdMenu: false, region: 'east', width: 240, loadMask: { msg: "数据加载中,请稍等..." }, trackMouseOver: true, disableSelection: false, selType: 'cellmodel', tbar: [{ xtype: 'label', text: '费用合计', style: 'font-size:18px', labelColor: '#000', //style:'background-color: #4b9bf5', x: '5%', y: '5%' }], columns: [{ sortable: false, dataIndex: 'CURRENCY', header: '币别', width: 100 }, { sortable: false, dataIndex: 'AMOUNT', header: '金额', renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '' + lsValue + ''; } } else { return value; } } catch (e) { return value; } return value; }, align: 'right', width: 110 }] }); this.panelCostBody = new Ext.Panel({ title: '成本核算明细', layout: "border", region: 'north', frame: true, bodyPadding: 5, autoScroll: true, collapsed: true, collapsible: true, trackResetOnLoad: true, height: 200, frame: false, items: [this.gridListCostBody, this.gridListCostSum] }); //#endregion //#region 配箱信息 this.storeBodyCtnList = Ext.create('Ext.data.Store', { model: 'MsOpCtnApplyCtnItems', remoteSort: true, proxy: { type: 'ajax', url: '/MvcContainer/MsOpCtnApply/GetCtnApplyCtnItemsList', reader: { id: 'GID', root: 'data', totalProperty: 'totalCount' } } }); //明细表表格 this.gridListCellEditing = Ext.create('Ext.grid.plugin.CellEditing', { clicksToEdit: 1 }); this.dbtns = [{ text: '引入罐箱', tooltip: '引入罐箱', id: "btnadddetail", iconCls: "btnadddetail", handler: function (button, event) { this.addDetail(); }, scope: this }, '-', { text: '删除明细', tooltip: '删除明细', id: "btndeldetail", iconCls: "btndeletedetail", handler: function (button, event) { this.onDeleteCtnItemsClick(); }, scope: this }, '-', { text: '保存配箱', tooltip: '保存配箱', iconCls: "btnsave", handler: function (button, event) { this.onPostDetailClick(); }, scope: this }, '-', { text: '生成业务卡', tooltip: '生成业务卡', iconCls: "btnsave", handler: function (button, event) { this.onAddBillClick(); }, scope: this }, '-', { text: '打印', tooltip: '打印', iconCls: "btnprint", handler: function (button, event) { this.Print(); }, scope: this }]; this.GridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel'); this.gridListCtnBody = new Ext.grid.GridPanel({ store: this.storeBodyCtnList, enableHdMenu: false, region: 'center', loadMask: { msg: "数据加载中,请稍等..." }, trackMouseOver: true, disableSelection: false, plugins: [this.gridListCellEditing], selModel: this.GridCheckBoxModel, tbar: this.dbtns, columns: [{ sortable: true, dataIndex: 'GID', header: '编号', hidden: true, width: 0 }, { sortable: true, dataIndex: 'LINKGID', header: '业务编号', hidden: true, width: 0 }, { sortable: true, dataIndex: 'AUDITSTATUS', header: '状态', width: 80 }, { sortable: true, dataIndex: 'ITEMSNO', header: '序号', editor: { xtype: 'numberfield', keyNavEnabled: false, selectOnFocus: true, hideTrigger: true, mouseWheelEnabled: false, enableKeyEvents: true }, renderer: Ext.util.Format.numberRenderer('00'), align: 'right', width: 60 }, { sortable: true, dataIndex: 'CTNNO', header: '箱号', width: 140 }, { sortable: true, dataIndex: 'TANKVOLUMN', header: '容积', width: 100 }, { sortable: true, dataIndex: 'CTNPROP', header: '箱属', width: 200 }, { sortable: true, dataIndex: 'OWNERCTN', header: '罐东', width: 200 }, { sortable: true, dataIndex: 'INSPECTION_EXPIRE_DATE', header: '年检到期日', width: 100 }, { sortable: true, dataIndex: 'INSURANCE_EXPIRE_DATE', header: '保险到期日', width: 100 }, { sortable: true, dataIndex: 'CURPORT', header: '当前地区', width: 100 }, { sortable: true, dataIndex: 'CURSTATOIN', header: '当前位置', width: 100 }, { sortable: true, dataIndex: 'PREGOODNAME', header: '前装货', width: 100 }, { sortable: true, dataIndex: 'REMARK', header: '备注', editor: { xtype: 'textfield', selectOnFocus: true, enableKeyEvents: true }, width: 250 }] }); // this.gridListCtnBody.on('edit', function (editor, e, eOpts) { // this.gridListAfterEdit(editor, e, eOpts); // }, this); this.panelCtnBody = new Ext.Panel({ title: '配箱明细', layout: "border", region: 'center', animate: true, minHeight: 250, // autoScroll: true, // containerScroll: true, frame: false, items: [this.gridListCtnBody] }); //#endregion // //#region 布局 // //控件布局 // this.panelTop = new Ext.Panel({ // layout: "border", // region: "north", // height: 220, // items: [this.panelBtn, ] // }); this.panelBodyAll = new Ext.Panel({ layout: "border", region: 'center', animate: true, autoScroll: true, containerScroll: true, frame: false, items: [this.panelEDIpage, this.formGoodsAudit, this.formCost, this.panelCostBody, this.formAudit, this.panelCtnBody] }); Ext.apply(this, { items: [this.panelBtn, this.panelBodyAll] }); //#endregion //绑定查询窗体 this.storeBodyList.on('beforeload', function (store) { var acondition = " LINKGID='" + this.editRecord.get('GID') + "'"; Ext.apply(store.proxy.extraParams, { condition: acondition }); }, this); this.storeBodyCostList.on('beforeload', function (store) { var acondition = " LINKGID='" + this.editRecord.get('GID') + "'"; Ext.apply(store.proxy.extraParams, { condition: acondition }); }, this); this.storeBodyCtnList.on('beforeload', function (store) { var acondition = " LINKGID='" + this.editRecord.get('GID') + "'"; Ext.apply(store.proxy.extraParams, { condition: acondition }); }, this); this.ParentWin = window.parent.opener; //初始化数据 this.InitData(); //绑定事件 }, //end initUIComponents InitData: function () { this.opStatus = 'add'; var condition = ''; if (this.ParentWin) { var ret = this.ParentWin.OprationSwap(); this.opStatus = ret[0]; this.StoreList = ret[1]; this.editRecord = ret[2]; } if (this.opStatus == 'edit') condition = " GID='" + this.editRecord.get('GID') + "'"; this.LoadData(this.opStatus, condition); }, //end InitData LoadData: function (opstatus, condition) { this.serialNo = 0; this.workSerialNo = 0; this.bodyDel = []; this.opStatus = opstatus; Ext.Ajax.request({ waitMsg: '正在查询主表数据...', url: '/MvcContainer/MsOpCtnApply/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; } var data = result.data; this.formEdit.getForm().reset(); this.formEdit.getForm().setValues(data); this.formGoodsAudit.getForm().reset(); this.formGoodsAudit.getForm().setValues(data); this.formCost.getForm().reset(); this.formCost.getForm().setValues(data); this.formAudit.getForm().reset(); this.formAudit.getForm().setValues(data); var acondition = ""; if (this.opStatus == 'edit') acondition = " LINKGID='" + this.editRecord.get('GID') + "'"; else acondition = " LINKGID='11111'"; this.storeBodyList.load({ params: { condition: acondition} }); this.storeBodyCtnList.load({ params: { condition: acondition} }); this.storeBodyCostList.load({ params: { condition: acondition} }); this.storeBodyCostSum.load({ params: { condition: acondition} }); this.GetEditStatus(); this.LoadGoodsData("CHEMICALCGOODSNAME='" + data.GOODSNAME + "'"); // this.LoadCtnData("CHEMICALCGOODSNAME='" + data.GOODSNAME + "'"); this.SetAuditForm(); document.title = MODULENAME+"-"+ data.BSNO; } else { Ext.MessageBox.alert('请求出现错误,请重试', response.responseText); } }, scope: this }); }, // end LoadDate LoadGoodsData: function (condition) { this.serialNo = 0; this.workSerialNo = 0; this.bodyDel = []; Ext.Ajax.request({ waitMsg: '正在查询主表数据...', url: '/MvcContainer/MsCodeMSDS/GetData', params: { handle: 'edit', 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; } var data = result.data; this.formGoodsAudit.getForm().reset(); this.formGoodsAudit.getForm().setValues(data); this.formGoodsAudit.getForm().findField('MELTINGPOINT').setValue(data.MELTINGPOINTB + '~' + data.MELTINGPOINTE); this.formGoodsAudit.getForm().findField('BOILINGPOINT').setValue(data.BOILINGPOINTB + '~' + data.BOILINGPOINTE); this.formGoodsAudit.getForm().findField('FLASHPOINT').setValue(data.FLASHPOINTB + '~' + data.FLASHPOINTE); } else { Ext.MessageBox.alert('请求出现错误,请重试', response.responseText); } }, scope: this }); }, // end LoadDate LoadCtnData: function (condition) { this.serialNo = 0; this.workSerialNo = 0; this.bodyDel = []; Ext.Ajax.request({ waitMsg: '正在查询主表数据...', url: '/MvcContainer/MsCodeCtnTk/GetData', params: { handle: 'edit', 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; } var data = result.data; this.formGoodsAudit.getForm().reset(); this.formGoodsAudit.getForm().setValues(data); this.formGoodsAudit.getForm().findField('MELTINGPOINT').setValue(data.MELTINGPOINTB + '~' + data.MELTINGPOINTE); } else { Ext.MessageBox.alert('请求出现错误,请重试', response.responseText); } }, scope: this }); }, // end LoadDate Save: function (type) { var basicForm = this.formEdit.getForm(); if (!basicForm.isValid()) { return; } this.opStatus == 'edit' basicForm.findField('GID').setDisabled(false); var data = basicForm.getValues(false, false, false); basicForm.findField('GID').setDisabled(true); var data2 = this.formCost.getForm().getValues(false, false, false); var j = 0; var bodydatas = []; for (var i = 0; i < this.storeBodyCostList.getCount(); i += 1) { var member = this.storeBodyCostList.getAt(i); j = j + 1; bodydatas.push(member); } if (j == 0) { Ext.Msg.show({ title: '提示', msg: '运价信息不能为空,请先录入运价信息!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } // var jsonBody = ConvertRecordsToJsonAll(bodydatas); Ext.Msg.wait('正在保存数据, 请稍侯..'); Ext.Ajax.request({ waitMsg: '正在保存数据...', url: '/MvcContainer/MsOpCtnApply/SaveCost', scope: this, params: { data: Ext.JSON.encode(data), data2: Ext.JSON.encode(data2), body: jsonBody }, callback: function (options, success, response) { if (success) { Ext.MessageBox.hide(); var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { var returnData = jsonresult.Data; this.formEdit.getForm().setValues(returnData); this.formGoodsAudit.getForm().reset(); this.formGoodsAudit.getForm().setValues(returnData); this.formCost.getForm().reset(); this.formCost.getForm().setValues(returnData); this.formAudit.getForm().reset(); this.formAudit.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('MsOpCtnApply', 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'; basicForm.findField('GID').setDisabled(true); for (var j = 0; j < this.storeBodyCostList.getCount(); j += 1) { var memberbody = this.storeBodyCostList.getAt(j); memberbody.set("LINKGID", this.editRecord.get('GID')); memberbody.commit(); }; } else if (type == '1') { this.opStatus = 'edit'; basicForm.findField('GID').setDisabled(true); for (var j = 0; j < this.storeBodyCostList.getCount(); j += 1) { var memberbody = this.storeBodyCostList.getAt(j); memberbody.set("LINKGID", this.editRecord.get('GID')); memberbody.commit(); }; window.close(); } else { this.LoadData('add', ''); basicForm.findField('GID').setDisabled(false); } } 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 addDetail: function () { window.open('/MvcContainer/MsCodeCtnTk/AddIndex', "引入罐箱", 'width=1200,height=760,top=0,left=0,resizable=yes,status=yes,menubar=no,scrollbars=yes'); }, GetHandleSerialNo: function (store) { var result = 0; if (result == 0) { for (var i = 0; i < store.getCount(); i += 1) { var member = store.getAt(i); if (parseInt(member.data.ITEMSNO) > parseInt(result)) { result = member.data.ITEMSNO; } } } result = parseInt(result) + 1; return result; }, setHeadFieldValue: function (fieldName, value) { var field = this.formCostAudit.getForm().findField(fieldName); field.setValue(value); }, gridListAfterEdit: function (editor, e, eOpts) { if (e.value == e.originalValue) return; if (e.field == 'UNITPRICE' || e.field == 'QUANTITY') { var unitPrice = e.record.data['UNITPRICE']; var quantity = e.record.data['QUANTITY']; var amount = Mul(unitPrice, quantity); e.record.set('AMOUNT', amount); } }, onDeleteCtnItemsClick: function () { var selections = this.gridListCtnBody.getSelectionModel().getSelection(); if (selections.length == 0) { Ext.Msg.show({ title: '提示', msg: '请先选择要删除的集装箱明细!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } var record = selections[0]; Ext.MessageBox.confirm('提示', '确定删除该记录吗?', function (btn) { if (btn == 'yes') { var bodyAddDatas = []; for (var i = 0; i < selections.length; i++) { var rec = selections[i]; if (rec.data.AUDITSTATUS == '录入' || rec.data.AUDITSTATUS == "") bodyAddDatas.push(rec); } var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas); Ext.Msg.wait('正在删除数据...'); Ext.Ajax.request({ waitMsg: '正在删除数据...', url: '/MvcContainer/MsOpCtnApply/DeleteOpCtnApplyCtnItems', params: { data: jsonbodyAddDatas }, callback: function (options, success, response) { if (success) { var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { var acondition = " LINKGID='" + this.editRecord.get('GID') + "'"; this.storeBodyCtnList.load({ params: { condition: acondition} }); 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 }); }, success: function (response, options) { }, scope: this }); //end Ext.Ajax.request } }, this); }, onPostDetailClick: function () { var PID = this.editRecord.get('GID'); var bodyAddDatas = []; for (i = 0; i < this.storeBodyCtnList.getCount(); i += 1) { var memberyf = this.storeBodyCtnList.getAt(i); bodyAddDatas.push(memberyf); }; if (bodyAddDatas.length == 0) { Ext.Msg.show({ title: '提示', msg: '没有要保存的配箱明细!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; }; var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas); Ext.Msg.wait('正在保存数据...'); Ext.Ajax.request({ waitMsg: '正在保存数据...', url: '/MvcContainer/MsOpCtnApply/SaveCtnApplyCtnItems', params: { body: jsonbodyAddDatas, PID: PID }, callback: function (options, success, response) { if (success) { var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { var acondition = " LINKGID='" + this.editRecord.get('GID') + "'"; this.storeBodyCtnList.load({ params: { condition: acondition} }); 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 }); }, success: function (response, options) { }, scope: this }); //end Ext.Ajax.request }, onAddBillClick: function () { var selections = this.gridListCtnBody.getSelectionModel().getSelection(); if (selections.length == 0) { Ext.Msg.show({ title: '提示', msg: '请先选择要生成的集装箱信息!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } var PID = this.editRecord.get('GID'); var record = selections[0]; Ext.MessageBox.confirm('提示', '确定生成吗?', function (btn) { if (btn == 'yes') { var bodyAddDatas = []; for (var i = 0; i < selections.length; i++) { var rec = selections[i]; if (rec.data.AUDITSTATUS == '录入' || rec.data.AUDITSTATUS == '') bodyAddDatas.push(rec); } if (bodyAddDatas.length == 0) { Ext.Msg.show({ title: '提示', msg: '没有要生成的配箱明细!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; }; var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas); Ext.Msg.wait('正在生成业务数据...'); Ext.Ajax.request({ waitMsg: '正在生成业务数据...', url: '/MvcContainer/MsOpCtnApply/CtnCreateBill', params: { data: jsonbodyAddDatas, PID: PID }, callback: function (options, success, response) { if (success) { var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { var acondition = " LINKGID='" + this.editRecord.get('GID') + "'"; this.storeBodyCtnList.load({ params: { condition: acondition} }); 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 }); }, success: function (response, options) { }, scope: this }); //end Ext.Ajax.request } }, this); }, onSubmitAuditClick: function () { var Duino = this.formEdit.getForm().findField('BSNO').getValue(); var GID = this.formEdit.getForm().findField('GID').getValue(); var basicForm = this.formEdit.getForm(); basicForm.findField('GID').setDisabled(false); var data = basicForm.getValues(false, false, false); basicForm.findField('GID').setDisabled(true); var data2 = this.formCost.getForm().getValues(false, false, false); var billstatus = this.formEdit.getForm().findField('BSSTATUS').getValue(); if (billstatus != '总经理审核通过') { Ext.Msg.show({ title: '提示', msg: '总经理审核通过后才可以配箱完成!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } // _this = this; Ext.Ajax.request({ waitMsg: '正在添加数据...', url: '/MvcContainer/MsOpCtnApply/SubmitAddCtn', params: { bill: GID }, callback: function (options, success, response) { if (success) { var result = Ext.JSON.decode(response.responseText); if (!result.Success) { Ext.Msg.show({ title: '提示', msg: result.Message, icon: Ext.MessageBox.ERROR, buttons: Ext.Msg.OK }); return; } else { Ext.Ajax.request({ waitMsg: '正在查询主表数据...', url: '/MvcContainer/MsOpCtnApply/GetData', params: { handle: 'edit', condition: " GID='" + GID + "'" }, callback: function (options, success, response) { if (success) { var result = Ext.JSON.decode(response.responseText); if (!result.Success) { Ext.Msg.show({ title: '提示', msg: result.Message, icon: Ext.MessageBox.ERROR, buttons: Ext.Msg.OK }); return; } var data = result.data; _this.formEdit.getForm().reset(); _this.formEdit.getForm().setValues(data); this.formGoodsAudit.getForm().reset(); this.formGoodsAudit.getForm().setValues(data); this.formCostAudit.getForm().reset(); this.formCostAudit.getForm().setValues(data); var editp = Ext.create('MsOpCtnApply', data); this.editRecord.fields.each(function (field) { if (field.persist) { name = field.name; if (name != 'id') this.editRecord.set(name, editp.get(name)); } }, this); this.editRecord.commit(); this.GetEditStatus(); } else { Ext.MessageBox.alert('请求出现错误,请重试', response.responseText); } }, scope: this }); } } else { Ext.MessageBox.alert('请求出现错误,请重试', response.responseText); } }, scope: this }); }, onSubmitAuditBackClick: function () { var Duino = this.formEdit.getForm().findField('BSNO').getValue(); var GID = this.formEdit.getForm().findField('GID').getValue(); var billstatus = this.formEdit.getForm().findField('BSSTATUS').getValue(); //if (billstatus != '配箱完成' && billstatus != '批准销售修改') { // Ext.Msg.show({ title: '提示', msg: '当前状态无法撤销配箱!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); // return; //} _this = this; Ext.Ajax.request({ waitMsg: '正在添加数据...', url: '/MvcContainer/MsOpCtnApply/SubmitBackAddCtn', params: { bill: GID }, callback: function (options, success, response) { if (success) { var result = Ext.JSON.decode(response.responseText); if (!result.Success) { Ext.Msg.show({ title: '提示', msg: result.Message, icon: Ext.MessageBox.ERROR, buttons: Ext.Msg.OK }); return; } else { Ext.Ajax.request({ waitMsg: '正在查询主表数据...', url: '/MvcContainer/MsOpCtnApply/GetData', params: { handle: 'edit', condition: " GID='" + GID + "'" }, callback: function (options, success, response) { if (success) { var result = Ext.JSON.decode(response.responseText); if (!result.Success) { Ext.Msg.show({ title: '提示', msg: result.Message, icon: Ext.MessageBox.ERROR, buttons: Ext.Msg.OK }); return; } var data = result.data; _this.formEdit.getForm().reset(); _this.formEdit.getForm().setValues(data); this.formGoodsAudit.getForm().reset(); this.formGoodsAudit.getForm().setValues(data); this.formCost.getForm().reset(); this.formCost.getForm().setValues(data); this.formAudit.getForm().reset(); this.formAudit.getForm().setValues(data); var editp = Ext.create('MsOpCtnApply', data); this.editRecord.fields.each(function (field) { if (field.persist) { name = field.name; if (name != 'id') this.editRecord.set(name, editp.get(name)); } }, this); this.editRecord.commit(); this.GetEditStatus(); } else { Ext.MessageBox.alert('请求出现错误,请重试', response.responseText); } }, scope: this }); } } else { Ext.MessageBox.alert('请求出现错误,请重试', response.responseText); } }, scope: this }); }, onAuditCostPassClick: function () { var Duino = this.formEdit.getForm().findField('BSNO').getValue(); var GID = this.formEdit.getForm().findField('GID').getValue(); var billstatus = this.formAudit.getForm().findField('COSTAUDITSTATUS').getValue(); if (billstatus != '提交审核') { Ext.Msg.show({ title: '提示', msg: '当前状态无法审核!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } var basicForm = this.formEdit.getForm(); basicForm.findField('GID').setDisabled(false); var data = basicForm.getValues(false, false, false); basicForm.findField('GID').setDisabled(true); var data2 = this.formAudit.getForm().getValues(false, false, false); _this = this; Ext.Ajax.request({ waitMsg: '正在添加数据...', url: '/MvcContainer/MsOpCtnApply/AuditCostPass', params: { data: Ext.JSON.encode(data), data2: Ext.JSON.encode(data2) }, callback: function (options, success, response) { if (success) { var result = Ext.JSON.decode(response.responseText); if (!result.Success) { Ext.Msg.show({ title: '提示', msg: result.Message, icon: Ext.MessageBox.ERROR, buttons: Ext.Msg.OK }); return; } else { this.LoadData('edit', " GID='" + GID + "'"); } } else { Ext.MessageBox.alert('请求出现错误,请重试', response.responseText); } }, scope: this }); }, onAuditCostBackClick: function () { var Duino = this.formEdit.getForm().findField('BSNO').getValue(); var GID = this.formEdit.getForm().findField('GID').getValue(); var billstatus = this.formAudit.getForm().findField('COSTAUDITSTATUS').getValue(); if (Duino == '*') { Ext.Msg.show({ title: '提示', msg: '请先保存申请,然后才能提交审核!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; }; var AUDITRESULT = this.formAudit.getForm().findField('COSTAUDITRESULT').getValue(); if (AUDITRESULT == '') { Ext.Msg.show({ title: '提示', msg: '驳回提交时,请把驳回原因录入审核反馈中!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } _this = this; var basicForm = this.formEdit.getForm(); basicForm.findField('GID').setDisabled(false); var data = basicForm.getValues(false, false, false); basicForm.findField('GID').setDisabled(true); var data2 = this.formGoodsAudit.getForm().getValues(false, false, false); Ext.Ajax.request({ waitMsg: '正在添加数据...', url: '/MvcContainer/MsOpCtnApply/AuditCostBack', params: { data: Ext.JSON.encode(data), data2: Ext.JSON.encode(data2) }, callback: function (options, success, response) { if (success) { var result = Ext.JSON.decode(response.responseText); if (!result.Success) { Ext.Msg.show({ title: '提示', msg: result.Message, icon: Ext.MessageBox.ERROR, buttons: Ext.Msg.OK }); return; } else { this.LoadData('edit', " GID='" + GID + "'"); } } else { Ext.MessageBox.alert('请求出现错误,请重试', response.responseText); } }, scope: this }); }, SetAuditForm: function () { if (CostAudit == "1") { SetFormReadOnly(this.formCost, true); this.formAudit.getForm().findField('CTN_PRICE').setReadOnly(false); this.formAudit.getForm().findField('CTN_INCOME').setReadOnly(false); this.formAudit.getForm().findField('CURRENCY').setReadOnly(false); this.formAudit.getForm().findField('LOAD_FREE_USECTNE_DAY').setReadOnly(false); this.formAudit.getForm().findField('LOAD_OVER_USECTNE_RATE').setReadOnly(false); this.formAudit.getForm().findField('DEST_FREE_USECTNE_DAY').setReadOnly(false); this.formAudit.getForm().findField('DEST_OVER_USECTNE_RATE').setReadOnly(false); } else { SetFormReadOnly(this.formCost, false); this.formAudit.getForm().findField('CTN_PRICE').setReadOnly(true); this.formAudit.getForm().findField('CTN_INCOME').setReadOnly(true); this.formAudit.getForm().findField('CURRENCY').setReadOnly(true); this.formAudit.getForm().findField('LOAD_FREE_USECTNE_DAY').setReadOnly(true); this.formAudit.getForm().findField('LOAD_OVER_USECTNE_RATE').setReadOnly(true); this.formAudit.getForm().findField('DEST_FREE_USECTNE_DAY').setReadOnly(true); this.formAudit.getForm().findField('DEST_OVER_USECTNE_RATE').setReadOnly(true); } }, PrevRecord: function () { var modifystr = this.getIsModify(); if (modifystr != "") { Ext.Msg.show({ title: '警告', msg: modifystr + '未保存,如果离开此页,将丢失未保存的更改 !!!', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); return; } var j = this.StoreList.indexOf(this.editRecord); if (j == 0) { Ext.Msg.show({ title: '警告', msg: '已是最前一票', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); return; } if (j == this.StoreList.count) { Ext.Msg.show({ title: '警告', msg: '已是最后一票', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); return; } var condition = ''; j = j - 1; this.editRecord = this.StoreList.getAt(j); if (this.opStatus == 'edit') { condition = "GID='" + this.editRecord.get('GID') + "'"; //this.storeBodyList.load({ params: { condition: condition} }); } this.LoadData(this.opStatus, condition); }, // #region 编辑时按钮等的状态 GetEditStatus: function () { var canedit = false; var op = this.formEdit.getForm().findField('INPUTBY').getValue(); var modustr = "modOpCtnApply"; this.StoreOpRange = Ext.create('DsExt.ux.RefTableStore', { model: 'MsOP', proxy: { url: '/MvcShipping/MsBaseInfo/GetOpIDRang' } }); _this = this; this.StoreOpRange.load({ params: { optype: modustr }, 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; } } else { canedit = false; } _this.setSaveBtnStatus(canedit); } } }); }, setSaveBtnStatus: function (enable) { var btnSubmitAudit = Ext.getCmp('btnSubmitAudit'); var btnSubmitAuditBack = Ext.getCmp('btnSubmitAuditBack'); //var btnAuditPass = Ext.getCmp('btnAuditPass'); var btnAuditBack = Ext.getCmp('btnAuditBack'); var btnadddetail = Ext.getCmp('btnadddetail'); var btndeldetail = Ext.getCmp('btndeldetail'); if (enable) { btnSubmitAudit.enable(); btnSubmitAuditBack.enable(); //btnAuditPass.enable(); btnAuditBack.enable(); btnadddetail.enable(); btndeldetail.enable(); } else { btnESave.disable(); btnSubmitAudit.disable(); btnSubmitAuditBack.disable(); //btnAuditPass.disable(); btnAuditBack.disable(); btnadddetail.disable(); btndeldetail.disable(); } }, //#endregion NextRecord: function () { var modifystr = this.getIsModify(); if (modifystr != "") { Ext.Msg.show({ title: '警告', msg: modifystr + '未保存,如果离开此页,将丢失未保存的更改 !!!', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); return; } var j = this.StoreList.indexOf(this.editRecord); if (j == (this.StoreList.data.length - 1)) { Ext.Msg.show({ title: '警告', msg: '已是最后一票', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); return; } var condition = ''; j = j + 1; this.editRecord = this.StoreList.getAt(j); if (this.opStatus == 'edit') { condition = "GID='" + this.editRecord.get('GID') + "'"; //this.storeBodyList.load({ params: { condition: condition} }); } this.LoadData(this.opStatus, condition); }, getIsModify: function () { var drmodify = this.storeBodyCtnList.getModifiedRecords(); if (drmodify.length != 0) return '配箱详细信息'; var isadd = false; for (i = 0; i < this.storeBodyCtnList.getCount(); i += 1) { var memberyf = this.storeBodyCtnList.getAt(i); if (memberyf.data.GID == "*") isadd = true; }; if (isadd) return '配箱详细信息'; if (panelEdit.formEdit.getForm().isDirty() == true) return '申请信息'; else return ''; }, Print: function () { var basicForm = this.formEdit.getForm(); var billNo = basicForm.findField('GID').value; if (billNo == '*' || billNo == '') { Ext.Msg.show({ title: '错误', msg: '单据还没有保存,请保存后再打印', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); return; } var printType = 'MSOPCTNAPPLYADDEDIT'; var sql1 = " select bs.GID,bs.BSNO 业务编号,bs.BSDATE 业务日期 ,bs.SALE 揽货人 ,bs.OP 操作员,bs.CUSTOMERNAME 委托单位,bs.GOODSNAME 品名,bs.GOODTYPE 货物类别,bs.PORTLOAD 装货港 "; var sql1 = sql1 + ",bs.PORTDISCHARGE 目的港,bs.ISOWNERBOOKING 是否我司订舱,bs.CTNALL 箱型, bs.CTNNUM 箱量,bs.PLANCTNDATE 计划用箱日期"; var sql1 = sql1 + ",bs.FACTORYNAME 工厂名称,bs.FACTORYADDR 工厂地址,bs.BSSTATUS 申请状态"; var sql1 = sql1 + ",bs.LOAD_FREE_USECTNE_DAY 起运港免箱使天数 ,bs.LOAD_OVER_USECTNE_RATE 起运港超期箱使费,bs.DEST_FREE_USECTNE_DAY 目的港免箱使天数,bs.DEST_OVER_USECTNE_RATE 目的港超期箱使费"; var sql1 = sql1 + ",bs.INPUTTIME 录入日期,bs.REMARKS 备注"; var sql1 = sql1 + ",bs.AGENTNAME 目的港代理,bs.CTN_PRICE 箱罐价格,bs.CURRENCY 币别"; var sql1 = sql1 + ",bs.ISGOODSNAMESAME 货物是否与MSDS一致,bs.PRODUCTGOODSNAME 工厂其他产品"; var sql1 = sql1 + ",msds.PH,msds.DENSITY 密度,msds.UNNO,msds.MELTINGPOINTB 熔点低,msds.MELTINGPOINTE 熔点高,msds.BOILINGPOINTB 沸点低,msds.BOILINGPOINTE 沸点高,msds.FLASHPOINTB 闪点低,msds.FLASHPOINTE 闪点高,msds.ISPOLLUTEOCEAN 是否海洋污染物"; var sql1 = sql1 + ",bs.AUDITSTATUS 适货审核状态 ,bs.AUDITTIME 适货审核时间"; var sql1 = sql1 + ",bs.AGENTINPUTBY 代理维护人 ,bs.CYCLEDAYS 周期,bs.CHANGERATE 超期箱使费佣金比例"; var sql1 = sql1 + ",bs.FULL_CTN_FREE_STORAGE_DAY 重箱免堆天数, FULL_CTN_OVER_STORAGE_RATE 重箱超期堆存费"; var sql1 = sql1 + ",bs.CLEAR_CTN_FREE_STORAGE_DAY 清洗免堆天数, CLEAR_CTN_OVER_STORAGE_RATE 清洗超期堆存费"; var sql1 = sql1 + ",bs.NO_CLEAR_CTN_FREE_STORAGE_DAY 不清洗免堆天数, NO_CLEAR_CTN_OVER_STORAGE_RATE 不清洗超期堆存费"; var sql1 = sql1 + ",bs.COSTAUDITSTATUS 成本审核状态,bs.COSTAUDITTIME 成本审核时间,MNGAUDITTIME 总经理审核时间"; var sql1 = sql1 + ",bs.CTN_INCOME 内部租金收入 ,bs.LOAD_FREE_USECTNE_DAY 起运港免箱使天数,bs.LOAD_OVER_USECTNE_RATE 起运港超期箱使费"; var sql1 = sql1 + ",(select ShowName from [user] where GID=bs.INPUTBY) as 录入人"; var sql1 = sql1 + ",(select ShowName from [user] where GID=bs.AUDITBY) as 适货审核人"; var sql1 = sql1 + ",(select ShowName from [user] where GID=bs.COSTAUDITBY) as 成本审核人"; var sql1 = sql1 + ",(select ShowName from [user] where GID=bs.MNGAUDITBY) as 总经理审核人"; var sql1 = sql1 + " from op_ctnapply bs "; var sql1 = sql1 + " Left join code_msds msds on bs.GOODSNAME=msds.CHEMICALCGOODSNAME "; var sql1 = sql1 + " WHERE bs.GID = '" + billNo + "'"; var sql2 = "Select GID ,LINKGID 关联编号 ,CTNNO 箱号,AUDITSTATUS 状态 ,TANKVOLUMN 容积,OWNERCTN 罐东,PREGOODNAME 前装货,INPUTTIME 配罐时间 "; var sql2 = sql2 + ",(select ShowName from [user] where GID=bs.INPUTBY) as 配罐人"; var sql2 = sql2 + " From op_ctnapplyctnitems bs"; var sql2 = sql2 + " WHERE LINKGID = '" + billNo + "'"; var sql3 = "Select GID ,LINKGID 关联编号 ,ITEMNAME 项目名称, REMARKS 备注 "; var sql3 = sql3 + "From op_ctnapplysalesitems"; var sql3 = sql3 + " WHERE LINKGID = '" + billNo + "'"; var sql4 = ""; var sql5 = ""; var sql6 = ""; PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6); } });