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/BookingConfirm/BookingConfirmEdit.js

2938 lines
105 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.BookingConfirmEdit = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.BookingConfirmEdit.superclass.constructor.call(this);
};
Ext.extend(Shipping.BookingConfirmEdit, Ext.Panel, {
ParentWin: null,
OpStatus: 'add',
StoreList: null,
editRecord: null,
Editdata: null,
isAudit: null,
accdate: null,
email: null,
seaeop: "",
seaecustservice: "",
seaesale: "",
reason: "",
initUIComponents: function () {
this.serialNo = 0;
//this.bodyDel = [];
this.itemindex = 1;
//#region 信息加载
//权限范围
this.StoreOpRange = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsOP',
proxy: {
url: '/MvcShipping/MsBaseInfo/GetOpRang'
}
});
this.StoreOpRange.load({
params: {
optype: "modSeaeOrderList"
}
});
//人员信息加载
this.storeOpCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.UserRefModel',
proxy: {
url: '/CommMng/BasicDataRef/GetUserRefList'
}
});
this.storeOpCode.load();
//客服
this.comboxCUSTSERVICE = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '客服',
store: this.storeOpCode,
forceSelection: true,
name: 'CUSTSERVICE',
valueField: 'UserName',
displayField: 'CodeAndName',
value: SHOWNAME
});
//揽货人
this.comboxSALE = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '揽货人',
store: this.storeOpCode,
forceSelection: true,
name: 'SALE',
valueField: 'UserName',
displayField: 'CodeAndName',
value: SHOWNAME
});
//操 作
this.comboxOP = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '操 作',
store: this.storeOpCode,
forceSelection: true,
name: 'OP',
valueField: 'UserName',
displayField: 'CodeAndName',
value: SHOWNAME
});
//单证
this.comboxDOC = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '单 证',
store: this.storeOpCode,
forceSelection: true,
name: 'DOC',
valueField: 'UserName',
displayField: 'CodeAndName',
value: SHOWNAME
});
this.storeInfoClientContact = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.InfoClientContactModel',
proxy: {
url: '/CommMng/BasicDataRef/GetInfoClientContactList'
}
});
//客户加载_委托单位
this.storeCustCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: {
url: '/CommMng/BasicDataRef/GetCustomRefList'
}
});
this.storeCustCode.load({
params: {
condition: "ISCONTROLLER='1'"
}
});
//委托单位
this.comboxCustCode = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '委托单位',
store: this.storeCustCode,
forceSelection: true,
readOnly:true,
name: 'CUSTOMERNAME', //readOnly:true,
valueField: 'CustName',
displayField: 'CodeAndName',
allowBlank: false,
listeners: {
scope: this
,beforequery: function (e) {
return FilterCombox(e);//在beforequery使用此方法
}
}
});
//客户加载_船公司
this.storeCARRIER = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: {
url: '/CommMng/BasicDataRef/GetCustomRefList'
}
});
this.storeCARRIER.load({
params: {
condition: "ISCARRIER='1'"
}
});
//船公司
this.comboxCARRIER = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '船公司',
store: this.storeCARRIER,
forceSelection: true,
name: 'CARRIER',
valueField: 'CustName',
displayField: 'CodeAndName',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
var s = " ISOPERATOR=1 and LINKID in (select gid from [info_client] where SHORTNAME='" + combo.value + "')";
this.storeInfoClientContact.load({
params: {
condition: s
},
callback: function (r, options, success) {
if (success) {
if (this.storeInfoClientContact.getCount() > 0) {
var member = this.storeInfoClientContact.getAt(0);
this.formHead.getForm().findField('CARRIERATTN').setValue(member.data.SHOWNAME);
this.formHead.getForm().findField('CARRIERTEL').setValue(member.data.TEL);
this.formHead.getForm().findField('CARRIEREMAIL').setValue(member.data.EMAIL);
} else {
this.formHead.getForm().findField('CARRIERATTN').setValue('');
this.formHead.getForm().findField('CARRIERTEL').setValue('');
this.formHead.getForm().findField('CARRIEREMAIL').setValue('');
}
}
},
scope: this
});
}
}
}
});
//客户加载_订舱代理
this.storeFORWARDER = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: {
url: '/CommMng/BasicDataRef/GetCustomRefList'
}
});
this.storeFORWARDER.load({
params: {
condition: "ISBOOKING='1'"
}
});
//船公司
this.comboxFORWARDER = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '订舱代理',
store: this.storeFORWARDER,
forceSelection: true,
name: 'FORWARDER',
valueField: 'CustName',
displayField: 'CodeAndName',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
var s = " ISOPERATOR=1 and LINKID in (select gid from [info_client] where SHORTNAME='" + combo.value + "')";
this.storeInfoClientContact.load({
params: {
condition: s
},
callback: function (r, options, success) {
if (success) {
if (this.storeInfoClientContact.getCount() > 0) {
var member = this.storeInfoClientContact.getAt(0);
this.formHead.getForm().findField('FORWARDERATTN').setValue(member.data.SHOWNAME);
this.formHead.getForm().findField('FORWARDERTEL').setValue(member.data.TEL);
this.formHead.getForm().findField('FORWARDEREMAIL').setValue(member.data.EMAIL);
} else {
this.formHead.getForm().findField('FORWARDERATTN').setValue('');
this.formHead.getForm().findField('FORWARDERTEL').setValue('');
this.formHead.getForm().findField('FORWARDEREMAIL').setValue('');
}
}
},
scope: this
});
}
}
}
});
/*
this.storePKGTYPE = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsExtEnumModel',
proxy: {
url: '/CommMng/PubSys/GetEnumValueList'
}
});
this.storePKGTYPE.load({
params: {
enumTypeId: 97011
}
});
this.comboxPKGTYPE = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '装箱类型',
store: this.storePKGTYPE,
forceSelection: true,
name: 'PACKINGTYPE',
valueField: 'KINDPKGS',
//EnumValueName
displayField: 'KINDPKGS' //EnumValueName
});
*/
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,
flex:1,
fieldLabel: "<a><font color='#FF0000'>货物标示</font></a>",
forceSelection: true,
readOnly: true,
name: 'CARGOID',
valueField: 'ID',
displayField: 'NAME'
});
//品名
this.StoreStlName = Ext.create('Ext.data.Store', {
fields: ['STLNAME']
});
this.StoreStlName.add({
"STLNAME": "票结"
});
this.StoreStlName.add({
"STLNAME": "半月结"
});
this.StoreStlName.add({
"STLNAME": "月结"
});
this.StoreStlName.add({
"STLNAME": "周结"
});
this.comboxStlName = Ext.create('DsExt.ux.RefTableCombox', {
store: this.StoreStlName,
fieldLabel: '结算方式',
forceSelection: true,
name: 'STLNAME',
valueField: 'STLNAME',
displayField: 'STLNAME'
});
//件数包装_集装箱列表中的下拉框加载
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',
//CTNEXHIBIT
valueField: 'CTN',
displayField: 'CTN'
});
this.myCheckboxService = new Ext.form.CheckboxGroup({
id: 'myService',
xtype: 'checkboxgroup',
fieldLabel: '服务项目',
columns: 8,
flex:4,hidden:true,
items: [{
boxLabel: '熏蒸',
inputValue: true,
name: 'ISFUMIGATION',
id: 'ISFUMIGATION'
},
{
boxLabel: '仓储',
inputValue: true,
name: 'ISSTORAGE',
id: 'ISSTORAGE'
},
{
boxLabel: '陆运',
inputValue: true,
name: 'ISLAND',
id: 'ISLAND'
},
{
boxLabel: '报关',
inputValue: true,
name: 'ISCUSTOMS',
id: 'ISCUSTOMS'
},
{
boxLabel: '报检',
inputValue: true,
name: 'ISINSPECTION',
id: 'ISINSPECTION'
},
{
boxLabel: '订舱',
inputValue: true,
name: 'ISBOOKING',
id: 'ISBOOKING'
},
{
boxLabel: '使用代理',
inputValue: true,
name: 'ISAGENT',
id: 'ISAGENT'
},
{
boxLabel: '分单签单',
inputValue: true,
name: 'ISHBLNO',
id: 'ISHBLNO'
}
]
});
//付费方式
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'
});
//#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: '业务状态',
hidden: true,
name: 'BSSTATUS'
},
{
fieldLabel: '订舱编号',
readOnly: true, hidden: true,
name: 'ORDNO'
},
{
fieldLabel: '订舱编号',
readOnly: true,
name: 'ORDERNO'
},
{
fieldLabel: '订舱状态',
readOnly: true,
name: 'BSSTATUSREF'
},
{
fieldLabel: '订舱日期',
readOnly: true,
name: 'BSDATE'
}, {
fieldLabel: '主提单号',
name: 'MBLNO'
},
{
fieldLabel: '运费协议号',
//labelWidth: 50,
name: 'CONTRACTNO'
}
, {
fieldLabel: '装运方式',hidden:true,
readOnly: true,
name: 'BLTYPE'
}
]
},
{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [//已经隐藏
this.myCheckboxService
]
},
{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
]
},
{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '委托单位',
readOnly: true,
name: 'CUSTOMERNAME'
},{
fieldLabel: '订舱人',
name: 'OPERATOR'
},
{
fieldLabel: '电话',
name: 'OPERATORTEL'
},
{
fieldLabel: '邮箱',
name: 'OPERATOREMAIL'
}, this.comboxCargoid
]
}
,
{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
{
name: 'SALE_NAME',flex:1,
fieldLabel: '指定销售'
}, { xtype: 'hiddenfield', flex: 1 }
, { xtype: 'hiddenfield', flex: 1 }
, { xtype: 'hiddenfield', flex: 1 }
, { xtype: 'hiddenfield', flex: 1 }
]
}
,
{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
{
xtype: 'textareafield',
name: 'EDIREMARK',
fieldLabel: '订舱备注',
heigh: 150
}
]
}
] //end items(fieldset 1)
}); //end this.formEdit
//#endregion
//#region 集装箱-数据集
this.storeBodyList = Ext.create('Ext.data.Store', {
model: 'Booking_Ctn',
remoteSort: false,
proxy: {
type: 'ajax',
url: '/MvcShipping/BookingConfirm/GetBookingCtnList',
reader: {
id: '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',
columns: [{
sortable: true,
dataIndex: 'CTN_ID',
header: '编号',
hidden: true,
width: 0
},
{
sortable: true,
dataIndex: 'BSNO',
header: '业务编号',
hidden: true,
width: 0
},
{
dataIndex: 'CTNALL',
//CTNEXHIBIT
header: '箱型',
width: 70,
editor: this.comboxCTNALL
},
{
dataIndex: 'CTNNUM',
header: '箱量',
width: 50,
editor: {
xtype: 'numberfield',
allowBlank: false,
selectOnFocus: true
}
}]
});
//#endregion
this.panelBodyCtn = new Ext.Panel({
title: '集装箱信息',
//layout: "anchor",
height: 150,
flex:1.75,
//width:200,
//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,
hidden: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'
}]
}]
});
//#region 冷冻柜信息
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]
}]
});
//#endregion
//#region 下拉菜单数据
Ext.define('VesselModel', {
extend: 'Ext.data.Model',
fields: [{
name: 'VSID',
type: 'string'
},
{
name: 'VESSEL',
type: 'string'
},
{
name: 'CNAME',
type: 'string'
},
{
name: 'CodeAndName',
type: 'string'
},
{
name: 'CARRIER',
type: 'string'
},
{
name: 'EDICODE',
type: 'string'
}]
});
// this.storeVoyVeg = Ext.create('DsExt.ux.RefTableStore', {
// model: 'VesselModel',
// proxy: { url: '/CommMng/BasicDataRef/GetVesselList' }
// });
// this.storeVoyVeg.load({ params: { condition: ""} });
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: 1,
displayField: 'VESSEL'
});
//国际港口(进口装货港、出口卸货港)
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: 'CodeAndName'
});
this.comboxPORTDISCHARGE = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '卸货港',
store: this.storeCodeDisport,
name: 'PORTDISCHARGE',
valueField: 'PORT',
queryMode: 'local',
displayField: 'PORT'
});
this.comboxDESTINATION = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '目的地',
store: this.storeCodeDisport2,
name: 'DESTINATION',
//
valueField: 'PORT',
displayField: 'PORT'
});
this.comboxPLACEDELIVERY = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '交货地',
store: this.storeCodeDisport3,
name: 'PLACEDELIVERY',
valueField: 'PORT',
displayField: 'PORT'
});
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' //
});
//#endregion
//#region 编辑formEdit 基本信息
this.formEdit = Ext.widget('form', {
region: 'north',
frame: true,
bodyPadding: 7.05,
layout: 'anchor',
trackResetOnLoad: true,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 70,
readOnly: true,
msgTarget: 'qtip'
},
items: [{
xtype: 'container',//fieldset
defaultType: 'textfield',
layout: 'hbox',
defaults: {
anchor: '96%'
},
items: [
//第一栏
{
xtype: 'container',
layout: 'anchor',
flex: 3,
defaultType: 'textfield',
items: [{
xtype: 'label',
text:'Shipper(发货人)'
}, {
xtype: 'textareafield',
grow: true,
labelWidth: 0,
height: 80,
name: 'SHIPPER',
anchor: '100%'
}
//,
//this.comboxConsignee
,{
xtype: 'label',
text: 'Consignee(收货人)'
}, {
xtype: 'textareafield',
grow: true,
labelWidth: 0,
height: 80,
name: 'CONSIGNEE',
anchor: '100%'
}
//,
//this.comboxNotifyParty
, {
xtype: 'label',
text: 'Notify Party(通知人)'
}, {
xtype: 'textareafield',
grow: true,
labelWidth: 0,
height: 80,
name: 'NOTIFYPARTY',
anchor: '100%'
}
]
},
//第二栏
{xtype:'hiddenfield',flex:0.05},
//第三栏
{
xtype: 'container',
layout: 'anchor',
flex: 4,
defaultType: 'textfield',
items: [
{
xtype: 'container',
defaultType: 'textfield',
layout: 'hbox',
items: [
{
fieldLabel: 'ETD',
format: 'Y-m-d',
readOnly:true,
xtype: 'datefield',
name: 'ETD'
}, this.comboxCARRIER
]
},
{
xtype: 'container',
defaultType: 'textfield',
layout: 'hbox',
items: [
this.comboxVoyVeg, {
fieldLabel: '航次',
flex: 1,
name: 'VOYNO'
}
]
},
{
xtype: 'container',
defaultType: 'textfield',
layout: 'hbox',
items: [
{
fieldLabel: Zi.LAN.PORTLOAD,
name: 'PORTLOADID'
},
{
fieldLabel: '',
name: 'PORTLOAD'
},
{
fieldLabel: Zi.LAN.PLACERECEIPTID,
name: 'PLACERECEIPTID'
}, {
fieldLabel: '',
name: 'PLACERECEIPT'
}
]
},
{
xtype: 'container',
defaultType: 'textfield',
layout: 'hbox',
items: [
{
fieldLabel: Zi.LAN.PORTDISCHARGE,
name: 'PORTDISCHARGEID'
}, {
fieldLabel: '',
name: 'PORTDISCHARGE'
},
{
fieldLabel: Zi.LAN.PLACEDELIVERY,
name: 'PLACEDELIVERYID'
},
{
fieldLabel: '',
name: 'PLACEDELIVERY'
}
]
},
{
xtype: 'container',
defaultType: 'textfield',
layout: 'hbox',
items: [
{
fieldLabel: Zi.LAN.DESTINATION,
name: 'DESTINATIONID'
}, {
fieldLabel: '',
name: 'DESTINATION'
}, {
fieldLabel: '运输方式',
name: 'TRANSTYPE'
},
{
xtype:'hiddenfield',flex:1
}
]
},
{
xtype: 'container',
layout: 'hbox',
items: [
{xtype:'hiddenfield',flex:0.25},
this.panelBodyCtn
,
{
xtype: 'container',
layout: 'anchor',
flex: 2,
defaultType: 'textfield',
items: [
{
fieldLabel: '总件数',
labelWidth: 70,
name: 'PKGS'
},
{
fieldLabel: '包装',
labelWidth: 70,
name: 'KINDPKGS'
}, {
labelWidth: 70,
fieldLabel: '总重量',
name: 'KGS'
},
{
//labelWidth: 70,
fieldLabel: '总尺码',
name: 'CBM'
}
]
}
]
}
,
{
xtype: 'container',
defaultType: 'textfield',
layout: 'hbox',
items: [ {
fieldLabel: '分提单号', hidden: true,
name: 'HBLNO', readOnly: true
},
{
fieldLabel: '审核人',
readOnly: true,hidden:true,
name: 'AUDITOPERATOR'
},
{
fieldLabel: '审核日期',
readOnly: true, hidden: true,
name: 'AUDITDATE'
}]
},
{
xtype: 'textareafield',
grow: true,hidden:true,
fieldLabel: '备 注',
height: 60,
name: 'REMARK',
anchor: '100%'
},
this.panelORREASON
]
}
]
},
{
xtype: 'container',
layout: 'anchor',
flex: 1,
defaultType: 'textfield',
defaults: {
anchor: '99%'
},
items: [{
xtype: 'container',
defaultType: 'textfield',
layout: 'hbox',
items: [
]
},
{
xtype: 'container',
defaultType: 'textfield',
layout: 'hbox',
items: [
]
},
{
xtype: 'container',
defaultType: 'textfield',
layout: 'hbox',
items: [{
xtype: 'container',
layout: 'anchor',
flex: 1.5,
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: 2.5,
defaultType: 'textfield',
items: [{
xtype: 'container',
defaultType: 'textfield',
layout: 'hbox',
defaults: {
anchor: '100%'
},
items: [
//this.comboxGOODSNAME
{
xtype: 'label',
html: '<html><br> Description of Goods(包装种类与货名)</html>'
//text:'Description of Goods(包装种类与货名)'
}
]
},
{
xtype: 'textareafield',
grow: true,
fieldLabel: '&nbsp&nbsp',
labelSeparator: '',
labelWidth: 20,
height: 250,
name: 'DESCRIPTION',
anchor: '100%'
}]
},
{
xtype: 'container',
layout: 'anchor',
flex: 2,
defaultType: 'textfield',
items: [
{xtype:'hiddenfield',height:30},
{
xtype: 'container',
layout: 'hbox',
flex: 2,
defaultType: 'textfield',
items: [
this.comboxISSUETYPE,
this.comboxSERVICE
]
},
{
xtype: 'container',
layout: 'hbox',
flex: 2,
defaultType: 'textfield',
items: [
this.comboxBLFRT
]
},
{
xtype: 'container',
layout: 'hbox',
flex: 2,
defaultType: 'textfield',
items: [
{
fieldLabel: '预付地点',
name: 'PREPARDAT'
},
{
fieldLabel: '到付地点',
name: 'PAYABLEAT'
}
]
},
{
xtype: 'container',
layout: 'hbox',
flex: 2,
defaultType: 'textfield',
items: [
this.comboxBLNUM,
{
fieldLabel: '副本份数',
name: 'COPYNOBILL'
}
]
}
,
{
xtype: 'label',hidden:true,
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', hidden: true,
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: 'label', hidden: true,
html: '&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp Gross Weight 毛重(公斤)'
},
{
xtype: 'textareafield', hidden: true,
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: 'label', hidden: true,
html: '&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp Measurement 尺码(立方米)'
},
{
xtype: 'textareafield', hidden: true,
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',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '件数大写',hidden:true,
name: 'TOTALNO'
}]
},
this.panelBodyDr, this.panelBodyRf,
{
xtype: 'container',hidden:true,
defaultType: 'textfield',
layout: 'hbox',
items: [
{
fieldLabel: '签单日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'ISSUEDATE'
},
{
fieldLabel: '签单地点',
name: 'ISSUEPLACE'
}]
},
{
xtype: 'container',
defaultType: 'textfield',
layout: 'hbox',
items: []
}
]
}]
}); //end this.formEdit
//#endregion
//#region 审核或驳回界面
this.storeUser = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.UserRefModel',
proxy: {
url: '/CommMng/BasicDataRef/GetUserRefList'
}
});
this.storeUser.load({
params: {
condition: ""
}
});
this.comboxSeaeOp = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '操作',
store: this.storeUser,
forceSelection: true,
name: 'OP',
valueField: 'UserName',
displayField: 'CodeAndName'
});
this.comboxSeaeSale = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '销售',
store: this.storeUser,
forceSelection: true,
name: 'SALE',
valueField: 'UserName',
displayField: 'CodeAndName'
});
this.comboxSeaeCustService = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '客服',
store: this.storeUser,
forceSelection: true,
name: 'CUSTSERVICE',
valueField: 'UserName',
displayField: 'CodeAndName'
});
Ext.define('DataInputType', {
extend: 'Ext.data.Model',
fields: [{
name: 'ID',
type: 'string'
},
{
name: 'InputType',
type: 'string'
}]
});
var DataInputType = [{
"ID": "0",
"InputType": "海运出口"
},
{
"ID": "1",
"InputType": "海运进口"
}];
this.storeDataInputType = Ext.create('Ext.data.Store', {
model: 'DataInputType',
data: DataInputType
});
this.comboxDataInputType = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '海运类型',hidden:true,
store: this.storeDataInputType,
name: 'DataInputType',
//id: "ISPAYED",
valueField: 'InputType',
displayField: 'InputType',
allowBlank: false,
value: '海运出口'
});
this.formAudit = Ext.widget('form', {
frame: true,
region: 'center',
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 90,
msgTarget: 'qtip'
},
items: [{ //fieldset 1
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '会计期间',
xtype: 'monthfield',
name: 'ACCDATE'
}, {
fieldLabel: '指定销售',
name: 'SALE_NAME',
readOnly: true
}
]
},
{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
this.comboxSeaeOp, {xtype:'hiddenfield'}
] //,this.comboxDataInputType
},
{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
this.comboxSeaeCustService,
this.comboxSeaeSale
] //,this.comboxDataInputType
} //
] //end items(fieldset 1)
},
this.comboxDataInputType //end fieldset 1
] //end root items
});
me = this;
this.winAuditShow = Ext.create('Ext.window.Window', {
title: "接受订舱",
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.formAudit],
buttons: [{
text: "确认接受",
id:"btnConfirm",
minWidth: 70,
handler: function () {
var form = me.formAudit.getForm();
var ACCDATE = form.findField('ACCDATE').getRawValue();
if (ACCDATE == '' || ACCDATE == null || ACCDATE == undefined) {
Ext.Msg.show({
title: '提示',
msg: '会计期间为必填!',
icon: Ext.Msg.INFO,
buttons: Ext.Msg.OK
});
return;
};
me.accdate = ACCDATE;
var User = me.comboxSeaeOp.getValue();
if (User == '' || User == null || User == undefined) {
Ext.Msg.show({
title: '提示',
msg: '操作员为必填!',
icon: Ext.Msg.INFO,
buttons: Ext.Msg.OK
});
return;
};
var btn_KP = Ext.getCmp("btnConfirm");
btn_KP.disable();
setTimeout(function () { btn_KP.enable(); }, 5000);
me.seaeop = User;
me.seaecustservice = me.comboxSeaeCustService.getValue();
me.seaesale = me.comboxSeaeSale.getValue();
me.onAuditPassClick();
}
},
{
text: "关闭",
minWidth: 70,
handler: function () {
me.winAuditShow.close();
}
}]
});
//#region 驳回订舱的窗口
this.formAuditBack = Ext.widget('form', {
frame: true,
region: 'center',
title: "<a href='#'><font color='#FF0000'>驳回原因</font></a>",
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 90,
msgTarget: 'qtip'
},
items: [
{
xtype: 'textfield',
grow: true,
fieldLabel: '邮箱',
labelSeparator: '',
labelWidth: 40,
//height: 100,
name: 'EMAIL',
anchor: '100%'
},
{
xtype: 'textareafield',
grow: true,
fieldLabel: '',
labelSeparator: '',
labelWidth: 0,
height: 100,
name: 'ORREASON',
anchor: '100%'
}
] //end root items
});
//#endregion
me = this;
this.winAuditBackShow = Ext.create('Ext.window.Window', {
title: "",
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.formAuditBack],
buttons: [{
text: "确认驳回",
minWidth: 70,
handler: function () {
var form = me.formAuditBack.getForm();
var EMAIL = form.findField('EMAIL').getValue();
if (isNullorEmpty(EMAIL)) {
Ext.Msg.show({
title: '提示',
msg: '邮箱为必填!',
icon: Ext.Msg.INFO,
buttons: Ext.Msg.OK
});
return;
};
me.email = EMAIL;
var ORREASON = form.findField('ORREASON').getRawValue();
if (ORREASON == '' || ORREASON == null || ORREASON == undefined) {
Ext.Msg.show({
title: '提示',
msg: '驳回原因为必填!',
icon: Ext.Msg.INFO,
buttons: Ext.Msg.OK
});
return;
};
me.reason = '订舱驳回: ' + ORREASON;
me.onAuditBack();
}
},
{
text: "关闭",
minWidth: 70,
handler: function () {
me.winAuditBackShow.close();
}
}]
});
//#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
},
{
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');
//field.setValue(SHOWNAME);
field = basicForm.findField('OP');
field.setValue(SHOWNAME);
for (var j = 0; j < this.storeBodyList.getCount(); j += 1) {
var memberbody = this.storeBodyList.getAt(j);
memberbody.set("ORDNO", '*');
memberbody.commit();
};
this.GetEditStatus();
var children = this.tabSeaepanel.items;
if (children) {
for (var i = children.length - 1,
len = 0; i >= len; i--) {
if (children.items[i].id) {
if (children.items[i].id == 'pnlmodSeaeOrderInfo') {
// this.tabSeaepanel.setActiveTab(i);
} else {
children.items[i].close();
}
}
}
}
this.tabSeaepanel.doLayout();
},
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
},
{
text: "接受订舱",
id: 'btnAudit',
iconCls: "btnadd",
handler: function (button, event) {
var billstatus = this.getStatus();
if (billstatus != 'Submit') {
Ext.Msg.show({
title: '警告',
msg: '当前状态,无法接受订舱!',
icon: Ext.Msg.WARNING,
buttons: Ext.Msg.OK
});
return;
}
var form = this.formAudit.getForm();
var VoucherDate = form.findField('ACCDATE');
var thisday = this.getToMonth();
VoucherDate.setRawValue(thisday);
var SALE = form.findField('SALE');
SALE.setValue(this.editRecord.get("SALE_NAME"));
form.findField('SALE_NAME').setValue(this.editRecord.get("SALE_NAME"));
this.winAuditShow.show();
},
scope: this
},
{
text: "驳回订舱",
id: 'btnAuditBack',
iconCls: "btndelete",
handler: function (button, event) {
var billstatus = this.getStatus();
if (billstatus != 'Confirm' && billstatus != 'Submit' ) {
Ext.Msg.show({
title: '警告',
msg: '当前状态,无法驳回!',
icon: Ext.Msg.WARNING,
buttons: Ext.Msg.OK
});
return;
}
var form = this.formAuditBack.getForm();
var EMAIL = form.findField('EMAIL');
var formdata = this.formHead.getForm().getValues(false, false, false);
var recemail = formdata.OPERATOREMAIL;
EMAIL.setRawValue(recemail);
this.winAuditBackShow.show();
},
scope: this
},
{
id: 'btnEPrint',
text: "打印",
iconCls: "btnprint",
handler: function (button, event) {
this.Print();
},
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.panelSeae = new Ext.Panel({
title: '订舱信息',
id: 'pnlmodSeaeOrderInfo',
layout: "border",
region: 'center',
animate: true,
autoScroll: true,
frame: false,
//closable:true,
items: [this.panelBtn, this.formHead, this.panelpage]
});
this.tabSeaepanel = new Ext.TabPanel({
activeTab: 0,
autoWidth: true,
border: true,
frame: false,
region: 'center',
id: "TabSeaePanel",
enableTabScroll: true,
items: [this.panelSeae]
});
Ext.apply(this, {
items: [this.tabSeaepanel]
});
//#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.setAuditBtnStatus(true);
if (this.opStatus == 'edit') {
condition = " ORDNO='" + this.editRecord.get('ORDNO') + "'";
//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/BookingConfirm/GetBookingData',
params: {
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(data);
this.GetEditStatus();
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
if (this.opStatus == 'edit') {
this.storeBodyList.load({
params: {
condition: condition
}
});
} else {
condition = "BSNO='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 jsonDelBody = ConvertRecordsToJsonAll(this.bodyDel);
//this.formHead.getForm().findField('ORDNO').setDisabled(false);
var data = this.formHead.getForm().getValues(false, false, false);
var data2 = this.formEdit.getForm().getValues(false, false, false);
//this.formHead.getForm().findField('ORDNO').setDisabled(true);
//
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/MvcShipping/MsSeaeOrder/Save',
scope: this,
params: {
opstatus: this.opStatus,
data: Ext.JSON.encode(data),
data2: Ext.JSON.encode(data2),
body: jsonBody
},
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('BookingConfirm', 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('ORDNO').setDisabled(true);
for (var j = 0; j < this.storeBodyList.getCount(); j += 1) {
var memberbody = this.storeBodyList.getAt(j);
memberbody.set("ORDNO", this.editRecord.get('ORDNO'));
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
getStatus: function () {
return this.formHead.getForm().findField('BSSTATUS').getValue();
},
getFieldValue: function (FieldName) {
return this.formHead.getForm().findField(FieldName).getValue();
},
addDetail: function () {
var record = Ext.create('MsSeaeOrderCtn', {
CTN_ID: NewGuid(),
ORDNO: '*',
CTNALL: '',
//CTNEXHIBIT
CTNNUM: 0,
REMARK: ''
});
this.storeBodyList.add(record);
var n = this.storeBodyList.getCount();
this.gridListCellEditing.startEditByPosition({
row: n - 1,
column: 2
});
},
deleteDetail: function () {
var BSSTATUS = this.getStatus();
if (BSSTATUS == '0') {
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.ORDNO == "" || rec.data.ORDNO == "*") //如果是新增但没有保存的数据,没有必要提交到后台
{
this.storeBodyList.remove(selectedRecords[i]);
} else {
Ext.MessageBox.confirm('提示', '确定删除该记录吗?',
function (btn) {
if (btn == 'yes') {
Ext.Msg.wait('正在删除数据...');
Ext.Ajax.request({
waitMsg: '正在删除数据...',
url: '/MvcShipping/MsSeaeOrder/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
setButtonStatus: function (BSSTATUS) {
if (BSSTATUS == "Submit") {
}
},
LoadInit: function (data) {
var CUSTOMERNAME = this.formHead.getForm().findField('CUSTOMERNAME').getValue();
var BLTYPE = this.formHead.getForm().findField('BLTYPE').getValue();
if (BLTYPE == "拼箱单票" || BLTYPE == "拼箱分票") {
this.panelBodyCtn.hide();
} else {
this.panelBodyCtn.show();
}
var BSSTATUS = this.getStatus();
if (BSSTATUS == "Back") {
//this.panelORREASON.show();
} else {
//this.panelORREASON.hide();
}
var CARGOID = this.formHead.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('ORDNO').getValue();
var billstatus = this.getStatus();
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 jsonBody = ConvertRecordsToJsonAll(bodydatas);
//var jsonDelBody = ConvertRecordsToJsonAll(this.bodyDel);
this.formHead.getForm().findField('ORDNO').setDisabled(false);
var data = this.formHead.getForm().getValues(false, false, false);
var data2 = this.formEdit.getForm().getValues(false, false, false);
this.formHead.getForm().findField('ORDNO').setDisabled(true);
_this = this;
Ext.Ajax.request({
waitMsg: '正在添加数据...',
url: '/MvcShipping/MsSeaeOrder/SubmitAuditForm',
params: {
data: Ext.JSON.encode(data),
data2: Ext.JSON.encode(data2),
body: jsonBody
},
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/MsSeaeOrder/GetData',
params: {
handle: 'edit',
condition: " ORDNO='" + Duino + "'"
},
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('MsSeaeOrderModel', 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('ORDNO').getValue();
var billstatus = this.getStatus();
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 jsonBody = ConvertRecordsToJsonAll(bodydatas);
this.formHead.getForm().findField('ORDNO').setDisabled(false);
var data = this.formHead.getForm().getValues(false, false, false);
var data2 = this.formEdit.getForm().getValues(false, false, false);
this.formHead.getForm().findField('ORDNO').setDisabled(true);
_this = this;
Ext.Ajax.request({
waitMsg: '正在添加数据...',
url: '/MvcShipping/MsSeaeOrder/SubmitAuditBackForm',
params: {
data: Ext.JSON.encode(data),
data2: Ext.JSON.encode(data2),
body: jsonBody
},
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/MsSeaeOrder/GetData',
params: {
handle: 'edit',
condition: " ORDNO='" + Duino + "'"
},
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('MsSeaeOrderModel', 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
});
},
onAuditPassClick: function () {
//this.formHead.getForm().findField('ORDNO').setDisabled(false);
var data = this.formHead.getForm().getValues(false, false, false);
var data2 = this.formEdit.getForm().getValues(false, false, false);
//this.formHead.getForm().findField('ORDNO').setDisabled(true);
//alert(_type);
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);
_this = this;
Ext.MessageBox.confirm('提示', '确定审核通过选中的业务吗?',
function (btn) {
if (btn == 'yes') {
Ext.Msg.wait('正在审核数据...');
Ext.Ajax.request({
waitMsg: '正在审核数据...',
url: '/MvcShipping/BookingConfirm/AuditWebOrderForm',
params: {
data: Ext.JSON.encode(data),
data2: Ext.JSON.encode(data2),
body: jsonBody,
accdate: _this.accdate,
op: _this.seaeop,
custservice: _this.seaecustservice,
sale: _this.seaecustsale
},
callback: function (options, success, response) {
if (success) {
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);
var editp = Ext.create('BookingConfirm', 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();
_this.GetEditStatus();
Ext.Msg.show({
title: '提示',
msg: '审核成功!',
icon: Ext.Msg.INFO,
buttons: Ext.Msg.OK
});
} else {
Ext.Msg.show({
title: '错误',
msg: jsonresult.Message,
icon: Ext.Msg.ERROR,
buttons: Ext.Msg.OK
});
}
_this.winAuditShow.close();
}
},
failure: function (response, options) {
Ext.Msg.show({
title: '警告',
msg: '服务器响应出错,请重试',
icon: Ext.Msg.INFO,
buttons: Ext.Msg.OK
});
},
success: function (response, options) { },
scope: this
}); //end Ext.Ajax.request
}
},
this);
},
onAuditBack: function () {
this.formHead.getForm().findField('ORDNO').setDisabled(false);
var data = this.formHead.getForm().getValues(false, false, false);
var data2 = this.formEdit.getForm().getValues(false, false, false);
this.formHead.getForm().findField('ORDNO').setDisabled(true);
_this = this;
Ext.MessageBox.confirm('提示', '确定驳回选中的业务吗?',
function (btn) {
if (btn == 'yes') {
Ext.Msg.wait('正在驳回数据...');
Ext.Ajax.request({
waitMsg: '正在驳回数据...',
url: '/MvcShipping/BookingConfirm/AuditWebOrderBack',
params: {
data: Ext.JSON.encode(data),
data2: Ext.JSON.encode(data2),
orreason: _this.reason,
email: _this.email
},
callback: function (options, success, response) {
if (success) {
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);
var editp = Ext.create('BookingConfirm', 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();
_this.GetEditStatus();
Ext.Msg.show({
title: '提示',
msg: '驳回成功!',
icon: Ext.Msg.INFO,
buttons: Ext.Msg.OK
});
} else {
Ext.Msg.show({
title: '错误',
msg: jsonresult.Message,
icon: Ext.Msg.ERROR,
buttons: Ext.Msg.OK
});
}
_this.winAuditBackShow.close();
}
},
failure: function (response, options) {
Ext.Msg.show({
title: '警告',
msg: '服务器响应出错,请重试',
icon: Ext.Msg.INFO,
buttons: Ext.Msg.OK
});
},
success: function (response, options) { },
scope: this
}); //end Ext.Ajax.request
}
},
this);
},
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.getStatus();
////var inputby = this.formHead.getForm().findField('INPUTBY').getValue();
////var op = this.formHead.getForm().findField('OP').getValue();
//_this = this;
//if (BSSTATUS == "0" || BSSTATUS == "1") {
// canedit = false;
// this.setSaveBtnStatus(canedit);
//} else {
// this.StoreOpRange.load({
// params: {
// optype: "modSeaeOrderList"
// },
// callback: function (r, options, success) {
// if (success) {
// if (r.length != 0) {
// var records = DsStoreQueryBy(_this.StoreOpRange, 'OPID', op);
// if (records.getCount() > 0) {
// canedit = true;
// } else {
// var recordins = DsStoreQueryBy(_this.StoreOpRange, 'OPID', inputby);
// if (recordins.getCount() > 0) {
// canedit = true;
// } else {
// canedit = false;
// }
// }
// } else {
// canedit = false;
// }
// _this.setSaveBtnStatus(canedit);
// }
// }
// });
//}
},
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;
},
setAuditBtnStatus: function (enable) {
var btnESave = Ext.getCmp('btnESave');
var btnESaveAndClose = Ext.getCmp('btnESaveAndClose');
var btnESaveAndNew = Ext.getCmp('btnESaveAndNew');
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');
var btnAudit = Ext.getCmp('btnAudit');
var btnAuditBack = Ext.getCmp('btnAuditBack');
btnESave.setVisible(!enable);;
btnESaveAndClose.setVisible(!enable);
btnESaveAndNew.setVisible(!enable);
btnENew.setVisible(!enable);;
btnECopyNew.setVisible(!enable);
btnSubmitAudit.setVisible(!enable);
btnSubmitAuditBack.setVisible(!enable);
btnEPrint.setVisible(!enable);
btnAudit.setVisible(enable);
btnAuditBack.setVisible(enable);
},
setSaveBtnStatus: function (enable) {
var btnESave = Ext.getCmp('btnESave');
var btnESaveAndClose = Ext.getCmp('btnESaveAndClose');
var btnESaveAndNew = Ext.getCmp('btnESaveAndNew');
if (enable) {
btnESave.enable();
btnESaveAndClose.enable();
btnESaveAndNew.enable();
} else {
btnESave.disable();
btnESaveAndClose.disable();
btnESaveAndNew.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
});