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/MsOpSeaeEdi/MsOpSeaeCustomEdiEdit.js

1995 lines
64 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.MsOpSeaeCustomEdiEdit = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsOpSeaeCustomEdiEdit.superclass.constructor.call(this);
};
Ext.extend(Shipping.MsOpSeaeCustomEdiEdit, Ext.Panel, {
ParentWin: null,
OpStatus: 'add',
StoreList: null,
EditRecord: null,
Editdata: null,
isAudit: null,
accdate: null,
seaeop: "",
seaecustservice: "",
reason: "",
BillType: null,
OrType: null,
editype:'',
initUIComponents: function () {
this.serialNo = 0;
//this.bodyDel = [];
this.itemindex = 1;
this.StoreCargoid = Ext.create('Ext.data.Store', {
fields: ['ID', 'NAME']
});
this.StoreCargoid.add({ "ID": "S", "NAME": "S普通货" });
this.StoreCargoid.add({ "ID": "R", "NAME": "R冻柜" });
this.StoreCargoid.add({ "ID": "D", "NAME": "D危险品" });
this.StoreCargoid.add({ "ID": "O", "NAME": "O超限箱" });
this.comboxCargoid = Ext.create('DsExt.ux.RefTableCombox', {
store: this.StoreCargoid,
fieldLabel: '货物标示',
forceSelection: true,
name: 'CARGOID',
valueField: 'ID',
displayField: 'NAME',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
if (combo.value == 'R') {
this.panelBodyDr.setVisible(false);
this.panelBodyRf.setVisible(true);
} else if (combo.value == 'D') {
this.panelBodyDr.setVisible(true);
this.panelBodyRf.setVisible(false);
} else {
this.panelBodyDr.setVisible(false);
this.panelBodyRf.setVisible(false);
}
}
}
}
});
//键值维护表_装运方式
//件数包装
this.storeCodePackage = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CodePackageModel',
proxy: { url: '/CommMng/BasicDataRef/GetCodePackageList' }
});
this.storeCodePackage.load();
this.comboxKINDPKGS = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '包 装',
store: this.storeCodePackage,
forceSelection: true,
name: 'KINDPKGS',
valueField: 'PKGS',
displayField: 'PKGS'
});
//件数包装_集装箱列表中的下拉框加载
this.comboxKINDPKGS_CTN = Ext.create('DsExt.ux.RefTableCombox', {
//fieldLabel: '件数包装',
store: this.storeCodePackage,
forceSelection: true,
name: 'KINDPKGS',
valueField: 'PKGS',
displayField: 'PKGS'
});
//箱型_集装箱列表中的下拉框加载
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: '箱型',
store: this.storeCodeCtn,
forceSelection: true,
name: 'CTNALL',
valueField: 'CTN',
displayField: 'CTN'
});
this.StoreStatus = Ext.create('Ext.data.Store', {
fields: ['STATUS']
});
this.StoreStatus.add({ "STATUS": "未发送" });
this.StoreStatus.add({ "STATUS": "已保存文件" });
this.StoreStatus.add({ "STATUS": "已发送" });
this.comboxStatus = Ext.create('DsExt.ux.RefTableCombox', {
store: this.StoreStatus,
fieldLabel: 'EDI状态',
forceSelection: true,
name: 'EDISTATUS',
valueField: 'STATUS',
displayField: 'STATUS'
});
this.StorePKType = Ext.create('Ext.data.Store', {
fields: ['TYPE']
});
this.StorePKType.add({ "TYPE": "整箱" });
this.StorePKType.add({ "TYPE": "拼箱" });
this.comboxPKType = Ext.create('DsExt.ux.RefTableCombox', {
store: this.StorePKType,
fieldLabel: '装运方式',
forceSelection: true,
name: 'PACKINGTYPE',
valueField: 'TYPE',
displayField: 'TYPE'
});
//#endregion
//#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: 'MFNO', hidden: true
}, {
fieldLabel: '业务编号',
name: 'BSNO', hidden: true
}, {
fieldLabel: 'MASTERNO',
name: 'MASTERNO', hidden: true
}, {
fieldLabel: 'EDITYPE',
name: 'EDITYPE', hidden: true
}, {
fieldLabel: '委托编号',
name: 'CUSTNO'
}, this.comboxStatus, {
fieldLabel: '主提单号',
name: 'MBLNO'
}, {
fieldLabel: 'HOUSE BL',
name: 'HBLNO'
}, this.comboxPKType, {
fieldLabel: '录入人',
readOnly: true,
name: 'INPUTBY'
}]
}, {
xtype: 'container',
defaultType: 'textfield',
layout: 'hbox',
items: [{
fieldLabel: '船名',
flex: 1.5,
name: 'VESSEL'
}, {
fieldLabel: '航次',
flex: 0.5,
name: 'VOYNO'
}, {
fieldLabel: '开船日期',
format: 'Y-m-d',
labelWidth: 90,
flex: 1,
xtype: 'datefield',
name: 'ETD'
}, {
fieldLabel: '船舶呼号',
flex: 0.5,
name: 'SHIPIMO'
}, {
fieldLabel: '船公司代码',
flex: 0.5,
name: 'CARRIERID'
}, {
fieldLabel: '船代',
name: 'FORWARDER'
}, {
fieldLabel: '录入日期',
readOnly: true,
name: 'INPUTDATE'
}]
}
]//end items(fieldset 1)
}); //end this.formEdit
//#endregion
//#region 集装箱-数据集
this.StoreCTNOWNER = Ext.create('Ext.data.Store', {
fields: ['TYPE']
});
this.StoreCTNOWNER.add({ "TYPE": "Shipper" });
this.StoreCTNOWNER.add({ "TYPE": "Consolidator" });
this.StoreCTNOWNER.add({ "TYPE": "Deconsolidator" });
this.StoreCTNOWNER.add({ "TYPE": "ThirdParty" });
this.comboxCTNOWNER = Ext.create('DsExt.ux.RefTableCombox', {
store: this.StoreCTNOWNER,
forceSelection: true,
name: 'CTNOWNER',
valueField: 'TYPE',
displayField: 'TYPE'
});
this.storeBodyList = Ext.create('Ext.data.Store', {
model: 'MsSeaeEdiCtn',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsOpSeaeEdi/GetBodyList',
reader: {
id: 'MFNO,CTN_ID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//明细表表格
this.gridListCellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});
this.gridList = new Ext.grid.GridPanel({
store: this.storeBodyList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
plugins: [this.gridListCellEditing],
selType: 'cellmodel',
tbar: [{
text: '增加明细',
tooltip: '增加明细',
id: "btnaddctndetail",
iconCls: "btnadddetail",
handler: function (button, event) {
this.onAddDetailClick(button, event);
},
scope: this
}, '-', {
text: '删除明细',
tooltip: '删除明细',
id: "btndelctndetail",
iconCls: "btndeletedetail",
handler: function (button, event) {
this.onDelDetailClick(button, event);
},
scope: this
}],
columns: [{
sortable: true,
dataIndex: 'CTN_ID',
header: '编号',
hidden: true,
width: 0
}, {
sortable: true,
dataIndex: 'MFNO',
header: '业务编号',
hidden: true,
width: 0
}, {
sortable: true,
dataIndex: 'CTNCODE',
header: '序号',
width: 30
}, {
dataIndex: 'CTNALL',
header: '箱型',
width: 70,
editor: this.comboxCTNALL
}, {
dataIndex: 'CNTRNO',
header: '箱号',
width: 120,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
}, {
dataIndex: 'SEALNO',
header: '封号',
width: 100,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
}, {
sortable: true,
dataIndex: 'PKGS',
header: '件数',
width: 60,
editor: {
xtype: 'numberfield',
allowBlank: false,
selectOnFocus: true
}
}, {
dataIndex: 'KINDPKGS',
header: '包装',
width: 120,
editor: this.comboxKINDPKGS_CTN
}, {
dataIndex: 'KGS',
header: '重量',
width: 60,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
}, {
dataIndex: 'CBM',
header: '尺码',
width: 60,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
}, {
dataIndex: 'MARKS',
header: '唛头',
width: 150,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
}, {
dataIndex: 'DESCRIPTION',
header: '货物描述',
width: 150,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
}]
});
//#endregion
this.panelBodyCtn = new Ext.Panel({
title: '集装箱信息',
layout: "border",
// anchor:'50% 100%',
region: 'center',
frame: true,
items: [this.gridList]
});
this.panelCtn = new Ext.Panel({
layout: "border",
region: 'center',
animate: true,
autoScroll: true,
// containerScroll: true,
frame: false,
items: [this.panelBodyCtn]
});
this.panelBodyDr = new Ext.Panel({
title: '危险品信息',
layout: "border",
hidden: true,
height: 60,
frame: true,
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
defaults: {
anchor: '96%'
},
items: [{
fieldLabel: '危险品等级',
flex: 1,
labelWidth: 70,
name: 'DCLASS'
}, {
fieldLabel: '危险品编号',
flex: 1,
labelWidth: 70,
name: 'DUNNO'
}, {
fieldLabel: '危险品页号',
flex: 1,
labelWidth: 70,
name: 'DPAGE'
}, {
fieldLabel: '危险品标签',
flex: 1,
labelWidth: 70,
name: 'DLABEL'
}, {
fieldLabel: '危险品联系人',
flex: 1,
labelWidth: 90,
name: 'LINKMAN'
}]
}]
});
this.StoreTemp = Ext.create('Ext.data.Store', {
fields: ['ID', 'NAME']
});
this.StoreTemp.add({ "ID": "C", "NAME": "C摄氏" });
this.StoreTemp.add({ "ID": "F", "NAME": "F华氏" });
this.comboxTemp = Ext.create('DsExt.ux.RefTableCombox', {
store: this.StoreTemp,
fieldLabel: '温度单位',
forceSelection: true,
name: 'TEMPID',
valueField: 'ID',
displayField: 'NAME'
});
this.panelBodyRf = new Ext.Panel({
title: '冻柜信息',
layout: "border",
hidden: true,
height: 60,
//margin: '5 10',
frame: true,
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '冷藏通风量',
name: 'REEFERF'
}, {
fieldLabel: '设置温度',
name: 'TEMPSET'
}, this.comboxTemp]
}]
});
this.panelShipper = new Ext.Panel({
title: '发货人信息',
layout: "anchor",
height: 246,
flex: 1,
frame: true,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
labelWidth: 60,
msgTarget: 'qtip'
},
items: [{
xtype: 'container',
defaultType: 'textfield',
layout: 'hbox',
items: [{ xtype: 'hiddenfield'}]
}, {
xtype: 'container',
defaultType: 'textfield',
layout: 'hbox',
items: [{
fieldLabel: '名称',
flex: 1,
name: 'SHIPPERNAME'
}]
}, {
xtype: 'container',
defaultType: 'textfield',
layout: 'hbox',
items: [{
fieldLabel: '地址1',
flex: 1,
name: 'SHIPPERADDR1'
}]
}, {
xtype: 'container',
defaultType: 'textfield',
layout: 'hbox',
items: [{
fieldLabel: '地址2',
flex: 1,
name: 'SHIPPERADDR2'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '地址3',
flex: 1,
name: 'SHIPPERADDR3'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '城市',
flex: 1,
name: 'SHIPPERCITY'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '州/省',
flex: 0.4,
name: 'SHIPPERPROVINCE'
}, {
fieldLabel: '国家',
flex: 0.30,
labelWidth: 50,
name: 'SHIPPERCOUNTRY'
}, {
fieldLabel: '邮编',
labelWidth: 50,
flex: 0.4,
name: 'SHIPPERPOSTCODE'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '联系人',
flex: 0.5,
name: 'SHIPPERATTN'
}, {
fieldLabel: '电话',
labelWidth: 50,
flex: 0.5,
name: 'SHIPPERTEL'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '代码',
flex: 0.5,
name: 'SHIPPERCODE'
}, {
fieldLabel: '邮箱',
labelWidth: 50,
flex: 0.5,
name: 'SHIPPEREMAIL'
}]
}
]
});
this.panelConsignee = new Ext.Panel({
title: '收货人信息',
layout: "anchor",
height: 246,
flex: 1,
frame: true,
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{ xtype: 'hiddenfield'}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '名称',
flex: 1,
name: 'CONSIGNEENAME'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '地址1',
flex: 1,
name: 'CONSIGNEEADDR1'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '地址2',
flex: 1,
name: 'CONSIGNEEADDR2'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '地址3',
flex: 1,
name: 'CONSIGNEEADDR3'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '城市',
flex: 1,
name: 'CONSIGNEECITY'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '州/省',
flex: 0.4,
name: 'CONSIGNEEPROVINCE'
}, {
fieldLabel: '国家',
labelWidth: 50,
flex: 0.3,
name: 'CONSIGNEECOUNTRY'
}, {
fieldLabel: '邮编',
labelWidth: 50,
flex: 0.4,
name: 'CONSIGNEEPOSTCODE'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '联系人',
flex: 0.5,
name: 'CONSIGNEEATTN'
}, {
fieldLabel: '电话',
labelWidth: 50,
flex: 0.5,
name: 'CONSIGNEETEL'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '代码',
flex: 0.5,
name: 'CONSIGNEECODE'
}, {
fieldLabel: '邮箱',
labelWidth: 50,
flex: 0.5,
name: 'CONSIGNEEEMAIL'
}]
}
]
});
this.panelNotifyParty = new Ext.Panel({
title: '通知人信息',
layout: "anchor",
height: 246,
flex: 1,
frame: true,
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
defaults: {
anchor: '96%'
},
items: [{ xtype: 'hiddenfield' }, ]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
defaults: {
anchor: '96%'
},
items: [{
xtype: 'checkboxfield',
boxLabel: '同收货人',
name: 'ISSAMECONSIGNEE',
inputValue: true,
boxLabelAlign: 'before',
checked: false
},{
fieldLabel: '名称',
flex: 1,
name: 'NOTIFYPARTYNAME'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
defaults: {
anchor: '96%'
},
items: [{
fieldLabel: '地址1',
flex: 1,
name: 'NOTIFYPARTYADDR1'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
defaults: {
anchor: '96%'
},
items: [{
fieldLabel: '地址2',
flex: 1,
name: 'NOTIFYPARTYADDR2'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
defaults: {
anchor: '96%'
},
items: [{
fieldLabel: '地址3',
flex: 1,
name: 'NOTIFYPARTYADDR3'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
defaults: {
anchor: '96%'
},
items: [{
fieldLabel: '城市',
flex: 1,
name: 'NOTIFYPARTYCITY'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
defaults: {
anchor: '96%'
},
items: [{
fieldLabel: '州/省',
flex: 0.4,
name: 'NOTIFYPARTYPROVINCE'
}, {
fieldLabel: '国家',
flex: 0.3,
labelWidth: 50,
name: 'NOTIFYPARTYCOUNTRY'
}, {
fieldLabel: '邮编',
flex: 0.4,
labelWidth: 50,
name: 'NOTIFYPARTYPOSTCODE'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
defaults: {
anchor: '96%'
},
items: [{
fieldLabel: '联系人',
flex: 0.5,
name: 'NOTIFYPARTYATTN'
}, {
fieldLabel: '电话',
flex: 0.5,
labelWidth: 50,
name: 'NOTIFYPARTYTEL'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '代码',
flex: 0.5,
name: 'NOTIFYPARTYCODE'
}, {
fieldLabel: '邮箱',
labelWidth: 50,
flex: 0.5,
name: 'NOTIFYPARTYEMAIL'
}]
}
]
});
this.panelscn = new Ext.Panel({
layout: "hbox",
height: 248,
items: [this.panelShipper, this.panelConsignee, this.panelNotifyParty]
});
//付费方式
this.storeFrt = Ext.create('DsExt.ux.RefTableStore', {
model: 'CODE_FRT',
proxy: { url: '/CommMng/BasicDataRef/GetCodeFrtList' }
});
this.storeFrt.load({ params: { condition: ""} });
this.comboxBLFRT = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '付费方式',
store: this.storeFrt,
forceSelection: true,
name: 'BLFRT',
valueField: 'FRT',
displayField: 'FRT'
});
//运输条款
this.storeSERVICE = Ext.create('DsExt.ux.RefTableStore', {
model: 'CODE_SERVICE',
proxy: { url: '/CommMng/BasicDataRef/GetCodeServiceList' }
});
this.storeSERVICE.load({ params: { condition: ""} });
this.comboxSERVICE = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '运输条款',
store: this.storeSERVICE,
forceSelection: true,
name: 'SERVICE',
valueField: 'SERVICE',
displayField: 'SERVICE'
});
this.panelPort = new Ext.Panel({
title: '港口信息',
layout: "anchor",
height: 90,
flex: 1,
frame: true,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
labelWidth: 60,
msgTarget: 'qtip'
},
items: [{
xtype: 'container',
defaultType: 'textfield',
layout: 'hbox',
items: [this.comboxSERVICE, {
fieldLabel: '收货港',
flex: 1,
name: 'PLACEDELIVERY'
}, {
fieldLabel: '',
flex: 0.5,
labelWidth: 0,
name: 'PLACEDELIVERYID'
}, {
fieldLabel: '装货港',
flex: 1,
name: 'PORTLOAD'
}, {
fieldLabel: '',
flex: 0.5,
labelWidth: 0,
name: 'PORTLOADID'
}, {
fieldLabel: '卸货港',
flex: 1,
name: 'PORTDISCHARGE'
}, {
fieldLabel: '',
flex: 0.5,
labelWidth: 0,
name: 'PORTDISCHARGEID'
}]
}, {
xtype: 'container',
defaultType: 'textfield',
layout: 'hbox',
items: [this.comboxBLFRT, {
fieldLabel: '目的地',
flex: 1,
name: 'DESTINATION'
}, {
fieldLabel: '',
flex: 0.5,
labelWidth: 0,
name: 'DESTINATIONID'
}, {
fieldLabel: '预抵日期',
format: 'Y-m-d',
xtype: 'datefield',
flex: 1,
name: 'ETA'
}, {
fieldLabel: '签单地点',
flex: 1,
name: 'ISSUEPLACE'
}, {
fieldLabel: '船公司',
flex: 1,
name: 'CARRIER'
}]
}
]
});
this.panelCargo = new Ext.Panel({
title: '货物信息',
layout: "anchor",
height: 150,
flex: 1,
frame: true,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
labelWidth: 60,
msgTarget: 'qtip'
},
items: [{
xtype: 'container',
defaultType: 'textfield',
layout: 'hbox',
items: [{
xtype: 'container',
layout: 'anchor',
flex: 1,
defaultType: 'textfield',
items: [{
xtype: 'label',
html: '<html>Seal No.(封志号)<br> Marks & Nos.(标记与号码) </html>'
}, {
xtype: 'textareafield',
grow: true,
height: 120,
name: 'MARKS',
anchor: '100%'
}
]
}, {
xtype: 'container',
layout: 'anchor',
flex: 3,
defaultType: 'textfield',
items: [{
xtype: 'container',
defaultType: 'textfield',
layout: 'hbox',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'label',
html: '<html>Description of Goods (包装种类与货名)</html>'
},this.comboxCargoid]
}, {
xtype: 'textareafield',
grow: true,
fieldLabel: '&nbsp&nbsp',
labelSeparator: '',
labelWidth: 20,
height: 120,
name: 'DESCRIPTION',
anchor: '100%'
}]
}, {
xtype: 'container',
layout: 'anchor',
flex: 2,
defaultType: 'textfield',
items: [{
xtype: 'container',
defaultType: 'textfield',
layout: 'hbox',
items: [{
xtype: 'label',
html: '<html>&nbsp&nbsp </html>'
}]
}, {
xtype: 'container',
defaultType: 'textfield',
layout: 'hbox',
items: [{
fieldLabel: '总件数',
labelWidth: 70,
readOnly: true,
name: 'PKGS'
}, this.comboxKINDPKGS]
}, {
xtype: 'container',
defaultType: 'textfield',
layout: 'hbox',
defaults: {
anchor: '100%'
},
items: [{
labelWidth: 70,
fieldLabel: '总重量',
name: 'KGS'
}, {
xtype: 'label',
width: 50,
text: 'KGS'
}]
}, {
xtype: 'container',
defaultType: 'textfield',
layout: 'hbox',
items: [{
labelWidth: 70,
fieldLabel: '总尺码',
name: 'CBM'
}, {
xtype: 'label',
width: 50,
text: 'CBM'
}]
}
]
}
]
}
]
});
//#region 编辑formEdit 基本信息
this.formEdit = Ext.widget('form', {
region: 'north',
frame: true,
bodyPadding: 5,
layout: 'anchor',
trackResetOnLoad: true,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
labelWidth: 70,
msgTarget: 'qtip'
},
items: [this.panelscn, this.panelPort, this.panelCargo, this.panelBodyDr, this.panelBodyRf
]
}); //end this.formEdit
//#endregion
//#region 按钮Toolbar
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [{
id: 'btnESave',
text: "保存",
iconCls: "btnsave",
handler: function (button, event) {
this.Save('0');
},
scope: this
}, {
id: 'btnESaveAndClose',
text: "保存并关闭",
handler: function (button, event) {
this.Save('1');
},
scope: this
}, '-', {
text: "关闭",
handler: function (button, event) {
window.close();
},
scope: this
}, '-', {
text: '船代舱单',
tooltip: '船代舱单',
menu: [
{ text: "外代CN2101",
handler: function (menu, event) {
_this.onCreateEDIClick("WD2101");
}
}, { text: "外代CN1101",
handler: function (menu, event) {
_this.onCreateEDIClick("WD1101");
}
}, { text: "中远",
handler: function (menu, event) {
_this.onCreateEDIClick("COSCO");
}
}],
scope: this
}]
}); //end 按钮Toolbar
//#endregion
//#region 生成EDI
this.formEdiShow = 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: [{
xtype: 'radiogroup',
fieldLabel: '文件功能',
id: 'rFILEROLE',
defaults: {
flex: 1
},
layout: 'hbox',
items: [
{
boxLabel: '原始',
name: 'FILEROLE',
inputValue: '9',
checked: true,
id: 'radio3'
}, {
boxLabel: '增加',
name: 'FILEROLE',
inputValue: '2',
id: 'radio4'
}, {
boxLabel: '删除',
name: 'FILEROLE',
inputValue: '3',
id: 'radio5'
}, {
boxLabel: '更新',
name: 'FILEROLE',
inputValue: '4',
id: 'radio6'
}
]
}
]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
});
me = this;
this.winEDIShow = Ext.create('Ext.window.Window', {
title: "生成EDI",
width: 450,
//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.formEdiShow],
buttons: [{
text: "上传EDI",
minWidth: 70,
handler: function () {
var cgFILEROLE = Ext.getCmp('rFILEROLE');
var FILEROLE = cgFILEROLE.getValue();
me.onSendEDI(me.editype, FILEROLE.FILEROLE);
}
}, {
text: "保存EDI文件",
minWidth: 70,
handler: function () {
var cgFILEROLE = Ext.getCmp('rFILEROLE');
var FILEROLE = cgFILEROLE.getValue();
me.onSaveEDI(me.editype, FILEROLE.FILEROLE);
}
}, {
text: "关闭",
minWidth: 70,
handler: function () {
me.winEDIShow.close();
}
}]
});
//#endregion
//#region 框架结构
this.panelpage = new Ext.Panel({
// title: 'EDI信息',
layout: "border",
region: 'center',
animate: true,
autoScroll: true,
// containerScroll: true,
frame: false,
items: [this.formEdit, this.panelCtn]
});
// this.tabSeaepanel = new Ext.TabPanel({
// activeTab: 0,
// autoWidth: true,
// border: true,
// frame: false,
// region: 'center',
// id: "TabSeaePanel",
// enableTabScroll: true,
// items:
// [
// this.panelpage
// ]
// });
this.panelSeae = new Ext.Panel({
id: 'pnlmodSeaeEdiInfo',
layout: "border",
region: 'center',
animate: true,
autoScroll: true,
frame: false,
//closable:true,
items: [this.panelBtn, this.formHead, this.panelpage]
});
Ext.apply(this, {
items: [this.panelSeae]
});
//#endregion
//#region 其他
parentWin = window.parent.opener;
this.InitData();
//#endregion
}, //end initUIComponents
//#region 加载事件
InitData: function () {
this.opStatus = 'add';
var condition = '';
_this = this;
if (parentWin) {
var ret = parentWin.OprationSwap();
this.opStatus = ret[0];
this.StoreList = ret[1];
this.editRecord = ret[2];
this.isAudit = ret[3];
this.BillType = ret[4];
this.OrType = ret[5];
}
this.setBtnStatus(this.BillType);
if (this.opStatus == 'edit') {
condition = "MFNO='" + this.editRecord.get('MFNO') + "'";
//this.storeBodyList.load({ params: { condition: condition} });
}
this.LoadData(this.opStatus, condition);
}, //end InitData
LoadData: function (opstatus, condition) {
this.serialNo = 0;
//this.bodyDel = [];
this.opStatus = opstatus;
Ext.Ajax.request({
waitMsg: '正在查询主表数据...',
url: '/MvcShipping/MsOpSeaeEdi/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.formEdit.getForm().reset();
this.formEdit.getForm().setValues(data);
this.LoadInit();
this.GetEditStatus();
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
if (this.opStatus == 'edit') {
this.storeBodyList.load({ params: { condition: condition} });
} else {
condition = "MFNO='XX'";
this.storeBodyList.load({ params: { condition: condition} });
}
}, // end LoadDate
//#endregion
//#region 保存
Save: function (type) {
var basicForm = this.formEdit.getForm();
var basicForm2 = this.formHead.getForm();
if (!basicForm.isValid()) {
return;
}
if (!basicForm2.isValid()) {
return;
}
//
var bodydatas = [];
for (var i = 0; i < this.storeBodyList.getCount(); i += 1) {
var member = this.storeBodyList.getAt(i);
bodydatas.push(member);
} //
var jsonBody = ConvertRecordsToJsonAll(bodydatas);
var cargodatas = [];
var jsonCargo = ConvertRecordsToJsonAll(cargodatas);
this.formHead.getForm().findField('MFNO').setDisabled(false);
var data = this.formHead.getForm().getValues(false, false, false);
var data2 = this.formEdit.getForm().getValues(false, false, false);
this.formHead.getForm().findField('MFNO').setDisabled(true);
//
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/MvcShipping/MsOpSeaeEdi/Save',
scope: this,
params: {
opstatus: this.opStatus,
data: Ext.JSON.encode(data),
data2: Ext.JSON.encode(data2),
body: jsonBody,
cargobody: jsonCargo
},
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);
this.formHead.getForm().reset();
this.formHead.getForm().setValues(returnData);
//
if (this.opStatus == 'add') {
var arrNewRecords = this.StoreList.add(returnData);
this.editRecord = arrNewRecords[0];
}
else if (this.opStatus == 'edit') {
var editp = Ext.create('MsSeaeEdiModel', 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();
}
if (type == '0') {
this.opStatus = 'edit';
basicForm2.findField('MFNO').setDisabled(true);
for (var j = 0; j < this.storeBodyList.getCount(); j += 1) {
var memberbody = this.storeBodyList.getAt(j);
memberbody.set("MFNO", this.editRecord.get('MFNO'));
memberbody.commit();
};
} else if (type == '1') {
window.close();
} else if (type == '2') {
this.LoadData('add', '');
}
} 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 集装箱按钮事件
onAddDetailClick: function (button, event) {
this.addDetail();
}, //end onAddDetailClick
onDelDetailClick: function (button, event) {
this.deleteDetail();
}, //onDelDetailClick
addDetail: function () {
var ORSTATUS = this.formHead.getForm().findField('EDISTATUS').getValue();
if (ORSTATUS == '已发送') {
Ext.Msg.show({ title: '警告', msg: '业务已发送,不允许操作!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
return;
}
var newSerialno = this.DsGetNewNo(this.storeBodyList);
this.serialNo = newSerialno;
var record = Ext.create('MsSeaeEdiCtn', {
CTN_ID: NewGuid(),
MFNO: '*',
CTNCODE: newSerialno,
CTNALL: '',
CNTRNO: '',
SEALNO: '',
PKGS: 0,
KGS: 0,
CBM: 0,
MARKS: '',
DESCRIPTION: ''
});
this.storeBodyList.add(record);
var n = this.storeBodyList.getCount();
this.gridListCellEditing.startEditByPosition({ row: n - 1, column: 2 });
},
DsGetNewNo: function (store) {
var result = store.getCount();
if (result == 0) {
return 1;
}
var record = store.getAt(result - 1).data.CTNCODE;
result = parseInt(record) + 1;
return result;
},
onNextKeyClick: function (type, col) {
var rows = this.gridDrChFee.getSelectionModel().getSelection();
var row = rows[rows.length - 1];
var s = this.gridDrChFee.getStore();
var number = s.indexOf(row) + 1;
if (number == this.gridDrChFee.getStore().getCount()) {
} else {
this.cellEditingDrChFee.startEditByPosition({ row: number, column: col });
}
},
cellEditingChFeeBeforeEdit: function (editor, e) {
var canedit = true;
var ORSTATUS = this.formHead.getForm().findField('EDISTATUS').getValue();
if (ORSTATUS == '已发送') {
Ext.Msg.show({ title: '警告', msg: '业务已发送,不允许操作!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
canedit = false;
}
return canedit;
},
deleteDetail: function () {
var ORSTATUS = this.formHead.getForm().findField('EDISTATUS').getValue();
if (ORSTATUS == '已发送') {
Ext.Msg.show({ title: '警告', msg: '业务已发送,不允许操作!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
return;
}
//this.serialNo = DsGetCurSerialNo(this.storeBodyList, this.serialNo);
var selectedRecords = this.gridList.selModel.getSelection();
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (rec.data.MFNO == "" || rec.data.MFNO == "*")//如果是新增但没有保存的数据,没有必要提交到后台
{
this.storeBodyList.remove(selectedRecords[i]);
}
else {
Ext.MessageBox.confirm('提示', '确定删除该记录吗?', function (btn) {
if (btn == 'yes') {
Ext.Msg.wait('正在删除数据...');
Ext.Ajax.request({
waitMsg: '正在删除数据...',
url: '/MvcShipping/MsOpSeaeEdi/DeleteDetail',
params: {
data: Ext.JSON.encode(rec.data)
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
this.storeBodyList.remove(rec);
Ext.Msg.show({ title: '提示', msg: jsonresult.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
else {
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
}
},
failure: function (response, options) {
Ext.Msg.show({ title: '警告', msg: '服务器响应出错,请重试', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
},
scope: this
}); //end Ext.Ajax.request
}
}, this);
}
//this.storeBodyList.remove(selectedRecords[i]);
}
},
//#endregion
onFtpUpClick: function () {
var GidStr = '';
this.formHead.getForm().findField('MFNO').setDisabled(false);
var data = this.formHead.getForm().getValues(false, false, false);
var data2 = this.formEdit.getForm().getValues(false, false, false);
this.formHead.getForm().findField('MFNO').setDisabled(true);
var msg = '';
var ORSTATUS = this.formHead.getForm().findField('EDISTATUS').getValue();
if (ORSTATUS == '已发送') {
msg = '此票业务已发送,确实要重新发送吗?';
} else { msg = '确实要发送吗?'; }
var Mblno = this.formHead.getForm().findField('MBLNO').getValue();
_this = this;
Ext.MessageBox.confirm('提示', msg, function (btn) {
if (btn == 'yes') {
Ext.Ajax.request({
waitMsg: 'Changing...',
url: '/MvcShipping/MsOpSeaeEdi/AFRSendData',
params: {
data: Ext.JSON.encode(data),
data2: Ext.JSON.encode(data2),
mblno: Mblno
},
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;
} else {
Ext.Msg.show({
title: '提示',
msg: result.Message,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
}
} else {
Ext.MessageBox.alert('服务器响应出错,请重试', response.responseText);
}
},
scope: this
});
}
}, this);
},
//#region
onCreateEDIClick: function (type) {
this.editype = type;
this.winEDIShow.show();
},
onSendEDI: function (type, filerole) {
this.formHead.getForm().findField('MFNO').setDisabled(false);
var data = this.formHead.getForm().getValues(false, false, false);
var data2 = this.formEdit.getForm().getValues(false, false, false);
this.formHead.getForm().findField('MFNO').setDisabled(true);
var msg = '';
var ORSTATUS = this.formHead.getForm().findField('EDISTATUS').getValue();
if (ORSTATUS == '已发送') {
msg = '此票业务已发送,确实要重新发送吗?';
} else { msg = '确实要发送吗?'; }
var Mblno = this.formHead.getForm().findField('MBLNO').getValue();
_this = this;
Ext.MessageBox.confirm('提示', msg, function (btn) {
if (btn == 'yes') {
Ext.Ajax.request({
waitMsg: '生成中..',
url: '/MvcShipping/MsOpSeaeEdi/CustomEdiSenddata',
params: {
data: Ext.JSON.encode(data),
data2: Ext.JSON.encode(data2),
mblno: Mblno,
type: type,
filerole: filerole
},
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;
} else {
Ext.Msg.show({
title: '提示',
msg: result.Message,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
}
} else {
Ext.MessageBox.alert('The Server Response Error, Please Try Again', response.responseText);
}
},
scope: this
});
}
}, this);
},
onSaveEDI: function (type, filerole) {
this.formHead.getForm().findField('MFNO').setDisabled(false);
var data = this.formHead.getForm().getValues(false, false, false);
var data2 = this.formEdit.getForm().getValues(false, false, false);
this.formHead.getForm().findField('MFNO').setDisabled(true);
var msg = '';
var ORSTATUS = this.formHead.getForm().findField('EDISTATUS').getValue();
if (ORSTATUS == '已发送') {
msg = '此票业务已发送确实要保存未Edi文件吗';
} else { msg = '确实要保存未Edi文件吗'; }
var Mblno = this.formHead.getForm().findField('MBLNO').getValue();
_this = this;
Ext.MessageBox.confirm('提示', msg, function (btn) {
if (btn == 'yes') {
Ext.Ajax.request({
waitMsg: 'Changing...',
url: '/MvcShipping/MsOpSeaeEdi/CustomEdiSaveFiledata',
params: {
data: Ext.JSON.encode(data),
data2: Ext.JSON.encode(data2),
mblno: Mblno,
type: type,
filerole: filerole
},
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;
} else {
window.location.href = result.Data;
}
} else {
Ext.MessageBox.alert('The Server Response Error, Please Try Again', response.responseText);
}
},
scope: this
});
}
}, this);
},
LoadInit: function () {
var CARGOID = this.formEdit.getForm().findField('CARGOID').getValue();
if (CARGOID == 'R') {
this.panelBodyDr.setVisible(false);
this.panelBodyRf.setVisible(true);
} else if (CARGOID == 'D') {
this.panelBodyDr.setVisible(true);
this.panelBodyRf.setVisible(false);
} else {
this.panelBodyDr.setVisible(false);
this.panelBodyRf.setVisible(false);
}
},
//#endregion
getToMonth: function () {
var now = new Date();
var year = now.getFullYear(); //年
var month = now.getMonth() + 1; //月
var clock = year + "-";
if (month < 10)
clock = clock + "0" + month;
else
clock = clock + month;
return (clock);
},
//#region 编辑时按钮等的状态
GetEditStatus: function () {
var canedit = false;
// var BSSTATUS = this.formHead.getForm().findField('ORSTATUS').getValue();
// var inputby = this.formHead.getForm().findField('INPUTBY').getValue();
// _this = this;
// if (BSSTATUS == "0" || BSSTATUS == "1") {
// canedit = false;
// this.setSaveBtnStatus(canedit);
// } else {
// this.setSaveBtnStatus(true);
// }
},
GetStringNum: function (str) {
var num = 0;
if (str == null || str == '') return num;
if (str.length == 0) return num;
var if_find = false;
var str_num = '';
for (var i = 0; i < str.length; i += 1) {
var member = str.substr(i, 1);
if ((member == '0') || (member == '1') || (member == '2') || (member == '3')
|| (member == '4') || (member == '5') || (member == '6') || (member == '7')
|| (member == '8') || (member == '9') || (member == '.') || (member == '-')) {
if (!if_find) {
str_num = str_num + member;
}
} else {
if_find = true;
}
}
return str_num;
},
setBtnStatus: function (enable) {
var btnESave = Ext.getCmp('btnESave');
var btnESaveAndClose = Ext.getCmp('btnESaveAndClose');
if (enable == 2) {
btnESave.setVisible(false); ;
btnESaveAndClose.setVisible(false);
} else {
btnESave.setVisible(true); ;
btnESaveAndClose.setVisible(true);
}
},
setSaveBtnStatus: function (enable) {
var btnESave = Ext.getCmp('btnESave');
var btnESaveAndClose = Ext.getCmp('btnESaveAndClose');
var btnEAddDetail = Ext.getCmp('btnadddetail');
var btnEDeleteDetail = Ext.getCmp('btndeldetail');
if (enable) {
btnESave.enable();
btnESaveAndClose.enable();
btnEAddDetail.enable();
btnEDeleteDetail.enable();
} else {
btnESave.disable();
btnESaveAndClose.disable();
btnEAddDetail.disable();
btnEDeleteDetail.disable();
}
},
//#endregion
//#region 打印
Print: function () {
/*
var basicForm = this.formEdit.getForm();
var billNo = basicForm.findField('BillNo').value;
if (billNo == '*' || billNo == '') {
Ext.Msg.show({ title: '错误', msg: '单据还没有保存,请保存后再打印', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
return;
}
var printType = 'MSWLBULKBS';
var sql1 = "SET LANGUAGE 'us_english' SELECT * FROM tMsWlBulkHead WHERE BillNo = '" + billNo + "'";
var sql2 = "";
var sql3 = "";
var sql4 = "";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
*/
}
//#endregion
});