You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
DS7/DSWeb/Areas/MvcShipping/Viewsjs/MsOpSubSeaOrder/MsOpSubSeaOrderEdit.js

2843 lines
104 KiB
JavaScript

3 years ago
Ext.namespace('Shipping');
Shipping.MsOpSubSeaeOrderEdit = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsOpSubSeaeOrderEdit.superclass.constructor.call(this);
};
Ext.extend(Shipping.MsOpSubSeaeOrderEdit, Ext.Panel, {
ParentWin: null,
OpStatus: 'add',
StoreList: null,
EditRecord: null,
Editdata: null,
isAudit: null,
accdate: null,
seaeop: "",
seaecustservice: "",
reason: "",
BillType: null,
OrType: null,
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',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
var str_num = this.formEdit.getForm().findField('PKGS').getValue();
this.formEdit.getForm().findField('TOTALNO').setValue('SAY:' + ToEn(str_num).toUpperCase() + ' ' + combo.value + ' ONLY.');
}
}
}
});
//件数包装_集装箱列表中的下拉框加载
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.storeAgent = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsOtCompany',
proxy: { url: '/MvcShipping/MsBaseInfo/GetOTCompanyEN' }
});
this.storeAgent.load();
this.comboxAgent = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '卸货代理',
store: this.storeAgent,
forceSelection: true,
name: 'AGENTID',
valueField: 'GID',
displayField: 'ENNAME'
});
//付费方式
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',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
if (combo.value == "FREIGHT PREPAID") {
var portload = this.formEdit.getForm().findField('PORTLOAD').getValue();
this.formEdit.getForm().findField('PREPARDAT').setValue(portload);
this.formEdit.getForm().findField('PAYABLEAT').setValue('');
} else if (combo.value == "FREIGHT COLLECT") {
var PORTDISCHARGE = this.formEdit.getForm().findField('PORTDISCHARGE').getValue();
this.formEdit.getForm().findField('PREPARDAT').setValue('');
this.formEdit.getForm().findField('PAYABLEAT').setValue(PORTDISCHARGE);
}
}
}
}
});
this.StoreCTNSOURCE = Ext.create('Ext.data.Store', {
fields: ['NAME']
});
this.StoreCTNSOURCE.add({ "NAME": "OWNER" });
this.StoreCTNSOURCE.add({ "NAME": "RENT" });
this.StoreCTNSOURCE.add({ "NAME": "FREEUSE" });
this.comboxCTNSOURCE = Ext.create('DsExt.ux.RefTableCombox', {
store: this.StoreCTNSOURCE,
forceSelection: true,
name: 'CTNSOURCE',
valueField: 'NAME',
displayField: 'NAME'
});
this.storeCtnNo = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
fields: [
{ name: 'CTNNO', type: 'string' }
],
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsOpCtnStatus/GetCtnNoData',
reader: {
id: '',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.storeCtnNo.load({ params: { condition: ""} });
//#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: 'BSNO', hidden: true
}, {
fieldLabel: 'ORSTATUS',
name: 'ORSTATUS', hidden: true
}, {
fieldLabel: 'BILLTYPE',
name: 'BILLTYPE', hidden: true, value: 1
}, {
fieldLabel: 'ORTYPE',
name: 'ORTYPE', hidden: true, value: 2
}, {
fieldLabel: 'COMPANYID',
name: 'COMPANYID', hidden: true
}, {
fieldLabel: '主提单号',
name: 'MBLNO'
}, {
fieldLabel: '订舱单号',
readOnly: true,
name: 'ORDNO'
}, {
fieldLabel: '订单状态',
3 years ago
readOnly: true,
name: 'ORSTATUSREF'
}, {
fieldLabel: '录入人',
readOnly: true,
name: 'INPUTBY'
}, this.comboxAgent, {
xtype: 'checkboxfield',
boxLabel: '特别费用',
name: 'SPCHARGE',
inputValue: true,
checked: true
}]
}
]//end items(fieldset 1)
}); //end this.formEdit
//#endregion
//#region 集装箱-数据集
this.storeBodyList = Ext.create('Ext.data.Store', {
model: 'MsSubSeaOrderCtn',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsOpSubSeaOrder/GetBodyList',
reader: {
id: 'BSNO,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: "btnadddetail",
iconCls: "btnadddetail",
handler: function (button, event) {
this.onAddDetailClick(button, event);
},
scope: this
}, '-', {
text: '删除明细',
tooltip: '删除明细',
id: "btndeldetail",
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: 'BSNO',
header: '业务编号',
hidden: true,
width: 0
}, {
sortable: true,
dataIndex: 'CTNCODE',
header: '序号',
width: 30
}, {
dataIndex: 'CTNALL',
header: '箱型',
width: 70,
editor: this.comboxCTNALL
}, {
dataIndex: 'CTNSOURCE',
header: '箱源',
width: 70,
editor: this.comboxCTNSOURCE
}, {
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: 'KGS',
header: '重量',
width: 60,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
}, {
dataIndex: 'CBM',
header: '尺码',
width: 60,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
}, {
dataIndex: 'REMARK',
header: '备注',
width: 150,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
}]
});
//#endregion
this.panelBodyCtn = new Ext.Panel({
title: '集装箱信息',
layout: "border",
height: 280,
//margin: '5 10',
frame: true,
items: [this.gridList]
});
this.panelORREASON = new Ext.Panel({
title: "<a href='#'><font color='#FF0000'>驳回原因</font></a>",
layout: "border",
height: 100,
//margin: '5 10',
frame: true,
items: [{
xtype: 'textareafield',
grow: true,
fieldLabel: '',
labelSeparator: '',
labelWidth: 0,
height: 100,
name: 'ORREASON',
anchor: '100%'
}]
});
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.storeVoyVeg = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.VesselModel',
proxy: { url: '/CommMng/BasicDataRef/GetVesselList' }
});
this.storeVoyVeg.load({ params: { condition: ""} });
this.comboxVoyVeg = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '船 名',
store: this.storeVoyVeg,
name: 'VESSEL',
valueField: 'VESSEL',
flex: 2,
displayField: 'VESSEL',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
var selectrecords = DsStoreQueryBy(this.storeVoyVeg, 'VoyName', combo.value);
if (selectrecords.getCount() > 0) {
var selectdata = selectrecords.getAt(0).data;
this.formEdit.getForm().findField('VESSELID').setValue(selectdata.EDICODE);
} else {
this.formEdit.getForm().findField('VESSELID').setValue('');
}
}
}
}
});
//国际港口(进口装货港、出口卸货港)
this.storeCodeDisport = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CodeDisportModel',
proxy: { url: '/CommMng/BasicDataRef/GetCodeDisportList' }
});
this.storeCodeDisport.load();
this.storeCodeDisport2 = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CodeDisportModel',
proxy: { url: '/CommMng/BasicDataRef/GetCodeDisportList' }
});
this.storeCodeDisport2.load();
this.storeCodeDisport3 = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CodeDisportModel',
proxy: { url: '/CommMng/BasicDataRef/GetCodeDisportList' }
});
this.storeCodeDisport3.load();
this.storeCodeDisport4 = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CodeDisportModel',
proxy: { url: '/CommMng/BasicDataRef/GetCodeDisportList' }
});
this.storeCodeDisport4.load();
//国内港口(出口装货港、进口卸货港)
this.storeCodeLoadport = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CodeLoadportModel',
proxy: { url: '/CommMng/BasicDataRef/GetCodeLoadportList' }
});
this.storeCodeLoadport.load();
this.comboxPORTLOAD = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '装货港',
store: this.storeCodeLoadport,
name: 'PORTLOAD',
valueField: 'PORT',
displayField: 'PORT',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
var selectrecords = DsStoreQueryBy(this.storeCodeLoadport, 'PORT', combo.value);
if (selectrecords.getCount() > 0) {
var selectdata = selectrecords.getAt(0).data;
this.formEdit.getForm().findField('PORTLOADID').setValue(selectdata.EDICODE);
} else {
this.formEdit.getForm().findField('PORTLOADID').setValue('');
}
}
}
}
});
this.comboxPORTDISCHARGE = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '卸货港',
store: this.storeCodeDisport,
name: 'PORTDISCHARGE',
valueField: 'PORT',
queryMode: 'local',
displayField: 'PORT',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
var selectrecords = DsStoreQueryBy(this.storeCodeDisport, 'PORT', combo.value);
if (selectrecords.getCount() > 0) {
var selectdata = selectrecords.getAt(0).data;
this.formEdit.getForm().findField('PORTDISCHARGEID').setValue(selectdata.EDICODE);
var DESTINATION = this.formEdit.getForm().findField('DESTINATIONID').getValue();
if (DESTINATION == null || DESTINATION == '') {
this.formEdit.getForm().findField('DESTINATION').setValue(combo.value);
this.formEdit.getForm().findField('DESTINATIONID').setValue(selectdata.EDICODE);
}
var PLACEDELIVERY = this.formEdit.getForm().findField('PLACEDELIVERY').getValue();
if (PLACEDELIVERY == null || PLACEDELIVERY == '') {
this.formEdit.getForm().findField('PLACEDELIVERY').setValue(combo.value);
this.formEdit.getForm().findField('PLACEDELIVERYID').setValue(selectdata.EDICODE);
}
} else {
this.formEdit.getForm().findField('PORTDISCHARGEID').setValue('');
}
}
}
}
});
this.comboxDESTINATION = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '目的地',
store: this.storeCodeDisport2,
name: 'DESTINATION',
valueField: 'PORT',
displayField: 'PORT',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
var selectrecords = DsStoreQueryBy(this.storeCodeDisport2, 'PORT', combo.value);
if (selectrecords.getCount() > 0) {
var selectdata = selectrecords.getAt(0).data;
this.formEdit.getForm().findField('DESTINATIONID').setValue(selectdata.EDICODE);
} else {
this.formEdit.getForm().findField('DESTINATIONID').setValue('');
}
}
}
}
});
this.comboxPLACEDELIVERY = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '交货地',
store: this.storeCodeDisport3,
name: 'PLACEDELIVERY',
valueField: 'PORT',
displayField: 'PORT',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
var selectrecords = DsStoreQueryBy(this.storeCodeDisport3, 'PORT', combo.value);
if (selectrecords.getCount() > 0) {
var selectdata = selectrecords.getAt(0).data;
this.formEdit.getForm().findField('PLACEDELIVERYID').setValue(selectdata.EDICODE);
} else {
this.formEdit.getForm().findField('PLACEDELIVERYID').setValue('');
}
}
}
}
});
this.comboxPLACERECEIPT = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '收货地点',
store: this.storeCodeDisport4,
name: 'PLACERECEIPT',
valueField: 'PORT',
displayField: 'PORT'
});
//运输条款
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.storeISSUETYPE = Ext.create('DsExt.ux.RefTableStore', {
model: 'CODE_BLTYPE',
proxy: { url: '/CommMng/BasicDataRef/GetCodeBLTYPEList' }
});
this.storeISSUETYPE.load({ params: { condition: ""} });
this.comboxISSUETYPE = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '签单方式',
store: this.storeISSUETYPE,
forceSelection: true,
name: 'ISSUETYPE',
valueField: 'BLTYPE',
displayField: 'BLTYPE'
});
this.StoreBLNUM = Ext.create('Ext.data.Store', {
fields: ['NUM']
});
this.StoreBLNUM.add({ "NUM": "ZERO" });
this.StoreBLNUM.add({ "NUM": "ONE" });
this.StoreBLNUM.add({ "NUM": "TWO" });
this.StoreBLNUM.add({ "NUM": "THREE" });
this.StoreBLNUM.add({ "NUM": "FOUR" });
this.StoreBLNUM.add({ "NUM": "FIVE" });
this.StoreBLNUM.add({ "NUM": "SIX" });
this.StoreBLNUM.add({ "NUM": "SEVEN" });
this.StoreBLNUM.add({ "NUM": "EIGHT" });
this.StoreBLNUM.add({ "NUM": "NINE" });
this.StoreBLNUM.add({ "NUM": "TEN" });
this.comboxBLNUM = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '提单份数',
store: this.StoreBLNUM,
forceSelection: true,
name: 'NOBILL',
valueField: 'NUM',
displayField: 'NUM'
});
//#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',
flex: 1,
labelWidth: 70,
msgTarget: 'qtip'
},
items: [{
xtype: 'fieldset',
defaultType: 'textfield',
layout: 'hbox',
defaults: {
anchor: '96%'
},
items: [{
xtype: 'container',
layout: 'anchor',
flex: 1,
defaultType: 'textfield',
items: [{
xtype: 'label',
html: '<html>Shipper (发货人)</html>'
}, {
xtype: 'textareafield',
grow: true,
labelWidth: 0,
height: 90,
name: 'SHIPPER',
anchor: '100%'
}, {
xtype: 'label',
html: '<html>Consignee (收货人) </html>'
}, {
xtype: 'textareafield',
grow: true,
labelWidth: 0,
height: 90,
name: 'CONSIGNEE',
anchor: '100%'
}, {
xtype: 'label',
html: '<html>Notify Party (通知人)</html>'
}, {
xtype: 'textareafield',
grow: true,
labelWidth: 0,
height: 90,
name: 'NOTIFYPARTY',
anchor: '100%'
}
]
}, {
xtype: 'container',
layout: 'anchor',
flex: 1,
defaultType: 'textfield',
items: [this.panelBodyCtn
]
}
]
}, {
xtype: 'container',
layout: 'anchor',
flex: 1,
defaultType: 'textfield',
defaults: {
anchor: '99%'
},
items: [{
xtype: 'container',
defaultType: 'textfield',
layout: 'hbox',
items: [{
fieldLabel: '开船日期',
format: 'Y-m-d',
flex: 1,
xtype: 'datefield',
name: 'ETD'
}, {
fieldLabel: '预抵日期',
format: 'Y-m-d',
flex: 1,
xtype: 'datefield',
name: 'ETA'
}, this.comboxVoyVeg, {
fieldLabel: '航次',
flex: 1,
name: 'VOYNO'
}]
}, {
xtype: 'container',
defaultType: 'textfield',
layout: 'hbox',
items: [this.comboxPORTLOAD, this.comboxPORTDISCHARGE, this.comboxDESTINATION, this.comboxPLACEDELIVERY, this.comboxPLACERECEIPT]
}, {
xtype: 'container',
defaultType: 'textfield',
layout: 'hbox',
items: [{
fieldLabel: '装港代码',
name: 'PORTLOADID'
}, {
fieldLabel: '卸港代码',
name: 'PORTDISCHARGEID'
}, {
fieldLabel: '目的代码',
name: 'DESTINATIONID'
}, {
fieldLabel: '交货代码',
name: 'PLACEDELIVERYID'
}, {
fieldLabel: '船舶呼号',
name: 'VESSELID'
}]
}, {
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: 250,
name: 'MARKS',
anchor: '100%'
}
]
}, {
xtype: 'container',
layout: 'anchor',
flex: 3,
defaultType: 'textfield',
items: [{
xtype: 'container',
defaultType: 'textfield',
layout: 'hbox',
defaults: {
anchor: '100%'
},
items: [{
labelWidth: 170,
fieldLabel: 'Description of Goods (包装种类与货名)',
name: 'GOODSNAME'
}, this.comboxCargoid]
}, {
xtype: 'textareafield',
grow: true,
fieldLabel: '&nbsp&nbsp',
labelSeparator: '',
labelWidth: 20,
height: 250,
name: 'DESCRIPTION',
anchor: '100%'
}]
}, {
xtype: 'container',
layout: 'anchor',
flex: 1,
defaultType: 'textfield',
items: [{
xtype: 'label',
html: '<html>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbspNo.of containers or pkgs.<br>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp箱数或件数)</html>'
}, {
xtype: 'textareafield',
grow: true,
fieldLabel: '&nbsp&nbsp',
labelWidth: 20,
labelSeparator: '',
height: 40,
name: 'NOPKGS',
anchor: '100%',
listeners: {
scope: this,
change: function (field, newValue, oldValue, eOpts) {
if (newValue == null || newValue == '') return;
if (newValue != oldValue) {
var SS = newValue;
var i = SS.indexOf("\n");
var num = 0;
if (i > 0) {
var slist = SS.split("\n");
for (var i = 0; i < slist.length; i += 1) {
var member = slist[i];
var str_num = this.GetStringNum(member);
if (i == 0) {
var str_kind = member.substring(str_num.length);
}
num = parseFloat(num).add(parseFloat(str_num));
}
this.formEdit.getForm().findField('PKGS').setValue(num);
this.formEdit.getForm().findField('KINDPKGS').setValue(str_kind);
this.formEdit.getForm().findField('TOTALNO').setValue('SAY:' + ToEn(num).toUpperCase() + ' ' + str_kind + ' ONLY.');
} else {
var str_num = this.GetStringNum(SS);
var str_kind = SS.substring(str_num.length);
this.formEdit.getForm().findField('PKGS').setValue(str_num);
this.formEdit.getForm().findField('KINDPKGS').setValue(str_kind);
this.formEdit.getForm().findField('TOTALNO').setValue('SAY:' + ToEn(str_num).toUpperCase() + ' ' + str_kind + ' ONLY.');
}
}
}
}
}, {
xtype: 'container',
defaultType: 'textfield',
layout: 'hbox',
items: [{
fieldLabel: '总件数',
labelWidth: 70,
readOnly: true,
name: 'PKGS'
}, this.comboxKINDPKGS]
}, {
xtype: 'label',
html: '&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp Gross Weight 毛重(公斤)'
}, {
xtype: 'textareafield',
grow: true,
height: 40,
labelWidth: 20,
labelSeparator: '',
fieldLabel: '&nbsp&nbsp',
name: 'GROSSWEIGHT',
anchor: '100%',
listeners: {
scope: this,
change: function (field, newValue, oldValue, eOpts) {
if (newValue == null || newValue == '') return;
if (newValue != oldValue) {
var SS = newValue;
var i = SS.indexOf("\n");
var num = 0;
if (i > 0) {
var slist = SS.split("\n");
for (var i = 0; i < slist.length; i += 1) {
var member = slist[i];
var str_num = this.GetStringNum(member);
num = parseFloat(num).add(parseFloat(str_num));
}
this.formEdit.getForm().findField('KGS').setValue(num);
} else {
var str_num = this.GetStringNum(SS);
this.formEdit.getForm().findField('KGS').setValue(str_num);
}
}
}
}
}, {
xtype: 'container',
defaultType: 'textfield',
layout: 'hbox',
defaults: {
anchor: '100%'
},
items: [{
labelWidth: 70,
fieldLabel: '总重量',
name: 'KGS'
}, {
xtype: 'label',
width: 50,
text: 'KGS'
}]
}, {
xtype: 'label',
html: '&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp Measurement 尺码(立方米)'
}, {
xtype: 'textareafield',
grow: true,
height: 40,
labelWidth: 20,
labelSeparator: '',
fieldLabel: '&nbsp&nbsp',
name: 'MEASUREMENT',
anchor: '100%',
listeners: {
scope: this,
change: function (field, newValue, oldValue, eOpts) {
if (newValue == null || newValue == '') return;
if (newValue != oldValue) {
var SS = newValue;
var i = SS.indexOf("\n");
var num = 0;
if (i > 0) {
var slist = SS.split("\n");
for (var i = 0; i < slist.length; i += 1) {
var member = slist[i];
var str_num = this.GetStringNum(member);
num = parseFloat(num).add(parseFloat(str_num));
}
this.formEdit.getForm().findField('CBM').setValue(num);
} else {
var str_num = this.GetStringNum(SS);
this.formEdit.getForm().findField('CBM').setValue(str_num);
}
}
}
}
}, {
xtype: 'container',
defaultType: 'textfield',
layout: 'hbox',
items: [{
labelWidth: 70,
fieldLabel: '总尺码',
name: 'CBM'
}, {
xtype: 'label',
width: 50,
text: 'CBM'
}]
}
]
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '件数大写',
name: 'TOTALNO'
}]
}, this.panelBodyDr, this.panelBodyRf, {
xtype: 'container',
defaultType: 'textfield',
layout: 'hbox',
items: [this.comboxISSUETYPE, {
fieldLabel: '签单日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'ISSUEDATE'
}, {
fieldLabel: '签单地点',
name: 'ISSUEPLACE'
}, this.comboxBLNUM]
}, {
xtype: 'container',
defaultType: 'textfield',
layout: 'hbox',
items: [this.comboxBLFRT, {
fieldLabel: '预付地点',
name: 'PREPARDAT'
}, {
fieldLabel: '到付地点',
name: 'PAYABLEAT'
}, this.comboxSERVICE]
}, {
xtype: 'textareafield',
grow: true,
fieldLabel: '备 注',
height: 60,
name: 'REMARK',
anchor: '100%'
}]
}
]
}); //end this.formEdit
//#endregion
this.StoreFeeFrt = Ext.create('Ext.data.Store', {
fields: ['Frt']
});
this.StoreFeeFrt.add({ "Frt": "PP" });
this.StoreFeeFrt.add({ "Frt": "CC" });
this.comboxFeeFrt = Ext.create('DsExt.ux.RefTableCombox', {
store: this.StoreFeeFrt,
forceSelection: true,
name: 'FeeFrt',
valueField: 'Frt',
displayField: 'Frt'
});
this.comboxFeeFrt2 = Ext.create('DsExt.ux.RefTableCombox', {
store: this.StoreFeeFrt,
forceSelection: true,
name: 'FeeFrt',
valueField: 'Frt',
displayField: 'Frt'
});
this.storeFeeNameRef = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.FeeTypeRefModel',
proxy: { url: '/MvcShipping/MsChFee/GetFeeTypeRefList' }
});
this.storeFeeNameRef.load({ params: { condition: ""} });
this.comboxFeeNameRef = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeFeeNameRef,
forceSelection: true,
name: 'FeeName',
valueField: 'Name',
displayField: 'CodeAndName'
});
this.storeFeeName2Ref = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.FeeTypeRefModel',
proxy: { url: '/MvcShipping/MsChFee/GetFeeTypeRefList' }
});
this.storeFeeName2Ref.load({ params: { condition: ""} });
this.comboxFeeName2Ref = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeFeeName2Ref,
forceSelection: true,
name: 'FeeName',
valueField: 'Name',
displayField: 'CodeAndName'
});
this.StoreCurr = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsFeeCurr',
proxy: { url: '/MvcShipping/MsChFee/GetFeeCurrList' }
});
this.StoreCurr.load({ params: { condition: ""} });
this.comboxCurr = Ext.create('DsExt.ux.RefTableCombox', {
store: this.StoreCurr,
forceSelection: true,
name: 'Currency',
valueField: 'CURR',
displayField: 'CURR'
});
this.comboxCurr2 = Ext.create('DsExt.ux.RefTableCombox', {
store: this.StoreCurr,
forceSelection: true,
name: 'Currency',
valueField: 'CURR',
displayField: 'CURR'
});
this.storeAgentChFee = Ext.create('Ext.data.Store', {
model: 'MsOrderFee',
remoteSort: false,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsOpSubSeaOrder/GetFeeList',
reader: {
id: 'GId',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.cellEditingDrChFee = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});
_this = this;
this.gridAgentChFee = new Ext.grid.GridPanel({
store: this.storeAgentChFee,
enableHdMenu: false,
region: "north",
// height: 280,
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
plugins: [this.cellEditingDrChFee],
selType: 'cellmodel',
tbar: [{
text: '增加明细',
tooltip: '增加明细',
id: "btnaddafeedetail",
iconCls: "btnadddetail",
handler: function (button, event) {
this.onAddAFeeDetailClick(button, event);
},
scope: this
}, '-', {
text: '删除明细',
tooltip: '删除明细',
id: "btndelafeedetail",
iconCls: "btndeletedetail",
handler: function (button, event) {
this.deleteAFeeDetail(button, event);
},
scope: this
}],
columns: [{
sortable: true,
dataIndex: 'FEEID',
header: '惟一编号',
hidden: true,
width: 160
}, {
sortable: true,
dataIndex: 'AGENTFEE',
header: 'AGENTFEE',
hidden: true,
width: 160
}, {
sortable: true,
dataIndex: 'BSNO',
header: '业务编号',
hidden: true,
width: 200
}, {
sortable: true,
dataIndex: 'FeeName',
header: '费用名称',
editor: this.comboxFeeName2Ref,
width: 100
}, {
sortable: true,
dataIndex: 'UnitPrice',
header: '单价',
editor: {
xtype: 'numberfield',
keyNavEnabled: false,
selectOnFocus: true,
hideTrigger: true,
mouseWheelEnabled: false,
enableKeyEvents: true,
listeners: {
keydown: function (textfield, e) {
if (e.getKey() == 40) {
_this.onNextKeyClick(1, 3)
}
}
}
},
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
try {
var lsValue = usMoney(value, 2, '', false);
if (lsValue != "NaN") {
value = lsValue; if (parseFloat(lsValue) < 0) {
return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
},
align: 'right',
width: 80
}, {
sortable: true,
dataIndex: 'Quantity',
header: '数量',
editor: {
xtype: 'numberfield',
keyNavEnabled: false,
allowDecimals: true,
decimalPrecision: 3,
selectOnFocus: true,
hideTrigger: true,
mouseWheelEnabled: false,
enableKeyEvents: true,
listeners: {
keydown: function (textfield, e) {
if (e.getKey() == 40) {
_this.onNextKeyClick(1, 4)
}
}
}
},
width: 60
}, {
sortable: true,
dataIndex: 'Amount',
header: '金额',
editor: {
xtype: 'numberfield',
keyNavEnabled: false,
selectOnFocus: true,
hideTrigger: true,
mouseWheelEnabled: false,
enableKeyEvents: true,
listeners: {
keydown: function (textfield, e) {
if (e.getKey() == 40) {
_this.onNextKeyClick(1, 5)
}
}
}
},
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
try {
var lsValue = usMoney(value, 2, '', false);
if (lsValue != "NaN") {
value = lsValue; if (parseFloat(lsValue) < 0) {
return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
},
align: 'right',
width: 80
}, {
sortable: true,
dataIndex: 'Currency',
header: '币别',
editor: this.comboxCurr,
width: 40
}, {
sortable: true,
dataIndex: 'ExChangerate',
header: '汇率',
editor: {
xtype: 'numberfield',
keyNavEnabled: false,
selectOnFocus: true,
hideTrigger: true,
mouseWheelEnabled: false,
enableKeyEvents: true,
listeners: {
keydown: function (textfield, e) {
if (e.getKey() == 40) {
_this.onNextKeyClick(1, 7)
}
}
}
},
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>'; } } else { return value; } } catch (e) { return value; } return value; },
align: 'right',
width: 60
}, {
sortable: true,
dataIndex: 'REMARK',
header: '备注',
editor: {
xtype: 'textfield',
selectOnFocus: true,
enableKeyEvents: true,
listeners: {
keydown: function (textfield, e) {
if (e.getKey() == 40) {
_this.onNextKeyClick(1, 8)
}
}
}
},
width: 150
}, {
sortable: true,
dataIndex: 'FeeFrt',
header: 'FRT',
editor: this.comboxFeeFrt,
width: 40
}
]
});
this.gridAgentChFee.on('edit', function (editor, e, eOpts) {
this.gridListChFeeAfterEdit(editor, e, eOpts);
}, this);
this.gridAgentChFee.on('beforeedit', function (editor, e) {
return this.cellEditingChFeeBeforeEdit(editor, e);
}, this);
this.storeCarrierChFee = Ext.create('Ext.data.Store', {
model: 'MsOrderFee',
remoteSort: false,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsOpSubSeaOrder/GetFeeList',
reader: {
id: 'GId',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.cellEditingChFee = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});
this.gridCarrierChFee = new Ext.grid.GridPanel({
store: this.storeCarrierChFee,
enableHdMenu: false,
region: "north",
// height: 280,
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
plugins: [this.cellEditingChFee],
selType: 'cellmodel',
tbar: [{
text: '增加明细',
tooltip: '增加明细',
id: "btnaddfeedetail",
iconCls: "btnadddetail",
handler: function (button, event) {
this.onAddFeeDetailClick(button, event);
},
scope: this
}, '-', {
text: '删除明细',
tooltip: '删除明细',
id: "btndelfeedetail",
iconCls: "btndeletedetail",
handler: function (button, event) {
this.deleteFeeDetail(button, event);
},
scope: this
}],
columns: [{
sortable: true,
dataIndex: 'FEEID',
header: '惟一编号',
hidden: true,
width: 160
}, {
sortable: true,
dataIndex: 'AGENTFEE',
header: 'AGENTFEE',
hidden: true,
width: 160
}, {
sortable: true,
dataIndex: 'BSNO',
header: '业务编号',
hidden: true,
width: 200
}, {
sortable: true,
dataIndex: 'FeeName',
header: '费用名称',
editor: this.comboxFeeNameRef,
width: 100
}, {
sortable: true,
dataIndex: 'UnitPrice',
header: '单价',
editor: {
xtype: 'numberfield',
keyNavEnabled: false,
selectOnFocus: true,
hideTrigger: true,
mouseWheelEnabled: false,
enableKeyEvents: true,
listeners: {
keydown: function (textfield, e) {
if (e.getKey() == 40) {
_this.onNextKeyClick(1, 3)
}
}
}
},
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
try {
var lsValue = usMoney(value, 2, '', false);
if (lsValue != "NaN") {
value = lsValue; if (parseFloat(lsValue) < 0) {
return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
},
align: 'right',
width: 80
}, {
sortable: true,
dataIndex: 'Quantity',
header: '数量',
editor: {
xtype: 'numberfield',
keyNavEnabled: false,
allowDecimals: true,
decimalPrecision: 3,
selectOnFocus: true,
hideTrigger: true,
mouseWheelEnabled: false,
enableKeyEvents: true,
listeners: {
keydown: function (textfield, e) {
if (e.getKey() == 40) {
_this.onNextKeyClick(1, 4)
}
}
}
},
width: 60
}, {
sortable: true,
dataIndex: 'Amount',
header: '金额',
editor: {
xtype: 'numberfield',
keyNavEnabled: false,
selectOnFocus: true,
hideTrigger: true,
mouseWheelEnabled: false,
enableKeyEvents: true,
listeners: {
keydown: function (textfield, e) {
if (e.getKey() == 40) {
_this.onNextKeyClick(1, 5)
}
}
}
},
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
try {
var lsValue = usMoney(value, 2, '', false);
if (lsValue != "NaN") {
value = lsValue; if (parseFloat(lsValue) < 0) {
return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
},
align: 'right',
width: 80
}, {
sortable: true,
dataIndex: 'Currency',
header: '币别',
editor: this.comboxCurr2,
width: 40
}, {
sortable: true,
dataIndex: 'ExChangerate',
header: '汇率',
editor: {
xtype: 'numberfield',
keyNavEnabled: false,
selectOnFocus: true,
hideTrigger: true,
mouseWheelEnabled: false,
enableKeyEvents: true,
listeners: {
keydown: function (textfield, e) {
if (e.getKey() == 40) {
_this.onNextKeyClick(1, 7)
}
}
}
},
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>'; } } else { return value; } } catch (e) { return value; } return value; },
align: 'right',
width: 60
}, {
sortable: true,
dataIndex: 'REMARK',
header: '备注',
editor: {
xtype: 'textfield',
selectOnFocus: true,
enableKeyEvents: true,
listeners: {
keydown: function (textfield, e) {
if (e.getKey() == 40) {
_this.onNextKeyClick(1, 8)
}
}
}
},
width: 150
}, {
sortable: true,
dataIndex: 'FeeFrt',
header: 'FRT',
editor: this.comboxFeeFrt2,
width: 40
}
]
});
this.gridCarrierChFee.on('edit', function (editor, e, eOpts) {
this.gridListChFeeAfterEdit(editor, e, eOpts);
}, this);
this.gridCarrierChFee.on('beforeedit', function (editor, e) {
return this.cellEditingChFeeBeforeEdit(editor, e);
}, this);
//#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
}, {
id: 'btnESaveAndNew',
text: "保存并新建",
handler: function (button, event) {
this.Save('2');
},
scope: this
}, {
id: 'btnECopyNew',
text: "复制新建",
handler: function (button, event) {
var basicForm = this.formHead.getForm();
this.opStatus = 'add';
basicForm.findField('BSNO').setDisabled(false);
var field = basicForm.findField('BSNO');
field.setValue(NewGuid());
basicForm.findField('BSNO').setDisabled(true);
field = basicForm.findField('ORDNO');
field.setValue('');
field = basicForm.findField('INPUTBY');
for (var j = 0; j < this.storeBodyList.getCount(); j += 1) {
var memberbody = this.storeBodyList.getAt(j);
memberbody.set("BSNO", '*');
memberbody.commit();
};
for (var j = 0; j < this.storeAgentChFee.getCount(); j += 1) {
var memberbody = this.storeAgentChFee.getAt(j);
memberbody.set("BSNO", '*');
memberbody.commit();
};
for (var j = 0; j < this.storeCarrierChFee.getCount(); j += 1) {
var memberbody = this.storeCarrierChFee.getAt(j);
memberbody.set("BSNO", '*');
memberbody.commit();
};
this.GetEditStatus();
},
scope: this
}, '-', {
text: "关闭",
handler: function (button, event) {
window.close();
},
scope: this
}, {
id: 'btnENew',
text: "新建",
handler: function (button, event) {
this.LoadData('add', '');
var basicForm = this.formEdit.getForm();
basicForm.findField('BsNo').setDisabled(false);
},
scope: this
}, '-', {
id: 'btnSubmitAudit',
text: '提交',
tooltip: '提交',
handler: function (button, event) {
this.onSubmitAuditClick();
},
scope: this
}, '-', {
id: 'btnSubmitAuditBack',
text: '撤销提交',
tooltip: '撤销提交',
handler: function (button, event) {
this.onSubmitAuditBackClick();
},
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.panelfee = new Ext.Panel({
title: 'DEBIT NOTE',
layout: "border",
region: 'north',
animate: true,
autoScroll: true,
height: 220,
// containerScroll: true,
frame: false,
items: [this.gridAgentChFee]
});
this.panelCarrierfee = new Ext.Panel({
title: '付顺发',
layout: "border",
region: 'center',
animate: true,
autoScroll: true,
// containerScroll: true,
frame: false,
items: [this.gridCarrierChFee]
});
this.panelAllFee = new Ext.Panel({
title: 'DEBIT NOTE和费用',
layout: "border",
region: 'center',
animate: true,
autoScroll: true,
frame: false,
//closable:true,
items: [this.panelfee, this.panelCarrierfee]
});
this.tabSeaepanel = new Ext.TabPanel({
activeTab: 0,
autoWidth: true,
border: true,
frame: false,
region: 'center',
id: "TabSeaePanel",
enableTabScroll: true,
items:
[
this.panelpage,
this.panelAllFee
]
});
this.panelSeae = new Ext.Panel({
id: 'pnlmodSeaeOrderInfo',
layout: "border",
region: 'center',
animate: true,
autoScroll: true,
frame: false,
//closable:true,
items: [this.panelBtn, this.formHead, this.tabSeaepanel]
});
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 = "BSNO='" + this.editRecord.get('BSNO') + "'";
//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/MsOpSubSeaOrder/GetData',
params: {
handle: opstatus,
condition: condition,
billtype: this.BillType,
ortype: this.OrType
},
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} });
this.storeAgentChFee.load({ params: { condition: condition, agentfee: 1} });
this.storeCarrierChFee.load({ params: { condition: condition, agentfee: 0} });
} else {
condition = "BSNO='XX'";
this.storeBodyList.load({ params: { condition: condition} });
this.storeAgentChFee.load({ params: { condition: condition, agentfee: 1} });
this.storeCarrierChFee.load({ params: { condition: condition, agentfee: 0} });
}
}, // 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);
var ctnsource = member.data.CTNSOURCE;
if (ctnsource != 'FREEUSE') {
var CTNNO = member.data.CNTRNO;
var ctnrecords = DsStoreQueryBy(this.storeCtnNo, 'CTNNO', CTNNO);
if (ctnrecords.getCount() > 0) { } else {
Ext.Msg.show({ title: '警告',
msg: "录入的箱号" + CTNNO + ",未在箱管系统中或不可用,请联系箱管先录入此集装箱信息,才能使用该箱号",
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
return;
}
}
bodydatas.push(member);
}
var feedatas = [];
for (var i = 0; i < this.storeAgentChFee.getCount(); i += 1) {
var member = this.storeAgentChFee.getAt(i);
feedatas.push(member);
}
var feedatascarrier = [];
for (var i = 0; i < this.storeCarrierChFee.getCount(); i += 1) {
var member = this.storeCarrierChFee.getAt(i);
feedatascarrier.push(member);
}
//
var jsonBody = ConvertRecordsToJsonAll(bodydatas);
var jsonfee = ConvertRecordsToJsonAll(feedatas);
var jsonfeecarrier = ConvertRecordsToJsonAll(feedatascarrier);
this.formHead.getForm().findField('BSNO').setDisabled(false);
var data = this.formHead.getForm().getValues(false, false, false);
var data2 = this.formEdit.getForm().getValues(false, false, false);
this.formHead.getForm().findField('BSNO').setDisabled(true);
//
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/MvcShipping/MsOpSubSeaOrder/Save',
scope: this,
params: {
opstatus: this.opStatus,
data: Ext.JSON.encode(data),
data2: Ext.JSON.encode(data2),
body: jsonBody,
fee: jsonfee,
feecarrier: jsonfeecarrier,
ortype: this.OrType
},
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('MsSubSeaOrderModel', 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('BSNO').setDisabled(true);
for (var j = 0; j < this.storeBodyList.getCount(); j += 1) {
var memberbody = this.storeBodyList.getAt(j);
memberbody.set("BSNO", this.editRecord.get('BSNO'));
memberbody.commit();
};
for (var j = 0; j < this.storeAgentChFee.getCount(); j += 1) {
var memberbody = this.storeAgentChFee.getAt(j);
memberbody.set("BSNO", this.editRecord.get('BSNO'));
memberbody.commit();
};
for (var j = 0; j < this.storeCarrierChFee.getCount(); j += 1) {
var memberbody = this.storeCarrierChFee.getAt(j);
memberbody.set("BSNO", this.editRecord.get('BSNO'));
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('ORSTATUS').getValue();
if (ORSTATUS == '0') {
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('MsSubSeaOrderCtn', {
CTN_ID: NewGuid(),
BSNO: '*',
CTNCODE: newSerialno,
CTNALL: '',
CNTRNO: '',
SEALNO: '',
PKGS: 0,
KGS: 0,
CBM: 0,
CTNSOURCE: 'OWNER',
REMARK: ''
});
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;
},
onAddAFeeDetailClick: function (button, event) {
var ORSTATUS = this.formHead.getForm().findField('ORSTATUS').getValue();
if (ORSTATUS == '0') {
Ext.Msg.show({ title: '警告', msg: '业务已提交审核,不允许操作!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
return;
}
var newSerialno = this.DsGetFeeNewNo(this.storeAgentChFee);
var record = Ext.create('MsOrderFee', {
FEEID: NewGuid(),
BSNO: '*',
SORT: newSerialno,
FeeName: '',
Currency: '',
Reason: '',
UnitPrice: 0,
Quantity: 0,
Amount: 0,
ExChangerate: 0,
AGENTFEE: 1,
Unit: '',
FeeFrt: ''
});
this.storeAgentChFee.add(record);
var n = this.storeAgentChFee.getCount();
this.cellEditingDrChFee.startEditByPosition({ row: n - 1, column: 3 });
}, //end onAddDetailClick
deleteAFeeDetail: function (button, event) {
var ORSTATUS = this.formHead.getForm().findField('ORSTATUS').getValue();
if (ORSTATUS == '0') {
Ext.Msg.show({ title: '警告', msg: '业务已提交审核,不允许操作!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
return;
}
var selectedRecords = this.gridAgentChFee.selModel.getSelection();
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (rec.data.BSNO == "" || rec.data.BSNO == "*")//如果是新增但没有保存的数据,没有必要提交到后台
{
this.storeAgentChFee.remove(selectedRecords[i]);
}
else {
Ext.MessageBox.confirm('提示', '确定删除该记录吗?', function (btn) {
if (btn == 'yes') {
Ext.Msg.wait('正在删除数据...');
Ext.Ajax.request({
waitMsg: '正在删除数据...',
url: '/MvcShipping/MsOpSubSeaOrder/DeleteFeeDetail',
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.storeAgentChFee.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]);
}
},
onAddFeeDetailClick: function (button, event) {
var ORSTATUS = this.formHead.getForm().findField('ORSTATUS').getValue();
if (ORSTATUS == '0') {
Ext.Msg.show({ title: '警告', msg: '业务已提交审核,不允许操作!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
return;
}
var newSerialno = this.DsGetFeeNewNo(this.storeCarrierChFee);
var record = Ext.create('MsOrderFee', {
FEEID: NewGuid(),
BSNO: '*',
SORT: newSerialno,
FeeName: '',
Currency: '',
Reason: '',
UnitPrice: 0,
Quantity: 0,
Amount: 0,
ExChangerate: 0,
AGENTFEE: 0,
Unit: '',
FeeFrt: ''
});
this.storeCarrierChFee.add(record);
var n = this.storeCarrierChFee.getCount();
this.cellEditingChFee.startEditByPosition({ row: n - 1, column: 3 });
}, //end onAddDetailClick
deleteFeeDetail: function (button, event) {
var ORSTATUS = this.formHead.getForm().findField('ORSTATUS').getValue();
if (ORSTATUS == '0') {
Ext.Msg.show({ title: '警告', msg: '业务已提交审核,不允许操作!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
return;
}
var selectedRecords = this.gridCarrierChFee.selModel.getSelection();
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (rec.data.BSNO == "" || rec.data.BSNO == "*")//如果是新增但没有保存的数据,没有必要提交到后台
{
this.storeCarrierChFee.remove(selectedRecords[i]);
}
else {
Ext.MessageBox.confirm('提示', '确定删除该记录吗?', function (btn) {
if (btn == 'yes') {
Ext.Msg.wait('正在删除数据...');
Ext.Ajax.request({
waitMsg: '正在删除数据...',
url: '/MvcShipping/MsOpSubSeaOrder/DeleteFeeDetail',
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.storeCarrierChFee.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]);
}
},
DsGetFeeNewNo: function (store) {
var result = store.getCount();
if (result == 0) {
return 1;
}
var record = store.getAt(result - 1).data.SORT;
result = parseInt(record) + 1;
return result;
},
gridListChFeeAfterEdit: function (editor, e, eOpts) {
if (e.value == e.originalValue) return;
if (e.field == 'UnitPrice' || e.field == 'Quantity') {
var unitPrice = e.record.data['UnitPrice'];
var quantity = e.record.data['Quantity'];
var amount = (parseFloat(unitPrice).mul(quantity)).toFixed(2);
e.record.set('Amount', amount);
} else if (e.field == 'Currency') {
if (e.value == 'RMB') {
e.record.set('ExChangerate', 1);
} else {
e.record.set('ExChangerate', 0);
}
}
},
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('ORSTATUS').getValue();
if (ORSTATUS == '0') {
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('ORSTATUS').getValue();
if (ORSTATUS == '0') {
Ext.Msg.show({ title: '警告', msg: '业务已提交审核,不允许操作!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
return;
}
var selectedRecords = this.gridList.selModel.getSelection();
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (rec.data.BSNO == "" || rec.data.BSNO == "*")//如果是新增但没有保存的数据,没有必要提交到后台
{
this.storeBodyList.remove(selectedRecords[i]);
}
else {
Ext.MessageBox.confirm('提示', '确定删除该记录吗?', function (btn) {
if (btn == 'yes') {
Ext.Msg.wait('正在删除数据...');
Ext.Ajax.request({
waitMsg: '正在删除数据...',
url: '/MvcShipping/MsOpSubSeaOrder/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
//#region
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
onSubmitAuditClick: function () {
var Duino = this.formHead.getForm().findField('BSNO').getValue();
var billstatus = this.formHead.getForm().findField('ORSTATUS').getValue();
if (Duino == '*') {
Ext.Msg.show({ title: '提示', msg: '请先保存此订舱单,然后才能提交!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
if ((billstatus != "9") && (billstatus != "2")) {
Ext.Msg.show({ title: '提示', msg: '当前状态无法提交!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var bodydatas = [];
for (var i = 0; i < this.storeBodyList.getCount(); i += 1) {
var member = this.storeBodyList.getAt(i);
bodydatas.push(member);
}
var feedatas = [];
for (var i = 0; i < this.storeAgentChFee.getCount(); i += 1) {
var member = this.storeAgentChFee.getAt(i);
feedatas.push(member);
}
var feedatascarrier = [];
for (var i = 0; i < this.storeCarrierChFee.getCount(); i += 1) {
var member = this.storeCarrierChFee.getAt(i);
feedatascarrier.push(member);
}
//
var jsonBody = ConvertRecordsToJsonAll(bodydatas);
var jsonfee = ConvertRecordsToJsonAll(feedatas);
var jsonfeecarrier = ConvertRecordsToJsonAll(feedatascarrier);
//var jsonDelBody = ConvertRecordsToJsonAll(this.bodyDel);
this.formHead.getForm().findField('BSNO').setDisabled(false);
var data = this.formHead.getForm().getValues(false, false, false);
var data2 = this.formEdit.getForm().getValues(false, false, false);
this.formHead.getForm().findField('BSNO').setDisabled(true);
_this = this;
Ext.Ajax.request({
waitMsg: '正在添加数据...',
url: '/MvcShipping/MsOpSubSeaOrder/SubmitAuditForm',
params: {
data: Ext.JSON.encode(data),
data2: Ext.JSON.encode(data2),
body: jsonBody,
fee: jsonfee,
feecarrier: jsonfeecarrier
},
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.Ajax.request({
waitMsg: '正在查询主表数据...',
url: '/MvcShipping/MsOpSubSeaOrder/GetData',
params: {
handle: 'edit',
condition: " BSNO='" + Duino + "'",
billtype: _this.BillType,
ortype: _this.OrType
},
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;
}
var data = result.data;
_this.formHead.getForm().reset();
_this.formHead.getForm().setValues(data);
_this.formEdit.getForm().reset();
_this.formEdit.getForm().setValues(data);
var editp = Ext.create('MsSubSeaOrderModel', data);
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();
_this.GetEditStatus();
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
},
onSubmitAuditBackClick: function () {
var Duino = this.formHead.getForm().findField('BSNO').getValue();
var billstatus = this.formHead.getForm().findField('ORSTATUS').getValue();
if (Duino == '*') {
Ext.Msg.show({ title: '提示', msg: '请先保存,然后才能提交!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
if (billstatus != "1") {
Ext.Msg.show({ title: '提示', msg: '当前状态无法撤销提交!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var bodydatas = [];
for (var i = 0; i < this.storeBodyList.getCount(); i += 1) {
var member = this.storeBodyList.getAt(i);
bodydatas.push(member);
}
var feedatas = [];
for (var i = 0; i < this.storeAgentChFee.getCount(); i += 1) {
var member = this.storeAgentChFee.getAt(i);
feedatas.push(member);
}
var jsonBody = ConvertRecordsToJsonAll(bodydatas);
var jsonfee = ConvertRecordsToJsonAll(feedatas);
this.formHead.getForm().findField('BSNO').setDisabled(false);
var data = this.formHead.getForm().getValues(false, false, false);
var data2 = this.formEdit.getForm().getValues(false, false, false);
this.formHead.getForm().findField('BSNO').setDisabled(true);
_this = this;
Ext.Ajax.request({
waitMsg: '正在添加数据...',
url: '/MvcShipping/MsOpSubSeaOrder/SubmitAuditBackForm',
params: {
data: Ext.JSON.encode(data),
data2: Ext.JSON.encode(data2),
body: jsonBody,
fee: jsonfee
},
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.Ajax.request({
waitMsg: '正在查询主表数据...',
url: '/MvcShipping/MsOpSubSeaOrder/GetData',
params: {
handle: 'edit',
condition: " BSNO='" + Duino + "'",
billtype: _this.BillType,
ortype: _this.OrType
},
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;
}
var data = result.data;
_this.formHead.getForm().reset();
_this.formHead.getForm().setValues(data);
_this.formEdit.getForm().reset();
_this.formEdit.getForm().setValues(data);
var editp = Ext.create('MsSubSeaOrderModel', data);
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();
_this.GetEditStatus();
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
},
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();
var OPCOMPANYID = this.formHead.getForm().findField('COMPANYID').getValue();
_this = this;
if (OPCOMPANYID == "Comcab2d43f60454327af30a131fc1d3abd" && COMPANYID == "Comcab2d43f60454327af30a131fc1d3abd") {
this.setSaveBtnStatus(true);
} else {
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');
var btnESaveAndNew = Ext.getCmp('btnESaveAndNew');
var btnEAddDetail = Ext.getCmp('btnadddetail');
var btnEDeleteDetail = Ext.getCmp('btndeldetail');
var btnENew = Ext.getCmp('btnENew');
var btnECopyNew = Ext.getCmp('btnECopyNew');
var btnSubmitAudit = Ext.getCmp('btnSubmitAudit');
var btnSubmitAuditBack = Ext.getCmp('btnSubmitAuditBack');
var btnEPrint = Ext.getCmp('btnEPrint');
if (enable == 2) {
btnESave.setVisible(false); ;
btnESaveAndClose.setVisible(false);
btnESaveAndNew.setVisible(false);
btnEAddDetail.setVisible(false);
btnEDeleteDetail.setVisible(false);
btnENew.setVisible(false); ;
btnECopyNew.setVisible(false);
btnSubmitAudit.setVisible(false);
btnSubmitAuditBack.setVisible(false);
} else {
btnESave.setVisible(true); ;
btnESaveAndClose.setVisible(true);
btnESaveAndNew.setVisible(true);
btnEAddDetail.setVisible(true);
btnEDeleteDetail.setVisible(true);
btnENew.setVisible(true); ;
btnECopyNew.setVisible(true);
btnSubmitAudit.setVisible(true);
btnSubmitAuditBack.setVisible(true);
}
},
setSaveBtnStatus: function (enable) {
var btnESave = Ext.getCmp('btnESave');
var btnESaveAndClose = Ext.getCmp('btnESaveAndClose');
var btnESaveAndNew = Ext.getCmp('btnESaveAndNew');
var btnEAddDetail = Ext.getCmp('btnadddetail');
var btnEDeleteDetail = Ext.getCmp('btndeldetail');
if (enable) {
btnESave.enable();
btnESaveAndClose.enable();
btnESaveAndNew.enable();
btnEAddDetail.enable();
btnEDeleteDetail.enable();
} else {
btnESave.disable();
btnESaveAndClose.disable();
btnESaveAndNew.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
});