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/MvcContainer/Viewsjs/MsOpCtnr/MsCodeCtnrIndex.js

665 lines
23 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');
Shipping.MsCodeCtnrIndex = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsCodeCtnrIndex.superclass.constructor.call(this);
};
Ext.extend(Shipping.MsCodeCtnrIndex, Ext.Panel, {
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
EditRecord: null, //用于从主界面获取
BSNo: '',
PageSize: 50,
initUIComponents: function () {
this.formname = 'MsCodeCtnrList';
this.ctnport = getUrlParam('ctnport');
this.ctnyard = getUrlParam('ctnyard');
this.ctnstatus = getUrlParam('ctnstatus');
this.ctnisstop = getUrlParam('ctnisstop');
//定义数据集
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: 'CURSTATUS',
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';
var openSet = "height=850, width=1250, toolbar=no, menubar=no,scrollbars=1, resizable=1,location=no, status=no,Top= " + (screen.height - 850) / 2 + ",Left= " + (screen.width - 1200) / 2
var openType = record.data.GID;
var openUrl = "/MvcContainer/MsOpCtnr/CodeEdit";
window.open(openUrl, openType, openSet);
}, this);
//#region formSearch
//租买类型
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();
}
}
}
}
]
}
]//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 (menu, event) {
_this.OprationStatus = 'add';
var openSet = "height=850, width=1250, toolbar=no, menubar=no,scrollbars=1, resizable=1,location=no, status=no,Top= " + (screen.height - 850) / 2 + ",Left= " + (screen.width - 1200) / 2
var openType ="";
var openUrl = "/MvcContainer/MsOpCtnr/CodeEdit";
window.open(openUrl, openType, openSet);
},
scope: this
}, '-',
{
text: "删除",
iconCls: "btndelete",
handler: function (button, event) {
this.onDeleteClick(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
}, {
text: "锁箱", //"打印",
iconCls: 'btnprint',
menu: [
{
text: "锁箱", //"全部",
handler: function (menu, event) {
_this.onLockClick('1');
}
}, {
text: "取消锁箱", //"选择打印",
handler: function (menu, event) {
_this.onLockClick('0');
}
}],
scope: this
}, {
text: "打印", //"打印",
iconCls: 'btnprint',
menu: [
{ text: "全部", //"全部",
handler: function (menu, event) {
_this.onPrintClick();
}
}, { text: "选择打印", //"选择打印",
handler: function (menu, event) {
_this.PrintSelect();
}
}],
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]
});
if (this.ctnport != undefined) {
this.sqlcontext = " ISNULL(s.PORT,'')='" + this.ctnport + "' and ISNULL(s.YARD,'')='" + this.ctnyard + "' and ISNULL(s.CTNSTATUS,'')='" + this.ctnstatus + "' AND (ISNULL(C.ISSTOP,0)=" + this.ctnisstop + ") ";
} else {
this.sqlcontext = '';
}
this.InitData();
}, //end initUIComponents
//#region 加载事件
InitData: function () {
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
});
},
onDeleteClick: 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 = [];
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/DeleteCtn',
params: {
data: Ext.JSON.encode(selectStores),
USERID: USERID
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
this.storeList.remove(selections);
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
onLockClick: function (type) {
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 lockstr = "锁箱";
if (type == '0') lockstr = "取消锁箱";
var selectedRecords = [];
selectedRecords = this.gridList.selModel.getSelection();
var selectStores = [];
var CtnrIndatas = [];
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
CtnrIndatas.push(rec);
}
var CtnrInBody = ConvertRecordsToJsonAll(CtnrIndatas);
Ext.MessageBox.confirm('提示', '确定' + lockstr+'该记录吗?', function (btn) {
if (btn == 'yes') {
Ext.Msg.wait('正在操作数据...');
Ext.Ajax.request({
waitMsg: '正在操作数据...',
url: '/MvcContainer/MsOpCtnr/LockCtn',
params: {
body: CtnrInBody,
islock: type
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
this.storeList.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 = "";
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, " c.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 + "'");
}
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,"");
}
});