|
|
Ext.namespace('Shipping');
|
|
|
|
|
|
Shipping.MsCodeCtnrAddIndex = function (config) {
|
|
|
Ext.applyIf(this, config);
|
|
|
this.initUIComponents();
|
|
|
window.Shipping.MsCodeCtnrAddIndex.superclass.constructor.call(this);
|
|
|
};
|
|
|
|
|
|
Ext.extend(Shipping.MsCodeCtnrAddIndex, Ext.Panel, {
|
|
|
|
|
|
OprationStatus: null, //仅当弹出界面时使用
|
|
|
SelectedRecord: null,
|
|
|
EditRecord: null, //用于从主界面获取
|
|
|
BSNo: '',
|
|
|
PageSize: 50,
|
|
|
|
|
|
initUIComponents: function () {
|
|
|
|
|
|
this.formname = 'MsCodeCtnrAddList';
|
|
|
this.bsno = getUrlParam('bsno');
|
|
|
this.port = getUrlParam('port');
|
|
|
|
|
|
|
|
|
//定义数据集
|
|
|
this.storeList = Ext.create('Ext.data.Store', {
|
|
|
model: 'MsOpCtnrDetail',
|
|
|
pageSize: this.PageSize,
|
|
|
// autoLoad: { start: 0, limit: 30 },
|
|
|
remoteSort: true,
|
|
|
proxy: {
|
|
|
type: 'ajax',
|
|
|
url: '/MvcContainer/MsOpCtnr/GetCtnrList',
|
|
|
reader: {
|
|
|
id: 'CTNGID',
|
|
|
root: 'data',
|
|
|
totalProperty: 'totalCount'
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
//定义Grid
|
|
|
this.CntrCB = Ext.create('Ext.selection.CheckboxModel');
|
|
|
this.columns = [{
|
|
|
sortable: true,
|
|
|
dataIndex: 'CTNGID',
|
|
|
header: 'CTNGID',
|
|
|
hidden: true,
|
|
|
width: 80
|
|
|
}, {
|
|
|
sortable: true, //1
|
|
|
dataIndex: 'CNTRNO',
|
|
|
header: '箱号',
|
|
|
width: 120, hidden: false
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'CTNEFREF',
|
|
|
header: '空重',
|
|
|
width: 60
|
|
|
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'CTNALL',
|
|
|
header: '箱型',
|
|
|
width: 60
|
|
|
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'CNTRSOURCE',
|
|
|
header: '箱源',
|
|
|
width: 80
|
|
|
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'OWNERCTN',
|
|
|
header: '箱东',
|
|
|
width: 80
|
|
|
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'NOTYPE',
|
|
|
header: 'NEW/USED',
|
|
|
width: 80
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'ISLOCKBOXREF',
|
|
|
header: '是否有锁盒',
|
|
|
width: 80
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'ISSLOTREF',
|
|
|
header: '否有叉车槽',
|
|
|
width: 80
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'CTNCOLOR',
|
|
|
header: '颜色',
|
|
|
width: 120
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'CTNSTATUS',
|
|
|
header: '当前箱动态',
|
|
|
width: 80
|
|
|
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'CTNSTATUSTIME',
|
|
|
header: '箱动态时间',
|
|
|
width: 100,
|
|
|
renderer: Ext.util.Format.dateRenderer('Y-m-d')
|
|
|
},
|
|
|
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'MBLNO',
|
|
|
header: '当前提单号',
|
|
|
width: 100
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'PORT',
|
|
|
header: '当前地点',
|
|
|
width: 100
|
|
|
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'YARD',
|
|
|
header: '当前场站',
|
|
|
width: 80
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'ISBERETURNREF',
|
|
|
header: '需返箱',
|
|
|
width: 100
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'ISSTOPREF',
|
|
|
header: '是否停用',
|
|
|
width: 80
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'ISLOCKREF',
|
|
|
header: '是否锁箱',
|
|
|
width: 80
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'REMARK',
|
|
|
header: '备注',
|
|
|
width: 160
|
|
|
|
|
|
}];
|
|
|
this.girdcolums = this.columns;
|
|
|
|
|
|
this.Pagenum = Ext.create('Ext.form.field.Number', {
|
|
|
name: 'bottles',
|
|
|
fieldLabel:'每页记录数',//每页记录数
|
|
|
labelAlign: 'right',
|
|
|
value: this.PageSize,
|
|
|
maxValue: 100000,
|
|
|
width: 180,
|
|
|
minValue: 0,
|
|
|
listeners: {
|
|
|
specialkey: function (field, e) {
|
|
|
if (e.getKey() == e.ENTER) {
|
|
|
_this.onRefreshClick();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
this.girdcolums = DsTruck.GetGridPanel(USERID, this.formname, this.girdcolums, 1, true);
|
|
|
this.gridList = new Ext.grid.GridPanel({
|
|
|
store: this.storeList,
|
|
|
enableHdMenu: false,
|
|
|
region: 'center',
|
|
|
columnLines: true,
|
|
|
selModel: this.CntrCB,
|
|
|
loadMask: { msg: "数据加载中,请稍等..." },
|
|
|
trackMouseOver: true,
|
|
|
disableSelection: false,
|
|
|
viewConfig: {
|
|
|
enableTextSelection: true
|
|
|
},
|
|
|
columns: this.girdcolums,
|
|
|
bbar:[ Ext.create('Ext.PagingToolbar', {
|
|
|
store: this.storeList,
|
|
|
displayInfo: true,
|
|
|
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
|
|
|
emptyMsg: "没有数据"
|
|
|
}),this.Pagenum]
|
|
|
});
|
|
|
this.gridList.addListener('itemdblclick', function (dataview, record, item, index, e, b) {
|
|
|
this.SelectedRecord = record;
|
|
|
this.OprationStatus = 'edit';
|
|
|
DsOpenEditWin("/MvcContainer/MsOpCtnr/CodeEdit", "", "650", "850");
|
|
|
}, this);
|
|
|
|
|
|
//#region formSearch
|
|
|
//租买类型
|
|
|
|
|
|
|
|
|
|
|
|
this.storeCodeDisport = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'DsShipping.ux.CodeDisportModel',
|
|
|
autoLoad: true,
|
|
|
proxy: { url: '/CommMng/BasicDataRef/GetCodeDisportListRm' }
|
|
|
});
|
|
|
|
|
|
|
|
|
this.comboxPORTDISCHARGE = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
fieldLabel: '还箱港口',
|
|
|
store: this.storeCodeDisport,
|
|
|
queryMode: 'remote',
|
|
|
labelWidth: 120,
|
|
|
minChars: 1,
|
|
|
queryParam: 'CODENAME',
|
|
|
name: 'DESTPORT',
|
|
|
valueField: 'PORT',
|
|
|
displayField: 'PORT'
|
|
|
});
|
|
|
|
|
|
|
|
|
this.formSearch = Ext.widget('form', {
|
|
|
frame: true,
|
|
|
region: 'center',
|
|
|
bodyPadding: 5,
|
|
|
fieldDefaults: {
|
|
|
margins: '2 2 2 2',
|
|
|
labelAlign: 'right',
|
|
|
flex: 1,
|
|
|
labelWidth: 70,
|
|
|
msgTarget: 'qtip'
|
|
|
},
|
|
|
|
|
|
items: [
|
|
|
{//fieldset 1
|
|
|
xtype: 'container',
|
|
|
defaultType: 'textfield',
|
|
|
layout: 'anchor',
|
|
|
flex: 1,
|
|
|
defaults: {
|
|
|
anchor: '100%'
|
|
|
},
|
|
|
items: [{
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
defaultType: 'textfield',
|
|
|
items: [{
|
|
|
fieldLabel: '买箱单号',
|
|
|
name: 'BILLNO',
|
|
|
enableKeyEvents: true,
|
|
|
listeners: {
|
|
|
keyup: function (field, e) {
|
|
|
if (e.getKey() == e.ENTER) {
|
|
|
_this.onRefreshClick();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}, {
|
|
|
fieldLabel: '箱号',
|
|
|
name: 'CNTRNO',
|
|
|
enableKeyEvents: true,
|
|
|
listeners: {
|
|
|
keyup: function (field, e) {
|
|
|
if (e.getKey() == e.ENTER) {
|
|
|
_this.onRefreshClick();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}, {
|
|
|
fieldLabel: '租买时间(从)',
|
|
|
name: 'BSDATE',
|
|
|
format: 'Y-m-d',
|
|
|
labelWidth: 90,
|
|
|
xtype: 'datefield',
|
|
|
enableKeyEvents: true,
|
|
|
listeners: {
|
|
|
keyup: function (field, e) {
|
|
|
if (e.getKey() == e.ENTER) {
|
|
|
_this.onRefreshClick();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}, {
|
|
|
fieldLabel: '租买时间(到)',
|
|
|
labelWidth: 90,
|
|
|
name: 'BSDATETO',
|
|
|
format: 'Y-m-d',
|
|
|
xtype: 'datefield',
|
|
|
enableKeyEvents: true,
|
|
|
listeners: {
|
|
|
keyup: function (field, e) {
|
|
|
if (e.getKey() == e.ENTER) {
|
|
|
_this.onRefreshClick();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}, this.comboxPORTDISCHARGE
|
|
|
]
|
|
|
}
|
|
|
]//end items(fieldset 1)
|
|
|
}//end fieldset 1
|
|
|
]//end root items
|
|
|
|
|
|
});
|
|
|
|
|
|
//#endregion formSearch
|
|
|
|
|
|
//查询工具条
|
|
|
_this = this;
|
|
|
this.panelBtn = new Ext.Panel({
|
|
|
region: "north",
|
|
|
tbar: [
|
|
|
{
|
|
|
text: "引入集装箱",
|
|
|
iconCls: "btnadd",
|
|
|
handler: function (button, event) {
|
|
|
this.onAddClick(button, event);
|
|
|
},
|
|
|
scope: this
|
|
|
},{
|
|
|
text: "执行查询",
|
|
|
iconCls: "btnrefresh",
|
|
|
handler: function (button, event) {
|
|
|
this.onRefreshClick(button, event);
|
|
|
},
|
|
|
scope: this
|
|
|
}, {
|
|
|
text: "重置条件",
|
|
|
iconCls: "btnreset",
|
|
|
handler: function (button, event) {
|
|
|
this.onClearSql(button, event);
|
|
|
},
|
|
|
scope: this
|
|
|
},
|
|
|
'-', {
|
|
|
text: "保存列表样式",
|
|
|
menu: [{ text: "保存",
|
|
|
handler: function (button, event) {
|
|
|
_this.girdcolums = DsTruck.SaveGridPanel(GID, _this.formname, _this.gridList.columns, _this.girdcolums, 0, true); //使用者id,表名,中间column数组,跳过一开始的几列
|
|
|
|
|
|
}
|
|
|
}, { text: "初始化",
|
|
|
handler: function (menu, event) {
|
|
|
_this.gridList.reconfigure(_this.storeList, _this.columns);
|
|
|
_this.girdcolums = DsTruck.SaveGridPanel(GID, _this.formname, _this.gridList.columns, _this.columns, 0, true); //使用者id,表名,中间column数组,跳过一开始的几列
|
|
|
}
|
|
|
}],
|
|
|
scope: this
|
|
|
}
|
|
|
]
|
|
|
});
|
|
|
|
|
|
this.panelTop = new Ext.Panel({
|
|
|
layout: "border",
|
|
|
region: "north",
|
|
|
height: 80,
|
|
|
items: [this.formSearch, this.panelBtn]
|
|
|
});
|
|
|
|
|
|
Ext.apply(this, {
|
|
|
items: [this.panelTop, this.gridList]
|
|
|
});
|
|
|
|
|
|
this.formSearch.getForm().findField('DESTPORT').setValue(this.port);
|
|
|
this.InitData();
|
|
|
|
|
|
|
|
|
}, //end initUIComponents
|
|
|
|
|
|
//#region 加载事件
|
|
|
InitData: function () {
|
|
|
|
|
|
this.sqlcontext = " CTNSTATUS='可用' and isnull(ISSTOP,0)=0 AND EXISTS (select 1 from op_ctnmng_return d where d.BSNO=c.BSNO and d.PORT='" + this.port + "') ";
|
|
|
this.storeList.load({
|
|
|
params: { start: 0, limit: this.PageSize, sort: '', condition: this.sqlcontext },
|
|
|
waitMsg:"正在查询数据...",
|
|
|
scope: this
|
|
|
});
|
|
|
|
|
|
this.storeList.on('beforeload', function (store) {
|
|
|
|
|
|
Ext.apply(store.proxy.extraParams, { condition: this.sqlcontext });
|
|
|
}, this);
|
|
|
//#endregion
|
|
|
|
|
|
|
|
|
}, //end InitData
|
|
|
//#endregion
|
|
|
onRefreshClick: function (button, event) {
|
|
|
var sql = this.getCondition();
|
|
|
|
|
|
|
|
|
this.PageSize = this.Pagenum.getValue();
|
|
|
this.storeList.pageSize = this.PageSize;
|
|
|
|
|
|
this.sqlcontext = sql;
|
|
|
this.storeList.load({
|
|
|
params: { start: 0, limit: this.PageSize, sort: '', condition: sql },
|
|
|
waitMsg: "正在查询数据...",
|
|
|
scope: this
|
|
|
});
|
|
|
},
|
|
|
|
|
|
onAddClick: function (button, event) {
|
|
|
var selections = this.gridList.getSelectionModel().getSelection();
|
|
|
if (selections.length == 0) {
|
|
|
Ext.Msg.show({ title: '提示', msg: '请先选择箱号!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
var selectedRecords = [];
|
|
|
this.parentWin = window.parent.opener._this;
|
|
|
|
|
|
selectedRecords = this.gridList.selModel.getSelection();
|
|
|
var selectStores = [];
|
|
|
for (var i = 0; i < selectedRecords.length; i++) {
|
|
|
selectStores.push(selectedRecords[i].data);
|
|
|
}
|
|
|
|
|
|
Ext.MessageBox.confirm('提示', '确定要引入要选择的箱号吗?', function (btn) {
|
|
|
if (btn == 'yes') {
|
|
|
Ext.Msg.wait('正在操作数据...');
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在操作数据...',
|
|
|
url: '/MvcContainer/MsOpCtnr/InsertCtn',
|
|
|
params: {
|
|
|
data: Ext.JSON.encode(selectStores),
|
|
|
BSNO: this.bsno
|
|
|
},
|
|
|
callback: function (options, success, response) {
|
|
|
if (success) {
|
|
|
var jsonresult = Ext.JSON.decode(response.responseText);
|
|
|
if (jsonresult.Success) {
|
|
|
this.storeList.remove(selections);
|
|
|
if (this.parentWin) {
|
|
|
this.parentWin.storeBodyList.reload();
|
|
|
}
|
|
|
|
|
|
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
|
|
|
}
|
|
|
}, this);
|
|
|
|
|
|
}, //onDeleteClick
|
|
|
|
|
|
|
|
|
|
|
|
getCondition: function () {
|
|
|
var form = this.formSearch.getForm();
|
|
|
if (!form.isValid()) {
|
|
|
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
|
|
|
return '';
|
|
|
}
|
|
|
|
|
|
var sql = " CTNSTATUS='可用' and isnull(ISSTOP,0)=0 ";
|
|
|
|
|
|
var BILLNO = form.findField('BILLNO').getValue();
|
|
|
sql = sql + getAndConSql(sql, BILLNO, " EXISTS (select 1 from op_ctnmng_detail d left join op_ctnmng m on (m.BSNO=d.BSNO) where d.CTNGID=op_ctnmng_ctndetail.CTNGID and m.BILLNO='" + BILLNO + "') ");
|
|
|
|
|
|
var CNTRNO = form.findField('CNTRNO').getValue();
|
|
|
sql = sql + getAndConSql(sql, CNTRNO, " CNTRNO like '%" + CNTRNO + "%'");
|
|
|
|
|
|
var BSDATE = form.findField('BSDATE').getRawValue();
|
|
|
sql = sql + getAndConSql(sql, BSDATE, " BSDATE >= '" + BSDATE + "'");
|
|
|
|
|
|
var BSDATETO = form.findField('BSDATETO').getRawValue();
|
|
|
if (BSDATETO != '' && BSDATETO != null) {
|
|
|
sql = sql + getAndConSql(sql, BSDATETO, " BSDATE <= '" + BSDATETO + "'");
|
|
|
}
|
|
|
|
|
|
var DESTPORT = form.findField('DESTPORT').getValue();
|
|
|
sql = sql + getAndConSql(sql, DESTPORT, " EXISTS (select 1 from op_ctnmng_return d where d.BSNO=c.BSNO and d.PORT='" + DESTPORT + "') ");
|
|
|
|
|
|
|
|
|
return sql;
|
|
|
},
|
|
|
onClearSql: function () {
|
|
|
var form = this.formSearch.getForm();
|
|
|
form.reset();
|
|
|
//this.InitData();
|
|
|
},
|
|
|
OprationSwap: function () {
|
|
|
var ret = new Array();
|
|
|
ret[0] = this.OprationStatus;
|
|
|
ret[1] = this.storeList;
|
|
|
ret[2] = this.SelectedRecord;
|
|
|
ret[3] = this.EditRecord;
|
|
|
ret[4] = this.OPLBNAME;
|
|
|
return ret;
|
|
|
},
|
|
|
|
|
|
onPrintClick: function (button, event) {
|
|
|
var printType = 'MsOpCtnrList';
|
|
|
var uid = USERID;
|
|
|
var sql1 = "select * from op_ctnmng";
|
|
|
var wherestr = this.getCondition();
|
|
|
if (wherestr != '') {
|
|
|
sql1 += "where 1=1 and " + wherestr;
|
|
|
}
|
|
|
|
|
|
PrintComm(printType, sql1);
|
|
|
},
|
|
|
|
|
|
|
|
|
PrintSelect: function () {
|
|
|
|
|
|
_this = this;
|
|
|
if (this.storeList.getCount() == 0) {
|
|
|
return;
|
|
|
}
|
|
|
var selectedRecords = [];
|
|
|
var storeadd = null;
|
|
|
selectedRecords = this.CntrCB.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 = 'MsOpCtnrListSelect';
|
|
|
var sql1 = "select * from op_ctnmng WHERE GID BSNO (" + feeGidSql + ") order by BSDATE DESC";
|
|
|
var sql2 = "";
|
|
|
var sql3 = "";
|
|
|
var sql4 = "";
|
|
|
var sql5 = "";
|
|
|
var sql6 = "";
|
|
|
|
|
|
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6,"");
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
|