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.
DS7/DSWeb/Areas/MvcShipping/Viewsjs/WMSOUT_GuiGe/LTJY/WMSOUT_GuiGeEdit.js

2067 lines
82 KiB
JavaScript

2 years ago
Ext.namespace('Shipping');
String.prototype.trim = function () { return this.replace(/(^\s*)|(\s*$)/g, ""); }
//#region 当前日期格式
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(), //cond
"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;
}
//#endregion
//#region 获取 YYYY-mm-dd 格式的日期
var xhr = new XMLHttpRequest();
var currdate = new Date();
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);
}
}
xhr.send(null);
//#endregion
//#region 关闭窗口前的判断
function getSaved() {
var changelines = panelEdit.storeDetailList.getModifiedRecords();
var changecount = changelines.length;
var AllDirty = true;
if (changecount == 0) { return false; }
if (panelEdit.formHead.getForm().isDirty() == true || AllDirty == true) { return true; }
else { return false };
}
//#endregion
Shipping.WMSOUT_GuiGeEdit = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.WMSOUT_GuiGeEdit.superclass.constructor.call(this);
};
Ext.extend(Shipping.WMSOUT_GuiGeEdit, Ext.Panel, {
parentWin: null,
opStatus: 'add',
EditRecord: null,
btnRefresh: null,
outType: null,
blISLOCK: false,
sqlcontext: '',
initUIComponents: function () {
this.formname = "formWMSOUT_GuiGeEdit_LTJY"; //出库单
this.formname_out = "formWMSOUTDetail_GuiGeEdit_LTJY"; //出库单明细
this.pcnostr = "";
//#region 页面加载
this.opStatus = 'add';
parentWin = window.parent.opener;
if (parentWin) {
var ret = parentWin.OprationSwap();
this.opStatus = ret[0];
this.EditRecord = ret[1];
this.btnRefresh = ret[2];
this.outType = ret[3];
}
//#endregion
//#region formSearch 下拉框信息加载
//委托单位
this.storeCustCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
this.storeCustCode.load();
this.comboxCustCode = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '客户名称', //需求编号SR2017071300002-2
store: this.storeCustCode,
forceSelection: true,
name: 'CUSTOMERNAME',
valueField: 'CustName',
displayField: 'CodeAndName',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick("");
}
}
}
});
//转移对象需求编号SR2017073000001
this.storeCLIENTNAMEOLD = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
this.storeCLIENTNAMEOLD.load({ params: { condition: "ISCONTROLLER='1'"} });
this.comboxCLIENTNAMEOLD = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '转移对象',
store: this.storeCLIENTNAMEOLD,
//forceSelection: true,
id: 'CLIENTNAMEOLD',
name: 'CLIENTNAMEOLD',
valueField: 'CustName',
displayField: 'CodeAndName'
});
//应收仓储客户需求编号SR2017073000001
this.storeARCLIENTWMSOUT = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
this.storeARCLIENTWMSOUT.load({ params: { condition: "ISCONTROLLER='1'"} });
this.comboxARCLIENTWMSOUT = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '应收仓储客户',
store: this.storeARCLIENTWMSOUT,
//forceSelection: true,
name: 'ARCLIENTWMSOUT',
valueField: 'CustName',
displayField: 'CodeAndName'
});
//应收出库客户需求编号SR2017073000001
this.storeARCLIENT = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
this.storeARCLIENT.load({ params: { condition: "ISCONTROLLER='1'"} });
this.comboxARCLIENT = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '应收出库客户',
store: this.storeARCLIENT,
//forceSelection: true,
name: 'ARCLIENT',
valueField: 'CustName',
displayField: 'CodeAndName'
});
//应付客户需求编号SR2017073000001
this.storeTRUCKNAME = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
this.storeTRUCKNAME.load({ params: { condition: "ISCONTROLLER='1'"} });
this.comboxTRUCKNAME = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '应付客户',
store: this.storeTRUCKNAME,
//forceSelection: true,
name: 'TRUCKNAME_OUT',
valueField: 'CustName',
displayField: 'CodeAndName'
});
//所属仓库
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,
forceSelection: true,
name: 'STORAGENAME',
valueField: 'CustName',
displayField: 'CodeAndName',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick("");
}
}
}
});
//品名
this.storeCodeGoodsList = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.DICModel',
proxy: { url: '/CommMng/TruckBasicDataRef/GetCommaWord' }
});
this.storeCodeGoodsList.load({ params: { tablename: "wms_in", columnname: "goodsname", condition: ""} });
this.comboxGOODSNAME = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '品名',
store: this.storeCodeGoodsList,
forceSelection: true,
name: 'GOODSNAME',
valueField: 'KEYFIELD',
displayField: 'KEYFIELD',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick("");
}
}
}
});
//品名明细表_规格
this.storeCodeGoodsDetailList = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CodeGoodsDetailModel',
proxy: { url: '/CommMng/BasicDataRef/GetCodeGoodsDetailList' }
});
this.storeCodeGoodsDetailList.load();
this.comboxCodeGoodsDetail = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '单位', //品牌
store: this.storeCodeGoodsDetailList, hidden: true,
forceSelection: true,
name: 'GOODSDETAILNAME',
valueField: 'GOODSDETAILNAME',
displayField: 'GOODSDETAILNAME',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick("");
}
}
}
});
//枚举维护表tSysEnumValue_车辆类型99019//需求编号SR2017073000001
this.storeTSysEnumValueCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.TSysEnumValueDataModel',
proxy: { url: '/CommMng/BasicDataRef/GetTSysEnumValueList' }
});
this.storeTSysEnumValueCode.load({ params: { condition: " and EnumTypeID=99019"} }); //车辆类型
this.comboxTRUCKTYPE = Ext.create('DsExt.ux.RefTableCombox', {
//fieldLabel: '车辆类型',
store: this.storeTSysEnumValueCode,
forceSelection: true,
name: 'TRUCKTYPE',
valueField: 'EnumValueName',
displayField: 'EnumValueName'
});
//装卸工下拉框//需求编号SR2017073000001
Ext.regModel('ZHUANGXIEGONGMODEL', { fields: [{ name: 'GID' }, { name: 'NAME' }, { name: 'CODE' }, { name: 'CODENAME'}] })
this.storeZhuangXieGong = Ext.create('DsExt.ux.RefTableStore', {
model: 'ZHUANGXIEGONGMODEL',
proxy: { url: '/MvcShipping/WMSNew/GetZhuangXieGongList' }
});
this.storeZhuangXieGong.load();
this.comboxZhuangXieGong = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeZhuangXieGong,
name: 'ZHUANGXIEGONGID_OUT',
forceSelection: true,
valueField: 'NAME',
displayField: 'CODENAME'
});
//#region 进口国
Ext.define('ConutryRef', {
extend: 'Ext.data.Model',
fields: [
{ name: 'countryid', type: 'string' },
{ name: 'country', type: 'string' },
{ name: 'country_idandname', type: 'string' }
]
});
this.storeCountry = Ext.create('DsExt.ux.RefTableStore', {
model: 'ConutryRef',
proxy: { url: '/CommMng/BasicDataRef/GetCountryRefList' }
});
this.storeCountry.load({ params: { condition: ""} });
this.comboxCountry = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '进口国', hidden: true,
forceSelection: true,
store: this.storeCountry,
name: 'COUNTRYID',
valueField: 'countryid',
displayField: 'country_idandname',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick("");
}
}
}
});
//#endregion
//#endregion
//#region formSearch 查询面板
this.formSearch = Ext.widget('form', {
title: '查询信息',
frame: true,
//collapsible: true, //将激活折叠功能
region: 'north',
border: false,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 60,
msgTarget: 'qtip'
},
items: [{//fieldset 1
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '箱号',
name: 'CNTRNO',
enableKeyEvents: true, //激活键盘事件
listeners: {
scope: this,
'keyup': {
fn: function (_field, e) {
if (e.getKey() == 13) {
this.onRefreshClick("");
}
},
scope: this
}
// ,specialkey: function (field, e) {
// if (e.getKey() == e.ENTER) {
// _this.onRefreshClick("");
// }
// }
}
}, {
fieldLabel: '箱数',
xtype: 'numberfield',
name: 'BOXCOUNT',
value: 0,
enableKeyEvents: true, //激活键盘事件
listeners: {
scope: this,
'keyup': {
fn: function (_field, e) {
if (e.getKey() == 13) {
this.onRefreshClick("");
}
},
scope: this
}
}
}, {
fieldLabel: '入库单号',
name: 'WMSNO',
editable: false,
enableKeyEvents: true, //激活键盘事件
listeners: {
scope: this,
'keyup': {
fn: function (_field, e) {
if (e.getKey() == 13) {
this.onRefreshClick("");
}
},
scope: this
}
// ,specialkey: function (field, e) {
// if (e.getKey() == e.ENTER) {
// _this.onRefreshClick("");
// }
// }
}
}, {
fieldLabel: '批次号',
name: 'PICIHAO',
editable: false,
enableKeyEvents: true, //激活键盘事件
listeners: {
scope: this,
'keyup': {
fn: function (_field, e) {
if (e.getKey() == 13) {
this.onRefreshClick("");
}
},
scope: this
}
}
}, this.comboxCustCode, this.comboxSTORAGENAME, this.comboxGOODSNAME
, this.comboxCodeGoodsDetail
, this.comboxCountry
, {
xtype: 'button',
width: 80,
text: "执行查询",
iconCls: "btnrefresh",
handler: function (button, event) {
this.onRefreshClick(button, event);
},
scope: this
}, {
xtype: 'button',
width: 80,
text: "重置条件",
iconCls: "btnreset",
handler: function (button, event) {
this.onClearSql(button, event);
this.pcnostr = "";
},
scope: this
}]
}]//end items(fieldset 1)
}]//end root items
});
//#endregion formSearch
//#region 编辑formHead 基本信息
this.formHead = Ext.widget('form', {
title: this.outType, //'出库信息',
frame: true,
region: 'north',
border: false,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 90,
msgTarget: 'qtip'
},
items: [{//fieldset 1
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '出库主表GID',
name: 'OUTGID',
hidden: true
}, {
fieldLabel: '出库单号',
name: 'OUTBSNO_OUT',
editable: true,
readOnly: true,
disabled: false
}, {
fieldLabel: '出库日期',
name: 'DODATE_OUT',
xtype: 'datefield',
format: 'Y-m-d',
value: currdate.format('yyyy-MM-dd'),
editable: false,
allowBlank: false,
listeners: {
select: function (dfield, records, eOpts) {
var sDODATE_OUT = dfield.rawValue;
Ext.getCmp('OLDCUSTFEEDATE').setValue(sDODATE_OUT);
}
}
}, {
fieldLabel: '结束计费日期', //需求编号SR2017073000001
id: 'OLDCUSTFEEDATE',
name: 'OLDCUSTFEEDATE',
xtype: 'datefield',
format: 'Y-m-d',
value: currdate.format('yyyy-MM-dd'),
editable: false,
allowBlank: false
}, this.comboxCLIENTNAMEOLD, this.comboxARCLIENTWMSOUT, this.comboxARCLIENT //需求编号SR2017073000001
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '费用状态',
readOnly: true,
disabled: true,
name: 'FEESTATUSREF_OUT'
}, {
fieldLabel: '会计期间',
name: 'ACCDATE_OUT',
xtype: 'monthfield',
format: 'Y-m',
value: currdate.format('yyyy-MM'),
editable: false,
allowBlank: false
}, this.comboxTRUCKNAME //需求编号SR2017073000001
, {
xtype: "checkbox", //checkbox控件
id: "cbCCF",
name: "cbCCF",
boxLabel: "",
fieldLabel: "是否生成仓储费",
inputValue: "true", //选中的值
uncheckedValue: "false", //未选中的值
checked: true //绘制时的选中状态
}, {
fieldLabel: '备注',
flex: 2, //需求编号SR2017073000001
name: 'OUTREMARK'
}]
}]//end items(fieldset 1)
}]//end root items
});
//#endregion
//#region 权限范围
/*
this.StoreOpRange = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsOP',
//proxy: { url: '/MvcShipping/MsBaseInfo/GetOpRang' }
proxy: { url: '/MvcShipping/MsBaseInfo/GetOpRang4' }
});
this.StoreOpRange.load({ params: { optype: "WMSOUT_GuiGeCHECKED"} });
this.StoreOpRange2 = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsOP',
//proxy: { url: '/MvcShipping/MsBaseInfo/GetOpRang' }
proxy: { url: '/MvcShipping/MsBaseInfo/GetOpRang4' }
});
this.StoreOpRange2.load({ params: { optype: "WMSOUT_GuiGeNotCHECKED"} });
*/
//#endregion
//#region 出库明细列表
//#region 定义数据集
this.storeDetailList = Ext.create('Ext.data.Store', {
model: 'VwWmsDetailModel',
remoteSort: false,
proxy: {
type: 'ajax',
url: '/MvcShipping/WMSOUT_GuiGe/GetDetailList_Box',
reader: {
id: 'NID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//#endregion
//#region 列定义
this.initgirdDrcolums = [{
sortable: false,
dataIndex: 'NID',
header: '唯一编码', //唯一编码
hidden: true,
width: 0
}, {
sortable: false,
dataIndex: 'OUTBSNO_OUT',
header: '出库单号',
align: 'center',
width: 80
}, {
sortable: true,
dataIndex: 'CNTRNO',
header: '箱号',
align: 'center',
width: 80
},
{
//需求编号SR2017062600003
sortable: false, hidden: true,
dataIndex: 'ISBONDEDNAME',
header: '是否保税业务',
align: 'center',
width: 80
},
{
sortable: false,
dataIndex: 'CUSTOMERNAME',
header: '客户名称', //需求编号SR2017071300002-2
width: 120
},
{
sortable: false,
dataIndex: 'STORAGENAME',
header: '所属仓库',
width: 120
},
{
sortable: false, hidden: true,
dataIndex: 'BLNO',
header: '提单号',
width: 120
}, {
sortable: false,
dataIndex: 'PICIHAO',
header: '批次号',
width: 120
},
{
sortable: false,
dataIndex: 'WMSNO',
header: '入库单号',
width: 120
},
{
sortable: false,
dataIndex: 'WMSDATE',
header: '入库时间',
width: 80
},
{
sortable: false,
dataIndex: 'GOODSNAME',
header: '品名',
width: 120
},
{
sortable: false, hidden: true,
dataIndex: 'GOODSMODEL',
header: '单位', //品牌需求编号SR2017061800001-12
width: 60
},
{
sortable: false, hidden: true,
dataIndex: 'GOODSSTANDARD',
header: '规格',
align: 'right',
width: 60
},
{
sortable: false, hidden: true,
dataIndex: 'GOODSPACKSTOCK',
header: '剩余件数',
align: 'right',
width: 80
},
{
//需求编号SR2017062200002
sortable: false, hidden: true,
dataIndex: 'WeiWanShui',
header: '未完税件数',
align: 'right',
width: 80
},
{
sortable: false, hidden: true,
dataIndex: 'GOODSNUM',
header: '完税库存件数', //需求编号SR2017062200002
align: 'right',
width: 80
},
{
sortable: false, hidden: true,
dataIndex: 'GOODSPACKPFSL_OUT',
header: '出库件数',
align: 'right',
width: 80,
editor: {
xtype: 'numberfield',
allowBlank: false,
selectOnFocus: true, //得到焦点时自动选择文本
allowDecimals: true, //允许输入小数
nanText: '请输入有效数值',
value: 0,
minValue: 0,
//maxValue: 100000,
keyNavEnabled: false, //键盘导航是否可用,启用后可以通过键盘的上下箭头调整数值
hideTrigger: true, //是否隐藏上下调节按钮
mouseWheelEnabled: false, //鼠标滚轮是否可用,启用后可以通过滚动鼠标滚轮调整数值
//step: 2,//通过调节按钮、键盘、鼠标滚轮调节数值时的大小
enableKeyEvents: true, //激活键盘事件
listeners: {
scope: this,
'keyup': {
fn: function (_field, e) {
if (e.getKey() == 13) {
this.onNextKeyClick(13);
}
},
scope: this
}
}
}
},
{
//需求编号SR2017061800001-7SR2017071100001
sortable: false, hidden: true,
dataIndex: 'GOODSSLICE_OUT',
header: '出库包装件数',
align: 'right',
width: 80
}
,
{
sortable: false,
dataIndex: 'GOODSSTOCK',
header: '剩余库存',
width: 80
}
,
{
sortable: false,
dataIndex: 'GOODSPFSL_OUT',
header: '出库量',
align: 'right',
width: 80,
editor: {
xtype: 'numberfield',
allowBlank: false,
selectOnFocus: true, //得到焦点时自动选择文本
allowDecimals: true, //允许输入小数
nanText: '请输入有效数值',
value: 0,
minValue: 0,
//maxValue: 100000,
keyNavEnabled: false, //键盘导航是否可用,启用后可以通过键盘的上下箭头调整数值
hideTrigger: true, //是否隐藏上下调节按钮
mouseWheelEnabled: false, //鼠标滚轮是否可用,启用后可以通过滚动鼠标滚轮调整数值
//step: 2,//通过调节按钮、键盘、鼠标滚轮调节数值时的大小
enableKeyEvents: true, //激活键盘事件
listeners: {
scope: this,
'keyup': {
fn: function (_field, e) {
if (e.getKey() == 13) {
this.onNextKeyClick(14);
}
},
scope: this
}
}
}
},
{
//需求编号SR2017073000001
sortable: false, hidden: true,
dataIndex: 'QianFengNO',
header: '铅封号',
width: 100,
editor: {
xtype: 'textfield',
selectOnFocus: true,
enableKeyEvents: true, //激活键盘事件
listeners: {
scope: this,
'keyup': {
fn: function (_field, e) {
if (e.getKey() == 13) {
this.onNextKeyClick(15);
}
},
scope: this
}
}
}
},
{
//需求编号SR2017073000001
sortable: false, hidden: true,
dataIndex: 'TRUCKNO_OUT',
header: '车号',
width: 100,
editor: {
xtype: 'textfield',
selectOnFocus: true,
enableKeyEvents: true, //激活键盘事件
listeners: {
scope: this,
'keyup': {
fn: function (_field, e) {
if (e.getKey() == 13) {
this.onNextKeyClick(15);
}
},
scope: this
}
}
}
},
{
//需求编号SR2017073000001
sortable: false, hidden: true,
dataIndex: 'TRUCKTYPE_OUT',
header: '车辆类型',
width: 100,
editor: this.comboxTRUCKTYPE
},
{
//需求编号SR2017073000001
sortable: false, hidden: true,
dataIndex: 'ZHUANGXIEGONGID_OUT',
header: '装卸工',
width: 100,
editor: this.comboxZhuangXieGong
},
{
//需求编号SR2017073000001
sortable: false, hidden: true,
dataIndex: 'TRUCKKGS_OUT',
header: '平均重量',
value: '0',
width: 80
},
{
//需求编号SR2017073000001
sortable: false, hidden: true,
dataIndex: 'ARFEE_OUT',
header: '铅封费',
align: 'right',
width: 100,
summaryType: 'sum',
editor: {
xtype: 'numberfield',
allowBlank: false,
selectOnFocus: true, //得到焦点时自动选择文本
allowDecimals: true, //允许输入小数
nanText: '请输入有效小数',
minValue: -999999999.99,
maxValue: 999999999.99,
value: 0.00,
keyNavEnabled: false, //键盘导航是否可用,启用后可以通过键盘的上下箭头调整数值
hideTrigger: true, //是否隐藏上下调节按钮
mouseWheelEnabled: false //鼠标滚轮是否可用,启用后可以通过滚动鼠标滚轮调整数值
//step: 2,//通过调节按钮、键盘、鼠标滚轮调节数值时的大小
},
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
},
summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
},
{
//需求编号SR2017073000001
sortable: false, hidden: true,
dataIndex: 'ARFEE_2_OUT',
header: '过磅费',
align: 'right',
width: 100,
summaryType: 'sum',
editor: {
xtype: 'numberfield',
allowBlank: false,
selectOnFocus: true, //得到焦点时自动选择文本
allowDecimals: true, //允许输入小数
nanText: '请输入有效小数',
minValue: -999999999.99,
maxValue: 999999999.99,
value: 0.00,
keyNavEnabled: false, //键盘导航是否可用,启用后可以通过键盘的上下箭头调整数值
hideTrigger: true, //是否隐藏上下调节按钮
mouseWheelEnabled: false //鼠标滚轮是否可用,启用后可以通过滚动鼠标滚轮调整数值
//step: 2,//通过调节按钮、键盘、鼠标滚轮调节数值时的大小
},
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
},
summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
},
{
//需求编号SR2017073000001
sortable: false, hidden: true,
dataIndex: 'GOODSOUTFEE_OUT',
header: '应收仓储费',
align: 'right',
width: 100,
summaryType: 'sum',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
},
summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
},
{
//需求编号SR2017073000001
sortable: false, hidden: true,
dataIndex: 'GOODSOUTFEEAP_OUT',
header: '应付仓储费',
align: 'right',
width: 100,
summaryType: 'sum',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
},
summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
},
{
sortable: false, hidden: true,
dataIndex: 'REMARK_OUT',
header: '备注',
width: 300,
editor: {
xtype: 'textfield',
selectOnFocus: true,
enableKeyEvents: true, //激活键盘事件
listeners: {
scope: this,
'keyup': {
fn: function (_field, e) {
if (e.getKey() == 13) {
this.onNextKeyClick(15);
}
},
scope: this
}
}
}
},
{
sortable: false, hidden: true,
dataIndex: 'CHIMA1',
header: '尺码1',
width: 120
}, {
sortable: false, hidden: true,
dataIndex: 'CHIMA2',
header: '尺码2',
width: 120
}, {
sortable: false, hidden: true,
dataIndex: 'GOODSKGS',
header: '重量',
width: 120
}, {
sortable: false, hidden: true,
dataIndex: 'ZHONGLIANG2',
header: '重量2',
width: 120
}, {
sortable: false, hidden: true,
dataIndex: 'WMSGID',
header: '入库GID',
hidden: true,
width: 0
}, {
sortable: false, hidden: true,
dataIndex: 'GID',
header: '入库明细GID',
hidden: true,
width: 0
}, {
sortable: false, hidden: true,
dataIndex: 'OUTGID',
header: '出库GID',
hidden: true,
width: 0
}, {
sortable: false, hidden: true,
dataIndex: 'GID_OUT',
header: '出库明细GID',
hidden: true,
width: 0
}, {
sortable: false, hidden: true,
dataIndex: 'BSNO_OUT',
header: '出库明细单号',
hidden: true,
width: 0
}, {
sortable: false, hidden: true,
dataIndex: 'ASSOCIATEDNO',
header: '业务GID',
hidden: true,
width: 0
}, {
sortable: false, hidden: true,
dataIndex: 'GOODSNAMEID',
header: '品名gid',
hidden: true,
width: 0
}, {
sortable: false,
dataIndex: 'WHS_CODE',
header: '库别',
hidden: true,
width: 0
}, {
sortable: false,
dataIndex: 'AREANAME',
header: '储位',
hidden: true,
width: 0
}, {
sortable: false,
dataIndex: 'BZTCHNO',
header: '电子账册号',
hidden: true,
width: 0
}, {
sortable: false,
dataIndex: 'CUSTOMNO',
header: '报关单号',
hidden: true,
width: 0
}, {
//需求编号SR2017061900001-1
sortable: false,
dataIndex: 'ISBONDED',
header: '是否报税业务',
hidden: true,
width: 0
},
{
sortable: false,
dataIndex: 'GOODSPACKPFSL_OUT_2',
header: '出库件数_用于判断',
align: 'right',
width: 0
}, {
//需求编号SR2017073000001
sortable: false,
dataIndex: 'CHARGEUNIT',
header: '入库计费单位',
hidden: true,
width: 0
},
{
sortable: false,
dataIndex: 'COUNTRY',
header: '进口国',
align: 'left',
width: 120
},
{
sortable: false,
dataIndex: 'AREACODE',
header: '库位编码',
align: 'left',
width: 80
},
{
sortable: false,//34
dataIndex: 'LOADERFEE',
header: 'LOADERFEE'
}
];
this.girdcolums = this.initgirdDrcolums;
this.girdcolums = DsTruck.GetGridPanel(GID, this.formname_out, this.girdcolums, 0); //使用者id表名中间column数组跳过一开始的几列
//#endregion
//#region gridList列表显示信息
this.gridListCellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1 //1单击2双击
});
this.gridList = new Ext.grid.GridPanel({
region: 'center',
store: this.storeDetailList,
enableHdMenu: false, //是否显示表格列的菜单
hideHeaders: false, //是否隐藏表头
enableColumnHide: true, ///隐藏表头列
sortableColumns: false, ///隐藏表头排序
//disableSelection: false, //是否禁止选择表格行或列默认为false
//trackMouseOver: true, //高亮显示鼠标所在的行默认为true,
//stripeRows: true, //斑马线效果
rowLines: true,
columnLines: true,
loadMask: { msg: "数据加载中,请稍等..." },
plugins: [this.gridListCellEditing],
selType: 'cellmodel',
columns: this.girdcolums,
features: [{
ftype: 'summary'//Ext.grid.feature.Summary表格汇总特性
}],
tbar: [{
text: "全部出库",
id: "order_modify",
handler: function (button, event) {
//alert(DsTruck.GetDirty1(panelWMSNewINEdit.storeWMSIN, null));
this.OUTALL();
},
scope: this
}, {
text: "保存列表样式",
menu: [{ text: "保存",
handler: function (button, event) {
//_thisfee.girdDrcolums = DsTruck.SaveGridPanel(GID, 'FEEDRGRID', _thisfee.gridDrChFee.columns, _thisfee.girdDrcolums, 0, true);
_this.girdcolums = DsTruck.SaveGridPanel(GID, _this.formname_out, _this.gridList.columns, _this.girdcolums, 0, true); //使用者id表名中间column数组跳过一开始的几列
}
}, { text: "初始化",
handler: function (menu, event) {
//_thisfee.gridDrChFee.reconfigure(this.storeList, _thisfee.initgirdDrcolums);
//_thisfee.girdDrcolums = DsTruck.SaveGridPanel(GID, 'FEEDRGRID', _thisfee.gridDrChFee.columns, _thisfee.initgirdDrcolums, 0, true);
_this.gridList.reconfigure(_this.storeDetailList, _this.initgirdDrcolums);
_this.girdcolums = DsTruck.SaveGridPanel(GID, _this.formname_out, _this.gridList.columns, _this.initgirdDrcolums, 0, true); //使用者id表名中间column数组跳过一开始的几列
}
}],
scope: this
}, {
text: "打印",
id: "PrintBtn",
handler: function (button, event) {
//alert(DsTruck.GetDirty1(panelWMSNewINEdit.storeWMSIN, null));
this.Print_OUT();
},
scope: this
}],
listeners: {
scope: this,
'edit': function (editor, e, eOpts) {
if (e.value == e.originalValue) { return; }
if (e.field == "GOODSPACKPFSL_OUT") {
//需求编号SR2017073000001
var dlOriginalValue = e.originalValue;
if (this.OpStatus == 'edit') {
dlOriginalValue = e.record.data['GOODSPACKPFSL_OUT_2']; //需求编号SR2017073000001
}
//
var dlGOODSPACKPFSL_OUT = e.value; //出库件数
var blISBONDED = e.record.data['ISBONDED'].toString(); //是否报税业务//需求编号SR2017061900001-1
if (blISBONDED == "true") {
//需求编号SR2017073000001
var dlGOODSNUM = e.record.data['GOODSNUM'].toString(); //完税件数
if (this.OpStatus == 'edit') {
dlGOODSNUM = e.record.data['GOODSNUM'] + dlOriginalValue; //完税件数
}
if (dlGOODSPACKPFSL_OUT > dlGOODSNUM) {
e.record.set('GOODSPACKPFSL_OUT', dlOriginalValue);
Ext.Msg.show({ title: '警告', msg: '注意:出库件数不能大于完税件数!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
}
}
//需求编号SR2017073000001
var dlGOODSPACKSTOCK = e.record.data['GOODSPACKSTOCK'].toString(); //剩余件数
if (this.OpStatus == 'edit') {
dlGOODSPACKSTOCK = e.record.data['GOODSPACKSTOCK'] + dlOriginalValue; //剩余件数
}
if (dlGOODSPACKPFSL_OUT > dlGOODSPACKSTOCK) {
e.record.set('GOODSPACKPFSL_OUT', dlOriginalValue);
Ext.Msg.show({ title: '警告', msg: '注意:出库件数不能大于剩余件数!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
}
//需求编号SR2017073000001
var rqWMSDATE = e.record.data['WMSDATE']; //入库日期
var rqDODATE_OUT = this.formHead.getForm().findField('DODATE_OUT').getRawValue(); //出库日期
if (rqWMSDATE > rqDODATE_OUT) {
e.record.set('GOODSPACKPFSL_OUT', dlOriginalValue);
Ext.Msg.show({ title: '警告', msg: '注意:出库日期不能小于入库日期!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
}
//
if (this.formHead.getForm().findField('CLIENTNAMEOLD').getValue() == undefined || this.formHead.getForm().findField('CLIENTNAMEOLD').getValue().toString().trim() == "") {
this.formHead.getForm().findField('CLIENTNAMEOLD').setValue(e.record.data['CUSTOMERNAME'].toString()); //转移对象
}
if (this.formHead.getForm().findField('ARCLIENTWMSOUT').getValue() == undefined || this.formHead.getForm().findField('ARCLIENTWMSOUT').getValue().toString().trim() == "") {
this.formHead.getForm().findField('ARCLIENTWMSOUT').setValue(e.record.data['CUSTOMERNAME'].toString()); //应收仓储客户
}
if (this.formHead.getForm().findField('ARCLIENT').getValue() == undefined || this.formHead.getForm().findField('ARCLIENT').getValue().toString().trim() == "") {
this.formHead.getForm().findField('ARCLIENT').setValue(e.record.data['CUSTOMERNAME'].toString()); //应收出库客户
}
}
else if (e.field == "GOODSPFSL_OUT") {//需求编号SR2017073000001
var dlGOODSPFSL_OUT = e.value; //出库量
var dlGOODSPACKPFSL_OUT = e.record.data['GOODSPACKPFSL_OUT'].toString(); //出库件数
if (dlGOODSPACKPFSL_OUT == 0) {
e.record.set('TRUCKKGS_OUT', 0);
}
else {
var dlTRUCKKGS_OUT = parseFloat(dlGOODSPFSL_OUT / dlGOODSPACKPFSL_OUT).toFixed(4);
e.record.set('TRUCKKGS_OUT', dlTRUCKKGS_OUT);
}
//
if (this.formHead.getForm().findField('CLIENTNAMEOLD').getValue() == undefined || this.formHead.getForm().findField('CLIENTNAMEOLD').getValue().toString().trim() == "") {
this.formHead.getForm().findField('CLIENTNAMEOLD').setValue(e.record.data['CUSTOMERNAME'].toString()); //转移对象
}
if (this.formHead.getForm().findField('ARCLIENTWMSOUT').getValue() == undefined || this.formHead.getForm().findField('ARCLIENTWMSOUT').getValue().toString().trim() == "") {
this.formHead.getForm().findField('ARCLIENTWMSOUT').setValue(e.record.data['CUSTOMERNAME'].toString()); //应收仓储客户
}
if (this.formHead.getForm().findField('ARCLIENT').getValue() == undefined || this.formHead.getForm().findField('ARCLIENT').getValue().toString().trim() == "") {
this.formHead.getForm().findField('ARCLIENT').setValue(e.record.data['CUSTOMERNAME'].toString()); //应收出库客户
}
}
}
}
});
this.gridList.addListener('itemclick', function (dataview, record, item, index, e, b) {
var condition2 = "WMSOUTGID='" + record.data.OUTGID + "' and ASSOCIATEDNO='" + record.data.GID_OUT + "'";
this.storeWmsRateDetailList.load({
params: { condition: condition2 },
waitMsg: "正在刷新数据...",
timeout: 6000000, //60秒
scope: this
});
}, this);
//#endregion
//#endregion
//#region 仓储费列表//需求编号SR2017073000001
//#region 定义数据集
this.storeWmsRateDetailList = Ext.create('Ext.data.Store', {
model: 'WmsRateDetailModel',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/WMSOUT_GuiGe/GetWmsRateDetailList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//#endregion
//#region 列定义
this.girdcolumsWmsRateDetail = [
{
sortable: false,
dataIndex: 'GID',
header: '', //唯一编码
hidden: true,
width: 0
},
{
sortable: false,
dataIndex: 'FEETYPENAME',
header: '费用类别',
align: 'center',
width: 60
},
{
sortable: false,
dataIndex: 'FEEGRADE',
header: '计费等级',
align: 'center',
width: 60
},
{
sortable: false,
dataIndex: 'STARTBILLINGDATE',
header: '开始计费日期',
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
align: 'center',
width: 100
},
{
sortable: false,
dataIndex: 'ENDBILLINGDATE',
header: '结束计费日期',
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
align: 'center',
width: 100
},
{
sortable: false,
dataIndex: 'FEESCALE',
header: '计费区间',
align: 'center',
width: 60
}
// ,
// {
// sortable: false,
// dataIndex: 'FEEUNIT',
// header: '计费单位',
// align: 'center',
// width: 60
// }
,
{
sortable: false,
dataIndex: 'FEEPRICE',
header: '计费单价',
align: 'right',
width: 80,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
},
{
sortable: false,
dataIndex: 'GOODSPFSL',
header: '出库量',
align: 'center',
width: 80
},
{
sortable: false,
dataIndex: 'OUTFEE',
header: '仓储费',
align: 'right',
width: 80,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
},
{
sortable: false,
dataIndex: 'WMSOUTGID',
header: 'WMSOUTGID',
hidden: true,
align: 'center',
width: 0
},
{
sortable: false,
dataIndex: 'ASSOCIATEDNO',
header: '关联号',
hidden: true,
align: 'center',
width: 0
}];
//#endregion
//#region gridList列表显示信息
this.gridListWmsRateDetail = new Ext.grid.GridPanel({
title: "仓储费用明细",
region: 'south',
store: this.storeWmsRateDetailList,
enableHdMenu: false, //是否显示表格列的菜单
hideHeaders: false, //是否隐藏表头
enableColumnHide: false, ///隐藏表头列
sortableColumns: false, ///隐藏表头排序
//disableSelection: false, //是否禁止选择表格行或列默认为false
//trackMouseOver: true, //高亮显示鼠标所在的行默认为true,
//stripeRows: true, //斑马线效果
rowLines: true,
columnLines: true,
loadMask: { msg: "数据加载中,请稍等..." },
selType: 'cellmodel',
height: 200,
columns: this.girdcolumsWmsRateDetail
});
//#endregion
//#endregion
//#region panelFee 费用信息
this.panelFee = new Shipping.FeeEditGrid({
border: false,
//title: '费用信息',
region: 'center', //south
layout: 'border'
//height: 400
//collapsible: true //将激活折叠功能
});
if (this.opStatus == 'edit') {
this.panelFee.EditRecord = this.EditRecord;
this.panelFee.stroplb = 'op_other'; //需求编号SR2017061800001-7
//this.panelFee.strBSNO = EditRecord.get('BSNO');
//this.panelFee.strMBLNO = EditRecord.get('MBLNO');
this.panelFee.strBSNO = this.EditRecord.data.GID;
this.panelFee.strMBLNO = this.EditRecord.data.BSNO;
}
//#endregion
_this = this;
//#region 按钮Toolbar/框架/加载
this.panelBtn = new Ext.Panel({
border: false,
region: "north",
tbar: [{
text: '新建',
tooltip: '新建',
id: "btnAdd",
iconCls: "btnadd",
handler: function (button, event) {
this.onAddClick();
},
scope: this
}, '-', {
id: 'btnSave',
text: "保存",
iconCls: "btnsave",
handler: function (button, event) {
this.Save();
},
scope: this
}, {
text: "关闭",
handler: function (button, event) {
window.close();
},
scope: this
}, '-', {
text: '打印',
tooltip: '打印',
iconCls: "btnprint",
handler: function (button, event) {
this.Print(button, event);
},
scope: this
}, '-', {
text: "保存列表样式",
menu: [{ text: "保存",
handler: function (button, event) {
//_thisfee.girdDrcolums = DsTruck.SaveGridPanel(GID, 'FEEDRGRID', _thisfee.gridDrChFee.columns, _thisfee.girdDrcolums, 0, true);
_this.girdcolums = DsTruck.SaveGridPanel(GID, _this.formname, _this.gridList.columns, _this.girdcolums, 1, true); //使用者id表名中间column数组跳过一开始的几列
}
}, { text: "初始化",
handler: function (menu, event) {
//_thisfee.gridDrChFee.reconfigure(this.storeList, _thisfee.initgirdDrcolums);
//_thisfee.girdDrcolums = DsTruck.SaveGridPanel(GID, 'FEEDRGRID', _thisfee.gridDrChFee.columns, _thisfee.initgirdDrcolums, 0, true);
_this.gridList.reconfigure(_this.storeDetailList, _this.initgirdDrcolums);
_this.girdcolums = DsTruck.SaveGridPanel(GID, _this.formname, _this.gridList.columns, _this.initgirdDrcolums, 1, true); //使用者id表名中间column数组跳过一开始的几列
}
}],
scope: this
}, '-', {
text: "费用入账",
id: "btIslock",
iconCls: "btislock",
handler: function (button, event) {
this.setislock(button, event);
},
scope: this
}, {
text: "取消入账",
id: "btNotIslock",
iconCls: "btnotislock",
handler: function (button, event) {
this.setnotlock(button, event);
},
scope: this
}]
}); //end 按钮Toolbar
this.panelTop = new Ext.Panel({
border: false,
layout: "border",
region: "north",
height: 176,
items: [this.panelBtn, this.formSearch, this.formHead]
});
this.page_1 = new Ext.Panel({
border: false,
id: "page_1",
title: "出库明细",
layout: "border",
region: 'center',
items: [this.gridList//, this.gridListWmsRateDetail
]
});
this.page_2 = new Ext.Panel({
border: false,
id: "page_2",
autoScroll: true,
title: "出库相关应收应付费用",
layout: "border",
region: 'center',
items: [this.panelFee]
});
this.MainTab = new Ext.tab.Panel({
border: false,
layout: "border",
region: "center", split: true,
items: [this.page_1, this.page_2]
});
Ext.apply(this, {
border: false,
items: [this.panelTop, this.MainTab]
});
//#endregion
//#region 页面加载
if (this.opStatus == 'edit') {
this.onRefreshClick("");
this.InitData();
this.blISLOCK = this.EditRecord.data.ISLOCK;
this.setBtn();
var sBSNO = this.EditRecord.data.BSNO;
this.LoadData("OUTBSNO_OUT='" + sBSNO + "'");
}
else {
this.onRefreshClick(" and 1<0");
}
//#endregion
}, //end initUIComponents
//#region 加载事件
InitData: function () {
this.panelFee.StoreCustType.add({ "SCUSTTYPE": "WTDW-委托单位", "CUSTTYPE": "委托单位", "CUSTNAME": "CUSTOMERNAME" });
this.panelFee.StoreCustType.add({ "SCUSTTYPE": "BGH-报关行", "CUSTTYPE": "报关行", "CUSTNAME": "CUSTOMSER" });
this.panelFee.StoreCustType.add({ "SCUSTTYPE": "HG-海关", "CUSTTYPE": "海关", "CUSTNAME": "BYCUSTOM" });
this.panelFee.StoreCustType.add({ "SCUSTTYPE": "DCDL-订舱代理", "CUSTTYPE": "订舱代理", "CUSTNAME": "FORWARDER" });
this.panelFee.StoreCustType.add({ "SCUSTTYPE": "DL-代理", "CUSTTYPE": "代理", "CUSTNAME": "AGENTID" });
this.panelFee.StoreCustType.add({ "SCUSTTYPE": "CZ-场站", "CUSTTYPE": "场站", "CUSTNAME": "YARD" });
this.panelFee.StoreCustType.add({ "SCUSTTYPE": "CGS-船公司", "CUSTTYPE": "船公司", "CUSTNAME": "CARRIER" });
this.panelFee.StoreCustType.add({ "SCUSTTYPE": "CD-车队", "CUSTTYPE": "车队", "CUSTNAME": "TRUCKER" });
this.panelFee.StoreDrOpRange.load({ params: { optype: "modOtherRecvFeeManagement"} }); //需求编号SR2017061800001-7
this.panelFee.StoreCrOpRange.load({ params: { optype: "modOtherPayFeeManagement"} }); //需求编号SR2017061800001-7
this.panelFee.StoreUnit.load({ params: { bsno: this.panelFee.strBSNO, bstype: "op_other"} }); //需求编号SR2017061800001-7
this.panelFee.storeFeeNameRef.load({ params: { condition: ""} });
this.panelFee.StoreDateCurr.load({ params: { optype: "op_other", bsno: this.panelFee.strBSNO} }); //需求编号SR2017061800001-7
this.panelFee.storeDrChFee.load({ params: { billno: this.panelFee.strBSNO, type: 1, optype: "op_other"} }); //需求编号SR2017061800001-7
this.panelFee.storeCrChFee.load({ params: { billno: this.panelFee.strBSNO, type: 2, optype: "op_other"} }); //需求编号SR2017061800001-7
this.panelFee.storeBodySum.load({ params: { bsno: this.panelFee.strBSNO, optype: "op_other" }, //需求编号SR2017061800001-7
callback: function (r, options, success) {
if (success) {
_thisfee.setTotalHead();
}
}
});
this.panelFee.storeChFeeGain.load({ params: { bsno: this.panelFee.strBSNO, optype: "op_other"} }); //需求编号SR2017061800001-7
}, //end InitData
LoadData: function (condition) {
this.serialNo = 0;
Ext.Ajax.request({
waitMsg: '正在查询数据...',
url: '/MvcShipping/WMSOUT_GuiGe/GetData',
params: { 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.INFO, buttons: Ext.Msg.OK });
return;
}
//
data = result.data;
this.formHead.getForm().findField('OUTGID').setDisabled(false);
this.formHead.getForm().reset();
this.formHead.getForm().setValues(data);
this.formHead.getForm().findField('OLDCUSTFEEDATE').setValue(data.OLDCUSTFEEDATE.toString().substring(0, 10));
this.formHead.getForm().findField('OUTGID').setDisabled(true);
//
var condition2 = "WMSOUTGID='" + data.OUTGID + "'";
this.storeWmsRateDetailList.load({
params: { condition: condition2 },
waitMsg: "正在刷新数据...",
timeout: 6000000, //60秒
scope: this
});
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
//this.GetEditStatus();
}, // end LoadDate
//#endregion
//#region 查询
onRefreshClick: function (sCondition) {
var sql = this.getCondition();
if (sCondition.toString().trim() != "" && sCondition.toString().trim() != "[object Object]") {
sql += sCondition;
}
this.sqlcontext = sql;
this.storeDetailList.load({
params: { start: 0, limit: this.PageSize, sort: '', opStatus: this.opStatus, condition: sql },
waitMsg: "正在刷新数据...",
timeout: 6000000, //30秒
scope: this
});
//this.panelFee.hide(); //隐藏按钮
if (this.opStatus == 'edit') {
//this.panelFee.show(); //显示按钮
var sBSNO = this.EditRecord.data.BSNO;
this.LoadData("OUTBSNO_OUT='" + sBSNO + "'");
}
},
getCondition: function () {
var sql = ''; //' GOODSSTOCK>0 ';
if (this.opStatus == 'edit') {
var sBSNO = this.EditRecord.data.BSNO;
sql = sql + getAndConSql(sql, sBSNO, "OUTBSNO_OUT='" + sBSNO + "'");
}
else {
var dl = 0;
sql = sql + getAndConSql(sql, "GOODSSTOCK", " GOODSSTOCK > 0 ");
// sql += "(GOODSPACKSTOCK<>" + dl + ")"; // or GOODSSTOCK<>" + dl + "
}
//箱号
var sBLNO = this.formSearch.getForm().findField('CNTRNO').getValue();
var sBOXCOUNT = this.formSearch.getForm().findField('BOXCOUNT').getValue();
if (sBLNO != null && sBLNO != "") {
if (sBOXCOUNT <= 0) {
sql = sql + getAndConSql(sql, sBLNO, "CNTRNO like '%" + sBLNO.toString().trim() + "%'");
} else {
var CNTRNO = sBLNO.toString().trim()
var getstartno = new RegExp(/\d+$/);
var startno = getstartno.exec(CNTRNO);
var CNTRNOString = CNTRNO.replace(startno, "");
var NumberCount = sBOXCOUNT + 0;
var _Sql = "CNTRNO in ('" + CNTRNO + "'";
for (var i = 1; i < NumberCount; i++) {
var thisno = CNTRNOString + (parseInt(startno) + parseInt(i));
_Sql += ",'" + thisno + "'"
}
_Sql += ")";
sql = sql + getAndConSql(sql, sBLNO, _Sql);
}
}
//入库单号
var sWMSNO = this.formSearch.getForm().findField('WMSNO').getValue();
if (sWMSNO != null) {
if (sWMSNO != "") {
sql = sql + getAndConSql(sql, sWMSNO, "WMSNO like '%" + sWMSNO.toString().trim() + "%'");
}
}
//委托单位
var sCUSTOMERNAME = this.formSearch.getForm().findField('CUSTOMERNAME').getValue();
if (sCUSTOMERNAME != null) {
if (sCUSTOMERNAME != "") {
sql = sql + getAndConSql(sql, sCUSTOMERNAME, "CUSTOMERNAME='" + sCUSTOMERNAME.toString().trim() + "'");
}
}
//所属仓库
var sSTORAGENAME = this.formSearch.getForm().findField('STORAGENAME').getValue();
if (sSTORAGENAME != null) {
if (sSTORAGENAME != "") {
sql = sql + getAndConSql(sql, sSTORAGENAME, "STORAGENAME='" + sSTORAGENAME.toString().trim() + "'");
}
}
//品名
var sGOODSNAME = this.formSearch.getForm().findField('GOODSNAME').getValue();
if (sGOODSNAME != null) {
if (sGOODSNAME != "") {
sql = sql + getAndConSql(sql, sGOODSNAME, "GOODSNAME='" + sGOODSNAME.toString().trim() + "'");
}
}
//品名明细表_规格
var sGOODSDETAILNAME = this.formSearch.getForm().findField('GOODSDETAILNAME').getValue();
if (sGOODSDETAILNAME != null) {
if (sGOODSDETAILNAME != "") {
sql = sql + getAndConSql(sql, sGOODSDETAILNAME, "GOODSMODEL='" + sGOODSDETAILNAME.toString().trim() + "'");
}
}
//批次号
var PICIHAO = this.formSearch.getForm().findField('PICIHAO').getValue();
if (PICIHAO != null) {
if (PICIHAO != "") {
sql = sql + getAndConSql(sql, PICIHAO, "PICIHAO like '%" + PICIHAO.toString().trim() + "%'");
}
}
//进口国
var COUNTRYID = this.comboxCountry.getValue();
if (COUNTRYID != '' && COUNTRYID != null) {
sql = sql + getAndConSql(sql, COUNTRYID, " countryid='" + COUNTRYID + "' ");
}
if (this.pcnostr != "") {
sql = sql + getAndConSql(sql, this.pcnostr, "PICIHAO IN (" + this.pcnostr + ") ");
}
if (sql != '') {
sql += ' and ISLOCK=1 and ISLOCK2=0'; //需求编号SR2017061400006-1
} else {
sql += 'ISLOCK=1 and ISLOCK2=0';
}
return sql;
},
onClearSql: function () {
var form = this.formSearch.getForm();
form.reset();
},
//#endregion
//#region 按键事件
onNextKeyClick: function (col) {
var rows = this.gridList.getSelectionModel().getSelection();
var row = rows[rows.length - 1];
if (col == 15) {
row = rows[rows.length];
col == 11;
}
var s = this.gridList.getStore();
var number = s.indexOf(row);
this.gridListCellEditing.startEditByPosition({ row: number, column: col });
},
//#endregion
//#region 新建
onAddClick: function () {
this.opStatus = 'add';
this.pcnostr = "";
this.onClearSql();
this.formHead.getForm().findField('OUTGID').setDisabled(false);
this.formHead.getForm().reset();
this.formHead.getForm().findField('OUTGID').setDisabled(true);
this.storeDetailList.load({
params: { start: 0, limit: this.PageSize, sort: '', opStatus: this.opStatus, condition: "1<0" },
waitMsg: "正在刷新数据...",
timeout: 6000000, //60秒
scope: this
});
this.storeWmsRateDetailList.load({
params: { condition: "1<0" },
waitMsg: "正在刷新数据...",
timeout: 6000000, //60秒
scope: this
});
},
//#endregion
//#region 保存
Save: function (type) {
this.formHead.getForm().findField('OUTGID').setDisabled(false);
var data = this.formHead.getForm().getValues(false, false, false);
this.formHead.getForm().findField('OUTGID').setDisabled(true);
//
if (this.outType == "货权转移") {
var sCLIENTNAMEOLD = Ext.getCmp('CLIENTNAMEOLD').getValue();
if (sCLIENTNAMEOLD == null) {
Ext.Msg.show({ title: '提示', msg: '货权转移对象不能为空!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
else {
if (sCLIENTNAMEOLD == "") {
Ext.Msg.show({ title: '提示', msg: '货权转移对象不能为空!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
}
}
//
var bodydatas = [];
for (var i = 0; i < this.storeDetailList.getCount(); i += 1) {
var dlGOODSPACKPFSL_OUT = this.storeDetailList.getAt(i).get("GOODSPACKPFSL_OUT"); //出库件数
var dlGOODSPFSL_OUT = this.storeDetailList.getAt(i).get("GOODSPFSL_OUT"); //出库立方
var dlGOODSNUM = this.storeDetailList.getAt(i).get("GOODSNUM"); //完税件数
var dlGOODSPACKSTOCK = this.storeDetailList.getAt(i).get("GOODSPACKSTOCK"); //剩余件数
if (this.opStatus == 'edit') {
dlGOODSNUM = this.storeDetailList.getAt(i).get("GOODSNUM") + dlGOODSPACKPFSL_OUT; //完税件数
dlGOODSPACKSTOCK = this.storeDetailList.getAt(i).get("GOODSPACKSTOCK") + dlGOODSPACKPFSL_OUT; //剩余件数
}
if (dlGOODSPACKPFSL_OUT != 0 || dlGOODSPFSL_OUT != 0) // && dlGOODSPFSL_OUT != 0
{
var member = this.storeDetailList.getAt(i);
var blISBONDED = this.storeDetailList.getAt(i).get("ISBONDED").toString(); //是否报税业务//需求编号SR2017061900001-1
if (blISBONDED == "true") {
if (dlGOODSPACKPFSL_OUT > dlGOODSNUM) {
continue;
}
}
if (dlGOODSPACKPFSL_OUT > dlGOODSPACKSTOCK) {
continue;
}
//出库日期不能小于入库日期//需求编号SR2017073000001
var rqWMSDATE = member.data.WMSDATE; //入库日期
var rqDODATE_OUT = this.formHead.getForm().findField('DODATE_OUT').getRawValue(); //出库日期
if (rqWMSDATE > rqDODATE_OUT) {
continue;
}
//需求编号SR2017073000001
var sZHUANGXIEGONGID_OUT = member.data.ZHUANGXIEGONGID_OUT.toString();
var comboxList = DsStoreQueryBy(this.storeZhuangXieGong, 'NAME', sZHUANGXIEGONGID_OUT);
if (comboxList.length > 0) {
var comboxRaw = comboxList.getAt(0).raw;
member.set("ZHUANGXIEGONGID_OUT", comboxRaw.GID.toString());
}
member.data.ISLOCK = member.data.ISLOCK == true ? 1 : 0;
member.data.ISLOCK2 = member.data.ISLOCK2 == true ? 1 : 0;
member.data.ISBONDED = member.data.ISBONDED == true ? 1 : 0;
member.data.ISDELETE = member.data.ISDELETE == true ? 1 : 0;
bodydatas.push(member);
}
}
if (bodydatas.length > 0) {
var jsonBody = ConvertRecordsToJsonAll(bodydatas);
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/MvcShipping/WMSOUT_GuiGe/SaveEdit_Box',
params: { opStatus: this.opStatus, data: Ext.JSON.encode(data), body: jsonBody, outType: this.outType },
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
if (this.opStatus == 'add') {
this.opStatus = 'edit';
}
var returnData = jsonresult.Data;
var editp = Ext.create('VwWmsDetailModel', returnData);
this.panelFee.EditRecord = editp;
this.panelFee.strBSNO = returnData.OUTGID;
this.panelFee.strMBLNO = returnData.OUTBSNO_OUT;
this.InitData();
this.formHead.getForm().findField('OUTGID').setDisabled(false);
this.formHead.getForm().findField('OUTGID').setValue(returnData.OUTGID);
this.formHead.getForm().findField('OUTBSNO_OUT').setValue(returnData.OUTBSNO_OUT);
this.formHead.getForm().findField('OLDCUSTFEEDATE').setValue(returnData.OLDCUSTFEEDATE.toString().substring(0, 10));
this.formHead.getForm().findField('OUTGID').setDisabled(true);
//
var condition = "OUTBSNO_OUT='" + returnData.OUTBSNO_OUT + "'";
this.storeDetailList.load({
params: { start: 0, limit: this.PageSize, sort: '', opStatus: this.opStatus, condition: condition },
waitMsg: "正在刷新数据...",
timeout: 6000000, //60秒
scope: this
});
//
var condition2 = "WMSOUTGID='" + returnData.OUTGID + "'";
this.storeWmsRateDetailList.load({
params: { condition: condition2 },
waitMsg: "正在刷新数据...",
timeout: 6000000, //60秒
scope: this
});
//this.panelFee.show(); //显示按钮
//
if (this.btnRefresh == null) {
}
else {
var btn = opener.document.getElementById(this.btnRefresh.id);
btn.click();
}
} 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.WARNING, buttons: Ext.Msg.OK });
}
},
scope: this
});
} else {
Ext.Msg.show({ title: '错误', msg: '请先确定出库数据是否正确,再重试!', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
}, //end save
//#endregion
//#region 费用入账//需求编号SR2017073000001
setislock: function (button, event) {
if (this.opStatus == "add") {
Ext.Msg.show({ title: '提示', msg: '请先保存单据!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
//
//var sBSNO = this.EditRecord.data.BSNO;
//this.LoadData("OUTBSNO_OUT='" + sBSNO + "'");
var sOUTGID = this.formHead.getForm().findField('OUTGID').getValue();
//
Ext.MessageBox.confirm('提示', '确定入账该记录吗?', function (btn) {
if (btn == 'yes') {
Ext.Msg.wait('正在入账数据...');
Ext.Ajax.request({
waitMsg: '正在入账数据...',
url: '/MvcShipping/WMSOUT_GuiGe/setislock',
params: {
sOUTGID: sOUTGID
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
this.panelFee.LoadDrChFee2("bsno='" + sOUTGID + "' and feetype=1");
this.panelFee.LoadCrChFee2("bsno='" + sOUTGID + "' and feetype=2");
this.blISLOCK = true;
this.setBtn();
//
if (this.btnRefresh == null) {
}
else {
var btn = opener.document.getElementById(this.btnRefresh.id);
btn.click();
}
//
Ext.Msg.show({ title: '提示', msg: '入账成功!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
else {
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
}
},
failure: function (response, options) {
Ext.Msg.show({ title: '警告', msg: '服务器响应出错,请重试', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
},
scope: this
});
}
}, this);
},
//#endregion
//#region 取消入账//需求编号SR2017073000001
setnotlock: function (button, event) {
if (this.opStatus == "add") {
Ext.Msg.show({ title: '提示', msg: '请先保存单据!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var sOUTGID = this.formHead.getForm().findField('OUTGID').getValue();
//
Ext.MessageBox.confirm('提示', '确定取消入账吗?', function (btn) {
if (btn == 'yes') {
Ext.Msg.wait('正在取消入账数据...');
Ext.Ajax.request({
waitMsg: '正在取消入账数据...',
url: '/MvcShipping/WMSOUT_GuiGe/setnotlock',
params: {
sOUTGID: sOUTGID
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
this.panelFee.LoadDrChFee2("bsno='" + sOUTGID + "' and feetype=1");
this.panelFee.LoadCrChFee2("bsno='" + sOUTGID + "' and feetype=2");
this.blISLOCK = false;
this.setBtn();
//
if (this.btnRefresh == null) {
}
else {
var btn = opener.document.getElementById(this.btnRefresh.id);
btn.click();
}
//
Ext.Msg.show({ title: '提示', msg: '取消入账成功!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
else {
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
}
},
failure: function (response, options) {
Ext.Msg.show({ title: '警告', msg: '服务器响应出错,请重试', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
},
success: function (response, options) {
},
scope: this
});
}
}, this);
},
//#endregion
//#region 按钮是否显示
setBtn: function () {
if (this.blISLOCK) {
Ext.getCmp('btnAdd').setVisible(false);
Ext.getCmp('btnSave').setVisible(false);
Ext.getCmp('btIslock').setVisible(false);
Ext.getCmp('btNotIslock').setVisible(true);
}
else {
Ext.getCmp('btnAdd').setVisible(true);
Ext.getCmp('btnSave').setVisible(true);
Ext.getCmp('btIslock').setVisible(true);
Ext.getCmp('btNotIslock').setVisible(false);
};
},
//#endregion
//#region 打印
Print: function (button, event) {
if (this.opStatus == "edit") {
var sOUTBSNO_OUT = this.formHead.getForm().findField('OUTBSNO_OUT').getValue();
var condition = "OUTBSNO_OUT='" + sOUTBSNO_OUT + "'";
Ext.Ajax.request({
waitMsg: '正在组织数据, 请稍侯...',
url: '/MvcShipping/WMSOUT_GuiGe/GetDataListStr',
params: { condition: condition },
callback: function (options, success, response) {
if (success) {
if (Ext.MessageBox.isVisible()) { Ext.MessageBox.hide(); }
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
var returnStr = jsonresult.data;
var printType = 'WMSOUT_GuiGeEdit';
var sql1 = returnStr;
var sql2 = "";
var sql3 = "";
var sql4 = "";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
} 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 });
}
},
scope: this
});
}
}
//#endregion
//#region 打印出库列表
, Print_OUT: function () { //费用通知_无过程
var basicForm = this.formHead.getForm();
var OUTBSNO_OUT = basicForm.findField('OUTBSNO_OUT').value;
if (OUTBSNO_OUT == "") {
alert("请先保存修改");
return;
}
var printType = 'WMSOUT_LTJY'; //
//
var sql1 = " SELECT * from VW_WMS_DETAIL where OUTBSNO_OUT='" + OUTBSNO_OUT + "' and ISLOCK=1 and ISLOCK2=0 order by CUSTOMERNAME,BLNO,WMSNO,WMSDATE,BSNO_OUT ";
var sql2 = "";
var sql3 = "";
var sql4 = "";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
}
//#endregion
//#region 打印出库列表
, OUTALL: function () { //费用通知_无过程
this.storeDetailList.each(function (record) {
if (record.get('GOODSSTOCK') > 0) {
record.set('GOODSPFSL_OUT', record.get('GOODSSTOCK'));
}
});
}
//#endregion
});