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.

3283 lines
112 KiB
JavaScript

12 months ago
///<reference path="../../../../Views/../TruckMng/Scripts/vswd-ext_2.0.2.js" />
Ext.namespace('Shipping');
Shipping.WMSOUTEdit = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.WMSOUTEdit.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() {
if (panelEdit.formEdit.getForm().isDirty()== true )
{
return true;
}
else return false;
}
Ext.extend(Shipping.WMSOUTEdit, Ext.Panel, {
parentWin: null,
OpStatus: 'add',
StoreList: null,
editRecord: null,
EditRecord:null,//用来放置所属的业务,提供给费用模块
parentRecord: null,
WMSRecord:null,//用来放置货转出库操作生成的货转入库业务
WMSStatus: 'edit',
WMSList:null,
BXSTATUS: 1,
YWType:"PT",
_First: true,
VISIBLERANGE: 0,
OPERATERANGE: 0,
WorkFlowName: "",
WorkFlowID: "",
PageSize: 30,
WMS_formname: "",
WMSIN_formname: "",
WMSINDetail_formname: "",
FEECOUNT:0,
initUIComponents: function () {
this.feeSerialNo = 0;
this.WMSOUTDetailBodyDel = [];
//this.feeBodyUnUnion = [];
//this.PayBodyDel = [];
//枚举参照相关(编辑form)
WorkFlowName = 'WMSOUTmod';
//#region 所需的combox
//客户加载_委托单位
//仓储出库货主
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'
});
//委托单位
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 CUSTOMERNAME = records[0].data.CustName;
//alert(CUSTOMERNAME);
//Ext.getCmp("CUSTOMERNAME").setText("CUSTOMERNAME");
}
}
}
});
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: 'ARCLIENTWMSOUT',
name: 'ARCLIENTWMSOUT',
valueField: 'CustName',
displayField: 'CodeAndName',
labelWidth: 80
});
this.storePayCust = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
this.storePayCust=this.storeGainCust;
this.comboxPayCust = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '应付客户',
store: this.storePayCust,
forceSelection: true,
id: 'TRUCKNAME',
name: 'TRUCKNAME',
valueField: 'CustName',
displayField: 'CodeAndName',
labelWidth: 80
});
this.storeGainOUTCust = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
this.storeGainOUTCust=this.storeGainCust;
this.comboxGainOUTCust = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '应收出库客户',
store: this.storeGainOUTCust,
forceSelection: true,
id: 'ARCLIENT',
name: 'ARCLIENT',
valueField: 'CustName',
displayField: 'CodeAndName',
labelWidth: 80
});
this.storeNewCust = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
this.storeNewCust=this.storeGainCust;
this.comboxNewCust = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '货权转给',
store: this.storeGainOUTCust,
forceSelection: true,
id: 'CLIENTNAMEOLD',
name: 'CLIENTNAMEOLD',
valueField: 'CustName',
displayField: 'CodeAndName',
labelWidth: 64,
listeners: {
change: function (field, newValue, oldValue) {
if (newValue=="")
Ext.getCmp("ISCHANGE").setValue(false);
else Ext.getCmp("ISCHANGE").setValue(true);
//if (this.YWType=="HZ" && newValue=="")
// alert("请注意选择货转的目标客户!");
},
scope: this
}
});
var CHARGEUNITData = [{ "CHARGEUNIT": "吨" },
{ "CHARGEUNIT": "千克" },
{ "CHARGEUNIT": "立方"}];
this.storeCHARGEUNIT = Ext.create('Ext.data.Store', {
model: 'CHARGEUNITmb',
data: CHARGEUNITData
});
this.comboxCHARGEUNIT = Ext.create('DsExt.ux.RefEnumCombox', {
fieldLabel: '计费单位',
forceSelection: true,
store: this.storeCHARGEUNIT,
id: 'CHARGEUNIT',hidden:true,
name: 'CHARGEUNIT',
valueField: 'CHARGEUNIT',
displayField: 'CHARGEUNIT'
});
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
});
//#endregion
//////////////////
//编辑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,readOnly: true,
name: 'BSNO', id: "BSNO"
},
this.comboxCustCode,
{
fieldLabel: '提单号', flex: 2, //readOnly: true,
name: 'MBLNO', id: "MBLNO"
}, {
fieldLabel: '备案清单号',
name: 'CUSTOMNO',
id: "CUSTOMNO"
}, {
fieldLabel: '审批单号',
name: 'INSPECTIONNO',
id: "INSPECTIONNO"
}
]
}//container_1 end
,
{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxCustWmsCode,
{
name: 'DODATE', id: "DODATE",
fieldLabel: '出库日期',
format: 'Y-m-d',
xtype: 'datefield',
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
listeners: {
change: function (field, newValue, oldValue) {
Ext.getCmp("OLDCUSTFEEDATE").setRawValue(getAfterDATE(newValue, 0 + 1));
this.setDate(newValue);
},
scope: this
}
}, {
name: 'OLDCUSTFEEDATE', id: "OLDCUSTFEEDATE",
fieldLabel: '结束计费日期',
labelWidth: 80,
format: 'Y-m-d',
xtype: 'datefield',
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
listeners: {
change: function (field, newValue, oldValue) {
this.setDate(newValue);
},
scope: this
}
}, this.comboxGOODSNAME
, {
fieldLabel: '牌号/型号',
name: 'GOODSMODEL',
id: "GOODSMODEL"
}, {
fieldLabel: '批次号',
name: 'BZTCHNO',
id: "BZTCHNO"
}
]
},
{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxGainCust,
this.comboxGainOUTCust,
this.comboxPayCust,
this.comboxNewCust,{
xtype: 'checkbox', flex: 1,
fieldLabel: '货权转移',
name: 'ISCHANGE',id: "ISCHANGE"
}, {
fieldLabel: '转移的分提单号',
name: 'MBLNONEW', labelWidth: 90,
id: "MBLNONEW"
}
]
},
{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '客户仓单号',
name: 'CLIENTBSNO',
id: "CLIENTBSNO"
}, {
name: 'VALIDDATE', id: "VALIDDATE",
fieldLabel: '有效期',
labelWidth: 80,
format: 'Y-m-d',
xtype: 'datefield',
renderer: Ext.util.Format.dateRenderer('Y-m-d')
}, {
fieldLabel: '重量大写',
name: 'TOTALNO',
id: "TOTALNO"
}, {
fieldLabel: '备注1', flex: 3,
name: 'REMARK',
id: "REMARK"
}]
},
{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '备注2', flex: 5,
name: 'REMARK2',
id: "REMARK2"
}
, {
xtype: 'checkbox', flex: 1,
fieldLabel: '是否代收',
name: 'ISCOLLECTING'
}]
}
,
{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: 'CLIENTCODE', hidden: true,
name: 'CLIENTCODE',
id: "CLIENTCODE"
}, {
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: 'CORPID', hidden: true,
name: 'CORPID',
id: "CORPID"
}, {
fieldLabel: 'GOODSPACKACTUAL', hidden: true,
name: 'GOODSPACKACTUAL',
id: "GOODSPACKACTUAL"
}, {
fieldLabel: 'GOODSRKSLACTUAL', hidden: true,
name: 'GOODSRKSLACTUAL',
id: "GOODSRKSLACTUAL"
}, {
fieldLabel: 'GOODSRKSL', hidden: true,
name: 'GOODSRKSL',
id: "GOODSRKSL"
}, {
fieldLabel: 'GOODSSTOCK', hidden: true,
name: 'GOODSSTOCK',
id: "GOODSSTOCK"
}, {
fieldLabel: 'GOODSPACKPFSL', hidden: true,
name: 'GOODSPACKPFSL',
id: "GOODSPACKPFSL"
}, {
fieldLabel: 'INGIDNEW', hidden: true,
name: 'INGIDNEW',
id: "INGIDNEW"
}, this.comboxCHARGEUNIT
, {
fieldLabel: 'AREANAME', hidden: true,
name: 'AREANAME',
id: "AREANAME"
}]
}
]
}
]
});
//#region WMS
//定义数据集
this.storeWMS = Ext.create('Ext.data.Store', {
model: 'WMSmb',
remoteSort: false,
pageSize: this.PageSize,
proxy: {
type: 'ajax',
url: '/MvcShipping/WMS/GetDataList',
reader: {
idProperty: 'Feeid',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.WMS_formname = "WMS_forOUT"
this.storeWMS_OLD = Ext.create('Ext.data.Store', {
model: 'WMSmb',
remoteSort: false,
pageSize: this.PageSize,
proxy: {
type: 'ajax',
url: '/MvcShipping/WMS/GetDataList',
reader: {
idProperty: 'Feeid',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//this.InWorkFlow=false;
//枚举参照
this.WMScolumn = [{
dataIndex: 'GID', hidden: true,
header: '惟一编号',
width: 80
},
{
dataIndex: 'ISLOCK', hidden: true,
header: '是否入账',
width: 60,
renderer: function (value, cellmeta) {
if (value == 'True') {
return "<img src='../../../../TruckMng/Content/Images/Lock.png' />";
}
}
}, {
dataIndex: 'ISCHANGE',
header: '货转',
width: 35,
renderer: function (value, cellmeta) {
if (value == 'True') {
return "<img src='../../../../TruckMng/Content/Images/check.gif' />";
}
}
},
{
dataIndex: 'WMSNO',
header: '入库单号',
width: 110
},
{
dataIndex: 'WMSDATE',
header: '入库时间',
width: 80,
renderer: Ext.util.Format.dateRenderer('Y-m-d')
},
{
dataIndex: 'CUSTOMERNAME',
header: '客户名称',
width: 80
},
{
dataIndex: 'WMSOP',
header: '制表人',
width: 80
},
{
dataIndex: 'STOREMAN', hidden: true,
header: '保管人',
width: 80
},
{
dataIndex: 'CREATEUSER', hidden: true,
header: '创建人',
width: 80
},
{
dataIndex: 'CREATETIME', hidden: true,
header: '创建时间',
width: 80
},
{
dataIndex: 'MODIFIEDUSER', hidden: true,
header: '最后一次更新操作人',
width: 80
},
{
dataIndex: 'MODIFIEDTIME', hidden: true,
header: '最后一次更新操作时间',
width: 80
},
{
dataIndex: 'ISDELETE', hidden: true,
header: '是否废除',
width: 80
},
{
dataIndex: 'DELETEUSER', hidden: true,
header: '废除人',
width: 80
},
{
dataIndex: 'DELETETIME', hidden: true,
header: '废除时间',
width: 80
},
{
dataIndex: 'ARCLIENT', hidden: true,
header: '应收账款客户名称',
width: 80
},
{
dataIndex: 'TRUCKNAME', hidden: true,
header: '装卸队名称/应付账款客户名称',
width: 80
},
{
dataIndex: 'LOCKTIME', hidden: true,
header: '锁定时间',
width: 80
},
{
dataIndex: 'LOCKUSER', hidden: true,
header: '锁定操作人',
width: 80
},
{
dataIndex: 'GOODSNAME',
header: '货物名称/品名',
width: 80
},
{
dataIndex: 'GOODSMODEL', hidden: true,
header: '型号',
width: 80
},
{
dataIndex: 'CHARGEUNIT',
header: '计费单位',
width: 60
},
{
dataIndex: 'GOODSPACK',
header: '入库件数',
width: 80
},
{
dataIndex: 'GOODSPACKSTOCK',
header: '*剩余件数',
width: 80
},
{
dataIndex: 'GOODSRKSL',
header: '入库量',
width: 80
},
{
dataIndex: 'GOODSSTOCK',
header: '*库存量',
width: 80
},
{
dataIndex: 'ARFEE', hidden: true,
header: '应收账款',
width: 80
},
{
dataIndex: 'APFEE', hidden: true,
header: '应付账款',
width: 80
},
{
dataIndex: 'FREESTORAGEPERIOD', hidden: true,
header: '应收免仓储期',
width: 80
},
{
dataIndex: 'ASSOCIATEDNO', hidden: true,
header: '关联号',
width: 80
},
{
dataIndex: 'BLNO', hidden: true,
header: '提单号',
width: 80
},
{
dataIndex: 'CONTRACTNO', hidden: true,
header: '合同号',
width: 80
},
{
dataIndex: 'CLIENTCODEOLD', hidden: true,
header: '原客户编码',
width: 80
},
{
dataIndex: 'CLIENTNAMEOLD', hidden: true,
header: '原客户名称',
width: 80
},
{
dataIndex: 'STORAGENAME', hidden: true,
header: '仓库名称',
width: 80
},
{
dataIndex: 'CORPID', hidden: true, hidden: true,
header: '分公司代码',
width: 80
},
{
dataIndex: 'STARTBILLINGDATE',hidden: true,
header: '应收开始计费日',
width: 80,
renderer: Ext.util.Format.dateRenderer('Y-m-d')
},
{
dataIndex: 'STARTBILLINGDATEAP',hidden: true,
header: '应付开始计费日',
width: 80,
renderer: Ext.util.Format.dateRenderer('Y-m-d')
},
{
dataIndex: 'CUSTOMNO', hidden: true,
header: '备案清单号',
width: 80
},
{
dataIndex: 'CUSTNO', hidden: true,
header: '委托编号',
width: 80
},
{
dataIndex: 'GOODSSTANDARD',
header: '规格',
width: 80
},
{
dataIndex: 'GOODSPACKACTUAL',
header: '实际件数',
width: 80
},
{
dataIndex: 'GOODSRKSLACTUAL',
header: '实际数量',
width: 80
},
{
dataIndex: 'FREESTORAGEPERIODAP', hidden: true,
header: '应付免仓储期',
width: 80
},
{
dataIndex: 'AREANAME',
header: '库位名称',
width: 80
},
{
dataIndex: 'MARKETVALUE',
header: '市场货值',
width: 80
},
{
dataIndex: 'BANKVALUE',
header: '银行货值',
width: 80
},
{
dataIndex: 'BZTCHNO', hidden: true,
header: '批次号',
width: 80
},
{
dataIndex: 'CLIENTBSNO', hidden: true,
header: '不同客户的重复的出库单/客户出库仓单号',
width: 140
}];
//定义Grid
this.WMSCB = Ext.create('Ext.selection.CheckboxModel', { checkOnly: true });
Ext.grid.RowNumberer = Ext.extend(Ext.grid.RowNumberer, {
width: 45
});
this.WMSList = new Ext.grid.GridPanel({
region: 'north',
title: "当前库存货物(双击添加出库记录。注意,未入账或已提光的入库记录不再显示)",
store: this.storeWMS,
enableHdMenu: false,
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
stripeRows: true,
viewConfig: {
enableTextSelection: true
},
stateful: true,
selModel: this.WMSCB,
columns: [new Ext.grid.RowNumberer()]
});
/////////////以下部分为获取存储的gridpanel显示样式
this.WMScolumn = DsTruck.GetGridPanel(USERID, this.WMS_formname, this.WMScolumn, 1, true);
//使用者id表名 中间column数组跳过一开始的几列
this.WMScolumn.unshift(new Ext.grid.RowNumberer());
this.WMSList.reconfigure(this.storeWMS, this.WMScolumn);
this.WMSList.addListener('itemdblclick', function (dataview, record, item, index, e, b) {
this.SelectedRecord = record;
//alert(record.data.GID);
this.onAddWMSOUTDetailClick(record.data);
}, this);
//#endregion
//#region 编辑wms_out_detail
//数据集
this.storeWMSOUTDetail = Ext.create('Ext.data.Store', {
model: 'WMSOUTDetailmb',
pageSize: this.PageSize,
remoteSort: false,
pruneModifiedRecords: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/WMS/GetWMSOUTDetailList',
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'
});
//出库信息表格
this.WMSOUTDetailcolumns = [
{
sortable: true, hidden:true,
dataIndex: 'ASSOCIATEDNO',
header: 'ASSOCIATEDNO',
width: 125
},{
sortable: true,
dataIndex: 'i_BLNO',
header: '提单号',
width: 125
},{
sortable: true,
dataIndex: 'i_WMSDATE',
header: '入库时间',
width: 80
},
{
sortable: true,
dataIndex: 'i_CUSTOMERNAME',
header: '货主',
width: 80
},
{
sortable: true,
dataIndex: 'i_GOODSNAME',
header: '货名',
width: 80
},
{
sortable: true,
dataIndex: 'i_GOODSMODEL',
header: '牌号',
width: 80
},
{
sortable: true,
dataIndex: 'i_GOODSPACKSTOCK',
header: '库存件数',
width: 80 ,
summaryType: 'sum',
summaryRenderer: Ext.util.Format.numberRenderer('00.00')
},
{
sortable: true,
dataIndex: 'i_GOODSSTOCK',
header: '库存数量',
width: 80 ,
summaryType: 'sum',
summaryRenderer: Ext.util.Format.numberRenderer('00.00000')
},
{
sortable: true, hidden:true,
dataIndex: 'i_STARTBILLINGDATE',
header: '应收开始计费',
width: 80
},
{
sortable: true, hidden:true,
dataIndex: 'i_STARTBILLINGDATEAP',
header: '应付开始计费',
width: 80
},
{
sortable: true, hidden:true,
dataIndex: 'i_MARKETVALUE',
header: '市场货值',
width: 80 ,
summaryType: 'sum',
summaryRenderer: Ext.util.Format.numberRenderer('00.00')
},
{
sortable: true, hidden:true,
dataIndex: 'i_BANKVALUE',
header: '银行货值',
width: 80 ,
summaryType: 'sum',
summaryRenderer: Ext.util.Format.numberRenderer('00.00')
},
{
sortable: true, hidden: true,
dataIndex: 'i_ISDELETE',
header: 'i_ISDELETE',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'i_INBSNO',
header: 'i_INBSNO',
width: 80
} ,
{
dataIndex: 'GID', hidden: true,
header: '惟一编号',
width: 80
},
{
dataIndex: 'INBSNO', hidden: true,
header: 'INBSNO',
width: 80
},
{
dataIndex: 'OUTBSNO', hidden: true,
header: '出库单号',
width: 80
},
{
dataIndex: 'BSNO', hidden: true,
header: '仓单明细号',
width: 80
},
{
dataIndex: 'CLIENTGID', hidden: true,
header: '客户GID',
width: 80
},
{
dataIndex: 'CLIENTCODE', hidden: true,
header: '客户编码',
width: 80
},
{
dataIndex: 'CUSTOMERNAME', hidden: true,
header: '客户名称',
width: 80,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
},
{
dataIndex: 'DODATE', hidden: true,
header: '出库时间',
width: 80,
editor: {
xtype: 'datefield',
format: 'Y-m-d',
selectOnFocus: true
},
renderer: Ext.util.Format.dateRenderer('Y-m-d')
},
{
dataIndex: 'STORAGECODE', hidden: true,
header: '仓库编码',
width: 80,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
},
{
dataIndex: 'STORAGENAME', hidden: true,
header: '仓库名称',
width: 80,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
},
{
dataIndex: 'AREACODE', hidden: true,
header: '库位编码',
width: 80,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
},
{
dataIndex: 'AREANAME', hidden: true,
header: '库区名称',
width: 80,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
},
{
dataIndex: 'GOODSCODE',hidden: true,
header: '货物编号',
width: 80,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
},
{
dataIndex: 'GOODSNAME', hidden: true,
header: '货物名称/品名',
width: 80,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
},
{
dataIndex: 'GOODSTYPE',hidden: true,
header: '货物类型',
width: 80,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
},
{
dataIndex: 'GOODSMODEL',hidden: true,
header: '型号',
width: 80,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
},
{
dataIndex: 'GOODSSTANDARD',hidden: true,
header: '规格',
width: 80,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
},
{
dataIndex: 'GOODSPACK',hidden: true,
header: '包装',
width: 80,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
},
{
dataIndex: 'CHARGEUNIT',hidden: true,
header: '计费单位',
width: 80,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
},
{
dataIndex: 'GOODSPACKPFSL',
header: '出库件数',
width: 70,
editor: {
xtype: 'textfield',
selectOnFocus: true
},
summaryType: 'sum',
summaryRenderer: Ext.util.Format.numberRenderer('00.00')
},
{
dataIndex: 'GOODSPFSL',
header: '出库量',
width: 70,
editor: {
xtype: 'textfield',
selectOnFocus: true
},
summaryType: 'sum',
summaryRenderer: Ext.util.Format.numberRenderer('00.00')
},
{
dataIndex: 'GOODSOUTFEE',
header: '应收仓储费',
width: 70,
editor: {
xtype: 'textfield',
selectOnFocus: true
},
summaryType: 'sum',
summaryRenderer: Ext.util.Format.numberRenderer('00.00')
},
{
dataIndex: 'GOODSOUTFEEAP',
header: '应付仓储费',
width: 70,
editor: {
xtype: 'textfield',
selectOnFocus: true
},
summaryType: 'sum',
summaryRenderer: Ext.util.Format.numberRenderer('00.00')
},
{
dataIndex: 'TRUCKNO',
header: '车号',
width: 130,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
},
{
dataIndex: 'REMARK',
header: '备注',
width: 100,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
},
{
dataIndex: 'CREATEUSER', hidden: true,
header: '创建人',
width: 80,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
},
{
dataIndex: 'CREATETIME', hidden: true,
header: '创建时间',
width: 80,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
},
{
dataIndex: 'ASSOCIATEDNO', hidden: true,
header: '关联号',
width: 80,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
},
{
dataIndex: 'ARFEE',
header: '出库费应收',
width: 80,
editor: {
xtype: 'textfield',
selectOnFocus: true
},
summaryType: 'sum',
summaryRenderer: Ext.util.Format.numberRenderer('00.00')
},
{
dataIndex: 'APFEE',
header: '出库费应付',
width: 80,
editor: {
xtype: 'textfield',
selectOnFocus: true
},
summaryType: 'sum',
summaryRenderer: Ext.util.Format.numberRenderer('00.00')
},
{
dataIndex: 'ISLOCK', hidden: true,
header: '是否锁定',
width: 80,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
},
{
dataIndex: 'LOCKTIME', hidden: true,
header: '锁定时间',
width: 80,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
},
{
dataIndex: 'LOCKUSER', hidden: true,
header: '锁定操作人',
width: 80,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
},
{
dataIndex: 'CORPID', hidden: true,
header: '分公司代码',
width: 80,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
},
{
dataIndex: 'CLIENTNAMEOLD',hidden: true,
header: '转移对象',
width: 80
},
{
dataIndex: 'OLDCUSTFEEDATE',id: 'OLDCUSTFEEDATE_WOD', hidden: true,
header: '上家承担仓储期',
width: 80,
renderer: Ext.util.Format.dateRenderer('Y-m-d')
},
{
dataIndex: 'STARTBILLINGDATE',hidden: true,
header: '应收开始计费日',
width: 80,format: 'Y-m-d',
renderer: Ext.util.Format.dateRenderer('Y-m-d')
},
{
dataIndex: 'ENDBILLINGDATE',id: 'ENDBILLINGDATE_WOD', hidden: true,
header: '应收结束计费日',
width: 80,
renderer: Ext.util.Format.dateRenderer('Y-m-d')
},
{
dataIndex: 'FEEDAYS',
header: '应收计费天数',
width: 80
},
{
dataIndex: 'GOODSSLICE',hidden: true,
header: '片数/件',
width: 80,
editor: {
xtype: 'textfield',
selectOnFocus: true
},
summaryType: 'sum',
summaryRenderer: Ext.util.Format.numberRenderer('00.00')
},
{
dataIndex: 'GOODSGRADE', hidden: true,
header: '品名的等级',
width: 80,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
},
{
dataIndex: 'STARTBILLINGDATEAP',hidden: true,
header: '应付开始计费日',
width: 80,
editor: {
xtype: 'textfield',
selectOnFocus: true,
format: 'Y-m-d',
},
renderer: Ext.util.Format.dateRenderer('Y-m-d')
},
{
dataIndex: 'ENDBILLINGDATEAP',id: 'ENDBILLINGDATEAP_WOD', hidden: true,
header: '应付结束计费日',
width: 80,
editor: {
xtype: 'textfield',
selectOnFocus: true
},
renderer: Ext.util.Format.dateRenderer('Y-m-d')
},
{
dataIndex: 'FEEDAYSAP',
header: '应付计费天数',
width: 80,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
},
{
dataIndex: 'ISCHANGE', hidden: true,
header: '是否是货权转移',
width: 80,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
},
{
dataIndex: 'MARKETVALUE',hidden: true,
header: '市场货值_2',
width: 80,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
},
{
dataIndex: 'BZTCHNO',hidden: true,
header: '批次号',
width: 80,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
}];
this.CE_WOD = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});
this.CB_WOD = Ext.create('Ext.selection.CheckboxModel');
this.formWMSOUTDetail = new Ext.grid.GridPanel({
store: this.storeWMSOUTDetail,
enableHdMenu: false,
region: 'center',
split: true,
//title: '费用明细',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
plugins: [this.CE_WOD],
selModel: this.CB_WOD,
selType: 'cellmodel',
features: [{
ftype: 'summary'//Ext.grid.feature.Summary表格汇总特性
}],
tbar: [{ xtype: 'label', text: '出库信息',
style: 'font-size:18px',
labelColor: '#099',
x: '5%',
y: '5%'
}, /*{
text: '增加出库信息', id: "add1",
tooltip: '增加出库信息',
iconCls: "btnadddetail",
handler: function (button, event) {
this.onAddWMSOUTDetailClick(button, event);
},
scope: this
},*/{
text: '删除出库信息', id: "del1",
tooltip: '删除出库信息',
iconCls: "btndeletedetail",
handler: function (button, event) {
this.onDelWMSOUTDetailClick(button, event);
},
scope: this
}, '-', {
text: '生成应收',
tooltip: '根据出库单内的应收仓储费/出入库费生成对货主的应收费用',
iconCls: "btnCWStart", id: "CWStart_YS",
handler: function (button, event) {
this.MakeFee("应收");
},
scope: this
}, {
text: '生成应付',
tooltip: '根据出库单内的应付仓储费/出入库费生成对仓库的应付费用',
iconCls: "btnCWStart", id: "CWStart_YF",
handler: function (button, event) {
this.MakeFee("应付");
},
scope: this
}],
columns: this.WMSOUTDetailcolumns
});
////////////////////////////////////////////明细<<<< WMS_OUTDetail列表 >>>>结束
//#endregion
//#region 编辑wms_rate
this.storeWMSRATEDetail = Ext.create('Ext.data.Store', {
model: 'WMSRATEDetailmb',
pageSize: this.PageSize,
remoteSort: false,
pruneModifiedRecords: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/WMS/GetWMSRATEDetailList',
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": "付"}];
var storeFeeType = Ext.create('Ext.data.Store', {
model: 'FeeTypeMd',
data: FeeTypeData
});
this.comboxFeeTypeRef = Ext.create('DsExt.ux.RefEnumCombox', {
//fieldLabel: '收付类型',
store: storeFeeType,
name: 'FEETYPE',
valueField: 'FeeTypeID',
displayField: 'FeeTypeName'
});
this.WMSRATEDetailcolumn = [
{
dataIndex: 'GID', hidden: true,
header: '惟一编号',
width: 80
},
{
dataIndex: 'ASSOCIATEDNO', hidden: true,
header: '关联号',
width: 80
},
{
dataIndex: 'CUSTOMERNAME', hidden: true,
header: '客户名称',
width: 80,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
}, {
sortable: true,
dataIndex: 'FEETYPEREF',
header: '收付方向',
width: 80
},
{
sortable: true,
dataIndex: 'FEEGRADE',
header: '计费等级',
width: 80
},
{
dataIndex: 'STARTBILLINGDATE',
header: '开始计费日期',
width: 80,
renderer: Ext.util.Format.dateRenderer('Y-m-d')
},
{
dataIndex: 'ENDBILLINGDATE',
header: '结束计费日期',
width: 80,
renderer: Ext.util.Format.dateRenderer('Y-m-d')
},
{
dataIndex: 'FEESCALE',
header: '计费区间(天数)',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'FEEUNIT',
header: '计费单位',
width: 80
},
{
dataIndex: 'FEEPRICE',
header: '计费单价',
width: 80,
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;
}
},
{
dataIndex: 'GOODSPFSL',
header: '出库量',
width: 80
},
{
dataIndex: 'OUTFEE',
header: '仓储费',
width: 80
},
{
dataIndex: 'REMARK',
header: '备注',
width: 80,hidden:true
},
{
dataIndex: 'CREATEUSER',hidden:true,
header: '创建人',
width: 80
},
{
dataIndex: 'CREATETIME',
header: '创建时间',
width: 80,hidden:true
},
{
dataIndex: 'MODIFIEDUSER',
header: '最后一次操作人',
width: 80,hidden:true
},
{
dataIndex: 'MODIFIEDTIME',
header: '最后一次操作时',
width: 80,hidden:true
},
{
dataIndex: 'WMSOUTGID',
header: 'WMS_OUT的GID',
width: 80,hidden:true
}
];
this.CE_RD = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});
this.CBM_RD = Ext.create('Ext.selection.CheckboxModel');
this.formWMSRATEDetail = new Ext.grid.GridPanel({
store: this.storeWMSRATEDetail,
enableHdMenu: false,
layout: 'border',
region: 'south',
split: true,
height:200,
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
plugins: [this.CE_RD],
selModel: this.CBM_RD,
selType: 'cellmodel',
features: [{
ftype: 'summary'//Ext.grid.feature.Summary表格汇总特性
}],
tbar: [{ xtype: 'label', text: '仓储费用明细',
style: 'font-size:18px',
labelColor: '#0f0',
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.onDelFeeClick(button, event);
},
scope: this
},*/ '-'],
columns: this.WMSRATEDetailcolumn
});
//#endregion
//公共按钮Toolbar:panelBtn
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [
{
id: "btnsave",
text: "生成出库单(保存并生成仓储费明细)",
handler: function (button, event) {
this.Save('0');
},
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: "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.storebill = Ext.create('Ext.data.Store', {
model: 'MsSeai',
remoteSort: false,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsSeaiFee/GetBLData',
reader: {
id: 'GId',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//var condition = " BsNo='" + this.BSNO + "'";
// this.panelFee.StoreBill = this.storebill;
//this.panelFee.strBSNO = this.BSNO;
this.panelFee.stroplb = 'WMS';
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 formSearch
//#region combox
this.storeDEPT = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.DeptModel',
proxy: { url: '/CommMng/BasicDataRef/GetDeptList' }
});
this.storeDEPT.load({ params: { condition: ""} });
this.comboxDEPT = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '业务部门',
store: this.storeDEPT,
name: 'DeptName',
valueField: 'DeptName',
displayField: 'DeptName'
});
this.storeUser = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.UserRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetUserRefList' }
});
this.storeUser.load({ params: { condition: ""} });
this.comboxUser = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '库存操作人',
store: this.storeUser,
name: 'WMSOP',
valueField: 'UserName',
displayField: 'CodeAndName'
//, value: SHOWNAME
});
this.storeCustCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
this.storeCustCode.load();
//委托单位
this.comboxCustCode2 = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '货主',
store: this.storeCustCode,
forceSelection: true,
name: 'CUSTOMERNAME',
valueField: 'CustName',
displayField: 'CodeAndName',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
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',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
//#endregion
this.formSearch = Ext.widget('form', {
frame: true,
//height: 100,
region: 'north',
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 90,
msgTarget: 'qtip'
},
items:
[
{//fieldset 1
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
xtype: 'button',
//width: 90,
flex:0.5,
text: "执行查询",
iconCls: "btnrefresh",
handler: function (button, event) {
this.onRefreshClick(button, event);
},
scope: this
}, {
fieldLabel: '入库单号',
name: 'WMSNO',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '提单号',
name: 'MBLNO',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, this.comboxUser, this.comboxDEPT
, {
fieldLabel: '不包含货转入库',
xtype: 'checkbox',
name: 'ISCHANGE',
value:1,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}]
}]
}
, {//fieldset 1
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
{
xtype: 'button',
//width: 90,
flex:0.5,
text: "重置条件",
iconCls: "btnreset",
handler: function (button, event) {
this.onClearSql(button, event);
},
scope: this
},
this.comboxCustCode2
, {
fieldLabel: '货物名称',
name: 'GOODSNAME',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}
, this.comboxSTORAGENAME
, {
labelWidth: 100,
fieldLabel: '从..入库日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'WMSDATEbgn', flex: 1,
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}
, {
fieldLabel: '到..入库日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'WMSDATEend', flex: 1,
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}]
}]
}
,
{//fieldset 3
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
]
}]
}
,{//fieldset 5
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: []
} //end items(fieldset 5)
]//end root items
});
//#endregion formSearch
//#region 布局
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 170,
split: true,
items: [this.formSearch,this.panelBtn, this.formEdit
]
});
this.panelWMSOUTDetail = new Ext.Panel({
layout: "border",
region: 'center',
split: true,
height: 480,
margin: '1 1',
items: [/*this.WMSList,*/ this.formWMSOUTDetail,this.formWMSRATEDetail]
});
this.page_1 = new Ext.Panel({
id:"page_1",
title: "出库信息",
autoScroll: true,
//closable:true,
items: [this.panelWMSOUTDetail]
});
this.page_2 = new Ext.Panel({
id:"page_2",
autoScroll:true,
title: "出库相关应收应付费用",
items: [this.panelChFee
]
});
_this=this;
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
],
listeners: {
scope: this,
'beforetabchange': function (tabPanel, newCard, oldCard, eOpts) {
if (oldCard.id == "page_1") {
var BSNO = _this.panelFee.WMSOUTBSNO;
if (BSNO=="0"||BSNO=="") {
Ext.Msg.show({ title: '警告', msg: '出库单未保存,请先保存出库单!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
return false;
}
}
}
}
});
Ext.apply(this, {
items: [this.panelTop
, this.MainTab
]
});
//#endregion
parentWin = window.parent.opener;
this.InitData();
var me = this;
Ext.Ajax.request({
waitMsg: '正在查询用户权限...',
url: '/CommMng/BasicDataRef/GetAuthorityRange',
params: {
modName: "modWmsOutList",
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("btnsave").diable();
Ext.getCmp("btnLock").diable();
Ext.getCmp("btnUnLock").diable();
} else {
Ext.getCmp("btnsave").enable();
Ext.getCmp("btnLock").enable();
Ext.getCmp("btnUnLock").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]();
},
onAddWMSOUTClick: function (button, event, type) {
//var allow = this.getAllowOperationDetail();
//if (allow == false) {
// return;
//}
var store = null;
store = this.storeWMSOUTDetail;
//var newSerialno = this.GetHandleSerialNo(store, type);
var record = null;
record = Ext.create('WMSOUTDetailmb', {
GID: NewGuid(),
ASSOCIATEDNO: "",
BLNO: "",
CONTRACTNO: "",
CTNALL: "",
CNTRNO: "",
SEALNO: "",
BSNO: this.editRecord.get('WMSNO'),
CLIENTCODE: "",
CLIENTNAME: this.editRecord.get('CUSTOMERNAME'),
DODATE: currdate.format('yyyy-MM-dd'),
STORAGECODE: "",
STORAGENAME: this.editRecord.get('STORAGENAME'),
AREACODE: "",
AREANAME: "",
GOODSCODE: "",
GOODSNAME: this.editRecord.get('GOODSNAME'),
GOODSTYPE: "",
GOODSMODEL: this.editRecord.get('GOODSMODEL'),
GOODSSTANDARD: this.editRecord.get('GOODSSTANDARD'),
GOODSPACK: "0",
GOODSPACKSTOCK: "0",
GOODSKGS: "0",
CHARGEUNIT: this.editRecord.get('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 });
},
onDelWMSOUTDetailClick: function (button, event, type) {
// var allow = this.getAllowOperationDetail();
// if (allow == false) {
// return;
// }
var feeGidSql = '';
var selectedRecords = [];
selectedRecords = this.CB_WOD.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 (selectedRecords.length > 0) {
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (rec.data.OUTBSNO != "") //如果是新增但没有保存的数据,没有必要提交到后台
{
this.WMSOUTDetailBodyDel.push(rec);
}
this.storeWMSOUTDetail.remove(selectedRecords[i]);
}
}
}
}, this);
},
onAddWMSOUTDetailClick: function (WMS) {
var store = null;
store = this.storeWMSOUTDetail;
var record = null;
var canadd = true;
this.storeWMSOUTDetail.each(function (record) {
if (record.get('INBSNO') == WMS.GID) {
canadd = false;
}
});
if (canadd != true) return;
//alert(this.parentRecord.get('BSNO'));
var data = this.formEdit.getForm().getValues();
record = Ext.create('WMSOUTDetailmb', {
GID: "",
INBSNO: WMS.GID,
OUTBSNO: "",
BSNO: "",
CLIENTGID: "",
CLIENTCODE: "",
CUSTOMERNAME: "",
DODATE: data.OLDCUSTFEEDATE,
STORAGECODE: "",
STORAGENAME: "",
AREACODE: "",
AREANAME: "",
GOODSCODE: "",
GOODSNAME: WMS.GOODSNAME,
GOODSTYPE: "",
GOODSMODEL: "",
GOODSSTANDARD: "",
GOODSPACK: "",
CHARGEUNIT: WMS.CHARGEUNIT,
GOODSPFSL: WMS.GOODSSTOCK,
GOODSPACKPFSL: WMS.GOODSPACKSTOCK,
GOODSOUTFEE: "0",
GOODSOUTFEEAP: "0",
TRUCKNO: "",
REMARK: "",
CREATEUSER: "",
CREATETIME: currdate.format('yyyy-MM-dd hh:mm:ss'),
ASSOCIATEDNO: this.parentRecord.get('BSNO'),
ARFEE: "0",
APFEE: "0",
ISLOCK: "0",
LOCKTIME: "1900-1-1",
LOCKUSER: "",
CORPID: "",
CLIENTNAMEOLD: data.CLIENTNAMEOLD,
OLDCUSTFEEDATE: data.OLDCUSTFEEDATE,
STARTBILLINGDATE: WMS.i_STARTBILLINGDATE,
ENDBILLINGDATE: data.OLDCUSTFEEDATE,
FEEDAYS: "",
GOODSSLICE: "0",
GOODSGRADE: "",
STARTBILLINGDATEAP: WMS.STARTBILLINGDATEAP,
ENDBILLINGDATEAP: data.OLDCUSTFEEDATE,
FEEDAYSAP: "",
ISCHANGE: "",
MARKETVALUE: "0",
BZTCHNO: ""
});
store.add(record);
record.set('GID', NewGuid());
cellediting = this.CE_WOD;
var n = store.getCount();
cellediting.startEditByPosition({ row: n - 1, column: 2 });
//将库房//id: STORAGENAME和货主 //id: CUSTOMERNAME,带到wms_out的formedit
/*
Ext.getCmp("STORAGENAME").setRawValue(WMS.STORAGENAME);
Ext.getCmp("CUSTOMERNAME").setRawValue(WMS.CUSTOMERNAME);
Ext.getCmp("ARCLIENTWMSOUT").setRawValue(WMS.CUSTOMERNAME);
*/
var WMSSQL = " ASSOCIATEDNO='" + WMS.ASSOCIATEDNO + "' and isnull(ISDELETE,0)=0 and isnull(ISLOCK,0)=1 and GOODSPACKSTOCK<>0 and GOODSSTOCK>0 and customername='" + WMS.CUSTOMERNAME + "' ";
this.storeWMS.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: WMSSQL },
waitMsg: "正在查询数据...",
scope: this
});
},
getLinenum: function (button, event) {
var _L = 0;
for (var i = 0; i < this.storeWMSOUTDetail.getCount(); i++) {
var _t = this.storeWMSOUTDetail.getAt(i).get("LINENUM");
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")));
// }
},
WMSOUTDetailAfterEdit: function (editor, e, eOpts) {
//需要自己实现里面的事件
if (COMPANYID == "" || DEPTGID == "") {
alert("登录信息不全,请退出重新登录");
returen;
}
//将库房//id: STORAGENAME和货主 //id: CUSTOMERNAME,带到wms_out的formedit
/*
Ext.getCmp("STORAGENAME").setRawValue(e.record.get('STORAGENAME'));
Ext.getCmp("CUSTOMERNAME").setRawValue(e.record.get('i_CUSTOMERNAME'));
Ext.getCmp("ARCLIENTWMSOUT").setRawValue(e.record.get('i_CUSTOMERNAME'));
*/
if (e.value==e.originalValue){return;}
//修改出库数量 件数时更改
var data = this.formEdit.getForm().getValues();
e.record.set('DODATE', data.OLDCUSTFEEDATE);
if (e.record.get('CREATEUSER')==""){
e.record.set('CREATEUSER', USERID);
e.record.set('CREATETIME', currdate.format('yyyy-MM-dd hh:mm:ss'));
}
e.record.set('CLIENTNAMEOLD', data.CLIENTNAMEOLD);
e.record.set('OLDCUSTFEEDATE', data.OLDCUSTFEEDATE);
e.record.set('ENDBILLINGDATE', data.OLDCUSTFEEDATE);
e.record.set('ENDBILLINGDATEAP', data.OLDCUSTFEEDATE);
if (e.record.get('GID')==""){
e.record.set('GID', NewGuid());
}
//移除其他货主的
/*
var WMSSQL = " ASSOCIATEDNO='" + WMS.ASSOCIATEDNO + "' and isnull(ISDELETE,0)=0 and isnull(ISLOCK,0)=1 and GOODSPACKSTOCK<>0 and GOODSSTOCK>0 and customername='" + WMS.CUSTOMERNAME + "' ";
this.storeWMS.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: WMSSQL },
waitMsg: "正在查询数据...",
scope: this
});*/
},
WMSOUTDetailBeforeEdit: function (editor, e, eOpts) {
//需要自己实现里面的事件
if (COMPANYID == "" || DEPTGID == "") {
alert("登录信息不全,请退出重新登录");
returen;
}
},
InitData: function () {
this.OpStatus = 'add';
var condition = '';
//var Detail = '';
if (parentWin) {
var ret = parentWin.OprationSwap();
this.OpStatus = ret[0];
this.StoreList = ret[1];
this.editRecord = ret[2];
this.parentRecord = ret[3];
this.EditRecord = ret[3];//业务数据 给费用模块
this.YWType = ret[4];
this.OPLBNAME = ret[5];
}
if (this.OpStatus == 'edit' && this.OPLBNAME!="WMSOUTMAIN") {
condition = " BSNO='" + this.editRecord.get('BSNO') + "'";
//alert(this.editRecord.get('BSNO'));
}
else if (this.OpStatus == 'edit') {
condition = " BSNO='" + this.editRecord.get('BSNO') + "'";
//alert(this.editRecord.get('BSNO'));
}
if (this.OpStatus == 'add' && this.OPLBNAME!="WMSOUTMAIN") {
condition = " BSNO='" + this.parentRecord.get('BSNO') + "'";
//alert(this.editRecord.get('BSNO'));
}
/*
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
//如果是普通业务
if (this.YWType=="PT"){
Ext.getCmp("CLIENTNAMEOLD").allowBlank = true;
Ext.getCmp("CLIENTNAMEOLD").readOnly = true;
Ext.getCmp("ISCHANGE").setValue(false);
Ext.getCmp("ISCHANGE").readOnly = true;
}else{
//如果是货转
if (this.OpStatus!='add'){
Ext.getCmp("CLIENTNAMEOLD").readOnly = true;
}
Ext.getCmp("CLIENTNAMEOLD").allowBlank = false;
Ext.getCmp("ISCHANGE").setValue(true);
Ext.getCmp("ISCHANGE").readOnly = true;
}
if (this.OPLBNAME != "WMSOUTMAIN") {
//this.formSearch.hidden = true;
this.formSearch.hide();
this.panelTop.height = 170;
} else {
this.formSearch.show();
this.panelTop.height = 240;
}
}, //end InitData
//载入数据
LoadData: function (OpStatus, condition) {
if (COMPANYID == "" || DEPTGID == "") {
alert("登录信息不全,请退出重新登录");
return;
}
this.OpStatus = OpStatus;
_this = this;
Ext.Ajax.request({
waitMsg: '正在查询主表数据...',
url: '/MvcShipping/WMS/GetWMSOUTData',
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!="WMSOUTMAIN") {
data.ASSOCIATEDNO = _this.parentRecord.get('BSNO');
data.COMPANY = COMPANYID;
data.DEPTNAME = DEPTGID;
data.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.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 = "1900-01-01";
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.DODATE = currdate.format('yyyy-MM-dd');
data.OLDCUSTFEEDATE= currdate.format('yyyy-MM-dd');
//var WMSSQL = " ASSOCIATEDNO='" + _this.parentRecord.get('BSNO') + "' and isnull(ISDELETE,0)=0 and isnull(ISLOCK,0)=1 and GOODSPACKSTOCK<>0 and GOODSSTOCK>0 ";
WMSOUTBSNO = "";//this.editRecord.get('BSNO') ;
//ASSOCIATEDNO = "";
this.storeWMSOUTDetail.load({
params: { start: 0, limit: this.PageSize, sort: '', WMSOUTBSNO: WMSOUTBSNO, ASSOCIATEDNO:_this.parentRecord.get('BSNO'),condition:"",ONLYINWMSOUT:"" },
waitMsg: "正在查询数据...",
scope: this
});
}
else if (this.OpStatus == 'add' && this.OPLBNAME=="WMSOUTMAIN") {
data.ASSOCIATEDNO = "";
data.BLNO = "";
data.COMPANY = COMPANYID;
data.DEPTNAME = DEPTGID;
data.CUSTOMERNAME = "";
data.BLNO = "";
data.CUSTOMNO = "";
data.CONTRACTNO = "";
data.ARCLIENT = "";
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 = "1900-01-01";
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.DODATE = currdate.format('yyyy-MM-dd');
data.OLDCUSTFEEDATE= currdate.format('yyyy-MM-dd');
/*
});*/
}
else if (this.OpStatus == 'edit' && this.OPLBNAME=="WMSOUTMAIN")
{
WMSOUTBSNO = this.editRecord.get('BSNO') ;
ASSOCIATEDNO = "";
this.storeWMSOUTDetail.load({
params: { start: 0, limit: this.PageSize, sort: '', WMSOUTBSNO: WMSOUTBSNO, ASSOCIATEDNO:ASSOCIATEDNO,condition:" ASSOCIATEDNO=GID ",ONLYINWMSOUT:"True" },
waitMsg: "正在查询数据...",
scope: this
});
var RD_condition=" ASSOCIATEDNO in (select gid from wms_out_detail where OUTBSNO='" + data.BSNO + "')";
this.storeWMSRATEDetail.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: RD_condition },
waitMsg: "正在查询数据...",
scope: this
});
}
else {
//编辑页面 不许修改货主名称
this.comboxCustCode.readOnly = true;
//只能
var WMSSQL = " ASSOCIATEDNO='" + _this.editRecord.get('BSNO') + "' and isnull(ISDELETE,0)=0 and isnull(ISLOCK,0)=1 and GOODSPACKSTOCK<>0 and GOODSSTOCK>0 and customername='" + data.CUSTOMERNAME + "' ";
this.storeWMS.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: WMSSQL },
waitMsg: "正在查询数据...",
scope: this
});
this.storeWMSOUTDetail.load({
params: { start: 0, limit: this.PageSize, sort: '', WMSOUTBSNO: data.BSNO, ASSOCIATEDNO:data.ASSOCIATEDNO },
waitMsg: "正在查询数据...",
scope: this
});
var RD_condition=" ASSOCIATEDNO in (select gid from wms_out_detail where OUTBSNO='" + data.BSNO + "')";
this.storeWMSRATEDetail.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: RD_condition },
waitMsg: "正在查询数据...",
scope: this
});
}
if (data.ISCOLLECTING == 'True') {
data.ISCOLLECTING = '1';
} else { data.ISCOLLECTING = '0' };
if (data.ISCHANGE == 'True') {
data.ISCHANGE = '1';
} else { data.ISCHANGE = '0' };
var basicForm = this.formEdit.getForm();
this.formEdit.getForm().setValues(data);
if (data.GID==""){data.GID="0"}
this.panelFee.WMSOUTBSNO = data.GID;
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(" WMSOUTBSNO='"+data.GID+"' and feetype=1 ");
//this.panelFee.storeCrChFee.load({ params: { billno: data.ASSOCIATEDNO, type: 2, optype: "op_Seai"} });
this.panelFee.LoadCrChFee2(" WMSOUTBSNO='"+data.GID+"' and feetype=2 ");
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
}); //request over
}, // end LoadDate
checkedit: function (status) {
if (status != 1 && status != 2 && status != 6 && status != 0) {
alert("注意 录入状态/提交审核/驳回提交 的费用可以全部保存,审核通过的业务只保存支付信息 ");
return false;
} else
if (status == 0) {
alert("注意审核通过的业务只保存支付信息 ");
return true;
}
// 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();
var data = this.formEdit.getForm().getValues();
if (data.CLIENTNAMEOLD=="" && this.YWType=="HZ"){
alert("请注意选择货转的目标客户!");
return;
}
var i_CUSTOMERNAME="";
var STORAGENAME="";
var CORPID="";
var GOODSNAME="";
var CHARGEUNIT="";
var AREANAME="";
//selectedRecords = this.gridListChFee.selModel.getSelection();
for (var i = 0; i < this.storeWMSOUTDetail.getCount(); i += 1) {
var rec = this.storeWMSOUTDetail.getAt(i);
if (i_CUSTOMERNAME == "" && (rec.get('GOODSPACKPFSL')!=0||rec.get('GOODSPFSL')!=0))
{
i_CUSTOMERNAME = rec.get('i_CUSTOMERNAME') ;
STORAGENAME=rec.get('STORAGENAME');
//CORPID=rec.get('CORPID');
//AREANAME=rec.get('AREANAME');
//GOODSNAME=rec.get('GOODSNAME');
//CHARGEUNIT=rec.get('CHARGEUNIT');
if (GOODSNAME==""){
GOODSNAME=rec.get('GOODSNAME');
}else
if (GOODSNAME.indexOf(rec.get('GOODSNAME'))>0){
//已有
}else
{
//未有
GOODSNAME=GOODSNAME+","+rec.get('GOODSNAME');
}
}
if ((i_CUSTOMERNAME != rec.get('i_CUSTOMERNAME'))&&(rec.get('GOODSPACKPFSL')!=0||rec.get('GOODSPFSL')!=0)) {
alert("不能出库属于多个货主的库存");
return false;
}
if ((STORAGENAME != rec.get('STORAGENAME'))&& STORAGENAME!="") {
alert("不能一次出库同时属于多个仓库的库存");
return false;
}
CORPID=rec.get('CORPID');
AREANAME=rec.get('AREANAME');
CHARGEUNIT=rec.get('CHARGEUNIT');
}
if (this.OpStatus == 'add')
{
Ext.getCmp("STORAGENAME").setRawValue(STORAGENAME);
//if (Ext.getCmp("CUSTOMERNAME").getRawValue=="")
// Ext.getCmp("CUSTOMERNAME").setRawValue(i_CUSTOMERNAME);
Ext.getCmp("CUSTOMERNAME").setRawValue(i_CUSTOMERNAME);
if (Ext.getCmp("ARCLIENTWMSOUT").getRawValue==""){
Ext.getCmp("ARCLIENTWMSOUT").setRawValue(i_CUSTOMERNAME);
data.ARCLIENTWMSOUT=i_CUSTOMERNAME;
}
Ext.getCmp("AREANAME").setRawValue(AREANAME);
Ext.getCmp("GOODSNAME").setRawValue(GOODSNAME);
Ext.getCmp("CHARGEUNIT").setRawValue(CHARGEUNIT);
data.STORAGENAME=STORAGENAME;
data.CUSTOMERNAME=i_CUSTOMERNAME;
data.AREANAME=AREANAME;
data.GOODSNAME=GOODSNAME;
data.CHARGEUNIT=CHARGEUNIT;
data.CORPID=CORPID;
//货物名称 库位 计费单位
if (!basicForm.isValid()) {
return;
}
}
var GOODSPFSL = 0; //出库量
var GOODSPACKPFSL = 0; //出库件数
var GOODSOUTFEE = 0; //应收仓储费
var GOODSOUTFEEAP = 0; //应付仓储费
this.storeWMSOUTDetail.each(function (record) {
if(parseFloat(record.get('GOODSPFSL'))==0 && parseFloat(record.get('GOODSPACKPFSL'))==0){
return;
}
GOODSPFSL = GOODSPFSL + parseFloat(record.get('GOODSPFSL'));
GOODSPACKPFSL = GOODSPACKPFSL + parseFloat(record.get('GOODSPACKPFSL'));
record.set('CLIENTNAMEOLD',data.CLIENTNAMEOLD);
record.set('OLDCUSTFEEDATE',data.OLDCUSTFEEDATE);
record.set('ENDBILLINGDATE',data.OLDCUSTFEEDATE);
record.set('ENDBILLINGDATEAP',data.OLDCUSTFEEDATE);
if (record.get('GID')==""){
record.set('GID',NewGuid());
}
/*
CLIENTNAMEOLD: data.CLIENTNAMEOLD,
OLDCUSTFEEDATE: data.OLDCUSTFEEDATE,
STARTBILLINGDATE: WMS.STARTBILLINGDATE,
ENDBILLINGDATE: data.OLDCUSTFEEDATE,
STARTBILLINGDATEAP: WMS.STARTBILLINGDATEAP,
ENDBILLINGDATEAP: data.OLDCUSTFEEDATE,*/
});
data.GOODSPFSL = GOODSPFSL;
data.GOODSPACKPFSL = GOODSPACKPFSL;
data.GOODSOUTFEE = GOODSOUTFEE;
data.GOODSOUTFEEAP = GOODSOUTFEEAP;
if (COMPANYID == "" || DEPTGID == "") {
alert("登录信息不全,请退出重新登录");
return;
}
data.ISCOLLECTING = this.formEdit.getForm().findField('ISCOLLECTING').getValue() ? 1 : 0;
data.ISCHANGE = this.formEdit.getForm().findField('ISCHANGE').getValue() ? 1 : 0;
var GOODSPACKPFSL = 0;
var WMSOUTDetaildatas = [];
for (var i = 0; i < this.storeWMSOUTDetail.getCount(); i += 1) {
var member = this.storeWMSOUTDetail.getAt(i);
WMSOUTDetaildatas.push(member);
/*
var Amount = member.data.Amount;
var NOTAXAMOUNT = member.data.NOTAXAMOUNT;
if (Amount == 0 || NOTAXAMOUNT == 0) {
Ext.Msg.show({ title: '警告',
msg: '不含税价格和价税合计金额均不允许为0请修改后再保存',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
return;
}*/
}
//费用明细
var WMSOUTDetailBody = ConvertRecordsToJsonAll(WMSOUTDetaildatas);
var WMSOUTDetailBodyDel = ConvertRecordsToJsonAll(this.WMSOUTDetailBodyDel);
_this = this;
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/MvcShipping/WMS/SaveWMSOUT',
scope: this,
async: false,
params: {
OpStatus: this.OpStatus,
data: Ext.JSON.encode(data),
WMSOUTDetailBody: WMSOUTDetailBody,
WMSOUTDetailBodyDel: WMSOUTDetailBodyDel
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
var returnData = jsonresult.Data;
this.formEdit.getForm().setValues(returnData);
this.WMSOUTDetailBodyDel=[];
var INGIDNEW="";
if (this.OpStatus == 'add') {
//如果是货转
if (this.YWType=='HZ'){
//生成新的货权转移入库
var editp = Ext.create('WMSOUTmb', returnData);
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/MvcShipping/WMS/SetHZWMS',
scope: this,
async: false,
params: {
OpStatus: this.OpStatus,
data: Ext.JSON.encode(returnData)
},
callback:function(options, success, response){
HZjsonresult = Ext.JSON.decode(response.responseText);
var HZreturnData = HZjsonresult.Data;
returnData=HZreturnData;
//var WMSData=HZjsonresult.DataBody;
///////20150716 生成货转入库单后打开入库明细并定位到该条入库而且打开
//////20150729 直接打开该条货转入库的信息
_this.OpenWMS(HZjsonresult.DataBody);
}
});
}
var arrNewRecords = this.StoreList.add(returnData);
this.editRecord = arrNewRecords[0];
}
else if (this.OpStatus == 'edit') {
if (this.YWType=="HZ"){
//生成新的货权转移入库
var editp = Ext.create('WMSOUTmb', returnData);
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/MvcShipping/WMS/SetHZWMS',
scope: this,
async: false,
params: {
OpStatus: this.OpStatus,
data: Ext.JSON.encode(returnData)
},
callback:function(options, success, response){
HZjsonresult = Ext.JSON.decode(response.responseText);
var HZreturnData = HZjsonresult.Data;
returnData=HZreturnData;
}
});
}
var editp = Ext.create('WMSOUTmb', 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();
//alert(this.editRecord.get("GID"));
//this.panelFee.WMSOUTBSNO=this.editRecord.get
//this.onRefreshClick(button, event);
}
this.storeWMSOUTDetail.commitChanges();
//this.storePayBody.commitChanges();
if (type == '0') {
this.OpStatus = 'edit';
var condition = " BSNO='" + returnData.BSNO + "'";
this.LoadData(this.OpStatus, condition);
} 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');
}
});
},
//end save
onExportClick: function (button, event) {
GridExportExcelPage(this.formFeeBody);
}
, 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 ";
}
}
, getCondition_Main: function () {
var form = this.formSearch.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return '';
}
var sql = " ASSOCIATEDNO=GID ";
var DeptName = form.findField("DeptName").getValue();
sql = sql + getAndConSql(sql, DeptName, " WMSOP in( select showname from vw_user where deptname='" + DeptName + "') ");
var WMSOP = form.findField("WMSOP").getValue();
sql = sql + getAndConSql(sql, WMSOP, "WMSOP = '" + WMSOP + "'");
var WMSNO = form.findField("WMSNO").getValue();
sql = sql + getAndConSql(sql, WMSNO, "WMSNO like '%" + WMSNO + "%'");
var MBLNO = form.findField("MBLNO").getValue();
sql = sql + getAndConSql(sql, MBLNO, "BLNO like '%" + MBLNO + "%'");
var ISCHANGE = form.findField("ISCHANGE").getValue();
if (ISCHANGE==1){
sql = sql + getAndConSql(sql, ISCHANGE, " isnull(ISCHANGE,0)=0 ");
}
var CUSTOMERNAME = form.findField("CUSTOMERNAME").getValue();
sql = sql + getAndConSql(sql, CUSTOMERNAME, "CUSTOMERNAME like '%" + CUSTOMERNAME + "%'");
var GOODSNAME = form.findField("GOODSNAME").getValue();
sql = sql + getAndConSql(sql, GOODSNAME, "GOODSNAME like '%" + GOODSNAME + "%'");
var STORAGENAME = form.findField("STORAGENAME").getValue();
sql = sql + getAndConSql(sql, STORAGENAME, "STORAGENAME like '%" + STORAGENAME + "%'");
var WMSDATEbgn = form.findField('WMSDATEbgn').getRawValue();
sql = sql + getAndConSql(sql, WMSDATEbgn, "WMSDATE >= '" + WMSDATEbgn + "'");
var WMSDATEend = form.findField('WMSDATEend').getRawValue();
sql = sql + getAndConSql(sql, WMSDATEend, "WMSDATE <= '" + WMSDATEend + " 23:59:59'");
/*
var WMSOP = form.findField("WMSOP").getValue();
sql = sql + getAndConSql(sql, WMSOP, "WMSOP = '" + WMSOP + "'");
var Status = this.comboxStatus.getValue();
if (Status != "") {
sql = sql + getAndConSql(sql, Status, "bx.bxstatus in (" + Status + ")");
}
*/
return sql;
}
, onRefreshClick: function (button, event) {
var sql = this.getCondition_Main();
var data = this.formEdit.getForm().getValues();
if (data.ASSOCIATEDNO !=""){
//params: { start: 0, limit: this.PageSize, sort: '', WMSOUTBSNO: WMSOUTBSNO, ASSOCIATEDNO:ASSOCIATEDNO },
this.storeWMSOUTDetail.load({
params: { start: 0, limit: this.PageSize, WMSOUTBSNO: data.BSNO,sort: '', condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
}
else{
this.storeWMSOUTDetail.load({
params: { start: 0, limit: this.PageSize, WMSOUTBSNO:data.BSNO,ASSOCIATEDNO:"",sort: '', condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
}
//alert(this.storeList.getCount());
}
, setDate: function (newValue, oldValue) {
if (newValue == oldValue)
{ return; } else {
//将store当中的所有CHARGEUNIT改为newvalue;
this.storeWMSOUTDetail.each(function (record) {
record.set('ENDBILLINGDATE', newValue);
record.set('ENDBILLINGDATEAP', newValue);
});
}
}
, 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);
_this = this;
Ext.Ajax.request({//
waitMsg: '正在处理数据...',
url: '/MvcShipping/WMS/LockOut_Import',
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");
} else {
_this.editRecord.set("ISLOCK", "False");
}
_this.editRecord.commit();
} else {
alert("操作失败" + jsonresult.Message);
}
},
scope: this
}); //request over
}
}, this);
} //onDeleteClick
,OpenWMS:function (WMSData){
//var WMSRecord=WMSData;
this.NewWMSList = Ext.create('Ext.data.Store', {
model: 'WMSmb',
remoteSort: false,
pageSize: this.PageSize,
proxy: {
type: 'ajax',
url: '/MvcShipping/WMS/GetDataList',
reader: {
idProperty: 'Feeid',
root: 'data',
totalProperty: 'totalCount'
}
}
});
var arrNewRecords = this.NewWMSList.add(WMSData);
this.WMSRecord = arrNewRecords[0];
this.WMSStatus= 'edit';
DsOpenEditWin("/MvcShipping/MsOpSeai/WMSINEdit", "", "650", "1250");
}
,OprationSwap: function () {
var ret = new Array();
ret[0] = this.WMSStatus;
ret[1] = this.WMSList;
ret[2] = this.WMSRecord;
ret[3] = this.parentRecord;
return ret;
}
,onClearSql: function () {
var form = this.formSearch.getForm();
form.reset();
} //onDeleteClick
, MakeFee: function (Type) { //初始化应收应付,
if (this.OpStatus=="add"){
return;
}
var GOODSOUTFEE=0; //应收 仓储费
var ARFEE=0; //应收 出入库费
var GOODSOUTFEEAP=0; //应付 仓储费
var APFEE=0; //应付 出入库费
this.FEECOUNT=this.storeWMSOUTDetail.getCount();
for (var i = 0; i <this.storeWMSOUTDetail.getCount(); i += 1) {
var member = this.storeWMSOUTDetail.getAt(i);
var GOODSOUTFEE=parseFloat(member.get('GOODSOUTFEE'));
var ARFEE=parseFloat(member.get('ARFEE'));
var GOODSOUTFEEAP=parseFloat(member.get('GOODSOUTFEEAP'));
var APFEE=parseFloat(member.get('APFEE'));
var OUTBSNO= member.get('OUTBSNO');
if (Type=="应收"){
if (GOODSOUTFEE>0){
this.addChFee(member.get('ASSOCIATEDNO'),this.editRecord.get('GID'),this.editRecord.get('CUSTOMERNAME'), 1, 'RMB', 1, '仓储费', GOODSOUTFEE, 1, "出库单"+OUTBSNO+"生成");
}
if (ARFEE>0){
this.addChFee(member.get('ASSOCIATEDNO'),this.editRecord.get('GID'),this.editRecord.get('CUSTOMERNAME'), 1, 'RMB', 1, '出入库费', ARFEE, 1, "");
}
}
if (Type=="应付"){
if (GOODSOUTFEEAP>0){
this.addChFee(member.get('ASSOCIATEDNO'),this.editRecord.get('GID'),this.editRecord.get('CUSTOMERNAME'), 1, 'RMB', 1, '仓储费', GOODSOUTFEEAP, 1, "出库单"+OUTBSNO+"生成");
}
if (APFEE>0){
this.addChFee(member.get('ASSOCIATEDNO'),this.editRecord.get('GID'),this.editRecord.get('CUSTOMERNAME'), 1, 'RMB', 1, '出入库费', APFEE, 1, "");
}
}
}
}
, addChFee: function (BSNO,WMSOUTBSNO,CustomerName,FeeType, Currency, Exchangerate, FeeName, price, Quantity, Remark) {
var _CustomerName = "";
if (parseFloat(price) == 0) {
return;
}
_CustomerName=CustomerName;
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;
}
var EnterDate = GetDateStr(0);
var field = " (GId,BsNo,FeeStatus,FeeType,FeeName,FeeDescription,CustomerType,CustomerName,Unit,UnitPrice,TaxUnitPrice,Quantity "
field = field + " ,Amount,NoTaxAmount,Currency,ExChangerate,Reason,Remark,Commissionrate,Settlement,Invoice,OrderAmount,OrderInvoice "
field = field + " ,Auditoperator,EnterOperator,EnterDate,DebitNo,IsDebit,IsOpen,IsAdvancedpay,IsInvoice,FeeFrt,IsCrmOrderFee,AuditStatus,WMSOUTBSNO) "
var _value = " values ('" + NewGuid() + "','" + BSNO + "',1," + FeeType + ",'" + FeeName + "','','','" + _CustomerName + "',''," + price + "," + price + "," + Quantity + ""
_value = _value + "," + price + "*" + Quantity + "," + price + "*" + Quantity + ",'" + Currency + "'," + Exchangerate + ",'','" + Remark + "',0,0,0,0,0"
_value = _value + ",'','" + USERID + "','" + EnterDate + "','',0,0,0,0,'PP',0,0,'"+WMSOUTBSNO+"')"
var SQL = " Insert into ch_fee " + field + _value;
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/Import/ImportSync/SaveSync',
scope: this,
params: {
SQL: SQL
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
this.FEECOUNT=this.FEECOUNT-1;
if (this.FEECOUNT==0){
//刷新费用列表
this.panelFee.LoadDrChFee();
this.panelFee.LoadCrChFee();
}
} else {
Ext.Msg.show({ title: '请重试',
msg: '服务器响应出错',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
}
//alert('03');
}
});
}
});