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/MsOpApply/ChuQuIndex.js

682 lines
20 KiB
JavaScript

2 years ago
Ext.namespace('Shipping');
Shipping.ChuQu = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.ChuQu.superclass.constructor.call(this);
};
Ext.extend(Shipping.ChuQu, Ext.Panel, {
PageSize: 10,
ParentWin: null,
feeType: 0,
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
StoreFee: null,
StoreFeeUnit: null,
StoreFeeCust: null,
EditRecord: null,
initUIComponents: function () {
//定义数据集
this.storeList = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
model: 'MsOpApply',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsOpApply/GetDataList',
reader: {
id: 'GId',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//#region 主grid
_this = this;
this.gridListCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
this.gridList = new Ext.grid.GridPanel({
store: this.storeList,
enableHdMenu: false,
region: 'north',
height: 268,
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
selModel: this.gridListCheckBoxModel,
viewConfig: {
autoFill: true,
enableTextSelection: true
},
columns: [{
sortable: true,
dataIndex: 'MBLNO',
header: '主提单号',
width: 130
}, {
sortable: true,
dataIndex: 'CUSTOMNO',
header: '报关单号',
width: 80
}, {
sortable: true,
dataIndex: 'HBLNO',
header: '分提单号',
width: 80
}, {
sortable: true,
dataIndex: 'CUSTNO',
header: '委托编号',
width: 130
}, {
sortable: true,
dataIndex: 'CUSTOMERNAME',
header: '委托单位',
width: 120
}, {
sortable: true,
dataIndex: 'CUSTOMDATE',
header: '报关日期',
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
width: 86
}, {
sortable: true,
dataIndex: 'CUSTOMSER',
header: '报关行',
width: 120
}, {
sortable: true,
dataIndex: 'VESSEL',
header: '船名',
width: 130
}, {
sortable: true,
dataIndex: 'VOYNO',
header: '航次',
width: 50
}, {
sortable: true,
dataIndex: 'ETD',
header: '开船日期',
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
width: 86
}, {
sortable: true,
dataIndex: 'BSTYPE',
header: '业务类型',
width: 120
}, {
sortable: true,
dataIndex: 'INPUTBY',
header: '录入人',
width: 80
}, {
sortable: true,
dataIndex: 'CREATETIME',
header: '录入日期',
width: 86
}, {
sortable: true,
dataIndex: 'OP',
header: '操作',
width: 80
}, {
sortable: true,
dataIndex: 'SALE',
header: '揽货人',
width: 80
}
],
// paging bar on the bottom
bbar: [{
xtype: "button",
id: "button_add",
iconCls: "btnadd",
text: "引入出区报关",
handler: function (button, event) {
_this.onAddDetailClick(button, event);
}
},
'-',
{
xtype: "button",
id: "button_close",
text: "取消退出",
handler: function (button, event) {
window.close();
}
},Ext.create('Ext.PagingToolbar', {
store: this.storeList,
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"
})]
});
//#endregion
//#region 商品明细
this.storeBodyList = Ext.create('Ext.data.Store', {
model: 'MsOpApplyDetail',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsOpApply/GetBodyList',
reader: {
id: 'BsNo,SerialNo',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.girdcolums1 = [{
sortable: true,
dataIndex: 'BsNo',
header: '业务编号',
hidden: true,
width: 120
}, {
sortable: true,
dataIndex: 'SerialNo',
header: '序号',
width: 30
}, {
sortable: true,
dataIndex: 'GoodsCode',
header: '商品编码',
editor: {
xtype: 'textfield',
selectOnFocus: true
},
width: 120
}, {
sortable: true,
dataIndex: 'GoodsName',
header: '商品名称',
editor: {
xtype: 'textfield',
selectOnFocus: true
},
width: 120
}, {
sortable: true,
dataIndex: 'GOODSMODEL',
header: '型号/品牌',
editor: {
xtype: 'textfield',
selectOnFocus: true
},
width: 120
}, {
sortable: true,
dataIndex: 'GOODSSTANDARD',
header: '规格',
editor: {
xtype: 'textfield',
selectOnFocus: true
},
width: 120
}, {
sortable: true,
dataIndex: 'GOODSNUM',
header: '件数',
editor: {
xtype: 'numberfield',
allowBlank: false,
selectOnFocus: true
},
width: 120
}, {
sortable: true,
dataIndex: 'Pkgs',
header: '报关件数',
editor: {
xtype: 'numberfield',
allowBlank: false,
selectOnFocus: true
},
width: 120
}, {
sortable: true,
dataIndex: 'Price',
header: '单价',
editor: {
xtype: 'numberfield',
allowBlank: false,
selectOnFocus: true
},
width: 100,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
try {
var lsValue = usMoney(value, 2, '', false);
if (lsValue != "NaN") {
value = lsValue; if (parseFloat(lsValue) < 0) {
return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
}
}, {
sortable: true,
dataIndex: 'Total',
header: '总价',
editor: {
xtype: 'numberfield',
allowBlank: false,
selectOnFocus: true
},
width: 120,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
try {
var lsValue = usMoney(value, 2, '', false);
if (lsValue != "NaN") {
value = lsValue; if (parseFloat(lsValue) < 0) {
return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
}
}, {
sortable: true,
dataIndex: 'Currency',
header: '币别',
editor: {
xtype: 'textfield',
allowBlank: false,
selectOnFocus: true
},
width: 120
}, {
sortable: true,
dataIndex: 'Remark',
header: '其他',
editor: {
xtype: 'textfield',
selectOnFocus: true
},
width: 110
}
];
this.girdcolums2 = [{
sortable: true,
dataIndex: 'BsNo',
header: '业务编号',
hidden: true,
width: 120
}, {
sortable: true,
dataIndex: 'SerialNo',
header: '序号',
width: 30
}, {
sortable: true,
dataIndex: 'WMSIN_GID',
header: '商品名称',
editor: this.comboxWmsIn,
width: 120,
renderer: function (value, p, record) {
return record.data.GoodsName;
},
}, {
sortable: true,
dataIndex: 'GOODSMODEL',
header: '型号/品牌',
width: 120
}, {
sortable: true,
dataIndex: 'GOODSSTANDARD',
header: '瓶/规格',
width: 120
}, {
sortable: true,
dataIndex: 'GOODSNUM',
header: '规格件数',
editor: {
xtype: 'numberfield',
allowBlank: false,
selectOnFocus: true
},
width: 120
}, {
sortable: true,
dataIndex: 'GoodsCode',
header: '商品编码',
editor: {
xtype: 'textfield',
selectOnFocus: true
},
width: 120
}, {
sortable: true,
dataIndex: 'Pkgs',
header: '报关件数',
editor: {
xtype: 'numberfield',
allowBlank: false,
selectOnFocus: true
},
width: 120
}, {
sortable: true,
dataIndex: 'Price',
header: '单价',
editor: {
xtype: 'numberfield',
allowBlank: false,
selectOnFocus: true
},
width: 100,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
try {
var lsValue = usMoney(value, 2, '', false);
if (lsValue != "NaN") {
value = lsValue; if (parseFloat(lsValue) < 0) {
return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
}
}, {
sortable: true,
dataIndex: 'Total',
header: '总价',
editor: {
xtype: 'numberfield',
allowBlank: false,
selectOnFocus: true
},
width: 120,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
try {
var lsValue = usMoney(value, 2, '', false);
if (lsValue != "NaN") {
value = lsValue; if (parseFloat(lsValue) < 0) {
return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
}
}, {
sortable: true,
dataIndex: 'Currency',
header: '币别',
editor: {
xtype: 'textfield',
allowBlank: false,
selectOnFocus: true
},
width: 120
}, {
sortable: true,
dataIndex: 'Remark',
header: '其他',
editor: {
xtype: 'textfield',
selectOnFocus: true
},
width: 110
}
];
this.girdcolums = this.girdcolums2;
this.gridBodyList = new Ext.grid.GridPanel({
store: this.storeBodyList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
//plugins: [this.gridListCellEditing],
selType: 'cellmodel',
tbar: [],
columns: this.girdcolums
});
//#endregion
//#region formSearch
//#region formSearch枚举参照相关
//#endregion
this.formSearch = Ext.widget('form', {
frame: true,
region: 'center',
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 90,
msgTarget: 'qtip'
},
items: [
{//fieldset 1
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '编号',
name: 'MblNo'
}, {
fieldLabel: '委托单位',
name: 'CustName'
}, {
fieldLabel: '从报关日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'CustDate_Min'
}, {
fieldLabel: '至报关日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'CustDate_Max'
}, {
xtype: 'button',
width: 90,
text: "执行查询",
iconCls: "btnrefresh",
handler: function (button, event) {
this.onRefreshClick(button, event);
},
scope: this
}
]
}]
}]
});
//#endregion formSearch
//#region 按钮ToolBar
//#endregion
//#region 布局
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 55,
items: [this.formSearch]
});
this.panelBodyChFee = new Ext.Panel({
title: '商品明细',
layout: "border",
region: 'center',
margin: '5 10',
items: [this.gridBodyList]
});
this.panelFee = new Ext.Panel({
layout: "border",
region: "center",
items: [
this.panelBodyChFee
]
});
Ext.apply(this, {
items: [this.panelTop, this.gridList, this.panelFee]
});
//#endregion
this.parentWin = window.parent.opener;
if (this.parentWin) {
this.EditRecord = this.parentWin.EditRecord;
}
//#region 事件绑定
this.storeList.on('beforeload', function (store) {
var sql = this.getCondition();
Ext.apply(store.proxy.extraParams, { condition: sql });
}, this);
this.storeList.on('load', function (store, records) {
if (store.getCount() > 0) {
this.gridList.getSelectionModel().select(0);
//this.gridListCheckBoxModel.selectAll();
}
}, this);
this.gridList.getSelectionModel().on('select', function (model, record, index) {
//alert(record.data.BillNo);
var bsno = record.data.BSNO;
this.storeBodyList.load({ params: { BsNo: bsno } });
}, this);
//#endregion
//#region 自动刷新(已经提交但是尚未审核的业务,哪怕一票货中有一笔费用没审核也显示)
this.onAutoRefresh();
//#endregion
// this.SetBtnRight();
}, //end initUIComponents
onAutoRefresh: function () {
var sql = " CUSTOMTYPE='出区报关' ";
this.storeList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
},
onRefreshClick: function (button, event) {
var sql = this.getCondition();
this.storeList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
},
onAddDetailClick: function (button, event) {
selectedRecords = this.gridListCheckBoxModel.selected.items;
rec = selectedRecords[0];
//this.parentWin.onPostDetailClick(NaN, NaN, this.feeType);
//this.parentWin.calcDetailTotal();
var form = this.parentWin.panelEdit.Set_WMS_OUT_Value(rec.data, this.storeBodyList);
window.closeAction = 'destroy';
window.close();
},
GetHandleSerialNo: function (store, type) {
var result = 0;
if (result == 0) {
for (var i = 0; i < store.getCount(); i += 1) {
var member = store.getAt(i);
if (member.data.Sort > result) {
result = member.data.Sort;
}
}
}
result = parseInt(result) + 1;
return result;
},
getCondition: function () {
var form = this.formSearch.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return '';
}
var sql = " CUSTOMTYPE='出区报关' ";
var custName = form.findField('CustName').getValue();
sql = sql + getAndConSql(sql, custName, "CUSTOMERNAME like '%" + custName + "%'");
var mblNo = form.findField('MblNo').getValue();
sql = sql + getAndConSql(sql, mblNo, " (CUSTOMNO like '%" + mblNo + "%' or MBLNO like '%" + mblNo + "%' or HBLNO like '%" + mblNo + "%') ");
var custDate_Min = form.findField('CustDate_Min').getRawValue();
sql = sql + getAndConSql(sql, custDate_Min, "CUSTOMDATE >= '" + custDate_Min + "'");
var custDate_Max = form.findField('CustDate_Max').getRawValue();
sql = sql + getAndConSql(sql, custDate_Max, "CUSTOMDATE <= '" + custDate_Max + " 23:59:59'");
return sql;
}
});