///
使用扫描枪扫描商品时,请确认【条码】框已获得焦点
", margin: '15' }, buttonCtn] }); var win = Ext.create('Ext.window.Window', { title: '入库盘点', layout: 'fit', id: 'optionWin', draggable: true, //拖动 x: event.clientX, y: event.clientY, resizable: false, items: { // Let's put an empty grid in just to illustrate fit layout xtype: 'panel', border: true, items: [layerPanel] }, listeners: { afterrender: function () { setTimeout(function () { Ext.getCmp("ctnCombo").focus(); }, 500); } } }); win.show(); }, scope: this }], columns: this.girdcolums, listeners: { 'beforeedit': function (o) { if (LOCK1 == '1') { return false; } } }, viewConfig: { stripeRows: false, getRowClass: function (record, rowIndex) {//CSS class name to add to the row.获得一行的css样式 if (record.get('JIANSHU1') === record.get('JIANSHU2') && record.get('JIANSHU1') !== 0) { return 'x-grid-row-green'; } } } }); //////////////////////////////////////////////明细<<<< WMS_In列表 >>>>结束 //#endregion //#region 编辑wms_rate this.storeWMSRATE = Ext.create('Ext.data.Store', { model: 'WMSRATEmb', pageSize: this.PageSize, remoteSort: false, pruneModifiedRecords: true, proxy: { type: 'ajax', url: '/MvcShipping/WMSNew/GetWMSRATE', reader: { id: 'GID', root: 'data', totalProperty: 'totalCount' } } }); Ext.define('FeeTypeMd', { extend: 'Ext.data.Model', fields: [ { name: 'FeeTypeID', type: 'string' }, { name: 'FeeTypeName', type: 'string' } ] }); var FeeTypeData = [{ "FeeTypeID": "1", "FeeTypeName": "收" }, { "FeeTypeID": "2", "FeeTypeName": "付" }]; this.storeFeeType = Ext.create('Ext.data.Store', { model: 'FeeTypeMd', data: FeeTypeData }); this.comboxFeeTypeRef = Ext.create('DsExt.ux.RefEnumCombox', { //fieldLabel: '收付类型', store: this.storeFeeType, name: 'FEETYPE', valueField: 'FeeTypeID', displayField: 'FeeTypeName' }); this.WMSRATEcolumn = [ { sortable: true, hidden: true, dataIndex: 'GID', header: '惟一编号', width: 80 }, { sortable: true, hidden: true, dataIndex: 'CUSTOMERNAME', header: '客户名称', width: 80 }, { sortable: true, dataIndex: 'FEEGRADE', header: '计费等级', width: 80, editor: { xtype: 'numberfield' } }, { sortable: true, dataIndex: 'FEETYPE', header: '收付方向', width: 80, renderer: function (value, p, record) { if (value == null || value == '') return ''; else return record.data.FEETYPE == '1' ? '收' : '付'; }, editor: this.comboxFeeTypeRef }, { sortable: true, dataIndex: 'FEESCALE', header: '计费区间(天数)', width: 80, editor: { xtype: 'numberfield' } }, { sortable: true, dataIndex: 'FEEPRICE', header: '计费单价', width: 80, editor: { xtype: 'numberfield' }, 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; } }, { sortable: true, hidden: true, dataIndex: 'FEEUNIT', header: '计费单位', width: 80 }, { sortable: true, hidden: true, dataIndex: 'CREATEUSER', header: '创建人ID', width: 80 }, { sortable: true, hidden: true, dataIndex: 'CREATEUSER2', header: '创建人', width: 80 }, { sortable: true, hidden: true, dataIndex: 'CREATETIME', header: '创建时间', width: 80, renderer: Ext.util.Format.dateRenderer('Y-m-d') }, { sortable: true, dataIndex: 'MODIFIEDUSER', header: '最后一次操作人', width: 80 }, { sortable: true, hidden: true, dataIndex: 'MODIFIEDTIME', header: '最后一次操作时间', width: 80, renderer: Ext.util.Format.dateRenderer('Y-m-d') }, { sortable: true, dataIndex: 'REMARK', header: '备注', width: 80 }, { sortable: true, hidden: true, dataIndex: 'BSNO', header: '关联的WMS的GID', width: 80 }, { sortable: true, dataIndex: 'ADDPRICE', header: '增值价', width: 80, editor: { xtype: 'numberfield' } }, { sortable: true, dataIndex: 'CAPPRICE', header: '封顶价', width: 80, editor: { xtype: 'numberfield' } }, { sortable: true, dataIndex: 'ENDBILLINGDATE', header: '结束计费日期', width: 80, editor: { xtype: 'datefield', format: 'Y-m-d', selectOnFocus: true }, renderer: Ext.util.Format.dateRenderer('Y-m-d') }, { sortable: true, hidden: true, dataIndex: 'RATETYPE', header: '费率类型', width: 80 }, { sortable: true, hidden: true, dataIndex: 'FEENAME', header: '费用中文名称', width: 80 }, { sortable: true, hidden: true, dataIndex: 'ISCHANGE', header: '是否是货权转移', width: 80 } ]; this.rategirdcolums = this.WMSRATEcolumn; this.rategirdcolums = DsTruck.GetGridPanel(GID, this.formnamerate, this.rategirdcolums, 0); //使用者id,表名,中间column数组,跳过一开始的几列 this.CE_RATE = Ext.create('Ext.grid.plugin.CellEditing', { clicksToEdit: 1 }); this.CB_RATE = Ext.create('Ext.selection.CheckboxModel'); this.formWMSRATE = new Ext.grid.GridPanel({ store: this.storeWMSRATE, enableHdMenu: false, columnLines: true, //layout: 'border', region: 'center', //title: '仓储费费率区间', loadMask: { msg: "数据加载中,请稍等..." }, trackMouseOver: true, disableSelection: false, plugins: [this.CE_RATE], selModel: this.CB_RATE, selType: 'cellmodel', features: [{ ftype: 'summary'//Ext.grid.feature.Summary表格汇总特性 }], tbar: [{ xtype: 'label', text: '仓储费费率区间', style: 'font-size:18px', labelColor: '#0f0', //style:'background-color: #4b9bf5', x: '5%', y: '5%' }, { text: '新建', id: "addrate", tooltip: '增加仓储费费率区间', iconCls: "btnadddetail", handler: function (button, event) { if (LOCK1 == '1') { Ext.MessageBox.alert('提示', '已入账不允许修改!'); return; } this.onAddWMSRATEClick(button, event); }, scope: this }, { text: '删除', id: "delrate", tooltip: '删除仓储费费率区间', iconCls: "btndeletedetail", handler: function (button, event) { if (LOCK1 == '1') { Ext.MessageBox.alert('提示', '已入账不允许修改!'); return; } this.onDelWMSRATEClick(button, event); }, scope: this }, '-', { id: "btnSave", text: '保存', tooltip: '保存', iconCls: "btnsave", handler: function (button, event) { if (LOCK1 == '1') { Ext.MessageBox.alert('提示', '已入账不允许修改!'); return; } this.SaveRate(); //alert(USERID); }, scope: this }, '-', { text: "保存列表样式", menu: [{ text: "保存", handler: function (button, event) { _this.rategirdcolums = DsTruck.SaveGridPanel(GID, _this.formnamerate, _this.formWMSRATE.columns, _this.rategirdcolums, 0, true); //使用者id,表名,中间column数组,跳过一开始的几列 } }, { text: "初始化", handler: function (menu, event) { _this.formWMSRATE.reconfigure(_this.formWMSRATE, _this.WMSRATEcolumn); _this.rategirdcolums = DsTruck.SaveGridPanel(GID, _this.formnamerate, _this.formWMSRATE.columns, _this.WMSRATEcolumn, 0, true); //使用者id,表名,中间column数组,跳过一开始的几列 } }], scope: this }, '-', { id: "btnFeeModel", text: '导入仓储费模板', tooltip: '导入仓储费模板', handler: function (button, event) { this.ImportFeeModel(); //alert(USERID); }, scope: this }], columns: this.rategirdcolums }); //#endregion Ext.define('FeeTypeMd', { extend: 'Ext.data.Model', fields: [ { name: 'FeeTypeID', type: 'string' }, { name: 'FeeTypeName', type: 'string' } ] }); var FeeTypeData = [{ "FeeTypeID": "1", "FeeTypeName": "收" }, { "FeeTypeID": "2", "FeeTypeName": "付" }]; this.storeFeeType = Ext.create('Ext.data.Store', { model: 'FeeTypeMd', data: FeeTypeData }); this.comboxFeeTypeRef = Ext.create('DsExt.ux.RefEnumCombox', { //fieldLabel: '收付类型', store: this.storeFeeType, name: 'FEETYPE', valueField: 'FeeTypeID', displayField: 'FeeTypeName' }); //公共按钮Toolbar:panelBtn this.panelBtn = new Ext.Panel({ region: "north", tbar: [ { // id: "saveandclose", text: "保存", iconCls: "btnsave", handler: function (button, event) { this.Save('0'); }, scope: this }, { // id: "saveandclose", text: "保存并关闭", handler: function (button, event) { this.Save('1'); }, scope: this }, '-', { // id: "saveandclose", text: "关闭", handler: function (button, event) { window.close(); }, scope: this }, '-', { text: "打印", id: "btnprint", iconCls: 'btnprint', handler: function (button, event) { this.onPrintClick(button, event); }, scope: this }, '-', { text: "入账", id: "btnLock", iconCls: 'new_lock', handler: function (button, event) { if (button.text == "入账") { this.LockWMS("1"); } else { this.LockWMS("0"); } }, scope: this }, '-', { text: "锁定", id: "btnLock2", iconCls: 'new_lock', handler: function (button, event) { if (button.text == "锁定") { this.LockWMS2("1"); } else { this.LockWMS2("0"); } }, scope: this } ] }); //end 按钮Toolbar this.panelTop; //#region//布局 parentWin = window.parent.opener; if (parentWin) { var ret = parentWin.OprationSwap(); this.OpStatus = ret[0]; //edit this.StoreList = ret[1]; this.EditRecord = ret[2]; //SelectedRecord this.parentRecord = ret[3]; this.OPLBNAME = ret[4]; parentWin = window.parent.opener; if (this.OPLBNAME == "WMSIN") { //如果是入库管理处双击打开 this.mainWin = getMainForm(parentWin); } else { //如果是海运进口处双击打开 this.mainWin = getMainForm_Opener(parentWin); } //this.storeCustCode.loadData(this.mainWin.GetPubStore("OPSEAE_CUST_ISCONTROLLER").data.items); //this.storeGainCust.loadData(this.mainWin.GetPubStore("INFOCLIENT_ALL").data.items); //this.storePayCust.loadData(this.mainWin.GetPubStore("INFOCLIENT_ALL").data.items); } if (this.OpStatus == "add" && this.OPLBNAME == '海运进口') { this.panelTop = new Ext.Panel({ region: "north", height: 197, items: [this.panelBtn, this.formEdit] }); } else if (this.OpStatus == "add" && this.OPLBNAME != 'WMSMAIN') { this.panelTop = new Ext.Panel({ //layout: "border", region: "north", height: 240, //split: true, items: [this.panelBtn, this.formSearch, this.formEdit] }); } else { this.panelTop = new Ext.Panel({ region: "north", height: 197, items: [this.panelBtn, this.formEdit] }); } //#region 其他 this.panelFee = new Shipping.FeeEditGrid({ region: 'center', layout: 'border' }); if (FEECONFIG == '1') { this.panelFee.stroplb = 'op_Seai'; } else { this.panelFee.stroplb = 'op_other'; } this.panelFee.StoreCustType.add({ "SCUSTTYPE": "WTDW-委托单位", "CUSTTYPE": "委托单位", "CUSTNAME": "CUSTOMERNAME" }); this.panelFee.StoreCustType.add({ "SCUSTTYPE": "CGS-船公司", "CUSTTYPE": "船公司", "CUSTNAME": "CARRIER" }); this.panelFee.StoreCustType.add({ "SCUSTTYPE": "DCDL-订舱代理", "CUSTTYPE": "订舱代理", "CUSTNAME": "FORWARDER" }); this.panelFee.StoreCustType.add({ "SCUSTTYPE": "BGH-报关行", "CUSTTYPE": "报关行", "CUSTNAME": "CUSTOMSER" }); this.panelFee.StoreCustType.add({ "SCUSTTYPE": "CD-车队", "CUSTTYPE": "车队", "CUSTNAME": "TRUCKER" }); this.panelFee.StoreCustType.add({ "SCUSTTYPE": "FHR-发货人", "CUSTTYPE": "发货人", "CUSTNAME": "SHIPPERID" }); this.panelFee.StoreCustType.add({ "SCUSTTYPE": "SHR-收货人", "CUSTTYPE": "收货人", "CUSTNAME": "CONSIGNEEID" }); this.panelFee.StoreCustType.add({ "SCUSTTYPE": "TZR-通知人", "CUSTTYPE": "通知人", "CUSTNAME": "NOTIFYPARTYID" }); this.panelFee.StoreCustType.add({ "SCUSTTYPE": "DL-代理", "CUSTTYPE": "代理", "CUSTNAME": "AGENTID" }); this.panelFee.StoreCustType.add({ "SCUSTTYPE": "CZ-场站", "CUSTTYPE": "场站", "CUSTNAME": "YARD" }); if (FEECONFIG == '1') { this.panelFee.StoreDrOpRange.load({ params: { optype: "modSeaiRecvFeeManagement" } }); this.panelFee.StoreCrOpRange.load({ params: { optype: "modSeaiPayFeeManagement" } }); } else { this.panelFee.StoreDrOpRange.load({ params: { optype: "modOtherRecvFeeManagement" } }); this.panelFee.StoreCrOpRange.load({ params: { optype: "modOtherPayFeeManagement" } }); } this.panelFee.storeFeeNameRef.load({ params: { condition: "" } }); this.panelChFee = new Ext.Panel({ region: 'center', layout: 'border', margin: '0 0', height: 580, //width: 450, items: [/*this.panelChFee_YS, this.panelChFee_YF*/ this.panelFee ] }); //#endregion this.panelWMSINBody = new Ext.Panel({ layout: "border", region: 'center', frame: true, split: true, items: [this.formWMSINBody] }); this.panelWMSRATE = new Ext.Panel({ layout: "border", region: 'south', height: 190, frame: true, items: [this.formWMSRATE] }); this.panelWMSIN = new Ext.Panel({ layout: "anchor", region: 'center', items: [this.panelWMSINBody] }); this.page_1 = new Ext.Panel({ id: "page_1", title: "入库信息", layout: "border", region: 'center', items: [this.panelWMSINBody, this.panelWMSRATE] }); this.page_2 = new Ext.Panel({ id: "page_2", autoScroll: true, title: "入库相关应收应付费用", layout: "border", region: 'center', items: [this.panelChFee ] }); this.PageTab = new Ext.tab.Panel({ layout: "border", region: "center", split: true, items: [this.page_1, this.page_2] }); this.page_main= new Ext.Panel({ id: "page_main", autoScroll: true, title: "入库信息", layout: "border", region: 'center', items: [this.panelTop, this.PageTab ] }); this.panelAmendFee = new Shipping.FeeAmendEditGrid({ region: 'center', title: "更改单", layout: 'border' }); if (this.OPLBNAME != '海运进口' && this.OPLBNAME != 'WMSMAIN') { this.Main = new Ext.tab.Panel({ layout: "border", region: "center", split: true, items: [this.page_main, this.panelAmendFee] }); } else { this.Main = new Ext.tab.Panel({ layout: "border", region: "center", split: true, items: [this.page_main] }); } Ext.apply(this, { items: [this.Main] }); this.InitData(); //#endregion //集中绑定事件 this.formWMSINBody.on('edit', function (editor, e, eOpts) { this.WMSINAfterEdit(editor, e, eOpts); }, this); this.formWMSRATE.on('edit', function (editor, e, eOpts) { this.WMSRATEAfterEdit(editor, e, eOpts); }, this); this.cellEditing.on('beforeedit', function (editor, e) { return this.WMSINBeforeEdit(editor, e); }, this); this.storeWMSIN.on('beforeload', function (store) { var GID = this.EditRecord.get('GID'); Ext.apply(store.proxy.extraParams, { condition: " ASSOCIATEDNO='" + GID + "'" }); }, this); this.storeWMSRATE.on('beforeload', function (store) { var GID = this.EditRecord.get('GID'); Ext.apply(store.proxy.extraParams, { condition: " BSNO='" + GID + "'" }); }, this); //定义原产国数据集 if (this.OPLBNAME == '海运进口') { Ext.Ajax.request({ url: '/MvcShipping/MsOpSeai/GetCountryForWMSIn', params: { condition: " BSNO='" + _this.parentRecord.get('BSNO') + "'" }, callback: function(options, success, response) { if (success) { var result = Ext.JSON.decode(response.responseText); if (!result.Success) { return; } data = result.data; var a = JSON.stringify(data); var obj = eval('(' + a + ')'); COUNTRYNAMESTR = obj.country; COUNTRYIDSTR = obj.countryid; } } }); } }, //end initUIComponents parentfunction: function (button, event) { var ret1 = window.parent.opener.OprationSwap(); ret1[3](); OPLBNAME = ret1[4]; }, onAddWMSINClick: function (button, event, type) { var store = null; var data = this.formEdit.getForm().getValues(); store = this.storeWMSIN; var jianshu1 = store.data.items.length > 0 ? store.data.items[store.data.items.length - 1].data.JIANSHU1 : 0; var jianshu2 = store.data.items.length > 0 ? store.data.items[store.data.items.length - 1].data.JIANSHU2 : 0; var zongjianshu = store.data.items.length > 0 ? store.data.items[store.data.items.length - 1].data.GOODSPACK : 0; var goodsmodel = store.data.items.length > 0 ? store.data.items[store.data.items.length - 1].data.GOODSMODEL : ''; var countryid = COUNTRYIDSTR; if (countryid=='') countryid = store.data.items.length > 0 ? store.data.items[store.data.items.length - 1].data.COUNTRYID : ''; var goodskgs = store.data.items.length > 0 ? store.data.items[store.data.items.length - 1].data.GOODSKGS : 0; var pinming = store.data.items.length > 0 ? store.data.items[store.data.items.length - 1].data.GOODSNAMEDISPLAY : ''; var pinmingid = store.data.items.length > 0 ? store.data.items[store.data.items.length - 1].data.GOODSNAMEID : ''; var guigejianshu = store.data.items.length > 0 ? store.data.items[store.data.items.length - 1].data.GOODSSTANDARD : ''; var baozhuangjianshu = store.data.items.length > 0 ? store.data.items[store.data.items.length - 1].data.GOODSSLICE : ''; //var countryid = store.data.items.length > 0 ? store.data.items[store.data.items.length - 1].data.COUNTRYID : ''; //var country = store.data.items.length > 0 ? store.data.items[store.data.items.length - 1].data.COUNTRY : ''; var country = COUNTRYNAMESTR; var record = null; var areaname = data.AREANAME; var BSNO = ""; var CLIENTNAME = ""; var STORAGENAME = ""; var GOODSNAME = ""; var GOODSMODEL = ""; var GOODSSTANDARD = ""; var CHARGEUNIT = ""; var DODATE = ""; if (this.OpStatus == "add") { BSNO = ""; CLIENTNAME = data.CUSTOMERNAME; STORAGENAME = ""; GOODSNAME = data.GOODSNAME; //GOODSMODEL = ""; GOODSMODEL = data.GOODSMODEL; GOODSSTANDARD = ""; CHARGEUNIT = data.CHARGEUNIT; DODATE = data.WMSDATE; } else { BSNO = this.EditRecord.get('WMSNO'); CLIENTNAME = this.EditRecord.get('CUSTOMERNAME'); STORAGENAME = this.EditRecord.get('STORAGENAME'); GOODSNAME = this.EditRecord.get('GOODSNAME'); //GOODSMODEL = this.EditRecord.get('GOODSMODEL'); GOODSMODEL = data.GOODSMODEL; GOODSSTANDARD = this.EditRecord.get('GOODSSTANDARD'); CHARGEUNIT = this.EditRecord.get('CHARGEUNIT'); DODATE = data.WMSDATE; } if (GOODSMODEL == '') GOODSMODEL=goodsmodel; var newid = NewGuid(); record = Ext.create('WMSINmb', { //GOODSNAMEDISPLAY: pinming, GID: newid, ASSOCIATEDNO: "", BLNO: "", CONTRACTNO: "", CTNALL: CTNALL, CNTRNO: '', SEALNO: SEALNO, BSNO: BSNO, CLIENTCODE: "", CLIENTNAME: CLIENTNAME, DODATE: DODATE, STORAGECODE: "", STORAGENAME: STORAGENAME, AREACODE: "", AREANAME: areaname, GOODSCODE: "", GOODSNAME: GOODSNAME, GOODSNAMEID: pinmingid, GOODSNAMEDISPLAY: pinming, GOODSTYPE: "", GOODSMODEL: GOODSMODEL, GOODSSTANDARD: guigejianshu, GOODSPACK: zongjianshu, GOODSPACKSTOCK: "0", GOODSKGS: goodskgs, CHARGEUNIT: CHARGEUNIT, GOODSRKSL: "0", GOODSSTOCK: "0", FREESTORAGEPERIOD: "0", ISLOCK: "0", LOCKTIME: "1900-01-01", LOCKUSER: "", ISDELETE: "0", DELETETIME: "1900-01-01", DELETEUSER: "", CREATEUSER: "", CREATETIME: '2017-05-22', MODIFIEDUSER: "", MODIFIEDTIME: '2017-05-22', REMARK: "", CLIENTCODEOLD: "", CLIENTNAMEOLD: "", KINDPKGS: "", ARFEE: "0", APFEE: "0", CORPID: COMPANYID, GOODSTHICKNESS: "0", GOODSWIDTH: "0", GOODSLENGTH: "0", GOODSSLICE: baozhuangjianshu, GOODSGRADE: "", STACKLOCATION: "", GOODSPACKACTUAL: "0", GOODSRKSLACTUAL: "0", ISCHANGE: "0", MARKETVALUE: "0", BANKVALUE: "0", JIANSHU2: jianshu2, JIANSHU1: jianshu1, LINENUM: this.getLinenum(), CHIMA1: "0", CHIMA2: "0", ZHONGLIANG2: "0", SHIJIZHONGLIANG: "0", SHIJICHIMA: "0", COUNTRY: country, COUNTRYID: countryid }); store.add(record); cellediting = this.cellEditing; var n = store.getCount(); cellediting.startEditByPosition({ row: n - 1, column: 2 }); /* this.storeWMSIN.each(function (record) { if (record.get('GID') == newid) { record.set('DODATE', Ext.util.Format.date(currdate, 'Y-m')); } }); */ }, onDelWMSINClick: function (button, event, type) { var feeGidSql = ''; var selectedRecords = []; selectedRecords = this.CheckBoxModel.selected.items; if (selectedRecords.length == 0) { Ext.Msg.show({ title: '提示', msg: '请先选择要删除的入库信息!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } Ext.MessageBox.confirm('提示', '确定要删除选中的入库信息吗?', function (btn) { if (btn == 'yes') { if (this.OpStatus == 'edit' && this.EditRecord.get('ISLOCK') == "True") { alert("不能删除已入账的入库记录。"); return; } if (this.OpStatus == 'edit' && this.EditRecord.get('ISLOCK2') == "True") { alert("不能删除已锁定的入库记录。"); return; } if (selectedRecords.length > 0) { for (var i = 0; i < selectedRecords.length; i++) { var rec = selectedRecords[i]; if (rec.data.ASSOCIATEDNO != "") //如果是新增但没有保存的数据,没有必要提交到后台 { this.WMSINBodyDel.push(rec); } this.storeWMSIN.remove(selectedRecords[i]); } } } }, this); }, getLinenum: function (button, event) { var _L = 0; for (var i = 0; i < this.storeWMSIN.getCount(); i++) { var _t = parseInt(this.storeWMSIN.getAt(i).get("LINENUM")); if (_t > _L) { _L = _t; } } _L++; return _L; }, getLinenum2: function (FEETYPE, GID) { var _L = 0; for (var i = 0; i < this.storeWMSRATE.getCount(); i++) { if (FEETYPE != this.storeWMSRATE.getAt(i).get("FEETYPE") || this.storeWMSRATE.getAt(i).get("GID") == GID) { continue; } var _t = parseInt(this.storeWMSRATE.getAt(i).get("FEEGRADE")); if (_t > _L) { _L = _t; } } _L++; return _L; }, //getLinenum2: function (FEETYPE, GID) { // var _L = 0; // var _store = this.storeWMSRATE.find('FEETYPE', FEETYPE); // if (_store == -1) return 1; // if (_store.getCount() == 0) return 1; // for (var i = 0; i < _store.getCount(); i++) { // _store.getAt(i).set('FEEGRADE', i + 1); // if (GID == _store.getAt(i).get('GID')) // _L = i + 1; // } // if (_L == 0) return _store.getCount()+1; // return _L; //}, onDelClick: function (button, event) { var selectedRecords = this.formFeeBody.selModel.getSelection(); Ext.MessageBox.confirm('提示', '确定删除记录吗?', function (btn) { if (btn == 'yes') { for (var i = 0; i < selectedRecords.length; i++) { var rec = selectedRecords[i]; if (rec.BXGID != "" || rec.BXGID != "*") //如果是新增但没有保存的数据,没有必要提交到后台 { this.feeBodyDel.push(rec); } } } }, this); //aftereditform(); var Amount_ALL = 0; }, WMSINAfterEdit: function (editor, e, eOpts) { var data = this.formEdit.getForm().getValues(); if (!BLNO && data.BLNO) BLNO = data.BLNO; if (COMPANYID == "" || DEPTGID == "") { alert("登录信息不全,请退出重新登录"); returen; } //选择箱型带出箱号列表 if (e.field == 'CTNALL' ) { var ctnall = Ext.getCmp('CTNALL').rawValue; this.storeCNTRNO.load({ params: { mblno: BLNO, ctnall: ctnall} }); } //选择品名带出规格/件数列表 if (e.field == 'GOODSNAMEID') { var display = Ext.getCmp('GOODSNAME').rawValue; var coodgoodsid = e.record.data.GOODSNAMEID; e.record.set('GOODSNAMEDISPLAY', display); var temp = ""; if (display == e.value) { temp = display; e.record.set('GOODSNAMEDISPLAY', temp); e.record.set('GOODSNAME', temp); Ext.getCmp('GOODSNAME').setValue(temp); } else { Ext.Ajax.request({ waitMsg: '正在查询主表数据...', url: '/MvcShipping/WMSNew/GetGoodsInfoWithName', params: { goodsname: coodgoodsid }, callback: function (options, success, response) { if (success) { var jsonresult = Ext.JSON.decode(response.responseText); e.record.set('GOODSNAMEDISPLAY', jsonresult.CodeAndName); e.record.set('GOODSNAMEID', jsonresult.data); Ext.getCmp('GOODSNAME').setValue(coodgoodsid); } }, scope: this }); //request over } //规格/件数列表 //this.storeGoodsDetailsList.load({ params: { codegoodsid: coodgoodsid }}); } //选择车队 if (e.field == 'CHEDUIID') { var cdName = this.comboxCheDui.rawValue; var cdValue = this.comboxCheDui.value; e.record.set('CHEDUI', cdName); this.storeWMSIN.each(function (record) { if (isNullorEmpty(record.get('CHEDUI'))){ record.set('CHEDUI', cdName); record.set('CHEDUIID', cdValue); } }); } //选择装卸工,带出装卸费 if (e.field == 'ZHUANGXIEGONGID') { var zxgcodename = this.comboxZhuangXieGong.rawValue; e.record.set('ZHUANGXIEGONG', zxgcodename); var feeType = e.record.data.ZhuangXieFeeType; var ton = e.record.data.SHIJIZHONGLIANG; var jian = e.record.data.GOODSPACK; var jianOrTon = 0; if (feeType == '件数') { jianOrTon = jian; } else { jianOrTon = ton; } var zhuangxiegongid = e.record.data.ZHUANGXIEGONGID; e.record.set('GOODSNAMEDISPLAY', display); var temp = ""; Ext.Ajax.request({ waitMsg: '正在查询主表数据...', url: '/MvcShipping/WMSNew/GetZhuangXieFeiWithZhuangXieGongID', params: { gid: zhuangxiegongid }, callback: function (options, success, response) { if (success) { var jsonresult = Ext.JSON.decode(response.responseText); var feeJian = jsonresult.data1; var feeTon = jsonresult.data2; e.record.set('ZhuangXieFeiDanJiaTon', feeTon); e.record.set('ZhuangXieFeiDanJiaJian', feeJian); if (feeType == '件数') { e.record.set('ZhuangXieFei', feeJian * jianOrTon); } else if (feeType == '') { e.record.set('ZhuangXieFei', 0); } else { e.record.set('ZhuangXieFei', feeTon * jianOrTon); } } }, scope: this }); //request over } //选择装卸计费标准计算装卸费ZhuangXieFeeType if (e.field == 'ZhuangXieFeeType' || e.field == 'SHIJIZHONGLIANG' || e.field == 'GOODSPACK' || e.field == 'LinShiZhuangXieFeiDanJiaJian' || e.field == 'LinShiZhuangXieFeiDanJiaDun') { var feeType = e.record.data.ZhuangXieFeeType; var ton = e.record.data.SHIJIZHONGLIANG; var jian = e.record.data.GOODSPACK; var feeJian = e.record.data.ZhuangXieFeiDanJiaJian; if (e.record.data.LinShiZhuangXieFeiDanJiaJian > 0) { feeJian = e.record.data.LinShiZhuangXieFeiDanJiaJian; } var feeTon = e.record.data.ZhuangXieFeiDanJiaTon; if (e.record.data.LinShiZhuangXieFeiDanJiaJian > 0) { feeTon = e.record.data.LinShiZhuangXieFeiDanJiaDun; } var jianOrTon = 0; if (feeType == '件数') { jianOrTon = jian; } else { jianOrTon = ton; } if (feeType == '件数') { e.record.set('ZhuangXieFei', feeJian * jianOrTon); } else if (feeType == '入库量(吨)') { e.record.set('ZhuangXieFei', feeTon * jianOrTon); } } // Ext.getCmp('GOODSDETAILSNAME').setValue(''); if (e.field == 'GOODSMODEL') { var goodsDetailsName = e.record.data.GOODSMODEL; if (!isNullorEmpty(goodsDetailsName)) var codeGoodsId = e.record.data.GOODSNAMEID; var temp = ''; Ext.Ajax.request({ waitMsg: '正在查询主表数据...', url: '/MvcShipping/WMSNew/GetPKGWithGoodsDetailsNameAndCodeGoodsId', params: { goodsDetailsName: goodsDetailsName, codeGoodsId: codeGoodsId }, callback: function (options, success, response) { if (success) { var jsonresult = Ext.JSON.decode(response.responseText); e.record.set('GOODSSTANDARD', jsonresult.data); var val = parseInt(e.record.get('GOODSSLICE')); var val2 = parseInt(e.record.get('GOODSSTANDARD')); if (isNaN(val)) { val = 0; } if (isNaN(val2)) { val2 = 0; } e.record.set('GOODSPACK', val * val2); e.record.set('GOODSPACKSTOCK', val * val2); } }, scope: this }); //request over } //计算入库件数与剩余件数 if (e.field == 'GOODSSLICE') { var val = parseInt(e.record.get('GOODSSLICE')); var val2 = parseInt(e.record.get('GOODSSTANDARD')); if (isNaN(val)) { val = 0; } if (isNaN(val2)) { val2 = 0; } e.record.set('GOODSPACK', val * val2); e.record.set('GOODSPACKSTOCK', val * val2); } //实际件数=剩余件数=总件数=件数1+件数2 //if (e.field == 'GOODSPACK' || e.field == 'JIANSHU2') { if (e.field == 'JIANSHU1' || e.field == 'JIANSHU2') { var JIANSHU1 = parseFloat(e.record.get('JIANSHU1')); var JIANSHU2 = parseFloat(e.record.get('JIANSHU2')); e.record.set('GOODSPACK', JIANSHU1 + JIANSHU2); e.record.set('GOODSPACKACTUAL', JIANSHU1 + JIANSHU2); e.record.set('GOODSPACKSTOCK', JIANSHU1 + JIANSHU2); //GOODSSTOCK e.record.set('GOODSSTOCK', JIANSHU1 * CHIMA1); } //实际尺码=尺码1+尺码2 if (e.field == 'CHIMA1' || e.field == 'CHIMA2') { var CHIMA1 = parseFloat(e.record.get('CHIMA1')); var CHIMA2 = parseFloat(e.record.get('CHIMA2')); e.record.set('SHIJICHIMA', CHIMA1 + CHIMA2); e.record.set('GOODSSTOCK', JIANSHU1 * CHIMA1); } //实际重量=重量1+重量2 if (e.field == 'GOODSKGS' || e.field == 'ZHONGLIANG2') { var ZHONGLINAG1 = parseFloat(e.record.get('GOODSKGS')); var ZHONGLIANG2 = parseFloat(e.record.get('ZHONGLIANG2')); e.record.set('SHIJIZHONGLIANG', ZHONGLINAG1 + ZHONGLIANG2); } //库存量 var JIFEIDANWEI = e.record.get('CHARGEUNIT'); if (JIFEIDANWEI == "吨") { var SHIJIZHONGLIANG = parseFloat(e.record.get('SHIJIZHONGLIANG')); e.record.set('GOODSRKSL', SHIJIZHONGLIANG); } else if (JIFEIDANWEI == "千克") { var SHIJIZHONGLIANG = e.record.get('SHIJIZHONGLIANG'); e.record.set('GOODSRKSL', SHIJIZHONGLIANG); } else if (JIFEIDANWEI == "CBM") { var SHIJICHIMA = e.record.get('SHIJICHIMA'); e.record.set('GOODSRKSL', SHIJICHIMA); } //库存量=入库数量 var KUCUNLIANG = e.record.get('GOODSRKSL'); e.record.set('GOODSSTOCK', KUCUNLIANG); //选择箱号带出封号,集装箱件数,CBM(尺码)(入库件数) if (e.field == 'CNTRNO' /*&& e.record.get('CHARGEUNIT') == 'CBM'*/) { var cntrno = Ext.getCmp('CNTRNO').rawValue; Ext.Ajax.request({ waitMsg: '正在查询主表数据...', url: '/MvcShipping/WMSNew/GetSEALNOWithBLNOAndCNTRNO', params: { bsno: BLNO, cntrno: cntrno }, callback: function (options, success, response) { var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { e.record.set('SEALNO', jsonresult.data); e.record.set('GOODSSLICE', jsonresult.pkgs); e.record.set('SHIJICHIMA', jsonresult.cbm); e.record.set('GOODSRKSL', jsonresult.cbm); } }, scope: this }); //request over } if (e.field == 'COUNTRYID') { var COUNTRY = DsStoreQueryBy(this.storeCountry, 'countryid', e.value); if (COUNTRY.getCount() > 0) { var COUNTRYdata = COUNTRY.getAt(0).data; e.record.set('COUNTRY', COUNTRYdata.country); } else { e.record.set('COUNTRY', ''); } } //装卸费模板判断导入 if ( e.field == 'CHIMA1' || e.field == 'CHIMA2' || e.field == 'GOODSKGS' || e.field == 'ZHONGLIANG2' || e.field == 'JIANSHU1' || e.field == 'JIANSHU2') { pimingid = e.record.get('GOODSNAMEID'); ARCLIENT = Ext.getCmp("ARCLIENT").getValue(); dodate = Ext.getCmp("WMSDATE").getValue(); storagename = Ext.getCmp("STORAGENAME").getValue(); Ext.Ajax.request({// waitMsg: '正在处理数据...', url: '/MvcShipping/WMSNew/GetLoaderFeeModel', params: { custname: ARCLIENT, goodnameid: pimingid, wmsdate: dodate, feetype: '1', storagename:STORAGENAME }, callback: function (options, success, response) { var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { if (jsonresult.data.length > 0) { var feedata = jsonresult.data[0]; var unit = feedata.FEEUNIT; var price = feedata.FEEPRICE; var num = e.record.get('GOODSRKSL'); e.record.set('LOADERFEE', num * price); //if (unit == "CBM") { // e.record.set('LOADERFEE', feeTon * price); //} else { // e.record.set('LOADERFEE', feeTon * price); //} } } else { alert(jsonresult.Message); } }, scope: this }); //request over } }, WMSINBeforeEdit: function (editor, e, eOpts, a, b, c, d) { var data = this.formEdit.getForm().getValues(); if (!BLNO && data.BLNO) BLNO = data.BLNO; //需要自己实现里面的事件 if (COMPANYID == "" || DEPTGID == "") { alert("登录信息不全,请退出重新登录"); returen; } if (e.field === 'GOODSMODEL') {//规格 var codeGoodsId = e.record.data.GOODSNAMEID; this.storeGoodsDetailsList.load({ params: { codegoodsid: codeGoodsId }}); } if (e.field === 'CNTRNO') {//箱号 //如果箱号为空 且箱型不为空 载入箱号store if (!e.record.data.CNTRNO && e.record.data.CTNALL) { this.storeCNTRNO.load({ params: { mblno: BLNO, ctnall: e.record.data.CTNALL } }); } } }, InitData: function () { this.OpStatus = 'add'; var condition = ''; if (parentWin) { var ret = parentWin.OprationSwap(); this.OpStatus = ret[0]; //edit this.StoreList = ret[1]; this.EditRecord = ret[2]; //SelectedRecord this.parentRecord = ret[3]; this.OPLBNAME = ret[4]; } if (this.OpStatus == 'edit') { condition = " WMSNO='" + this.EditRecord.get('WMSNO') + "'"; this.LoadData(this.OpStatus, condition); WMSNO = this.EditRecord.get('WMSNO'); this.blEIP = this.EditRecord.data.EIP; } else if (this.OpStatus == "add" && this.OPLBNAME == '海运进口') { FEECONFIG = '1'; //this.LoadData(this.OpStatus, condition); this.SetOpseaiData(); } else { this.LoadData(this.OpStatus, condition); } this.LoadMustBe(); }, //end InitData //载入数据 LoadData: function (OpStatus, condition) { if (COMPANYID == "" || DEPTGID == "") { alert("登录信息不全,请退出重新登录"); return; } //#region 权限相关 Ext.Ajax.request({ waitMsg: '正在查询用户权限...', url: '/CommMng/BasicDataRef/GetAuthorityRange', params: { modName: "modWmsFeeRejected", USERID: USERID }, callback: function (options, success, response) { if (success) { var result = Ext.JSON.decode(response.responseText); rec = result.data; AUTHUNLOCKV = rec.VISIBLERANGE; AUTHUNLOCK = rec.OPERATERANGE; } else { Ext.MessageBox.alert('获取权限失败', response.responseText); return; } }, scope: this }); //#endregion //#region 获取系统参数(用于判断费用关联到海运进口还是入库单) Ext.Ajax.request({ waitMsg: '正在查询用户权限...', url: '/MvcShipping/WMSNew/GetSysFeeConfig', params: { userid: USERID }, callback: function (options, success, response) { if (success) { var result = Ext.JSON.decode(response.responseText); FEECONFIG = result.data; } else { Ext.MessageBox.alert('获取费用配置信息失败', response.responseText); return; } }, scope: this }); //#endregion this.OpStatus = OpStatus; var _this = this; Ext.Ajax.request({ waitMsg: '正在查询主表数据...', url: '/MvcShipping/WMSNew/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; } WMSNOManual = result.WMSNOManual; if (WMSNOManual == '1') { document.getElementById("WMSNO-inputEl").removeAttribute("readonly"); } else { Ext.getCmp('WMSNO').readOnly = true; } var timeStamp = result.timeStamp; timeStamp = timeStamp.replace(/\//g, '-'); //格式化时分秒 var y = ''; var m = ''; var d = ''; var timetemp = timeStamp.split('-'); y = timetemp[0]; if (timetemp[1].length < 2) { m = '0' + timetemp[1]; } else { m = timetemp[1]; } if (timetemp[2].length < 2) { d = '0' + timetemp[2]; } else { d = timetemp[2]; } var timeStampFin = y + '-' + m + '-' + d; TIMESTAMP = timeStampFin; timeStamp = timeStampFin; var data = result.data; var blno = data.BLNO; BLNO = data.BLNO; CNTRNO = data.CNTRNO; CTNALL = data.CTNALL; SEALNO = data.SEALNO; PKGS = data.PKGS; this.storeCodeCtn.load({ params: { mblno: BLNO} }); if (blno != "" && blno != null) { this.storeCustomsNo.load({ params: { BLNO: blno, CUSTOMNO: ""} }); } if (this.OpStatus == 'add') { if (this.OPLBNAME == 'WMSMAIN') { // this.formSearch.setVisible(false); data.ASSOCIATEDNO = _this.parentRecord.get('BSNO'); data.CORPID = COMPANYID; data.DEPTNAME = DEPTGID; data.CUSTOMERNAME = _this.parentRecord.get('CUSTOMERNAME'); data.BLNO = _this.parentRecord.get('MBLNO'); data.CUSTOMNO = _this.parentRecord.get('CUSTOMNO'); data.CONTRACTNO = _this.parentRecord.get('CONTRACTNO'); data.ARCLIENT = _this.parentRecord.get('CUSTOMERNAME'); data.GOODSNAME = _this.parentRecord.get('GOODSNAME'); data.CREATEUSER = USERID; data.CREATETIME = timeStamp; data.WMSDATE = timeStamp; data.FREESTORAGEPERIOD = "0"; data.STARTBILLINGDATE = timeStamp; data.FREESTORAGEPERIODAP = "0"; data.STARTBILLINGDATEAP = timeStamp; data.MARKETVALUE = "0"; data.BANKVALUE = "0"; data.GOODSPACK = "0"; data.GOODSPACKSTOCK = "0"; data.GOODSRKSL = "0"; data.GOODSSTOCK = "0"; data.ARFEE = "0"; data.APFEE = "0"; data.GOODSPACKACTUAL = "0"; data.GOODSRKSLACTUAL = "0"; data.GOODSKGS = "0"; data.CHARGEUNIT = _this.parentRecord.get('UNITOFWEIGHT'); data.RENTAREA = "0"; data.ACCDATE = Ext.util.Format.date(currdate, 'Y-m'); } else { data.ASSOCIATEDNO = ""; data.CORPID = COMPANYID; data.DEPTNAME = DEPTGID; data.CUSTOMERNAME = ""; data.BLNO = ""; data.CUSTOMNO = ""; // data.BLNO = _this.parentRecord.get('MBLNO'); //data.CUSTOMNO = _this.parentRecord.get('CUSTOMNO'); data.CONTRACTNO = ""; data.ARCLIENT = ""; data.GOODSNAME = ""; data.CREATEUSER = USERID; data.CREATETIME = timeStamp; data.WMSDATE = timeStamp; data.FREESTORAGEPERIOD = "0"; data.STARTBILLINGDATE = timeStamp; data.FREESTORAGEPERIODAP = "0"; data.STARTBILLINGDATEAP = timeStamp; data.MARKETVALUE = "0"; data.BANKVALUE = "0"; data.GOODSPACK = "0"; data.GOODSPACKSTOCK = "0"; data.GOODSRKSL = "0"; data.GOODSSTOCK = "0"; data.ARFEE = "0"; data.APFEE = "0"; data.GOODSPACKACTUAL = "0"; data.GOODSRKSLACTUAL = "0"; data.GOODSKGS = "0"; data.CHARGEUNIT = ""; data.RENTAREA = "0"; data.ACCDATE = Ext.util.Format.date(currdate, 'Y-m'); } this.LoadDefValue(); } if (data.CUSTOMERNAME != '') { var recordCustCode = Ext.create('DsShipping.ux.CustomRefModel', { GId: NewGuid(), CustCode: data.CUSTOMERNAME, CustName: data.CUSTOMERNAME, CodeAndName: data.CUSTOMERNAME }); this.storeCustCode.add(recordCustCode); } if (data.ARCLIENT != '') { var recordCustCode = Ext.create('DsShipping.ux.CustomRefModel', { GId: NewGuid(), CustCode: data.ARCLIENT, CustName: data.ARCLIENT, CodeAndName: data.ARCLIENT }); this.storeGainCust.add(recordCustCode); } if (data.TRUCKNAME != '') { var recordCustCode = Ext.create('DsShipping.ux.CustomRefModel', { GId: NewGuid(), CustCode: data.TRUCKNAME, CustName: data.TRUCKNAME, CodeAndName: data.TRUCKNAME }); this.storePayCust.add(recordCustCode); } var basicForm = this.formEdit.getForm(); if (this.OpStatus == 'edit') { var ischange = this.EditRecord.get('ISCHANGE'); if (ischange == '货权转移') { //data.TRUCKNAME = ""; data.FREESTORAGEPERIODAP = "0"; data.STARTBILLINGDATEAP = timeStamp; } } this.formEdit.getForm().setValues(data); this.LoadPeriod(this.OpStatus); if (data.GID == "") { data.GID = "0" } //2019015,修改出入库号为入库号,而不是海运进口的BSNO,BY BALINGXU //this.panelFee.WMSOUTBSNO = data.ASSOCIATEDNO; this.panelFee.WMSOUTBSNO = data.GID; this.panelFee.EditRecord = this.EditRecord; if (FEECONFIG == '1') { this.panelFee.strBSNO = data.ASSOCIATEDNO; } else { this.panelFee.strBSNO = data.GID;} this.panelFee.StoreDateCurr.load({ params: { optype: "op_Seai", bsno: data.GID } }); if (FEECONFIG == '1') { this.panelFee.StoreUnit.load({ params: { bsno: data.GID, bstype: "op_Seai" } }); } else { this.panelFee.StoreUnit.load({ params: { bsno: data.GID, bstype: "WMSIN" } }); } this.panelFee.storeBodySum.load({ params: { bsno: data.GID } }); this.panelFee.DR_condition = "(((WMSOUTBSNO = '" + data.GID + "') and feetype = 1) or ((BSNO = '" + data.GID + "') and feetype = 1)) "; this.panelFee.CR_condition = "(((WMSOUTBSNO = '" + data.GID + "') and feetype = 2) or ((BSNO = '" + data.GID + "') and feetype = 2)) "; if (FEECONFIG == '1') { this.panelFee.storeDrChFee.load({ params: { billno: data.ASSOCIATEDNO, type: 1, optype: "op_Seai", condition: "((( WMSOUTBSNO='" + data.GID + "') and feetype=1) or (( BSNO='" + data.GID + "') and feetype=1) )"} }); this.panelFee.storeCrChFee.load({ params: { billno: data.ASSOCIATEDNO, type: 2, optype: "op_Seai", condition: "((( WMSOUTBSNO='" + data.GID + "') and feetype=2) or (( BSNO='" + data.GID + "') and feetype=2))"} }); } else { this.panelFee.storeDrChFee.load({ params: { billno: data.ASSOCIATEDNO, type: 1, optype: "op_other", condition: "((( WMSOUTBSNO='" + data.GID + "') and feetype=1) or (( BSNO='" + data.GID + "') and feetype=1) ) "} }); this.panelFee.storeCrChFee.load({ params: { billno: data.ASSOCIATEDNO, type: 2, optype: "op_other", condition: "((( WMSOUTBSNO='" + data.GID + "') and feetype=2) or (( BSNO='" + data.GID + "') and feetype=2))" } }); } this.panelFee.storeBodyList_GuDingFeeWeiHu.load(); if (data.ISLOCK == '1' || data.ISLOCK == 'True') { LOCK1 = '1'; Ext.getCmp('btnLock').setText('取消入账'); Ext.getCmp('btnLock').setIconCls('new_lock'); var arr = this.formEdit.form._fields.items; for (var i = 0; i < arr.length; i++) { var obj = arr[i]; obj.setReadOnly(true); obj.fieldStyle = 'background:#E6E6E6'; } } else { LOCK1 = '0'; Ext.getCmp('btnLock').setText('入账'); Ext.getCmp('btnLock').setIconCls('new_lock'); } if (data.ISLOCK2 == '1' || data.ISLOCK2 == 'True') { Ext.getCmp('btnLock2').setText('解锁'); Ext.getCmp('btnLock2').setIconCls('new_lock'); var arr = this.formEdit.form._fields.items; for (var i = 0; i < arr.length; i++) { var obj = arr[i]; obj.setReadOnly(true); obj.fieldStyle = 'background:#E6E6E6'; } } else { Ext.getCmp('btnLock2').setText('锁定'); Ext.getCmp('btnLock2').setIconCls('new_lock'); } if (this.OpStatus != "add" && (this.OPLBNAME != '海运进口' && this.OPLBNAME != 'WMSMAIN')) { this.panelAmendFee.EditRecord = this.EditRecord;; this.bsno = data.GID; this.panelAmendFee.strBSNO = this.bsno; this.panelAmendFee.isCancel = false; if (FEECONFIG == '1') { this.panelAmendFee.stroplb = 'op_Seai'; } else { this.panelAmendFee.stroplb = 'op_other'; } this.panelAmendFee.StoreCustType.add({ "SCUSTTYPE": "WTDW-委托单位", "CUSTTYPE": "委托单位", "CUSTNAME": "CUSTOMERNAME" }); this.panelAmendFee.StoreCustType.add({ "SCUSTTYPE": "CGS-船公司", "CUSTTYPE": "船公司", "CUSTNAME": "CARRIER" }); this.panelAmendFee.StoreCustType.add({ "SCUSTTYPE": "DCDL-订舱代理", "CUSTTYPE": "订舱代理", "CUSTNAME": "FORWARDER" }); this.panelAmendFee.StoreCustType.add({ "SCUSTTYPE": "BGH-报关行", "CUSTTYPE": "报关行", "CUSTNAME": "CUSTOMSER" }); this.panelAmendFee.StoreCustType.add({ "SCUSTTYPE": "CD-车队", "CUSTTYPE": "车队", "CUSTNAME": "TRUCKER" }); this.panelAmendFee.StoreCustType.add({ "SCUSTTYPE": "FHR-发货人", "CUSTTYPE": "发货人", "CUSTNAME": "SHIPPERID" }); this.panelAmendFee.StoreCustType.add({ "SCUSTTYPE": "SHR-收货人", "CUSTTYPE": "收货人", "CUSTNAME": "CONSIGNEEID" }); this.panelAmendFee.StoreCustType.add({ "SCUSTTYPE": "TZR-通知人", "CUSTTYPE": "通知人", "CUSTNAME": "NOTIFYPARTYID" }); this.panelAmendFee.StoreCustType.add({ "SCUSTTYPE": "DL-代理", "CUSTTYPE": "代理", "CUSTNAME": "AGENTID" }); this.panelAmendFee.StoreCustType.add({ "SCUSTTYPE": "CZ-场站", "CUSTTYPE": "场站", "CUSTNAME": "YARD" }); if (FEECONFIG == '1') { this.panelAmendFee.StoreDrOpRange.load({ params: { optype: "modSeaiRecvFeeManagement" } }); this.panelAmendFee.StoreCrOpRange.load({ params: { optype: "modSeaiPayFeeManagement" } }); } else { this.panelAmendFee.StoreDrOpRange.load({ params: { optype: "modOtherRecvFeeManagement" } }); this.panelAmendFee.StoreCrOpRange.load({ params: { optype: "modOtherPayFeeManagement" } }); } this.panelAmendFee.storeFeeNameRef.load({ params: { condition: "" } }); this.panelAmendFee.StoreDateCurr.load({ params: { optype: "op_Seai", bsno: data.GID } }); if (FEECONFIG == '1') { this.panelAmendFee.StoreUnit.load({ params: { bsno: data.GID, bstype: "op_Seai" } }); } else { this.panelAmendFee.StoreUnit.load({ params: { bsno: data.GID, bstype: "WMSIN" } }); } _thisamendhead = this.panelAmendFee; this.panelAmendFee.storeAmendBill.load({ params: { billno: this.bsno, bstype: "" }, callback: function (r, options, success) { if (success) { if (r.length > 0) { _thisamendhead.gridAmendList.getSelectionModel().select(0); } } }, scope: this }); this.panelAmendFee.storeBodyBLSum.load({ params: { bsno: this.bsno, optype: "" }, callback: function (r, options, success) { if (success) { _thisamendhead.setBLTotalHead(); } } }); Ext.Ajax.request({ waitMsg: Zi.LAN.ZhengZaiChaXunShuJu, //'正在查询主表数据...', url: '/Account/ChMonthClose/GetNowPeriod', params: { condition: '' }, callback: function (options, success, response) { if (success) { var result = Ext.JSON.decode(response.responseText); if (!result.Success) { return; } data = result.data; _thisamendhead.ACCDATEEDIT.setMinValue(data.PERIOD); } else { Ext.MessageBox.alert(Zi.LAN.FuWuQiXiangYingChuCuo, response.responseText);//'请求出现错误,请重试' } }, scope: this }); } } else { Ext.MessageBox.alert('请求出现错误,请重试', response.responseText); } if (AUTHUNLOCK == '4') { if (Ext.getCmp('btnLock').text == "取消入账") { Ext.getCmp("btnLock").setDisabled(true); } } }, scope: this }); //request over if (this.OpStatus == 'edit') { var GID = this.EditRecord.get('GID'); this.storeWMSIN.load({ params: { start: 0, limit: 1000, sort: '', condition: " ASSOCIATEDNO='" + GID + "'" }, waitMsg: "正在查询数据...", scope: this }); this.storeWMSRATE.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: " BSNO='" + GID + "'" }, waitMsg: "正在查询数据...", scope: this }); } ///仓储费用入账 Ext.Ajax.request({ waitMsg: '正在查询用户权限...', url: '/CommMng/BasicDataRef/GetAuthorityRange', params: { modName: "modWmsFeeLock", USERID: USERID }, callback: function (options, success, response) { if (success) { var result = Ext.JSON.decode(response.responseText); rec = result.data; this.VISIBLERANGE = rec.VISIBLERANGE; this.OPERATERANGE = rec.OPERATERANGE; this.modWmsFeeLock = rec.OPERATERANGE; } else Ext.MessageBox.alert('请求出现错误,请重试', response.responseText); }, scope: this }); //request over ///仓储费用取消入账 Ext.Ajax.request({ waitMsg: '正在查询用户权限...', url: '/CommMng/BasicDataRef/GetAuthorityRange', params: { modName: "modWmsFeeRejected", USERID: USERID }, callback: function (options, success, response) { if (success) { var result = Ext.JSON.decode(response.responseText); rec = result.data; this.VISIBLERANGE = rec.VISIBLERANGE; this.OPERATERANGE = rec.OPERATERANGE; this.modWmsFeeRejected = rec.OPERATERANGE; } else Ext.MessageBox.alert('请求出现错误,请重试', response.responseText); }, scope: this }); //request over }, // end LoadDate checkedit: function (status) { if (status != 1 && status != 2 && status != 6 && status != 0) { alert("注意 录入状态/提交审核/驳回提交 的费用可以全部保存,审核通过的业务只保存支付信息 "); return false; } else if (status == 0) { alert("注意审核通过的业务只保存支付信息 "); return true; } }, LoadPeriod: function (opstatus) { Ext.Ajax.request({ waitMsg: '正在查询主表数据...', url: '/Account/ChMonthClose/GetNowPeriod', params: { condition: '' }, callback: function (options, success, response) { if (success) { var result = Ext.JSON.decode(response.responseText); if (!result.Success) { return; } data = result.data; this.MsPeriod = data; this.LoadPeriodStatus(opstatus); } else { Ext.MessageBox.alert('请求出现错误,请重试', response.responseText); } }, scope: this }); }, LoadPeriodStatus: function (opstatus) { var ACCDATE = this.formEdit.getForm().findField('ACCDATE').getValue(); var oDate1 = new Date(ACCDATE + '-01'); var oDate2 = new Date(this.MsPeriod.PERIOD + '-01'); if (oDate1.getTime() >= oDate2.getTime()) { this.formEdit.getForm().findField('ACCDATE').setMinValue(this.MsPeriod.PERIOD); this.formEdit.getForm().findField('ACCDATE').setReadOnly(false); } else { if (opstatus == 'add' || opstatus == 'copyadd') { this.formEdit.getForm().findField('ACCDATE').setMinValue(this.MsPeriod.PERIOD); this.formEdit.getForm().findField('ACCDATE').setValue(this.MsPeriod.PERIOD); this.formEdit.getForm().findField('ACCDATE').setReadOnly(false); } else { this.formEdit.getForm().findField('ACCDATE').setMinValue(''); this.formEdit.getForm().findField('ACCDATE').setReadOnly(true); } } }, Save: function (type) { var basicForm = this.formEdit.getForm(); var wmsgid = basicForm.findField('GID').value; if (!basicForm.isValid()) { return; } if (this.panelFee.storeDrChFee.getUpdatedRecords().length > 0 && wmsgid != "") { Ext.MessageBox.alert("提示", "有未保存的费用信息!请先在费用录入列表上方保存费用!"); return; } this.SetFieldDisabled(false); var data = this.formEdit.getForm().getValues(); if (data.ISLOCK == "True" || data.ISLOCK == "1") { Ext.MessageBox.alert("提示", "已入账的入库信息不能进行修改") return; } if (data.ISLOCK2 == "True" || data.ISLOCK2 == "1") { Ext.MessageBox.alert("提示", "已锁定的入库信息不能进行修改") return; } //var data = this.formEdit.getForm().getValues(); if (data.ISCHANGE == "True") { Ext.MessageBox.alert("提示", "来源于货权转移的入库信息不能进行修改。请修改相应的货转出库记录。") return; } if (COMPANYID == "" || DEPTGID == "") { Ext.MessageBox.alert("提示", "登录信息不全,请退出重新登录"); return; } // if (data.BLNO == '') { // Ext.MessageBox.alert('提示', '未关联提单号!请先执行查询操作进行关联!'); // return; // } var MARKETVALUE = 0; var BANKVALUE = 0; var GOODSKGS = 0; var WMSINdatas = []; for (var i = 0; i < this.storeWMSIN.getCount(); i += 1) { var member = this.storeWMSIN.getAt(i); if (member.data.GOODSPACK == 0 && member.data.GOODSRKSL == 0) { Ext.MessageBox.alert("提示", "存在空的入库明细数据,请先检查数据正确与否!"); return; } var comboxList = DsStoreQueryBy(this.storeGoodsnameList, 'GID', member.data.GOODSNAMEID); if (comboxList.getCount() > 0) { var comboxRaw = comboxList.getAt(0).data; member.data.GOODSNAME = comboxRaw.GOODNAME.toString(); } WMSINdatas.push(member); MARKETVALUE = MARKETVALUE + parseFloat(member.data.MARKETVALUE); BANKVALUE = BANKVALUE + parseFloat(member.data.BANKVALUE); GOODSKGS = GOODSKGS + parseFloat(member.data.GOODSKGS); } this.formEdit.getForm().findField('MARKETVALUE').setValue(MARKETVALUE); this.formEdit.getForm().findField('BANKVALUE').setValue(BANKVALUE); this.formEdit.getForm().findField('GOODSRKSL').setValue(GOODSKGS); var WMSRATEdatas = []; var WMSINBody = ConvertWMSRecordsToJson(WMSINdatas); var WMSINBodyDel = ConvertRecordsToJsonAll(this.WMSINBodyDel); var WMSRATEBody = ConvertRecordsToJson(WMSRATEdatas); var WMSRATEBodyDel = ConvertRecordsToJsonAll(this.WMSRATEBodyDel); var GOODSPACKSTOCK = 0; var GOODSSTOCK = 0; var GOODSPACK = 0; var GOODSRKSL = 0; var GOODSPACKACTUAL = 0; var GOODSRKSLACTUAL = 0; var MARKETVALUE = 0; var BANKVALUE = 0; var GOODSSLICE = 0; var GOODSKGS = 0; var GOODSNAMEID = ''; var GOODSNAME = ''; this.storeWMSIN.each(function (record) { GOODSPACKSTOCK = GOODSPACKSTOCK + parseFloat(record.get('GOODSPACKSTOCK')); GOODSSTOCK = GOODSSTOCK + parseFloat(record.get('GOODSSTOCK')); GOODSPACK = GOODSPACK + parseFloat(record.get('GOODSPACK')); GOODSRKSL = GOODSRKSL + parseFloat(record.get('GOODSRKSL')); GOODSSLICE = GOODSSLICE + parseFloat(record.get('GOODSSLICE')); GOODSPACKACTUAL = GOODSPACKACTUAL + parseFloat(record.get('GOODSPACKACTUAL')); GOODSRKSLACTUAL = GOODSRKSLACTUAL + parseFloat(record.get('GOODSRKSLACTUAL')); MARKETVALUE = MARKETVALUE + parseFloat(record.get('MARKETVALUE')); BANKVALUE = BANKVALUE + parseFloat(record.get('BANKVALUE')); GOODSKGS = GOODSKGS + parseFloat(record.get('GOODSKGS')); if (record.get('GOODSNAMEID') != null && record.get('GOODSNAMEID') != '' ) GOODSNAMEID = record.get('GOODSNAMEID'); if (record.get('GOODSNAME') != null && record.get('GOODSNAME') != '') GOODSNAME = record.get('GOODSNAME'); }); // if (GOODSSLICE > PKGS) { // Ext.MessageBox.alert('提示', '入库件数已超出!'); // return; // } data.GOODSPACKSTOCK = GOODSPACKSTOCK; data.GOODSSTOCK = GOODSSTOCK; data.GOODSPACK = GOODSPACK; data.GOODSRKSL = GOODSRKSL; data.GOODSPACKACTUAL = GOODSPACKACTUAL; data.GOODSRKSLACTUAL = GOODSRKSLACTUAL; data.MARKETVALUE = MARKETVALUE; data.BANKVALUE = BANKVALUE; data.GOODSKGS = GOODSKGS; data.GOODSNAMEID = GOODSNAMEID; data.GOODSNAME = GOODSNAME; var _this = this; Ext.Msg.wait('正在保存数据, 请稍侯..'); Ext.Ajax.request({ waitMsg: '正在保存数据...', url: '/MvcShipping/WMSNew/Save', scope: this, async: false, params: { OpStatus: this.OpStatus, data: Ext.JSON.encode(data), WMSINBody: WMSINBody, WMSINBodyDel: WMSINBodyDel, WMSRATEBody: WMSRATEBody, WMSRATEBodyDel: WMSRATEBodyDel }, callback: function (options, success, response) { _this.SetFieldDisabled(true); if (success) { _this.comboxZhuangXieGong.setValue(''); _this.comboxCheDui.setValue(''); Ext.MessageBox.hide(); var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { //保存费用 var data = jsonresult.Data; var returnData = jsonresult.Data; //费用关联海运进口 if (FEECONFIG == "1") { this.panelFee.stroplb = 'op_Seai'; this.panelFee.strBSNO = data.ASSOCIATEDNO; this.panelFee.strMBLNO = MBLNO; this.panelFee.DR_condition = "(((WMSOUTBSNO = '" + data.GID + "') and feetype = 1) or ((BSNO = '" + data.GID + "') and feetype = 1)) "; this.panelFee.CR_condition = "((WMSOUTBSNO = '" + data.GID + "') and feetype = 2) or ((BSNO = '" + data.GID + "') and feetype = 2) "; this.panelFee.StoreDrOpRange.load({ params: { optype: "modSeaiRecvFeeManagement"} }); this.panelFee.StoreCrOpRange.load({ params: { optype: "modSeaiPayFeeManagement"} }); this.panelFee.StoreUnit.load({ params: { bsno: data.GID, bstype: "op_Seai" } }); this.panelFee.storeFeeNameRef.load({ params: { condition: ""} }); this.panelFee.StoreDateCurr.load({ params: { optype: "op_Seai", bsno: BSNO} }); this.panelFee.storeDrChFee.load({ params: { billno: this.panelFee.strBSNO, type: 1, optype: "op_Seai", condition: "((( WMSOUTBSNO='" + data.GID + "') and feetype=1 ) or (( BSNO='" + data.GID + "') and feetype=1 ))" } }); this.panelFee.storeCrChFee.load({ params: { billno: this.panelFee.strBSNO, type: 2, optype: "op_Seai", condition: "((( WMSOUTBSNO='" + data.GID + "') and feetype=2) or (( BSNO='" + data.GID + "') and feetype=2)) " } }); this.formEdit.getForm().setValues(returnData); this.panelFee.onPostDetailClick(null, null, 1); this.panelFee.onPostDetailClick(null, null, 2); } else { //费用关联入库单 //this.panelFee.strBSNO = data.GID; this.panelFee.strBSNO = data.ASSOCIATEDNO; this.panelFee.StoreDateCurr.load({ params: { optype: "op_other", bsno: data.GID} }); //this.panelFee.StoreUnit.load({ params: { bsno: data.GID } }); this.panelFee.StoreUnit.load({ params: { bsno: data.GID, bstype: "WMSIN" } }); this.panelFee.storeBodySum.load({ params: { bsno: data.GID} }); this.panelFee.LoadDrChFee2("(WMSOUTBSNO='" + data.GID + "' and feetype=1) or (BSNO='" + data.GID + "' and feetype=1)"); this.panelFee.LoadCrChFee2("(WMSOUTBSNO='" + data.GID + "' and feetype=2) or (BSNO='" + data.GID + "' and feetype=2)"); this.formEdit.getForm().setValues(returnData); this.panelFee.onPostDetailClick(null, null, 1); this.panelFee.onPostDetailClick(null, null, 2); } //保存费用end if (this.OpStatus == 'add') { var arrNewRecords = this.StoreList.add(returnData); this.EditRecord = arrNewRecords[0]; } else if (this.OpStatus == 'edit') { var editp = Ext.create('WMSmb', returnData); this.EditRecord.fields.each(function (field) { if (field.persist) { name = field.name; //alert(name + ' -- ' + editp.get(name)); if (name != 'GID') this.EditRecord.set(name, editp.get(name)); } }, this); this.EditRecord.commit(); //this.onRefreshClick(button, event); } this.storeWMSIN.commitChanges(); //this.storePayBody.commitChanges(); this.SaveRate(); if (type == '0') { this.OpStatus = 'edit'; var GID = _this.EditRecord.get('GID'); _this.panelFee.EditRecord = this.EditRecord; this.storeWMSIN.load({ params: { start: 0, limit: 1000, sort: '', condition: " ASSOCIATEDNO='" + GID + "'" }, waitMsg: "正在查询数据...", scope: this }); var condition = " WMSNO='" + returnData.WMSNO + "'"; WMSNO = returnData.WMSNO; _this.LoadData(_this.OpStatus, condition); } else if (type == '1') {//保存并关闭 window.close(); } } 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 }); } //alert('03'); } }); } //end save , getCondition: function (VISIBLERANGE) { var sql = ""; if (VISIBLERANGE == '0') { sql = " wi.CORPID='" + COMPANYID + "'"; } else if (VISIBLERANGE == '1') { sql = " wi.CORPID='" + COMPANYID + "'"; } else if (VISIBLERANGE == '2') { sql = " wi.CORPID='" + COMPANYID + "'"; } if (VISIBLERANGE == '3') { sql = " wi.CORPID='" + COMPANYID + "'"; } else {//4 sql = " 1=2 "; } } , getStartDate: function (Level, FEETYPE) { //计费等级level,收付方向feetype for (var i = 0; i < this.storeWMSRATE.getCount(); i++) { lastlevel = this.storeWMSRATE.getAt(i).get("FEEGRADE"); lastFEETYPE = this.storeWMSRATE.getAt(i).get("FEETYPE"); if (lastlevel == Level - 1 && FEETYPE == lastFEETYPE) { return (this.storeWMSRATE.getAt(i).get("ENDBILLINGDATE")); } } if (FEETYPE == '1') { return this.formEdit.getForm().findField('STARTBILLINGDATE').getValue(); } if (FEETYPE == '2') { return this.formEdit.getForm().findField('STARTBILLINGDATEAP').getValue(); } } , setCBM: function (newValue, oldValue) { if (newValue == oldValue) { return; } else { //将store当中的所有CHARGEUNIT改为newvalue; this.storeWMSIN.each(function (record) { record.set('CHARGEUNIT', newValue); //库存量 if (newValue == "吨") { var SHIJIZHONGLIANG = parseFloat(record.get('SHIJIZHONGLIANG')); record.set('GOODSRKSL', SHIJIZHONGLIANG); } else if (newValue == "千克") { var SHIJIZHONGLIANG = record.get('SHIJIZHONGLIANG'); record.set('GOODSRKSL', SHIJIZHONGLIANG); } else if (newValue == "CBM") { var SHIJICHIMA = record.get('SHIJICHIMA'); record.set('GOODSRKSL', SHIJICHIMA); } }); var rec = Ext.getCmp("GOODSSTOCK_IN").setText("*库存量(" + newValue + ")"); ; } } , LockWMS: function (Value) { //费用入账 if (Value == "0") { if (AUTHUNLOCK == '4') { Ext.MessageBox.alert('提示', '没有取消入账的权限!'); } } if (this.EditRecord == null) { alert("请先保存记录"); return; } if (this.EditRecord.data.WMSNO == '') { alert("请先进行保存!"); return; } var LockWMS = []; var info = "入账"; if (Value == "0") { info = "取消入账"; } else { info = "入账"; } Ext.MessageBox.confirm('提示', '确定要' + info + '吗?', function (btn) { if (btn == 'yes') { LockWMS.push(this.EditRecord); var LockWMSJSNO = ConvertRecordsToJsonAll(LockWMS); var _this = this; var wmsno = "'" + this.EditRecord.data.WMSNO + "'"; Ext.Ajax.request({// waitMsg: '正在处理数据...', url: '/MvcShipping/WMSNew/LockWMS', params: { wmsno: wmsno, EIP:_this.blEIP, type: parseInt(Value) }, callback: function (options, success, response) { var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { alert(jsonresult.Message); if (Value == "1") { _this.EditRecord.set("ISLOCK", "True"); var data = this.formEdit.getForm().getValues(); data.ISLOCK = "True"; this.formEdit.getForm().setValues(data); Ext.getCmp('btnLock').setText('取消入账'); Ext.getCmp('btnLock').setIconCls('new_lock'); LOCK1 = 1; var arr = this.formEdit.form._fields.items; for (var i = 0; i < arr.length; i++) { var obj = arr[i]; obj.setReadOnly(true); // obj.setDisabled(true); } } else { _this.EditRecord.set("ISLOCK", "False"); var data = this.formEdit.getForm().getValues(); data.ISLOCK = "False"; this.formEdit.getForm().setValues(data); Ext.getCmp('btnLock').setText('入账'); Ext.getCmp('btnLock').setIconCls('new_lock'); LOCK1 = 0; var arr = this.formEdit.form._fields.items; for (var i = 0; i < arr.length; i++) { var obj = arr[i]; obj.setReadOnly(false); //obj.setDisabled(false); } } _this.EditRecord.commit(); } else { alert(jsonresult.Message); } var condition = " WMSNO='" + WMSNO + "'"; this.LoadData('edit', condition); }, scope: this }); //request over } }, this); } , LockWMS2: function (Value) { //锁定库存 被锁定的库存不可出库 if (this.EditRecord == null) { alert("请先保存记录"); return; } if (this.EditRecord.data.WMSNO == '') { alert("请先进行保存!"); return; } var LockWMS = []; var info = "锁定"; if (Value == "0") { info = "解锁"; } else { info = "锁定"; } Ext.MessageBox.confirm('提示', '确定要' + info + '吗?', function (btn) { if (btn == 'yes') { LockWMS.push(this.EditRecord); var LockWMSJSNO = ConvertRecordsToJsonAll(LockWMS); var _this = this; var wmsno = "'" + this.EditRecord.data.WMSNO + "'"; Ext.Ajax.request({// waitMsg: '正在处理数据...', url: '/MvcShipping/WMSNew/LockWMS2', params: { wmsno: wmsno, type: parseInt(Value) }, callback: function (options, success, response) { var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { alert(jsonresult.Message); if (Value == "1") { _this.EditRecord.set("ISLOCK2", "True"); var data = this.formEdit.getForm().getValues(); data.ISLOCK2 = "True"; this.formEdit.getForm().setValues(data); Ext.getCmp('btnLock2').setText('解锁'); Ext.getCmp('btnLock2').setIconCls('new_lock'); var arr = this.formEdit.form._fields.items; for (var i = 0; i < arr.length; i++) { var obj = arr[i]; obj.setReadOnly(true); // obj.setDisabled(true); } } else { _this.EditRecord.set("ISLOCK2", "False"); var data = this.formEdit.getForm().getValues(); data.ISLOCK2 = "False"; this.formEdit.getForm().setValues(data); Ext.getCmp('btnLock2').setText('锁定'); Ext.getCmp('btnLock2').setIconCls('new_lock'); var arr = this.formEdit.form._fields.items; for (var i = 0; i < arr.length; i++) { var obj = arr[i]; obj.setReadOnly(false); //obj.setDisabled(false); } } _this.EditRecord.commit(); } else { alert("操作失败" + jsonresult.Message); } }, scope: this }); //request over } }, this); }, LoadDefValue: function () { this.storeDefValue.load({ params: { condition: "BSTYPE='仓储入库'" }, callback: function (r, options, success) { if (success) { if (this.storeDefValue.getCount() > 0) { for (var j = 0; j < this.storeDefValue.getCount() ; j += 1) { var member = this.storeDefValue.getAt(j); var fieldname = member.data.FIELDNAME; var headfield = this.formEdit.getForm().findField(fieldname); if (headfield != NaN && headfield != null) headfield.setValue(member.data.DEFVALUE); }; } else { } } }, scope: this }); }, LoadMustBe: function () { this.storeMustBe.load({ params: { condition: "BSTYPE='仓储入库'" }, callback: function (r, options, success) { if (success) { if (this.storeMustBe.getCount() > 0) { for (var j = 0; j < this.storeMustBe.getCount() ; j += 1) { var member = this.storeMustBe.getAt(j); var fieldname = member.data.FIELDNAME; var headfield = this.formEdit.getForm().findField(member.data.FIELDNAME); if (headfield != NaN && headfield != null) { if (member.data.ISMUST == "1") headfield.allowBlank = false; if (member.data.ISCOLOR == "1") headfield.setFieldStyle({ background: '#ffc' }); if (member.data.ISREADONLY == "1") headfield.setReadOnly(true); } }; } else { } } }, scope: this }); }, onPrintClick: function (button, event) { // var printType = 'WmsInfoReport_opseai'; //海运进口 入库明细 var printType = 'WmsInfoReportNew'; var strBSNO = this.EditRecord.get('GID'); var wmsno = this.EditRecord.get('WMSNO'); var uid = USERID; var sql1 = "select "; sql1 = sql1 + " wi.goodsnameid '品名',"; sql1 = sql1 + " wi.GOODSMODEL '规格',"; sql1 = sql1 + " wi.GOODSSTANDARD '规格/件数',"; sql1 = sql1 + "* from wms w "; sql1 = sql1 + " left join wms_in wi on w.gid= wi.ASSOCIATEDNO "; sql1 = sql1 + " where w.WMSNO = '" + wmsno + "'"; sql1 = sql1 + " order by wi.DODATE "; PrintComm(printType, sql1); }, onNextKeyClick: function (type, col) { if (type == 1) { var rows = this.formWMSINBody.getSelectionModel().getSelection(); var row = rows[rows.length - 1]; var s = this.formWMSINBody.getStore(); var number = s.indexOf(row) + 1; if (number == this.formWMSINBody.getStore().getCount()) { this.onAddWMSINClick(s, event, type); } else { this.cellEditing.startEditByPosition({ row: number, column: col }); } } else if (type == 2) { var rows = this.gridCrChFee.getSelectionModel().getSelection(); var row = rows[rows.length - 1]; var s = this.gridCrChFee.getStore(); var number = s.indexOf(row) + 1; if (number == this.gridCrChFee.getStore().getCount()) { this.onAddDetailClick(s, event, type); } else { this.cellEditingCrChFee.startEditByPosition({ row: number, column: col }); } } }, onSearchClick: function () { //查询数据 _this = this; var data = this.formSearch.getForm().getValues(); var sBLNO = ""; //提单号 var sCUSTOMNO = ""; //报关单号、备案清单号 var sCONTRACTNO = ""; //合同号 var sCUSTNO = ""; //委托编号 var sCUSTOMERNAME = ""; //客户名称 var sBSNO = ""; //海运进口业务gid var sCTNALL = ""; //箱型 var sCNTRNO = ""; //箱号 var sSEALNO = ""; //封号 var sBAOGUANJIANSHU = 0; //报关件数 var sISBONDED = ""; var sOPLBNAME = ""; var sCompanyID = ""; BLNO = data.BLNO; var CUSTOMNO = data.CUSTOMNO; var OPLBNAME = data.OPLBNAME; Ext.Ajax.request({ waitMsg: '正在查询主表数据...', //参数BLNO为提单号或委托单号 url: '/MvcShipping/WMSNew/GetDataWithBLNOAndWMSNO', params: { BLNO: BLNO, CUSTOMNO: CUSTOMNO, OPLBNAME: OPLBNAME }, callback: function (options, success, response) { if (success) { var result = Ext.JSON.decode(response.responseText); if (result.Success == true) { //更新备案清单号列表 this.storeCustomsNo.load({ params: { BLNO: BLNO, CUSTOMNO: CUSTOMNO} }); var data = this.formEdit.getForm().getValues(); sBLNO = result.MBLNO; sCUSTOMNO = result.CUSTOMNO; sCONTRACTNO = result.CONTRACTNO; sCUSTNO = result.CUSTNO; sCUSTOMERNAME = result.CUSTOMERNAME; sBSNO = result.BSNO; sCTNALL = result.CTNALL; sCNTRNO = result.CNTRNO; sSEALNO = result.SEALNO; sBAOGUANJIANSHU = result.BAOGUANJIANSHU; sISBONDED = result.ISBONDED; sOPLBNAME = result.OPLBNAME; sCompanyID = result.COMPANYID; var timeStamp = Ext.util.Format.date(result.timeStamp, 'Y-m-d'); TIMESTAMP = timeStamp; CNTRNO = sCNTRNO; CTNALL = sCTNALL; SEALNO = sSEALNO; PKGS = result.PKGS; KGS = result.KGS; BAOGUANJIANSHU = sBAOGUANJIANSHU; MBLNO = sBLNO; BSNO = sBSNO; if (true) { data.ISBONDED = sISBONDED; data.BAOGUANJIANSHU = BAOGUANJIANSHU; data.ASSOCIATEDNO = sBSNO; data.CORPID = COMPANYID; data.DEPTNAME = DEPTGID; data.CUSTOMERNAME = sCUSTOMERNAME; data.BLNO = sBLNO; data.CUSTNO = sCUSTNO; data.CUSTOMNO = sCUSTOMNO; data.CONTRACTNO = sCONTRACTNO; data.ARCLIENT = sCUSTOMERNAME; data.GOODSNAME = ""; data.CREATEUSER = USERID; data.CREATETIME = timeStamp; data.WMSDATE = timeStamp; data.FREESTORAGEPERIOD = "0"; data.STARTBILLINGDATE = timeStamp; data.FREESTORAGEPERIODAP = "0"; //data.STARTBILLINGDATEAP = timeStamp; data.MARKETVALUE = "0"; data.BANKVALUE = "0"; data.GOODSPACK = "0"; data.GOODSPACKSTOCK = "0"; data.GOODSRKSL = "0"; data.GOODSSTOCK = "0"; data.ARFEE = "0"; data.APFEE = "0"; data.GOODSPACKACTUAL = "0"; data.GOODSRKSLACTUAL = "0"; data.CHARGEUNIT = ""; data.CTNALL = sCTNALL; data.CNTRNO = sCNTRNO; data.SEALNO = sSEALNO; data.PKGS = "0"; data.TiDanJianShu = PKGS; data.COMPANY = sCompanyID; data.TiDanZhongLiang = KGS; } if (data.CUSTOMERNAME != '') { var recordCustCode = Ext.create('DsShipping.ux.CustomRefModel', { GId: NewGuid(), CustCode: data.CUSTOMERNAME, CustName: data.CUSTOMERNAME, CodeAndName: data.CUSTOMERNAME }); this.storeCustCode.add(recordCustCode); } if (data.ARCLIENT != '') { var recordCustCode = Ext.create('DsShipping.ux.CustomRefModel', { GId: NewGuid(), CustCode: data.ARCLIENT, CustName: data.ARCLIENT, CodeAndName: data.ARCLIENT }); this.storeGainCust.add(recordCustCode); } if (data.TRUCKNAME != '') { var recordCustCode = Ext.create('DsShipping.ux.CustomRefModel', { GId: NewGuid(), CustCode: data.TRUCKNAME, CustName: data.TRUCKNAME, CodeAndName: data.TRUCKNAME }); this.storePayCust.add(recordCustCode); } var basicForm = this.formEdit.getForm(); this.storeCodeCtn.load({ params: { mblno: BLNO} }); this.formEdit.getForm().setValues(data); if (sOPLBNAME == "进口贸易") { this.formEdit.getForm().findField('CHARGEUNIT').setValue('吨'); Ext.define('Cargomb', { extend: 'Ext.data.Model', idProperty: 'id', fields: [ { name: 'id', type: 'string' }, { name: 'GID', type: 'string' }, { name: 'ContractNo', type: 'string' }, { name: 'cargoinfo_id', type: 'string' }, { name: 'cargociq_id', type: 'string' }, { name: 'AGENCRATE', type: 'string' }, { name: 'name', type: 'string' }, { name: 'Ename', type: 'string' }, { name: 'Unit', type: 'string' }, { name: 'UnitRate', type: 'string' }, { name: 'U_PRICE', type: 'number' }, { name: 'U_weight', type: 'number' }, { name: 'weight', type: 'number' }, { name: 'm_weight', type: 'number' }, { name: 't_weight', type: 'number' }, { name: 'price', type: 'number' }, { name: 'price_agio', type: 'number' }, { name: 'price_limit', type: 'number' }, { name: 'Amount', type: 'number' },//合同价格 { name: 'tax_Amount', type: 'number' }, //完税价格 { name: 'tax_Amount_RMB', type: 'number' }, //完税价格 { name: 'pay_Amount', type: 'number' },//购货价格 { name: 'BoxCount', type: 'number' }, { name: 'BoxWeight', type: 'number' }, { name: 'Exporter', type: 'string' }, { name: 'FactoryNo', type: 'string' }, { name: 'PRODUCTIONDATE', type: 'string' }, { name: 'currid', type: 'string' }, { name: 'prepayments', type: 'number' }, { name: 'balance', type: 'number' }, { name: 'pay_prepayments', type: 'number' }, { name: 'pay_balance', type: 'number' }, { name: 'Paypart', type: 'string' }, { name: 'cicode', type: 'string' }, { name: 'ciname', type: 'string' }, { name: 'cicodeandname', type: 'string' }, { name: 'ciqcode', type: 'string' }, { name: 'ciqname', type: 'string' }, { name: 'ciqcodeandname', type: 'string' }, { name: 'codename', type: 'string' }, { name: 'defaultrate', type: 'string' }, { name: 'UnitRef', type: 'string' }, { name: 'paypartRef', type: 'string' }, { name: 'baolv', type: 'string' }, { name: 'tariff', type: 'string' }, { name: 'tax', type: 'number' }, { name: 'tax_zz', type: 'number' }, //20190929 增加对从量税率的存储 分/kg { name: 'tax_cl', type: 'number' }, { name: 'Declarenumber', type: 'string' }, { name: 'Exchangerate', type: 'number' }, { name: 'Exchangerate_Customs', type: 'number' }, //20140109 增加对计算值的保存,用于向应收应付列表和费用通知单提供数据 { name: 'tax_1', type: 'string' }, { name: 'tax_zz_1', type: 'string' }, { name: 'tax_2', type: 'string' }, { name: 'tax_zz_2', type: 'string' } //20140307 增加 预付比例,用于许可证核销的总金额 , { name: 'RecProportion', type: 'string' } , { name: 'PreProportion', type: 'string' } , { name: 'AMOUNT_WRITEOFFS', type: 'string' } , { name: 'NAME_REF', type: 'string' } , { name: 'SEQUENCE', type: 'number' } , { name: 'Ename', type: 'string' } , { name: 'SBYS', type: 'string' } , { name: 'BZTCHNO', type: 'string' } , { name: 'CargoType', type: 'string' } , { name: 'REMARK', type: 'string' } , { name: 'SPECIFICATIONS', type: 'string' } , { name: 'SHIJIGUANSHUI', type: 'number' } , { name: 'SHIJIZENGZHISHUI', type: 'number' } , { name: 'XIANJIAJINE', type: 'number' } , { name: 'BAOZHENGJIN', type: 'number' } , { name: 'ZHIBAOJIN', type: 'number' } , { name: 'ZONGJINE', type: 'number' } ] }); this.storeCargo = Ext.create('Ext.data.Store', { pageSize: 1000, model: 'Cargomb', remoteSort: false, pruneModifiedRecords: true, proxy: { type: 'ajax', url: '/Import/XXH/GetCargoList', reader: { id: 'id,ContractNo', root: 'data', totalProperty: 'totalCount' } } }); var CUSTOMERNAME = this.formEdit.getForm().findField('CUSTOMERNAME').getValue(); this.storeCargo.load({ params: { condition: sBSNO }, callback: function (r, options, success) { if (success) { if (r.length != 0) { for (i = 0; i < _this.storeCargo.getCount() ; i += 1) { var memberyf = _this.storeCargo.getAt(i); var store = null; store = _this.storeWMSIN; var record = null; var areaname =""; var BSNO = ""; var CLIENTNAME = ""; var STORAGENAME = ""; var GOODSNAME = ""; var GOODSMODEL = ""; var GOODSSTANDARD = ""; var CHARGEUNIT = ""; BSNO = ""; CLIENTNAME = CUSTOMERNAME; var newid = NewGuid(); record = Ext.create('WMSINmb', { //GOODSNAMEDISPLAY: pinming, GID: newid, ASSOCIATEDNO: "", BLNO: "", CONTRACTNO: "", CTNALL: CTNALL, CNTRNO: sCNTRNO, SEALNO: SEALNO, BSNO: BSNO, CLIENTCODE: "", CLIENTNAME: CLIENTNAME, DODATE: "", STORAGECODE: "", STORAGENAME: STORAGENAME, AREACODE: "", AREANAME:"", GOODSCODE: "", GOODSNAME: memberyf.data.name, GOODSNAMEID: memberyf.data.name, GOODSNAMEDISPLAY: memberyf.data.name, GOODSTYPE: "", GOODSMODEL: GOODSMODEL, GOODSSTANDARD: "", GOODSPACK: memberyf.data.BoxCount, GOODSPACKSTOCK: memberyf.data.BoxCount, GOODSKGS: memberyf.data.weight/1000, CHARGEUNIT:'吨', GOODSRKSL: memberyf.data.weight/1000, GOODSSTOCK: memberyf.data.weight / 1000, FREESTORAGEPERIOD: "0", ISLOCK: "0", LOCKTIME: "1900-01-01", LOCKUSER: "", ISDELETE: "0", DELETETIME: "1900-01-01", DELETEUSER: "", CREATEUSER: "", CREATETIME: '2017-05-22', MODIFIEDUSER: "", MODIFIEDTIME: '2017-05-22', REMARK: "", CLIENTCODEOLD: "", CLIENTNAMEOLD: "", KINDPKGS: "", ARFEE: "0", APFEE: "0", CORPID: COMPANYID, GOODSTHICKNESS: "0", GOODSWIDTH: "0", GOODSLENGTH: "0", GOODSSLICE: "", GOODSGRADE: "", STACKLOCATION: "", GOODSPACKACTUAL: "0", GOODSRKSLACTUAL: "0", ISCHANGE: "0", MARKETVALUE: "0", BANKVALUE: "0", JIANSHU2: "0", JIANSHU1: memberyf.data.BoxCount, LINENUM: _this.getLinenum(), CHIMA1: "0", CHIMA2: "0", ZHONGLIANG2: "0", SHIJIZHONGLIANG: "0", SHIJICHIMA: "0", PRODUCTIONDATE: memberyf.data.PRODUCTIONDATE, FactoryNo: memberyf.data.FactoryNo }); store.add(record); } } } } }); } if (data.GID == "") { data.GID = "0" } } else { Ext.MessageBox.alert('提示', result.Message); return; } } else { Ext.MessageBox.alert('请求出现错误,请重试', response.responseText); } }, scope: this }); }, SetOpseaiData: function () { var ret1 = window.parent.opener.OprationSwap(); var blno = ret1[3].data.MBLNO; var customno = ''; var sBLNO = ""; //提单号 var sCUSTOMNO = ""; //报关单号、备案清单号 var sCONTRACTNO = ""; //合同号 var sCUSTNO = ""; //委托编号 var sCUSTOMERNAME = ""; //客户名称 var sBSNO = ""; //海运进口业务gid var sCTNALL = ""; //箱型 var sCNTRNO = ""; //箱号 var sSEALNO = ""; //封号 var sBAOGUANJIANSHU = 0; //报关件数 var sISBONDED = ""; var sOPLBNAME = ""; var sCompanyID = ""; var sStorageName = ""; Ext.Ajax.request({ waitMsg: '正在查询主表数据...', //参数BLNO为提单号或委托单号 url: '/MvcShipping/WMSNew/GetDataWithBLNOAndWMSNO', params: { BLNO: blno, CUSTOMNO: customno }, callback: function (options, success, response) { if (success) { var result = Ext.JSON.decode(response.responseText); if (result.Success == true) { //更新备案清单号列表 this.storeCustomsNo.load({ params: { BLNO: BLNO, CUSTOMNO: CUSTOMNO } }); var data = this.formEdit.getForm().getValues(); sBLNO = result.MBLNO; sCUSTOMNO = result.CUSTOMNO; sCONTRACTNO = result.CONTRACTNO; sCUSTNO = result.CUSTNO; sCUSTOMERNAME = result.CUSTOMERNAME; sBSNO = result.BSNO; sCTNALL = result.CTNALL; sCNTRNO = result.CNTRNO; sSEALNO = result.SEALNO; sBAOGUANJIANSHU = result.BAOGUANJIANSHU; sISBONDED = result.ISBONDED; sOPLBNAME = result.OPLBNAME; sCompanyID = result.COMPANYID; sStorageName = result.STORAGENAME; var timeStamp = Ext.util.Format.date(result.timeStamp, 'Y-m-d'); TIMESTAMP = timeStamp; CNTRNO = sCNTRNO; CTNALL = sCTNALL; SEALNO = sSEALNO; PKGS = result.PKGS; KGS = result.KGS; BAOGUANJIANSHU = sBAOGUANJIANSHU; MBLNO = sBLNO; BSNO = sBSNO; if (true) { data.ISBONDED = sISBONDED; data.BAOGUANJIANSHU = BAOGUANJIANSHU; data.ASSOCIATEDNO = sBSNO; data.CORPID = COMPANYID; data.DEPTNAME = DEPTGID; data.CUSTOMERNAME = sCUSTOMERNAME; data.BLNO = sBLNO; data.CUSTNO = sCUSTNO; data.CUSTOMNO = sCUSTOMNO; data.CONTRACTNO = sCONTRACTNO; data.ARCLIENT = sCUSTOMERNAME; data.GOODSNAME = ""; data.CREATEUSER = USERID; data.CREATETIME = timeStamp; data.WMSDATE = timeStamp; data.FREESTORAGEPERIOD = "0"; data.STARTBILLINGDATE = timeStamp; data.FREESTORAGEPERIODAP = "0"; data.STARTBILLINGDATEAP = timeStamp; data.MARKETVALUE = "0"; data.BANKVALUE = "0"; data.GOODSPACK = "0"; data.GOODSPACKSTOCK = "0"; data.GOODSRKSL = "0"; data.GOODSSTOCK = "0"; data.ARFEE = "0"; data.APFEE = "0"; data.GOODSPACKACTUAL = "0"; data.GOODSRKSLACTUAL = "0"; data.CHARGEUNIT = ""; data.CTNALL = sCTNALL; data.CNTRNO = sCNTRNO; data.SEALNO = sSEALNO; data.PKGS = "0"; data.TiDanJianShu = PKGS; data.COMPANY = sCompanyID; data.TiDanZhongLiang = KGS; data.STORAGENAME = sStorageName; data.EIP = false; data.RENTAREA = "0"; } if (data.CUSTOMERNAME != '') { var recordCustCode = Ext.create('DsShipping.ux.CustomRefModel', { GId: NewGuid(), CustCode: data.CUSTOMERNAME, CustName: data.CUSTOMERNAME, CodeAndName: data.CUSTOMERNAME }); this.storeCustCode.add(recordCustCode); } if (data.ARCLIENT != '') { var recordCustCode = Ext.create('DsShipping.ux.CustomRefModel', { GId: NewGuid(), CustCode: data.ARCLIENT, CustName: data.ARCLIENT, CodeAndName: data.ARCLIENT }); this.storeGainCust.add(recordCustCode); } if (data.TRUCKNAME != '') { var recordCustCode = Ext.create('DsShipping.ux.CustomRefModel', { GId: NewGuid(), CustCode: data.TRUCKNAME, CustName: data.TRUCKNAME, CodeAndName: data.TRUCKNAME }); this.storePayCust.add(recordCustCode); } var basicForm = this.formEdit.getForm(); this.storeCodeCtn.load({ params: { mblno: BLNO } }); this.formEdit.getForm().setValues(data); if (data.GID == "") { data.GID = "0" } } else { Ext.MessageBox.alert('提示', result.Message); return; } } else { Ext.MessageBox.alert('请求出现错误,请重试', response.responseText); } }, scope: this }); }, onImportCtnClick: function () { var basicForm = this.formEdit.getForm(); var wmsgid = basicForm.findField('GID').value; var wmsasso = basicForm.findField('ASSOCIATEDNO').value; if ((wmsgid == wmsasso) || (wmsasso == '') || (FEECONFIG != '1')) { Ext.MessageBox.alert('提示', '业务并没有关联海运进口或者没有在查询框输入提单号'); return; } var CUSTOMERNAME = this.formEdit.getForm().findField('CUSTOMERNAME').getValue(); _this = this; this.storeCtnList = Ext.create('Ext.data.Store', { pageSize: 1000, params: { condition: " BSNO='" + wmsasso + "'" }, fields: [ { name: 'CTNALL', type: 'string' }, { name: 'CTNNUM', type: 'string' }, { name: 'CNTRNO', type: 'string' }, { name: 'SEALNO', type: 'string' }, { name: 'PKGS', type: 'string' }, { name: 'KGS', type: 'string' }, { name: 'CBM', type: 'string' }, { name: 'UNITOFWEIGHT', type: 'string' }, { name: 'GOODSNAME', type: 'string' }, { name: 'GOODSNAMEID', type: 'string' } ], remoteSort: true, proxy: { type: 'ajax', url: '/MvcShipping/MsOpSeai/GetCtnDetailList', reader: { id: '', root: 'data', totalProperty: 'totalCount' } } }); this.storeCtnList.load({ params: { condition: " B.BSNO='" + wmsasso + "' and (c.ISWMS = '0' or c.ISWMS is null) " }, callback: function (r, options, success) { if (success) { if (r.length != 0) { for (i = 0; i < _this.storeCtnList.getCount(); i += 1) { var memberyf = _this.storeCtnList.getAt(i); _this.formEdit.getForm().findField('CHARGEUNIT').setValue(memberyf.data.UNITOFWEIGHT); var store = null; store = _this.storeWMSIN; var record = null; var areaname = ""; var BSNO = ""; var CLIENTNAME = ""; var STORAGENAME = ""; var GOODSNAME = ""; var GOODSMODEL = ""; var GOODSSTANDARD = ""; var CHARGEUNIT = ""; BSNO = ""; CLIENTNAME = CUSTOMERNAME; var newid = NewGuid(); record = Ext.create('WMSINmb', { //GOODSNAMEDISPLAY: pinming, GID: newid, ASSOCIATEDNO: "", BLNO: "", CONTRACTNO: "", CTNALL: memberyf.data.CTNALL, CNTRNO: memberyf.data.CNTRNO, SEALNO: "", BSNO: BSNO, CLIENTCODE: "", CLIENTNAME: CLIENTNAME, DODATE: "", STORAGECODE: "", STORAGENAME: STORAGENAME, AREACODE: "", AREANAME: "", GOODSCODE: "", GOODSNAME: memberyf.data.GOODSNAME, GOODSNAMEID: memberyf.data.GOODSNAMEID, GOODSNAMEDISPLAY: memberyf.data.GOODSNAME, GOODSTYPE: "", GOODSMODEL: "", GOODSSTANDARD: "", GOODSPACK: memberyf.data.PKGS, GOODSPACKSTOCK: memberyf.data.PKGS, GOODSKGS: memberyf.data.KGS, CHARGEUNIT: memberyf.data.UNITOFWEIGHT, GOODSRKSL: memberyf.data.KGS, GOODSSTOCK: memberyf.data.KGS, FREESTORAGEPERIOD: "0", ISLOCK: "0", LOCKTIME: "1900-01-01", LOCKUSER: "", ISDELETE: "0", DELETETIME: "1900-01-01", DELETEUSER: "", CREATEUSER: "", CREATETIME: '2017-05-22', MODIFIEDUSER: "", MODIFIEDTIME: '2017-05-22', REMARK: "", CLIENTCODEOLD: "", CLIENTNAMEOLD: "", KINDPKGS: "", ARFEE: "0", APFEE: "0", CORPID: COMPANYID, GOODSTHICKNESS: "0", GOODSWIDTH: "0", GOODSLENGTH: "0", GOODSSLICE: "", GOODSGRADE: "", STACKLOCATION: "", GOODSPACKACTUAL: memberyf.data.PKGS, GOODSRKSLACTUAL: "0", ISCHANGE: "0", MARKETVALUE: "0", BANKVALUE: "0", JIANSHU2: "0", JIANSHU1: memberyf.data.PKGS, LINENUM: _this.getLinenum(), CHIMA1: memberyf.data.CBM, CHIMA2: "0", ZHONGLIANG2: "0", SHIJIZHONGLIANG: memberyf.data.KGS, SHIJICHIMA: memberyf.data.KGS, PRODUCTIONDATE: "", FactoryNo: "" }); store.add(record); } } else { Ext.MessageBox.alert('提示', '没有相关信息'); } } } }); }, onCreateCostClick: function () { if (LOCK1 != 1) { Ext.MessageBox.alert('提示', '未入账不允许生成费用'); return; } Ext.Ajax.request({ waitMsg: '正在生成费用...', url: '/MvcShipping/WMSNew/CreateCost', params: { wmsno: WMSNO }, callback: function (options, success, response) { if (success) { var result = Ext.JSON.decode(response.responseText); if (result.Success == true) { Ext.MessageBox.alert('提示', result.Message); var condition = " WMSNO='" + WMSNO + "'"; this.LoadData('edit', condition); } else { Ext.MessageBox.alert('提示', result.Message); return; } } else { Ext.MessageBox.alert('请求出现错误,请重试', response.responseText); } }, scope: this }); } //#region 仓储费率相关 , onAddWMSRATEClick: function (button, event, type) { var store = null; store = this.storeWMSRATE; var record = null; var newid = NewGuid(); var FEEGRADE = this.getLinenum2("1", newid); var startdate = this.getStartDate(FEEGRADE, '1'); if (FEEGRADE == "1") { days = 1; } else { days = 2; } var enddate = getAfterDATE(startdate, days); record = Ext.create('WMSRATEmb', { GID: newid, CUSTOMERNAME: "", FEETYPE: "0", FEETYPEREF: "", FEEGRADE: FEEGRADE, FEESCALE: 1, FEEPRICE: 0, FEEUNIT: "", CREATEUSER: USERID, CREATETIME: TIMESTAMP, MODIFIEDUSER: SHOWNAME, MODIFIEDTIME: TIMESTAMP, REMARK: "", BSNO: "", ADDPRICE: "0", //ENDBILLINGDATE: TIMESTAMP, ENDBILLINGDATE: enddate, RATETYPE: 1, FEENAME: "仓储费", ISCHANGE: "0", CAPPRICE: "0" }); store.add(record); cellediting = this.CE_RATE; var n = store.getCount(); cellediting.startEditByPosition({ row: n - 1, column: 2 }); this.storeWMSRATE.each(function (record) { if (record.get('GID') == newid) { record.set('FEETYPE', "1"); record.set('FEETYPEREF', "收"); } }); } , SaveRate: function (type) { if (COMPANYID == "" || DEPTGID == "") { alert("登录信息不全,请退出重新登录"); return; } var WMSRATEdatas = []; var data = this.formEdit.getForm().getValues(); var dt0 = new Date(data.STARTBILLINGDATE); var dttemp; for (var i = 0; i < this.storeWMSRATE.getCount(); i++) { //判断结束计费日期 STARTBILLINGDATE var member = this.storeWMSRATE.getAt(i); var dt1 = new Date(member.data.ENDBILLINGDATE); if (i == 0) { if (dt1 < dt0) { Ext.Msg.show({ title: '错误', msg: '结束计费日期录入错误!', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); return; } } else { var member = this.storeWMSRATE.getAt(i); var dt2 = new Date(member.data.ENDBILLINGDATE); if (dt2 < dt0) { Ext.Msg.show({ title: '错误', msg: '结束计费日期录入错误!', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); return; } } dttemp = dt1; } var data = this.formEdit.getForm().getValues(); for (var i = 0; i < this.storeWMSRATE.getCount(); i += 1) { var member = this.storeWMSRATE.getAt(i); member.data.CUSTOMERNAME = data.CUSTOMERNAME; WMSRATEdatas.push(member); } var WMSRATEBody = ConvertRecordsToJson(WMSRATEdatas); var WMSRATEBodyDel = ConvertRecordsToJsonAll(this.WMSRATEBodyDel); var _this = this; if ((WMSRATEBody + WMSRATEBodyDel) == "") { return; } Ext.Msg.wait('正在保存数据, 请稍侯..'); Ext.Ajax.request({ waitMsg: '正在保存数据...', url: '/MvcShipping/WMSNew/SaveRate', scope: this, params: { BSNONAME: "BSNO", BSNO: data.GID, WMSRATEBody: WMSRATEBody, WMSRATEBodyDel: WMSRATEBodyDel }, callback: function (options, success, response) { if (success) { Ext.MessageBox.hide(); var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { var GID = _this.EditRecord.get('GID'); _this.storeWMSRATE.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: " BSNO='" + GID + "'" }, waitMsg: "正在查询数据...", scope: this }); } 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 }); } } }); } , onDelWMSRATEClick: function (button, event, type) { var selectedRecords = []; selectedRecords = this.CB_RATE.selected.items; if (selectedRecords.length == 0) { Ext.Msg.show({ title: '提示', msg: '请先选择要删除的费率!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } Ext.MessageBox.confirm('提示', '确定要删除选中的费率信息吗?', function (btn) { if (btn == 'yes') { if (COMPANYID == "" || DEPTGID == "") { alert("登录信息不全,请退出重新登录"); return; } if (selectedRecords.length > 0) { for (var i = 0; i < selectedRecords.length; i++) { var rec = selectedRecords[i]; if (rec.data.BSNO != "") //如果是新增但没有保存的数据,没有必要提交到后台 { this.WMSRATEBodyDel.push(rec); } else { this.storeWMSRATE.remove(selectedRecords[i]); } } } var WMSRATEBodyDel = ConvertRecordsToJsonAll(this.WMSRATEBodyDel); if (WMSRATEBodyDel == "") { return; } else { var data = this.formEdit.getForm().getValues(); var _this = this; Ext.Msg.wait('正在保存数据, 请稍侯..'); Ext.Ajax.request({ waitMsg: '正在保存数据...', url: '/MvcShipping/WMSNew/DelRate', scope: this, params: { BSNONAME: "BSNO", BSNO: data.GID, WMSRATEBodyDel: WMSRATEBodyDel }, callback: function (options, success, response) { if (success) { Ext.MessageBox.hide(); var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { for (var i = 0; i < selectedRecords.length; i++) { this.storeWMSRATE.remove(selectedRecords[i]); } //this.storeWMSRATE.remove(selectedRecords[i]); } 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 }); } //alert('03'); } }); } } }, this); }, setFeeModel: function (FeeType) { if (this.storeWMSRATE.getCount() === 0) return; for (let i = 0; i < this.storeWMSRATE.getCount(); i++) { var record = this.storeWMSRATE.getAt(i); if ((record.get('FEETYPE')) != FeeType) continue; var startdate = this.getStartDate(parseInt(record.get('FEEGRADE')), FeeType); var days = 0; if (parseInt(record.get('FEEGRADE')) == "1") { days = parseInt(record.get('FEESCALE')); } else { days = parseInt(record.get('FEESCALE')) + 1; } var enddate = getAfterDATE(startdate, days); if (parseInt(record.get('FEESCALE')) === 0) { enddate = getAfterDATE(enddate, 2); } record.set('ENDBILLINGDATE', enddate); } } , WMSRATEAfterEdit: function (editor, e, eOpts) { //需要自己实现里面的事件 if (COMPANYID == "" || DEPTGID == "") { alert("登录信息不全,请退出重新登录"); returen; } if (e.field == 'FEESCALE') { var startdate = this.getStartDate(parseInt(e.record.get('FEEGRADE')), e.record.get('FEETYPE')); var days = 0; if (parseInt(e.record.get('FEEGRADE')) == "1") { days = parseInt(e.value); } else { days = parseInt(e.value) + 1; } var enddate = getAfterDATE(startdate, days); if (parseInt(e.value) === 0) { enddate = getAfterDATE(enddate, 2); } e.record.set('ENDBILLINGDATE', enddate); } if (e.field == 'FEETYPE') { var staterecords = DsStoreQueryBy(this.storeFeeType, 'FeeTypeID', e.value); if (staterecords.getCount() > 0) { var statedata = staterecords.getAt(0).data; e.record.set('FEETYPEREF', statedata.FeeTypeName); e.record.set('FEEGRADE', this.getLinenum2(e.value, e.record.get('GID'))); } else { e.record.set('FEETYPEREF', ''); } var startdate = this.getStartDate(parseInt(e.record.get('FEEGRADE')), e.record.get('FEETYPE')); var days = 0; if (parseInt(e.record.get('FEEGRADE')) == 1) { days = parseInt(e.value); } else { days = parseInt(e.value) + 1; } var enddate = getAfterDATE(startdate, days); if (parseInt(e.value) === 0) { enddate = getAfterDATE(enddate, 2); } e.record.set('ENDBILLINGDATE', enddate); } }, getLinenum: function (button, event) { var _L = 0; for (var i = 0; i < this.storeWMSIN.getCount(); i++) { var _t = parseInt(this.storeWMSIN.getAt(i).get("LINENUM")); if (_t > _L) { _L = _t; } } _L++; return _L; }, ImportFeeModel: function () { Ext.MessageBox.confirm('提示', '点击确定系统将自动导入入库明细【第一行】的【品名】相关仓储费率模板', function (btn) { if (btn == 'yes') { var _this = this; var ARCLIENT = "'" + this.EditRecord.data.ARCLIENT + "'"; //应收客户 var STORAGENAME = "'" + this.EditRecord.data.STORAGENAME + "'"; //仓库 var pinmingid = ''; if (this.storeWMSIN.data.items.length > 0) { pinmingid = this.storeWMSIN.data.items[0].data.GOODSNAMEID; } if (ARCLIENT == 'undefine' || ARCLIENT == '') { Ext.Msg.show({ title: '错误', msg: '未获取到应收客户信息!', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); return; } if (STORAGENAME == 'undefine' || STORAGENAME == '') { Ext.Msg.show({ title: '错误', msg: '未获取到仓库信息!', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); return; } if (pinmingid == '') { Ext.Msg.show({ title: '错误', msg: '未获取到品名信息!', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); return; } pinmingid = "'" + pinmingid + "'"; dodate = Ext.getCmp("WMSDATE").getValue(); Ext.Ajax.request({// waitMsg: '正在处理数据...', url: '/MvcShipping/WMSNew/GetImportFeeModel', params: { custname: ARCLIENT, goodnameid: pinmingid, wmsdate: dodate, storagename:STORAGENAME }, callback: function (options, success, response) { var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { for (var i = 0; i < jsonresult.data.length; i++) { var feedata = jsonresult.data[i]; var store = null; store = this.storeWMSRATE; var record = null; var newid = NewGuid(); var JiFeiTime = this.formEdit.getForm().findField('STARTBILLINGDATE').getValue(); record = Ext.create('WMSRATEmb', { GID: newid, CUSTOMERNAME: feedata, FEETYPE: feedata.ShouFuFangXiang, FEETYPEREF: "", FEEGRADE: feedata.JiFeiDengJi, FEESCALE: feedata.JiFeiQuJian, FEEPRICE: feedata.JiFeiDanJia, FEEUNIT: "", CREATEUSER: USERID, CREATETIME: TIMESTAMP, MODIFIEDUSER: SHOWNAME, MODIFIEDTIME: TIMESTAMP, REMARK: "", BSNO: "", ADDPRICE: feedata.ZengZhiJia, ENDBILLINGDATE: TIMESTAMP, RATETYPE: 1, FEENAME: "仓储费", ISCHANGE: "0", CAPPRICE: feedata.FengDingJia }); store.add(record); this.storeWMSRATE.each(function (record) { if (record.get('FEETYPE') == '1') { record.set('FEETYPEREF', "收"); } else { record.set('FEETYPEREF', "付"); } }); var value = feedata.JiFeiQuJian; var startdate = this.getStartDate(parseInt(record.get('FEEGRADE')), record.get('FEETYPE')); var days = 0; if (parseInt(record.get('FEEGRADE')) == "1") { days = parseInt(value) } else { days = parseInt(value) + 1; } var enddate = getAfterDATE(startdate, days); record.set('ENDBILLINGDATE', enddate); } } else { alert(jsonresult.Message); } }, scope: this }); //request over } }, this); } //#endregion , MakeWMSIN: function (CNTRNO) { var store = null; var data = this.formEdit.getForm().getValues(); store = this.storeWMSIN; //var jianshu1 = store.data.items.length > 0 ? store.data.items[store.data.items.length - 1].data.GOODSPACK : 0; var jianshu1 = store.data.items.length > 0 ? store.data.items[store.data.items.length - 1].data.JIANSHU1 : 0; var jianshu2 = store.data.items.length > 0 ? store.data.items[store.data.items.length - 1].data.JIANSHU2 : 0; var zongjianshu = store.data.items.length > 0 ? store.data.items[store.data.items.length - 1].data.GOODSPACK : 0; var pinming = store.data.items.length > 0 ? store.data.items[store.data.items.length - 1].data.GOODSNAMEDISPLAY : ''; var guigejianshu = store.data.items.length > 0 ? store.data.items[store.data.items.length - 1].data.GOODSSTANDARD : ''; var baozhuangjianshu = store.data.items.length > 0 ? store.data.items[store.data.items.length - 1].data.GOODSSLICE : ''; var record = null; var areaname = data.AREANAME; var BSNO = ""; var CLIENTNAME = ""; var STORAGENAME = ""; var GOODSNAME = ""; var GOODSMODEL = ""; var GOODSSTANDARD = ""; var CHARGEUNIT = ""; if (this.OpStatus == "add") { BSNO = ""; CLIENTNAME = data.CUSTOMERNAME; STORAGENAME = ""; GOODSNAME = data.GOODSNAME; //GOODSMODEL = ""; GOODSMODEL = data.GOODSMODEL; GOODSSTANDARD = ""; CHARGEUNIT = data.CHARGEUNIT; } else { BSNO = this.EditRecord.get('WMSNO'); CLIENTNAME = this.EditRecord.get('CUSTOMERNAME'); STORAGENAME = this.EditRecord.get('STORAGENAME'); GOODSNAME = this.EditRecord.get('GOODSNAME'); //GOODSMODEL = this.EditRecord.get('GOODSMODEL'); GOODSMODEL = data.GOODSMODEL; GOODSSTANDARD = this.EditRecord.get('GOODSSTANDARD'); CHARGEUNIT = this.EditRecord.get('CHARGEUNIT'); } var newid = NewGuid(); record = Ext.create('WMSINmb', { //GOODSNAMEDISPLAY: pinming, GID: newid, ASSOCIATEDNO: "", BLNO: "", CONTRACTNO: "", CTNALL: CTNALL, CNTRNO: CNTRNO, SEALNO: SEALNO, BSNO: BSNO, CLIENTCODE: "", CLIENTNAME: CLIENTNAME, DODATE: "", STORAGECODE: "", STORAGENAME: STORAGENAME, AREACODE: "", AREANAME: areaname, GOODSCODE: "", GOODSNAME: GOODSNAME, GOODSTYPE: "", GOODSMODEL: GOODSMODEL, GOODSSTANDARD: guigejianshu, GOODSPACK: zongjianshu, GOODSPACKSTOCK: "0", GOODSKGS: "0", CHARGEUNIT: CHARGEUNIT, GOODSRKSL: "0", GOODSSTOCK: "0", FREESTORAGEPERIOD: "0", ISLOCK: "0", LOCKTIME: "1900-01-01", LOCKUSER: "", ISDELETE: "0", DELETETIME: "1900-01-01", DELETEUSER: "", CREATEUSER: "", CREATETIME: '2017-05-22', MODIFIEDUSER: "", MODIFIEDTIME: '2017-05-22', REMARK: "", CLIENTCODEOLD: "", CLIENTNAMEOLD: "", KINDPKGS: "", ARFEE: "0", APFEE: "0", CORPID: COMPANYID, GOODSTHICKNESS: "0", GOODSWIDTH: "0", GOODSLENGTH: "0", GOODSSLICE: baozhuangjianshu, GOODSGRADE: "", STACKLOCATION: "", GOODSPACKACTUAL: "0", GOODSRKSLACTUAL: "0", ISCHANGE: "0", MARKETVALUE: "0", BANKVALUE: "0", JIANSHU2: jianshu2, JIANSHU1: jianshu1, LINENUM: this.getLinenum(), CHIMA1: "0", CHIMA2: "0", ZHONGLIANG2: "0", SHIJIZHONGLIANG: "0", SHIJICHIMA: "0" }); store.add(record); cellediting = this.cellEditing; var n = store.getCount(); cellediting.startEditByPosition({ row: n - 1, column: 2 }); this.storeWMSIN.each(function (record) { if (record.get('GID') == newid) { record.set('DODATE', Ext.util.Format.date(currdate, 'Y-m')); } }); }, //#endregion //#region 设置disabled SetFieldDisabled: function(value) { Ext.getCmp('WMSNO').setDisabled(value); Ext.getCmp('ZGOODSKGS').setDisabled(value); Ext.getCmp('PKGS').setDisabled(value); } //#endregion //#region 计算装卸队对应的 //#endregion });