Ext . namespace ( 'Shipping' ) ;
Shipping . MsOpBillEdit = function ( config ) {
Ext . applyIf ( this , config ) ;
this . initUIComponents ( ) ;
window . Shipping . MsOpBillEdit . superclass . constructor . call ( this ) ;
} ;
Ext . extend ( Shipping . MsOpBillEdit , Ext . Panel , {
ParentWin : null ,
MParentWin : null ,
OpStatus : 'add' ,
StoreList : null ,
EditRecord : null ,
Editdata : null ,
MainEditRecord : null ,
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 : "modImport" } } ) ;
//品名
this . storeCodeGoodsList = Ext . create ( 'DsExt.ux.RefTableStore' , {
model : 'DsShipping.ux.CodeGoodsModel' ,
proxy : { url : '/CommMng/BasicDataRef/GetCodeGoodsList' }
} ) ;
this . storeCodeGoodsList . load ( ) ;
this . comboxGOODSNAME = Ext . create ( 'DsExt.ux.RefTableCombox' , {
fieldLabel : 'Description of Goods (包装种类与货名)' ,
store : this . storeCodeGoodsList ,
flex : 1.5 ,
labelWidth : 250 ,
forceSelection : true ,
name : 'GOODSNAME' ,
valueField : 'GOODNAME' ,
displayField : 'CodeAndName'
} ) ;
//客户加载_发货人
this . storeShipper = Ext . create ( 'DsExt.ux.RefTableStore' , {
model : 'OpSeaeShipper' ,
proxy : { url : '/Import/ImportTrade/GetShipperList' }
} ) ;
// this.storeShipper.load({ params: { condition: "ISCONTROLLER='1'"} });
//发货人
this . comboxShipper = Ext . create ( 'DsExt.ux.RefTableCombox' , {
fieldLabel : 'Shipper (发货人)' ,
store : this . storeShipper ,
forceSelection : true ,
labelWidth : 150 ,
labelAlign : 'left' ,
name : 'SHIPPERID' ,
valueField : 'SHORTNAME' ,
displayField : 'CodeAndName' ,
listeners : {
scope : this ,
'select' : function ( combo , records , eOpts ) {
if ( records . length > 0 ) {
var selectrecords = DsStoreQueryBy ( this . storeShipper , 'SHORTNAME' , combo . value ) ;
if ( selectrecords . getCount ( ) > 0 ) {
var selectdata = selectrecords . getAt ( 0 ) . data ;
this . formEdit . getForm ( ) . findField ( 'SHIPPER' ) . setValue ( selectdata . SHIPPERDETAIL ) ;
} else {
this . formEdit . getForm ( ) . findField ( 'SHIPPER' ) . setValue ( '' ) ;
}
}
}
}
} ) ;
//客户加载_收货人
this . storeConsignee = Ext . create ( 'DsExt.ux.RefTableStore' , {
model : 'OpSeaeShipper' ,
proxy : { url : '/Import/ImportTrade/GetShipperList' }
} ) ;
// this.storeShipper.load({ params: { condition: "ISCONTROLLER='1'"} });
//收货人
this . comboxConsignee = Ext . create ( 'DsExt.ux.RefTableCombox' , {
fieldLabel : 'Consignee (收货人)' ,
labelWidth : 150 ,
labelAlign : 'left' ,
store : this . storeConsignee ,
forceSelection : true ,
name : 'CONSIGNEEID' ,
valueField : 'SHORTNAME' ,
displayField : 'CodeAndName' ,
listeners : {
scope : this ,
'select' : function ( combo , records , eOpts ) {
if ( records . length > 0 ) {
var selectrecords = DsStoreQueryBy ( this . storeConsignee , 'SHORTNAME' , combo . value ) ;
if ( selectrecords . getCount ( ) > 0 ) {
var selectdata = selectrecords . getAt ( 0 ) . data ;
this . formEdit . getForm ( ) . findField ( 'CONSIGNEE' ) . setValue ( selectdata . SHIPPERDETAIL ) ;
} else {
this . formEdit . getForm ( ) . findField ( 'CONSIGNEE' ) . setValue ( '' ) ;
}
}
}
}
} ) ;
//客户加载_通知人
this . storenotifyparty = Ext . create ( 'DsExt.ux.RefTableStore' , {
model : 'OpSeaeShipper' ,
proxy : { url : '/Import/ImportTrade/GetShipperList' }
} ) ;
// this.storeShipper.load({ params: { condition: "ISCONTROLLER='1'"} });
//通知人
this . comboxNotifyParty = Ext . create ( 'DsExt.ux.RefTableCombox' , {
fieldLabel : 'Notify Party (通知人)' ,
store : this . storenotifyparty ,
labelWidth : 150 ,
labelAlign : 'left' ,
forceSelection : true ,
name : 'NOTIFYPARTYID' ,
valueField : 'SHORTNAME' ,
displayField : 'CodeAndName' ,
listeners : {
scope : this ,
'select' : function ( combo , records , eOpts ) {
if ( records . length > 0 ) {
var selectrecords = DsStoreQueryBy ( this . storenotifyparty , 'SHORTNAME' , combo . value ) ;
if ( selectrecords . getCount ( ) > 0 ) {
var selectdata = selectrecords . getAt ( 0 ) . data ;
this . formEdit . getForm ( ) . findField ( 'NOTIFYPARTY' ) . setValue ( selectdata . SHIPPERDETAIL ) ;
} else {
this . formEdit . getForm ( ) . findField ( 'NOTIFYPARTY' ) . setValue ( '' ) ;
}
}
}
}
} ) ;
//客户加载_代理
this . storeagent = Ext . create ( 'DsExt.ux.RefTableStore' , {
model : 'OpSeaeShipper' ,
proxy : { url : '/Import/ImportTrade/GetShipperList' }
} ) ;
// this.storeShipper.load({ params: { condition: "ISCONTROLLER='1'"} });
//收货人
this . comboxAgent = Ext . create ( 'DsExt.ux.RefTableCombox' , {
fieldLabel : '代 理' ,
store : this . storeagent ,
forceSelection : true ,
name : 'AGENTID' ,
valueField : 'SHORTNAME' ,
displayField : 'CodeAndName' ,
listeners : {
scope : this ,
'select' : function ( combo , records , eOpts ) {
if ( records . length > 0 ) {
var selectrecords = DsStoreQueryBy ( this . storeagent , 'SHORTNAME' , combo . value ) ;
if ( selectrecords . getCount ( ) > 0 ) {
var selectdata = selectrecords . getAt ( 0 ) . data ;
this . formEdit . getForm ( ) . findField ( 'AGENT' ) . setValue ( selectdata . SHIPPERDETAIL ) ;
} else {
this . formEdit . getForm ( ) . findField ( 'AGENT' ) . setValue ( '' ) ;
}
}
}
}
} ) ;
//#endregion
//提单模板
this . storeTemplate = Ext . create ( 'DsExt.ux.RefTableStore' , {
model : 'CODETEMPLATE' ,
proxy : { url : '/CommMng/BasicDataRef/GetCodeTemplateList' }
} ) ;
this . storeTemplate . load ( { params : { condition : "" } } ) ;
this . comboxTemplate = Ext . create ( 'DsExt.ux.RefTableCombox' , {
fieldLabel : '提单模板' ,
store : this . storeTemplate ,
forceSelection : true ,
name : 'TEMPLATE' ,
valueField : 'TEMPLATEID' ,
displayField : 'TEMPLATE'
} ) ;
this . StoreBILLTYPE = Ext . create ( 'Ext.data.Store' , {
fields : [ 'BLTYPE' ]
} ) ;
this . StoreBILLTYPE . add ( { "BLTYPE" : "分单" } ) ;
this . StoreBILLTYPE . add ( { "BLTYPE" : "主单" } ) ;
this . comboxBILLTYPE = Ext . create ( 'DsExt.ux.RefTableCombox' , {
fieldLabel : '提单类型' ,
store : this . StoreBILLTYPE ,
forceSelection : true ,
name : 'BILLTYPE' ,
valueField : 'BLTYPE' ,
displayField : 'BLTYPE'
} ) ;
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 : 'CodeAndName' ,
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 : 'CodeAndName' ,
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 . storeFrt = Ext . create ( 'DsExt.ux.RefTableStore' , {
model : 'CODE_FRT' ,
proxy : { url : '/CommMng/BasicDataRef/GetCodeFrtList' }
} ) ;
this . storeFrt . load ( { params : { condition : "" } } ) ;
this . comboxBLFRT = Ext . create ( 'DsExt.ux.RefTableCombox' , {
fieldLabel : '付费方式' ,
store : this . storeFrt ,
forceSelection : true ,
name : 'BLFRT' ,
valueField : 'FRT' ,
displayField : 'FRT'
} ) ;
//运输条款
this . storeSERVICE = Ext . create ( 'DsExt.ux.RefTableStore' , {
model : 'CODE_SERVICE' ,
proxy : { url : '/CommMng/BasicDataRef/GetCodeServiceList' }
} ) ;
this . storeSERVICE . load ( { params : { condition : "" } } ) ;
this . comboxSERVICE = Ext . create ( 'DsExt.ux.RefTableCombox' , {
fieldLabel : '运输条款' ,
store : this . storeSERVICE ,
forceSelection : true ,
name : 'SERVICE' ,
valueField : 'SERVICE' ,
displayField : 'SERVICE'
} ) ;
//签单方式
this . 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'
} ) ;
//件数包装
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 : '包 装' ,
labelWidth : 35 ,
store : this . storeCodePackage ,
padding : '0 0 0 10' ,
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 . 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 . comboxKINDPKGS _CTN = Ext . create ( 'DsExt.ux.RefTableCombox' , {
//fieldLabel: '件数包装',
store : this . storeCodePackage ,
forceSelection : true ,
name : 'KINDPKGS' ,
valueField : 'PKGS' ,
displayField : 'PKGS'
} ) ;
//#region 集装箱-数据集
this . storeBodyList = Ext . create ( 'Ext.data.Store' , {
model : 'MsOpSeaeDetail' ,
remoteSort : true ,
proxy : {
type : 'ajax' ,
url : '/Import/ImportTrade/GetBodyList' ,
reader : {
id : 'BsNo,CTNCODE,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
} , '-' , {
text : '更新合计' ,
tooltip : '更新合计' ,
handler : function ( button , event ) {
this . onUpdateDetailClick ( 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 : 'CTNNUM' ,
header : '箱量' ,
width : 50 ,
editor : {
xtype : 'numberfield' ,
allowBlank : false ,
selectOnFocus : true
}
} , {
dataIndex : 'CNTRNO' ,
header : '箱号' ,
width : 100 ,
editor : {
xtype : 'textfield' ,
selectOnFocus : true
}
} , {
dataIndex : 'SEALNO' ,
header : '封号' ,
width : 80 ,
editor : {
xtype : 'textfield' ,
selectOnFocus : true
}
} , {
sortable : true ,
dataIndex : 'PKGS' ,
header : '件数' ,
width : 60 ,
editor : {
xtype : 'numberfield' ,
allowBlank : false ,
selectOnFocus : true
}
} , {
dataIndex : 'KINDPKGS' ,
header : '件数包装' ,
width : 100 ,
editor : this . comboxKINDPKGS _CTN
} , {
dataIndex : 'KGS' ,
header : '重量' ,
width : 60 ,
editor : {
xtype : 'textfield' ,
selectOnFocus : true
}
} , {
dataIndex : 'CBM' ,
header : '尺码' ,
width : 60 ,
editor : {
xtype : 'textfield' ,
selectOnFocus : true
}
} , {
dataIndex : 'TAREWEIGHT' ,
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 : 200 ,
//margin: '5 10',
frame : true ,
items : [ this . gridList ]
} ) ;
//#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 : [ this . comboxShipper , {
xtype : 'textareafield' ,
grow : true ,
labelWidth : 0 ,
height : 90 ,
name : 'SHIPPER' ,
anchor : '100%'
} , this . comboxConsignee , {
xtype : 'textareafield' ,
grow : true ,
labelWidth : 0 ,
height : 90 ,
name : 'CONSIGNEE' ,
anchor : '100%'
} , this . comboxNotifyParty , {
xtype : 'textareafield' ,
grow : true ,
labelWidth : 0 ,
height : 90 ,
name : 'NOTIFYPARTY' ,
anchor : '100%'
}
]
} , {
xtype : 'container' ,
layout : 'anchor' ,
flex : 1 ,
defaultType : 'textfield' ,
items : [ {
xtype : 'container' ,
layout : 'hbox' ,
flex : 1 ,
defaultType : 'textfield' ,
items : [ {
fieldLabel : '业务编号' ,
name : 'BSNO' , hidden : true
} , {
fieldLabel : 'INPUTBY' ,
name : 'INPUTBY' , hidden : true
} , {
fieldLabel : 'AS_ID' ,
name : 'AS_ID' , hidden : true
} , {
fieldLabel : '主提单号' ,
name : 'MBLNO'
} , {
fieldLabel : '分提单号' ,
name : 'HBLNO'
} ]
} , {
xtype : 'container' ,
layout : 'hbox' ,
flex : 1 ,
defaultType : 'textfield' ,
items : [ this . comboxTemplate , this . comboxBILLTYPE ]
} , this . panelBodyCtn , {
xtype : 'container' ,
layout : 'hbox' ,
flex : 1 ,
defaultType : 'textfield' ,
items : [ { xtype : 'hiddenfield' } ]
} , this . comboxAgent , {
xtype : 'textareafield' ,
grow : true ,
fieldLabel : 'AGENT' ,
height : 90 ,
name : 'AGENT' ,
anchor : '100%'
}
]
}
]
} , {
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 : [ {
xtype : 'container' ,
layout : 'anchor' ,
flex : 1 ,
defaultType : 'textfield' ,
items : [ {
xtype : 'label' ,
html : '<html>Seal No.(封志号)</html>'
} , {
xtype : 'textareafield' ,
grow : true ,
height : 135 ,
name : 'CNTRSEALNO' ,
anchor : '100%'
} , {
xtype : 'label' ,
html : '<html>Marks & Nos.(标记与号码) </html>'
} , {
xtype : 'textareafield' ,
grow : true ,
height : 135 ,
name : 'MARKS' ,
anchor : '100%'
}
]
} , {
xtype : 'container' ,
layout : 'anchor' ,
flex : 3 ,
defaultType : 'textfield' ,
items : [ {
xtype : 'container' ,
defaultType : 'textfield' ,
layout : 'hbox' ,
defaults : {
anchor : '100%'
} ,
items : [ {
xtype : 'label' ,
html : '<html>         货物描述</html>'
} ]
} , {
xtype : 'textareafield' ,
grow : true ,
fieldLabel : '  ' ,
labelSeparator : '' ,
labelWidth : 20 ,
height : 290 ,
name : 'DESCRIPTION' ,
anchor : '100%'
} ]
} , {
xtype : 'container' ,
layout : 'anchor' ,
flex : 1 ,
defaultType : 'textfield' ,
items : [ {
xtype : 'label' ,
html : '<html>         No.of containers or pkgs.<br>         ( 箱数或件数)</html>'
} , {
xtype : 'textareafield' ,
grow : true ,
fieldLabel : '  ' ,
labelWidth : 20 ,
labelSeparator : '' ,
height : 60 ,
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 ( str _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 : '          Gross Weight 毛重(公斤)'
} , {
xtype : 'textareafield' ,
grow : true ,
height : 60 ,
labelWidth : 20 ,
labelSeparator : '' ,
fieldLabel : '  ' ,
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 : '          Measurement 尺码(立方米)'
} , {
xtype : 'textareafield' ,
grow : true ,
height : 60 ,
labelWidth : 20 ,
labelSeparator : '' ,
fieldLabel : '  ' ,
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'
} ]
} , {
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
//#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 . formEdit . getForm ( ) ;
this . opStatus = 'add' ;
basicForm . findField ( 'AS_ID' ) . setDisabled ( false ) ;
var field = basicForm . findField ( 'AS_ID' ) ;
field . setValue ( '*' ) ;
basicForm . findField ( 'AS_ID' ) . setDisabled ( true ) ;
field = basicForm . findField ( 'INPUTBY' ) ;
field . setValue ( SHOWNAME ) ;
this . GetEditStatus ( ) ;
} ,
scope : this
} , '-' , {
id : 'btnEHistryCopy' ,
text : "历史引入" ,
handler : function ( button , event ) {
DsOpenEditWin ( '/Import/ImportTrade/HistryBillIndex' , "提单历史引入" , "600" , "940" , "10" , "10" ) ;
} ,
scope : this
} , '-' , {
text : "关闭" ,
handler : function ( button , event ) {
window . close ( ) ;
} ,
scope : this
} , {
text : "新建" ,
handler : function ( button , event ) {
this . LoadData ( 'add' , '' ) ;
} ,
scope : this
} , '-' , {
text : "打印" ,
iconCls : "btnprint" ,
handler : function ( button , event ) {
this . Print ( ) ;
} ,
scope : this
} , '-' , {
text : "其他操作" ,
menu : [
{ text : "直发舱单" ,
handler : function ( menu , event ) {
_this . winDSMANIFESTShow . show ( ) ;
}
} ] ,
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 ]
} ) ;
Ext . apply ( this , {
items : [ this . panelBtn , this . panelpage ]
} ) ;
//#endregion
//#region 其他
parentWin = window . parent . opener . _this . tabSeaepanel . activeTab ;
MparentWin = window . parent . opener . _this ;
this . InitData ( ) ;
//绑定事件
this . gridList . on ( 'edit' , function ( editor , e , eOpts ) {
this . gridAfterEdit ( editor , e , eOpts ) ;
} , this ) ;
//#endregion
//#region 直发舱单
this . CheckVessel = new Ext . form . Checkbox ( {
fieldLabel : '换船或更改提单号' ,
checked : false
} ) ;
this . formDsManifestShow = 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 : 'radiogroup' ,
fieldLabel : '船公司' ,
columns : 2 ,
vertical : true ,
id : 'dCARRIER' ,
items : [
{
boxLabel : '外代' ,
name : 'CARRIER' ,
inputValue : '外代' ,
checked : true
} , {
boxLabel : '外运' ,
name : 'CARRIER' ,
inputValue : '外运' ,
checked : false
} , {
boxLabel : '联代' ,
name : 'CARRIER' ,
inputValue : '联代' ,
checked : false
} , {
boxLabel : '华港' ,
name : 'CARRIER' ,
inputValue : '华港' ,
checked : false
} , {
boxLabel : '中创' ,
name : 'CARRIER' ,
inputValue : '中创' ,
checked : false
} , {
boxLabel : '中远' ,
name : 'CARRIER' ,
inputValue : '中远' ,
checked : false
} , {
boxLabel : '海丰' ,
name : 'CARRIER' ,
inputValue : '海丰' ,
checked : false
} , {
boxLabel : '振华' ,
name : 'CARRIER' ,
inputValue : '振华' ,
checked : false
} , {
boxLabel : '中通' ,
name : 'CARRIER' ,
inputValue : '中通' ,
checked : false
} , {
boxLabel : '中海' ,
name : 'CARRIER' ,
inputValue : '中海' ,
checked : false
}
]
} , this . CheckVessel , {
xtype : 'textareafield' ,
grow : true ,
fieldLabel : 'EDI备注' ,
height : 60 ,
id : 'dREMARK' ,
name : 'EDIREMARK' ,
anchor : '100%'
}
] //end items(fieldset 1)
} //end fieldset 1
] //end root items
} ) ;
me = this ;
this . winDSMANIFESTShow = 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 . formDsManifestShow ] ,
buttons : [ {
text : "确定发送" ,
minWidth : 70 ,
handler : function ( ) {
var cgCARRIER = Ext . getCmp ( 'dCARRIER' ) ;
var CARRIER = cgCARRIER . getValue ( ) ;
var IsCgVessel = 0 ;
if ( me . CheckVessel . checked )
IsCgVessel = 1 ;
var dREMARK = Ext . getCmp ( 'dREMARK' ) ;
var REMARK = dREMARK . getValue ( ) ;
me . onSendDS ( CARRIER . CARRIER , IsCgVessel , REMARK ) ;
}
} , {
text : "关闭" ,
minWidth : 70 ,
handler : function ( ) {
me . winDSMANIFESTShow . close ( ) ;
}
} ]
} ) ;
//#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 . MainEditRecord = MparentWin . Editdata ;
}
if ( this . opStatus == 'edit' ) {
condition = "AS_ID='" + this . editRecord . get ( 'AS_ID' ) + "'" ;
}
this . LoadData ( this . opStatus , condition ) ;
} , //end InitData
LoadData : function ( opstatus , condition ) {
this . serialNo = 0 ;
//this.bodyDel = [];
this . opStatus = opstatus ;
_this = this ;
if ( this . opStatus == 'add' ) {
this . formEdit . getForm ( ) . reset ( ) ;
this . formEdit . getForm ( ) . setValues ( this . MainEditRecord ) ;
this . LoadInit ( this . MainEditRecord ) ;
this . storeBodyList . load ( { params : { condition : "BSNO='" + this . MainEditRecord . BSNO + "'" } ,
callback : function ( r , options , success ) {
if ( success ) {
if ( r . length != 0 ) {
for ( var j = 0 ; j < _this . storeBodyList . getCount ( ) ; j += 1 ) {
var memberbody = _this . storeBodyList . getAt ( j ) ;
memberbody . set ( "CTN_ID" , NewGuid ( ) ) ;
memberbody . set ( "BSNO" , "*" ) ;
memberbody . commit ( ) ;
} ;
}
}
}
} ) ;
} else {
Ext . Ajax . request ( {
waitMsg : '正在查询主表数据...' ,
url : '/Import/ImportTrade/GetBillData' ,
params : {
handle : opstatus ,
condition : condition
} ,
callback : function ( options , success , response ) {
if ( success ) {
var result = Ext . JSON . decode ( response . responseText ) ;
if ( ! result . Success ) {
Ext . Msg . show ( {
title : '提示' ,
msg : result . Message ,
icon : Ext . MessageBox . ERROR ,
buttons : Ext . Msg . OK
} ) ;
return ;
}
data = result . data ;
this . formEdit . getForm ( ) . reset ( ) ;
this . formEdit . getForm ( ) . setValues ( data ) ;
this . storeBodyList . load ( { params : { condition : "BSNO='" + data . AS _ID + "'" } } ) ;
this . LoadInit ( data ) ;
// this.GetEditStatus();
} else {
Ext . MessageBox . alert ( '请求出现错误,请重试' , response . responseText ) ;
}
} ,
scope : this
} ) ;
}
} , // end LoadDate
//#endregion
//#region 保存
Save : function ( type ) {
var basicForm = this . formEdit . getForm ( ) ;
if ( ! basicForm . isValid ( ) ) {
return ;
}
var data = this . formEdit . getForm ( ) . getValues ( false , false , false ) ;
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 ) ;
//
Ext . Msg . wait ( '正在保存数据, 请稍侯..' ) ;
Ext . Ajax . request ( {
waitMsg : '正在保存数据...' ,
url : '/Import/ImportTrade/BillSave' ,
scope : this ,
params : {
opstatus : this . opStatus ,
data : Ext . JSON . encode ( data ) ,
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 ) ;
//
if ( this . opStatus == 'add' ) {
var arrNewRecords = this . StoreList . add ( returnData ) ;
this . editRecord = arrNewRecords [ 0 ] ;
}
else if ( this . opStatus == 'edit' ) {
var editp = Ext . create ( 'MsOpBillModel' , 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 . LoadInit ( returnData ) ;
}
if ( type == '0' ) {
this . opStatus = 'edit' ;
for ( var j = 0 ; j < this . storeBodyList . getCount ( ) ; j += 1 ) {
var memberbody = this . storeBodyList . getAt ( j ) ;
memberbody . set ( "BSNO" , this . editRecord . get ( 'AS_ID' ) ) ;
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
onUpdateDetailClick : function ( button , event ) {
this . UpdateDetail ( ) ;
} , //onDelDetailClick
gridAfterEdit : function ( editor , e , eOpts ) {
if ( e . field == 'PKGS' || e . field == 'KGS' || e . field == 'CBM' ) {
this . setAllTotal ( ) ;
if ( e . field == 'KGS' ) {
var KGS = this . formEdit . getForm ( ) . findField ( 'KGS' ) . getValue ( ) ;
this . formEdit . getForm ( ) . findField ( 'GROSSWEIGHT' ) . setValue ( KGS + 'KGS' ) ;
}
if ( e . field == 'CBM' ) {
var CBM = this . formEdit . getForm ( ) . findField ( 'CBM' ) . getValue ( ) ;
this . formEdit . getForm ( ) . findField ( 'MEASUREMENT' ) . setValue ( CBM + 'CBM' ) ;
}
if ( e . field == 'PKGS' ) {
var PKGS = this . formEdit . getForm ( ) . findField ( 'PKGS' ) . getValue ( ) ;
var KINDPKGS = this . formEdit . getForm ( ) . findField ( 'KINDPKGS' ) . getValue ( ) ;
this . formEdit . getForm ( ) . findField ( 'NOPKGS' ) . setValue ( PKGS + KINDPKGS ) ;
this . formEdit . getForm ( ) . findField ( 'TOTALNO' ) . setValue ( 'SAY:' + ToEn ( PKGS ) . toUpperCase ( ) + ' ' + KINDPKGS + ' ONLY.' ) ;
}
} else if ( e . field == 'KINDPKGS' ) {
var KINDPKGS = e . record . data [ 'KINDPKGS' ] ;
this . setHeadFieldValue ( 'KINDPKGS' , KINDPKGS ) ;
var PKGS = this . formEdit . getForm ( ) . findField ( 'PKGS' ) . getValue ( ) ;
this . formEdit . getForm ( ) . findField ( 'NOPKGS' ) . setValue ( PKGS + KINDPKGS ) ;
this . formEdit . getForm ( ) . findField ( 'TOTALNO' ) . setValue ( 'SAY:' + ToEn ( PKGS ) . toUpperCase ( ) + ' ' + KINDPKGS + ' ONLY.' ) ;
} else if ( e . field == 'CTNALL' || e . field == 'CNTRNO' || e . field == 'SEALNO' ) {
this . calcDetailCntrTotal ( ) ;
}
} ,
addDetail : function ( ) {
//var newSerialno = DsGetNewSerialNo(this.storeBodyList, this.serialNo);
var newSerialno = this . DsGetNewNo ( this . storeBodyList ) ;
this . serialNo = newSerialno ;
var record = Ext . create ( 'MsOpSeaeDetail' , {
CTN _ID : NewGuid ( ) ,
BSNO : '*' ,
CTNCODE : newSerialno ,
CTNALL : '' ,
CTNNUM : 0 ,
CNTRNO : '' ,
SEALNO : '' ,
PKGS : 0 ,
KINDPKGS : '' ,
KGS : 0 ,
TAREWEIGHT : 0 ,
CBM : 0 ,
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 = result + 1 ;
return result ;
} ,
deleteDetail : function ( ) {
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.bodyDel.push(rec);
this . storeBodyList . remove ( selectedRecords [ i ] ) ;
this . calcDetailCntrTotal ( ) ;
this . setAllTotal ( ) ;
var KGS = this . formEdit . getForm ( ) . findField ( 'KGS' ) . getValue ( ) ;
this . formEdit . getForm ( ) . findField ( 'GROSSWEIGHT' ) . setValue ( KGS + 'KGS' ) ;
var CBM = this . formEdit . getForm ( ) . findField ( 'CBM' ) . getValue ( ) ;
this . formEdit . getForm ( ) . findField ( 'MEASUREMENT' ) . setValue ( CBM + 'CBM' ) ;
var PKGS = this . formEdit . getForm ( ) . findField ( 'PKGS' ) . getValue ( ) ;
var KINDPKGS = this . formEdit . getForm ( ) . findField ( 'KINDPKGS' ) . getValue ( ) ;
this . formEdit . getForm ( ) . findField ( 'NOPKGS' ) . setValue ( PKGS + KINDPKGS ) ;
this . formEdit . getForm ( ) . findField ( 'TOTALNO' ) . setValue ( 'SAY:' + ToEn ( PKGS ) . toUpperCase ( ) + ' ' + KINDPKGS + ' ONLY.' ) ;
}
else {
Ext . MessageBox . confirm ( '提示' , '确定删除该记录吗?' , function ( btn ) {
if ( btn == 'yes' ) {
Ext . Msg . wait ( '正在删除数据...' ) ;
Ext . Ajax . request ( {
waitMsg : '正在删除数据...' ,
url : '/Import/ImportTrade/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 ) ;
this . calcDetailCntrTotal ( ) ;
this . setAllTotal ( ) ;
var KGS = this . formEdit . getForm ( ) . findField ( 'KGS' ) . getValue ( ) ;
this . formEdit . getForm ( ) . findField ( 'GROSSWEIGHT' ) . setValue ( KGS + 'KGS' ) ;
var CBM = this . formEdit . getForm ( ) . findField ( 'CBM' ) . getValue ( ) ;
this . formEdit . getForm ( ) . findField ( 'MEASUREMENT' ) . setValue ( CBM + 'CBM' ) ;
var PKGS = this . formEdit . getForm ( ) . findField ( 'PKGS' ) . getValue ( ) ;
var KINDPKGS = this . formEdit . getForm ( ) . findField ( 'KINDPKGS' ) . getValue ( ) ;
this . formEdit . getForm ( ) . findField ( 'NOPKGS' ) . setValue ( PKGS + KINDPKGS ) ;
this . formEdit . getForm ( ) . findField ( 'TOTALNO' ) . setValue ( 'SAY:' + ToEn ( PKGS ) . toUpperCase ( ) + ' ' + KINDPKGS + ' ONLY.' ) ;
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]);
}
} ,
setAllTotal : function ( ) {
this . setPKGSTotal ( ) ;
this . setKGSTotal ( ) ;
this . setCBMTotal ( ) ;
} ,
setPKGSTotal : function ( ) {
var total = this . calcDetailTotal ( 'PKGS' ) ;
this . setHeadFieldValue ( 'PKGS' , total ) ;
} ,
setKGSTotal : function ( ) {
var total = this . calcDetailTotal ( 'KGS' ) ;
this . setHeadFieldValue ( 'KGS' , total ) ;
} ,
setCBMTotal : function ( ) {
var total = this . calcDetailTotal ( 'CBM' ) ;
this . setHeadFieldValue ( 'CBM' , total ) ;
} ,
calcDetailTotal : function ( fieldName ) {
var total = 0 ;
for ( var i = 0 ; i < this . storeBodyList . getCount ( ) ; i += 1 ) {
var member = this . storeBodyList . getAt ( i ) ;
var value = member . get ( fieldName ) ;
total = Add ( total , value ) ;
}
return total ;
} ,
calcDetailCntrTotal : function ( ) {
var cntrstr = '' ;
for ( var i = 0 ; i < this . storeBodyList . getCount ( ) ; i += 1 ) {
var member = this . storeBodyList . getAt ( i ) ;
var cntr = member . get ( 'CNTRNO' ) + '/' + member . get ( 'SEALNO' ) + '/' + member . get ( 'CTNALL' ) ;
cntrstr = cntrstr + cntr + "\n" ;
}
this . setHeadFieldValue ( 'CNTRSEALNO' , cntrstr ) ;
} ,
setHeadFieldValue : function ( fieldName , value ) {
var field = this . formEdit . getForm ( ) . findField ( fieldName ) ;
field . setValue ( value ) ;
} ,
UpdateDetail : function ( ) {
var pkgs = 0 ;
var kgs = 0 ;
var cbm = 0 ;
var str _kind = '' ;
for ( var i = 0 ; i < this . storeBodyList . getCount ( ) ; i += 1 ) {
var member = this . storeBodyList . getAt ( i ) ;
var Bpkgs = member . get ( 'PKGS' ) ;
var Bkgs = member . get ( 'KGS' ) ;
var Bcbm = member . get ( 'CBM' ) ;
str _kind = member . get ( 'KINDPKGS' ) ;
pkgs = parseFloat ( pkgs ) . add ( parseFloat ( Bpkgs ) ) ;
kgs = parseFloat ( kgs ) . add ( parseFloat ( Bkgs ) ) ;
cbm = parseFloat ( cbm ) . add ( parseFloat ( Bcbm ) ) ;
}
this . formEdit . getForm ( ) . findField ( 'PKGS' ) . setValue ( pkgs ) ;
this . formEdit . getForm ( ) . findField ( 'KINDPKGS' ) . setValue ( str _kind ) ;
this . formEdit . getForm ( ) . findField ( 'NOPKGS' ) . setValue ( pkgs + str _kind ) ;
this . formEdit . getForm ( ) . findField ( 'TOTALNO' ) . setValue ( 'SAY:' + ToEn ( pkgs ) . toUpperCase ( ) + ' ' + str _kind + ' ONLY.' ) ;
this . formEdit . getForm ( ) . findField ( 'KGS' ) . setValue ( kgs ) ;
this . formEdit . getForm ( ) . findField ( 'GROSSWEIGHT' ) . setValue ( kgs + 'KGS' ) ;
this . formEdit . getForm ( ) . findField ( 'CBM' ) . setValue ( cbm ) ;
this . formEdit . getForm ( ) . findField ( 'MEASUREMENT' ) . setValue ( cbm + 'CBM' ) ;
} ,
//#endregion
//#region 直发舱单EDI
onSendDS : function ( carrier , iscgvessel , remarks ) {
var BSNO = this . formEdit . getForm ( ) . findField ( 'AS_ID' ) . getValue ( ) ;
Ext . Ajax . request ( {
waitMsg : '正在生成...' ,
url : '/Import/ImportTradeEdi/CustomBillEdiMail' ,
params : {
bsnos : BSNO ,
dcarrier : carrier ,
iscvessel : iscgvessel ,
remarks : remarks
} ,
callback : function ( options , success , response ) {
if ( success ) {
var result = Ext . JSON . decode ( response . responseText ) ;
if ( ! result . Success ) {
Ext . Msg . show ( {
title : '提示' ,
msg : result . Message ,
icon : Ext . MessageBox . ERROR ,
buttons : Ext . Msg . OK
} ) ;
return ;
} else {
Ext . Msg . show ( { title : '提示' , msg : result . Message , icon : Ext . Msg . INFO , buttons : Ext . Msg . OK } ) ;
}
} else {
Ext . MessageBox . alert ( '请求出现错误,请重试' , response . responseText ) ;
}
} ,
scope : this
} ) ;
} ,
//#endregion
//#region
LoadInit : function ( data ) {
var CUSTOMERNAME = this . MainEditRecord . CUSTOMERNAME ;
this . storeShipper . load ( { params : { condition : "shippertype=2 AND (ISPUBLIC=1 OR CODENAME IN (SELECT CODENAME FROM info_client WHERE SHORTNAME='" + CUSTOMERNAME + "') )" } ,
callback : function ( r , options , success ) {
if ( success ) {
this . formEdit . getForm ( ) . findField ( 'SHIPPERID' ) . setValue ( data . SHIPPERID ) ;
}
} ,
scope : this
} ) ;
this . storeConsignee . load ( { params : { condition : "shippertype=1 AND (ISPUBLIC=1 OR CODENAME IN (SELECT CODENAME FROM info_client WHERE SHORTNAME='" + CUSTOMERNAME + "') )" } ,
callback : function ( r , options , success ) {
if ( success ) {
this . formEdit . getForm ( ) . findField ( 'CONSIGNEEID' ) . setValue ( data . CONSIGNEEID ) ;
}
} ,
scope : this
} ) ;
this . storenotifyparty . load ( { params : { condition : "shippertype=3 AND (ISPUBLIC=1 OR CODENAME IN (SELECT CODENAME FROM info_client WHERE SHORTNAME='" + CUSTOMERNAME + "') )" } ,
callback : function ( r , options , success ) {
if ( success ) {
this . formEdit . getForm ( ) . findField ( 'NOTIFYPARTYID' ) . setValue ( data . NOTIFYPARTYID ) ;
}
} ,
scope : this
} ) ;
this . storeagent . load ( { params : { condition : "shippertype=4 AND (ISPUBLIC=1 OR CODENAME IN (SELECT CODENAME FROM info_client WHERE SHORTNAME='" + CUSTOMERNAME + "') )" } ,
callback : function ( r , options , success ) {
if ( success ) {
this . formEdit . getForm ( ) . findField ( 'AGENTID' ) . setValue ( data . AGENTID ) ;
}
} ,
scope : this
} ) ;
} ,
//#endregion
//#region 编辑时按钮等的状态
GetEditStatus : function ( ) {
var canedit = false ;
//var bsStatus = this.formHead.getForm().findField('BSSTATUS').getValue();
var BSSTATUS = this . formHead . getForm ( ) . findField ( 'BSSTATUSREF' ) . getValue ( ) ;
var inputby = this . formHead . getForm ( ) . findField ( 'INPUTBY' ) . getValue ( ) ;
var op = this . formHead . getForm ( ) . findField ( 'OP' ) . getValue ( ) ;
_this = this ;
if ( BSSTATUS == '锁定' ) {
canedit = false ;
this . setSaveBtnStatus ( canedit ) ;
} else {
this . StoreOpRange . load ( { params : { optype : "modImport" } ,
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 ) ;
}
}
} ) ;
}
_this = this ;
Ext . Ajax . request ( {
waitMsg : '正在查询委托编号状态...' ,
url : '/MvcShipping/MsBaseInfo/GetRuleEdit' ,
params : {
rulename : '委托编号' ,
ruletype : '1'
} ,
callback : function ( options , success , response ) {
if ( success ) {
var custno = _this . formHead . getForm ( ) . findField ( 'CUSTNO' ) ;
custno . setReadOnly ( true ) ;
} else {
Ext . MessageBox . alert ( '请求出现错误,请重试' , response . responseText ) ;
}
} ,
scope : this
} ) ;
Ext . Ajax . request ( {
waitMsg : '正在查询委托编号状态...' ,
url : '/MvcShipping/MsBaseInfo/GetRuleEdit' ,
params : {
rulename : '分提单号' ,
ruletype : '1'
} ,
callback : function ( options , success , response ) {
if ( success ) {
var hblno = _this . formHead . getForm ( ) . findField ( 'HBLNO' ) ;
hblno . setReadOnly ( true ) ;
} else {
Ext . MessageBox . alert ( '请求出现错误,请重试' , response . responseText ) ;
}
} ,
scope : this
} ) ;
} ,
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 ;
} ,
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 ( 'AS_ID' ) . value ;
var bsNo = basicForm . findField ( 'BSNO' ) . value ;
if ( billNo == '*' || billNo == '' || billNo == NaN ) {
Ext . Msg . show ( { title : '错误' , msg : '提单还没有保存,请保存后再打印' , icon : Ext . Msg . ERROR , buttons : Ext . Msg . OK } ) ;
return ;
}
var printType = 'MSOPBILL' ;
var sql1 = "SET LANGUAGE 'us_english' SELECT * FROM op_seae_billmanage WHERE AS_ID = '" + billNo + "'" ;
var sql2 = "SET LANGUAGE 'us_english' SELECT * FROM op_seae WHERE BSNO = '" + bsNo + "'" ;
var sql3 = "" ;
var sql4 = "" ;
var sql5 = "" ;
var sql6 = "" ;
PrintComm ( printType , sql1 , sql2 , sql3 , sql4 , sql5 , sql6 ) ;
}
// #endregion
} ) ;