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/WMSOUT_GuiGeIndex.js

1516 lines
57 KiB
JavaScript

This file contains ambiguous Unicode characters!

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

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,
outType2: null, //用于虎鲸业务 判断是否查找 出区报关 的报关业务
bEIP : false,
initUIComponents: function () {
_this = this;
var mainform = window.parent._this; // Ext.getCmp('OpSeaiEdit');
if (typeof (mainform.editRecord) == "undefined") {
//this.BsNo = getUrlParam('id');
this.OPLBNAME = "WMSMAIN";
}
else {
this.EditRecord = mainform.editRecord;
//this.BSNO = EditRecord.get('BSNO');
this.BsNo = this.EditRecord.data.BSNO;
this.OPLBNAME = this.EditRecord.data.OPLBNAME;
if (this.OPLBNAME == "" || this.OPLBNAME == undefined) {
this.OPLBNAME = "op_seai";
}
}
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.comboxGOODSNAME = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '品名',
store: this.storeCodeGoodsList,
forceSelection: true,
name: 'GOODSNAME',
valueField: 'GOODNAME',
displayField: 'CodeAndName',
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
}
}
});
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'
});
Ext.regModel('IsChange',
{
fields: [{ name: 'value' }, { name: 'text' }]
});
var cbStoreChange = new Ext.data.Store({
model: 'IsChange',
data: [{ 'value': '0', 'text': '否' },
{ 'value': '1', 'text': '是' }]
});
var cbChange = Ext.create('Ext.form.ComboBox', {
name: 'cbChange',
queryMode: 'local',
id: 'cbChange',
triggerAction: 'all',
labelWidth: 90,
valueField: 'value',
displayField: 'text',
store: cbStoreChange,
fieldLabel: '是否货权转移'
});
this.storeExpress = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
this.storeExpress.load({ params: { condition: "ISEXPRESS='1'" } });
this.comboxEXPRESS = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '快递公司',
store: this.storeExpress,
forceSelection: true,
name: 'EXPRESSCORP',
valueField: 'CustName',
displayField: 'CodeAndName'
});
//#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();
}
}
}
}
, 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
}
}
},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();
}
}
}
}, this.comboxEXPRESS]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '快递单号', //需求编号SR2017103100003
name: 'EXPRESSEXNO',
enableKeyEvents: true,
listeners: {
keyup: function (field, e)
{
if (e.getKey() == e.ENTER)
{
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '合同号', //需求编号SR2017103100003
name: 'CONTRACTNO',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '箱号', //需求编号SR2017103100003
name: 'CNTRNO',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
},cbChange,
{
xtype: 'hiddenfield'
}, {
xtype: 'hiddenfield'
}]
}]//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 "<img src='../../../../TruckMng/Content/Images/Lock.png' />";
}
}
},
{
sortable: true,
dataIndex: 'ISCHANGE',
header: '货权转移',
align: 'center',
width: 60,
renderer: function (value, cellmeta) {
if (value == true) {
return "<img src='../../../../TruckMng/Content/Images/yes.png' />";
}
}
},
{
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: 'COUNTRYOFORIGIN',
header: '原产国',
width: 120
},
{
sortable: true,
dataIndex: 'DingTalkAudit',
header: '钉钉审批',
width: 120
},
{
sortable: true,
dataIndex: 'STORAGENAME',
header: '所属仓库',
width: 150
},
{
sortable: true,
dataIndex: 'GOODSPFSL',
header: '出库量',
width: 150,
summaryType: 'sum',
summaryRenderer: function (value) {
return Ext.util.Format.number(value, '0.0000');
}
}, {
sortable: true,
dataIndex: 'GOODSPACKPFSL',
header: '出库件数',
width: 150,
summaryType: 'sum',
summaryRenderer: function (value) {
return Ext.util.Format.number(value, '0.0');
}
}, {
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: 'GOODSNAME',
header: '品名',
width: 80
}, {
sortable: true,
dataIndex: 'PICIHAO',
header: '批次号',
width: 80
},
{
sortable: true,
dataIndex: 'EXPRESSCORP',
header: '快递公司',
align: 'center',
width: 100
},
{
sortable: true,
dataIndex: 'EXPRESSEXNO',
header: '快递单号',
align: 'center',
width: 100
}, {
sortable: true,
dataIndex: 'CONTRACTNO',
header: '合同号',
width: 80
},
{
sortable: true,
dataIndex: 'ISBONDED',
header: '是否保税业务', //需求编号SR2017071300002-2
align: 'center',
width: 80
},
{
sortable: true,
dataIndex: 'REMARK',
header: '备注',
width: 200
},
{
sortable: false,
dataIndex: 'REMARK2',
header: 'REMARK2',
hidden: true,
width: 0
},
{
sortable: false,
dataIndex: 'CNTRTOTAL',
header: '箱型箱量',
width: 80
},
{
sortable: false,
dataIndex: 'KGS_OUT',
header: '出库重量',
width: 80
},
{
sortable: false,
dataIndex: 'PKGS_OUT',
header: '出库件数',
width: 80
},
{
sortable: false,
dataIndex: 'CBM_OUT',
header: '出库尺码',
width: 80
},
{
sortable: true,
dataIndex: 'MODIFIEDUSERNAME',
header: '最后一次操作人',
align: 'center',
width: 100
},
{
sortable: true,
dataIndex: 'MODIFIEDTIME',
header: '最后一次操作时间',
align: 'center',
width: 140
}];
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,
features: [{
ftype: 'summary'//Ext.grid.feature.Summary表格汇总特性
}],
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.changeType = "1";
if (record.data.ISDETAIL == '1') {
this.outType = "StockOutDetail";
DsOpenEditWin('/MvcShipping/WMSOUT_GuiGe/Edit', "货权转移-出库明细");
} else {
this.outType = "StockOut";
DsOpenEditWin('/MvcShipping/WMSOUT_GuiGe/Edit', "货权转移-出库单");
}
}
else {
this.changeType = "0";
if (record.data.ISDETAIL == '1') {
this.outType = "StockOutDetail";
DsOpenEditWin('/MvcShipping/WMSOUT_GuiGe/Edit', "出库明细");
} else {
this.outType = "StockOut";
DsOpenEditWin('/MvcShipping/WMSOUT_GuiGe/Edit', "出库单");
}
}
}, this);
//#endregion
//#endregion
this.storeExpressCorp = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsInfoClientModel',
proxy: { url: '/MvcShipping/MsInfoClient/GetDataListAll' }
});
this.storeExpressCorp.load({ params: { condition: "ISEXPRESS='1'" } });
//#region 按钮工具条/页面布局
this.panelBtn = new Ext.Panel({
layout: "border",
region: "center",
border: false,
tbar: [{
text: "新建出库",
iconCls: "btnadd",
menu: [{ text: "出库单",
handler: function (menu, event) {
_this.OprationStatus = 'add';
_this.changeType = '0';
_this.outType = 'StockOut';
DsOpenEditWin('/MvcShipping/WMSOUT_GuiGe/Edit', "出库单");
}
}, {
text: "明细出库",
handler: function(menu, event) {
_this.OprationStatus = 'add';
_this.changeType = '0';
_this.outType = 'StockOutDetail';
DsOpenEditWin('/MvcShipping/WMSOUT_GuiGe/Edit', "明细出库");
}
}],
scope: this
}, '-', {
text: "新建货转",
iconCls: "btnadd",
menu: [{
text: "整体货转",
handler: function (menu, event) {
_this.OprationStatus = 'add';
_this.changeType = '1';
_this.outType = 'StockOut';
DsOpenEditWin('/MvcShipping/WMSOUT_GuiGe/Edit', "货权转移-出库单");
}
}, {
text: "明细货转",
handler: function (menu, event) {
_this.OprationStatus = 'add';
_this.changeType = '1';
_this.outType = 'StockOutDetail';
DsOpenEditWin('/MvcShipping/WMSOUT_GuiGe/Edit', "货权转移-明细出库");
}
}, '-',{
text: "完税出库(明细货转)",
handler: function (menu, event) {
_this.OprationStatus = 'add';
_this.changeType = '1';
_this.outType = 'StockOutDetail';
_this.outType2 = true;
DsOpenEditWin('/MvcShipping/WMSOUT_GuiGe/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
}, '-',{
xtype: 'button',
width: 90,
text: "高级查询",
iconCls: "btnmore",
handler: function (button, event) {
var sql = this.getCondition();
if (this.winAccess) { this.winAccess.close(); }
this.winAccess = new Shipping.DsQuery({
});
this.winAccess.StoreList = this.storeList;
this.winAccess.formname = this.formname;
this.winAccess.condition = sql;
this.winAccess.show();
return;
},
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: "查看快递动态",
iconCls: "",
handler: function (button, event) {
var selections = this.gridListHJ.getSelectionModel().getSelection();
if (selections.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var record = selections[0];
var expno = record.data.EXPRESSEXNO;
var CORP = record.data.EXPRESSCORP;
if (expno == "" || CORP == "") {
Ext.Msg.show({ title: '提示', msg: '快递单号和快递公司不能为空!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
} else {
var ex_storeList = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
model: 'MsOpExpress',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsOpExpress/GetDataList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
ex_storeList.on('beforeload', function (store) {
Ext.apply(store.proxy.extraParams, {
condition: "EXNO='" + expno + "'"
});
}, this);
ex_storeList.load({
params: { start: 0, limit: 1 },
waitMsg: "正在查询数据...",
scope: this
});
ex_storeList.on("load", function (store) {
var model = store.data.items[0].data;
var expcorpid = "";
var Cargoinforecords = DsStoreQueryBy(_this.storeExpressCorp, 'SHORTNAME', CORP);
if (Cargoinforecords.getCount() > 0) {
var Cargoinfodata = Cargoinforecords.getAt(0).data;
expcorpid = Cargoinfodata.EDICODE;
}
var expid = model.GID;
if (expcorpid == "") {
Ext.Msg.show({ title: '提示', msg: '快递公司的EDI代码不能为空!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var ExpressStatusView = new Shipping.ExpressStatusView({});
ExpressStatusView.expno = expno;
ExpressStatusView.expcorpid = expcorpid;
ExpressStatusView.expid = expid;
ExpressStatusView.EditRecord = record;
ExpressStatusView.show();
return;
})
}
},
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: "&nbsp;&nbsp;"
}]
});
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: 120,
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
var _this = this;
}, //end initUIComponents
//#region 加载事件
InitData: function () {
if (this.BsNo != undefined && this.BsNo != "") {
this.sqlcontext = " ASSOCIATEDNO='" + this.BsNo + "' "; //只显示该业务下的
} else {
//#region 初始化只显示当前月
var myDate = new Date();
var mydatestr = Ext.util.Format.date(myDate, 'Y-m') + ('-01');
this.sqlcontext = " DODATE >='" + mydatestr + "'";
//endregion
}
this.storeListHJ.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: this.sqlcontext },
waitMsg: "正在查询数据...",
scope: this
});
this.storeListHJ.on('beforeload', function (store) {
Ext.apply(store.proxy.extraParams, { condition: this.sqlcontext });
}, this);
//#endregion
//this.onRefreshClick();
if (this.BsNo != undefined && this.BsNo != "") {
//this.formSearch.hidden = true;
this.formSearch.hide();
this.panelTop.height = 30;
} else {
this.formSearch.show();
this.panelTop.height = 130;
}
}, //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
});
},
onDsQuery: function () {
var sql = this.sqlcontext;
this.storeListHJ.load({
params: { start: 0, limit: this.PageSize, 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 ASSOCIATEDNO from wms where BLNO like '%" + NO + "%') or" +
" BSNO IN (SELECT OUTBSNO_OUT FROM VW_WMS_DETAIL where BLNO like '%" + NO + "%') or" +
" BSNO IN (SELECT OUTBSNO_OUT FROM VW_WMS_DETAIL where PICIHAO+' '+CNTRNO+' '+WMSNO+' ' like '%" + NO + "%' ))");
}
}
if (this.BsNo != undefined && this.BsNo != "") {
sql = " ASSOCIATEDNO='" + this.BsNo + "' ";
}
//是否保税业务//需求编号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 EXPRESSCORP = this.formSearch.getForm().findField('EXPRESSCORP').getValue();
if (EXPRESSCORP !== "" && EXPRESSCORP!= null)
sql = sql + getAndConSql(sql, EXPRESSCORP, "EXPRESSCORP='" + EXPRESSCORP.toString().trim() + "'");
//快递单号
var EXPRESSEXNO = this.formSearch.getForm().findField('EXPRESSEXNO').getValue();
if (EXPRESSEXNO !== "" && EXPRESSEXNO != null)
sql = sql + getAndConSql(sql, EXPRESSEXNO, "EXPRESSEXNO like'%" + EXPRESSEXNO.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() + "')");
}
}
//品牌
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 ) ");
sql = sql +
getAndConSql(sql,
COUNTRYID,
" exists(select 1 from wms_out_detail where OUTBSNO=wms_out.BSNO and BSNO in (select OUTBSNO from wms_out_detail where INBSNO in (select GID from wms_in where COUNTRYID = '" +
COUNTRYID +
"')) ) ");
}
var CONTRACTNO = this.formSearch.getForm().findField('CONTRACTNO').getValue();
if (CONTRACTNO != '' && CONTRACTNO != null) {
sql = sql + getAndConSql(sql, CONTRACTNO, " EXISTS (select 1 from wms where CONTRACTNO like '%" + CONTRACTNO + "%' and wms_out.ASSOCIATEDNO=wms.GID ) ");
}
var CNTRNO = this.formSearch.getForm().findField('CNTRNO').getValue();
if (CNTRNO != '' && CNTRNO != null) {
sql = sql +
getAndConSql(sql,
CNTRNO,
" (exists (select 1 from wms_out_detail where OUTBSNO=wms_out.BSNO and INBSNO in (select GID from wms_in where CNTRNO like '%" + CNTRNO+"%') ) or exists (select 1 from wms_out_detail where OUTBSNO=wms_out.BSNO and INBSNO in (select GID from wms where exists(select 1 from wms_in where ASSOCIATEDNO = wms.GID and CNTRNO like '%"+CNTRNO+"%'))))");
//sql = sql + getAndConSql(sql, CNTRNO, " EXISTS(select 1 from wms where EXISTS(select * from wms_in where wms_in.BSNO=wms.GID and wms_in.CNTRNO='" + CNTRNO + "') and wms_out.ASSOCIATEDNO=wms.GID ) ");
}
//是否货权转移
var cbChange = this.formSearch.getForm().findField('cbChange').getValue();
if (cbChange != '' && cbChange != null) {
sql = sql + getAndConSql(sql, cbChange, " ISCHANGE = '" + cbChange + "'");
}
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;
}
if (selections.length > 1) {
Ext.Msg.show({ title: '提示', msg: '对不起,只能逐条删除!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
return;
}
//
var gids = "";
var sError = "";
var curEIP = false;
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');
curEIP = record.get('EIP');
}
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,
eip:curEIP
},
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;//整体出库 StockOut,明细出库 StockOutDetail
ret[4] = this.changeType;//是否货权转移 10
ret[5] = this.bEIP;//是否EIP
ret[6] = this.OPLBNAME;
ret[7] = this.EditRecord;
ret[8] = this.outType2;
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 发送出库入库报文
onSendXMLClick: function () {
var selectedRecords = [];
selectedRecords = this.gridListHJ.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
});