|
|
Ext.namespace('Shipping');
|
|
|
String.prototype.trim = function () { return this.replace(/(^\s*)|(\s*$)/g, ""); }
|
|
|
|
|
|
Shipping.RptWmsSettlementList_GuiGeEdit = function (config) {
|
|
|
Ext.applyIf(this, config);
|
|
|
this.initUIComponents();
|
|
|
window.Shipping.RptWmsSettlementList_GuiGeEdit.superclass.constructor.call(this);
|
|
|
};
|
|
|
|
|
|
//需求编号:SR2017072600002
|
|
|
Ext.extend(Shipping.RptWmsSettlementList_GuiGeEdit, Ext.Panel, {
|
|
|
PageSize: 1000, //每页的条数
|
|
|
ParentWin: null,
|
|
|
OpStatus: 'add',
|
|
|
StoreList: null,
|
|
|
EditRecord: null,
|
|
|
btnRefresh: null,
|
|
|
|
|
|
initUIComponents: function () {
|
|
|
this.serialNo = 0;
|
|
|
this.workSerialNo = 0;
|
|
|
this.bodyDel = [];
|
|
|
this.FeeSql = '';
|
|
|
this.BillSql = '';
|
|
|
this.DuiBillSql = '';
|
|
|
|
|
|
//#region 账单信息加载
|
|
|
//对账客户
|
|
|
this.storeCustCode = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'DsShipping.ux.CustomRefModel',
|
|
|
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
|
|
|
});
|
|
|
this.storeCustCode.load({ params: { condition: ""} });
|
|
|
this.comboxCustCode = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
fieldLabel: '对账客户',
|
|
|
store: this.storeCustCode,
|
|
|
forceSelection: true,
|
|
|
name: 'CUSTOMERNAME',
|
|
|
valueField: 'CustName',
|
|
|
displayField: 'CodeAndName'
|
|
|
});
|
|
|
//打印模板
|
|
|
this.storeDuiTemplate = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'MsCodeDuiTemplate',
|
|
|
proxy: { url: '/MvcShipping/MsCodeDuiTemplate/GetDataList' }
|
|
|
});
|
|
|
this.storeDuiTemplate.load({ params: { condition: ""} });
|
|
|
this.comboxDuiTemplate = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
fieldLabel: '打印模板',
|
|
|
store: this.storeDuiTemplate,
|
|
|
forceSelection: true,
|
|
|
name: 'DM_ID',
|
|
|
valueField: 'DM_ID',
|
|
|
displayField: 'NAME'
|
|
|
});
|
|
|
//#endregion
|
|
|
|
|
|
//#region 账单信息布局
|
|
|
this.formEdit = Ext.widget('form', {
|
|
|
region: 'center',
|
|
|
border: false,
|
|
|
frame: true,
|
|
|
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: '对账编号',
|
|
|
readOnly: true, //, hidden: true
|
|
|
name: 'DUINO'
|
|
|
}, {
|
|
|
id: "CUSTOMERNAME",
|
|
|
fieldLabel: '对账客户',
|
|
|
readOnly: true,
|
|
|
name: 'CUSTOMERNAME'
|
|
|
}, {
|
|
|
id: "STARTBILLINGDATE",
|
|
|
fieldLabel: '开始对账日期',
|
|
|
readOnly: true,
|
|
|
name: 'STARTBILLINGDATE'
|
|
|
}, {
|
|
|
id: "ENDBILLINGDATE",
|
|
|
fieldLabel: '结束对账日期',
|
|
|
readOnly: true,
|
|
|
name: 'ENDBILLINGDATE'
|
|
|
}]
|
|
|
}, {
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
defaultType: 'textfield',
|
|
|
items: [{
|
|
|
fieldLabel: '备注',
|
|
|
name: 'REMARK',
|
|
|
flex: 4
|
|
|
}]
|
|
|
}]//end items(fieldset 1)
|
|
|
}]//end root items
|
|
|
}); //end this.formEdit
|
|
|
//#endregion
|
|
|
|
|
|
//#region 账单明细
|
|
|
//明细表表格相关
|
|
|
this.GridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
|
|
|
//明细表-数据集
|
|
|
this.storeBodyList = Ext.create('Ext.data.Store', {
|
|
|
model: 'RptWmsSettlementList_GuiGeEntity',
|
|
|
remoteSort: true,
|
|
|
proxy: {
|
|
|
type: 'ajax',
|
|
|
timeout: 6000000, //60秒,
|
|
|
url: '/MvcShipping/RptWmsSettlementList_GuiGe/GetDataList',
|
|
|
reader: {
|
|
|
id: 'GID',
|
|
|
root: 'data',
|
|
|
totalProperty: 'totalCount'
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
//#endregion
|
|
|
|
|
|
|
|
|
//#region List列表自增序号列生成
|
|
|
Ext.grid.RowNumberer = Ext.extend(Ext.grid.RowNumberer, {
|
|
|
width: 30
|
|
|
});
|
|
|
//#endregion
|
|
|
|
|
|
//#region 查询的主列表_提单号_加载
|
|
|
this.storeMblnoList = Ext.create('Ext.data.Store', {
|
|
|
model: 'wms_settlement_detail_mblno',
|
|
|
remoteSort: true,
|
|
|
proxy: {
|
|
|
type: 'ajax',
|
|
|
timeout: 6000000, //60秒,
|
|
|
url: '/MvcShipping/RptWmsSettlementList_GuiGe/GetBLListData',
|
|
|
reader: {
|
|
|
id: 'GID', //,DUINO
|
|
|
root: 'data',
|
|
|
totalProperty: 'totalCount'
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
this.storeMblnoModel = Ext.create('Ext.selection.CheckboxModel');
|
|
|
this.gridMblnoList = new Ext.grid.GridPanel({
|
|
|
store: this.storeMblnoList,
|
|
|
selModel: this.storeMblnoModel,
|
|
|
region: 'north',
|
|
|
height: 150,
|
|
|
loadMask: { msg: "数据加载中,请稍等..." },
|
|
|
enableHdMenu: false, //是否显示表格列的菜单
|
|
|
hideHeaders: false, //是否隐藏表头
|
|
|
enableColumnHide: false, ///隐藏表头列
|
|
|
sortableColumns: false, ///隐藏表头排序
|
|
|
trackMouseOver: true,
|
|
|
disableSelection: false, //是否禁止行选择,默认为false
|
|
|
stripeRows: true, //表格是否隔行换色,默认为false
|
|
|
viewConfig: {
|
|
|
enableTextSelection: true, //允许复制数据
|
|
|
autoFill: true
|
|
|
},
|
|
|
columns: [{
|
|
|
sortable: true,
|
|
|
dataIndex: 'GID',
|
|
|
header: 'GID',
|
|
|
hidden: true,
|
|
|
width: 100
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'BLNO',
|
|
|
header: '提单号',
|
|
|
width: 150
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'CUSTOMNO',
|
|
|
header: '报关单号',
|
|
|
width: 150
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'CUSTOMERNAME',
|
|
|
header: '对账客户',
|
|
|
width: 150
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'DUIGID',
|
|
|
header: '对账GID',
|
|
|
width: 0
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'DUINO',
|
|
|
header: '对账编号',
|
|
|
width: 0
|
|
|
}]
|
|
|
});
|
|
|
this.gridMblnoList.columns[0] = new Ext.grid.RowNumberer();
|
|
|
//#endregion
|
|
|
|
|
|
//#region 查询的明细表加载
|
|
|
this.storeBodyAddList = Ext.create('Ext.data.Store', {
|
|
|
model: 'wms_settlement_detail',
|
|
|
remoteSort: true,
|
|
|
proxy: {
|
|
|
type: 'ajax',
|
|
|
timeout: 6000000, //60秒,
|
|
|
url: '/MvcShipping/RptWmsSettlementList_GuiGe/GetMblnoDetailList',
|
|
|
reader: {
|
|
|
id: 'GID', //,DUINO
|
|
|
root: 'data',
|
|
|
totalProperty: 'totalCount'
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
this.AddGridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
|
|
|
this.gridAddList = new Ext.grid.GridPanel({
|
|
|
store: this.storeBodyAddList,
|
|
|
region: 'center',
|
|
|
loadMask: { msg: "数据加载中,请稍等..." },
|
|
|
enableHdMenu: false, //是否显示表格列的菜单
|
|
|
hideHeaders: false, //是否隐藏表头
|
|
|
enableColumnHide: false, ///隐藏表头列
|
|
|
sortableColumns: false, ///隐藏表头排序
|
|
|
trackMouseOver: true,
|
|
|
disableSelection: false,
|
|
|
viewConfig: {
|
|
|
enableTextSelection: true, //允许复制数据
|
|
|
autoFill: true
|
|
|
},
|
|
|
columns: [{
|
|
|
sortable: true,
|
|
|
dataIndex: 'GID',
|
|
|
header: 'GID',
|
|
|
hidden: true,
|
|
|
width: 0
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'STORAGENAME',
|
|
|
header: '仓库名称',
|
|
|
width: 100
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'WMSNO',
|
|
|
header: '入库单号',
|
|
|
width: 100
|
|
|
},{
|
|
|
sortable: true,
|
|
|
dataIndex: 'WMSDATE',
|
|
|
header: '入库日期',
|
|
|
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
|
|
|
width: 100
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'STARTBILLINGDATE',
|
|
|
header: '开始计费日期',
|
|
|
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
|
|
|
width: 100
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'ENDBILLINGDATE',
|
|
|
header: '结束计费日期',
|
|
|
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
|
|
|
width: 100
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'GOODSPACK',
|
|
|
header: '入库件数',
|
|
|
align: 'right',
|
|
|
width: 100
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'GOODSPACKSTOCK',
|
|
|
header: '库存件数',
|
|
|
align: 'right',
|
|
|
width: 100
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'GOODSRKSL',
|
|
|
header: '入库量',
|
|
|
align: 'right',
|
|
|
width: 100
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'FEEDAYS',
|
|
|
header: '应收计费天数',
|
|
|
align: 'right',
|
|
|
width: 100
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'FEEPRICE',
|
|
|
header: '费率',
|
|
|
align: 'right',
|
|
|
width: 100
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'OUTFEE',
|
|
|
header: '仓储费',
|
|
|
align: 'right',
|
|
|
width: 100,
|
|
|
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
|
|
|
value = usMoney(value, 2, '', true);
|
|
|
return value;
|
|
|
}
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: ',GID_LINK',
|
|
|
header: '入库明细GID',
|
|
|
hidden: true,
|
|
|
width: 0
|
|
|
}]
|
|
|
});
|
|
|
//#endregion
|
|
|
|
|
|
|
|
|
//#region List合计列表加载信息,定义数据集
|
|
|
this.storeListSum = Ext.create('Ext.data.Store', {
|
|
|
idProperty: 'GID',
|
|
|
fields: [
|
|
|
{ name: 'CUSTOMERNAME', type: 'string' },
|
|
|
{ name: 'OUTFEE', type: 'string' },
|
|
|
{ name: 'GID', type: 'string' }
|
|
|
],
|
|
|
proxy: {
|
|
|
type: 'ajax',
|
|
|
timeout: 6000000, //60秒,
|
|
|
url: '/MvcShipping/RptWmsSettlementList_GuiGe/GetDataListSum',
|
|
|
reader: {
|
|
|
id: 'GID',
|
|
|
root: 'data'
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
this.gridListSum = new Ext.grid.GridPanel({
|
|
|
store: this.storeListSum,
|
|
|
region: 'west',
|
|
|
width: 350,
|
|
|
trackMouseOver: true, //当鼠标移过行时,行是否要highlight
|
|
|
stripeRows: true, //让grid相邻两行背景色不同
|
|
|
disableSelection: false, //值为TRUE,表示禁止选择行
|
|
|
enableHdMenu: false, //是否显示表格列的菜单//在列的header是否要有下拉菜单
|
|
|
hideHeaders: false, //是否隐藏表头
|
|
|
enableColumnHide: false, ///隐藏表头列
|
|
|
sortableColumns: false, ///隐藏表头排序
|
|
|
loadMask: { msg: "数据加载中,请稍等..." },
|
|
|
viewConfig: {
|
|
|
enableTextSelection: true, //允许复制数据
|
|
|
autoFill: true
|
|
|
},
|
|
|
stateful: false,
|
|
|
|
|
|
columns: [{
|
|
|
sortable: true,
|
|
|
dataIndex: 'GID',
|
|
|
header: 'GID',
|
|
|
hidden: true,
|
|
|
width: 100
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'CUSTOMERNAME',
|
|
|
header: '',
|
|
|
width: 80
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'OUTFEE',
|
|
|
header: '仓储费',
|
|
|
width: 100,
|
|
|
align: 'right',
|
|
|
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
|
|
|
value = usMoney(value, 2, '', true);
|
|
|
return value;
|
|
|
}
|
|
|
}]
|
|
|
});
|
|
|
//#endregion
|
|
|
|
|
|
//#region ListSelect合计列表加载信息,定义数据集
|
|
|
this.storeListSumSelect = Ext.create('Ext.data.Store', {
|
|
|
idProperty: 'GID',
|
|
|
fields: [
|
|
|
{ name: 'CUSTOMERNAME', type: 'string' },
|
|
|
{ name: 'OUTFEE', type: 'string' },
|
|
|
{ name: 'GID', type: 'string' }
|
|
|
],
|
|
|
proxy: {
|
|
|
type: 'ajax',
|
|
|
timeout: 6000000, //60秒,
|
|
|
url: '/MvcShipping/RptWmsSettlementList_GuiGe/GetDataListSum',
|
|
|
reader: {
|
|
|
id: 'GID',
|
|
|
root: 'data'
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
this.gridListSumSelect = new Ext.grid.GridPanel({
|
|
|
store: this.storeListSumSelect,
|
|
|
region: 'east',
|
|
|
width: 350,
|
|
|
trackMouseOver: true, //当鼠标移过行时,行是否要highlight
|
|
|
stripeRows: true, //让grid相邻两行背景色不同
|
|
|
disableSelection: false, //值为TRUE,表示禁止选择行
|
|
|
enableHdMenu: false, //是否显示表格列的菜单//在列的header是否要有下拉菜单
|
|
|
hideHeaders: false, //是否隐藏表头
|
|
|
enableColumnHide: false, ///隐藏表头列
|
|
|
sortableColumns: false, ///隐藏表头排序
|
|
|
loadMask: { msg: "数据加载中,请稍等..." },
|
|
|
viewConfig: {
|
|
|
enableTextSelection: true, //允许复制数据
|
|
|
autoFill: true
|
|
|
},
|
|
|
stateful: false,
|
|
|
|
|
|
columns: [{
|
|
|
sortable: true,
|
|
|
dataIndex: 'GID',
|
|
|
header: 'GID',
|
|
|
hidden: true,
|
|
|
width: 100
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'CUSTOMERNAME',
|
|
|
header: '',
|
|
|
width: 80
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'OUTFEE',
|
|
|
header: '仓储费',
|
|
|
width: 100,
|
|
|
align: 'right',
|
|
|
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
|
|
|
value = usMoney(value, 2, '', true);
|
|
|
return value;
|
|
|
}
|
|
|
}]
|
|
|
});
|
|
|
//#endregion
|
|
|
|
|
|
//#region ListSelectAll合计列表加载信息,定义数据集
|
|
|
this.storeListSumSelectAll = Ext.create('Ext.data.Store', {
|
|
|
idProperty: 'GID',
|
|
|
fields: [
|
|
|
{ name: 'CUSTOMERNAME', type: 'string' },
|
|
|
{ name: 'OUTFEE', type: 'string' },
|
|
|
{ name: 'GID', type: 'string' }
|
|
|
],
|
|
|
proxy: {
|
|
|
type: 'ajax',
|
|
|
timeout: 6000000, //60秒,
|
|
|
url: '/MvcShipping/RptWmsSettlementList_GuiGe/GetDataListSum',
|
|
|
reader: {
|
|
|
id: 'GID',
|
|
|
root: 'data'
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
this.gridListSumSelectAll = new Ext.grid.GridPanel({
|
|
|
store: this.storeListSumSelectAll,
|
|
|
region: 'center',
|
|
|
trackMouseOver: true, //当鼠标移过行时,行是否要highlight
|
|
|
stripeRows: true, //让grid相邻两行背景色不同
|
|
|
disableSelection: false, //值为TRUE,表示禁止选择行
|
|
|
enableHdMenu: false, //是否显示表格列的菜单//在列的header是否要有下拉菜单
|
|
|
hideHeaders: false, //是否隐藏表头
|
|
|
enableColumnHide: false, ///隐藏表头列
|
|
|
sortableColumns: false, ///隐藏表头排序
|
|
|
loadMask: { msg: "数据加载中,请稍等..." },
|
|
|
viewConfig: {
|
|
|
enableTextSelection: true, //允许复制数据
|
|
|
autoFill: true
|
|
|
},
|
|
|
stateful: false,
|
|
|
|
|
|
columns: [{
|
|
|
sortable: true,
|
|
|
dataIndex: 'GID',
|
|
|
header: 'GID',
|
|
|
hidden: true,
|
|
|
width: 100
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'CUSTOMERNAME',
|
|
|
header: '',
|
|
|
width: 80
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'OUTFEE',
|
|
|
header: '仓储费',
|
|
|
width: 100,
|
|
|
align: 'right',
|
|
|
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
|
|
|
value = usMoney(value, 2, '', true);
|
|
|
return value;
|
|
|
}
|
|
|
}]
|
|
|
});
|
|
|
//#endregion
|
|
|
|
|
|
|
|
|
//#region 查询条件信息加载
|
|
|
//委托单位
|
|
|
this.storeCustomer = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'DsShipping.ux.CustomRefModel',
|
|
|
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
|
|
|
});
|
|
|
this.storeCustomer.load({ params: { condition: ""} });
|
|
|
this.comboxCustomer = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
fieldLabel: '<font color=red style="font-weight: bold;">对账客户</font>',
|
|
|
store: this.storeCustomer,
|
|
|
forceSelection: true,
|
|
|
name: 'CUSTOMERNAME',
|
|
|
valueField: 'CustName',
|
|
|
displayField: 'CodeAndName',
|
|
|
listeners: {
|
|
|
change: function (field, newValue, oldValue) {
|
|
|
//this.comboxCustCode.setValue(newValue);
|
|
|
Ext.getCmp('CUSTOMERNAME').setValue(newValue);
|
|
|
},
|
|
|
scope: this
|
|
|
}
|
|
|
});
|
|
|
//
|
|
|
this.storeStock = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'DsShipping.ux.CustomRefModel',
|
|
|
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
|
|
|
//proxy: { url: '/CommMng/BasicDataRef/GetTrader' }
|
|
|
});
|
|
|
this.storeStock.load({ params: { condition: " ISWAREHOUSE=1 "} });
|
|
|
this.comboxStock = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
fieldLabel: '仓库名称',
|
|
|
store: this.storeStock,
|
|
|
forceSelection: true,
|
|
|
name: 'STORAGENAME',
|
|
|
valueField: 'CustName',
|
|
|
displayField: 'CodeAndName'
|
|
|
});
|
|
|
//
|
|
|
Ext.define('CHARGEUNIT', {
|
|
|
extend: 'Ext.data.Model',
|
|
|
fields: [
|
|
|
{ name: 'Name', type: 'string' }
|
|
|
]
|
|
|
});
|
|
|
var CHARGEUNITData = [{ "Name": "吨" }, { "Name": "千克" }, { "Name": "立方" }, { "Name": "CBM" }, { "Name": ""}];
|
|
|
var storeCHARGEUNIT = Ext.create('Ext.data.Store', {
|
|
|
model: 'CHARGEUNIT',
|
|
|
data: CHARGEUNITData
|
|
|
});
|
|
|
this.comboxCHARGEUNIT = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
fieldLabel: '计费单位',
|
|
|
forceSelection: true,
|
|
|
store: storeCHARGEUNIT,
|
|
|
name: 'CHARGEUNIT',
|
|
|
valueField: 'Name',
|
|
|
displayField: 'Name'
|
|
|
});
|
|
|
//
|
|
|
Ext.define('STOCKTYPE', {
|
|
|
extend: 'Ext.data.Model',
|
|
|
fields: [
|
|
|
{ name: 'Name', type: 'string' }
|
|
|
]
|
|
|
});
|
|
|
var STOCKTYPEData = [{ "Name": "有货" }, { "Name": "清库" }, { "Name": ""}];
|
|
|
var storeSTOCKTYPE = Ext.create('Ext.data.Store', {
|
|
|
model: 'STOCKTYPE',
|
|
|
data: STOCKTYPEData
|
|
|
});
|
|
|
this.comboxSTOCKTYPE = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
fieldLabel: '库存状态',
|
|
|
forceSelection: true,
|
|
|
store: storeSTOCKTYPE,
|
|
|
name: 'STOCKTYPE',
|
|
|
valueField: 'Name',
|
|
|
displayField: 'Name'
|
|
|
});
|
|
|
//#endregion
|
|
|
|
|
|
//#region 查询条件布局
|
|
|
this.formSearch = Ext.widget('form', {
|
|
|
frame: true,
|
|
|
border: false,
|
|
|
region: 'north',
|
|
|
height: 35,
|
|
|
fieldDefaults: {
|
|
|
margins: '2 2 2 2',
|
|
|
labelAlign: 'right',
|
|
|
flex: 1,
|
|
|
labelWidth: 65,
|
|
|
msgTarget: 'qtip'
|
|
|
},
|
|
|
|
|
|
items: [{//fieldset 1
|
|
|
xtype: 'container',
|
|
|
defaultType: 'textfield',
|
|
|
layout: 'anchor',
|
|
|
defaults: {
|
|
|
anchor: '100%'
|
|
|
},
|
|
|
items: [{
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
defaultType: 'textfield',
|
|
|
items: [this.comboxCustomer, {
|
|
|
fieldLabel: '<font color=red style="font-weight: bold;">对账日期</font>', //对账日期
|
|
|
format: 'Y-m-d',
|
|
|
xtype: 'datefield',
|
|
|
name: 'WMSDATE_min',
|
|
|
listeners: {
|
|
|
blur: function (_df) {
|
|
|
var value = _df.getRawValue();
|
|
|
Ext.getCmp('STARTBILLINGDATE').setValue(value);
|
|
|
}
|
|
|
}
|
|
|
}, {
|
|
|
fieldLabel: '<font color=red style="font-weight: bold;">...到</font>',
|
|
|
format: 'Y-m-d',
|
|
|
xtype: 'datefield',
|
|
|
name: 'WMSDATE_max',
|
|
|
listeners: {
|
|
|
blur: function (_df) {
|
|
|
var value = _df.getRawValue();
|
|
|
Ext.getCmp('ENDBILLINGDATE').setValue(value);
|
|
|
}
|
|
|
}
|
|
|
}, {
|
|
|
fieldLabel: '主提单号',
|
|
|
name: 'BLNO', flex: 1
|
|
|
},this.comboxStock,{
|
|
|
xtype: 'button',
|
|
|
width: 90,
|
|
|
text: "执行查询",
|
|
|
iconCls: "btnrefresh",
|
|
|
handler: function (button, event) {
|
|
|
this.onRefreshClick(button, event);
|
|
|
},
|
|
|
scope: this
|
|
|
}, {
|
|
|
xtype: 'button',
|
|
|
width: 90,
|
|
|
text: "重置条件",
|
|
|
iconCls: "btnreset",
|
|
|
handler: function (button, event) {
|
|
|
this.onClearSql(button, event);
|
|
|
},
|
|
|
scope: this
|
|
|
}]
|
|
|
}]//end items(fieldset 1)
|
|
|
}]//end root items
|
|
|
});
|
|
|
//#endregion
|
|
|
|
|
|
|
|
|
//#region 按钮Toolbar
|
|
|
this.panelBtn = new Ext.Panel({
|
|
|
border: false,
|
|
|
region: "north",
|
|
|
tbar: [{
|
|
|
id: "btsave",
|
|
|
text: "保存",
|
|
|
iconCls: "btnsave",
|
|
|
handler: function (button, event) {
|
|
|
this.Save('0');
|
|
|
},
|
|
|
scope: this
|
|
|
}, '-', {
|
|
|
id: "btsave2",
|
|
|
text: "保存并关闭",
|
|
|
handler: function (button, event) {
|
|
|
this.Save('1');
|
|
|
},
|
|
|
scope: this
|
|
|
}, {
|
|
|
id: "btdel",
|
|
|
text: "删除",
|
|
|
handler: function (button, event) {
|
|
|
this.onDeleteClick(button, event);
|
|
|
},
|
|
|
scope: this
|
|
|
}, {
|
|
|
id: "btPrint",
|
|
|
text: "打印",
|
|
|
handler: function (button, event) {
|
|
|
this.Print();
|
|
|
},
|
|
|
scope: this
|
|
|
}]
|
|
|
}); //end 按钮Toolbar
|
|
|
//#endregion
|
|
|
|
|
|
//#region 控件布局
|
|
|
this.panelListSum = new Ext.Panel({
|
|
|
border: false,
|
|
|
layout: "border",
|
|
|
region: 'south',
|
|
|
split: true,
|
|
|
height: 50,
|
|
|
split: true,
|
|
|
items: [this.gridListSum, this.gridListSumSelectAll]//this.gridListSumSelect,
|
|
|
});
|
|
|
this.paneladddetail = new Ext.Panel({
|
|
|
border: false,
|
|
|
layout: "border",
|
|
|
region: 'center',
|
|
|
items: [this.gridMblnoList, this.gridAddList, this.panelListSum]
|
|
|
});
|
|
|
this.paneladd = new Ext.Panel({
|
|
|
border: false,
|
|
|
title: '账单明细', //添加账单明细
|
|
|
layout: "border",
|
|
|
region: 'center',
|
|
|
split: true,
|
|
|
height: 300,
|
|
|
items: [this.formSearch, this.paneladddetail]
|
|
|
});
|
|
|
this.panelTop = new Ext.Panel({
|
|
|
border: false,
|
|
|
layout: "border",
|
|
|
region: "north",
|
|
|
height: 90,
|
|
|
items: [this.panelBtn, this.formEdit]
|
|
|
});
|
|
|
Ext.apply(this, {
|
|
|
border: false,
|
|
|
items: [this.panelTop, this.paneladd]
|
|
|
});
|
|
|
//#endregion
|
|
|
|
|
|
|
|
|
//#region 页面加载
|
|
|
//绑定查询窗体
|
|
|
this.ParentWin = window.parent.opener;
|
|
|
//初始化数据
|
|
|
this.InitData();
|
|
|
//绑定事件
|
|
|
var GID = '*';
|
|
|
this.setBtn();
|
|
|
//#endregion
|
|
|
|
|
|
//#region 调用账单明细
|
|
|
this.storeBodyList.load({
|
|
|
timeout: 6000000, //60秒,
|
|
|
params: { condition: " GID='" + GID + "'" }
|
|
|
});
|
|
|
this.storeBodyList.on('beforeload', function (store) {
|
|
|
var sql = " GID='" + GID + "'";
|
|
|
Ext.apply(store.proxy.extraParams, { condition: sql });
|
|
|
}, this);
|
|
|
//#endregion
|
|
|
|
|
|
//#region 调用查询条件
|
|
|
this.storeBodyAddList.on('beforeload', function (store) {
|
|
|
var sql = this.getCondition();
|
|
|
var form = this.formSearch.getForm();
|
|
|
Ext.apply(store.proxy.extraParams, { condition: this.BillSql, duicondition: this.DuiBillSql });
|
|
|
}, this);
|
|
|
|
|
|
this.storeBodyAddList.on('load', function (store, records) {
|
|
|
if (store.getCount() > 0) {
|
|
|
this.gridAddList.getSelectionModel().select(0);
|
|
|
}
|
|
|
}, this);
|
|
|
|
|
|
this.gridAddList.getSelectionModel().on('select', function (model, record, index) {
|
|
|
var outgid = record.data.GID_LINK;
|
|
|
var CUSTOMERNAME = record.data.CUSTOMERNAME;
|
|
|
if (outgid.toString().trim() != "") {
|
|
|
var sql = " AND WMSOUTBSNO='" + outgid + "' and CUSTOMERNAME='" + CUSTOMERNAME + "'";
|
|
|
}
|
|
|
}, this);
|
|
|
|
|
|
this.gridMblnoList.getSelectionModel().on('select', function (model, record, index) {
|
|
|
var DUIGID = record.data.DUIGID;
|
|
|
var mblno = record.data.BLNO;
|
|
|
var CUSTOMNO = record.data.CUSTOMNO;
|
|
|
var CUSTOMERNAME = record.data.CUSTOMERNAME;
|
|
|
//
|
|
|
var sql = "";
|
|
|
if (DUIGID.toString().trim() != "") {
|
|
|
sql += " AND DUIGID='" + DUIGID + "'";
|
|
|
}
|
|
|
if (mblno.toString().trim() != "") {
|
|
|
sql += " AND blno='" + mblno + "'";
|
|
|
}
|
|
|
if (CUSTOMNO.toString().trim() != "") {
|
|
|
sql += " AND CUSTOMNO='" + CUSTOMNO + "'";
|
|
|
}
|
|
|
if (CUSTOMERNAME.toString().trim() != "") {
|
|
|
sql += " AND CUSTOMERNAME='" + CUSTOMERNAME + "'";
|
|
|
}
|
|
|
//
|
|
|
if (sql.toString().trim() != "") {
|
|
|
this.storeBodyAddList.load({
|
|
|
timeout: 6000000, //60秒,
|
|
|
params: { condition: sql, condition2: this.opStatus }
|
|
|
});
|
|
|
}
|
|
|
}, this);
|
|
|
|
|
|
this.gridMblnoList.on('cellclick', function (button, event) {
|
|
|
var selectedRecords = this.gridMblnoList.selModel.getSelection(); //选中行
|
|
|
var strBLNOAll = "";
|
|
|
var strCUSTOMNOAll = "";
|
|
|
var strCUSTOMERNAMEAll = "";
|
|
|
var strDUIGID = "";
|
|
|
for (var i = 0; i < selectedRecords.length; i++) {
|
|
|
var rec = selectedRecords[i];
|
|
|
strDUIGID = "'" + rec.get('DUIGID') + "'";
|
|
|
//
|
|
|
if (strBLNOAll == "") {
|
|
|
strBLNOAll = "'" + rec.get('BLNO') + "'";
|
|
|
strCUSTOMNOAll = "'" + rec.get('CUSTOMNO') + "'";
|
|
|
strCUSTOMERNAMEAll = "'" + rec.get('CUSTOMERNAME') + "'";
|
|
|
}
|
|
|
else {
|
|
|
strBLNOAll += ",'" + rec.get('BLNO') + "'";
|
|
|
strCUSTOMNOAll += ",'" + rec.get('CUSTOMNO') + "'";
|
|
|
strCUSTOMERNAMEAll += ",'" + rec.get('CUSTOMERNAME') + "'";
|
|
|
}
|
|
|
}
|
|
|
var strSql = "";
|
|
|
if (strBLNOAll.trim() != "") {
|
|
|
strSql += " and BLNO in (" + strBLNOAll + ")";
|
|
|
}
|
|
|
else {
|
|
|
strSql = " and 1<0";
|
|
|
}
|
|
|
if (strCUSTOMNOAll.trim() != "") {
|
|
|
strSql += " and CUSTOMNO in (" + strCUSTOMNOAll + ")";
|
|
|
}
|
|
|
else {
|
|
|
strSql = " and 1<0";
|
|
|
}
|
|
|
if (strCUSTOMERNAMEAll.trim() != "") {
|
|
|
strSql += " and CUSTOMERNAME in (" + strCUSTOMERNAMEAll + ")";
|
|
|
}
|
|
|
else {
|
|
|
strSql = " and 1<0";
|
|
|
}
|
|
|
if (strDUIGID.trim() != "") {
|
|
|
strSql += " and DUIGID in (" + strDUIGID + ")";
|
|
|
}
|
|
|
//
|
|
|
this.storeListSumSelectAll.load({
|
|
|
timeout: 6000000, //60秒,
|
|
|
params: { condition: strSql, opstatus: this.opStatus, hjname: '选中金额:' }
|
|
|
});
|
|
|
}, this);
|
|
|
|
|
|
//#endregion
|
|
|
|
|
|
}, //end initUIComponents
|
|
|
|
|
|
//#region 初始化数据函数
|
|
|
InitData: function () {
|
|
|
this.opStatus = 'add';
|
|
|
var condition = '';
|
|
|
var GID = "";
|
|
|
if (this.ParentWin) {
|
|
|
var ret = this.ParentWin.OprationSwap();
|
|
|
this.opStatus = ret[0];
|
|
|
this.StoreList = ret[1];
|
|
|
this.EditRecord = ret[2];
|
|
|
this.btnRefresh = ret[4];
|
|
|
}
|
|
|
if (this.opStatus == 'edit') {
|
|
|
condition = " GID='" + this.EditRecord.get('GID') + "'";
|
|
|
GID = this.EditRecord.get('GID');
|
|
|
//condition = " DUINO='" + this.EditRecord.get('DUINO') + "'";
|
|
|
}
|
|
|
this.LoadData(this.opStatus, condition, GID);
|
|
|
}, //end InitData
|
|
|
|
|
|
LoadData: function (opstatus, condition, GID) {
|
|
|
this.serialNo = 0;
|
|
|
this.workSerialNo = 0;
|
|
|
this.bodyDel = [];
|
|
|
this.opStatus = opstatus;
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在查询主表数据...',
|
|
|
url: '/MvcShipping/RptWmsSettlementList_GuiGe/GetData',
|
|
|
params: {
|
|
|
handle: opstatus,
|
|
|
condition: condition
|
|
|
},
|
|
|
callback: function (options, success, response) {
|
|
|
if (success) {
|
|
|
var result = Ext.JSON.decode(response.responseText);
|
|
|
if (!result.Success) {
|
|
|
Ext.Msg.show({
|
|
|
title: '提示',
|
|
|
msg: result.Message,
|
|
|
icon: Ext.MessageBox.ERROR,
|
|
|
buttons: Ext.Msg.OK
|
|
|
});
|
|
|
return;
|
|
|
}
|
|
|
var data = result.data;
|
|
|
this.formEdit.getForm().reset();
|
|
|
this.formEdit.getForm().setValues(data);
|
|
|
} else {
|
|
|
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
|
|
|
}
|
|
|
},
|
|
|
scope: this
|
|
|
});
|
|
|
//加载明细表
|
|
|
if (opstatus == "edit") {
|
|
|
var sql = opstatus;
|
|
|
var sql2 = "DUIGID='" + GID + "'";
|
|
|
var DUIGID = " and DUIGID='" + GID + "'";
|
|
|
this.storeMblnoList.load({
|
|
|
timeout: 6000000, //60秒,
|
|
|
params: { start: 0, limit: this.PageSize, sort: '', condition: 'edit', condition2: sql2, condition3: '', condition4: '', strSTARTBILLINGDATE: '', strENDBILLINGDATE: '' },
|
|
|
waitMsg: "正在查询数据...",
|
|
|
callback: function (r, options, success) {
|
|
|
if (success) {
|
|
|
var sql = " AND 1<0";
|
|
|
this.storeBodyAddList.load({
|
|
|
timeout: 6000000, //60秒,
|
|
|
params: { condition: sql, condition2: "edit" }
|
|
|
});
|
|
|
}
|
|
|
},
|
|
|
scope: this
|
|
|
});
|
|
|
//合计
|
|
|
this.storeListSum.load({
|
|
|
timeout: 6000000, //60秒,
|
|
|
params: { condition: DUIGID, opstatus: 'edit', hjname: '合计金额:' }
|
|
|
});
|
|
|
//this.storeListSumSelect.load({ params: { condition: " and 1<0", opstatus: 'edit', hjname: '当前金额:'} });
|
|
|
this.storeListSumSelectAll.load({
|
|
|
timeout: 6000000, //60秒,
|
|
|
params: { condition: " and 1<0", opstatus: 'edit', hjname: '选中金额:' }
|
|
|
});
|
|
|
}
|
|
|
}, // end LoadDate
|
|
|
//#endregion
|
|
|
|
|
|
//#region 按钮是否显示
|
|
|
setBtn:function(){
|
|
|
if (this.opStatus == 'edit') {
|
|
|
this.formSearch.hide();
|
|
|
Ext.getCmp('btsave').setVisible(false);
|
|
|
Ext.getCmp('btsave2').setVisible(false);
|
|
|
Ext.getCmp('btdel').setVisible(true);
|
|
|
Ext.getCmp('btPrint').setVisible(true);
|
|
|
}
|
|
|
else {
|
|
|
this.formSearch.show();
|
|
|
Ext.getCmp('btsave').setVisible(true);
|
|
|
Ext.getCmp('btsave2').setVisible(false);
|
|
|
Ext.getCmp('btdel').setVisible(false);
|
|
|
Ext.getCmp('btPrint').setVisible(false);
|
|
|
};
|
|
|
},
|
|
|
//#endregion
|
|
|
|
|
|
//#region 0-保存,1-保存并关闭,2-保存并新建
|
|
|
Save: function (type) {
|
|
|
var basicForm = this.formEdit.getForm();
|
|
|
if (!basicForm.isValid()) {
|
|
|
return;
|
|
|
}
|
|
|
//
|
|
|
var selectedRecords = this.gridMblnoList.selModel.getSelection();
|
|
|
var strBLNOs = "";
|
|
|
var strCUSTOMNOs = "";
|
|
|
var strCUSTOMERNAMEs = "";
|
|
|
for (var i = 0; i < selectedRecords.length; i++) {
|
|
|
var rec = selectedRecords[i];
|
|
|
if (strBLNOs == "") {
|
|
|
strBLNOs = "'" + rec.get('BLNO') + "'";
|
|
|
strCUSTOMNOs = "'" + rec.get('CUSTOMNO') + "'";
|
|
|
strCUSTOMERNAMEs = "'" + rec.get('CUSTOMERNAME') + "'";
|
|
|
}
|
|
|
else {
|
|
|
strBLNOs += ",'" + rec.get('BLNO') + "'";
|
|
|
strCUSTOMNOs += ",'" + rec.get('CUSTOMNO') + "'";
|
|
|
strCUSTOMERNAMEs += ",'" + rec.get('CUSTOMERNAME') + "'";
|
|
|
}
|
|
|
}
|
|
|
var sql = "";
|
|
|
if (strBLNOs.trim() != "") {
|
|
|
sql += " and BLNO in (" + strBLNOs + ")";
|
|
|
}
|
|
|
if (strCUSTOMNOs.trim() != "") {
|
|
|
sql += " and CUSTOMNO in (" + strCUSTOMNOs + ")";
|
|
|
}
|
|
|
if (strCUSTOMERNAMEs.trim() != "") {
|
|
|
sql += " and CUSTOMERNAME in (" + strCUSTOMERNAMEs + ")";
|
|
|
}
|
|
|
//
|
|
|
var data = basicForm.getValues();
|
|
|
Ext.Msg.wait('正在保存数据, 请稍侯..');
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在保存数据...',
|
|
|
url: '/MvcShipping/RptWmsSettlementList_GuiGe/Save',
|
|
|
scope: this,
|
|
|
params: {
|
|
|
condition: sql,
|
|
|
opstatus: this.opStatus,
|
|
|
data: Ext.JSON.encode(data)
|
|
|
},
|
|
|
callback: function (options, success, response) {
|
|
|
if (success) {
|
|
|
Ext.MessageBox.hide();
|
|
|
var jsonresult = Ext.JSON.decode(response.responseText);
|
|
|
if (jsonresult.Success) {
|
|
|
var returnData = jsonresult.Data;
|
|
|
this.formEdit.getForm().setValues(returnData);
|
|
|
|
|
|
if (this.opStatus == 'add') {
|
|
|
}
|
|
|
else if (this.opStatus == 'edit') {
|
|
|
this.EditRecord.commit();
|
|
|
}
|
|
|
//
|
|
|
if (this.btnRefresh == null) {
|
|
|
}
|
|
|
else {
|
|
|
var btn = opener.document.getElementById(this.btnRefresh.id);
|
|
|
btn.click();
|
|
|
}
|
|
|
//
|
|
|
if (type == '0') {
|
|
|
this.opStatus = 'edit';
|
|
|
this.setBtn();
|
|
|
} else if (type == '1') {
|
|
|
window.close();
|
|
|
} else {
|
|
|
this.LoadData('add', '');
|
|
|
this.setBtn();
|
|
|
}
|
|
|
} 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 });
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
//#endregion
|
|
|
|
|
|
//#region 执行查询
|
|
|
onRefreshClick: function (button, event) {
|
|
|
var sql = this.getCondition();
|
|
|
var sql2 = this.getCondition2();
|
|
|
var sql3 = this.getCondition3();
|
|
|
var sql4 = this.getCondition4();
|
|
|
var strSTARTBILLINGDATE = this.getSTARTBILLINGDATE();
|
|
|
var strENDBILLINGDATE = this.getENDBILLINGDATE();
|
|
|
if (sql != "" || sql2 != "" || sql3 != "" || sql4 != "") {
|
|
|
Ext.Ajax.timeout = 6000000;
|
|
|
this.storeMblnoList.load({
|
|
|
params: { start: 0, limit: this.PageSize, sort: '', condition: sql, condition2: sql2, condition3: sql3, condition4: sql4, strSTARTBILLINGDATE: strSTARTBILLINGDATE, strENDBILLINGDATE: strENDBILLINGDATE },
|
|
|
waitMsg: "正在查询数据...",
|
|
|
timeout: 6000000, //60秒,
|
|
|
callback: function (r, options, success) {
|
|
|
if (success) {
|
|
|
var sql = " AND 1<0";
|
|
|
this.storeBodyAddList.load({
|
|
|
timeout: 6000000, //60秒,
|
|
|
params: { condition: sql, condition2: "edit" }
|
|
|
});
|
|
|
}
|
|
|
},
|
|
|
scope: this
|
|
|
});
|
|
|
//合计
|
|
|
this.storeListSum.load({
|
|
|
timeout: 6000000, //60秒,
|
|
|
params: { condition: '', opstatus: 'add', hjname: '合计金额:' }
|
|
|
|
|
|
});
|
|
|
this.storeListSumSelectAll.load({
|
|
|
timeout: 6000000, //60秒,
|
|
|
params: { condition: " and 1<0", opstatus: 'edit', hjname: '选中金额:' }
|
|
|
});
|
|
|
}
|
|
|
},
|
|
|
//#endregion
|
|
|
|
|
|
//#region 重置条件
|
|
|
onClearSql: function () {
|
|
|
var form = this.formSearch.getForm();
|
|
|
form.reset();
|
|
|
},
|
|
|
//#endregion
|
|
|
|
|
|
//#region 查询条件赋值
|
|
|
getCondition: function () {
|
|
|
var form = this.formSearch.getForm();
|
|
|
if (!form.isValid()) {
|
|
|
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
|
|
|
return '';
|
|
|
}
|
|
|
|
|
|
var sql = '';
|
|
|
|
|
|
//var WMSDATE_min = form.findField('WMSDATE_min').getRawValue();
|
|
|
//var WMSDATE_max = form.findField('WMSDATE_max').getRawValue();
|
|
|
//if (WMSDATE_min == "" || WMSDATE_max == "") {
|
|
|
// Ext.Msg.alert('提示', '请选择对账日期!');
|
|
|
// return '';
|
|
|
//}
|
|
|
//sql = sql + getAndConSql(sql, WMSDATE_min, "CONVERT(char(10), WMSDATE, 120) >= '" + WMSDATE_min + "'");
|
|
|
//sql = sql + getAndConSql(sql, WMSDATE_max, "CONVERT(char(10), WMSDATE, 120) <= '" + WMSDATE_max + "'");
|
|
|
|
|
|
return sql;
|
|
|
},
|
|
|
|
|
|
//查询条件提取2
|
|
|
getCondition2: function () {
|
|
|
var form = this.formSearch.getForm();
|
|
|
if (!form.isValid()) {
|
|
|
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
|
|
|
return '';
|
|
|
}
|
|
|
var sql = '';
|
|
|
var WMSDATE_min = form.findField('WMSDATE_min').getRawValue();
|
|
|
var WMSDATE_max = form.findField('WMSDATE_max').getRawValue();
|
|
|
if (WMSDATE_min == "" || WMSDATE_max == "") {
|
|
|
Ext.Msg.alert('提示', '请选择对账日期!');
|
|
|
return '';
|
|
|
}
|
|
|
sql = sql + getAndConSql(sql, WMSDATE_min, "CONVERT(char(10), DODATE, 120) >= '" + WMSDATE_min + "'");
|
|
|
sql = sql + getAndConSql(sql, WMSDATE_max, "CONVERT(char(10), DODATE, 120) <= '" + WMSDATE_max + "'");
|
|
|
return sql;
|
|
|
},
|
|
|
|
|
|
//查询条件提取4
|
|
|
getCondition4: function () {
|
|
|
var form = this.formSearch.getForm();
|
|
|
if (!form.isValid()) {
|
|
|
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
|
|
|
return '';
|
|
|
}
|
|
|
var sql = '';
|
|
|
var WMSDATE_max = form.findField('WMSDATE_max').getRawValue();
|
|
|
var WMSDATE_min = form.findField('WMSDATE_min').getRawValue();
|
|
|
if (WMSDATE_min == "" || WMSDATE_max == "") {
|
|
|
Ext.Msg.alert('提示', '请选择对账日期!');
|
|
|
return '';
|
|
|
}
|
|
|
sql = sql + getAndConSql(sql, WMSDATE_max, "CONVERT(char(10), DODATE, 120) <= '" + WMSDATE_max + "'");
|
|
|
return sql;
|
|
|
},
|
|
|
|
|
|
//查询条件提取3
|
|
|
getCondition3: function () {
|
|
|
var form = this.formSearch.getForm();
|
|
|
if (!form.isValid()) {
|
|
|
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
|
|
|
return '';
|
|
|
}
|
|
|
|
|
|
//查询条件
|
|
|
var sql = " CORPID='" + COMPANYID + "'";
|
|
|
|
|
|
var BLNO = form.findField('BLNO').getValue();
|
|
|
sql = sql + getAndConSql(sql, BLNO, "(BLNO like '%" + BLNO + "%')");
|
|
|
|
|
|
var CustomerName = form.findField('CUSTOMERNAME').getValue();
|
|
|
sql = sql + getAndConSql(sql, CustomerName, "CUSTOMERNAME = '" + CustomerName + "'");
|
|
|
|
|
|
var STORAGENAME = form.findField('STORAGENAME').getValue();
|
|
|
sql = sql + getAndConSql(sql, STORAGENAME, "STORAGENAME = '" + STORAGENAME + "'");
|
|
|
|
|
|
|
|
|
return sql;
|
|
|
},
|
|
|
|
|
|
//查询条件_开始计费日期
|
|
|
getSTARTBILLINGDATE: function () {
|
|
|
var form = this.formSearch.getForm();
|
|
|
if (!form.isValid()) {
|
|
|
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
|
|
|
return '';
|
|
|
}
|
|
|
var WMSDATE_max = form.findField('WMSDATE_max').getRawValue();
|
|
|
var WMSDATE_min = form.findField('WMSDATE_min').getRawValue();
|
|
|
if (WMSDATE_min == "" || WMSDATE_max == "") {
|
|
|
Ext.Msg.alert('提示', '请选择对账日期!');
|
|
|
return '';
|
|
|
}
|
|
|
return WMSDATE_min;
|
|
|
},
|
|
|
|
|
|
//查询条件_结束计费日期
|
|
|
getENDBILLINGDATE: function () {
|
|
|
var form = this.formSearch.getForm();
|
|
|
if (!form.isValid()) {
|
|
|
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
|
|
|
return '';
|
|
|
}
|
|
|
var WMSDATE_max = form.findField('WMSDATE_max').getRawValue();
|
|
|
var WMSDATE_min = form.findField('WMSDATE_min').getRawValue();
|
|
|
if (WMSDATE_min == "" || WMSDATE_max == "") {
|
|
|
Ext.Msg.alert('提示', '请选择对账日期!');
|
|
|
return '';
|
|
|
}
|
|
|
return WMSDATE_max;
|
|
|
},
|
|
|
//#endregion
|
|
|
|
|
|
//#region 打印
|
|
|
Print: function () {
|
|
|
var basicForm = this.formEdit.getForm();
|
|
|
var billNo = basicForm.findField('DUINO').value;
|
|
|
if (billNo == '*' || billNo == '') {
|
|
|
Ext.Msg.show({ title: '错误', msg: '单据还没有保存,请保存后再打印', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
//#region 语句链
|
|
|
var printType = 'WMSDUI';
|
|
|
var sql1 = "SELECT GID as 惟一编号,DUIGID as 对账GID,DUINO as 对账编号,BLNO as 提单号,CUSTOMNO as 报关单号,CONTRACTNO as 合同号,WMSNO as 入库单号,OUTBSNO as 出库单号,CUSTOMERNAME as 货主,STORAGENAME as 仓库,CONVERT(char(10), WMSDATE, 20) as 入库日期,GOODSPACK as 入库件数,GOODSPACKSTOCK as 库存件数,GOODSRKSL as 入库数量,GOODSSTOCK as 库存数量,CHARGEUNIT as 计费单位,FEETYPE as 费用类别,FEEGRADE as 计费等级,FEESCALE as 计费区间,FEEPRICE as [计费单价/费率],CONVERT(char(10), STARTBILLINGDATE, 20) as 应收开始计费日期,CONVERT(char(10), ENDBILLINGDATE, 20) as 应收结束计费日期,FEEDAYS as 应收计费天数,OUTFEE as 应收仓储费,(SELECT TOP (1) SHOWNAME FROM [user] WHERE GID = wms_settlement_detail.CREATEUSER) as 创建人,CREATETIME as 创建时间,ISMAKEOUT as 是否重新生成过,(SELECT TOP (1) SHOWNAME FROM [user] WHERE GID = wms_settlement_detail.MAKEOUTUSER) as 重新生成人,MAKEOUTTIME as 重新生成时间,CORPID as 分公司代码,LINENUM as 单个grid的行号,GID_LINK as 出入库主表关联GID,ISDELETE as 是否删除,(SELECT TOP (1) SHOWNAME FROM [user] WHERE GID = wms_settlement_detail.DELETEUSER) as 删除人,DELETETIME as 删除时间 FROM wms_settlement_detail WHERE DUINO='" + billNo + "' and ISDELETE=0 order by BLNO,WMSNO,GID_LINK,LINENUM,ENDBILLINGDATE"; //明细表
|
|
|
|
|
|
var sql2 = "SELECT GID as 惟一编号,DUINO as 对账编号,CUSTOMERNAME as 对账客户,CONVERT(char(10), STARTBILLINGDATE, 20) as 开始计费日期,CONVERT(char(10), ENDBILLINGDATE, 20) as 结束计费日期,REMARK as 备注,(SELECT TOP (1) [NAME] FROM [company] WHERE GID = wms_settlement_list.CORPID) as 分公司代码,(SELECT TOP (1) SHOWNAME FROM [user] WHERE GID = wms_settlement_list.CREATEUSER) as 创建人,CREATETIME as 创建时间,ISMAKEOUT as 是否重新生成过,(SELECT TOP (1) SHOWNAME FROM [user] WHERE GID = wms_settlement_list.MAKEOUTUSER) as 重新生成人,MAKEOUTTIME as 重新生成时间,ISDELETE as 是否删除,(SELECT TOP (1) SHOWNAME FROM [user] WHERE GID = wms_settlement_list.DELETEUSER) as 删除人,DELETETIME as 删除时间 FROM wms_settlement_list WHERE DUINO='" + billNo + "' and ISDELETE=0 order by ENDBILLINGDATE"; //主表
|
|
|
|
|
|
var sql3 = "select *,全部出库数量=isnull((入库数量-当前库存数量),0) from (select top 1"
|
|
|
+ " 入库数量=isnull((select sum(GOODSRKSL) from (select GOODSRKSL,blno,WMSNO from wms_settlement_detail where DUINO='" + billNo + "' and ISDELETE=0 and (LINENUM=1 or LINENUM=5) group by blno,WMSNO,GOODSRKSL) as b),0)"
|
|
|
+ ",当前库存数量=isnull((select sum(GOODSSTOCK) from (select GOODSSTOCK,blno,WMSNO from wms_settlement_detail where DUINO='" + billNo + "' and ISDELETE=0 and LINENUM=5 group by blno,WMSNO,GOODSSTOCK) as e),0)"
|
|
|
+ ",当前应收仓储费=isnull((select sum(OUTFEE) from wms_settlement_detail where DUINO='" + billNo + "' and ISDELETE=0),0)"
|
|
|
+ " from wms_settlement_detail as d WHERE DUINO='" + billNo + "' and ISDELETE=0"
|
|
|
+ ") as a"; //统计本单出入库总量和库存、金额等
|
|
|
|
|
|
var sql4 = "SELECT GID as 惟一值,CODENAME as 客户代码,SHORTNAME as 客户简称,DESCRIPTION as 客户中文名称或描述信息,NAME as 客户英文简称,EnFullName as 客户英文全称,STATUS as 客户状态,ADDR as 通讯地址,EMAIL as 电子邮箱,WEB as 网页,(CASE TEL WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE TEL END) as 电话,(CASE FAX WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE FAX END) as 传真,CHIEF as 负责人,SALE as 所属揽货人,OP as 所属操作,DOC as 所属单证,ISCARRIER as 是否船公司,ISBOOKING as 是否订舱公司,ISYARD as 是否场站,ISTRUCK as 是否车队,ISCONTROLLER as 是否委托单位,ISCUSTOM as 是否报关行,ISAGENT as 是否国外代理,ISAGENTCN as 是否国内代理,ISEXPRESS as 是否快递公司,ISAIRLINES as 是否航空公司,ISSHIPPER as 是否发货人,ISCONSIGNEE as 是否收货人,ISNOTIFYPARTY as 是否通知人,ISWAREHOUSE as 是否仓库,ISINSURE as 是保险公司,ISLEASING as 是租箱公司,ISTRADINGAGENCY as 是否贸易代理,ISOTHER as 其他_,OTHERS as 其他说明,COUNTRY as 国家,PROVINCE as 省或州,CITY as 城市,CORPID as 所属分公司代码,BLCONTENT as 详细信息,ISSTOP as 是否停用该客户信息,BillRises1 as 发票抬头1,BillRises2 as 发票抬头2,RMBBillRises as 人民币支票抬头,RMBBank as 人民币开户银行,RMBAccount as 人民币账号,RMBOnlineNO as 人民币联机行号,USDBillRises as 美元支票抬头,USDBank as 美元开户银行,USDAccount as 美元账号,USDOnlineNO as 美元联机行号,CustomAttributes1 as 自定义属性1,CustomAttributes2 as 自定义属性2,USDMaxAmountCredit as 美元信用最大金额,RMBMaxAmountCredit as 人民币信用最大金额,MaxAmountCredit as 信用最大金额,STLNAME as 结算方式,OPNAME as 处理人,OPTIME as 处理时间,REMARK as 备注,USDExchangeRate as 美金汇率,STLDATE as 月结时间,STLFIRSTHALFDATE as 上半月结时间,STLMIDDLEDATE as 下半月结时间,STLDATEPJ as 票结时间,LEVEL as 运价级别,LOGINNAME as 客户代码名,LOGINPASSWORD as 登录密码,QQ as QQ,MSN as MSN,(SELECT TOP (1) SHOWNAME FROM [user] WHERE GID = MODIFIEDUSER) as 最后一次更新操作人,MODIFIEDTIME as 最后一次更新操作时间,FARCODE as 财务应收帐款代码,FAPCODE as 财务应付帐款代码 FROM info_client where SHORTNAME in (select CUSTOMERNAME from wms_settlement_list WHERE DUINO='" + billNo + "' and ISDELETE=0) and ISSTOP=0 ";
|
|
|
|
|
|
var sql5 = "SELECT u.GID as 惟一编号,u.USERNAME as 英文名,u.PASSWORD as 登录密码,u.CODENAME as 用户代码名,u.SHOWNAME as 显示用户名,u.ENROLLTIME as 注册时间,(SELECT TOP (1) SHOWNAME FROM [user] WHERE GID = u.CREATEUSER) as 操作人,(SELECT TOP (1) SHOWNAME FROM [user] WHERE GID = u.MODIFIEDUSER) as 更改操作人,u.MODIFIEDTIME as 更改操作时间,u.ISDELETED as 账户删除状态标志,u.ISDISABLE as 账户禁用状态标志,b.COMPANYNAME as 公司简称,b.DEPTNAME as 部门名称,b.QQ as QQ,b.MSN as MSN,(CASE b.OFFICEPHONE WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE b.OFFICEPHONE END) as 办公电话号码,(CASE b.HOMEPHONE WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE b.HOMEPHONE END) as 家庭电话号码,b.MOBILE as 手机号码,(CASE b.FAX WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE b.FAX END) as 传真号码,b.EMAIL1 as 主电子邮件地址,b.EMAIL2 as 次电子邮件地址,b.HOMEADDRESS as 家庭地址,b.REMARK as 备注信息,(SELECT TOP (1) SHOWNAME FROM [user] WHERE GID = b.CREATEUSER) as 创建人,b.CREATETIME as 创建时间,(SELECT TOP (1) SHOWNAME FROM [user] WHERE GID = b.MODIFIEDUSER) as 最后一次操作人,b.MODIFIEDTIME as 最后一次操作时间,b.EMERGUSER as 紧急联系人,(CASE b.EMERGPHONE WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE b.EMERGPHONE END) as 紧急联系人联系电话,b.EMERGEMAIL as 紧急联系人邮箱,b.POSTCODE as 邮政编码,b.SIGNATURE as 签名图片,b.FINANCESOFTCODE as 财务软件代码,b.IMAGEURL as 头像url,b.SIGNATUREURL as 签名Url FROM [user] as u INNER JOIN user_baseinfo as b ON u.GID = b.USERID where u.GID='" + USERID + "'";
|
|
|
|
|
|
var sql6 = " SELECT GID as 惟一编号,CODENAME as 公司代码名,NAME as 公司简称,FULLNAME as 公司全称,ENNAME as 公司英文名称,ADDRESS as 公司联络地址,ENADDRESS as 公司英文地址,POSTCODE as 邮政编码,(CASE OFFICEPHONE WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE OFFICEPHONE END) AS 公司办公电话,(CASE FAX WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE FAX END) AS 传真号码,EMAIL as 电子邮箱,WEBSITEURL as 公司网址,LICENSECODE as 工商登记号,TAXCODE as 税务登记号,LOGO as 徽标,BillRises as 发票抬头,ChequePayable as 支票抬头,PRTHEADXML1 as 打印抬头1,PRTHEADXML2 as 打印抬头2,PRTHEADXML3 as 打印抬头3,PRTHEADXML4 as 打印抬头4,PRTHEADXML5 as 打印抬头5,CREATEUSER as 创建人gid,CREATETIME as 创建时间,MODIFIEDUSER as 更新人gid,MODIFIEDTIME as 更新时间,ISDELETED as 是否删除,ISDISABLE as 是否被禁用,PARENTID as 父公司GID,BANKSHEAD as 票号头字符 FROM [company] WHERE GID = '" + COMPANYID + "'";
|
|
|
//#endregion
|
|
|
|
|
|
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
|
|
|
},
|
|
|
//#endregion
|
|
|
|
|
|
//#region 删除
|
|
|
onDeleteClick: function (button, event) {
|
|
|
var selectedRecords = this.gridMblnoList.getSelectionModel().getSelection();
|
|
|
if (selectedRecords.length == 0) {
|
|
|
Ext.Msg.show({ title: '提示', msg: '请先选择单据!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
|
|
|
return;
|
|
|
}
|
|
|
//
|
|
|
var record = selectedRecords[0];
|
|
|
var DUIGID = record.data.DUIGID;
|
|
|
if (DUIGID.trim() != "") {
|
|
|
DUIGID = " and DUIGID='" + DUIGID + "'";
|
|
|
}
|
|
|
//
|
|
|
var selectedRecords = this.gridMblnoList.selModel.getSelection();
|
|
|
var strBLNOs = "";
|
|
|
var strCUSTOMNOs = "";
|
|
|
var strCUSTOMERNAMEs = "";
|
|
|
for (var i = 0; i < selectedRecords.length; i++) {
|
|
|
var rec = selectedRecords[i];
|
|
|
if (strBLNOs == "") {
|
|
|
strBLNOs = "'" + rec.get('BLNO') + "'";
|
|
|
strCUSTOMNOs = "'" + rec.get('CUSTOMNO') + "'";
|
|
|
strCUSTOMERNAMEs = "'" + rec.get('CUSTOMERNAME') + "'";
|
|
|
}
|
|
|
else {
|
|
|
strBLNOs += ",'" + rec.get('BLNO') + "'";
|
|
|
strCUSTOMNOs += ",'" + rec.get('CUSTOMNO') + "'";
|
|
|
strCUSTOMERNAMEs += ",'" + rec.get('CUSTOMERNAME') + "'";
|
|
|
}
|
|
|
}
|
|
|
var strSql = "";
|
|
|
if (strBLNOs.trim() != "") {
|
|
|
strSql += " and BLNO in (" + strBLNOs + ")";
|
|
|
}
|
|
|
if (strCUSTOMNOs.trim() != "") {
|
|
|
strSql += " and CUSTOMNO in (" + strCUSTOMNOs + ")";
|
|
|
}
|
|
|
if (strCUSTOMERNAMEs.trim() != "") {
|
|
|
strSql += " and CUSTOMERNAME in (" + strCUSTOMERNAMEs + ")";
|
|
|
}
|
|
|
//
|
|
|
Ext.MessageBox.confirm('提示', '确定删除记录吗?', function (btn) {
|
|
|
if (btn == 'yes') {
|
|
|
Ext.Msg.wait('正在删除数据...');
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在删除数据...',
|
|
|
url: '/MvcShipping/RptWmsSettlementList_GuiGe/Delete_Detail',
|
|
|
params: {
|
|
|
DUIGID: DUIGID,
|
|
|
strBLNOs: strSql,
|
|
|
data: Ext.JSON.encode(record.data)
|
|
|
},
|
|
|
callback: function (options, success, response) {
|
|
|
if (success) {
|
|
|
var jsonresult = Ext.JSON.decode(response.responseText);
|
|
|
if (jsonresult.Success) {
|
|
|
for (var i = 0; i < selectedRecords.length; i++) {
|
|
|
var rec = selectedRecords[i];
|
|
|
this.storeMblnoList.remove(rec);
|
|
|
}
|
|
|
//
|
|
|
var sql = " AND 1<0";
|
|
|
this.storeBodyAddList.load({
|
|
|
timeout: 6000000, //60秒,
|
|
|
params: { condition: sql, condition2: "edit" }
|
|
|
});
|
|
|
//合计
|
|
|
this.storeListSum.load({
|
|
|
timeout: 6000000, //60秒,
|
|
|
params: { condition: DUIGID, opstatus: 'edit', hjname: '合计金额:' }
|
|
|
});
|
|
|
this.storeListSumSelectAll.load({
|
|
|
timeout: 6000000, //60秒,
|
|
|
params: { condition: " and 1<0", opstatus: 'edit', hjname: '选中金额:' }
|
|
|
});
|
|
|
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
|
|
|
}); //end Ext.Ajax.request
|
|
|
}
|
|
|
}, this);
|
|
|
}
|
|
|
//#endregion
|
|
|
});
|
|
|
|
|
|
|