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.

1230 lines
41 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.MsRptCtnStatusDetailDb = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsRptCtnStatusDetailDb.superclass.constructor.call(this);
};
Ext.extend(Shipping.MsRptCtnStatusDetailDb, Ext.Panel, {
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
sqlcontext: '',
psqlcontext: '',
PageSize: 500,
sortfield: '',
sortdire: '',
AccDate: null,
initUIComponents: function () {
this.formname = "MsRptCtnStatusDetailDb"; //页面名称
//定义数据集
this.storeList = Ext.create('Ext.data.Store', {
model: 'MsOpCtnBsCard',
pageSize: this.PageSize,
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcContainer/MsOpCtnBsCard/GetRptCtnStatusList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
Ext.grid.RowNumberer = Ext.extend(Ext.grid.RowNumberer, {
width: 30
});
this.initgirdcolums = [{
sortable: true,
id: '',
dataIndex: '',
header: '',
width: 0
}, {
sortable: true,
dataIndex: 'GID',
header: 'GID',
hidden: true,
width: 120
}, {
sortable: true,
dataIndex: 'COMPANYID',
header: 'COMPANYID',
hidden: true,
width: 120
}, {
sortable: true,
dataIndex: 'CTNNO',
header: '箱号',
width: 200
}, {
sortable: true,
dataIndex: 'CTNPROP',
header: '箱属',
width: 200
}, {
sortable: true,
dataIndex: 'BSNO',
header: '业务编号',
width: 200
}, {
sortable: true,
dataIndex: 'ISCLOSE',
header: '锁定',
width: 100,
renderer: function (value, cellmeta) {
if (value == 'true') {
return "<img src='../../../../TruckMng/Content/Images/Lock.png' />";
}
}
}, {
sortable: true,
dataIndex: 'IS_PUTCTN',
header: '放箱通知发送',
width: 100,
renderer: function (value, cellmeta) {
if (value == 'true') {
return "是";
}
}
}, {
sortable: true,
dataIndex: 'PUTCTNDATE',
header: '放箱通知发送时间',
width: 100
}, {
sortable: true,
dataIndex: 'CUSTOMERNAME',
header: '委托单位',
width: 200
}, {
sortable: true,
dataIndex: 'GOODSNAME',
header: '货物名称',
width: 100
}, {
sortable: true,
dataIndex: 'PREGOODSNAME',
header: '前装货品名',
width: 100
}, {
sortable: true,
dataIndex: 'ETD',
header: '开船日期',
width: 100
}, {
sortable: true,
dataIndex: 'ETA',
header: '到港日期',
width: 100
}, {
sortable: true,
dataIndex: 'AGENTNAME',
header: '目的港代理',
width: 100
}, {
sortable: true,
dataIndex: 'CUR_PORT',
header: '当前位置',
width: 100
}, {
sortable: true,
dataIndex: 'CUR_DATE',
header: '当前时间',
width: 100
}, {
sortable: true,
dataIndex: 'CYCLE_DAY',
header: '周期',
width: 100
}, {
sortable: true,
dataIndex: 'CUSTNO',
header: '委托编号',
width: 200
}, {
sortable: true,
dataIndex: 'OP',
header: '操作',
width: 200
}, {
sortable: true,
dataIndex: 'MBLNO',
header: '主提单号',
width: 200
}, {
sortable: true,
dataIndex: 'CARRIER',
header: '船公司',
width: 200
}, {
sortable: true,
dataIndex: 'PORTLOAD_STATOIN',
header: '起运港场站',
width: 200
}, {
sortable: true,
dataIndex: 'PORTLOAD_CNT_TIME',
header: '起运港提箱日期',
width: 200
}, {
sortable: true,
dataIndex: 'LOADFACTORY',
header: '装货工厂',
width: 200
}, {
sortable: true,
dataIndex: 'PORTLOAD',
header: '起运港',
width: 200
}, {
sortable: true,
dataIndex: 'DESTPORT',
header: '目的港',
width: 100
}, {
sortable: true,
dataIndex: 'DEST_CNT_TIME',
header: '目的港提箱日期',
width: 200
}, {
sortable: true,
dataIndex: 'DEST_RTCNT_TIME',
header: '目的港还箱日期',
width: 200
}, {
sortable: true,
dataIndex: 'DESTPORT_STATOIN',
header: '目的港场站',
width: 200
}, {
sortable: true,
dataIndex: 'DETAIN_CTN_DAYS',
header: '滞箱天数',
width: 200
}, {
sortable: true,
dataIndex: 'PRE_CNT_TIME',
header: '预计提箱日期',
width: 200
}, {
sortable: true,
dataIndex: 'IS_RETURE_EMPTY',
header: '是否返空',
width: 100
}, {
sortable: true,
dataIndex: 'ISRETURNDOMESTIC',
header: '空返国内',
width: 100
}, {
sortable: true,
dataIndex: 'IS_POD_CLEAN',
header: '否目的港清洗',
width: 100
}, {
sortable: true,
dataIndex: 'IS_BOOKING',
header: '是否订舱',
width: 200
}, {
sortable: true,
dataIndex: 'I_CUSTNO',
header: '空返委托编号',
width: 100
}, {
sortable: true,
dataIndex: 'I_ETD',
header: '空返开船日期',
width: 100
}, {
sortable: true,
dataIndex: 'I_ETA',
header: '空返进口日期',
width: 100
}, {
sortable: true,
dataIndex: 'PREI_ETA',
header: '空返预抵日期',
width: 100
}, {
sortable: true,
dataIndex: 'I_MBLNO',
header: '空返提单号',
width: 120
}, {
sortable: true,
dataIndex: 'I_CARRIER',
header: '空返船公司',
width: 100
}, {
sortable: true,
dataIndex: 'I_CONTRACT',
header: '运费约价',
width: 100
}, {
sortable: true,
dataIndex: 'I_PORTLOAD_CNT_TIME',
header: '起运港提箱日期',
width: 100
}, {
sortable: true,
dataIndex: 'I_PORTLOAD',
header: '空返起运港',
width: 100
}, {
sortable: true,
dataIndex: 'I_DESTPORT',
header: '空返目的港',
width: 100
}, {
sortable: true,
dataIndex: 'I_DESTPORT_STATOIN',
header: '空返目的港场站',
width: 100
}, {
sortable: true,
dataIndex: 'I_DEST_CNT_TIME',
header: '空返目的港提箱日期',
width: 100
}, {
sortable: true,
dataIndex: 'I_DEST_RTCNT_TIME',
header: '空返目的港还箱日期',
width: 100
}, {
sortable: true,
dataIndex: 'PORTLOAD_FREE_DAYS',
header: '起运港免箱使天数',
width: 100
}, {
sortable: true,
dataIndex: 'PORTLOAD_OVER_DAYS',
header: '起运港超期天数',
width: 100
}, {
sortable: true,
dataIndex: 'PORTLOAD_OVER_DAYS_FEE',
header: '起运港箱使费/天',
width: 100
}, {
sortable: true,
dataIndex: 'PORTLOAD_OVER_DAYS_AMT',
header: '起运港箱使费',
width: 100
}, {
sortable: true,
dataIndex: 'DESTPORT_FREE_DAYS',
header: '目的港免箱使天数',
width: 100
}, {
sortable: true,
dataIndex: 'DESTPORT_OVER_DAYS',
header: '目的港超期天数',
width: 100
}, {
sortable: true,
dataIndex: 'DESTPORT_OVER_DAYS_FEE',
header: '目的港箱使费/天',
width: 100
}, {
sortable: true,
dataIndex: 'DESTPORT_OVER_DAYS_AMT',
header: '目的港箱使费',
width: 100
}, {
sortable: true,
dataIndex: 'BOOKGOODNAME',
header: '订舱品名',
width: 100
}, {
sortable: true,
dataIndex: 'CUSTOMGOODNAME',
header: '报关品名',
width: 100
}, {
sortable: true,
dataIndex: 'TRUCKNAME',
header: '录车队',
width: 100
}, {
sortable: true,
dataIndex: 'INPUTBYREF',
header: '录入人',
width: 100
}, {
sortable: true,
dataIndex: 'INPUTTIME',
header: '录入时间',
width: 100
}
];
this.girdcolums = this.initgirdcolums;
this.GridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
_this = this;
//定义Grid
this.gridList = new Ext.grid.GridPanel({
store: this.storeList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
selModel: this.GridCheckBoxModel,
columns: this.girdcolums
,
// paging bar on the bottom
bbar: Ext.create('Ext.PagingToolbar', {
store: this.storeList,
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"
})
});
this.girdcolums = DsTruck.GetGridPanel(USERID, this.formname, this.girdcolums, 1); //使用者id表名中间column数组跳过一开始的几列
this.girdcolums.unshift(new Ext.grid.RowNumberer());
this.gridList.reconfigure(this.storeList, this.girdcolums);
this.gridList.addListener('itemdblclick', function (dataview, record, item, index, e, b) {
this.SelectedRecord = record;
this.OprationStatus = 'edit';
if (BSCARDTYPE == '1')
DsOpenEditWin('/MvcContainer/MsOpCtnBsCard/Edit', record.data.GID);
else
DsOpenEditWin('/MvcContainer/MsOpCtnBsCard/CtnStatusEdit', record.data.GID);
}, this);
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [ {
text: "保存列表样式",
id: "btntest",
menu: [
{ text: "保存列表",
handler: function (button, event) {
_this.onSaveGridClick(button, event);
}
}, { text: "刷新列表",
handler: function (button, event) {
_this.oninitGridClick(button, event);
}
}],
scope: this
}, {
text: "导出Excel",
id: "btnExportExcel",
iconCls: 'btnexportexcel',
handler: function (button, event) {
this.onExportClick(button, event);
},
scope: this
}
]
});
this.storeCodeDisport3 = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CodeDisportModel',
autoLoad: true,
proxy: { url: '/CommMng/BasicDataRef/GetCodeDisportListRm' }
});
this.comboxPORTLOAD = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '起运港',
store: this.storeCodeDisport3,
name: 'PORTLOAD',
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: 60,
msgTarget: 'qtip'
},
items: [{//fieldset 1
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxPORTLOAD, {
xtype: 'button',
width: 90,
text: "执行查询",
iconCls: "btnrefresh",
handler: function (button, event) {
this.onRefreshClick(button, event);
},
scope: this
}, {
xtype: 'button',
width: 90,
text: "高级查询",
iconCls: "btnmore",
handler: function (button, event) {
var sql = this.getCondition();
var winAccess = new Shipping.DsQuery({
});
winAccess.StoreList = this.storeList;
winAccess.formname = this.formname;
winAccess.condition = sql;
winAccess.show();
return;
},
scope: this
}]
}
]//end items(fieldset 1)
}]//end root items
});
this.initgirdcolumsctnapply = [{
sortable: true,
id: '',
dataIndex: '',
header: '',
width: 0
}, {
sortable: true,
dataIndex: 'GID',
header: 'GID',
hidden: true,
width: 120
}, {
sortable: true,
dataIndex: 'COMPANYID',
header: 'COMPANYID',
hidden: true,
width: 120
}, {
sortable: true,
dataIndex: 'PRICETYPE',
header: 'PRICETYPE',
hidden: true,
width: 120
}, {
sortable: true,
dataIndex: 'BSNO',
header: '申请单号',
width: 100
}, {
sortable: true,
dataIndex: 'BSDATE',
header: '申请日期',
width: 100
}, {
sortable: true,
dataIndex: 'OPSTATUS',
header: '自定义状态标识',
renderer: function (value, metadata, record, rowIndex) {
metadata.style = "background-color:" + record.data.OPSTATUSCOLOR;
return value;
},
width: 100
}, {
sortable: true,
dataIndex: 'PLANCTNDATE',
header: '计划用箱日期',
width: 100,
renderer: function (value, meta, record) {
if (value != '' && record.data.ADDCTNNUM == 0) {
var ENDATE = new Date(value);
var myDate = new Date();
var mydatestr = Ext.util.Format.date(myDate, 'Y-m-d');
mydatestr = getNewDay(mydatestr, 5);
mydatestr = new Date(mydatestr);
if (mydatestr.getTime() >= ENDATE.getTime()) {
meta.tdCls = 'feestatus_nopass';
}
}
return value;
}
}, {
sortable: true,
dataIndex: 'SALE',
header: '揽货人',
width: 100
}, {
sortable: true,
dataIndex: 'OP',
header: '操作员',
width: 100
}, {
sortable: true,
dataIndex: 'GOODSNAME',
header: '品名',
width: 100
}, {
sortable: true,
dataIndex: 'GOODSNAMEREF',
header: '货物名称(含英文简称)',
width: 100
}, {
sortable: true,
dataIndex: 'GOODTYPE',
header: '产品类别',
width: 100
}, {
sortable: true,
dataIndex: 'PORTLOAD',
header: '起运港',
width: 100
}, {
sortable: true,
dataIndex: 'PORTDISCHARGE',
header: '目的港',
width: 100
}, {
sortable: true,
dataIndex: 'CTNALL',
header: '箱型',
width: 100
}, {
sortable: true,
dataIndex: 'CTNNUM',
header: '箱量',
width: 100
}, {
sortable: true,
dataIndex: 'CUSTOMERNAME',
header: '委托单位',
width: 100
}, {
sortable: true,
dataIndex: 'FACTORYNAME',
header: '工厂名称',
width: 100
}, {
sortable: true,
dataIndex: 'PREGOODSNAME',
header: '前装品名',
width: 100
}, {
sortable: true,
dataIndex: 'CURGOODSNAME',
header: '后装品名',
width: 100
}, {
sortable: true,
dataIndex: 'AUDITSTATUS',
header: '适货审核状态',
width: 100
}, {
sortable: true,
dataIndex: 'AUDITBYREF',
header: '适货审核人',
width: 100
}, {
sortable: true,
dataIndex: 'AUDITTIME',
header: '适货审核时间',
width: 100
}, {
sortable: true,
dataIndex: 'AUDITRESULT',
header: '适货审核结果',
width: 100
}, {
sortable: true,
dataIndex: 'AGENTINPUTBY',
header: '代理维护人',
width: 100
}, {
sortable: true,
dataIndex: 'CYCLEDAYS',
header: '周期',
width: 100
}, {
sortable: true,
dataIndex: 'COSTAUDITSTATUS',
header: '成本审核状态',
width: 100
}, {
sortable: true,
dataIndex: 'COSTAUDITBYREF',
header: '成本审核人',
width: 100
}, {
sortable: true,
dataIndex: 'COSTAUDITTIME',
header: '成本审核时间',
width: 100
}, {
sortable: true,
dataIndex: 'COSTAUDITRESULT',
header: '成本审核结果',
width: 100
}, {
sortable: true,
dataIndex: 'CHANGERATE',
header: '超期箱使费佣金比例',
width: 100
}, {
sortable: true,
dataIndex: 'FULL_CTN_FREE_STORAGE_DAY',
header: '重箱免堆天数',
width: 100
}, {
sortable: true,
dataIndex: 'CTN_PRICE',
header: '罐箱价格',
width: 100
}, {
sortable: true,
dataIndex: 'CURRENCY',
header: '币别',
width: 50
}, {
sortable: true,
dataIndex: 'CTN_INCOME',
header: '内部租金收入',
width: 100
}, {
sortable: true,
dataIndex: 'REMARKS',
header: '备注',
width: 200
}, {
sortable: true,
dataIndex: 'INPUTBYREF',
header: '录入人',
width: 100
}, {
sortable: true,
dataIndex: 'INPUTTIME',
header: '录入时间',
width: 100
}, {
sortable: true,
dataIndex: 'BSSTATUS',
header: '申请状态',
width: 100
}, {
sortable: true,
dataIndex: 'CTNNUMS',
header: '业务卡数量',
width: 100
}, {
sortable: true,
dataIndex: 'SERVICE',
header: '运输条款',
width: 100
}, {
sortable: true,
dataIndex: 'NEEDBEHEATED',
header: '是否加热',
renderer: function (value, meta) {
if (isFalse(value)) {
return "";
} else {
meta.tdCls = 'feestatus_pass';
return "是";
}
},
width: 100
}, {
sortable: true,
dataIndex: 'EMPTYCTNALLOCATION',
header: '空箱调拨',
renderer: function (value, meta) {
if (isFalse(value)) {
return "";
} else {
meta.tdCls = 'feestatus_pass';
return "是";
}
},
width: 100
}, {
sortable: true,
align: 'right',
dataIndex: 'WEIGHT',
header: '重量(KGS)',
width: 100,
renderer: function (value) {
return Ext.util.Format.number(value, '0.000');
}
}, {
sortable: true,
dataIndex: 'PREI_ETD',
header: '预计开船日期',
width: 100
}
];
this.girdcolumsctnapply = this.initgirdcolumsctnapply;
_this = this;
//定义数据集
this.storeListctnapply = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
model: 'MsOpCtnApply',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcContainer/MsOpCtnApply/GetDataList',
reader: {
root: 'data',
totalProperty: 'totalCount'
}
}
});
Ext.grid.RowNumberer = Ext.extend(Ext.grid.RowNumberer, {
width: 30
});
this.GridCheckBoxModelctnapply = Ext.create('Ext.selection.CheckboxModel');
_this = this;
//定义Grid
this.gridListctnapply = new Ext.grid.GridPanel({
store: this.storeListctnapply,
enableHdMenu: false,
region: 'south',
height:260,
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
selModel: this.GridCheckBoxModelctnapply,
columns: this.girdcolumsctnapply
,
viewConfig: {
enableTextSelection: true
},
// paging bar on the bottom
bbar: Ext.create('Ext.PagingToolbar', {
store: this.storeListctnapply,
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"
})
});
this.girdcolumsctnapply = DsTruck.GetGridPanel(USERID, this.formname, this.girdcolums +'ctnapply', 1); //使用者id表名中间column数组跳过一开始的几列
//this.girdcolumsctnapply.unshift(new Ext.grid.RowNumberer());
// this.InitGrid(this.girdcolums, '');
this.gridListctnapply.addListener('itemdblclick', function (dataview, record, item, index, e, b) {
this.OpenEditWin(record);
}, this);
this.gridListctnapply.addListener('sortchange', function (ct, column, direction, eOpts) {
this.sortfield = column.dataIndex;
this.sortdire = direction;
}, this);
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 90,
items: [this.panelBtn,this.formSearch]
});
Ext.apply(this, {
items: [this.panelTop, this.gridList, this.gridListctnapply]
});
this.sqlcontext = '';
this.psqlcontext = '';
//this.ParentWin = window.parent.opener._this;
//if (this.ParentWin) {
// if (this.ParentWin.sqlcontext!='')
// this.psqlcontext = this.ParentWin.sqlcontext + ' AND ' + this.ParentWin.sqlselect;
// else
// this.psqlcontext = this.ParentWin.sqlselect;
// this.sqlcontext = this.psqlcontext;
//}
this.storeList.on('beforeload', function (store) {
Ext.apply(store.proxy.extraParams, { condition: _this.sqlcontext });
}, this);
//this.storeList.load({
// params: { start: 0, limit: this.PageSize, sort: '', condition: this.sqlcontext },
// waitMsg: "正在查询数据...",
// scope: this
//});
}, //end initUIComponents
InitGrid: function (grid) {
var agirdcolums = grid;
this.gridList.reconfigure(this.storeList, agirdcolums);
},
onRefreshClick: function (button, event) {
var sql = this.getCondition();
this.storeList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
var sql = this.getConditionctnapply();
this.storeListctnapply.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
},
onDsQuery: function () {
var sql = this.sqlcontext;
if (sql != '')
this.sqlcontext = this.psqlcontext + ' and ' + sql;
else
this.sqlcontext = this.psqlcontext;
this.storeList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
},
onSaveGridClick: function (button, event) {
this.girdcolums = DsTruck.SaveGridPanel(USERID, this.formname, this.gridList.columns, this.girdcolums, 1, true);
},
oninitGridClick: function (button, event) {
this.gridList.reconfigure(this.storeList, this.initgirdcolums);
this.girdcolums = DsTruck.SaveGridPanel(USERID, this.formname, this.gridList.columns, this.initgirdcolums, 1, true);
},
onExportClick: function () {
_this = this;
if (this.storeList.getCount() == 0) {
return;
}
var bsno = '11111';
var selections = this.gridList.getSelectionModel().getSelection();
if (selections.length != 0) {
var record = selections[0];
bsno = record.data.GID;
}
var sortstr = '';
if (this.sortfield != '' && this.sortdire != '') {
sortstr = this.sortfield + ' ' + this.sortdire;
}
Ext.Msg.wait('正在组织数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在组织数据...',
url: '/MvcContainer/MsOpCtnBsCard/GetDataListStr',
scope: this,
params: {
condition: _this.sqlcontext,
printstr: 'true',
sort: sortstr
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
var returnstr = jsonresult.data;
var printType = 'MSOPCTNBSCARD';
var sql1 = returnstr;
sql1 = sql1.replace(/\+/g, "@@@")
sql1 = sql1.replace(/\>/g, "&&&")
sql1 = sql1.replace(/\</g, "%%%")
if (sql1 != '') {
GridExportBySql(sql1, this.formname, '罐箱情况表列表.xls');
}
} 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
});
}
}
});
},
getCondition: function () {
var form = this.formSearch.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return '';
}
var sql = '';
sql = " ((ISNULL(IS_RETURE_EMPTY,0)=1 AND VETA IS NULL AND I_PORTLOAD_CNT_TIME IS NOT NULL) OR (isnull(EMPTYCTNALLOCATION, 0) = 1 AND VETA IS NULL AND PORTLOAD_CNT_TIME IS NOT NULL) "
+ " OR VDEST_RTCNT_TIME IS NOT NULL OR (IS_RETURE_EMPTY=1 and I_PORTLOAD_CNT_TIME IS NULL AND I_ETD IS NULL AND DEST_RTCNT_TIME IS NOT NULL) OR (IS_DB=1 and D_PORTLOAD_CNT_TIME IS NULL AND D_ETD IS NULL AND I_DEST_RTCNT_TIME IS NOT NULL)) "
var PORTLOAD = form.findField('PORTLOAD').getValue();
sql = sql + getAndConSql(sql, PORTLOAD, " VDESTPORT='" + PORTLOAD + "' ");
//var BSNO = form.findField('BSNO').getValue();
//sql = sql + getAndConSql(sql, BSNO, " (BSNO like '%" + BSNO + "%' or CUSTNO like '%" + BSNO + "%' or I_CUSTNO like '%" + BSNO + "%' or MBLNO like '%" + BSNO + "%' ) ");
//var CTNNO = form.findField('CTNNO').getValue();
//sql = sql + getAndConSql(sql, CTNNO, "CTNNO like '%" + CTNNO + "%'");
//var expDateBgn = form.findField('ETDbgn').getRawValue();
//sql = sql + getAndConSql(sql, expDateBgn, "ETD>='" + expDateBgn + "'");
//var expDateEnd = form.findField('ETDend').getRawValue();
//sql = sql + getAndConSql(sql, expDateEnd, "ETD<='" + expDateEnd + " 23:59:59'");
return sql;
},
getConditionctnapply: function () {
var form = this.formSearch.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return '';
}
var sql = '';
sql = " AUDITSTATUS='审核通过' AND GID NOT IN (SELECT LINKGID FROM op_ctnapplyctnitems) and BSSTATUS<>'配箱完成' AND ADDCTNSTATUS<>'配箱完成' "
var PORTLOAD = form.findField('PORTLOAD').getValue();
sql = sql + getAndConSql(sql, PORTLOAD, " PORTLOAD='" + PORTLOAD + "' ");
return sql;
},
OprationSwap: function () {
var ret = new Array();
ret[0] = this.OprationStatus;
ret[1] = this.storeList;
ret[2] = this.SelectedRecord;
return ret;
},
Print: function () {
_this = this;
if (this.storeList.getCount() == 0) {
return;
}
var bsno = '11111';
var selections = this.gridList.getSelectionModel().getSelection();
if (selections.length != 0) {
var record = selections[0];
bsno = record.data.GID;
}
var sortstr = '';
if (this.sortfield != '' && this.sortdire != '') {
sortstr = this.sortfield + ' ' + this.sortdire;
}
Ext.Msg.wait('正在组织数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在组织数据...',
url: '/MvcContainer/MsOpCtnBsCard/GetDataListStr',
scope: this,
params: {
condition: _this.sqlcontext,
printstr: 'true',
sort: sortstr
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
var returnstr = jsonresult.data;
var printType = 'MSOPCTNBSCARD';
var sql1 = returnstr;
var sql2 = "Select GID 编号";
sql2 = sql2 + ",BSNO 业务编号 , CTNNO 箱号, CUR_PORT 当期位置, GOODSNAME 货物名称 ";
sql2 = sql2 + " , MBLNO 主提单号, CUSTNO 委托编号, CUSTOMERNAME 委托单位, PORTLOAD_STATOIN 起运港场站, GOODSNAME 货物名称";
sql2 = sql2 + " ,PORTLOAD_CNT_TIME 提箱日期 , LOADFACTORY 装货工厂";
sql2 = sql2 + ", PORTLOAD 起运港, ETD 开船日期 ,DESTPORT 目的港 , ETA 到港日期 , AGENTNAME 目的港代理";
sql2 = sql2 + " , DEST_CNT_TIME 目的港提箱日期 ,DEST_RTCNT_TIME 目的港还箱日期 ,DESTPORT_STATOIN 目的港堆存场站 ";
sql2 = sql2 + " , DESTPORT_FREE_DAYS 免费箱使天数, DESTPORT_OVER_DAYS 超期天数,DESTPORT_OVER_DAYS_FEE 箱使费天, DESTPORT_OVER_DAYS_AMT 超期箱使费 ,DETAIN_CTN_DAYS 滞箱天数 ";
sql2 = sql2 + " ,I_MBLNO 进口主提单号, I_CUSTNO 进口委托编号,I_PORTLOAD 进口堆存场站 ";
sql2 = sql2 + " ,I_PORTLOAD_CNT_TIME 进口提箱日期 ";
sql2 = sql2 + " ,I_PORTLOAD 进口起运港 ,I_ETD 进口开船日期 ,i_DESTPORT 进口目的港, I_ETA 进口到港日期 ";
sql2 = sql2 + " , I_DEST_CNT_TIME 进口目的港提箱日期 ,I_DEST_RTCNT_TIME 进口目的港还箱日期 ,I_DESTPORT_STATOIN 进口目的港堆存场站 ";
sql2 = " from op_ctnbscard where GID='" + bsno + "'";
var sql3 = "";
var sql4 = "";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
} 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
});
}
}
});
},
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 sortstr = 'CTNNO';
if (this.sortfield != '' && this.sortdire != '') {
sortstr = this.sortfield + ' ' + this.sortdire;
}
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 selections = this.gridList.getSelectionModel().getSelection();
if (selections.length != 0) {
var record = selections[0];
bsno = record.data.GID;
}
var printType = 'MSOPCTNBSCARDSELECT';
var sql1 = "Select op_ctnbscard.GID 编号";
sql1 = sql1 + ",BSNO 业务编号 , CTNNO 箱号, CUR_PORT 当期位置, GOODSNAME 货物名称 ";
sql1 = sql1 + " , MBLNO 主提单号, CUSTNO 委托编号, CUSTOMERNAME 委托单位, PORTLOAD_STATOIN 起运港场站, GOODSNAME 货物名称";
sql1 = sql1 + " ,PORTLOAD_CNT_TIME 提箱日期 , LOADFACTORY 装货工厂";
sql1 = sql1 + ", PORTLOAD 起运港, ETD 开船日期 ,DESTPORT 目的港 , ETA 到港日期 , AGENTNAME 目的港代理";
sql1 = sql1 + " , DEST_CNT_TIME 目的港提箱日期 ,DEST_RTCNT_TIME 目的港还箱日期 ,DESTPORT_STATOIN 目的港堆存场站 ";
sql1 = sql1 + " , DESTPORT_FREE_DAYS 免费箱使天数, DESTPORT_OVER_DAYS 超期天数,DESTPORT_OVER_DAYS_FEE 箱使费天, DESTPORT_OVER_DAYS_AMT 超期箱使费 ,DETAIN_CTN_DAYS 滞箱天数,TRUCKNAME 车队,TRUCKLINKNAME 车队联系人 ";
sql1 = sql1 + " ,I_MBLNO 进口主提单号, I_CUSTNO 进口委托编号,I_PORTLOAD 进口堆存场站 ";
sql1 = sql1 + " ,I_PORTLOAD_CNT_TIME 进口提箱日期 ";
sql1 = sql1 + " ,I_PORTLOAD 进口起运港 ,I_ETD 进口开船日期,i_DESTPORT 进口目的港,I_ETA 进口到港日期 ";
sql1 = sql1 + " , I_DEST_CNT_TIME 进口目的港提箱日期 ,I_DEST_RTCNT_TIME 进口目的港还箱日期 ,I_DESTPORT_STATOIN 进口目的港堆存场站 ";
sql1 = sql1 + " , ClientSTATOIN.Tel 场站电话 ,ClientSTATOIN.CHIEF 场站联系人,ClientSTATOIN.ADDR 场站地址 ";
sql1 = sql1 + " from op_ctnbscard "
sql1 = sql1 + " Left join info_client ClientSTATOIN on ClientSTATOIN.SHORTNAME=op_ctnbscard.PORTLOAD_STATOIN ";
sql1 = sql1 + " Left join op_ctnrepair on op_ctnrepair.LINKGID=op_ctnbscard.GID ";
sql1 = sql1 + "WHERE op_ctnbscard.GID IN (" + feeGidSql + ") order by CTNNO ";
var sql2 = "select * from op_ctnbscard where GID='" + bsno + "'";
var sql3 = "SELECT [CTNNO] 罐号,[CTNPROP] 箱属,[NAMEPLATE] 铭牌信息 ,[OWNERCTN] 罐东 ,[MADEDATE] 制造年限";
sql3 = sql3 + ",(select ShowName from [user] where GID=code_ctntk.INPUTBY) as 录入人";
sql3 = sql3 + ",(select TOP 1 GOODSNAME FROM op_ctnbscard WHERE CTNNO=code_ctntk.CTNNO";
sql3 = sql3 + " ORDER BY PORTLOAD_CNT_TIME DESC) as 所装货";
// sql3 = sql3 + ",(select TOP 1 CUR_PORT FROM op_ctnbscard WHERE CTNNO=code_ctntk.CTNNO ";
// sql3 = sql3 + " ORDER BY PORTLOAD_CNT_TIME DESC) as 当前位置";
sql3 = sql3 + ",(select TOP 1 当前位置 FROM v_tk_cutdate WHERE CTNNO=code_ctntk.CTNNO ";
sql3 = sql3 + " ORDER BY 当前日期 DESC) as 当前位置 ";
sql3 = sql3 + ",(select TOP 1 当前日期 FROM v_tk_cutdate WHERE CTNNO=code_ctntk.CTNNO ";
sql3 = sql3 + " ORDER BY 当前日期 DESC) as 当前日期 ";
sql3 = sql3 + ",(select TOP 1 下一日期 FROM v_tk_cutdate WHERE CTNNO=code_ctntk.CTNNO ";
sql3 = sql3 + " ORDER BY 下一日期 DESC) as 下一日期 ";
sql3 = sql3 + ",(select TOP 1 前装货 FROM v_tk_preGoodsName WHERE CTNNO=code_ctntk.CTNNO ";
sql3 = sql3 + " order by PORTLOAD_CNT_TIME desc ) as 前装货 ";
sql3 = sql3 + " from code_ctntk";
sql3 = sql3 + " where CTNPROP in ('租赁箱','自有箱')";
sql3 = sql3 + " ORDER BY CTNNO ";
var sql4 = "Select op_ctnbscard.GID 编号";
sql4 = sql4 + ", op_ctnbscard.CTNNO 箱号,[dbo].F_GetRepairItems(op_ctnbscard.GID) 改装列表";
sql4 = sql4 + " from op_ctnbscard ";
sql4 = sql4 + "WHERE op_ctnbscard.GID IN (" + feeGidSql + ") order by op_ctnbscard.CTNNO ";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
}
});