You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

3007 lines
110 KiB
JavaScript

10 months ago
///<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_ImportTrade";
this.formname = "WMSIN_Import";
this.formname_RATE = "WMSINRATE_Import";
//#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: ""} });
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('');
}
}
}
}*/
});
Ext.regModel('PUTINTYPE', {
fields: [{ name: 'value' }, { name: 'text'}]
})
this.comboxPUTINTYPE = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '入库类型',
store: new Ext.data.Store({
model: 'PUTINTYPE',
data: [{ 'value': '入库', 'text': '入库' },
{ 'value': '倒柜', 'text': '倒柜' },
{ 'value': '直入客户名下', 'text': '直入客户名下' }]
}),
id: 'PUTINTYPE',
name: 'PUTINTYPE',
valueField: 'text',
displayField: 'text'
});
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: 'CARGO_GID',
hidden: true,
name: 'CARGO_GID'
}, {
fieldLabel: '入库单号', flex: 1,
name: 'WMSNO', id: "WMSNO"
}, {
fieldLabel: '合同号', flex: 1,
//labelWidth: 100,
name: 'CONTRACTNO', id: "CONTRACTNO"
}, this.comboxGOODSNAME
, {
fieldLabel: '进口国', flex: 1,
readOnly: true,
name: 'COUNTRY', id: "COUNTRY"
}, {
fieldLabel: '厂号', flex: 1,
readOnly: true,
name: 'FACTORYNO', id: "FACTORYNO"
}, {
fieldLabel: '箱号', flex: 1,
readOnly: true,
name: 'CNTRNO', id: "CNTRNO"
}
, {
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.comboxCustWmsCode,
{
fieldLabel: '库 位',
name: 'AREANAME',
id: "AREANAME"
}
]
}//container_1 end
,
{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
{
fieldLabel: '代理公司', flex: 1,
readOnly: true,
name: 'AGENT', id: "AGENT"
},
this.comboxCHARGEUNIT,
{
fieldLabel: '牌号', hidden: true,
name: 'GOODSMODEL',
id: "GOODSMODEL"
}, {
fieldLabel: '包装规格', hidden: true,
name: 'GOODSSTANDARD',
id: "GOODSSTANDARD"
}, this.comboxCustCode,
{
fieldLabel: '提单号', flex: 1,
name: 'BLNO', id: "BLNO"
},
{
fieldLabel: '报关单号', //hidden: true,
//readOnly: true,
name: 'CUSTOMNO',
id: "CUSTOMNO"
}, {
fieldLabel: '检疫证号', //hidden: true,
//labelWidth: 100,
name: 'CLIENTBSNO',
id: "CLIENTBSNO"
}, {
fieldLabel: '检疫证正本时间', //hidden: true,
labelWidth: 100,
xtype: "datefield",
name: 'CREATETIME',
flex:2,
id: "CREATETIME"
}, { fieldLabel: '销售员', //hidden: true,
readOnly: true,
name: 'SALER',
id: "SALER", flex: 1
}
]
},
{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
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: '应收开始计费日期',
flex:2,
labelWidth: 100,
format: 'Y-m-d',
xtype: 'datefield',
renderer: Ext.util.Format.dateRenderer('Y-m-d H:i:s')
}, {
fieldLabel: '溢短装',
readOnly: true,
name: 'Overfilled', id: "Overfilled", flex: 4
}, this.comboxPUTINTYPE
]
},
{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
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,
flex:2,
format: 'Y-m-d',
xtype: 'datefield',
renderer: Ext.util.Format.dateRenderer('Y-m-d H:i:s')
}, {
fieldLabel: '备注', flex: 4,
//labelWidth: 100,
name: 'REMARK'
}
, {
fieldLabel: '是否有入库回执', //hidden: true,
xtype: 'checkbox',
labelWidth: 100,
name: 'BZTCHNO',
id: "BZTCHNO"
}//, { xtype: 'hiddenfield', flex: 1 }
]
}
,
{
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: '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: 'CUSTNO', hidden: true,
name: 'CUSTNO',
id: "CUSTNO"
}, {
fieldLabel: 'GOODSRKSL', hidden: true,
name: 'GOODSRKSL',
id: "GOODSRKSL"
}, {
fieldLabel: 'GOODSSTOCK', hidden: true,
name: 'GOODSSTOCK',
id: "GOODSSTOCK"
}, {
fieldLabel: '市场货值', hidden: true,
name: 'MARKETVALUE',
id: "MARKETVALUE",
xtype: 'numberfield'
}, {
fieldLabel: '银行货值', hidden: true,
name: 'BANKVALUE',
id: "BANKVALUE",
xtype: 'numberfield'
}]
}
]
}
]
});
//#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({
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
}, '-', {
text: "保存列表样式",
id: "btntest",
handler: function (button, event) {
DsTruck.SaveGridPanel(USERID, this.formname, this.formWMSINBody.columns, this.columns, 0, true);
},
scope: this
}],
columns: this.columns
});
/////////////以下部分为获取存储的gridpanel显示样式
this.columns = DsTruck.GetGridPanel(USERID, this.formname, this.columns, 0, true);
//使用者id表名 中间column数组跳过一开始的几列
//this.columns.unshift(new Ext.grid.RowNumberer());
this.formWMSINBody.reconfigure(this.storeWMSIN, 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: "btnSaveRate",
text: '保存',
tooltip: '保存',
iconCls: "btnsave",
handler: function (button, event) {
this.SaveRate();
//alert(USERID);
},
scope: this
}, '-', {
text: "保存列表样式",
id: "btnRateSaveForm",
handler: function (button, event) {
DsTruck.SaveGridPanel(USERID, this.formname_RATE, this.formWMSRATE.columns, this.WMSRATEcolumn, 0, true);
},
scope: this
}],
columns: this.WMSRATEcolumn
});
/////////////以下部分为获取存储的gridpanel显示样式
this.WMSRATEcolumn = DsTruck.GetGridPanel(USERID, this.formname_RATE, this.WMSRATEcolumn, 0, true);
//使用者id表名 中间column数组跳过一开始的几列
//this.columns.unshift(new Ext.grid.RowNumberer());
this.formWMSRATE.reconfigure(this.storeWMSRATE, this.WMSRATEcolumn);
////////////////////////////
//#endregion
//公共按钮Toolbar:panelBtn
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [
{
id: "btnsave",
text: "保存",
handler: function (button, event) {
this.Save('0');
},
scope: this
}, {
id: "btnsaveandclose",
text: "保存并关闭",
handler: function (button, event) {
this.Save('1');
},
scope: this
},
{
id: "btnsaveandnew",
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: "提交费用入账申请", //hidden: true,
id: "btnLock",
handler: function (button, event) {
this.LockWMS("2");
},
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: 170,
//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.panelTop, this.MainTab]
});
parentWin = window.parent.opener;
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) {
//Ext.getCmp("zongshu").setText("1234");
return this.WMSINBeforeEdit(editor, e);
}, this);
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;
this.VISIBLERANGE = rec.VISIBLERANGE;
this.OPERATERANGE = rec.OPERATERANGE;
//this.setBtnEnable();
if (this.OPERATERANGE == "4") {
Ext.getCmp("btnSaveRate").diable();
Ext.getCmp("btnsave").diable();
Ext.getCmp("btnsaveandclose").diable();
Ext.getCmp("btnsaveandnew").diable();
} else {
Ext.getCmp("formML").enable();
Ext.getCmp("btnsave").enable();
Ext.getCmp("btnsaveandclose").enable();
Ext.getCmp("btnsaveandnew").enable();
}
}
else
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
},
scope: this
}); //request over
}, //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 {
}
}
},
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_Import',
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');
data.BZTCHNO = 0;
} 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();
if (data.BZTCHNO == "1" || data.BZTCHNO == "True") {
data.BZTCHNO = 1;
} else {
data.BZTCHNO = 0;
}
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" //|| data.ISLOCK == "2"
) {
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;
data.BZTCHNO = this.formEdit.getForm().findField('BZTCHNO').getValue() ? 1 : 0;
var _this = this;
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/MvcShipping/WMS/Save_Import',
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 = [];
//提交审核
if (Value == "2") {
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/SubmitAudit',
params: {
WMSList: LockWMSJSNO,
LOCK: Value
},
callback: function (options, success, response) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
alert(jsonresult.Message);
} else {
alert("操作失败" + jsonresult.Message);
}
var sql = this.getCondition();
this.storeList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
},
scope: this
}); //request over
}
}, this);
} else {
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 form = this.formEdit.getForm();
var CONTRACTNO = form.findField('CONTRACTNO').getValue();
if (CONTRACTNO != "") {
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;
}
});