DS7/DSWeb/Areas/MvcShipping/Viewsjs/WMSImport/WMSINMAKE.js

3823 lines
136 KiB
JavaScript

This file contains ambiguous Unicode characters!

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

///<reference path="../../../../Views/../TruckMng/Scripts/vswd-ext_2.0.2.js" />
Ext.namespace('Shipping');
Shipping.WMSINEdit = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.WMSINEdit.superclass.constructor.call(this);
};
Date.prototype.format = function (format) {
var o = {
"M+": this.getMonth() + 1, //month
"d+": this.getDate(), //day
"h+": this.getHours(), //hour
"m+": this.getMinutes(), //minute
"s+": this.getSeconds(), //second
"q+": Math.floor((this.getMonth() + 3) / 3), //quarter
"S": this.getMilliseconds() //millisecond
}
if (/(y+)/.test(format)) format = format.replace(RegExp.$1,
(this.getFullYear() + "").substr(4 - RegExp.$1.length));
for (var k in o) if (new RegExp("(" + k + ")").test(format))
format = format.replace(RegExp.$1,
RegExp.$1.length == 1 ? o[k] :
("00" + o[k]).substr(("" + o[k]).length));
return format;
}
var xhr = new XMLHttpRequest();
var currdate = new Date();
if (!xhr) {
//...其他生成xmlhttprequest方法
}
xhr.open("HEAD", location.href, true);
xhr.onreadystatechange = function () {
if (xhr.readyState == 4 && xhr.status == 200) {
var datestr = xhr.getResponseHeader("Date");
currdate = new Date(datestr);
// alert(currdate.format('yyyy-MM-dd'));
}
}
xhr.send(null);
function getSaved() {
var feedirty = DsTruck.GetDirty(panelEdit.storeWMSIN);
if (panelEdit.formEdit.getForm().isDirty()== true )
{
return true;
}
else return false;
}
Ext.extend(Shipping.WMSINEdit, Ext.Panel, {
parentWin: null,
OpStatus: 'add',
StoreList: null,
editRecord: null,
parentRecord: null,
BXSTATUS: 1,
// parentfunction: null,
_First: true,
VISIBLERANGE: 0,
OPERATERANGE: 0,
WorkFlowName: "",
WorkFlowID: "",
PageSize: 30,
OPLBNAME: "",
initUIComponents: function () {
this.feeSerialNo = 0;
this.WMSINBodyDel = [];
this.WMSRATEBodyDel = [];
this.CargoListName = "CargoList_WMSMAKE";
//#region 枚举参照相关(编辑form)
WorkFlowName = 'WMSINmod';
//客户加载_委托单位
//仓储出库货主
this.storeCustWmsCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
this.storeCustWmsCode.load({ params: { condition: "ISWAREHOUSE='1'"} });
this.comboxCustWmsCode = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '仓 库',
store: this.storeCustWmsCode,
forceSelection: true,
id: 'STORAGENAME',
name: 'STORAGENAME',
valueField: 'CustName',
displayField: 'CodeAndName',
allowBlank: false
});
//委托单位
this.storeCustCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
this.storeCustCode.load({ params: { condition: "ISCONTROLLER='1'"} });
this.comboxCustCode = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '委托单位',
store: this.storeCustCode,
forceSelection: true,
id: 'CUSTOMERNAME',
name: 'CUSTOMERNAME',
valueField: 'CustName',
displayField: 'CodeAndName',
allowBlank: false/*,
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
var data = combo.value;
var s = "LINKID in (select gid from [info_client] where SHORTNAME='" + combo.value + "')";
this.storeInfoClientContact.load({ params: { condition: s} });
}
}
}*/
});
this.storeGainCust = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
this.storeGainCust.load({ params: { condition: ""} });
this.comboxGainCust = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '应收客户',
store: this.storeGainCust,
forceSelection: true,
id: 'ARCLIENT',
name: 'ARCLIENT',
valueField: 'CustName',
displayField: 'CodeAndName'
});
this.storePayCust = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
this.storePayCust.load({ params: { condition: ""} });
this.comboxPayCust = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '应付客户',
store: this.storePayCust,
forceSelection: true,
id: 'TRUCKNAME',
name: 'TRUCKNAME',
valueField: 'CustName',
displayField: 'CodeAndName'
});
var CHARGEUNITData = [{ "CHARGEUNIT": "吨" },
{ "CHARGEUNIT": "千克" },
{ "CHARGEUNIT": "CBM"}];
this.storeCHARGEUNIT = Ext.create('Ext.data.Store', {
model: 'CHARGEUNITmb',
data: CHARGEUNITData
});
this.comboxCHARGEUNIT = Ext.create('DsExt.ux.RefEnumCombox', {
fieldLabel: '计费单位',
forceSelection: true,
store: this.storeCHARGEUNIT,
name: 'CHARGEUNIT',
valueField: 'CHARGEUNIT',
displayField: 'CHARGEUNIT',
listeners: {
change: function (field, newValue, oldValue) {
this.setCBM(newValue, oldValue);
},
scope: this
}
});
this.storeCodeGoodsList = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CodeGoodsModel',
proxy: { url: '/CommMng/BasicDataRef/GetCodeGoodsList' }
});
this.storeCodeGoodsList.load();
this.comboxGOODSNAME = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '品名',
store: this.storeCodeGoodsList,
id: 'GOODSNAME',
name: 'GOODSNAME',
valueField: 'GOODNAME',
displayField: 'CodeAndName'/*,
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
var Cargoinforecords = DsStoreQueryBy(this.storeCodeGoodsList, 'GOODNAME', records[0].data.GOODNAME);
if (Cargoinforecords.getCount() > 0) {
var Cargoinfodata = Cargoinforecords.getAt(0).data;
this.formEdit.getForm().findField('GOODSTYPENAME').setValue(Cargoinfodata.GoodsTypeName);
} else {
this.formEdit.getForm().findField('GOODSTYPENAME').setValue('');
}
}
}
}*/
});
this.storeUser = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsTruckMng.ux.UserRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetUserRefList' }
});
this.storeUser.load({ params: { condition: " 1=1 "} });
this.comboxCreator = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '制单人',
forceSelection: true,
store: this.storeUser,
name: 'CREATEUSER',
id: "CREATEUSER",
valueField: 'UserName',
displayField: 'CodeAndName',
allowBlank: false
});
//箱号封号/件数重量
this.storeCTN = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsOpSeaiDetail',
proxy: {
type: 'ajax',
url: '/MvcShipping/MsOpSeai/GetBodyList',
reader: {
id: 'BsNo,CTNCODE,CTN_ID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//this.storeCTN.load({ params: { COMPANYID: COMPANYID} });
this.comboxCTN = Ext.create('DsExt.ux.RefTableCombox', {
//fieldLabel: '箱号',
//forceSelection: true,
store: this.storeCTN,
name: 'CNTRNO',
valueField: 'CNTRNO',
displayField: 'CNTRNO',
allowBlank: false
});
this.comboxSEALNO = Ext.create('DsExt.ux.RefTableCombox', {
//fieldLabel: '封号',
//forceSelection: true,
store: this.storeCTN,
name: 'SEALNO',
valueField: 'SEALNO',
displayField: 'SEALNO',
allowBlank: false
});
//#endregion
//#region 编辑form:formEdit
this.formEdit = Ext.widget('form', {
// layout: "border",
region: 'north',
frame: true,
bodyPadding: 1,
trackResetOnLoad: true,
fieldDefaults: {
margins: '1 1 1 1',
labelAlign: 'right',
flex: 1,
labelWidth: 64,
msgTarget: 'qtip'
//,split:true
},
//bodyStyle: 'background:#FFF',
items: [
{//fieldset 1
xtype: 'fieldset',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{//container_1
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: 'GID',
hidden: true,
name: 'GID'
}, {
fieldLabel: '入库单号', flex: 1,
name: 'WMSNO', id: "WMSNO"
},
this.comboxCustCode,
{
fieldLabel: '提单号', flex: 1,
name: 'BLNO', id: "BLNO"
}, {
fieldLabel: '合同号', flex: 1,
//labelWidth: 100,
name: 'CONTRACTNO', id: "CONTRACTNO"
}
, {
xtype: 'hiddenfield', flex: 2
}
]
}//container_1 end
,
{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxCustWmsCode,
{
name: 'WMSDATE', id: "WMSDATE",
fieldLabel: '入库时间',
format: 'Y-m-d',
xtype: 'datefield',
renderer: Ext.util.Format.dateRenderer('Y-m-d H:i:s'),
listeners: {
scope: this,
'blur': function (field) {
var FREESTORAGEPERIOD = parseInt(Ext.getCmp("FREESTORAGEPERIOD").getValue());
Ext.getCmp("STARTBILLINGDATE").setRawValue(getAfterDATE(field.value, FREESTORAGEPERIOD + 1));
var FREESTORAGEPERIODAP = parseInt(Ext.getCmp("FREESTORAGEPERIODAP").getValue());
Ext.getCmp("STARTBILLINGDATEAP").setRawValue(getAfterDATE(field.value, FREESTORAGEPERIOD + 1));
}
}
}, this.comboxCHARGEUNIT
, this.comboxGainCust
, {
fieldLabel: '应收免仓储期',
labelWidth: 100,
name: 'FREESTORAGEPERIOD',
id: "FREESTORAGEPERIOD",
xtype: 'numberfield',
allowBlank: false,
regex: /^(0|[1-9][0-9]*)$/,
regexText: '请输入正确的数值!',
listeners: {
scope: this,
'blur': function (field) {
var wmsdate = Ext.getCmp("WMSDATE").getValue();
//alert(getAfterDATE(wmsdate, field.value));
Ext.getCmp("STARTBILLINGDATE").setRawValue(getAfterDATE(wmsdate, field.value + 1));
}
}
}
, {
name: 'STARTBILLINGDATE', id: "STARTBILLINGDATE",
fieldLabel: '应收开始计费日期',
labelWidth: 100,
format: 'Y-m-d',
xtype: 'datefield',
renderer: Ext.util.Format.dateRenderer('Y-m-d H:i:s')
}]
},
{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxGOODSNAME
, {
fieldLabel: '牌号',
name: 'GOODSMODEL',
id: "GOODSMODEL"
}, {
fieldLabel: '包装规格',
name: 'GOODSSTANDARD',
id: "GOODSSTANDARD"
}, this.comboxPayCust
, {
fieldLabel: '应付免仓储期',
labelWidth: 100,
name: 'FREESTORAGEPERIODAP',
id: "FREESTORAGEPERIODAP",
xtype: 'numberfield',
regex: /^(0|[1-9][0-9]*)$/,
regexText: '请输入正确的数值!',
listeners: {
scope: this,
'blur': function (field) {
var wmsdate = Ext.getCmp("WMSDATE").getValue();
Ext.getCmp("STARTBILLINGDATEAP").setRawValue(getAfterDATE(wmsdate, field.value + 1));
}
}
}
, {
name: 'STARTBILLINGDATEAP', id: "STARTBILLINGDATEAP",
fieldLabel: '应付开始计费日期',
labelWidth: 100,
format: 'Y-m-d',
xtype: 'datefield',
renderer: Ext.util.Format.dateRenderer('Y-m-d H:i:s')
}
]
},
{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '库 位',
name: 'AREANAME',
id: "AREANAME"
}, {
fieldLabel: '市场货值',
name: 'MARKETVALUE',
id: "MARKETVALUE",
xtype: 'numberfield'
}, {
fieldLabel: '银行货值',
name: 'BANKVALUE',
id: "BANKVALUE",
xtype: 'numberfield'
}, {
fieldLabel: '备案清单号',
name: 'CUSTOMNO',
id: "CUSTOMNO"
}, {
fieldLabel: '委托编号',
labelWidth: 100,
name: 'CUSTNO',
id: "CUSTNO"
}, {
fieldLabel: '批次号',
labelWidth: 100,
name: 'BZTCHNO',
id: "BZTCHNO"
}]
}
,
{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: 'WMSOP', hidden: true,
name: 'WMSOP',
id: "WMSOP"
}, {
fieldLabel: 'STOREMAN', hidden: true,
name: 'STOREMAN',
id: "STOREMAN"
}, {
fieldLabel: 'CREATEUSER', hidden: true,
name: 'CREATEUSER',
id: "CREATEUSER"
}, {
fieldLabel: 'CREATETIME', hidden: true,
name: 'CREATETIME',
id: "CREATETIME"
}, {
fieldLabel: 'MODIFIEDUSER', hidden: true,
name: 'MODIFIEDUSER',
id: "MODIFIEDUSER"
}, {
fieldLabel: 'MODIFIEDTIME', hidden: true,
name: 'MODIFIEDTIME',
id: "MODIFIEDTIME"
}, {
fieldLabel: 'ISDELETE', hidden: true,
name: 'ISDELETE',
id: "ISDELETE"
}, {
fieldLabel: 'DELETEUSER', hidden: true,
name: 'DELETEUSER',
id: "DELETEUSER"
}, {
fieldLabel: 'DELETETIM', hidden: true,
name: 'DELETETIM',
id: "DELETETIM"
}, {
fieldLabel: 'ISLOCK', hidden: true,
name: 'ISLOCK',
id: "ISLOCK"
}, {
fieldLabel: 'LOCKTIME', hidden: true,
name: 'LOCKTIME',
id: "LOCKTIME"
}, {
fieldLabel: 'LOCKUSER', hidden: true,
name: 'LOCKUSER',
id: "LOCKUSER"
}, {
fieldLabel: 'GOODSPACK', hidden: true,
name: 'GOODSPACK',
id: "GOODSPACK"
}, {
fieldLabel: 'GOODSPACKSTOCK', hidden: true,
name: 'GOODSPACKSTOCK',
id: "GOODSPACKSTOCK"
}, {
fieldLabel: 'ARFEE', hidden: true,
name: 'ARFEE',
id: "ARFEE"
}, {
fieldLabel: 'APFEE', hidden: true,
name: 'APFEE',
id: "APFEE"
}, {
fieldLabel: 'ASSOCIATEDNO', hidden: true,
name: 'ASSOCIATEDNO',
id: "ASSOCIATEDNO"
}, {
fieldLabel: 'CLIENTCODEOLD', hidden: true,
name: 'CLIENTCODEOLD',
id: "CLIENTCODEOLD"
}, {
fieldLabel: 'CLIENTNAMEOLD', hidden: true,
name: 'CLIENTNAMEOLD',
id: "CLIENTNAMEOLD"
}, {
fieldLabel: 'CORPID', hidden: true,
name: 'CORPID',
id: "CORPID"
}, {
fieldLabel: 'GOODSPACKACTUAL', hidden: true,
name: 'GOODSPACKACTUAL',
id: "GOODSPACKACTUAL"
}, {
fieldLabel: 'GOODSRKSLACTUAL', hidden: true,
name: 'GOODSRKSLACTUAL',
id: "GOODSRKSLACTUAL"
}, {
fieldLabel: 'ISCHANGE', hidden: true,
name: 'ISCHANGE',
id: "ISCHANGE"
}, {
fieldLabel: 'CLIENTBSNO', hidden: true,
name: 'CLIENTBSNO',
id: "CLIENTBSNO"
}, {
fieldLabel: 'GOODSRKSL', hidden: true,
name: 'GOODSRKSL',
id: "GOODSRKSL"
}, {
fieldLabel: 'GOODSSTOCK', hidden: true,
name: 'GOODSSTOCK',
id: "GOODSSTOCK"
}]
}
]
}
]
});
//#endregion
//#region 编辑wms_IN
//数据集
this.storeWMSIN = Ext.create('Ext.data.Store', {
model: 'WMSINmb',
pageSize: this.PageSize,
remoteSort: false,
pruneModifiedRecords: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/WMS/GetWMSINList',
reader: {
id: 'gid',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//箱型_集装箱列表中的下拉框加载
this.storeCodeCtn = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CodeCtnModel',
proxy: { url: '/CommMng/BasicDataRef/GetCodeCtnList' }
});
this.storeCodeCtn.load();
this.comboxCTNALL = Ext.create('DsExt.ux.RefTableCombox', {
//fieldLabel: '箱型',
store: this.storeCodeCtn,
forceSelection: true,
id: 'CTNALL',
name: 'CTNALL',
valueField: 'CTN',
displayField: 'CTN'
});
var _this = this;
this.columns = [
{
sortable: true, //1
dataIndex: 'GID',
header: '惟一编号',
width: 80, hidden: true
},
{
sortable: true,
dataIndex: 'ASSOCIATEDNO',
header: '关联号',
width: 80, hidden: true
},
{
sortable: true,
dataIndex: 'BLNO',
header: '提单号',
width: 80, hidden: true
},
{
sortable: true,
dataIndex: 'CONTRACTNO',
header: '合同号',
width: 80, hidden: true
},
{
sortable: true, hidden: true, //5
dataIndex: 'LINENUM',
header: '序号',
width: 35
},
{
sortable: true,
dataIndex: 'CTNALL',
header: '箱型',
width: 80, editor: this.comboxCTNALL
},
{
sortable: true,
dataIndex: 'CNTRNO',
header: '箱号',
width: 80,
editor: this.comboxCTN
},
{
sortable: true,
dataIndex: 'SEALNO',
header: '封号',
width: 80,
editor: this.comboxSEALNO
},
{
sortable: true, hidden: true,
dataIndex: 'BSNO',
header: '入库单号',
width: 80
},
{
sortable: true, hidden: true, //10
dataIndex: 'CLIENTCODE',
header: '客户编码',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'CLIENTNAME',
header: '客户名称',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'DODATE',
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: 'STORAGECODE',
header: '仓库编码',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'STORAGENAME',
header: '仓库名称',
width: 80
},
{
sortable: true, hidden: true, //15
dataIndex: 'AREACODE',
header: '库位编码',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'AREANAME',
header: '库位名称',
width: 80,
editor: {
xtype: 'textfield'
}
},
{
sortable: true, //17
dataIndex: 'GOODSCODE',
header: '货物编号',
width: 80,
editor: {
xtype: 'textfield',
enableKeyEvents: true,
listeners: {
keydown: function (textfield, e) {
if (e.getKey() == 40) {
_this.onNextKeyClick(1, 17)
}
}
}
}
},
{
sortable: true, //18
dataIndex: 'GOODSNAME',
header: '货物名称/品名',
width: 80,
editor: {
xtype: 'textfield',
enableKeyEvents: true,
listeners: {
keydown: function (textfield, e) {
if (e.getKey() == 40) {
_this.onNextKeyClick(1, 18)
}
}
}
}
},
{
sortable: true, //19
dataIndex: 'GOODSTYPE',
header: '货物类型',
width: 80,
editor: {
xtype: 'textfield',
enableKeyEvents: true,
listeners: {
keydown: function (textfield, e) {
if (e.getKey() == 40) {
_this.onNextKeyClick(1, 19)
}
}
}
}
},
{
sortable: true, //20
dataIndex: 'GOODSMODEL',
header: '型号/品牌',
width: 80,
editor: {
xtype: 'textfield',
enableKeyEvents: true,
listeners: {
keydown: function (textfield, e) {
if (e.getKey() == 40) {
_this.onNextKeyClick(1, 20)
}
}
}
}
},
{
sortable: true, hidden: true,
dataIndex: 'GOODSSTANDARD',
header: '规格',
width: 80,
editor: {
xtype: 'textfield'
}
},
{
sortable: true,
dataIndex: 'CHARGEUNIT',
header: '计费单位',
width: 80
},
{
sortable: true, summaryType: 'sum', //23
dataIndex: 'GOODSPACK',
header: '入库件数',
width: 80,
editor: {
xtype: 'numberfield',
decimalPrecision: 4,
enableKeyEvents: true,
listeners: {
keydown: function (textfield, e) {
if (e.getKey() == 40) {
_this.onNextKeyClick(1, 23)
}
}
}
}
},
{
sortable: true, id: "GOODSKGS", //24
dataIndex: 'GOODSKGS',
header: '单位重量',
width: 80,
editor: {
xtype: 'numberfield',
decimalPrecision: 4,
enableKeyEvents: true,
listeners: {
keydown: function (textfield, e) {
if (e.getKey() == 40) {
_this.onNextKeyClick(1, 24)
}
}
}
}
},
{
sortable: true, id: "GOODSTHICKNESS", //25
dataIndex: 'GOODSTHICKNESS',
header: '厚度',
width: 80,
editor: {
xtype: 'numberfield',
decimalPrecision: 4,
enableKeyEvents: true,
listeners: {
keydown: function (textfield, e) {
if (e.getKey() == 40) {
_this.onNextKeyClick(1, 25)
}
}
}
}
},
{
sortable: true, id: "GOODSWIDTH",
dataIndex: 'GOODSWIDTH',
header: '宽度',
width: 80,
editor: {
xtype: 'numberfield',
decimalPrecision: 4,
enableKeyEvents: true,
listeners: {
keydown: function (textfield, e) {
if (e.getKey() == 40) {
_this.onNextKeyClick(1, 26)
}
}
}
}
},
{
sortable: true, id: "GOODSLENGTH",
dataIndex: 'GOODSLENGTH',
header: '长度',
width: 80,
editor: {
xtype: 'numberfield',
decimalPrecision: 4,
enableKeyEvents: true,
listeners: {
keydown: function (textfield, e) {
if (e.getKey() == 40) {
_this.onNextKeyClick(1, 27)
}
}
}
}
},
{
sortable: true, summaryType: 'sum',
dataIndex: 'GOODSRKSL',
header: '入库量',
width: 80,
editor: {
xtype: 'numberfield',
decimalPrecision: 5,
enableKeyEvents: true,
listeners: {
keydown: function (textfield, e) {
if (e.getKey() == 40) {
_this.onNextKeyClick(1, 28)
}
}
}
}
},
{
sortable: true, summaryType: 'sum', //29
dataIndex: 'GOODSPACKSTOCK',
header: '*剩余件数(包/片/箱)',
width: 80,
editor: {
xtype: 'numberfield',
decimalPrecision: 4,
enableKeyEvents: true,
listeners: {
keydown: function (textfield, e) {
if (e.getKey() == 40) {
_this.onNextKeyClick(1, 29)
}
}
}
}
},
{
sortable: true, summaryType: 'sum', //30
id: "GOODSSTOCK_IN",
dataIndex: 'GOODSSTOCK',
header: '*库存量',
width: 80,
editor: {
xtype: 'numberfield',
decimalPrecision: 5,
enableKeyEvents: true,
listeners: {
keydown: function (textfield, e) {
if (e.getKey() == 40) {
_this.onNextKeyClick(1, 30)
}
}
}
}
},
{
sortable: true, hidden: true,
dataIndex: 'FREESTORAGEPERIOD',
header: '免仓储期',
width: 80,
editor: {
xtype: 'numberfield',
enableKeyEvents: true,
listeners: {
keydown: function (textfield, e) {
if (e.getKey() == 40) {
_this.onNextKeyClick(1, 31)
}
}
}
}
},
{
sortable: true, hidden: true,
dataIndex: 'ISLOCK',
header: '是否锁定',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'LOCKTIME',
header: '锁定时间',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'LOCKUSER',
header: '锁定操作人',
width: 80
},
{
sortable: true, hidden: true, //35
dataIndex: 'ISDELETE',
header: '是否废除',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'DELETETIME',
header: '废除时间',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'DELETEUSER',
header: '废除操作人',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'CREATEUSER',
header: '创建人',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'CREATETIME',
header: '创建时间',
width: 80
},
{
sortable: true, hidden: true, //40
dataIndex: 'MODIFIEDUSER',
header: '最后一次更新操作人',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'MODIFIEDTIME',
header: '最后一次更新操作时间',
width: 80
},
{
sortable: true,
dataIndex: 'REMARK',
header: '备注',
width: 80,
editor: {
xtype: 'textfield',
enableKeyEvents: true,
listeners: {
keydown: function (textfield, e) {
if (e.getKey() == 40) {
_this.onNextKeyClick(1, 42)
}
}
}
}
},
{
sortable: true, hidden: true,
dataIndex: 'CLIENTCODEOLD',
header: '原客户编码',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'CLIENTNAMEOLD',
header: '原客户名称',
width: 80
},
{
sortable: true, //45
dataIndex: 'KINDPKGS',
header: '包装',
width: 80
},
{
sortable: true, summaryType: 'sum',
dataIndex: 'ARFEE',
header: '应收账款',
width: 80
},
{
sortable: true, summaryType: 'sum',
dataIndex: 'APFEE',
header: '应付账款',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'CORPID',
header: '分公司代码',
width: 80
},
{
sortable: true, summaryType: 'sum',
dataIndex: 'GOODSSLICE',
header: '片数/件',
width: 80,
editor: {
xtype: 'numberfield',
enableKeyEvents: true,
listeners: {
keydown: function (textfield, e) {
if (e.getKey() == 40) {
_this.onNextKeyClick(1, 49)
}
}
}
}
},
{
sortable: true, hidden: true, //50
dataIndex: 'GOODSGRADE',
header: '品名的等级',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'STACKLOCATION',
header: '码放位置',
width: 80
},
{
sortable: true, summaryType: 'sum',
dataIndex: 'GOODSPACKACTUAL',
header: '实际件数(备注类)',
width: 80,
editor: {
xtype: 'numberfield',
enableKeyEvents: true,
listeners: {
keydown: function (textfield, e) {
if (e.getKey() == 40) {
_this.onNextKeyClick(1, 53)
}
}
}
}
},
{
sortable: true, summaryType: 'sum', //54
dataIndex: 'GOODSRKSLACTUAL',
header: '实际数量(备注类)',
width: 80,
editor: {
xtype: 'numberfield',
decimalPrecision: 5,
enableKeyEvents: true,
listeners: {
keydown: function (textfield, e) {
if (e.getKey() == 40) {
_this.onNextKeyClick(1, 54)
}
}
}
}
},
{
sortable: true, hidden: true,
dataIndex: 'ISCHANGE',
header: '是否是货权转移',
width: 80
},
{
sortable: true, summaryType: 'sum',
dataIndex: 'MARKETVALUE',
header: '市场货值',
width: 80,
editor: {
xtype: 'numberfield'
}
},
{
sortable: true, summaryType: 'sum',
dataIndex: 'BANKVALUE',
header: '银行货值',
width: 80,
editor: {
xtype: 'numberfield'
}
}];
this.cellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});
this.CheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
//this.formWMSINBody = new Ext.grid.GridPanel({
this.formWMSINBody = new Ext.grid.GridPanel({
store: this.storeWMSIN,
enableHdMenu: false,
region: 'center',
//layout: "border",
//title: '费用明细',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
plugins: [this.cellEditing],
selModel: this.CheckBoxModel,
selType: 'cellmodel',
features: [{
ftype: 'summary'//Ext.grid.feature.Summary表格汇总特性
}],
tbar: [{ xtype: 'label', text: '入库信息',
style: 'font-size:18px',
labelColor: '#099',
//style:'background-color: #4b9bf5',
x: '5%',
y: '5%'
}, {
text: '增加入库信息', id: "add1",
tooltip: '增加入库信息',
iconCls: "btnadddetail",
handler: function (button, event) {
this.onAddWMSINClick(button, event);
},
scope: this
}, {
text: '删除入库信息', id: "del1",
tooltip: '删除入库信息',
iconCls: "btndeletedetail",
handler: function (button, event) {
this.onDelWMSINClick(button, event);
},
scope: this
}, '-'],
columns: this.columns
});
//////////////////////////////////////////////明细<<<< 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/WMS/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.FEETYPEREF;
},
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 '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
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: '创建人',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'CREATETIME',
header: '创建时间',
width: 80
},
{
sortable: true,
dataIndex: 'MODIFIEDUSER',
header: '最后一次操作人',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'MODIFIEDTIME',
header: '最后一次操作时间',
width: 80
},
{
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.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,
//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) {
this.onAddWMSRATEClick(button, event);
},
scope: this
}, {
text: '删除', id: "delrate",
tooltip: '删除仓储费费率区间',
iconCls: "btndeletedetail",
handler: function (button, event) {
this.onDelWMSRATEClick(button, event);
},
scope: this
}, '-', {
id: "btnSave",
text: '保存',
tooltip: '保存',
iconCls: "btnsave",
handler: function (button, event) {
this.SaveRate();
//alert(USERID);
},
scope: this
}],
columns: this.WMSRATEcolumn
});
//#endregion
//#region 商品信息
//数据集
this.storeCargo = Ext.create('Ext.data.Store', {
model: 'Cargomb2',
remoteSort: false,
pruneModifiedRecords: true,
proxy: {
type: 'ajax',
url: '/Import/ImportTrade/GetCargoList3',
reader: {
id: 'id,ContractNo',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.storeCargo_temp = Ext.create('Ext.data.Store', {
model: 'Cargomb2',
remoteSort: false,
pruneModifiedRecords: true,
proxy: {
type: 'ajax',
url: '/Import/ImportTrade/GetCargoList2',
reader: {
id: 'id,ContractNo',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//#region 相关控件
this.storeExporter = Ext.create('DsExt.ux.RefTableStore', {
model: 'Tradermb',
proxy: { url: '/CommMng/BasicDataRef/GetTrader' }
});
this.storeExporter.load({ params: { condition: " isenterp=1 "} });
this.comboxExporter = Ext.create('DsExt.ux.RefTableCombox', {
//fieldLabel: '出口商',
//forceSelection: true,
store: this.storeExporter,
name: 'Exporter',
valueField: 'name',
displayField: 'codename'
});
this.storeFactoryNo = Ext.create('DsExt.ux.RefTableStore', {
model: 'FactoryNomb',
proxy: { url: '/Import/CargoName/GetFactoryNoList' }
});
this.comboxFactoryNo = Ext.create('DsExt.ux.RefTableCombox', {
//fieldLabel: '厂号',
autosize: true,
//bodyPadding: 5,
//flex: 1,
//width: 100,
//labelWidth: 90,
store: this.storeFactoryNo,
//queryMode: 'local',
//triggerOnClick: false,
name: 'FactoryNo',
valueField: 'FACTORYNO',
displayField: 'FACTORYNO'
});
this.storeCargoName = Ext.create('DsExt.ux.RefTableStore', {
model: 'CargoNamemb',
proxy: { url: '/Import/CargoName/GetCargoNameList' }
});
//this.storeCargoName.load({ params: { condition: " isenterp=1 "} });
this.comboxCargoName = Ext.create('DsExt.ux.RefTableCombox', {
//fieldLabel: '出口商',
//forceSelection: true,
store: this.storeCargoName,
name: 'name',
valueField: 'CNNAME',
displayField: 'CNNAME'
});
this.comboxCargoENName = Ext.create('DsExt.ux.RefTableCombox', {
//forceSelection: true,
store: this.storeCargoName,
name: 'Ename',
valueField: 'ENNAME',
displayField: 'ENNAME'
});
this.storeUnit = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeUnit.load({ params: { enumTypeId: 11} });
this.comboxUnit = Ext.create('DsExt.ux.RefEnumCombox', {
store: this.storeUnit,
forceSelection: true,
name: 'Unit'
, value: '2'
});
this.storecurr = Ext.create('DsExt.ux.RefTableStore', {
model: 'currRef',
proxy: { url: '/CommMng/BasicDataRef/GetcurrRefList' }
});
this.storecurr.load({ params: { condition: ""} });
this.comboxcurr = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storecurr,
forceSelection: true,
name: 'currid',
valueField: 'codename',
displayField: 'codename'
//币别
});
Ext.define('Booleanmb', {
extend: 'Ext.data.Model',
fields: [
{ name: 'BooleanID', type: 'string' },
{ name: 'BooleanName', type: 'string' }
]
});
var BooleanData = [{ "BooleanID": "0", "BooleanName": "否" },
{ "BooleanID": "1", "BooleanName": "是"}];
this.storeInspection_Storage = Ext.create('Ext.data.Store', {
model: 'Booleanmb',
data: BooleanData
});
this.comboxInspection_Storage = Ext.create('DsExt.ux.RefEnumCombox', {
//fieldLabel: '是否商检慢检',
store: this.storeInspection_Storage,
name: 'Inspection_Storage',
valueField: 'BooleanID',
displayField: 'BooleanName'
});
this.storeMainstate = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeMainstate.load({ params: { enumTypeId: 28} });
this.comboxMainstate = Ext.create('DsExt.ux.RefEnumCombox', {
//fieldLabel: '合同货物状态',
forceSelection: true,
store: this.storeMainstate,
name: 'Mainstate'
});
this.storeBuyer = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
this.storeBuyer.load({ params: { condition: ""} }); //客户 委托单位
this.comboxBuyer = Ext.create('DsExt.ux.RefTableCombox', {
//fieldLabel: '购货方', id: "buyer",
matchFieldWidth : false,
store: this.storeBuyer,
forceSelection: true,
name: 'buyer',
valueField: 'CustName',
displayField: 'CodeAndName',
allowBlank: true
});
//#endregion
//表格
this.CargoColumns = [
{
dataIndex: 'id',
header: '自增序列号',
width: 80,
hidden: true
}, {
dataIndex: 'ISLOCKED',
header: '已锁定',
width: 60,
renderer: function (value, cellmeta) {
if (value == "1") {
return "<img src='../../../../TruckMng/Content/Images/Lock.png' />";
}
}
}, {
dataIndex: 'GID',
header: 'GID',
width: 80,
hidden: true,
editor: {
xtype: 'textfield'
}
},
{
dataIndex: 'HTH',
header: '合同号',
width: 80
},
{
dataIndex: 'ContainerNo',
header: '箱号',
width: 80
},
{
dataIndex: 'buyer',
header: '跟单购货方',
editor:this.comboxBuyer,
width: 80
},
{
dataIndex: 'SALEINFO',
header: '销售摘要',
width: 160
},
{
dataIndex: 'ContractNo',
header: '合同序列号',
width: 80,
hidden: true
}, {
dataIndex: 'Mainstate',
header: '合同货物状态',
renderer: function (value, p, record) {
if (value == null || value == '') return '';
else return record.data.MainStateRef;
},
editor: this.comboxMainstate,
width: 60
},
{
dataIndex: 'MainStateRef', hidden: true,
header: 'MainStateRef',
width: 80
}, {
dataIndex: 'Inspection_Storage',
header: '是否商检慢检',
renderer: function (value, p, record) {
if (value == null || value == '' || value == '0') return '否';
else return '是';
},
editor: this.comboxInspection_Storage,
width: 60
}, {
dataIndex: 'inspection_date',
header: '商检验货日期',
width: 110,
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
editor: {
xtype: 'datefield',
selectOnFocus: true
}
}, {
dataIndex: 'Unsealdate',
header: '商检放行日期',
width: 110,
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
editor: {
xtype: 'datefield',
selectOnFocus: true
}
},
//this.comboxInspection_Storage
{
dataIndex: 'SEQUENCE',
header: '序号',
width: 44,
hidden: true
}, {
dataIndex: 'Exporter',
header: '出口商',
width: 110
}, {
dataIndex: 'FactoryNo',
header: '厂号',
width: 80
}, {
dataIndex: 'name',
header: '产品描述(中文)',
width: 100
}, {
dataIndex: 'Ename',
header: '产品描述(英文)',
width: 100
}, {
dataIndex: 'CargoType',
header: '产品类型',
width: 50
}, {
dataIndex: 'SPECIFICATIONS',
header: '商品规格',
width: 100,
hidden: true
}, {
dataIndex: 'SBYS', hidden: true,
header: '申报要素',
width: 160
}, {
dataIndex: 'Unit',
header: '重量单位',
renderer: function (value, p, record) {
if (value == null || value == '') return '';
else return record.data.UnitRef;
},
width: 60,
hidden: true
}, {
dataIndex: 'currid',
header: '币别',
editor: this.comboxcurr,
width: 50,
hidden: true
}, {
dataIndex: 'Exchangerate',
header: '汇率_商务',
width: 75,
hidden: true
}, {
dataIndex: 'Exchangerate_Customs',
header: '汇率_海关',
width: 75,
hidden: true
}, {
dataIndex: 'U_PRICE', hidden: true,
header: '购货单价(重量单位)',
width: 90
}, {
dataIndex: 'U_weight',
header: '单据净重(重量单位)',
width: 80
}, {
dataIndex: 'price',
header: '购货单价(币别/kg)',
width: 90,
allowBlank: false,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 6, '', true);
return value;
}
}, {
dataIndex: 'WEIGHT_HT',
header: '合同净重(kg)',
width: 80,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 4, '', true);
return value;
}
}, {
dataIndex: 'BOXCOUNT_HT',
header: '合同件数',
width: 80
}, {
dataIndex: 'weight',
header: '单据净重(kg)',
width: 80,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
}, {
dataIndex: 'm_weight',
header: '毛重',
width: 50
}, {
dataIndex: 'BoxCount',
header: '单据件数',
width: 80,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
}, {
dataIndex: 'MOREORLESS',
header: '短装重量(kg)',
tooltip: '溢装填负值,短装填正值',
width: 80,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
},
renderer: function (value) {
if (parseFloat(value) > 0) {
return "<a><font color='#FF0000'>" + value + "</font></a>";
} else if (parseFloat(value) <= 0) {
return "<a><font color='#00FFFF'>" + value + "</font></a>";
} else {
return "";
}
}
}, {
dataIndex: 'KINDPKGS',
header: '包装',
width: 80,
editor: this.comboxKINDPKGS
}, {
dataIndex: 'WEIGHT_ACT',
header: '实际入库重量',
width: 80,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
}, {
dataIndex: 'BOXCOUNT_ACT',
header: '实际入库件数',
width: 80,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
}, {
dataIndex: 'WEIGHT_REMAIN',
header: '可售重量',
width: 80,
hidden: true
}, {
dataIndex: 'BOXCOUNT_REMAIN',
header: '可售件数',
width: 80,
hidden: true
}, {
dataIndex: 'BoxWeight', hidden: true,
header: '规格',
width: 50,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
}, {
dataIndex: 'price_agio',
header: '对客户卖价',
width: 50,
hidden: true
}, {
dataIndex: 'price_limit',
header: '海关限价',
width: 60,
hidden: true
}, {
dataIndex: 'Amount',
header: '合同金额',
width: 80
}, {
dataIndex: 'tax_Amount',
header: '完税价格',
width: 80,
hidden: true
}, {
dataIndex: 'baolv',
header: '保率',
width: 55,
hidden: true
}, {
dataIndex: 'pay_Amount',
header: '购货款$(对供应商)',
width: 120,
hidden: true
}, {
dataIndex: 'PreProportion',
header: '预付比例(%)',
width: 80,
hidden: true
}, {
dataIndex: 'prepayments',
header: '预付款(收客户)',
width: 80,
hidden: true
}, {
dataIndex: 'balance',
header: '尾款(收客户)',
width: 80,
hidden: true
}, {
dataIndex: 'pay_prepayments',
header: '预付款(付代理)',
width: 80,
hidden: true
}, {
dataIndex: 'pay_balance',
header: '尾款(付代理)',
width: 80,
hidden: true
}, {
dataIndex: 'AGENCRATE',
header: '付代理费率(元/吨)',
width: 80,
hidden: true
}, {
dataIndex: 'Paypart',
header: '付款方式', hidden: true,
renderer: function (value, p, record) {
if (value == null || value == '') return '';
else return record.data.paypartRef;
},
width: 50,
hidden: true
}, {
dataIndex: 'tariff',
header: '关税类型',
width: 80,
hidden: true
}, {
dataIndex: 'tax',
header: '关税税率',
width: 80,
hidden: true
}, {
dataIndex: 'tax_zz',
header: '增值税税率',
width: 80,
hidden: true
}, {
dataIndex: 'tax_1',
header: '关税(应收)',
width: 80,
hidden: true
}, {
dataIndex: 'tax_zz_1',
header: '增值税(应收)',
width: 80,
hidden: true
}, {
dataIndex: 'tax_2',
header: '关税(应付)',
width: 80,
hidden: true
},
{
dataIndex: 'tax_zz_2',
header: '增值税(应付)',
width: 80,
hidden: true
}, {
dataIndex: 'Productiondate_min',
header: '生产日期 起',
width: 110,
renderer: Ext.util.Format.dateRenderer('Y-m-d')
}, {
dataIndex: 'Productiondate_max',
header: '生产日期 止',
width: 110,
renderer: Ext.util.Format.dateRenderer('Y-m-d')
}, {
dataIndex: 'ExpirationDate',
header: '保质期',
width: 110,
renderer: Ext.util.Format.dateRenderer('Y-m-d')
}, {
dataIndex: 'Exchangerate_Cust',
header: '应收账单汇率',
width: 100,
hidden: true
}, {
dataIndex: 'AGENCRATE_Cust',
header: '应收代理费率',
width: 100,
hidden: true
},
{
dataIndex: 'BZTCHNO', hidden: true,
header: '批号',
width: 80,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
},
{
dataIndex: 'Declarenumber', hidden: true,
header: '报关单号',
width: 80,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
},
{
dataIndex: 'REMARK', hidden: true,
header: '备注',
width: 120,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
}
];
var _this = this;
this.cellEditingCargo = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});
this.cargoCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
_this = this;
this.formCargo = new Ext.grid.GridPanel({
store: this.storeCargo,
enableHdMenu: false,
layout: 'border',
region: 'center', //bodyStyle: 'background:#FFF',
trackResetOnLoad: true,
height: 320,
autoScroll: true,
title: '添加商品信息',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
plugins: [this.cellEditingCargo],
selModel: this.cargoCheckBoxModel,
selType: 'cellmodel',
tbar: [{
fieldLabel: '合同/箱号/提单号',
format: 'Y-m-d',
xtype: 'textfield',
name: 'HXT', id: "HXT", labelWidth: 110,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick_Import();
}
}
}
},
{
xtype: 'button',
width: 80,
text: "执行查询",
iconCls: "btnrefresh",
handler: function (button, event) {
_this.onRefreshClick_Import(button, event);
}
}
, '-',
{
text: '生成库存',
tooltip: '生成库存,锁定货物状态',
iconCls: "btnCargoLock", id: "CargoLock",
handler: function (button, event) {
//this.CargoLock(button, event);
//var formHead = this.formHead.getForm();
/*
var buyer = formHead.findField('buyer').getValue();
if (buyer == "") {
Ext.MessageBox.confirm('提示', '没有录入购货方,因此生成的库存信息将会缺少货主。确定吗?', function (btn) {
if (btn == 'yes') {
_this.winSTORAGEShow.show();
}
});
} else*/
this.winSTORAGEShow.show();
},
scope: this
}, {
text: '取消生成库存',
tooltip: '生成库存的反操作。注意:如果库存已被提取则无法成功,必须先删除库存取用信息。',
iconCls: "btnCargoUnLock", id: "CargoUnLock",
handler: function (button, event) {
this.CargoUnLock(button, event);
},
scope: this
}, '-', {
id: "btnSaveCargo",
text: '保存更改',
tooltip: '保存更改',
iconCls: "btnsave",
handler: function (button, event) {
this.SaveCargo();
//alert(USERID);
},
scope: this
}, '-', {
text: "保存列表样式",
id: "btnsavelist",
handler: function (button, event) {
var tempcolumns = this.formCargo.columns;
DsTruck.SaveGridPanel(USERID, _this.CargoListName, tempcolumns);
},
scope: this
}],
columns: this.CargoColumns
});
this.CargoColumns = DsTruck.GetGridPanel(USERID, this.CargoListName, this.CargoColumns);
//使用者id表名 中间column数组跳过一开始的几列
this.formCargo.reconfigure(this.storeCargo, this.CargoColumns);
this.cellEditingCargo.on('beforeedit', function (editor, e) {
return this.CargoBeforeEdit(editor, e);
}, this);
//#endregion
//公共按钮Toolbar:panelBtn
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [
{
// id: "saveandclose",
text: "保存",
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) {
this.Save('2');
},
scope: this
}, '-',
{
// id: "saveandclose",
text: "关闭",
handler: function (button, event) {
window.close();
},
scope: this
}, '-', {
text: "导出Excel",
id: "btnExportExcel",
iconCls: 'btnexportexcel',
handler: function (button, event) {
this.onExportClick(button, event);
},
scope: this
}, '-', {
text: "打印",
id: "btnprint",
iconCls: 'btnprint',
handler: function (button, event) {
this.onPrintClick(button, event);
},
scope: this
}, '-',
{
text: "费用入账",
id: "btnLock",
handler: function (button, event) {
this.LockWMS("1");
},
scope: this
}, {
text: "取消入账",
id: "btnUnLock",
handler: function (button, event) {
this.LockWMS("0");
},
scope: this
}
]
}); //end 按钮Toolbar
//#region 其他
this.panelFee = new Shipping.FeeEditGrid({
region: 'center',
layout: 'border'
});
this.panelFee.stroplb = 'WMSMAIN';
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" });
this.panelFee.StoreDrOpRange.load({ params: { optype: "modSeaiRecvFeeManagement"} });
this.panelFee.StoreCrOpRange.load({ params: { optype: "modSeaiPayFeeManagement"} });
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
//#region//布局
this.panelTop = new Ext.Panel({
//layout: "border",
region: "north",
height: 160,
//split: true,
items: [this.panelBtn, this.formEdit]
});
this.panelWMSINBody = new Ext.Panel({
//title: '应收费用',
layout: "border",
anchor: '100% 50%',
frame: true,
split: true,
items: [this.formWMSINBody]
});
this.panelWMSRATE = new Ext.tab.Panel({
//title: '费率区间',
layout: "border",
anchor: '100% 50%',
frame: true,
items: [this.formWMSRATE,
this.formCargo]
});
this.panelWMSIN = new Ext.Panel({
layout: "anchor",
region: 'center',
//split: true,
//height: 330,
//margin: '1 1',
items: [this.panelWMSINBody, this.panelWMSRATE]
});
this.page_1 = new Ext.Panel({
id: "page_1",
title: "入库信息/费率",
layout: "anchor",
region: 'center',
items: [this.panelWMSINBody, this.panelWMSRATE]
});
this.page_2 = new Ext.Panel({
id: "page_2",
autoScroll: true,
title: "入库相关应收应付费用",
items: [this.panelChFee
]
});
this.MainTab = new Ext.tab.Panel({
layout: "border",
region: "center", split: true,
items: [this.page_1, this.page_2//, this.page_3, this.page_4//,this.page_5
]
});
Ext.apply(this, {
items: [this.formCargo]
});
parentWin = window.parent.opener;
this.InitData();
//#endregion
//集中绑定事件
this.formWMSINBody.on('edit', function (editor, e, eOpts) {
this.WMSINAfterEdit(editor, e, eOpts);
}, this);
this.formCargo.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) {
//Ext.getCmp("zongshu").setText("1234");
return this.WMSINBeforeEdit(editor, e);
}, this);
//#region 锁定货物状态时的弹出窗口
this.storeSTORAGENAME = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
this.storeSTORAGENAME.load({ params: { condition: " ISWAREHOUSE=1 "} });
this.comboxSTORAGENAME = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '仓库名称',
store: this.storeSTORAGENAME,
allowBlank: false,
forceSelection: true,
name: 'STORAGENAME', id: "STORAGENAME",
valueField: 'CustName',
displayField: 'CodeAndName'
});
this.formSTORAGE = Ext.widget('form', {
frame: true,
region: 'center',
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 90,
msgTarget: 'qtip'
},
items: [
{
xtype: "label",
height: 20,
text: "请选择仓库:"
},
this.comboxSTORAGENAME
,
{
fieldLabel: '入库日期', id: "WMSDATE",
format: 'Y-m-d',
xtype: 'datefield',
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
name: 'WMSDATE',
listeners: {
change: function (field, eOpts) {
if (field.lastValue != "") {
//this.formHead.getForm().findField('STOCKDATE_1').setValue(field.rawValue);
}
},
scope: this
}
}]
});
me = this;
this.winSTORAGEShow = Ext.create('Ext.window.Window', {
title: "生成库存",
width: 450,
//height : 120,
//plain : true,
iconCls: "addicon",
resizable: false,
// 是否可以拖动
// draggable:false,
collapsible: true, // 允许缩放条
closeAction: 'close',
closable: true,
modal: 'true',
buttonAlign: "center",
bodyStyle: "padding:0 0 0 0",
items: [this.formSTORAGE],
buttons: [
{
text: "确定",
minWidth: 70,
handler: function () {
_this.CargoLock(Ext.getCmp("STORAGENAME").getValue(), Ext.getCmp("WMSDATE").getRawValue());
}
}, {
text: "取消",
minWidth: 70,
handler: function () {
me.winSTORAGEShow.close();
}
}]
});
//#endregion
}, //end initUIComponents
parentfunction: function (button, event) {
var ret1 = window.parent.opener.OprationSwap();
// alert(this.First);
ret1[3]();
OPLBNAME = ret1[4];
},
onAddWMSINClick: function (button, event, type) {
var store = null;
store = this.storeWMSIN;
var record = null;
var BSNO = "";
var CLIENTNAME = "";
var STORAGENAME = "";
var GOODSNAME = "";
var GOODSMODEL = "";
var GOODSSTANDARD = "";
var CHARGEUNIT = "";
/* data.CUSTOMERNAME = _this.parentRecord.get('CUSTOMERNAME');
data.BLNO = _this.parentRecord.get('MBLNO');
data.CUSTOMNO = _this.parentRecord.get('MBLNO');
data.CONTRACTNO = _this.parentRecord.get('CONTRACTNO');
data.ARCLIENT = _this.parentRecord.get('CUSTOMERNAME');*/
var data = this.formEdit.getForm().getValues();
if (this.OpStatus == "add") {
BSNO = "";
CLIENTNAME = data.CUSTOMERNAME;
STORAGENAME = "";
GOODSNAME = data.GOODSNAME;
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');
GOODSSTANDARD = this.editRecord.get('GOODSSTANDARD');
CHARGEUNIT = this.editRecord.get('CHARGEUNIT');
}
var newid = NewGuid();
record = Ext.create('WMSINmb', {
GID: newid,
ASSOCIATEDNO: "",
BLNO: "",
CONTRACTNO: "",
CTNALL: "",
CNTRNO: "",
SEALNO: "",
BSNO: BSNO,
CLIENTCODE: "",
CLIENTNAME: CLIENTNAME,
DODATE: "",
STORAGECODE: "",
STORAGENAME: STORAGENAME,
AREACODE: "",
AREANAME: "",
GOODSCODE: "",
GOODSNAME: GOODSNAME,
GOODSTYPE: "",
GOODSMODEL: GOODSMODEL,
GOODSSTANDARD: GOODSSTANDARD,
GOODSPACK: "0",
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: currdate.format('yyyy-MM-dd hh:mm:ss'),
MODIFIEDUSER: "",
MODIFIEDTIME: currdate.format('yyyy-MM-dd hh:mm:ss'),
REMARK: "",
CLIENTCODEOLD: "",
CLIENTNAMEOLD: "",
KINDPKGS: "",
ARFEE: "0",
APFEE: "0",
CORPID: COMPANYID,
GOODSTHICKNESS: "0",
GOODSWIDTH: "0",
GOODSLENGTH: "0",
GOODSSLICE: "0",
GOODSGRADE: "",
STACKLOCATION: "",
GOODSPACKACTUAL: "0",
GOODSRKSLACTUAL: "0",
ISCHANGE: "0",
MARKETVALUE: "0",
BANKVALUE: "0",
LINENUM: this.getLinenum()
});
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', currdate.format('yyyy-MM-dd'));
}
});
},
onDelWMSINClick: function (button, event, type) {
// var allow = this.getAllowOperationDetail();
// if (allow == false) {
// return;
// }
var feeGidSql = '';
var selectedRecords = [];
selectedRecords = this.CheckBoxModel.selected.items;
// var candelete = this.CheckChFeeDelete(selectedRecords, 1);
// if (candelete == false)
// return;
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.editRecord.get('ISLOCK') == "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]);
}
}
if (this.storeWMSIN.getCount() == 0) {
var form = this.formEdit.getForm();
form.findField('CONTRACTNO').setValue("");
}
}
}, this);
},
onAddWMSRATEClick: function (button, event, type) {
var store = null;
store = this.storeWMSRATE;
var record = null;
var newid = NewGuid();
record = Ext.create('WMSRATEmb', {
GID: newid,
CUSTOMERNAME: "",
FEETYPE: "0",
FEETYPEREF: "",
FEEGRADE: this.getLinenum2("1", newid),
FEESCALE: 0,
FEEPRICE: 0,
FEEUNIT: "",
CREATEUSER: USERID,
CREATETIME: currdate.format('yyyy-MM-dd hh:mm:ss'),
MODIFIEDUSER: SHOWNAME,
MODIFIEDTIME: currdate.format('yyyy-MM-dd hh:mm:ss'),
REMARK: "",
BSNO: "",
ADDPRICE: "0",
ENDBILLINGDATE: currdate.format('yyyy-MM-dd hh:mm:ss'),
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', "收");
}
});
},
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/WMS/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);
},
SaveRate: function (type) {
if (COMPANYID == "" || DEPTGID == "") {
alert("登录信息不全,请退出重新登录");
return;
}
var WMSRATEdatas = [];
for (var i = 0; i < this.storeWMSRATE.getCount(); i += 1) {
var member = this.storeWMSRATE.getAt(i);
WMSRATEdatas.push(member);
}
var WMSRATEBody = ConvertRecordsToJson(WMSRATEdatas);
var WMSRATEBodyDel = ConvertRecordsToJsonAll(this.WMSRATEBodyDel);
var data = this.formEdit.getForm().getValues();
var _this = this;
if ((WMSRATEBody + WMSRATEBodyDel) == "") {
return;
}
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/MvcShipping/WMS/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) {
//this.storeWMSRATE.commitChanges();
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
});
}
//alert('03');
}
});
},
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;
},
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.storeBodyChfee.remove(selectedRecords[i]);
}
}
}, this);
//aftereditform();
var Amount_ALL = 0;
// for (var i = 0; i < this.storeBodyChfee.getCount(); i += 1) {
// Amount_ALL = Add(Amount_ALL, parseFloat(this.storeBodyChfee.getAt(i).get("Amount")));
// }
},
WMSINAfterEdit: function (editor, e, eOpts) {
//需要自己实现里面的事件
if (COMPANYID == "" || DEPTGID == "") {
alert("登录信息不全,请退出重新登录");
returen;
}
if (e.field == 'GOODSPACK' || e.field == 'GOODSKGS' || e.field == 'GOODSTHICKNESS' || e.field == 'GOODSWIDTH' || e.field == 'GOODSLENGTH') {
if (e.record.get('CHARGEUNIT') == "吨" || e.record.get('CHARGEUNIT') == "千克") {
var GOODSPACKSTOCK = parseFloat(e.record.get('GOODSPACK'));
var GOODSKGS = parseFloat(e.record.get('GOODSKGS'));
var GOODSSTOCK = Mul(GOODSPACKSTOCK, GOODSKGS, 4);
if (GOODSSTOCK != 0) {
e.record.set('GOODSSTOCK', GOODSSTOCK); //量
e.record.set('GOODSRKSL', GOODSSTOCK);
e.record.set('GOODSPACKSTOCK', GOODSPACKSTOCK); //件数
}
}
else {
var GOODSPACKSTOCK = parseFloat(e.record.get('GOODSPACK'));
var GOODSSTOCK = Mul3(e.record.get('GOODSTHICKNESS'), e.record.get('GOODSWIDTH'), e.record.get('GOODSLENGTH'), 4);
e.record.set('GOODSSTOCK', GOODSSTOCK);
e.record.set('GOODSRKSL', GOODSSTOCK);
e.record.set('GOODSPACKSTOCK', GOODSPACKSTOCK);
e.record.set('GOODSSLICE', GOODSPACKSTOCK);
}
}
if (e.field == 'GOODSRKSL') {
var GOODSRKSL = e.record.get('GOODSRKSL');
e.record.set('GOODSSTOCK', GOODSRKSL);
//e.record.set('GOODSPACKSTOCK', GOODSRKSL);
}
if (e.field == 'CNTRNO' || e.field == 'SEALNO') {
var CTNrecodes = DsStoreQueryBy(this.storeCTN, e.field, e.value);
if (CTNrecodes.getCount() > 0) {
var CTNdata = CTNrecodes.getAt(0).data;
//e.record.set('app_id', appdata.app_id);
//alert(CTNdata.PKGS);KGS
e.record.set('GOODSSTOCK', CTNdata.KGS);
e.record.set('GOODSRKSL', CTNdata.KGS);
e.record.set('GOODSPACKSTOCK', CTNdata.PKGS);
e.record.set('GOODSSLICE', CTNdata.PKGS);
e.record.set('GOODSPACK', CTNdata.PKGS);
e.record.set('SEALNO', CTNdata.SEALNO);
e.record.set('CNTRNO', CTNdata.CNTRNO);
} else {
}
}
if (e.field == 'BOXCOUNT_ACT') {
var BoxCount = e.record.get('BoxCount');
var weight = e.record.get('weight');
var BOXCOUNT_ACT = e.record.get('BOXCOUNT_ACT');
if (parseFloat(BoxCount) > 0 && parseFloat(BOXCOUNT_ACT) > 0) {
var WEIGHT_ACT = Div(Mul(weight, BOXCOUNT_ACT), BoxCount)
e.record.set('WEIGHT_ACT', WEIGHT_ACT);
}
}
},
WMSINBeforeEdit: function (editor, e, eOpts) {
//需要自己实现里面的事件
if (COMPANYID == "" || DEPTGID == "") {
alert("登录信息不全,请退出重新登录");
returen;
}
},
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);
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', '');
}
}
},
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') + "'";
}
else {
//新建入库单,设定提单号等业务信息
}
/*
if (COMPANYID == "" || DEPTGID == "") {
alert("登录信息不全,请退出重新登录")
} else {
this.LoadData(this.OpStatus, condition);
}*/
var me = this;
Ext.Ajax.request({
waitMsg: '正在查询用户权限...',
url: '/CommMng/BasicDataRef/GetAuthorityRange',
params: {
modName: "modWmsList",
USERID: USERID
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
rec = result.data;
//alert(rec.VISIBLERANGE);
//alert(rec.OPERATERANGE);
//可操作为0则全都可见3为可提交/驳回,2为可审核/驳回1为只能看
/*0 审核通过
1 录入状态
2 提交审核
3 申请修改
4 申请删除
5 取消申请
6 驳回提交*/
this.VISIBLERANGE = rec.VISIBLERANGE;
this.OPERATERANGE = rec.OPERATERANGE;
//condition = me.getCondition(this.VISIBLERANGE);
if (this.OPERATERANGE == '0') {
} else
if (this.OPERATERANGE == '1') {
} else
if (this.OPERATERANGE == '2') {
//Ext.getCmp("add2").enable();
//Ext.getCmp("del2").enable();
} else {//3
//Ext.getCmp("add2").disable();
//Ext.getCmp("del2").disable();
}
this.LoadData(this.OpStatus, condition);
}
else
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
},
scope: this
}); //request over
}, //end InitData
//载入数据
LoadData: function (OpStatus, condition) {
if (COMPANYID == "" || DEPTGID == "") {
alert("登录信息不全,请退出重新登录");
return;
}
this.OpStatus = OpStatus;
var _this = this;
Ext.Ajax.request({
waitMsg: '正在查询主表数据...',
url: '/MvcShipping/WMS/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;
if (this.OpStatus == 'add' && this.OPLBNAME != "WMSMAIN") {
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 = currdate.format('yyyy-MM-dd hh:mm:ss');
data.WMSDATE = currdate.format('yyyy-MM-dd');
data.FREESTORAGEPERIOD = "0";
data.STARTBILLINGDATE = currdate.format('yyyy-MM-dd');
data.FREESTORAGEPERIODAP = "0";
data.STARTBILLINGDATEAP = currdate.format('yyyy-MM-dd');
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 = _this.parentRecord.get('UNITOFWEIGHT');
} else if (this.OpStatus == 'add') {
data.ASSOCIATEDNO = "";
data.CORPID = COMPANYID;
data.DEPTNAME = DEPTGID;
data.CUSTOMERNAME = "";
data.BLNO = "";
data.CUSTOMNO = "";
data.CONTRACTNO = "";
data.ARCLIENT = "";
data.GOODSNAME = "";
data.CREATEUSER = USERID;
data.CREATETIME = currdate.format('yyyy-MM-dd hh:mm:ss');
data.WMSDATE = currdate.format('yyyy-MM-dd');
data.FREESTORAGEPERIOD = "0";
data.STARTBILLINGDATE = currdate.format('yyyy-MM-dd');
data.FREESTORAGEPERIODAP = "0";
data.STARTBILLINGDATEAP = currdate.format('yyyy-MM-dd');
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 = "";
} else {
//123123
}
var basicForm = this.formEdit.getForm();
this.formEdit.getForm().setValues(data);
if (data.GID == "") { data.GID = "0" }
this.panelFee.WMSOUTBSNO = data.ASSOCIATEDNO;
this.panelFee.EditRecord = this.editRecord;
//this.panelFee.WMSOUTBSNO = data.GID;
this.panelFee.strBSNO = data.ASSOCIATEDNO;
this.panelFee.StoreDateCurr.load({ params: { optype: "op_Seai", bsno: data.ASSOCIATEDNO} });
this.panelFee.StoreUnit.load({ params: { bsno: data.ASSOCIATEDNO} });
this.panelFee.storeBodySum.load({ params: { bsno: data.ASSOCIATEDNO} });
//this.panelFee.storeDrChFee.load({ params: { billno: data.ASSOCIATEDNO, type: 1, optype: "op_Seai"} });
this.panelFee.LoadDrChFee2("bsno='" + data.ASSOCIATEDNO + "' and feetype=1 and isnull(wmsoutbsno,'')<>'' ");
//this.panelFee.storeCrChFee.load({ params: { billno: data.ASSOCIATEDNO, type: 2, optype: "op_Seai"} });
this.panelFee.LoadCrChFee2("bsno='" + data.ASSOCIATEDNO + "' and feetype=2 and isnull(wmsoutbsno,'')<>'' ");
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
}); //request over
if (this.OpStatus == 'edit') {
//this.formEdit.getForm().findField('BXGID').setDisabled(false);
var GID = this.editRecord.get('GID');
//this.storeWMSIN.load({ params: { }});
this.storeWMSIN.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: " ASSOCIATEDNO='" + GID + "'" },
waitMsg: "正在查询数据...",
scope: this
});
this.storeWMSRATE.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: " BSNO='" + GID + "'" },
waitMsg: "正在查询数据...",
scope: this
});
//this.formEdit.getForm().findField('HTH').readOnly=true;
//var CONTRACTNO = this.formEdit.getForm().findField('CONTRACTNO');
//Ext.getCmp("CONTRACTNO").getEl().dom.readOnly = false;
} else {
//this.storeCHEQUENUM.load({ params: { DEPTID: DEPTGID, BXGID: ""} });
}
if (this.OPLBNAME != "WMSMAIN") {
var BSNO = this.parentRecord.get('BSNO');
this.storeCTN.load({
params: { condition: " BSNO='" + BSNO + "' and CNTRNO not in(select distinct CNTRNO from wms_in where ISDELETE=0 and ASSOCIATEDNO='" + BSNO + "')" },
waitMsg: "正在查询数据...",
scope: this
});
}
}, // end LoadDate
checkedit: function (status) {
if (status != 1 && status != 2 && status != 6 && status != 0) {
alert("注意 录入状态/提交审核/驳回提交 的费用可以全部保存,审核通过的业务只保存支付信息 ");
return false;
} else
if (status == 0) {
alert("注意审核通过的业务只保存支付信息 ");
return true;
}
// else
// if (this.storeBodyChfee.getCount() == 0) { return true; }
// else {
// for (var i = 0; i < this.storeBodyChfee.getCount(); i += 1) {
// var CHFEE = this.storeBodyChfee.getAt(i).data;
// if (Add(parseFloat(CHFEE.NOTAXAMOUNT), parseFloat(CHFEE.TAX)) != CHFEE.Amount) {
// alert("不含税金额与税额之和与含税金额不相等");
// this.formFeeBody.selModel.select(i, true, false);
// return false;
// }
// } //end for
// return true;
// } //end if
},
Save: function (type) {
var basicForm = this.formEdit.getForm();
if (!basicForm.isValid()) {
return;
}
var data = this.formEdit.getForm().getValues();
if (data.ISLOCK == "True" || data.ISLOCK == "1") {
alert("已入账的入库信息不能进行修改")
return;
}
var data = this.formEdit.getForm().getValues();
if (data.ISCHANGE == "True") {
alert("来源于货权转移的入库信息不能进行修改。请修改相应的货转出库记录。")
return;
}
if (COMPANYID == "" || DEPTGID == "") {
alert("登录信息不全,请退出重新登录");
return;
}
var MARKETVALUE = 0;
var BANKVALUE = 0;
var WMSINdatas = [];
for (var i = 0; i < this.storeWMSIN.getCount(); i += 1) {
var member = this.storeWMSIN.getAt(i);
WMSINdatas.push(member);
MARKETVALUE = MARKETVALUE + parseFloat(member.data.MARKETVALUE);
BANKVALUE = BANKVALUE + parseFloat(member.data.BANKVALUE);
}
this.formEdit.getForm().findField('MARKETVALUE').setValue(MARKETVALUE);
this.formEdit.getForm().findField('BANKVALUE').setValue(BANKVALUE);
var WMSRATEdatas = [];
for (var i = 0; i < this.storeWMSRATE.getCount(); i += 1) {
var member = this.storeWMSRATE.getAt(i);
WMSRATEdatas.push(member);
}
var WMSINBody = ConvertRecordsToJson(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;
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'));
GOODSPACKACTUAL = GOODSPACKACTUAL + parseFloat(record.get('GOODSPACKACTUAL'));
GOODSRKSLACTUAL = GOODSRKSLACTUAL + parseFloat(record.get('GOODSRKSLACTUAL'));
MARKETVALUE = MARKETVALUE + parseFloat(record.get('MARKETVALUE'));
BANKVALUE = BANKVALUE + parseFloat(record.get('BANKVALUE'));
});
data.GOODSPACKSTOCK = GOODSPACKSTOCK;
data.GOODSSTOCK = GOODSSTOCK;
data.GOODSPACK = GOODSPACK;
data.GOODSRKSL = GOODSRKSL;
data.GOODSPACKACTUAL = GOODSPACKACTUAL;
data.GOODSRKSLACTUAL = GOODSRKSLACTUAL;
data.MARKETVALUE = MARKETVALUE;
data.BANKVALUE = BANKVALUE;
var _this = this;
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/MvcShipping/WMS/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) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
var returnData = jsonresult.Data;
this.formEdit.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('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.storeWMSIN.commitChanges();
//this.storePayBody.commitChanges();
if (type == '0') {
this.OpStatus = 'edit';
//basicForm.findField('Feeid').setDisabled(false);
//this.storeApp.load({ params: { condition: this.editRecord.get('ContractNo')} });
//this.storeCargo.load({ params: { condition: this.editRecord.get('ContractNo')} });
//basicForm.findField('Feeid').setDisabled(true);
var GID = _this.editRecord.get('GID');
this.storeWMSIN.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: " ASSOCIATEDNO='" + GID + "'" },
waitMsg: "正在查询数据...",
scope: this
});
this.storeWMSRATE.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: " BSNO='" + GID + "'" },
waitMsg: "正在查询数据...",
scope: this
});
} else if (type == '1') {//保存并关闭
window.close();
} else if (type == '2') {//保存并全部新建
this.LoadData('add', '');
}
} else {
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
} else {
Ext.Msg.show({ title: '请重试',
msg: '服务器响应出错',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
}
//alert('03');
}
});
var me = this;
if (this.editRecord.get('BXSTATUS') == "0") {
//var recordList = [];
//var BXGID = me.editRecord.get('BXGID');
Ext.Ajax.request({
waitMsg: "",
url: '/OA/Baoxiao/SetGZ',
scope: this,
async: true,
params: {
BXGID: BXGID
},
callback: function (_count) {
//return _count;
}
});
}
},
//end save
onExportClick: function (button, event) {
GridExportExcelPage(this.formFeeBody);
}
, DoPrint: function () {
var basicForm = this.formEdit.getForm();
var BXGID = this.editRecord.get('BXGID')
/*
if (ContractNo == '*' || ContractNo == '') {
Ext.Msg.show({ title: '错误', msg: '单据还没有保存,请保存后再打印', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
return;
}*/
function GetDateStr(AddDayCount) {
var dd = new Date();
dd.setDate(dd.getDate() + AddDayCount); //获取AddDayCount天后的日期
var y = dd.getFullYear();
var m = dd.getMonth() + 1; //获取当前月份的日期
var d = dd.getDate();
return y + "-" + m + "-" + d;
}
//alert(GetDateStr(+5));
var needdate = GetDateStr(+5);
var printdate = GetDateStr(0);
var _date = Ext.getCmp("CREATEDATE").getRawValue();
var printType = 'Baoxiao';
//
var sql1 = " select OA_Baoxiao.*,sd.deptname DN ";
var sql1 = sql1 + " from OA_Baoxiao left join [user] U on U.showname=OA_Baoxiao.createuser ";
var sql1 = sql1 + " left join [user_baseinfo] ub on ub.userid=u.gid ";
var sql1 = sql1 + " left join sys_dept sd on sd.gid=OA_Baoxiao.DEPTNAME ";
var sql1 = sql1 + " where BXGID='" + BXGID + "' ";
var sql2 = " select vs.mblno,vs.CUSTNO, c.* from ch_fee c ";
var sql2 = sql2 + " left join vw_settlement vs on vs.bsno=c.bsno ";
var sql2 = sql2 + " where BXGID ='" + BXGID + "' order by c.CHEQUENUM,c.remark";
var sql3 = "select createuser from oa_baoxiao where bxgid ='" + BXGID + "' ";
var sql4 = "select dbo.GetRemain_ZWC ('" + DEPTGID + "','" + _date + "')"; //获取该部门剩余资金
/*
var sql5 = " select * from (select * from vw_customerbalance ";
sql5 = sql5 + " union all ";
sql5 = sql5 + " select '',ic.gid,0,0,0,0,0,ic.SHORTNAME,'','','','',ic.CODENAME,0,0,0,0,0,null from info_client ic ";
sql5 = sql5 + " where gid not in(select customergid from Customer_Balance))tt ";
sql5 = sql5 + " where tt.customername in( ";
sql5 = sql5 + " select customername from ch_fee where BXGID='" + BXGID + "') ";
*/
var sql5 = " select * from (select * from vw_customerbalance where customername in( select customername from ch_fee where BXGID='" + BXGID;
sql5 = sql5 + "') and deptgid=( select deptname from oa_baoxiao where BXGID='" + BXGID + "') ";
sql5 = sql5 + " union all select '',ic.gid,0,0,0,0,0,ic.SHORTNAME,'','','','',ic.CODENAME,0,0,0,0,0,null from info_client ic ";
sql5 = sql5 + " where gid not in(select customergid from Customer_Balance) and shortname in( select customername from ch_fee where BXGID='" + BXGID + "') ";
sql5 = sql5 + " )tt ";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
}
, 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) {
if (Level == 1) {
return this.formEdit.getForm().findField('STARTBILLINGDATE').getValue();
}
else {
var lastlevel = "";
for (var i = 0; i < this.storeWMSRATE.getCount() - 1; 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"));
}
}
}
}
, setCBM: function (newValue, oldValue) {
if (newValue == oldValue)
{ return; } else {
//将store当中的所有CHARGEUNIT改为newvalue;
this.storeWMSIN.each(function (record) {
record.set('CHARGEUNIT', newValue);
});
var rec = Ext.getCmp("GOODSSTOCK_IN").setText("*库存量(" + newValue + ")"); ;
if (newValue == "吨" || newValue == "千克") {
Ext.getCmp("GOODSLENGTH").hide();
Ext.getCmp("GOODSTHICKNESS").hide();
Ext.getCmp("GOODSWIDTH").hide();
Ext.getCmp("GOODSKGS").show();
} else {
Ext.getCmp("GOODSLENGTH").show();
Ext.getCmp("GOODSTHICKNESS").show();
Ext.getCmp("GOODSWIDTH").show();
Ext.getCmp("GOODSKGS").hide();
}
/* if (this.OpStatus == 'edit') {
//this.formEdit.getForm().findField('BXGID').setDisabled(false);
var GID = this.editRecord.get('GID');
//this.storeWMSIN.load({ params: { }});
this.storeWMSIN.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: " ASSOCIATEDNO='" + GID + "'" },
waitMsg: "正在查询数据...",
scope: this
});
this.storeWMSRATE.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: " BSNO='" + GID + "'" },
waitMsg: "正在查询数据...",
scope: this
});
} else {
//this.storeCHEQUENUM.load({ params: { DEPTID: DEPTGID, BXGID: ""} });
}*/
}
}
,
LockWMS: function (Value) {
if (this.editRecord == null) {
alert("请先保存记录");
return;
}
if (this.editRecord.get('ISLOCK') == "True" && Value == "1") {
alert("已经入账,不能重复操作");
return;
}
if (this.editRecord.get('ISLOCK') == "False" && Value == "0") {
alert("目前没有入账,不能重复操作");
return;
}
var LockWMS = [];
Ext.MessageBox.confirm('提示', '确定要操作该入库信息吗?', function (btn) {
if (btn == 'yes') {
LockWMS.push(this.editRecord);
var LockWMSJSNO = ConvertRecordsToJsonAll(LockWMS);
var _this = this;
Ext.Ajax.request({//
waitMsg: '正在处理数据...',
url: '/MvcShipping/WMS/Lock',
params: {
data: LockWMSJSNO,
LOCK: 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);
} else {
_this.editRecord.set("ISLOCK", "False");
var data = this.formEdit.getForm().getValues();
data.ISLOCK = "False";
this.formEdit.getForm().setValues(data);
}
_this.editRecord.commit();
} else {
alert("操作失败" + jsonresult.Message);
}
},
scope: this
}); //request over
}
}, this);
} //onDeleteClick
,
onPrintClick: function (button, event) {
var printType = 'WmsInfoReport_opseai'; //海运进口 入库明细
var strBSNO = this.editRecord.get('GID');
var sql1 = " SELECT *,FULLNAME=(select top 1 [DESCRIPTION] from info_client where SHORTNAME=VW_WMS_IN.CUSTOMERNAME) ";
var sql1 = sql1 + " ,ARRATE=(select top 1 [ARRATE] from code_goods where GOODNAME=VW_WMS_IN.GOODSNAME) ";
var sql1 = sql1 + " ,APRATE=(select top 1 [APRATE] from code_goods where GOODNAME=VW_WMS_IN.GOODSNAME) ";
var sql1 = sql1 + " ,GOODSPACKACTUAL,GOODSRKSLACTUAL FROM VW_WMS_IN WHERE ASSOCIATEDNO='" + strBSNO + "' order by GOODSGRADE ";
var sql1 = sql1 + " ,GOODSLENGTH,GOODSSTANDARD,CREATETIME,LINENUM ";
var sql2 = " select * from op_seai where bsno=(select top 1 ASSOCIATEDNO FROM wms WHERE GID='" + strBSNO + "')";
var sql3 = " SELECT ctnall as 箱型,count(ctnall) as 箱量 FROM VW_WMS_IN WHERE ASSOCIATEDNO='" + strBSNO + "' group by ctnall ";
var sql4 = "";
var sql5 = " SELECT * FROM [info_client] WHERE SHORTNAME =(SELECT top 1 CUSTOMERNAME FROM VW_WMS_IN WHERE CUSTOMERNAME=info_client.SHORTNAME ";
var sql5 = sql5 + " and ASSOCIATEDNO='" + strBSNO + "') ";
var sql6 = " SELECT * FROM [info_client] WHERE SHORTNAME= ";
var sql6 = sql6 + " (SELECT top 1 STORAGENAME FROM VW_WMS_IN WHERE STORAGENAME=info_client.SHORTNAME and ASSOCIATEDNO='" + strBSNO + "') ";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
},
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 });
}
}
},
onRefreshClick_Import: function (button, event) {
var sql = this.getCondition();
if (sql != "") {
this.storeCargo.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: sql} });
}
},
getCondition: function () {
var form = this.formEdit.getForm();
//if (!form.isValid()) {
// Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
// return '';
//}
var sql = "";
var HTH = Ext.getCmp("HXT").getValue();
sql = sql + getAndConSql(sql, HTH, " (M.HTH like '%" + HTH + "%' or M.ContainerNo like '%" + HTH + "%' or M.Billno like '%" + HTH + "%') ");
return sql;
}
, CargoLock: function (STORAGENAME, WMSDATE) { //生成入库信息
//20160707 修改
//如无对应销售信息,货主为操作者的“本公司”
//如有对应销售信息,则首先判断销售重量是否大于等于实际入库重量。
//如剩余重量小于等于1kg则全部按销售重量和销售客户按比例生成。
//如剩余重量大于1kg则剩余部分按货主为操作者的“本公司”处理。
//20170203 修改
//改为在此处选择货主(货权拥有者的公司简称)
//如无则返回错误,不允许保存。
var selectedRecords = this.formCargo.selModel.getSelection();
var Cargodatas = [];
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (rec.data.ISLOCKED == "1") {
alert("注意,已经锁定的货物信息不可重复锁定");
} else
Cargodatas.push(rec);
}
if (Cargodatas == []) {
return;
}
//商品明细
var CargoBody = ConvertRecordsToJsonAll(Cargodatas);
//var CUSTOMERNAME = this.formHead.getForm().findField('buyer').getValue();
_this = this;
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/Import/ImportTrade/LockCargo2',
scope: this,
params: {
//CUSTOMERNAME: "北京二商大红门",
STORAGENAME: STORAGENAME,
WMSDATE: WMSDATE,
CargoBody: CargoBody
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
_this.winSTORAGEShow.close();
_this.onRefreshClick_Import();
} else {
Ext.Msg.show({ title: '请重试',
msg: '服务器响应出错',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
}
//alert('03');
}
});
}
, CargoUnLock: function (button, event) {
//如果相关库存信息已经“费用入账”
//则不允许进行解锁操作
var selections = this.formCargo.getSelectionModel().getSelection();
if (selections.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择商品!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var _L = selections.length;
_this = this;
Ext.MessageBox.confirm('提示', '确定解锁这' + _L + '条记录吗?', function (btn) {
if (btn == 'yes') {
//var record = selections[0];
for (var i = 0; i < _L; i++) {
var record = selections[i];
var CARGO_GID = record.data.GID;
//var sql = " CARGO_GID='" + CARGO_GID + "'";
Ext.Ajax.request({
waitMsg: '正在查询数据...',
url: '/Import/ImportTrade/GetLocked',
scope: this,
async: false,
params: { CARGO_GID: CARGO_GID },
waitMsg: "正在查询数据...",
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
var returnData = jsonresult.data;
//alert(returnData.Count);
this.ChfeeCount = parseInt(returnData.Count);
if (returnData > 0) {
alert("<" + record.data.name + ">的库存已经锁定,不能进行取消操作,请联系入库审核人员解锁该入库。");
return;
} else {
Ext.Msg.wait('正在删除数据...');
Ext.Ajax.request({
waitMsg: '正在删除数据...',
url: '/Import/ImportTrade/DeleteWMS',
params: {
CARGO_GID: CARGO_GID
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
_this.onRefreshClick_Import();
}
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
}
} else {
Ext.Msg.show({ title: '请重试',
msg: '服务器响应出错',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
return;
}
}
});
}
//this.storeList.remove(record);
//if (i >= _L ) {
// Ext.Msg.show({ title: '提示', msg: "数据删除结束", icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
//}
};
Ext.Msg.show({ title: '提示', msg: "数据处理结束", icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
this.onRefreshClick(button, event);
}, this);
}
,
SaveCargo: function (type) {
//费用
var bodyCargoDatas = [];
for (i = 0; i < this.storeCargo.getCount(); i += 1) {
var memberyf = this.storeCargo.getAt(i);
bodyCargoDatas.push(memberyf);
};
var jsonCargoDatas = ConvertRecordsToJson(bodyCargoDatas);
if (jsonCargoDatas == "") {
return;
}
_this = this;
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/Import/ImportTrade/SaveWMSCargo',
scope: this,
params: {
Cargobody: jsonCargoDatas
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
_this.onRefreshClick_Import();
} 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');
}
});
}
, CargoBeforeEdit: function (editor, e) {
var cargo_id = e.record.get('id');
if (cargo_id == '') { cargo_id = -1; }
var canedit = true;
if (e.field == 'WEIGHT_ACT' || e.field == "BOXCOUNT_ACT" || e.field == 'weight' || e.field == 'BoxCount') {
if (e.record.get('ISLOCKED') == "1") {
alert("已经生成库存,请不要修改商品信息的实际入库数据");
canedit = false;
}
}
return canedit;
}
});