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.

1506 lines
54 KiB
JavaScript

Ext.namespace('Shipping');
Shipping.MsOpLetterTruckView = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsOpLetterTruckView.superclass.constructor.call(this);
};
Ext.extend(Shipping.MsOpLetterTruckView, Ext.Panel, {
ParentWin: null,
OpStatus: 'add',
StoreList: null,
editRecord: null,
Editdata: null,
MainEditRecord: null,
oplb: '',
initUIComponents: function () {
this.serialNo = 0;
//this.bodyDel = [];
this.itemindex = 1;
this.BsNo = getUrlParam('bsno');
this.oplb = getUrlParam('oplb');
this.le_id = getUrlParam('le_id');
//权限范围
this.StoreOpRange = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsOP',
proxy: { url: '/MvcShipping/MsBaseInfo/GetOpRang' }
});
this.StoreOpRange.load({ params: { optype: "modOrderManagement"} });
this.storeFM = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.UserLinkRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetUserLinkRefList' }
});
//客户加载_车队
this.storeTRUCKER = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
this.storeTRUCKER.load({ params: { condition: "ISTRUCK='1'"} });
//车队
this.comboxTRUCKER = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '车队',
store: this.storeTRUCKER,
name: 'HEAD_TO',
valueField: 'CustName',
displayField: 'CodeAndName',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
this.formEdit.getForm().findField('TRUCK').setValue(combo.value);
var s = " ISOPERATOR=1 and LINKID in (select gid from [info_client] where SHORTNAME='" + combo.value + "')";
this.storeInfoClientContact.load({ params: { condition: s },
callback: function (r, options, success) {
if (success) {
if (this.storeInfoClientContact.getCount() > 0) {
var member = this.storeInfoClientContact.getAt(0);
this.comboxInfoClientContact.setValue(member.data.SHOWNAME);
this.formHead.getForm().findField('HEAD_ATTNTEL').setValue(member.data.TEL);
this.formHead.getForm().findField('HEAD_ATTNFAX').setValue(member.data.FAX);
} else {
this.comboxInfoClientContact.setValue('');
this.formHead.getForm().findField('HEAD_ATTNTEL').setValue('');
this.formHead.getForm().findField('HEAD_ATTNFAX').setValue('');
}
}
},
scope: this
});
}
}
}
});
//委托单位_联系人
this.storeInfoClientContact = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.InfoClientContactModel',
proxy: { url: '/CommMng/BasicDataRef/GetInfoClientContactList' }
});
this.comboxInfoClientContact = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: 'ATTN',
store: this.storeInfoClientContact,
name: 'HEAD_ATTN',
valueField: 'SHOWNAME',
displayField: 'SHOWNAME',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
var Cargoinforecords = DsStoreQueryBy(this.storeInfoClientContact, 'GID', records[0].data.GID);
if (Cargoinforecords.getCount() > 0) {
var Cargoinfodata = Cargoinforecords.getAt(0).data;
this.formHead.getForm().findField('HEAD_ATTNTEL').setValue(Cargoinfodata.TEL);
this.formHead.getForm().findField('HEAD_ATTNFAX').setValue(Cargoinfodata.FAX);
} else {
// this.formHead.getForm().findField('HEAD_ATTNTEL').setValue('');
// this.formHead.getForm().findField('HEAD_ATTNFAX').setValue('');
}
}
}
}
});
//this.StoreTRUCKSTATUS = Ext.create('Ext.data.Store', {
// fields: ['BLTYPE']
//});
//this.StoreTRUCKSTATUS.add({ "BLTYPE": "待派车" });
//this.StoreTRUCKSTATUS.add({ "BLTYPE": "提交派车" });
//this.StoreTRUCKSTATUS.add({ "BLTYPE": "已发单" });
//this.StoreTRUCKSTATUS.add({ "BLTYPE": "已接单" });
//this.StoreTRUCKSTATUS.add({ "BLTYPE": "已派车" });
//this.comboxTRUCKSTATUS = Ext.create('DsExt.ux.RefTableCombox', {
// fieldLabel: '派车状态',
// store: this.StoreTRUCKSTATUS,
// forceSelection: true,
// readOnly: true,
// name: 'TRUCKSTATUS',
// valueField: 'BLTYPE',
// displayField: 'BLTYPE'
//});
this.storeList = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
model: 'MsOpLetterTruck',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsOpLetter/GetTruckList',
reader: {
id: 'BSNO',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.girdcolums = [{
sortable: true,
dataIndex: 'LE_ID',
header: 'LE_ID',
hidden: true,
width: 150
}, {
sortable: true,
dataIndex: 'BSNO',
header: '业务编号',
hidden: true,
width: 150
}, {
sortable: true,
dataIndex: 'TRUCK',
header: '车队',
width: 120
}, {
sortable: true,
dataIndex: 'CTNS',
header: '集装箱',
width: 120
}, {
sortable: true,
dataIndex: 'FACTRYNAME',
header: '工厂',
width: 120
}, {
sortable: true,
dataIndex: 'INPUTBY',
header: '录入人',
width: 80
}, {
sortable: true,
dataIndex: 'INPUTTIME',
header: '录入日期',
width: 80
}
];
//定义Grid
//#region 编辑formHead 基本信息
this.formHead = Ext.widget('form', {
region: 'north',
frame: true,
bodyPadding: 5,
collapsed: false,
collapsible: true,
trackResetOnLoad: true,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 70,
msgTarget: 'qtip'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '业务编号',
name: 'BSNO', hidden: true
}, {
fieldLabel: 'LE_ID',
hidden: true,
name: 'LE_ID'
}, {
fieldLabel: 'INPUTTIME',
hidden: true,
name: 'INPUTTIME'
}, {
fieldLabel: 'LETTERNAME',
hidden: true,
name: 'LETTERNAME',
value: '派车通知'
}, this.comboxTRUCKER]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxInfoClientContact, {
fieldLabel: 'ATTN电话',
name: 'HEAD_ATTNTEL'
}, {
fieldLabel: 'ATTN传真',
name: 'HEAD_ATTNFAX'
}, { xtype: 'hiddenfield'}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: 'FROM',
name: 'INPUTBY'
}, {
fieldLabel: 'FROM电话',
name: 'HEAD_FMTEL'
}, {
fieldLabel: 'FROM传真',
name: 'HEAD_FMFAX'
}, {
fieldLabel: 'EMAIL',
name: 'HEAD_FMEMAIL'
}]
}
]//end items(fieldset 1)
}); //end this.formEdit
//#endregion
//客户加载_场站
this.storeYARD = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomYardRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomYardRefList' }
});
this.storeYARD.load({ params: { condition: "ISYARD='1'"} });
//船公司
var yardname = '提箱场站';
if (this.oplb == "海运进口" || this.oplb == "空运进口") {
yardname = '提箱码头'
}
this.comboxYARD = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: yardname,
store: this.storeYARD,
forceSelection: true,
name: 'YARD',
valueField: 'CustName',
displayField: 'CodeAndName',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
var data = combo.value;
var s = " ISOPERATOR=1 and LINKID in (select gid from [info_client] where SHORTNAME='" + combo.value + "')";
this.storeInfoClientContactYard.load({ params: { condition: s },
callback: function (r, options, success) {
if (success) {
if (this.storeInfoClientContactYard.getCount() > 0) {
var member = this.storeInfoClientContactYard.getAt(0);
this.comboxInfoClientContactYard.setValue(member.data.SHOWNAME);
this.formEdit.getForm().findField('YARDTEL').setValue(member.data.TEL);
} else {
this.comboxInfoClientContactYard.setValue('');
this.formEdit.getForm().findField('YARDTEL').setValue('');
}
}
},
scope: this
});
}
}
}
});
//委托单位_联系人
this.storeInfoClientContactYard = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.InfoClientContactModel',
proxy: { url: '/CommMng/BasicDataRef/GetInfoClientContactList' }
});
this.comboxInfoClientContactYard = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '联系人',
store: this.storeInfoClientContactYard,
name: 'YARDATTN',
valueField: 'SHOWNAME',
displayField: 'SHOWNAME',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
this.formEdit.getForm().findField('YARDTEL').setValue(records[0].data.TEL);
}
}
}
});
//客户加载_场站
this.storeYARD2 = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomYardRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomYardRefList' }
});
this.storeYARD2.load({ params: { condition: "ISYARD='1'"} });
//船公司
this.comboxYARD2 = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '入货场站',
store: this.storeYARD,
forceSelection: true,
name: 'RETURNYARD',
valueField: 'CustName',
displayField: 'CodeAndName',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
var data = combo.value;
var s = " ISOPERATOR=1 and LINKID in (select gid from [info_client] where SHORTNAME='" + combo.value + "')";
this.storeInfoClientContactYard2.load({ params: { condition: s },
callback: function (r, options, success) {
if (success) {
if (this.storeInfoClientContactYard2.getCount() > 0) {
var member = this.storeInfoClientContactYard2.getAt(0);
this.comboxInfoClientContactYard2.setValue(member.data.SHOWNAME);
this.formEdit.getForm().findField('RETURNTEL').setValue(member.data.TEL);
} else {
this.comboxInfoClientContactYard2.setValue('');
this.formEdit.getForm().findField('RETURNTEL').setValue('');
}
}
},
scope: this
});
}
}
}
});
//委托单位_联系人
this.storeInfoClientContactYard2 = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.InfoClientContactModel',
proxy: { url: '/CommMng/BasicDataRef/GetInfoClientContactList' }
});
this.comboxInfoClientContactYard2 = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '联系人',
store: this.storeInfoClientContactYard,
name: 'RETURNATTN',
valueField: 'SHOWNAME',
displayField: 'SHOWNAME',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
this.formEdit.getForm().findField('RETURNTEL').setValue(records[0].data.TEL);
}
}
}
});
var companyname = '工厂';
if (this.oplb == "海运进口" || this.oplb == "空运进口") {
companyname = '卸货工厂'
}
Ext.define('MsOpSeaeDetail', {
extend: 'Ext.data.Model',
fields: [
{ name: 'GID', type: 'string' },
{ name: 'CTN_ID', type: 'string' },
{ name: 'CTNNUM', type: 'int' },
{ name: 'KGS', type: 'number' },
{ name: 'FENCTNNUM', type: 'int' },
{ name: 'FENKGS', type: 'number' },
{ name: 'CTNALL', type: 'string' }
]
});
this.storeCtnList = Ext.create('Ext.data.Store', {
model: 'MsOpSeaeDetail',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsOpLetter/GetLetterCtnList',
reader: {
id: 'CTN_ID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//箱型_集装箱列表中的下拉框加载
this.storeCodeCtn = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CodeCtnModel',
proxy: { url: '/CommMng/BasicDataRef/GetCodeCtnList' }
});
this.storeCodeCtn.load();
this.comboxCTNALL = Ext.create('DsExt.ux.RefTableCombox', {
//fieldLabel: Zi.LAN.CTNALL, //'箱型',
store: this.storeCodeCtn,
forceSelection: true,
name: 'CTNALL',
valueField: 'CTN',
displayField: 'CTN'
});
this.gridListCellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});
this.gridListCtn = new Ext.grid.GridPanel({
store: this.storeCtnList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
plugins: [this.gridListCellEditing],
selType: 'cellmodel',
//tbar: [
// {
// text: '增加明细', //'增加明细',
// tooltip: '增加明细', //'增加明细',
// id: "btnadddetail",
// iconCls: "btnadddetail",
// handler: function (button, event) {
// this.addDetail();
// },
// scope: this
// }, '-', {
// text: '删除明细', //'删除明细',
// tooltip: '删除明细', //'删除明细',
// id: "btndeldetail",
// iconCls: "btndeletedetail",
// handler: function (button, event) {
// this.deleteDetail();
// },
// scope: this
// }],
columns: [{
sortable: true,
dataIndex: 'CTN_ID',
header: '编号',
hidden: true,
width: 0
}, {
dataIndex: 'CTNALL',
header: '箱型', //'箱型',
width: 125
}, {
dataIndex: 'CTNNUM',
header: '箱量', //'箱量',
width: 100
}, {
dataIndex: 'KGS',
header: '重量', //'重量',
width: 120
}]
});
this.storeCtnList.on('beforeload', function (store) {
var billNo = this.formEdit.getForm().findField('LE_ID').getValue();
var condition = "LE_ID='" + billNo + "'";
Ext.apply(store.proxy.extraParams, { condition: condition });
}, this);
this.panelBodyCtn = new Ext.Panel({
// title: '集装箱信息', //'集装箱信息',
layout: "border",
height: 120,
flex: 1,
margin: '5 20',
frame: true,
items: [this.gridListCtn]
});
//#region 编辑formEdit 派车通知
this.formEdit = Ext.widget('form', {
region: 'north',
height: 460,
frame: true,
bodyPadding: 5,
trackResetOnLoad: true,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 70,
msgTarget: 'qtip'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '船名',
name: 'VESSEL'
}, {
fieldLabel: '航次',
name: 'VOYNO'
}, {
fieldLabel: '提单号',
name: 'MBLNO'
}, {
fieldLabel: '绩效',
labelWidth: 40,
xtype: 'numberfield',
flex: 0.5,
name: 'OTHERFEE',
value: 0
}]
},{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '业务编号',
name: 'BSNO', hidden: true
}, {
fieldLabel: 'LE_ID',
hidden: true,
name: 'LE_ID'
}, {
fieldLabel: 'TRUCK',
hidden: true,
name: 'TRUCK'
}, {
fieldLabel: 'ISFEE',
hidden: true,
name: 'ISFEE'
}, {
fieldLabel: 'CUSTOMERNAME',
hidden: true,
name: 'CUSTOMERNAME'
}
, {
fieldLabel: '箱型箱量',
name: 'CTNS'
}
, {
fieldLabel: '陆运费',
xtype: 'numberfield',
labelWidth: 50,
name: 'TRUCKFEE',
value: 0
}, {
fieldLabel: '吨数',
name: 'KGS'
}
, {
fieldLabel: '支付方式',
name: 'PAYTYPE'
}, {
fieldLabel: '派车日期',
format: 'Y-m-d',
flex: 1,
xtype: 'datefield',
name: 'TRUCKDATE'
}
]
}
, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxYARD, this.comboxInfoClientContactYard, {
fieldLabel: '电话',
name: 'YARDTEL'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: companyname,
name: 'FACTRYNAME'
}]
}
, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
xtype: 'textareafield',
grow: true,
flex: 2,
fieldLabel: '工厂地址',
height: 60,
name: 'FACTRYADDR',
anchor: '100%'
}, {
fieldLabel: '要求到达时间', labelWidth: 80,
format: 'Y-m-d',
flex: 1,
xtype: 'datetimefield',
name: 'FACTRYTIME'
}]
}
, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '工厂联系人',
name: 'FACTRYATTN'
}, {
fieldLabel: '联系方式',
name: 'FACTRYTEL'
}]
}
, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxYARD2, this.comboxInfoClientContactYard2, {
fieldLabel: '电话',
name: 'RETURNTEL'
}]
}
, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '截港日期',
format: 'Y-m-d',
flex: 1,
// xtype: 'datefield',
name: 'CLOSINGDATE'
}, {
fieldLabel: '提货日期',
format: 'Y-m-d',
flex: 1,
xtype: 'datefield',
name: 'CARGODATE'
}, {
fieldLabel: '派车状态',
readOnly:true,
name: 'TRUCKSTATUS'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.panelBodyCtn, {
xtype: 'container',
layout: 'anchor',
flex: 1,
defaultType: 'textfield',
items: [{
xtype: 'textareafield',
grow: true,
flex: 1,
fieldLabel: '注意事项',
height: 60,
name: 'TRUCKDETAIL',
anchor: '100%'
}, {
xtype: 'textareafield',
grow: true,
fieldLabel: '备注',
height: 60,
name: 'REMARK',
anchor: '100%'
}]
}
]
}, {
xtype: 'textfield', hidden: true,
fieldLabel: '件数',
name: 'PKGS',
anchor: '100%'
}, {
xtype: 'textfield', hidden: true,
fieldLabel: '尺码',
name: 'CBM',
anchor: '100%'
}
]//end items(fieldset 1)
}); //end this.formEdit
//#endregion
//#region 按钮Toolbar
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [{
text: "打印",
iconCls: "btnprint",
handler: function (button, event) {
this.Print();
},
scope: this
}, {
id: 'btnESave',
text: "保存",
iconCls: "btnsave",
handler: function (button, event) {
this.Save('0');
},
scope: this
}, {
text: "分拆派车",
id: 'btnFcPc',
handler: function (button, event) {
this.winCtnListShow.show();
},
scope: this
}, {
text: "派 车",
id: 'btnPc',
handler: function (button, event) {
this.Pc();
},
scope: this
}, {
text: "发 单",
id: 'btnFd',
handler: function (button, event) {
this.Fd();
},
scope: this
}, {
text: "取消派车",
handler: function (button, event) {
this.CancelPc();
},
scope: this
}]
}); //end 按钮Toolbar
//#endregion
//#region 框架结构
this.panelpage = new Ext.Panel({
title: '派车通知详细信息',
layout: "border",
region: 'center',
animate: true,
autoScroll: true,
// containerScroll: true,
frame: false,
items: [this.formEdit]
});
this.paneltruckdetail = new Ext.Panel({
layout: "border",
region: 'center',
animate: true,
autoScroll: true,
// containerScroll: true,
frame: false,
items: [this.formHead, this.panelpage]
});
Ext.apply(this, {
items: [this.panelBtn,this.paneltruckdetail]
});
//#endregion
//#region 其他
this.InitData();
parentWin = window.parent.opener._this;
//#region 集装箱窗体
this.gridListCellEditing2 = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});
this.GridCheckBoxModelCtn = Ext.create('Ext.selection.CheckboxModel');
this.gridListCtnShow = new Ext.grid.GridPanel({
store: this.storeCtnList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
plugins: [this.gridListCellEditing2],
selType: 'cellmodel',
//tbar: [
//{
// text: '增加明细', //'增加明细',
// tooltip: '增加明细', //'增加明细',
// iconCls: "btnadddetail",
// handler: function (button, event) {
// this.addDetail();
// },
// scope: this
//}, '-', {
// text: '删除明细', //'删除明细',
// tooltip: '删除明细', //'删除明细',
// iconCls: "btndeletedetail",
// handler: function (button, event) {
// this.deleteDetail();
// },
// scope: this
//}],
columns: [{
sortable: true,
dataIndex: 'CTN_ID',
header: '编号',
hidden: true,
width: 0
}, {
dataIndex: 'CTNALL',
header: '箱型', //'箱型',
width: 45
}, {
dataIndex: 'CTNNUM',
header: '箱量', //'箱量',
width: 80
}, {
dataIndex: 'KGS',
header: '重量', //'重量',
width: 100
}, {
dataIndex: 'FENCTNNUM',
header: '分解箱量', //'箱量',
width: 80,
editor: {
xtype: 'numberfield',
allowBlank: false,
selectOnFocus: true
}
}, {
dataIndex: 'FENKGS',
header: '分解重量', //'重量',
width: 120,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
}]
});
this.gridListCtnShow.on('edit', function (editor, e, eOpts) {
this.gridAfterEdit(editor, e, eOpts);
}, this);
me = this;
this.winCtnListShow = Ext.create('Ext.window.Window', {
title: '分拆明细', //"集装箱明细",
width: 500,
height: 250,
//plain : true,
layout: "border",
iconCls: "addicon",
resizable: false,
// 是否可以拖动
// draggable:false,
collapsible: true, // 允许缩放条
closeAction: 'close',
closable: true,
modal: 'true',
buttonAlign: "center",
bodyStyle: "padding:0 0 0 0",
items: [this.gridListCtnShow],
buttons: [{
text: "确定分拆", //
minWidth: 70,
handler: function () {
me.onFenJie();
}
}, {
text: '关闭', //"关闭",
minWidth: 70,
handler: function () {
me.winCtnListShow.close();
}
}]
});
//#endregion
//#endregion
}, //end initUIComponents
//#region 加载事件
InitData: function () {
this.opStatus = 'add';
var condition = '';
_this = this;
_this.LoadData("edit", "LE_ID='" + this.le_id + "'");
}, //end InitData
LoadData: function (opstatus, condition) {
this.serialNo = 0;
//this.bodyDel = [];
this.opStatus = opstatus;
Ext.Ajax.request({
waitMsg: '正在查询主表数据...',
url: '/MvcShipping/MsOpLetter/GetData',
params: {
handle: opstatus,
condition: condition
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
Ext.Msg.show({
title: '提示',
msg: result.Message,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
return;
}
data = result.data;
this.formHead.getForm().reset();
this.formHead.getForm().setValues(data);
this.storeCtnList.load({ params: { condition: "LE_ID='" + data.LE_ID + "'" } });
// this.formEdit.getForm().findField('CUSTOMERNAME').setValue(this.MainEditRecord.get('CUSTOMERNAME'));
this.GetEditStatus();
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
Ext.Ajax.request({
waitMsg: '正在查询主表数据...',
url: '/MvcShipping/MsOpLetter/GetTruckData',
params: {
handle: opstatus,
condition: condition
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
Ext.Msg.show({
title: '提示',
msg: result.Message,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
return;
}
data = result.data;
this.formEdit.getForm().reset();
this.formEdit.getForm().setValues(data);
// this.LoadInit();
this.GetEditStatus();
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
//20160219 获取业务主表内的件数重量尺码,用于在生成散货派车单时传递
//this.formEdit.getForm().findField('PKGS').setValue(this.MainEditRecord.get('PKGS'));
//this.formEdit.getForm().findField('KGS').setValue(this.MainEditRecord.get('KGS'));
//this.formEdit.getForm().findField('CBM').setValue(this.MainEditRecord.get('CBM'));
}, // end LoadDate
//#endregion
//#region
LoadInit: function () {
var CUSTOMERNAME = this.MainEditRecord.get('CUSTOMERNAME');
var s = " ISOPERATOR=1 and LINKID in (select gid from [info_client] where SHORTNAME='" + CUSTOMERNAME + "')";
this.storeInfoClientContact.load({ params: { condition: s} });
var YARD = this.formEdit.getForm().findField('YARD').getValue();
var s = " ISOPERATOR=1 and LINKID in (select gid from [info_client] where SHORTNAME='" + YARD + "')";
this.storeInfoClientContactYard.load({ params: { condition: s} });
var YARD2 = this.formEdit.getForm().findField('RETURNYARD').getValue();
var s = " ISOPERATOR=1 and LINKID in (select gid from [info_client] where SHORTNAME='" + YARD2 + "')";
this.storeInfoClientContactYard2.load({ params: { condition: s} });
},
//#endregion
//#region 保存
Save: function (type) {
var basicForm = this.formEdit.getForm();
if (!basicForm.isValid()) {
return;
}
this.setAllTotal();
var data = this.formHead.getForm().getValues(false, false, false);
var body = this.formEdit.getForm().getValues(false, false, false);
var bodydatas = [];
for (var i = 0; i < this.storeCtnList.getCount(); i += 1) {
var member = this.storeCtnList.getAt(i);
bodydatas.push(member);
}
var jsonBodyCtn = ConvertRecordsToJsonAll(bodydatas);
//
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/MvcShipping/MsOpLetter/SaveBLTruck',
scope: this,
params: {
opstatus: 'edit',
data: Ext.JSON.encode(data),
body: Ext.JSON.encode(body),
ctn: jsonBodyCtn
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
var returnData = jsonresult.Data;
this.formEdit.getForm().reset();
this.formEdit.getForm().setValues(returnData);
var LE_ID = this.formHead.getForm().findField('LE_ID').getValue();
for (var j = 0; j < this.storeCtnList.getCount(); j += 1) {
var memberbody = this.storeCtnList.getAt(j);
memberbody.set("LE_ID", LE_ID);
memberbody.commit();
};
this.opStatus = 'edit';
this.GetEditStatus();
} 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
});
}
}
});
}, //end save
//#endregion
//#region 保存
onFenJie: function () {
var basicForm = this.formEdit.getForm();
if (!basicForm.isValid()) {
return;
}
var TRUCKSTATUS = this.formEdit.getForm().findField('TRUCKSTATUS').getValue();
if (TRUCKSTATUS == '已派车' || TRUCKSTATUS == '待派车') {
Ext.Msg.show({ title: '提示', msg: '当前状态已派车,不允许分解派车!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var isnottrue = false;
var warmstr = '';
var bodydatas = [];
for (var i = 0; i < this.storeCtnList.getCount(); i += 1) {
var member = this.storeCtnList.getAt(i);
if (member.data.FENKGS == 0 || member.data.FENCTNNUM == 0) {
isnottrue = true;
warmstr = warmstr + ' ' + '分解重量和分解箱量不能为0';
}
if (member.data.FENKGS >= member.data.KGS || member.data.FENCTNNUM >= member.data.CTNNUM) {
isnottrue = true;
warmstr = warmstr + ' ' + '分解重量和分解箱量不能大于原来重量和箱量';
}
bodydatas.push(member);
}
var jsonBodyCtn = ConvertRecordsToJsonAll(bodydatas);
if (isnottrue) {
Ext.Msg.show({ title: '提示', msg: '当前状态,不允许提交派车!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var data = this.formHead.getForm().getValues(false, false, false);
var body = this.formEdit.getForm().getValues(false, false, false);
//
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/MvcShipping/MsOpLetter/SubmitFenPcBLTruck',
scope: this,
params: {
data: Ext.JSON.encode(data),
body: Ext.JSON.encode(body),
ctn: jsonBodyCtn
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
var returnData = jsonresult.Data;
this.formEdit.getForm().reset();
this.formEdit.getForm().setValues(returnData);
//
if (this.opStatus == 'add') {
var arrNewRecords = this.storeList.add(returnData);
this.editRecord = arrNewRecords[0];
var editp = Ext.create('MsOpLetterTruck', returnData);
this.formHead.getForm().findField('LE_ID').setValue(editp.get('LE_ID'));
}
else if (this.opStatus == 'edit') {
var editp = Ext.create('MsOpLetterTruck', returnData);
//this.editRecord.fields.each(function (field) {
// if (field.persist) {
// name = field.name;
// if (name != 'id')
// this.editRecord.set(name, editp.get(name));
// }
//}, this);
//this.editRecord.commit();
}
var LE_ID = this.formHead.getForm().findField('LE_ID').getValue();
this.storeCtnList.load({ params: { condition: "LE_ID='" + data.LE_ID + "'" } });
this.opStatus = 'edit';
parentWin.Refresh();
this.GetEditStatus();
} 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
});
}
}
});
}, //end save
//#endregion
setAllTotal: function () {
var cntrstr = '';
var kgs = 0;
for (var j = 0; j < _this.storeCtnList.getCount(); j += 1) {
var memberbody = _this.storeCtnList.getAt(j);
if (cntrstr == '')
cntrstr = memberbody.data.CTNALL + '*' + memberbody.data.CTNNUM;
else
cntrstr = cntrstr + ' ' + memberbody.data.CTNALL + '*' + memberbody.data.CTNNUM;
kgs = Add(kgs, memberbody.data.KGS);
}
this.formEdit.getForm().findField('CTNS').setValue(cntrstr);
this.formEdit.getForm().findField('KGS').setValue(kgs);
},
gridAfterEdit: function (editor, e, eOpts) {
if (e.field == 'FENCTNNUM') {
var KGS = e.record.data['KGS'];
var CTNNUM = e.record.data['CTNNUM'];
var FENCTNNUM = e.record.data['FENCTNNUM'];
var FENKGS = Mul(FENCTNNUM, Div(KGS, CTNNUM));
e.record.set('FENKGS', FENKGS);
}
},
//#region 派车
Pc: function () {
var TRUCK = this.formEdit.getForm().findField('TRUCK').getValue();
if (TRUCK == '') {
Ext.Msg.show({ title: '提示', msg: '必须选择车队!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var TRUCKSTATUS = this.formEdit.getForm().findField('TRUCKSTATUS').getValue();
if (TRUCKSTATUS == '已派车' || TRUCKSTATUS == '待派车') {
Ext.Msg.show({ title: '提示', msg: '当前状态已派车,不允许重复派车!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var data = this.formHead.getForm().getValues(false, false, false);
var body = this.formEdit.getForm().getValues(false, false, false);
var bodydatas = [];
for (var i = 0; i < this.storeCtnList.getCount(); i += 1) {
var member = this.storeCtnList.getAt(i);
bodydatas.push(member);
}
var jsonBodyCtn = ConvertRecordsToJsonAll(bodydatas);
//
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/MvcShipping/MsOpLetter/PcBLTruck',
scope: this,
params: {
data: Ext.JSON.encode(data),
body: Ext.JSON.encode(body),
ctn: jsonBodyCtn
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
var returnData = jsonresult.Data;
this.formEdit.getForm().reset();
this.formEdit.getForm().setValues(returnData);
parentWin.Refresh();
this.GetEditStatus();
} 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
});
}
}
});
}, //end save
//#endregion
//#region 派车
CancelPc: function () {
var TRUCKSTATUS = this.formEdit.getForm().findField('TRUCKSTATUS').getValue();
if (TRUCKSTATUS != '已派车' && TRUCKSTATUS != '已发单') {
Ext.Msg.show({ title: '提示', msg: '当前状态,不允许取消派车!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var data = this.formHead.getForm().getValues(false, false, false);
var body = this.formEdit.getForm().getValues(false, false, false);
var bodydatas = [];
for (var i = 0; i < this.storeCtnList.getCount(); i += 1) {
var member = this.storeCtnList.getAt(i);
bodydatas.push(member);
}
var jsonBodyCtn = ConvertRecordsToJsonAll(bodydatas);
//
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/MvcShipping/MsOpLetter/CancelPcBLTruck',
scope: this,
params: {
data: Ext.JSON.encode(data),
body: Ext.JSON.encode(body),
ctn: jsonBodyCtn
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
var returnData = jsonresult.Data;
this.formEdit.getForm().reset();
this.formEdit.getForm().setValues(returnData);
parentWin.Refresh();
this.GetEditStatus();
} 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
});
}
}
});
}, //end save
//#endregion
//#region 发单
Fd: function () {
var TRUCKSTATUS = this.formEdit.getForm().findField('TRUCKSTATUS').getValue();
if (TRUCKSTATUS == '已派车' || TRUCKSTATUS == '待派车') {
Ext.Msg.show({ title: '提示', msg: '当前状态已派车,不允许重复派车!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var data = this.formHead.getForm().getValues(false, false, false);
var body = this.formEdit.getForm().getValues(false, false, false);
var bodydatas = [];
for (var i = 0; i < this.storeCtnList.getCount(); i += 1) {
var member = this.storeCtnList.getAt(i);
bodydatas.push(member);
}
var jsonBodyCtn = ConvertRecordsToJsonAll(bodydatas);
//
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/MvcShipping/MsOpLetter/FdBLTruck',
scope: this,
params: {
data: Ext.JSON.encode(data),
body: Ext.JSON.encode(body),
ctn: jsonBodyCtn
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
var returnData = jsonresult.Data;
this.formEdit.getForm().reset();
this.formEdit.getForm().setValues(returnData);
parentWin.Refresh();
this.opStatus = 'edit';
this.GetEditStatus();
} 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
});
}
}
});
}, //end save
//#endregion
GetEditStatus: function () {
var canedit = false;
//var bsStatus = this.formHead.getForm().findField('BSSTATUS').getValue();
var TRUCKSTATUS = this.formEdit.getForm().findField('TRUCKSTATUS').getValue();
_this = this;
if (TRUCKSTATUS == '待派车' || TRUCKSTATUS == '已派车') {
canedit = false;
this.setSaveBtnStatus(canedit);
} else {
this.setSaveBtnStatus(true);
}
},
setSaveBtnStatus: function (enable) {
var btnESave = Ext.getCmp('btnESave');
var btnFcPc = Ext.getCmp('btnFcPc');
var btnPc = Ext.getCmp('btnPc');
var btnFd = Ext.getCmp('btnFd');
if (enable) {
btnESave.enable();
btnFcPc.enable();
btnPc.enable();
btnFd.enable();
} else {
btnESave.disable();
btnFcPc.disable();
btnPc.disable();
btnFd.disable();
}
},
//#endregion
//#region 打印
Print: function () {
var basicForm = this.formHead.getForm();
var billNo = basicForm.findField('LE_ID').value;
var bsNo = basicForm.findField('BSNO').value;
if (billNo == '*' || billNo == '' || billNo == NaN) {
Ext.Msg.show({ title: '错误', msg: '派车通知还没有保存,请保存后再打印', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
return;
}
var printType = 'MSOPLETTERTRUCK';
if (this.oplb == "海运进口") {
printType = 'MSOPLETTERTRUCKSEAI'
} else if (this.oplb == "空运进口") {
printType = 'MSOPLETTERTRUCKAIRI'
} else if (this.oplb == "空运出口") {
printType = 'MSOPLETTERTRUCKAIRE'
}
var sql1 = "SET LANGUAGE 'us_english' SELECT * FROM op_letter WHERE LE_ID = '" + billNo + "'";
var sql2 = "SET LANGUAGE 'us_english' SELECT * FROM op_letter_truck WHERE LE_ID = '" + billNo + "'";
var sql3 = "";
if (this.oplb == "海运进口")
sql3 = "SET LANGUAGE 'us_english' SELECT * FROM op_seai WHERE BSNO = '" + bsNo + "'";
else if (this.oplb == "空运进口")
sql3 = "SET LANGUAGE 'us_english' SELECT * FROM op_airi WHERE BSNO = '" + bsNo + "'";
else if (this.oplb == "空运出口")
sql3 = "SET LANGUAGE 'us_english' SELECT * FROM op_aire WHERE BSNO = '" + bsNo + "'";
else
sql3 = "SET LANGUAGE 'us_english' SELECT * FROM op_seae WHERE BSNO = '" + bsNo + "'";
var sql4 = "";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
}
// #endregion
});