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/MvcContainer/Viewsjs/MsOpCtnBsCard/MsOpCtnBsCardAuditIndex.js

1153 lines
41 KiB
JavaScript

2 years ago
Ext.namespace('Shipping');
Shipping.MsOpCtnBsCardAuditIndex = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsOpCtnBsCardAuditIndex.superclass.constructor.call(this);
};
Ext.extend(Shipping.MsOpCtnBsCardAuditIndex, Ext.Panel, {
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
sqlcontext: '',
PageSize: 500,
sortfield: '',
sortdire: '',
AccDate: null,
initUIComponents: function () {
this.formname = "formMsOpCtnBsCardAuditIndex"; //页面名称
//定义数据集
this.storeList = Ext.create('Ext.data.Store', {
model: 'MsOpCtnBsCard',
pageSize: this.PageSize,
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcContainer/MsOpCtnBsCard/GetDataList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
Ext.grid.RowNumberer = Ext.extend(Ext.grid.RowNumberer, {
width: 30
});
this.initgirdcolums = [ {
sortable: true,
dataIndex: 'GID',
header: 'GID',
hidden: true,
width: 120
},{
sortable: true,
id: '',
dataIndex: '',
header: '',
width: 0
}, {
sortable: true,
dataIndex: 'COMPANYID',
header: 'COMPANYID',
hidden: true,
width: 120
}, {
sortable: true,
dataIndex: 'CTNNO',
header: '箱号',
width: 200
}, {
sortable: true,
dataIndex: 'APPLYNO',
header: '放箱申请编号',
width: 120
}, {
sortable: true,
dataIndex: 'CTNPROP',
header: '箱属',
width: 200
}, {
sortable: true,
dataIndex: 'BSNO',
header: '业务编号',
width: 200
}, {
sortable: true,
dataIndex: 'AUDITSTATUS',
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',//'ETD'
2 years ago
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: '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_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_ETD',
header: '空返开船日期',
width: 100
}, {
sortable: true,
dataIndex: 'I_DESTPORT',
header: '空返目的港',
width: 100
}, {
sortable: true,
dataIndex: 'I_ETA',
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
}, {
sortable: true,
dataIndex: 'SHENTIME',
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,
viewConfig: {
enableTextSelection: true
},
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';
DsOpenEditWin('/MvcContainer/MsOpCtnBsCard/CtnStatusEdit', record.data.GID);
}, this);
//#region formSearch 查询面板
_this = this;
//客户加载_委托单位
this.storeCustCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
this.storeCustCode.load({ params: { condition: "ISCONTROLLER='1'"} });
//委托单位
_this = this;
this.comboxCustCode = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '委托单位',
store: this.storeCustCode,
forceSelection: true,
name: 'CUSTOMERNAME',
valueField: 'CustName',
displayField: 'CodeAndName',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.storeAuditStatus = Ext.create('Ext.data.Store', {
fields: ['DC', 'NAME']
});
this.storeAuditStatus.add({ "DC": "申请返空/调拨", "NAME": "申请返空/调拨" });
this.storeAuditStatus.add({ "DC": "申请返空", "NAME": "申请返空" });
this.storeAuditStatus.add({ "DC": "申请调拨", "NAME": "申请调拨" });
this.storeAuditStatus.add({ "DC": "批准返空", "NAME": "批准返空" });
this.comboxAuditStatus = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '返空状态',
store: this.storeAuditStatus,
valueField: 'DC',
displayField: 'NAME',
forceSelection: true,
value: '申请返空',
name: 'DC',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
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: 'CTNNO',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
},this.comboxAuditStatus,{
fieldLabel: '编号',
name: 'BSNO',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, this.comboxCustCode, {
fieldLabel: '开船日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'ETDbgn',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '到',
format: 'Y-m-d',
xtype: 'datefield',
name: 'ETDend',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
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
});
//#endregion formSearch
//查询工具条
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [{
text: "批准返空",
iconCls: "btnadd",
handler: function (button, event) {
this.onAuditPassClick();
},
scope: this
},
'-',
{
text: "驳回返空申请",
iconCls: "btndelete",
handler: function (button, event) {
this.onAuditBackClick();
},
scope: this
}, '-',
{
text: "执行查询",
iconCls: "btnrefresh",
handler: function (button, event) {
this.onRefreshClick(button, event);
},
scope: this
},
{
text: "重置条件",
iconCls: "btnreset",
handler: function (button, event) {
},
scope: this
}, '-',
{
text: "打印",
iconCls: 'btnprint',
menu: [
{ text: "全部",
handler: function (menu, event) {
_this.Print();
}
}, { text: "选择打印",
handler: function (menu, event) {
_this.PrintSelect();
}
}],
scope: this
}, '-', {
text: "保存列表样式",
id: "btntest",
menu: [
{ text: "保存",
handler: function (button, event) {
this.girdcolums = DsTruck.SaveGridPanel(USERID, _this.formname, _this.gridList.columns, _this.girdcolums, 1, true);
}
}, { text: "初始化",
handler: function (menu, event) {
_this.InitGrid(_this.initgirdcolums);
_this.girdcolums = DsTruck.SaveGridPanel(USERID, _this.formname, _this.gridList.columns, _this.initgirdcolums, 1, true);
}
}],
scope: this
}
]
});
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 75,
items: [this.formSearch, this.panelBtn]
});
Ext.apply(this, {
items: [this.panelTop, this.gridList]
});
this.sqlcontext = '';
this.storeList.on('beforeload', function (store) {
Ext.apply(store.proxy.extraParams, { condition: _this.sqlcontext });
}, this);
this.onRefreshClick();
this.formAccMonthShow = Ext.widget('form', {
frame: true,
region: 'center',
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 85,
msgTarget: 'qtip'
},
items: [
{//fieldset 1
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '放箱通知时间',
format: 'Y-m-d',
xtype: 'datefield',
name: 'AccDate'
}
]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
});
me = this;
this.winFeeCloseShow = Ext.create('Ext.window.Window', {
title: "发送放箱通知",
width: 420,
//height : 120,
//plain : true,
iconCls: "addicon",
resizable: false,
// 是否可以拖动
// draggable:false,
collapsible: true, // 允许缩放条
closeAction: 'close',
closable: true,
modal: 'true',
buttonAlign: "center",
bodyStyle: "padding:0 0 0 0",
items: [this.formAccMonthShow],
buttons: [{
text: "确认发送",
minWidth: 70,
handler: function () {
var form = me.formAccMonthShow.getForm();
me.AccDate = form.findField('AccDate').getRawValue();
if (me.AccDate == '' || me.AccDate == null || me.AccDate == undefined) {
Ext.Msg.show({ title: '提示', msg: '必须有放箱通知发送时间!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
_this.onSelPutCtnClick()
}
}, {
text: "关闭",
minWidth: 70,
handler: function () {
me.winFeeCloseShow.close();
}
}]
});
this.storeCodeDisport = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CodeDisportModel',
autoLoad: true,
proxy: { url: '/CommMng/BasicDataRef/GetCodeDisportList' }
});
this.storeCodeDisport.load();
var btndelete = Ext.getCmp('btndelete');
Ext.Ajax.request({
waitMsg: '',
url: '/MvcShipping/MsBaseInfo/GetUserModuleEnable',
params: {
modulename: "CTNBSCARDDEL"
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (result.Success != true) {
btndelete.disable();
} else {
btndelete.enable();
}
} else {
}
},
scope: this
});
var btnadd = Ext.getCmp('btnadd');
Ext.Ajax.request({
waitMsg: '',
url: '/MvcShipping/MsBaseInfo/GetUserModuleEnable',
params: {
modulename: "CTNBSCARDNEW"
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (result.Success != true) {
btnadd.disable();
} else {
btnadd.enable();
}
} else {
}
},
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.sqlcontext = sql;
this.storeList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
},
onDsQuery: function () {
var sql = this.sqlcontext;
this.storeList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
},
onAuditPassClick: function () {
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 bodyAddDatas = [];
for (var i = 0; i < selections.length; i++) {
var rec = selections[i];
var BILLSTATUS = rec.data.AUDITSTATUS;
if (BILLSTATUS == '申请返空' || BILLSTATUS == '申请调拨') {
bodyAddDatas.push(rec);
} else {
Ext.Msg.show({ title: '提示', msg: '当前状态不允许审核!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
}
var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas);
_this = this;
Ext.MessageBox.confirm('提示', '确定要批准的选中的业务吗?', function (btn) {
if (btn == 'yes') {
Ext.Msg.wait('正在审核数据...');
Ext.Ajax.request({
waitMsg: '正在审核数据...',
url: '/MvcContainer/MsOpCtnBsCard/AuditReturn',
params: {
data: jsonbodyAddDatas,
type: '1'
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
_this.onRefreshClick();
Ext.Msg.show({ title: '提示', msg: '批准成功!', 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);
},
onAuditBackClick: function () {
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 bodyAddDatas = [];
for (var i = 0; i < selections.length; i++) {
var rec = selections[i];
var BILLSTATUS = rec.data.AUDITSTATUS;
if ((BILLSTATUS == '批准返空' || BILLSTATUS == '批准调拨' ||BILLSTATUS == '申请返空' || BILLSTATUS == '申请调拨')) {
bodyAddDatas.push(rec);
} else {
Ext.Msg.show({ title: '提示', msg: '当前状态不允许驳回!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
}
var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas);
_this = this;
Ext.MessageBox.confirm('提示', '确定驳回选中的业务吗?', function (btn) {
if (btn == 'yes') {
Ext.Msg.wait('正在驳回数据...');
Ext.Ajax.request({
waitMsg: '正在驳回数据...',
url: '/MvcContainer/MsOpCtnBsCard/AuditReturn',
params: {
data: jsonbodyAddDatas,
type: '0'
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
_this.onRefreshClick();
Ext.Msg.show({ title: '提示', msg: '驳回成功!', 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);
},
getCondition: function () {
var form = this.formSearch.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return '';
}
var sql = "";
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 AUDITSTATUS = form.findField('DC').getValue();
if (AUDITSTATUS == '申请返空/调拨')
sql = sql + getAndConSql(sql, AUDITSTATUS, " (AUDITSTATUS='申请返空' || AUDITSTATUS='申请调拨') ");
else
sql = sql + getAndConSql(sql, AUDITSTATUS, "AUDITSTATUS='" + AUDITSTATUS + "'");
var CTNNO = form.findField('CTNNO').getValue();
sql = sql + getAndConSql(sql, CTNNO, "CTNNO like '%" + CTNNO + "%'");
var CUSTOMERNAME = form.findField('CUSTOMERNAME').getValue();
sql = sql + getAndConSql(sql, CUSTOMERNAME, "CUSTOMERNAME='" + CUSTOMERNAME + "'");
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;
},
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 提箱日期 ,PRE_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 提箱日期,PRE_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 (ISSTOPUSE=0 OR ISSTOPUSE IS NULL) AND 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);
}
});