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/MsOpSubSeaOrder/MsOpOrderCtnStatusAIndex.js

722 lines
22 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.MsOpOrderCtnStatusAIndex = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsOpOrderCtnStatusAIndex.superclass.constructor.call(this);
};
Ext.extend(Shipping.MsOpOrderCtnStatusAIndex, Ext.Panel, {
PageSize: 100,
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
isShowAdvancedQuery: 0, //是否显示高级查询面板
IsAudit: false,
BillType: 2,
sqlcontext: '',
initUIComponents: function () {
this.formname = "formMsOpOrderCtnStatusAIndex"; //页面名称
//定义数据集
this.storectndisp = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CtnDispModel',
proxy: { url: '/CommMng/BasicDataRef/GetCtnDisp' }
});
this.storeList = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
model: 'MsOrderCtnStatus',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsOpSubSeaOrder/GetCtnStatusList',
reader: {
id: 'CTN_ID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//#region List列表显示信息
Ext.grid.RowNumberer = Ext.extend(Ext.grid.RowNumberer, {
width: 30
});
this.girdcolums = [{
sortable: true,
dataIndex: 'BSNO',
hidden: true,
header: 'BSNO',
width: 0
},
{
sortable: true,
dataIndex: 'ORSTATUS',
hidden: true,
header: 'ORSTATUS',
width: 60
}, {
dataIndex: 'CTNALL',
header: 'CTN SIZE',
width: 70
}, {
dataIndex: 'CNTRNO',
header: 'CNTRNO',
width: 120
}, {
dataIndex: 'CTNSTATUS',
header: 'CTNSTATUS',
autoShow: true,
width: 220
},
{
sortable: true,
dataIndex: 'ETD',
header: 'ETD',
width: 80
},
{
sortable: true,
dataIndex: 'MBLNO',
header: 'MBLNO',
width: 120
},
{
sortable: true,
dataIndex: 'VESSEL',
header: 'VESSEL',
width: 100
},
{
sortable: true,
dataIndex: 'VOYNO',
header: 'VOYNO',
width: 60
},
{
sortable: true,
dataIndex: 'PORTLOAD',
header: 'PORTLOAD',
width: 100
},
{
sortable: true,
dataIndex: 'PORTDISCHARGE',
header: 'PORTDISCHARGE',
width: 100
},
{
sortable: true,
dataIndex: 'GOODSNAME',
header: 'GOODS NAME',
width: 120
},
{
sortable: true,
dataIndex: 'PKGS',
header: 'PKGS',
width: 80
},
{
sortable: true,
dataIndex: 'KGS',
header: 'KGS',
width: 80
},
{
sortable: true,
dataIndex: 'CNTRTOTAL',
header: 'CNTR',
width: 80
},
{
sortable: true,
dataIndex: 'KINDPKGS',
header: 'KINDPKGS',
width: 60
},
{
sortable: true,
dataIndex: 'BLFRT',
header: 'BLFRT',
width: 60
},
{
sortable: true,
dataIndex: 'CARGOID',
header: 'CARGOID',
width: 60
}, {
dataIndex: 'SEALNO',
header: 'SEALNO',
width: 100
},
{
sortable: true,
dataIndex: 'BSDATE',
header: 'INPUTDATE',
width: 80
}];
this.CheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
//定义Grid
this.gridList = new Ext.grid.GridPanel({
store: this.storeList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "LoadingPls Wait..." },
trackMouseOver: true,
disableSelection: false,
selModel: this.CheckBoxModel,
listeners: {
cellclick: function (thisTab, record, item, index, e, eOpts) {
if (index == 10) {//设置按钮列
// alert('用户编号=' + this.getStore().getAt(rowIndex).data.usercode);
}
}
},
columns: this.girdcolums,
// paging bar on the bottom
bbar: Ext.create('Ext.PagingToolbar', {
store: this.storeList,
displayInfo: true,
displayMsg: 'Display {0} - {1} Record /Total {2}Records',
emptyMsg: "No Data"
})
});
/////////////以下部分为获取存储的gridpanel显示样式
this.column = DsTruck.GetGridPanel(USERID, this.formname, this.girdcolums, 1); //使用者id表名中间column数组跳过一开始的几列
this.gridList.reconfigure(this.storeList, this.girdcolums);
this.gridList.columns[0] = new Ext.grid.RowNumberer();
////////////////////////////////////////////////
//国际港口(进口装货港、出口卸货港)
this.storeCodeDisport = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CodeDisportModel',
proxy: { url: '/CommMng/BasicDataRef/GetCodeDisportList' }
});
this.storeCodeDisport.load();
this.comboxPORTLOAD = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: 'PORTLOAD',
store: this.storeCodeDisport,
forceSelection: true,
name: 'PORTLOAD',
valueField: 'PORT',
displayField: 'CodeAndName'
});
//国内港口(出口装货港、进口卸货港)
this.storeCodeLoadport = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CodeLoadportModel',
proxy: { url: '/CommMng/BasicDataRef/GetCodeLoadportList' }
});
this.storeCodeLoadport.load();
this.comboxPORTDISCHARGE = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: 'PORTDISCHARGE',
store: this.storeCodeLoadport,
forceSelection: true,
name: 'PORTDISCHARGE',
valueField: 'PORT',
displayField: 'CodeAndName'
});
//#endregion
//#region formSearch 查询面板
this.storeVoyVeg = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.VesselModel',
proxy: { url: '/CommMng/BasicDataRef/GetVesselList' }
});
this.storeVoyVeg.load({ params: { condition: ""} });
this.comboxVoyVeg = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: 'VESSEL',
store: this.storeVoyVeg,
name: 'VESSEL',
valueField: 'VESSEL',
flex: 1,
displayField: 'VESSEL'
});
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: 'CNTRNO',
name: 'CtnNo'
}, {
fieldLabel: 'MBLNO',
name: 'MblNo'
}, {
fieldLabel: 'ETD',
format: 'Y-m-d',
xtype: 'datefield',
name: 'ETDbgn'
}, {
fieldLabel: 'TO',
format: 'Y-m-d',
xtype: 'datefield',
name: 'ETDend'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxPORTLOAD, this.comboxPORTDISCHARGE, this.comboxVoyVeg, {
fieldLabel: 'VOY',
name: 'VOYNO'
}]
}]//end items(fieldset 1)
}]//end root items
});
//#endregion formSearch
//按钮工具条
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [{
text: "Query",
iconCls: "btnrefresh",
handler: function (button, event) {
this.onRefreshClick(button, event);
},
scope: this
}, {
text: "Reset",
iconCls: "btnreset",
handler: function (button, event) {
this.onClearSql(button, event);
},
scope: this
}, '-',
{
text: "Print",
iconCls: 'btnprint',
menu: [
{ text: "Print All",
handler: function (menu, event) {
_this.Print();
}
}, { text: "Print Select",
handler: function (menu, event) {
_this.PrintSelect();
}
}],
scope: this
}, '-', {
text: "Save Display List",
id: "btntest",
handler: function (button, event) {
this.column = DsTruck.SaveGridPanel(USERID, this.formname, this.gridList.columns, this.column, 1, true);
},
scope: this
}]
});
//按钮工具条
_this = this;
this.panelBtnStatus = new Ext.Panel({
region: "north",
tbar: [{
text: "Shipper Working",
height: 80,
iconCls: "Ctn4",
scale: 'large',
iconAlign: 'top',
width: 120,
handler: function (button, event) {
this.onLeavePortClick(button, event, 1);
},
scope: this
}, '-', {
text: "Port of Receipt",
height: 80,
iconCls: "Ctn3",
scale: 'large',
iconAlign: 'top',
width: 120,
handler: function (button, event) {
this.onLeavePortClick(button, event, 2);
},
scope: this
}, '-', {
text: "Port of Loading",
height: 80,
iconCls: "Ctn1",
scale: 'large',
iconAlign: 'top',
width: 120,
handler: function (button, event) {
this.onLeavePortClick(button, event, 3);
},
scope: this
}, '-', {
text: "OnBorad",
height: 80,
iconCls: "Ctn5",
scale: 'large',
iconAlign: 'top',
width: 120,
handler: function (button, event) {
this.onLeavePortClick(button, event, 4);
},
scope: this
}, '-',
{ fieldLabel: 'WORK TIME',
format: 'Y-m-d',
id: 'dtOverTime',
xtype: 'datetimefield',
name: 'OVERTIME'
}]
});
this.panelBtnStatus = new Ext.Panel({
title: 'Container Status Operation',
layout: "border",
region: 'south',
height: 150,
animate: true,
autoScroll: true,
frame: false,
items: [this.panelBtnStatus]
});
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 100,
items: [this.panelBtn, this.formSearch]
});
Ext.apply(this, {
items: [this.panelTop, this.gridList, this.panelBtnStatus]
});
this.onRefreshClick();
var dtOverTime = Ext.getCmp('dtOverTime');
var currenttime = this.CurentTime();
dtOverTime.setValue(currenttime);
this.storeList.on('beforeload', function (store) {
var sql = this.getCondition();
Ext.apply(store.proxy.extraParams, { condition: sql, billtype: this.BillType, billtype: this.BillType });
}, this);
}, //end initUIComponents
onRefreshClick: function (button, event) {
//var girdcolums = this.gridList.getColumnMode();
var sql = this.getCondition();
this.sqlcontext = sql;
this.storeList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: sql, billtype: this.BillType },
waitMsg: "Loading...",
scope: this
});
},
onLeavePortClick: function (button, event, type) {
var GidStr = '';
var records = this.CheckBoxModel.selected.items;
if (records.length == 0) {
Ext.Msg.show({ title: 'Prompt', msg: 'Pls Select Change Ctn!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var dtOverTime = Ext.getCmp('dtOverTime');
var OpDateTime = dtOverTime.getValue();
if (OpDateTime == '' || OpDateTime == null) {
Ext.Msg.show({ title: 'Prompt', msg: "WORK TIME Can't Empty!", icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var insert;
var bodyAddDatas = [];
var j = 0;
for (var i = 0; i < records.length; i++) {
var rec = records[i];
var ORSTATUS = rec.data.ORSTATUS;
if (ORSTATUS == 9) {
Ext.Msg.show({ title: 'Prompt', msg: 'Bill Must Be Posted!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
} else {
bodyAddDatas.push(rec);
j = j + 1;
}
}
var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas);
_this = this;
if (j == 0) {
Ext.Msg.show({ title: 'Prompt', msg: 'No Ctn Be Selected!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
} else {
Ext.Ajax.request({
waitMsg: 'Changing...',
url: '/MvcShipping/MsOpSubSeaOrder/CtnOpStatus',
params: {
data: jsonbodyAddDatas,
type: type,
opdatetime: OpDateTime
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
Ext.Msg.show({
title: 'Prompt',
msg: result.Message,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
return;
} else {
_this.onRefreshClick();
}
} else {
Ext.MessageBox.alert('The Server Response Error, Please Try Again', response.responseText);
}
},
scope: this
});
}
},
onClearSql: function () {
var form = this.formSearch.getForm();
form.reset();
}, //onDeleteClick
getCondition: function () {
var form = this.formSearch.getForm();
if (!form.isValid()) {
Ext.Msg.alert('Prompt', 'Query Conditions Assignment ErrorsPls Check。');
return '';
}
var sql = " b.BILLTYPE=2 AND b.COMPANYID='"+COMPANYID+"'";
//#region formSearch 查询面板
//编号包括(主提单号)
var MblNo = form.findField('MblNo').getValue();
sql = sql + getAndConSql(sql, MblNo, "(b.MBLNO like '%" + MblNo + "%' )");
//箱号
var CtnNo = form.findField('CtnNo').getValue();
sql = sql + getAndConSql(sql, CtnNo, "c.CNTRNO='" + CtnNo + "'");
//到港日期
var ETDbgn = form.findField('ETDbgn').getRawValue();
sql = sql + getAndConSql(sql, ETDbgn, "b.ETD >='" + ETDbgn + "'");
var ETDend = form.findField('ETDend').getRawValue();
sql = sql + getAndConSql(sql, ETDend, "b.ETD <='" + ETDend + "'");
//装货港
var PORTLOAD = form.findField('PORTLOAD').getValue();
sql = sql + getAndConSql(sql, PORTLOAD, "b.PORTLOAD like '%" + PORTLOAD + "%'");
//卸货港
var PORTDISCHARGE = form.findField('PORTDISCHARGE').getValue();
sql = sql + getAndConSql(sql, PORTDISCHARGE, "b.PORTDISCHARGE like '%" + PORTDISCHARGE + "%'");
//船名
var VESSEL = form.findField('VESSEL').getValue();
sql = sql + getAndConSql(sql, VESSEL, "b.VESSEL like '%" + VESSEL + "%'");
//航次
var VOYNO = form.findField('VOYNO').getValue();
sql = sql + getAndConSql(sql, VOYNO, "b.VOYNO like '%" + VOYNO + "%'");
return sql;
},
CurentTime: function () {
var now = new Date();
var year = now.getFullYear(); //年
var month = now.getMonth() + 1; //月
var day = now.getDate(); //日
var hh = now.getHours(); //时
var mm = now.getMinutes(); //分
var clock = year + "-";
if (month < 10)
clock += "0";
clock += month + "-";
if (day < 10)
clock += "0";
clock += day + " ";
if (hh < 10)
clock += "0";
clock += hh + ":";
if (mm < 10) clock += '0';
clock += mm;
clock = clock + ':00';
return (clock);
},
OprationSwap: function () {
var ret = new Array();
ret[0] = this.OprationStatus;
ret[1] = this.storeList;
ret[2] = this.SelectedRecord;
ret[3] = this.IsAudit;
return ret;
},
Print: function () {
_this = this;
if (this.storeList.getCount() == 0) {
return;
}
var printType = 'MSSEAORDERCTNLISTSELECT';
var sql1 = " SELECT c.[CTN_ID],c.[BSNO],c.[CTNCODE],c.[CTNALL],c.[CNTRNO],c.[SEALNO],c.[PKGS],c.[KGS],c.[CBM],c.[REMARK], "
+ " c.[CTNSTATUS],c.[CTNSTATUSDATE],b.[ORSTATUS],b.[BSDATE],b.[MBLNO],b.[VESSEL],b.[VOYNO],b.[ETD],b.[PORTLOADID],b.[PORTLOAD], "
+ " b.[PORTDISCHARGEID],b.[PORTDISCHARGE],b.[PLACEDELIVERYID],b.[PLACEDELIVERY],b.[DESTINATIONID],b.[DESTINATION],b.[SERVICE],b.[CNTRTOTAL],b.[CARGOID] "
+ " ,b.[SHIPPER],b.[CONSIGNEE],b.[NOTIFYPARTY],b.[MARKS],b.[KINDPKGS],b.[BLFRT],b.[DESCRIPTION],b.[MEASUREMENT] "
+ " from op_seaorder_ctn c left join op_sub_seaorder b on (b.BSNO=c.BSNO)"
+" where "+this.sqlcontext
+ " order by b.VESSEL,b.VOYNO,b.ETD,b.MBLNO"
var sql2 = "";
var sql3 = "";
var sql4 = "";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
},
PrintSelect: function () {
_this = this;
if (this.storeList.getCount() == 0) {
return;
}
var selectedRecords = [];
var storeadd = null;
selectedRecords = this.GridCheckBoxModel.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('CTN_ID') + "'";
if (feeGidSql == '') {
feeGidSql = feeGId;
} else {
feeGidSql = feeGidSql + "," + feeGId;
}
};
var printType = 'MSSEAORDERCTNLISTSELECT';
var sql1 = " SELECT c.[CTN_ID],c.[BSNO],c.[CTNCODE],c.[CTNALL],c.[CNTRNO],c.[SEALNO],c.[PKGS],c.[KGS],c.[CBM],c.[REMARK], "
+ " c.[CTNSTATUS],c.[CTNSTATUSDATE],b.[ORSTATUS],b.[BSDATE],b.[MBLNO],b.[VESSEL],b.[VOYNO],b.[ETD],b.[PORTLOADID],b.[PORTLOAD], "
+ " b.[PORTDISCHARGEID],b.[PORTDISCHARGE],b.[PLACEDELIVERYID],b.[PLACEDELIVERY],b.[DESTINATIONID],b.[DESTINATION],b.[SERVICE],b.[CNTRTOTAL],b.[CARGOID] "
+ " ,b.[SHIPPER],b.[CONSIGNEE],b.[NOTIFYPARTY],b.[MARKS],b.[KINDPKGS],b.[BLFRT],b.[DESCRIPTION],b.[MEASUREMENT] "
+ " from op_seaorder_ctn c left join op_sub_seaorder b on (b.BSNO=c.BSNO)"
+ " WHERE C.CTN_ID IN (" + feeGidSql + ")"
+ " order by b.VESSEL,b.VOYNO,b.ETD,b.MBLNO"
var sql2 = "";
var sql3 = "";
var sql4 = "";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
}
});