Ext.namespace('Shipping');
String.prototype.trim = function () { return this.replace(/(^\s*)|(\s*$)/g, ""); }
Shipping.WMSOUT_GuiGeIndex = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.WMSOUT_GuiGeIndex.superclass.constructor.call(this);
};
Ext.extend(Shipping.WMSOUT_GuiGeIndex, Ext.Panel, {
PageSize: 50,
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
sqlcontext: '',
outType: null,
initUIComponents: function () {
this.formname = "formWMSOUT_GuiGeIndex"; //需求编号:SR2017051700006,根据领导要求添加 仓储按规格出库模块
//#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: '客户名称',
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,
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.CodeGoodsModel',
proxy: { url: '/CommMng/BasicDataRef/GetCodeGoodsList' }
});
this.storeCodeGoodsList.load();*/
this.storeGoodsname = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.DICModel',
proxy: { url: '/CommMng/TruckBasicDataRef/GetCommaWord' }
});
this.storeGoodsname.load({ params: { tablename: "WMS_IN", columnname: "GoodsName", condition: ""} });
this.comboxGOODSNAME = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '品名',
store: this.storeGoodsname,
//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,
forceSelection: true,
name: 'GOODSDETAILNAME',
valueField: 'GOODSDETAILNAME',
displayField: 'GOODSDETAILNAME',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
//是否保税业务//需求编号:SR2017071300002-2
Ext.define('ISBONDEDModel', { extend: 'Ext.data.Model', fields: [{ name: 'Name', type: 'string'}] });
var dataISBONDED = [{ "Name": "" }, { "Name": "是" }, { "Name": "否"}];
var storeISBONDED = Ext.create('Ext.data.Store', { model: 'ISBONDEDModel', data: dataISBONDED });
this.comboxISBONDED = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '是否保税',
forceSelection: true,
store: storeISBONDED,
name: 'ISBONDED',
labelAlign: 'right',
valueField: 'Name',
displayField: 'Name',
enableKeyEvents: true, //激活键盘事件
listeners: {
scope: this,
'keyup': {
fn: function (_field, e) {
if (e.getKey() == 13) {
this.onRefreshClick();
}
},
scope: this
}
}
});
//#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: '进口国',
forceSelection: true,
store: this.storeCountry,
name: 'COUNTRYID',
valueField: 'countryid',
displayField: 'country_idandname'
});
//#endregion
//#endregion
//#region formSearch 查询面板
this.formSearch = Ext.widget('form', {
frame: true,
region: 'center',
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: '编号', //需求编号:SR2017103100003
name: 'NO',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}
// ,{
// fieldLabel: '提单号', //需求编号:SR2017071300002-2
// name: 'MBLNO',
// enableKeyEvents: true,
// listeners: {
// keyup: function (field, e) {
// if (e.getKey() == e.ENTER) {
// _this.onRefreshClick();
// }
// }
// }
// }, {
// fieldLabel: '入库单号', //需求编号:SR2017071300002-2
// name: 'WMSNO',
// enableKeyEvents: true,
// listeners: {
// keyup: function (field, e) {
// if (e.getKey() == e.ENTER) {
// _this.onRefreshClick();
// }
// }
// }
// }, {
// fieldLabel: '出库单号', //需求编号:SR2017071300002-2
// name: 'BSNO',
// enableKeyEvents: true,
// listeners: {
// keyup: function (field, e) {
// if (e.getKey() == e.ENTER) {
// _this.onRefreshClick();
// }
// }
// }
// }
, this.comboxCustCode//, this.comboxISBONDED
, {
fieldLabel: '出库日期',
xtype: 'datefield',
format: 'Y-m-d',
name: 'DODATEbgn',
editable: false,
enableKeyEvents: true, //激活键盘事件
listeners: {
scope: this,
'keyup': {
fn: function (_field, e) {
if (e.getKey() == 13) {
this.onRefreshClick();
}
},
scope: this
}
}
}, {
fieldLabel: '到',
xtype: 'datefield',
format: 'Y-m-d',
name: 'DODATEend',
editable: false,
enableKeyEvents: true, //激活键盘事件
listeners: {
scope: this,
'keyup': {
fn: function (_field, e) {
if (e.getKey() == 13) {
this.onRefreshClick();
}
},
scope: this
}
}
}, { xtype: 'hiddenfield' }//, this.comboxCountry
]//, { xtype: 'hiddenfield', flex: 1}//需求编号:SR2017071300002-2
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxSTORAGENAME, this.comboxGOODSNAME, this.comboxCodeGoodsDetail, {
fieldLabel: '备注', //需求编号:SR2017103100003
name: 'REMARK',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '牌号',
name: 'GOODSMODEL',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}
]
}]//end items(fieldset 1)
}]//end root items
});
var _this = this;
this.formSearch2 = Ext.widget('form', {
frame: true,
region: "west",
border: false,
width: 80,
items: [{
xtype: 'radiogroup',
id: 'rdLBYS',
name: 'rdLBYS',
//fieldLabel: '列表样式',
//flex: 2,
columns: 1,
//vertical: true,
horizontal: true,
items: [
{ id: 'rdoHJ', boxLabel: '合计列', name: 'OBJNUM', inputValue: '合计列' },
{ id: 'rdoMX', boxLabel: '明细列', name: 'OBJNUM', inputValue: '明细列', checked: true}//
],
listeners: {
change: function (rd, newValue, oldValue, eOpts) {
saveQuerySetting(_this.formname, _this.formSearch2, false, true);
_this.onRefreshClick();
if (newValue.OBJNUM.toString() == "合计列") {
_this.gridListHJ.show(); //显示按钮
_this.gridList.hide(); //隐藏按钮
}
else {
_this.gridList.show(); //显示按钮
_this.gridListHJ.hide(); //隐藏按钮
}
}
}
}]//end root items
});
//#endregion formSearch
//#region 合计列
//#region 定义数据集
//列表加载
this.storeListHJ = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
model: 'WMSOUT_GuiGeModel',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/WMSOUT_GuiGe/GetDataListHJ',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//#endregion
//#region 列定义
this.GridCheckBoxModelHJ = Ext.create('Ext.selection.CheckboxModel');
this.columns = [{
sortable: false,
dataIndex: 'GID',
header: '', //唯一编码
hidden: true,
width: 0
},
{
sortable: true,
dataIndex: 'ISLOCK',
header: '费用入账',
align: 'center',
width: 60,
renderer: function (value, cellmeta) {
if (value == true) {
return "";
}
}
},
{
sortable: true,
dataIndex: 'ISCHANGE',
header: '货权转移',
align: 'center',
width: 60,
renderer: function (value, cellmeta) {
if (value == true) {
return "";
}
}
},
{
sortable: true,
dataIndex: 'MBLNO',
header: '提单号', //需求编号:SR2017071300002-2
width: 120
},
{
sortable: true,
dataIndex: 'WMSNO',
header: '入库单号', //需求编号:SR2017071300002-2
width: 150
},
{
sortable: true,
dataIndex: 'BSNO',
header: '出库单号',
width: 120
},
{
sortable: true,
dataIndex: 'DODATE',
header: '出库时间',
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
align: 'center',
width: 80
},
{
sortable: true,
dataIndex: 'CUSTOMERNAME',
header: '客户名称',
width: 150
},
{
sortable: true,
dataIndex: 'STORAGENAME',
header: '所属仓库',
width: 150
},
{
sortable: true,
dataIndex: 'GOODSPFSL',
header: '出库量',
width: 150
}, {
sortable: true,
id: '',
dataIndex: 'DRFEESTATUS', //需求编号:SR2017071300002-1
header: '应收费用状态',
align: 'center',
width: 80,
renderer: function (value, meta) {
if (value == '审核通过') {
meta.tdCls = 'feestatus_pass';
} else if (value == '录入状态') {
} else if (value == '提交审核') {
meta.tdCls = 'feestatus_refer';
} else if (value == '部分结算') {
meta.tdCls = 'feestatus_refer';
} else if (value == '结算完毕') {
meta.tdCls = 'feestatus_settle';
} else if (value == '未录入') {
} else if (value == '部分结算') {
meta.tdCls = 'feestatus_settle';
} else if (value == '部分审核') {
meta.tdCls = 'feestatus_pass';
} else if (value == '部分提交') {
meta.tdCls = 'feestatus_refer';
}
return value;
}
},
{
sortable: true,
id: '',
dataIndex: 'CRFEESTATUS', //需求编号:SR2017071300002-1
header: '应付费用状态',
align: 'center',
width: 80,
renderer: function (value, meta) {
if (value == '审核通过') {
meta.tdCls = 'feestatus_pass';
} else if (value == '录入状态') {
} else if (value == '提交审核') {
meta.tdCls = 'feestatus_refer';
} else if (value == '部分结算') {
meta.tdCls = 'feestatus_refer';
} else if (value == '结算完毕') {
meta.tdCls = 'feestatus_settle';
} else if (value == '未录入') {
} else if (value == '部分结算') {
meta.tdCls = 'feestatus_settle';
} else if (value == '部分审核') {
meta.tdCls = 'feestatus_pass';
} else if (value == '部分提交') {
meta.tdCls = 'feestatus_refer';
}
return value;
}
},
{
sortable: true,
dataIndex: 'ISBONDED',
header: '是否保税业务', //需求编号:SR2017071300002-2
align: 'center',
width: 80
},
{
sortable: true,
dataIndex: 'REMARK',
header: '备注',
width: 200
},
{
sortable: true,
dataIndex: 'MODIFIEDUSERNAME',
header: '最后一次操作人',
align: 'center',
width: 100
},
{
sortable: true,
dataIndex: 'MODIFIEDTIME',
header: '最后一次操作时间',
align: 'center',
width: 140
},
{
sortable: true,
dataIndex: 'GOODSNAME',
header: '品名',
align: 'center',
width: 140
},
{
sortable: true,
dataIndex: 'PICIHAO',
header: '批次号',
align: 'center',
width: 80
},
{
sortable: true,
dataIndex: 'FilePath',
header: '附件文件名',
width: 200,
//return '' + value + '';
renderer: function (value, p, record) {
if (value == '') {
//return ' 已有附件 ';
}
}
];
this.girdcolumsHJ = this.columns;
this.girdcolumsHJ = DsTruck.GetGridPanel(USERID, this.formname, this.girdcolumsHJ, 0); //使用者id,表名,中间column数组,跳过一开始的几列
//#endregion
//#region gridList列表显示信息
this.gridListHJ = new Ext.grid.GridPanel({
store: this.storeListHJ,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
columns: this.girdcolumsHJ,
selModel: this.GridCheckBoxModelHJ,
columnLines: true, //是否显示列分割线,默认为false
iconCls: 'icon-grid',
renderTo: Ext.getBody(),
bbar: Ext.create('Ext.PagingToolbar', {
store: this.storeListHJ,
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"
})
});
this.gridListHJ.addListener('itemdblclick', function (dataview, record, item, index, e, b) {
this.SelectedRecord = record;
this.OprationStatus = 'edit';
if (record.data.ISCHANGE) {
this.outType = "货权转移";
DsOpenEditWin('/MvcShipping/WMSOUT_GuiGe_LTJY/Edit', "货权转移");
}
else {
this.outType = "出库单";
DsOpenEditWin('/MvcShipping/WMSOUT_GuiGe_LTJY/Edit', "出库单");
}
}, this);
//#endregion
//#endregion
//#region 按钮工具条/页面布局
var _this = this;
this.panelBtn = new Ext.Panel({
layout: "border",
region: "center",
border: false,
tbar: [
// {
// text: "新建",
// iconCls: "btnadd",
// handler: function (button, event) {
// this.OprationStatus = 'add';
// this.outType = "";
// DsOpenEditWin('/MvcShipping/WMSOUT_GuiGe/Edit', "出库明细");
// },
// scope: this
// },
{
text: "新建",
iconCls: "btnadd",
menu: [{ text: "出库单",
handler: function (button, event) {
_this.OprationStatus = 'add';
_this.outType = "出库单";
DsOpenEditWin('/MvcShipping/WMSOUT_GuiGe_LTJY/Edit', "出库单");
}
}, {
text: "货权转移",
handler: function (menu, event) {
_this.OprationStatus = 'add';
_this.outType = "货权转移";
DsOpenEditWin('/MvcShipping/WMSOUT_GuiGe_LTJY/Edit', "货权转移");
}
}],
scope: this
}, '-', {
text: "查询",
id: "btnRefresh",
iconCls: "btnrefresh",
handler: function (button, event) {
this.onRefreshClick();
},
scope: this
}, {
text: "重置条件",
iconCls: "btnreset",
handler: function (button, event) {
this.onClearSql(button, event);
},
scope: this
}, '-', {
text: "删除",
iconCls: "btndelete",
handler: function (button, event) {
this.onDeleteClick(button, event);
},
scope: this
}, '-', {
text: "保存列表样式",
menu: [{ text: "保存",
handler: function (button, event) {
_this.girdcolumsHJ = DsTruck.SaveGridPanel(USERID, _this.formname, _this.gridListHJ.columns, _this.girdcolumsHJ, 0, true); //使用者id,表名,中间column数组,跳过一开始的几列
}
}, { text: "初始化",
handler: function (menu, event) {
_this.gridListHJ.reconfigure(_this.storeListHJ, _this.columns);
_this.girdcolumsHJ = DsTruck.SaveGridPanel(USERID, _this.formname, _this.gridListHJ.columns, _this.columns, 0, true); //使用者id,表名,中间column数组,跳过一开始的几列
}
}],
scope: this
}, '-', {
text: "发送出库入库报文",
iconCls: "btnrefresh",
handler: function (button, event) {
this.onSendXMLClick(button, event);
},
scope: this
}, {
text: "打印", //"打印",
iconCls: 'btnprint',
menu: [
{ text: "全部", //"全部",
handler: function (menu, event) {
_this.onPrintClick();
}
}, { text: "选择打印", //"选择打印",
handler: function (menu, event) {
_this.PrintSelect();
}
}],
scope: this
}
// , {
// text: "导出",
// id: "btnExportExcel",
// iconCls: 'btnexportexcel',
// menu: [{
// text: "出库列表",
// handler: function (menu, event) {
// _this.onExportClick(1);
// }
// }
//// , {
//// text: "明细列表",
//// handler: function (menu, event) {
//// _this.onExportClick(2);
//// }
//// }, {
//// text: "财务软件",
//// handler: function (menu, event) {
//// _this.onExportClick3();
//// }
//// }
// ],
// scope: this
// }
// , {
// text: '打印',
// tooltip: '打印',
// id: "btnprint",
// iconCls: "btnprint",
// menu: [{
// text: "出库列表",
// handler: function (menu, event) {
// _this.Print(1);
// }
// }
//// , {
//// text: "明细列表",
//// handler: function (menu, event) {
//// _this.Print(2);
//// }
//// }
// ],
// scope: this
// }
// , '-', {
// text: "审核",
// iconCls: "btislock",
// handler: function (button, event) {
// this.setISCHECKED(1);
// },
// scope: this
// }, {
// text: "返审",
// iconCls: "btnotislock",
// handler: function (button, event) {
// this.setISCHECKED(0);
// },
// scope: this
// }
]
});
this.panelZQ = new Ext.Panel({
layout: "border",
region: "east",
width: 500,
style: 'text-align:right;',
border: false,
items: [{
xtype: 'displayfield',
id: 'lbTitle2',
name: 'lbTitle2',
value: " "
}]
});
this.panelTopF = new Ext.Panel({
layout: "border",
region: "north",
height: 26,
//border: false,
items: [this.panelBtn]//, this.panelZQ
});
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 90,
border: false,
items: [this.panelTopF, this.formSearch]//, this.formSearch2
});
Ext.apply(this, {
border: false,
items: [this.panelTop, this.gridListHJ]//, this.gridList
});
//#endregion
//#region 页面加载
//this.gridList.show(); //显示按钮
//this.gridListHJ.hide(); //隐藏按钮
this.InitData();
//#endregion
//#region 下载窗体
this.formDownloadShow = Ext.widget('form', {
frame: true,
region: 'center',
height: 100,
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 90,
msgTarget: 'qtip'
},
items: [{
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
id: 'downloadfile',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'label',
html: '',
width: 120,
text: ''
}]
}]
});
me = this;
this.winDownloadShow = Ext.create('Ext.window.Window', {
title: "下载文件",
width: 450,
height: 120,
//plain : true,
iconCls: "addicon",
resizable: false,
// draggable:false,// 是否可以拖动
collapsible: true, // 允许缩放条
closeAction: 'close',
closable: true,
modal: 'true',
buttonAlign: "center",
bodyStyle: "padding:0 0 0 0",
items: [this.formDownloadShow],
buttons: [{
text: "关闭",
minWidth: 70,
handler: function () {
me.winDownloadShow.close();
}
}]
});
//#endregion
this.gridListHJ.addListener('itemcontextmenu', this.itemcontextmenu);
}, //end initUIComponents
//#region 加载事件
InitData: function () {
//LoadQueryData(this.formname, this.formSearch2, this.CheckSaveQuery);
//
this.storeListHJ.on('beforeload', function (store) {
var sql = this.getCondition();
this.sqlcontext = sql;
if (sql.toString() != "") {
Ext.apply(store.proxy.extraParams, { condition: sql });
}
}, this);
// this.storeList.on('beforeload', function (store) {
// var sql = this.getCondition();
// this.sqlcontext = sql;
// if (sql.toString() != "") {
// Ext.apply(store.proxy.extraParams, { condition: sql });
// }
// }, this);
// //
// this.storeList.on('refresh', function (store) {
// //mergeCells(this.gridList, [2, 3, 4, 5, 10, 11, 12, 0]); // 加载完成后,执行函数
// }, this)
this.onRefreshClick();
}, //end InitData
//#endregion
//#region 查询
onRefreshClick: function () {
var sql = this.getCondition();
this.sqlcontext = sql;
// if (Ext.getCmp('rdLBYS').getValue().OBJNUM.toString() == "合计列") {
// this.storeListHJ.load({
// params: { start: 0, limit: this.PageSize, sort: '', condition: sql },
// waitMsg: "正在刷新数据...",
// timeout: 6000000, //30秒
// scope: this
// });
// } else {
// this.storeList.load({
// params: { start: 0, limit: this.PageSize, sort: '', condition: sql },
// waitMsg: "正在刷新数据...",
// timeout: 6000000, //30秒
// scope: this
// });
// }
this.storeListHJ.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: sql },
waitMsg: "正在刷新数据...",
timeout: 6000000, //30秒
scope: this
});
},
getCondition: function () {
var sql = '';
//提单号//需求编号:SR2017071300002-2
// var MBLNO = this.formSearch.getForm().findField('MBLNO').getValue();
// if (MBLNO != null) {
// if (MBLNO != "") {
// sql = sql + getAndConSql(sql, MBLNO, "ASSOCIATEDNO in (select bsno from v_op_bs where MBLNO like '%" + MBLNO.toString().trim() + "%')");
// }
// }
// //入库单号//需求编号:SR2017071300002-2
// var WMSNO = this.formSearch.getForm().findField('WMSNO').getValue();
// if (WMSNO != null) {
// if (WMSNO != "") {
// sql = sql + getAndConSql(sql, WMSNO, "[BSNO] in (select OUTBSNO from wms_out_detail where INBSNO in (select gid from wms_in where ASSOCIATEDNO in (select gid from wms where WMSNO like '%" + WMSNO.toString().trim() + "%')))");
// }
// }
// //出库单号//需求编号:SR2017071300002-2
// var BSNO = this.formSearch.getForm().findField('BSNO').getValue();
// if (BSNO != null) {
// if (BSNO != "") {
// sql = sql + getAndConSql(sql, BSNO, "[BSNO] like '%" + BSNO.toString().trim() + "%'");
// }
// }
//需求编号:SR2017103100003
var NO = this.formSearch.getForm().findField('NO').getValue();
if (NO != null) {
if (NO != "") {
sql = sql + getAndConSql(sql, NO, "([BSNO] like '%" + NO + "%' or " +
"[BSNO] in (select OUTBSNO from wms_out_detail where INBSNO in (select gid from wms_in where ASSOCIATEDNO in (select gid from wms where WMSNO like '%" + NO + "%'))) or " +
"ASSOCIATEDNO in (select bsno from v_op_bs where MBLNO like '%" + NO + "%') or" +
"(SELECT wi.PICIHAO+'/'FROM wms_in wi where wi.ASSOCIATEDNO=wms_out.ASSOCIATEDNO FOR XML PATH('')) like '%" + NO + "%')");
}
}
//是否保税业务//需求编号:SR2017071300002-2
/*
var ISBONDED = this.formSearch.getForm().findField('ISBONDED').getValue();
if (ISBONDED != null) {
if (ISBONDED == "是") {
sql = sql + getAndConSql(sql, ISBONDED, "ASSOCIATEDNO in (select bsno from op_seai where ISBONDED=1)");
}
else if (ISBONDED == "否") {
sql = sql + getAndConSql(sql, ISBONDED, "ASSOCIATEDNO in (select bsno from op_seai where ISBONDED=0)");
}
}*/
//出库日期
var DODATEbgn = this.formSearch.getForm().findField('DODATEbgn').getRawValue();
if (DODATEbgn != null) {
if (DODATEbgn != "") {
sql = sql + getAndConSql(sql, DODATEbgn, "DODATE >='" + DODATEbgn.toString().trim() + "'");
}
}
var DODATEend = this.formSearch.getForm().findField('DODATEend').getRawValue();
if (DODATEend != null) {
if (DODATEend != "") {
sql = sql + getAndConSql(sql, DODATEend, "DODATE <='" + DODATEend.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 sREMARK = this.formSearch.getForm().findField('REMARK').getValue();
if (sREMARK != null) {
if (sREMARK != "") {
sql = sql + getAndConSql(sql, sREMARK, "REMARK='" + sREMARK.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, "BSNO in (select OUTBSNO from wms_out_detail where GOODSNAME='" + sGOODSNAME.toString().trim() + "')");
sql = sql + getAndConSql(sql, sGOODSNAME, " EXISTS (select 1 from wms_out_detail where wms_out_detail.OUTBSNO=WMS_OUT.BSNO and wms_out_detail.GOODSNAME like '%" + sGOODSNAME.toString().trim() + "%')");
}
}
//品牌
var sGOODSMODEL = this.formSearch.getForm().findField('GOODSMODEL').getValue();
if (sGOODSMODEL != null) {
if (sGOODSMODEL != "") {
sql = sql + getAndConSql(sql, sGOODSMODEL, "BSNO in (select OUTBSNO from wms_out_detail where GOODSMODEL='" + sGOODSMODEL.toString().trim() + "')");
}
}
//品名明细表_规格
var sGOODSDETAILNAME = this.formSearch.getForm().findField('GOODSDETAILNAME').getValue();
if (sGOODSDETAILNAME != null) {
if (sGOODSDETAILNAME != "") {
sql = sql + getAndConSql(sql, sGOODSDETAILNAME, "BSNO in (select OUTBSNO from wms_out_detail where GOODSMODEL='" + sGOODSDETAILNAME.toString().trim() + "')");
}
}
//进口国
/*
var COUNTRYID = this.comboxCountry.getValue();
if (COUNTRYID != '' && COUNTRYID != null) {
sql = sql + getAndConSql(sql, COUNTRYID, " EXISTS(select 1 from wms where EXISTS(select * from wms_in where wms_in.BSNO=wms.GID and wms_in.countryid='" + COUNTRYID + "') and wms_out.ASSOCIATEDNO=wms.GID ) ");
}*/
return sql;
},
onClearSql: function () {
var form = this.formSearch.getForm();
form.reset();
this.InitData();
},
//#endregion
//#region 删除
onDeleteClick: function (button, event) {
var selections;
// if (Ext.getCmp('rdLBYS').getValue().OBJNUM.toString() == "合计列") {
// selections = this.gridListHJ.getSelectionModel().getSelection();
// }
// else {
// selections = this.gridList.getSelectionModel().getSelection();
// }
selections = this.gridListHJ.getSelectionModel().getSelection();
if (selections.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择业务!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
return;
}
//
var gids = "";
var sError = "";
for (var i = 0; i < selections.length; i++) {
var record = selections[i];
//if (record.get('ISCHECKED').toString() != "true") {
if (i == 0) {
gids = record.get('BSNO');
}
else {
gids += "," + record.get('BSNO');
}
//}
//else {
// sError = "(注:已经审核的业务不允许删除!)";
//}
}
//
if (gids.trim() == "") {
Ext.Msg.show({ title: '提示', msg: '请先选择业务!' + sError, icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
return;
}
else {
Ext.MessageBox.confirm('提示', '确定删除该记录吗?', function (btn) {
if (btn == 'yes') {
Ext.Msg.wait('正在删除数据...');
Ext.Ajax.request({
waitMsg: '正在删除数据...',
url: '/MvcShipping/WMSOUT_GuiGe/Delete',
params: {
gids: gids
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
//this.storeList.remove(record);
this.onRefreshClick();
Ext.Msg.show({ title: '提示', msg: jsonresult.Message + sError, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
else {
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, 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.WARNING, buttons: Ext.Msg.OK });
},
success: function (response, options) { },
scope: this
}); //end Ext.Ajax.request
}
}, this);
}
},
//#endregion
//#region 获取 YYYY-mm-dd 格式的日期
GetDateStr: function (sdate, AddDayCount) {
var dd = new Date(sdate); //获取选择的时期对象
dd.setDate(dd.getDate() + AddDayCount); //获取AddDayCount天后的日期
sdate = dd.toISOString();
sdate = sdate.toString().substr(0, 10);
return sdate;
},
//#endregion
OprationSwap: function () {
var ret = new Array();
ret[0] = this.OprationStatus;
ret[1] = this.SelectedRecord;
ret[2] = Ext.getCmp('btnRefresh');
ret[3] = this.outType;
return ret;
}, onPrintClick: function (button, event) {
// var printType = 'WmsInfoReport_opseai'; //海运进口 入库明细
var printType = 'WmsOutInfoReportNewList';
var uid = USERID;
var sql1 = "SELECT *, ";
sql1 += "MODIFIEDUSERNAME=(select top 1 [SHOWNAME] from [user] where gid=wms_out.MODIFIEDUSER),";
sql1 += "FEESTATUSREF=(case when FEESTATUS='True' then '锁定' else '未锁定' end), ";
sql1 += "dbo.F_GetBillDrFeeStatus(GID) DRFEESTATUS, dbo.F_GetBillCrFeeStatus(GID) CRFEESTATUS,";
sql1 += " MBLNO=isnull((select top 1 MBLNO from op_seai where bsno=wms_out.ASSOCIATEDNO),";
sql1 += " (select top 1 BLNO from wms where gid=wms_out.ASSOCIATEDNO)), ";
sql1 += "WMSNO=(case when CHARGEUNIT='CBM' then (select top 1 WMSNO from wms ";
sql1 += "where gid=(select top 1 ASSOCIATEDNO from wms_in where ";
sql1 += "gid=(select top 1 inbsno from wms_out_detail where outbsno=wms_out.bsno))) else";
sql1 += " (select top 1 WMSNO from wms where gid=(select top 1 inbsno from ";
sql1 += " wms_out_detail where outbsno=wms_out.bsno)) end), ";
sql1 += " ISBONDED=isnull((select top 1 (case when ISBONDED=1 then '是' else '否' end) as ISBONDED from op_seai where bsno=wms_out.ASSOCIATEDNO),'否') ";
sql1 += "from wms_out WITH(NOLOCK) where (ISDELETE=0 or ISDELETE is null) ";
var wherestr = this.getCondition();
if (wherestr != '') {
sql1 += "and " + wherestr;
}
PrintComm(printType, sql1);
},
PrintSelect: function () {
_this = this;
if (this.storeListHJ.getCount() == 0) {
return;
}
var selectedRecords = [];
var storeadd = null;
selectedRecords = this.GridCheckBoxModelHJ.selected.items;
if (selectedRecords.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择要打印的业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var feeGidSql = '';
for (var i = 0; i < selectedRecords.length; i++) {
var record = selectedRecords[i];
var feeGId = "'" + record.get('GID') + "'";
if (feeGidSql == '') {
feeGidSql = feeGId;
} else {
feeGidSql = feeGidSql + "," + feeGId;
}
};
var bsno = '11111';
var mblno = '';
var printType = 'WmsOutInfoReportNewListSelect';
var sql1 = "SELECT *, ";
sql1 += "MODIFIEDUSERNAME=(select top 1 [SHOWNAME] from [user] where gid=wms_out.MODIFIEDUSER),";
sql1 += "FEESTATUSREF=(case when FEESTATUS='True' then '锁定' else '未锁定' end), ";
sql1 += "dbo.F_GetBillDrFeeStatus(GID) DRFEESTATUS, dbo.F_GetBillCrFeeStatus(GID) CRFEESTATUS,";
sql1 += " MBLNO=isnull((select top 1 MBLNO from op_seai where bsno=wms_out.ASSOCIATEDNO),";
sql1 += " (select top 1 BLNO from wms where gid=wms_out.ASSOCIATEDNO)), ";
sql1 += "WMSNO=(case when CHARGEUNIT='CBM' then (select top 1 WMSNO from wms ";
sql1 += "where gid=(select top 1 ASSOCIATEDNO from wms_in where ";
sql1 += "gid=(select top 1 inbsno from wms_out_detail where outbsno=wms_out.bsno))) else";
sql1 += " (select top 1 WMSNO from wms where gid=(select top 1 inbsno from ";
sql1 += " wms_out_detail where outbsno=wms_out.bsno)) end), ";
sql1 += " ISBONDED=isnull((select top 1 (case when ISBONDED=1 then '是' else '否' end) as ISBONDED from op_seai where bsno=wms_out.ASSOCIATEDNO),'否') ";
sql1 += "from wms_out WITH(NOLOCK) where wms_out.GID IN (" + feeGidSql + ") order by DODATE DESC";
var sql2 = "";
var sql3 = "";
var sql4 = "";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6, "");
},
//#region 发送出库入库报文
onSendXML2Click: function () {
var selectedRecords = [];
selectedRecords = this.gridList.selModel.getSelection();
var selectStores = [];
for (var i = 0; i < selectedRecords.length; i++) {
selectStores.push(selectedRecords[i].data);
}
var wmsnos = '';
for (var i = 0; i < selectedRecords.length; i++) {
wmsnos += "'" + selectedRecords[i].data.BSNO + "',";
}
if (wmsnos.length <= 0) {
Ext.Msg.show({ title: '提示', msg: '请选择入库数据', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
} else {
wmsnos = wmsnos.substr(0, wmsnos.length - 1);
}
Ext.Msg.wait('正在查询数据...');
Ext.Ajax.request({
waitMsg: '正在查询数据...',
url: '/MvcShipping/WMSNew/GetXMLMessage4001WithWMSBSNO',
params: {
WMSBSNO: wmsnos,
type: 1
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
Ext.Msg.show({ title: '提示', msg: jsonresult.Message, 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
}); //end Ext.Ajax.request
}
//#endregion
,
// gridList_Edit的右键菜单
itemcontextmenu: function (his, record, item, index, e) {
// itemcontextmenu( Ext.view.View this, Ext.data.Model record,
// HTMLElement item, Number index, Ext.EventObject e, Object eOpts )
// 分类代码表的右键菜单
e.preventDefault();
e.stopEvent(); // 取消浏览器默认事件
_this = this;
var array = [
{
text: '上传附件',
handler: function () {
this.SelectedRecord = record;
//BillNo , ShipCompanyRef
var BillNo = record.data.BSNO;
me = this;
var imgform = new Ext.FormPanel({
region: 'center',
labelWidth: 40,
frame: true,
bodyStyle: 'padding:5px 5px 0',
autoScroll: true,
border: false,
fileUpload: true,
items: [{
xtype: 'fileuploadfield',
id: 'LoadFile',
name: 'LoadFile',
emptyText: '请选择文件',
fieldLabel: '文件',
buttonText: '选择文件',
allowBlank: false,
buttonCfg: { iconCls: 'uploaddialog' },
anchor: '98%'
}],
buttons: [{
text: '上传',
type: 'submit',
handler: function () {
var UserFilePath = Ext.getCmp('LoadFile').getValue();
if (!imgform.form.isValid()) { return; }
imgform.form.submit({
url: '/TruckMng/PcHeadEdit_LTJY/UploadFile_WMS',
waitMsg: '正在上传',
method: 'POST',
submitEmptyText: false,
async: false,
params: {
BillNo: BillNo,
TABLENAME: "WMS_OUT"
},
success: function (form, action) {
win.close(this);
Ext.Msg.show({ title: '提示', msg: '上传成功!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
},
failure: function (form, action) {
form.reset();
if (action.failureType == Ext.form.Action.SERVER_INVALID)
Ext.MessageBox.alert('警告', action.result.Message);
}
});
}
}, {
text: '关闭',
type: 'submit',
handler: function () {
win.close(this);
}
}]
});
var win = new Ext.Window({
title: "上传文件",
width: 360,
height: 120,
modal: true,
resizable: false,
border: false,
items: imgform
});
win.show();
}
}
];
var nodemenu = new Ext.menu.Menu({
items: array
});
nodemenu.showAt(e.getXY()); // 菜单打开的位置
}
});