Ext . namespace ( 'DsTruck' ) ;
DsTruck . MsWlPcEdit = function ( config ) {
Ext . applyIf ( this , config ) ;
this . initUIComponents ( ) ;
window . DsTruck . MsWlPcEdit . superclass . constructor . call ( this ) ;
} ;
Ext . extend ( DsTruck . MsWlPcEdit , Ext . Panel , {
ParentWin : null , //弹出式
ParentPanel : null , //Tab页编辑模式
FunType : '' ,
OpStatus : 'add' ,
StoreList : null ,
EditRecord : null ,
RefBillNo : '*' ,
formtype : "" ,
DataLoading : true ,
LoadFuel : 0 ,
NoLoadFuel : 0 ,
//主要是为了处理修改事件。使用focus和blur模拟change事件。
RealMil : 0 ,
OverLoadMil : 0 ,
NoLoadMil : 0 ,
Ton : 0 ,
initUIComponents : function ( ) {
this . fixSerialNo = 0 ;
this . fixBodyDel = [ ] ;
this . feeSerialNo = 0 ;
this . feeBodyDel = [ ] ;
//#region 编辑form
//枚举参照相关(编辑form)
this . storeBsType = Ext . create ( 'DsExt.ux.RefEnumStore' , { } ) ;
this . storeBsType . load ( { params : { enumTypeId : 99025 } } ) ;
this . comboxBsType = Ext . create ( 'DsExt.ux.RefEnumCombox' , {
fieldLabel : '托单类型' ,
store : this . storeBsType ,
name : 'BsType'
} ) ;
//表参照相关(编辑form)
this . storeTruckNo = Ext . create ( 'DsExt.ux.RefTableStore' , {
model : 'MsWlBsHeadRefMsWlTruck' ,
proxy : { url : '/TruckMng/MsWlPc/GetTruckNoList' }
} ) ;
this . storeTruckNo . load ( { params : { condition : "" } } ) ;
this . comboxTruckNo = Ext . create ( 'DsExt.ux.RefTableCombox' , {
fieldLabel : '车牌号' ,
store : this . storeTruckNo ,
name : 'TruckNo' ,
valueField : 'TruckNo' ,
displayField : 'TruckNo' ,
matchFieldWidth : true ,
listeners : {
change : function ( field , newValue , oldValue ) {
this . tonAndTruckNoChange ( field , newValue , oldValue ) ;
} ,
scope : this
}
} ) ;
this . storeDrvName = Ext . create ( 'DsExt.ux.RefTableStore' , {
model : 'MsWlBsHeadRefMsWlDriver' ,
proxy : { url : '/TruckMng/MsWlPc/GetDrvNameList' }
} ) ;
this . storeDrvName . load ( { params : { condition : "" } } ) ;
this . comboxDrvName = Ext . create ( 'DsExt.ux.RefTableCombox' , {
fieldLabel : '司机' ,
store : this . storeDrvName ,
name : 'DrvCode' ,
valueField : 'DrvCode' ,
displayField : 'CodeAndName' ,
listeners : {
scope : this ,
'select' : function ( combo , records , eOpts ) {
if ( records . length > 0 ) {
this . setDrvName ( records [ 0 ] . data . DrvCode ) ;
}
}
}
} ) ;
this . storeContainerType = Ext . create ( 'DsExt.ux.RefTableStore' , {
model : 'DsTruckMng.ux.CtnRefModel' ,
proxy : { url : '/CommMng/BasicDataRef/GetCtnRefList' }
} ) ;
this . storeContainerType . load ( { params : { condition : "" } } ) ;
this . comboxContainerType = Ext . create ( 'DsExt.ux.RefTableCombox' , {
fieldLabel : '箱型' ,
store : this . storeContainerType ,
name : 'ContainerType' ,
valueField : 'CtnCode' ,
displayField : 'CodeAndName'
} ) ;
this . storeContainerTypese = Ext . create ( 'DsExt.ux.RefTableStore' , {
model : 'DsTruckMng.ux.CtnRefModel' ,
proxy : { url : '/CommMng/BasicDataRef/GetCtnRefList' }
} ) ;
this . storeContainerTypese . load ( { params : { condition : "" } } ) ;
this . comboxContainerTypese = Ext . create ( 'DsExt.ux.RefTableCombox' , {
fieldLabel : '箱型' ,
store : this . storeContainerTypese ,
name : 'ContainerTypeSe' ,
valueField : 'CtnCode' ,
displayField : 'CodeAndName'
} ) ;
this . storeYardCode = Ext . create ( 'DsExt.ux.RefTableStore' , {
model : 'DsTruckMng.ux.CustomRefModel' ,
proxy : { url : '/CommMng/BasicDataRef/GetCustomRefList' }
} ) ;
this . storeYardCode . load ( { params : { condition : "ISYARD='1'" } } ) ;
this . comboxYardCode = Ext . create ( 'DsExt.ux.RefTableCombox' , {
fieldLabel : '拖箱场站' ,
store : this . storeYardCode ,
name : 'YardCode' ,
valueField : 'CustCode' ,
displayField : 'CodeAndName' ,
listeners : {
scope : this ,
'select' : function ( combo , records , eOpts ) {
if ( records . length > 0 ) {
var recs = DsStoreQueryBy ( this . storeYardCode , 'CustCode' , records [ 0 ] . data . CustCode ) ;
var custname = this . formEdit . getForm ( ) . findField ( 'YardName' ) ;
if ( recs . getCount ( ) > 0 ) {
var data = recs . getAt ( 0 ) . data ;
custname . setValue ( data . CustName ) ;
} else {
custname . setValue ( '' ) ;
}
}
}
}
} ) ;
this . comboxRtnYardCode = Ext . create ( 'DsExt.ux.RefTableCombox' , {
fieldLabel : '返箱场站' ,
store : this . storeYardCode ,
name : 'RtnYardCode' ,
valueField : 'CustCode' ,
displayField : 'CodeAndName'
} ) ;
this . comboxYardCodeSe = Ext . create ( 'DsExt.ux.RefTableCombox' , {
fieldLabel : '拖箱场站' ,
store : this . storeYardCode ,
name : 'YardCodeSe' ,
valueField : 'CustCode' ,
displayField : 'CodeAndName'
} ) ;
this . comboxRtnYardCodeSe = Ext . create ( 'DsExt.ux.RefTableCombox' , {
fieldLabel : '返箱场站' ,
store : this . storeYardCode ,
name : 'RtnYardCodeSe' ,
valueField : 'CustCode' ,
displayField : 'CodeAndName'
} ) ;
this . storeDdCode = Ext . create ( 'DsExt.ux.RefTableStore' , {
model : 'DsTruckMng.ux.UserRefModel' ,
proxy : { url : '/CommMng/BasicDataRef/GetUserRefList' }
} ) ;
this . storeDdCode . load ( { params : { condition : "" } } ) ;
this . comboxDdCode = Ext . create ( 'DsExt.ux.RefTableCombox' , {
fieldLabel : '调度员编码' ,
store : this . storeDdCode ,
name : 'DdCode' ,
valueField : 'UserCode' ,
displayField : 'CodeAndName'
} ) ;
this . storeVoyVeg = Ext . create ( 'DsExt.ux.RefTableStore' , {
model : 'DsTruckMng.ux.VoyRefModel' ,
proxy : { url : '/CommMng/BasicDataRef/GetVoyRefList' }
} ) ;
this . storeVoyVeg . load ( { params : { condition : "" } } ) ;
this . comboxVoyVeg = Ext . create ( 'DsExt.ux.RefTableCombox' , {
fieldLabel : '船名航次' ,
store : this . storeVoyVeg ,
name : 'VoyVeg' ,
valueField : 'VoyCode' ,
displayField : 'CodeAndName'
} ) ;
this . storeVoyVegSe = Ext . create ( 'DsExt.ux.RefTableStore' , {
model : 'DsTruckMng.ux.VoyRefModel' ,
proxy : { url : '/CommMng/BasicDataRef/GetVoyRefList' }
} ) ;
this . storeVoyVegSe . load ( { params : { condition : "" } } ) ;
this . comboxVoyVegSe = Ext . create ( 'DsExt.ux.RefTableCombox' , {
fieldLabel : '船名航次' ,
store : this . storeVoyVegSe ,
name : 'VoyVegSe' ,
valueField : 'VoyCode' ,
displayField : 'CodeAndName'
} ) ;
//封号
this . storeSealNo = Ext . create ( 'DsExt.ux.RefTableStore' , {
model : 'MsWlBsHeadRefMsSeals' ,
proxy : { url : '/TruckMng/MsWlPc/GetSealNoList' }
} ) ;
//this.storeSealNo.load({ params: { condition: ""} });
//箱号
this . storeContainerNo = Ext . create ( 'DsExt.ux.RefTableStore' , {
model : 'MsWlBsHeadRefMsContainers' ,
proxy : { url : '/TruckMng/MsWlPc/GetContainerNoList' }
} ) ;
//this.storeContainerNo.load({ params: { condition: ""} });
this . comboxContainerNo = Ext . create ( 'DsExt.ux.RefTableCombox' , {
fieldLabel : '箱号' ,
store : this . storeContainerNo ,
name : 'ContainerNo' ,
valueField : 'ContainerNo' ,
displayField : 'ContainerNo' ,
listeners : {
scope : this ,
'expand' : function ( field , eOpts ) {
var basicForm = this . formEdit . getForm ( ) ;
var pcbillNoValue = basicForm . findField ( 'BillNo' ) . value ;
var bsBillNoValue = basicForm . findField ( 'RefBillNo' ) . value ;
this . storeContainerNo . load ( { params : { pcbillNo : pcbillNoValue , bsBillNo : bsBillNoValue } } ) ;
} ,
'select' : function ( combo , records , eOpts ) {
if ( records . length > 0 ) {
var recs = DsStoreQueryBy ( this . storeSealNo , 'ContainerNo' , records [ 0 ] . data . ContainerNo ) ;
var basicForm = this . formEdit . getForm ( ) ;
var sealNo = basicForm . findField ( 'SealNo' ) ;
if ( recs . getCount ( ) > 0 ) {
var data = recs . getAt ( 0 ) . data ;
sealNo . setValue ( data . SealNo ) ;
} else {
sealNo . setValue ( '' ) ;
}
}
}
}
} ) ;
this . comboxContainerNoSe = Ext . create ( 'DsExt.ux.RefTableCombox' , {
fieldLabel : '箱号' ,
store : this . storeContainerNo ,
name : 'ContainerNoSe' ,
valueField : 'ContainerNo' ,
displayField : 'ContainerNo' ,
listeners : {
scope : this ,
'expand' : function ( field , eOpts ) {
var basicForm = this . formEdit . getForm ( ) ;
var pcbillNoValue = basicForm . findField ( 'BillNo' ) . value ;
var bsBillNoValue = basicForm . findField ( 'RefBillNo' ) . value ;
this . storeContainerNo . load ( { params : { pcbillNo : pcbillNoValue , bsBillNo : bsBillNoValue } } ) ;
} ,
'select' : function ( combo , records , eOpts ) {
if ( records . length > 0 ) {
var recs = DsStoreQueryBy ( this . storeSealNo , 'ContainerNo' , records [ 0 ] . data . ContainerNo ) ;
var basicForm = this . formEdit . getForm ( ) ;
var sealNo = basicForm . findField ( 'SealNoSe' ) ;
if ( recs . getCount ( ) > 0 ) {
var data = recs . getAt ( 0 ) . data ;
sealNo . setValue ( data . SealNo ) ;
} else {
sealNo . setValue ( '' ) ;
}
}
}
}
} ) ;
this . storeCustomerName = Ext . create ( 'DsExt.ux.RefTableStore' , {
model : 'Tradermb' ,
proxy : { url : '/CommMng/BasicDataRef/GetTrader' }
} ) ;
this . storeCustomerName . load ( { params : { condition : "" } } ) ;
this . comboxCustomerName = Ext . create ( 'DsExt.ux.RefTableCombox' , {
fieldLabel : '客户' , id : "CustomerName" , hidden : true ,
forceSelection : true ,
store : this . storeCustomerName ,
name : 'CustomerName' ,
valueField : 'name' ,
displayField : 'codename'
} ) ;
this . storeF _CustomerName = Ext . create ( 'DsExt.ux.RefTableStore' , {
model : 'Tradermb' ,
proxy : { url : '/CommMng/BasicDataRef/GetTrader' }
} ) ;
this . storeF _CustomerName . load ( { params : { condition : "" } } ) ;
this . comboxF _CustomerName = Ext . create ( 'DsExt.ux.RefTableCombox' , {
fieldLabel : '最终客户' , id : "F_CustomerName" , hidden : true ,
forceSelection : true ,
store : this . storeF _CustomerName ,
name : 'F_CustomerName' ,
valueField : 'name' ,
displayField : 'codename'
} ) ;
//编辑form
this . formEdit = Ext . widget ( 'form' , {
region : 'center' ,
frame : true ,
bodyPadding : 5 ,
autoScroll : true ,
fieldDefaults : {
margins : '2 2 2 2' ,
labelAlign : 'right' ,
flex : 1 ,
labelWidth : 90 ,
msgTarget : 'qtip'
} ,
items : [
{
//fieldset 1
xtype : 'fieldset' ,
defaultType : 'textfield' ,
layout : 'anchor' ,
defaults : {
anchor : '100%'
} ,
items : [ {
xtype : 'container' ,
layout : 'hbox' ,
defaultType : 'textfield' ,
items : [
//#region 界面需要的但不需要显示的控件
{
fieldLabel : '录入日期' ,
name : 'LrDate' ,
flex : 0 ,
hidden : true ,
margins : '0'
} , {
fieldLabel : '记账日期' ,
name : 'JzDate' ,
flex : 0 ,
hidden : true ,
margins : '0'
} , {
fieldLabel : '用户编码' ,
name : 'UserCode' ,
flex : 0 ,
hidden : true ,
margins : '0'
} , {
fieldLabel : '用户姓名' ,
name : 'UserName' ,
flex : 0 ,
hidden : true ,
margins : '0'
} , {
fieldLabel : '组织编码' ,
name : 'OrgCode' ,
flex : 0 ,
hidden : true ,
margins : '0'
} , {
fieldLabel : '组织名称' ,
name : 'OrgName' ,
flex : 0 ,
hidden : true ,
margins : '0'
} , {
fieldLabel : '司机姓名' ,
name : 'DrvName' ,
flex : 0 ,
hidden : true ,
margins : '0'
} , {
fieldLabel : '开船日期' ,
name : 'EtDate' ,
flex : 0 ,
hidden : true ,
margins : '0'
} , {
fieldLabel : '截港日期' ,
name : 'EndPortDate' ,
flex : 0 ,
hidden : true ,
margins : '0'
} , {
fieldLabel : '场站名称' ,
name : 'YardName' ,
flex : 0 ,
hidden : true ,
margins : '0'
} , {
fieldLabel : '周转量' ,
name : 'AroundTon' ,
flex : 0 ,
hidden : true ,
margins : '0'
} , {
fieldLabel : '运输次数' ,
name : 'LoadCount' ,
flex : 0 ,
hidden : true ,
margins : '0'
} , {
fieldLabel : '调度员姓名' ,
name : 'DdName' ,
flex : 0 ,
hidden : true ,
margins : '0'
} , {
fieldLabel : '相关托单结算客户' ,
name : 'RefCustomerName' ,
flex : 0 ,
hidden : true ,
margins : '0'
} , {
fieldLabel : '时间戳' ,
name : 'TimeMark' ,
flex : 0 ,
hidden : true ,
margins : '0'
} ,
{
fieldLabel : '相关托单物流号' ,
name : 'RefBillNo' ,
flex : 0 ,
hidden : true ,
margins : '0'
} , {
fieldLabel : '单据锁定状态' ,
name : 'BillStatus' ,
flex : 0 ,
hidden : true ,
margins : '0'
} , {
fieldLabel : '费用锁定状态' ,
name : 'FeeStatus' ,
flex : 0 ,
hidden : true ,
margins : '0'
} , {
fieldLabel : 'GId' ,
name : 'GId' ,
flex : 0 ,
hidden : true ,
margins : '0'
} ,
//#endregion
{
fieldLabel : '物流号' ,
allowBlank : false ,
disabled : true ,
name : 'BillNo'
} , this . comboxDdCode , this . comboxTruckNo , this . comboxBsType
]
} , {
xtype : 'container' ,
layout : 'hbox' ,
defaultType : 'textfield' ,
items : [ this . comboxDrvName , {
fieldLabel : '司机手机' ,
name : 'Mobile'
} , {
fieldLabel : '派车日期' ,
format : 'Y-m-d' ,
xtype : 'datefield' ,
name : 'ExpDate' ,
listeners : {
change : function ( field , eOpts ) {
if ( field . lastValue != "" ) {
//this.storeTruckNo.load({ params: { condition: " ORGCODE=(select CODENAME from company where GID='" + field.lastValue + "') "} });
var returndate = ( this . formEdit . getForm ( ) . findField ( 'ReturnDate' ) . getRawValue ( ) ) ;
if ( returndate == "" || returndate == null ) {
this . formEdit . getForm ( ) . findField ( 'ReturnDate' ) . setValue ( field . rawValue )
}
var ACCDATE = ( this . formEdit . getForm ( ) . findField ( 'ACCDATE' ) . getRawValue ( ) ) ;
if ( ACCDATE == "" || ACCDATE == null ) {
_M = field . lastValue . getMonth ( ) + 1 ;
var _M2 = "" ;
if ( _M < 10 ) {
_M2 = "0" + _M ;
} else {
_M2 = "" + _M ;
}
_a = field . lastValue . getFullYear ( ) + '-' + _M2 ;
this . formEdit . getForm ( ) . findField ( 'ACCDATE' ) . setValue ( _a ) ;
//this.formEdit.getForm().findField('ReturnDate').setValue(field.lastValue);
}
}
this . Cansearch = false ;
} ,
scope : this
}
} , this . comboxVoyVeg
]
} , {
xtype : 'container' ,
layout : 'hbox' ,
defaultType : 'textfield' ,
items : [ {
fieldLabel : '提单号' ,
name : 'MblNo'
} , this . comboxContainerType , this . comboxContainerNo , {
fieldLabel : '封号' ,
name : 'SealNo'
}
]
} , {
xtype : 'container' ,
layout : 'hbox' ,
defaultType : 'textfield' ,
items : [ this . comboxYardCode , this . comboxRtnYardCode , {
fieldLabel : '始发地点' ,
name : 'LoadPlace'
} , {
fieldLabel : '目的地' ,
name : 'DstArea'
}
]
} , {
xtype : 'container' ,
layout : 'hbox' ,
defaultType : 'textfield' ,
items : [ {
fieldLabel : '工厂地址' ,
name : 'DetiNation'
}
]
} , {
xtype : 'container' ,
layout : 'hbox' ,
defaultType : 'textfield' ,
items : [ {
fieldLabel : '联系电话' ,
name : 'LinkTel'
} , {
fieldLabel : '联系人' ,
name : 'LinkMan'
} , {
fieldLabel : '实际重量' ,
name : 'ActualWeight'
} , {
fieldLabel : '本次加油量' ,
xtype : 'numberfield' ,
allowBlank : false ,
hideTrigger : true ,
keyNavEnabled : false ,
mouseWheelEnabled : false ,
disabled : true ,
name : 'FuelQty'
}
]
} , {
xtype : 'container' ,
layout : 'hbox' ,
defaultType : 'textfield' ,
items : [ {
fieldLabel : '实际里程' ,
xtype : 'numberfield' ,
allowBlank : false ,
name : 'RealMil' ,
hideTrigger : true ,
keyNavEnabled : false ,
mouseWheelEnabled : false ,
listeners : {
focus : function ( field , eOpts ) {
this . RealMil = field . value ;
} ,
blur : function ( field , eOpts ) {
var newValue = field . value ;
this . realMilChange ( field , newValue , this . RealMil ) ;
} ,
scope : this
}
} , this . comboxCustomerName
, {
fieldLabel : '重驶里程' , id : "OverLoadMil" ,
xtype : 'numberfield' ,
allowBlank : false ,
name : 'OverLoadMil' ,
hideTrigger : true ,
keyNavEnabled : false ,
mouseWheelEnabled : false ,
listeners : {
focus : function ( field , eOpts ) {
this . OverLoadMil = field . value ;
} ,
blur : function ( field , eOpts ) {
var newValue = field . value ;
this . overLoadMilChange ( field , newValue , this . OverLoadMil ) ;
} ,
scope : this
}
} , this . comboxF _CustomerName
, {
fieldLabel : '空驶里程' , id : "NoLoadMil" ,
xtype : 'numberfield' ,
allowBlank : false ,
name : 'NoLoadMil' ,
hideTrigger : true ,
keyNavEnabled : false ,
mouseWheelEnabled : false ,
listeners : {
focus : function ( field , eOpts ) {
this . NoLoadMil = field . value ;
} ,
blur : function ( field , eOpts ) {
var newValue = field . value ;
this . noLoadMilChange ( field , newValue , this . NoLoadMil ) ;
} ,
scope : this
}
}
]
} , {
xtype : 'container' ,
layout : 'hbox' ,
defaultType : 'textfield' ,
items : [ {
fieldLabel : '货重(吨)' ,
xtype : 'numberfield' ,
allowBlank : false ,
name : 'Ton' ,
hideTrigger : true ,
keyNavEnabled : false ,
mouseWheelEnabled : false ,
listeners : {
focus : function ( field , eOpts ) {
this . Ton = field . value ;
} ,
blur : function ( field , eOpts ) {
var newValue = field . value ;
this . tonAndTruckNoChange ( field , newValue , this . Ton ) ;
} ,
scope : this
}
} , {
fieldLabel : '重驶油耗' ,
xtype : 'numberfield' ,
allowBlank : false ,
hideTrigger : true ,
keyNavEnabled : false ,
mouseWheelEnabled : false ,
name : 'LoadFuel'
} , {
fieldLabel : '空驶油耗' ,
xtype : 'numberfield' ,
allowBlank : false ,
hideTrigger : true ,
keyNavEnabled : false ,
mouseWheelEnabled : false ,
name : 'NoLoadFuel'
}
]
} , {
xtype : 'container' ,
layout : 'hbox' ,
defaultType : 'textfield' ,
items : [ {
fieldLabel : '额定油耗' ,
xtype : 'numberfield' ,
allowBlank : false ,
hideTrigger : true ,
keyNavEnabled : false ,
mouseWheelEnabled : false ,
name : 'RatedFuel'
} , {
fieldLabel : '截港日期' , id : "CutoffTime" , hidden : true ,
format : 'Y-m-d' ,
xtype : 'datefield' ,
name : 'CutoffTime'
} , {
fieldLabel : '实际油耗' , id : "RealFuel" ,
xtype : 'numberfield' ,
allowBlank : false ,
hideTrigger : true ,
keyNavEnabled : false ,
mouseWheelEnabled : false ,
name : 'RealFuel'
} , {
xtype : 'checkbox' , id : "isEnd" , hidden : true ,
fieldLabel : '运行完成' ,
name : 'isEnd'
} , {
fieldLabel : '运行次数' , id : "RunTimes" ,
xtype : 'numberfield' ,
allowBlank : false ,
hideTrigger : true ,
keyNavEnabled : false ,
mouseWheelEnabled : false ,
allowDecimals : false ,
name : 'RunTimes'
} , {
fieldLabel : '额定里程' ,
xtype : 'numberfield' ,
allowBlank : false ,
name : 'RatedMil' ,
hideTrigger : true ,
keyNavEnabled : false ,
mouseWheelEnabled : false ,
hidden : true
}
]
} , {
xtype : 'container' ,
layout : 'hbox' ,
defaultType : 'textfield' ,
items : [ {
fieldLabel : '变动里程' , id : "ChangedMil" ,
xtype : 'numberfield' ,
allowBlank : false ,
hideTrigger : true ,
keyNavEnabled : false ,
mouseWheelEnabled : false ,
name : 'ChangedMil'
} , {
fieldLabel : '变动油耗' , id : "ChangedFuel" ,
xtype : 'numberfield' ,
allowBlank : false ,
hideTrigger : true ,
keyNavEnabled : false ,
mouseWheelEnabled : false ,
name : 'ChangedFuel'
} , {
fieldLabel : '变动原因' , id : "ChangedReson" ,
name : 'ChangedReson'
}
]
} , {
xtype : 'container' ,
layout : 'hbox' ,
defaultType : 'textfield' ,
items : [ {
fieldLabel : '到厂日期' ,
format : 'Y-m-d' ,
xtype : 'datefield' ,
name : 'ArriveDate'
} , {
fieldLabel : '到厂时间' ,
name : 'ArriveTime'
} , {
fieldLabel : '返回日期' ,
format : 'Y-m-d' ,
xtype : 'datefield' ,
name : 'ReturnDate'
} , {
fieldLabel : '统计期间' ,
name : 'ACCDATE' ,
xtype : 'monthfield'
}
]
} , {
xtype : 'container' ,
layout : 'hbox' ,
defaultType : 'textfield' ,
items : [ {
fieldLabel : '客户联系人姓名' ,
flex : 2 ,
name : 'CustLikeManName'
} , {
fieldLabel : '客户联系电话' ,
flex : 2 ,
name : 'CustTel'
} , {
fieldLabel : '发票抬头' ,
flex : 2 ,
name : 'BillRises1'
} , {
xtype : 'checkboxfield' ,
fieldLabel : '是否双背' ,
flex : 1 ,
allowBlank : false ,
name : 'IsDouble' ,
listeners : {
change : function ( field , newValue , oldValue , eOpts ) {
Ext . getCmp ( 'fdDouble' ) . setVisible ( newValue ) ;
}
}
} , {
fieldLabel : '返回时间' ,
name : 'ReturnTime'
}
]
} , {
xtype : 'container' ,
layout : 'hbox' ,
defaultType : 'textarea' ,
items : [ {
fieldLabel : '备注' ,
name : 'Remark'
}
]
}
] //end items(fieldset 1)
} , //end fieldset 1
{
//fieldset 2
xtype : 'fieldset' ,
//checkboxToggle: true,
//collapsed: true,
hidden : true ,
id : 'fdDouble' ,
defaultType : 'textfield' ,
layout : 'anchor' ,
defaults : {
anchor : '100%'
} ,
items : [ {
xtype : 'container' ,
layout : 'hbox' ,
defaultType : 'textfield' ,
items : [ {
fieldLabel : '托单物流号' ,
name : 'RefBillNoSe' ,
listeners : {
change : function ( field , newValue , oldValue ) {
this . refBillNoSeChange ( field , newValue , oldValue ) ;
} ,
scope : this
}
} , {
fieldLabel : '提单号' ,
name : 'MblNoSe'
}
]
} , {
xtype : 'container' ,
layout : 'hbox' ,
defaultType : 'textfield' ,
items : [ this . comboxVoyVegSe
, this . comboxContainerTypese
, {
fieldLabel : '箱量' ,
name : 'ContainerQtySe'
}
]
} , {
xtype : 'container' ,
layout : 'hbox' ,
defaultType : 'textfield' ,
items : [ {
fieldLabel : '开船日期' ,
format : 'Y-m-d' ,
xtype : 'datefield' ,
name : 'EtDateSe'
} , {
fieldLabel : '截港日期' ,
format : 'Y-m-d' ,
xtype : 'datefield' ,
name : 'EndPortDateSe'
} , this . comboxYardCodeSe
]
} , {
xtype : 'container' ,
layout : 'hbox' ,
defaultType : 'textfield' ,
items : [ this . comboxRtnYardCodeSe , {
fieldLabel : '联系人' ,
name : 'LinkManSe'
} , {
fieldLabel : '联系电话' ,
name : 'LinkTelSe'
}
]
} , {
xtype : 'container' ,
layout : 'hbox' ,
defaultType : 'textfield' ,
items : [ {
fieldLabel : '目的地' ,
name : 'DstAreaSe'
} , {
fieldLabel : '工厂地址' ,
name : 'DetiNationSe' ,
flex : 2
}
]
} , {
xtype : 'container' ,
layout : 'hbox' ,
defaultType : 'textfield' ,
items : [ this . comboxContainerNoSe , {
fieldLabel : '封号' ,
name : 'SealNoSe'
}
]
}
] //end items(fieldset 1)
} //end fieldset 2
] //end root items
} ) ; //end this.formEdit
//#endregion
//#region 按钮Toolbar
this . panelBtn = new Ext . Panel ( {
region : "north" ,
tbar : [
{
id : 'pcbtnSave' ,
text : "保存" ,
iconCls : "btnsave" ,
handler : function ( button , event ) {
this . Save ( '0' ) ;
} ,
scope : this
} ,
{
id : 'pcbtnSaveAndClose' ,
text : "保存并关闭" ,
handler : function ( button , event ) {
this . Save ( '1' ) ;
} ,
scope : this
} ,
'-' ,
{
id : 'pcbtnSaveAndNew' ,
text : "保存并新建" ,
handler : function ( button , event ) {
this . Save ( '2' ) ;
} ,
scope : this
} ,
'-' ,
{
text : "关闭" ,
handler : function ( button , event ) {
window . close ( ) ;
} ,
scope : this
} ,
{
id : 'pcbtnNew' ,
text : "新建" ,
handler : function ( button , event ) {
this . LoadData ( 'add' , '' , this . RefBillNo ) ;
var basicForm = this . formEdit . getForm ( ) ;
basicForm . findField ( 'BillNo' ) . setDisabled ( false ) ;
} ,
scope : this
} ,
'-' ,
{
text : "打印" ,
iconCls : "btnprint" ,
handler : function ( button , event ) {
this . Print ( ) ;
} ,
scope : this
}
]
} ) ; //end 按钮Toolbar
//#endregion
//#region 固定费用明细表
//明细表表格相关
this . storeCreditDebitRef = Ext . create ( 'DsExt.ux.RefEnumStore' , { } ) ;
this . storeCreditDebitRef . load ( { params : { enumTypeId : 99020 } } ) ;
this . comboxCreditDebitRef = Ext . create ( 'DsExt.ux.RefEnumCombox' , {
store : this . storeCreditDebitRef ,
name : 'CreditDebit'
} ) ;
this . storeFeeTypeCodeRef = Ext . create ( 'DsExt.ux.RefTableStore' , {
model : 'DsTruckMng.ux.FeeTypeRefModel' ,
proxy : { url : '/CommMng/BasicDataRef/GetFeeTypeRefList' }
} ) ;
this . storeFeeTypeCodeRef . load ( { params : { condition : "ISTRUCKING='1' and ISTRUCKINGFIXED ='1'" } } ) ;
this . comboxFeeTypeCodeRef = Ext . create ( 'DsExt.ux.RefTableCombox' , {
store : this . storeFeeTypeCodeRef ,
name : 'FeeTypeCode' ,
valueField : 'FeeCode' ,
displayField : 'CodeAndName'
} ) ;
//明细表-数据集
this . storeBodyFix = Ext . create ( 'Ext.data.Store' , {
model : 'MsWlPcFixed' ,
remoteSort : false ,
proxy : {
type : 'ajax' ,
url : '/TruckMng/MsWlPc/GetFeeFixBodyList' ,
reader : {
id : 'GId' ,
root : 'data' ,
totalProperty : 'totalCount'
}
}
} ) ;
//明细表表格
this . cellEditingFix = Ext . create ( 'Ext.grid.plugin.CellEditing' , {
clicksToEdit : 1
} ) ;
this . gridListFix = new Ext . grid . GridPanel ( {
store : this . storeBodyFix ,
enableHdMenu : false ,
region : 'center' ,
loadMask : { msg : "数据加载中,请稍等..." } ,
trackMouseOver : true ,
disableSelection : false ,
plugins : [ this . cellEditingFix ] ,
selType : 'cellmodel' ,
tbar : [ {
text : '增加明细' ,
tooltip : '增加明细' ,
iconCls : "btnadddetail" ,
handler : function ( button , event ) {
this . onAddDetailClick ( button , event , '1' ) ;
} ,
scope : this
} , '-' , {
text : '删除明细' ,
tooltip : '删除明细' ,
iconCls : "btndeletedetail" ,
handler : function ( button , event ) {
this . onDelDetailClick ( button , event , '1' ) ;
} ,
scope : this
} ] ,
columns : [ {
sortable : true ,
dataIndex : 'BillNo' ,
header : '单据号' ,
hidden : true ,
width : 120
} , {
sortable : true ,
dataIndex : 'SerialNo' ,
header : '序号' ,
width : 40
} , {
sortable : true ,
dataIndex : 'FeeTypeCode' ,
header : '费用编码' ,
renderer : function ( value , p , record ) {
if ( value == null || value == '' )
return '' ;
else
return value + '-' + record . data . FeeTypeCode _Ref ;
} ,
editor : this . comboxFeeTypeCodeRef ,
width : 80
} , {
sortable : true ,
dataIndex : 'FeeTypeName' ,
header : '费用名称' ,
hidden : true ,
width : 120
} , {
sortable : true ,
dataIndex : 'FsTotal' ,
header : '金额' ,
editor : {
xtype : 'numberfield' ,
allowBlank : false ,
selectOnFocus : true
} ,
width : 60
} , {
sortable : true ,
dataIndex : 'Remark' ,
header : '备注' ,
editor : {
xtype : 'textfield' ,
selectOnFocus : true
} ,
width : 150
}
]
} ) ;
this . gridListFix . on ( 'edit' , function ( editor , e , eOpts ) {
this . gridListFixAfterEdit ( editor , e , eOpts ) ;
} , this ) ;
this . cellEditingFix . on ( 'beforeedit' , function ( editor , e ) {
return this . cellEditingFixBeforeEdit ( editor , e ) ;
} , this ) ;
//#endregion 明细表
//#region 费用表
//明细表表格相关
this . storeFeeTypeRef = Ext . create ( 'DsExt.ux.RefEnumStore' , { } ) ;
this . storeFeeTypeRef . load ( { params : { enumTypeId : 99020 } } ) ;
this . comboxFeeTypeRef = Ext . create ( 'DsExt.ux.RefEnumCombox' , {
store : this . storeFeeTypeRef ,
name : 'FeeType'
} ) ;
this . storeFeeNameRef = Ext . create ( 'DsExt.ux.RefTableStore' , {
model : 'DsTruckMng.ux.FeeTypeRefModel' ,
proxy : { url : '/CommMng/BasicDataRef/GetFeeTypeRefList' }
} ) ;
this . storeFeeNameRef . load ( { params : { condition : "ISTRUCKING='1' " } } ) ;
this . comboxFeeNameRef = Ext . create ( 'DsExt.ux.RefTableCombox' , {
store : this . storeFeeNameRef ,
name : 'FeeName' ,
valueField : 'Name' ,
displayField : 'CodeAndName'
} ) ;
this . storeCustomerNameRef = Ext . create ( 'DsExt.ux.RefTableStore' , {
model : 'DsTruckMng.ux.CustomRefModel' ,
proxy : { url : '/CommMng/BasicDataRef/GetCustomRefList' }
} ) ;
this . storeCustomerNameRef . load ( { params : { condition : "" } } ) ;
this . comboxCustomerNameRef = Ext . create ( 'DsExt.ux.RefTableCombox' , {
store : this . storeCustomerNameRef ,
name : 'CustomerName' ,
valueField : 'CustName' ,
displayField : 'CodeAndName'
} ) ;
//明细表-数据集
this . storeBodyChFee = Ext . create ( 'Ext.data.Store' , {
model : 'MsChFee' ,
remoteSort : false ,
proxy : {
type : 'ajax' ,
url : '/TruckMng/MsChFee/GetDataList' ,
reader : {
id : 'GId' ,
root : 'data' ,
totalProperty : 'totalCount'
}
}
} ) ;
//明细表表格
this . cellEditingChFee = Ext . create ( 'Ext.grid.plugin.CellEditing' , {
clicksToEdit : 1
} ) ;
this . feeGridCheckBoxModel = Ext . create ( 'Ext.selection.CheckboxModel' ) ;
this . gridListChFee = new Ext . grid . GridPanel ( {
store : this . storeBodyChFee ,
enableHdMenu : false ,
region : 'center' ,
loadMask : { msg : "数据加载中,请稍等..." } ,
trackMouseOver : true ,
disableSelection : false ,
plugins : [ this . cellEditingChFee ] ,
selModel : this . feeGridCheckBoxModel ,
selType : 'cellmodel' ,
viewConfig : {
autoFill : true ,
getRowClass : function ( record , rowIndex , rowParams , store ) {
var feeStatus = record . get ( 'FeeStatus' ) ;
return DsTruck . MsChFeeGetRowClass ( feeStatus ) ;
}
} ,
tbar : [ {
text : '增加明细' ,
tooltip : '增加明细' ,
iconCls : "btnadddetail" ,
handler : function ( button , event ) {
this . onAddDetailClick ( button , event , '2' ) ;
} ,
scope : this
} , '-' , {
text : '删除明细' ,
tooltip : '删除明细' ,
iconCls : "btndeletedetail" ,
handler : function ( button , event ) {
this . onDelDetailClick ( button , event , '2' ) ;
} ,
scope : this
} , '-' , {
text : '提交审核' ,
tooltip : '提交审核' ,
iconCls : 'btnsubmitaudit' ,
handler : function ( button , event ) {
this . onSubmitAuditClick ( button , event ) ;
} ,
scope : this
} ] ,
columns : [ {
sortable : true ,
dataIndex : 'GId' ,
header : '惟一编号' ,
hidden : true ,
width : 160
} , {
sortable : true ,
dataIndex : 'BsNo' ,
header : '业务编号' ,
hidden : true ,
width : 200
} , {
sortable : true ,
dataIndex : 'FeeStatus' ,
header : '费用状态' ,
renderer : function ( value , p , record ) {
return record . data . FeeStatus _Ref ;
} ,
width : 66
} , {
sortable : true ,
dataIndex : 'FeeName' ,
header : '费用名称' ,
editor : this . comboxFeeNameRef ,
width : 100
} , {
sortable : true ,
dataIndex : 'FeeType' ,
header : '收付方式' ,
renderer : function ( value , p , record ) {
if ( value == null || value == '' )
return '' ;
else
return value + '-' + record . data . FeeType _Ref ;
} ,
editor : this . comboxFeeTypeRef ,
width : 66
} , {
sortable : true ,
dataIndex : 'IsInvoice' ,
header : '不开发票' ,
editor : {
xtype : 'checkboxfield' ,
inputValue : '1' ,
uncheckedValue : '0'
// selectOnFocus: true
} ,
renderer : function ( value , cellmeta ) {
if ( value == '1' || value == true || value == "True" ) {
return "√" ;
}
} ,
width : 60
} , {
sortable : true ,
dataIndex : 'FeeDescription' ,
header : '费用英文名称' ,
hidden : true ,
width : 200
} , {
sortable : true ,
dataIndex : 'CustomerType' ,
header : '客户类别' ,
hidden : true ,
width : 200
} , {
sortable : true ,
dataIndex : 'CustomerName' ,
header : '结算对象' ,
editor : this . comboxCustomerNameRef ,
width : 120
} , {
sortable : true ,
dataIndex : 'Unit' ,
header : '单位标准' ,
hidden : true ,
width : 200
} , {
sortable : true ,
dataIndex : 'UnitPrice' ,
header : '单价' ,
editor : {
xtype : 'numberfield' ,
selectOnFocus : true
} ,
width : 60
} , {
sortable : true ,
dataIndex : 'Quantity' ,
header : '数量' ,
editor : {
xtype : 'numberfield' ,
selectOnFocus : true
} ,
width : 60
} , {
sortable : true ,
dataIndex : 'Amount' ,
header : '金额' ,
width : 60
} , {
sortable : true ,
dataIndex : 'Currency' ,
header : '币别' ,
hidden : true ,
width : 200
} , {
sortable : true ,
dataIndex : 'ExChangerate' ,
header : '汇率' ,
hidden : true ,
width : 160
} , {
sortable : true ,
dataIndex : 'Reason' ,
header : '原因' ,
hidden : true ,
width : 200
} , {
sortable : true ,
dataIndex : 'Remark' ,
header : '备注' ,
editor : {
xtype : 'textfield' ,
selectOnFocus : true
} ,
width : 150
}
]
} ) ;
this . gridListChFee . on ( 'edit' , function ( editor , e , eOpts ) {
this . gridListChFeeAfterEdit ( editor , e , eOpts ) ;
} , this ) ;
this . cellEditingChFee . on ( 'beforeedit' , function ( editor , e ) {
return this . cellEditingChFeeBeforeEdit ( editor , e ) ;
} , this ) ;
//#endregion
//#region 布局
this . panelTop = new Ext . Panel ( {
layout : "border" ,
region : "north" ,
height : 320 ,
split : true ,
items : [ this . panelBtn , this . formEdit ]
} ) ;
this . panelBodyFix = new Ext . Panel ( {
title : '固定费用(仅报销,不计入利润统计)' ,
layout : "border" ,
region : 'west' ,
width : 270 ,
margin : '5 10' ,
items : [ this . gridListFix ]
} ) ;
this . panelBodyChFee = new Ext . Panel ( {
title : '费用(计入利润统计的应收应付)' ,
layout : "border" ,
region : 'center' ,
margin : '5 10' ,
items : [ this . gridListChFee ]
} ) ;
this . panelFee = new Ext . Panel ( {
layout : "border" ,
region : "center" ,
split : true ,
items : [
this . panelBodyFix , this . panelBodyChFee
]
} ) ;
Ext . apply ( this , {
items : [ this . panelTop , this . panelFee ]
} ) ;
//#endregion
this . opStatus = 'add' ;
parentWin = window . parent . opener ;
{
if ( parentWin ) {
var ret = parentWin . OprationSwap ( ) ;
var fun = ret [ 4 ] ;
if ( fun ) {
this . FunType = fun ;
if ( fun == "MsRptPcHeadQryIndex" || fun == 'MsRptWlTransIndex' ) {
this . opStatus = ret [ 0 ] ;
this . StoreList = ret [ 1 ] ;
this . editRecord = ret [ 2 ] ;
this . RefBillNo = ret [ 3 ] ;
this . formtype = ret [ 5 ] ;
if ( fun == "MsRptPcHeadQryIndex" )
this . setSaveBtnStatus ( false ) ;
else if ( fun == 'MsRptWlTransIndex' ) {
this . setBtnOnlyQuery ( ) ;
}
this . InitData ( ) ;
}
}
}
}
} , //end initUIComponents
//#region 加载数据
InitData : function ( ) {
var condition = '' ;
if ( this . ParentPanel ) {
var ret = this . ParentPanel . OprationSwap ( ) ;
this . opStatus = ret [ 0 ] ;
this . StoreList = ret [ 1 ] ;
this . editRecord = ret [ 2 ] ;
this . RefBillNo = ret [ 3 ] ;
this . formtype = ret [ 5 ] ;
}
if ( this . formtype == 'Qry' ) {
Ext . getCmp ( "OverLoadMil" ) . show ( ) ;
Ext . getCmp ( "NoLoadMil" ) . show ( ) ;
Ext . getCmp ( "RealFuel" ) . show ( ) ;
Ext . getCmp ( "RunTimes" ) . show ( ) ;
Ext . getCmp ( "ChangedMil" ) . show ( ) ;
Ext . getCmp ( "ChangedFuel" ) . show ( ) ;
Ext . getCmp ( "ChangedReson" ) . show ( ) ;
Ext . getCmp ( "CustomerName" ) . hide ( ) ;
Ext . getCmp ( "F_CustomerName" ) . hide ( ) ;
Ext . getCmp ( "CutoffTime" ) . hide ( ) ;
Ext . getCmp ( "isEnd" ) . hide ( ) ;
}
if ( this . formtype == 'Operate' ) {
Ext . getCmp ( "OverLoadMil" ) . hide ( ) ;
Ext . getCmp ( "NoLoadMil" ) . hide ( ) ;
Ext . getCmp ( "RealFuel" ) . hide ( ) ;
Ext . getCmp ( "RunTimes" ) . hide ( ) ;
Ext . getCmp ( "ChangedMil" ) . hide ( ) ;
Ext . getCmp ( "ChangedFuel" ) . hide ( ) ;
Ext . getCmp ( "ChangedReson" ) . hide ( ) ;
Ext . getCmp ( "CustomerName" ) . show ( ) ;
Ext . getCmp ( "F_CustomerName" ) . show ( ) ;
Ext . getCmp ( "CutoffTime" ) . show ( ) ;
Ext . getCmp ( "isEnd" ) . show ( ) ;
}
if ( this . opStatus == 'add' ) {
condition = " BillNo='*'" ;
} else if ( this . opStatus == 'edit' ) {
if ( this . FunType == 'MsRptPcHeadQryIndex' ) {
condition = " BillNo='" + this . editRecord . get ( 'BillNo' ) + "'" ;
} else {
condition = " BillNo='" + this . editRecord . get ( 'BillNo' ) + "'" ;
}
}
this . LoadData ( this . opStatus , condition , this . RefBillNo ) ;
} , //end InitData
LoadData : function ( opstatus , condition , refbillno ) {
this . fixSerialNo = 0 ;
this . fixBodyDel = [ ] ;
this . feeSerialNo = 0 ;
this . feeBodyDel = [ ] ;
this . opStatus = opstatus ;
var Url = '/TruckMng/MsWlPc/GetData' ;
/ *
if ( this . formtype = 'Operate' ) {
Url = '/TruckMng/MsWlPc/GetData' ;
}
if ( this . formtype = 'Qry' ) {
Url = '/TruckMng/MsWlPc/GetData_ADL' ;
} * /
Ext . Ajax . request ( {
waitMsg : '正在查询主表数据...' ,
url : Url ,
params : {
handle : opstatus ,
condition : condition ,
refbillno : refbillno
} ,
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 ;
if ( this . opStatus == 'add' ) {
data . RefBillNo = this . RefBillNo ;
}
if ( data . isEnd == 'True' ) {
data . isEnd = '1' ;
} else { data . isEnd = '0' } ;
if ( data . FuelPrice == "" ) {
data . FuelPrice = "0" ;
}
if ( data . RoadFee == "" ) {
data . RoadFee = "0" ;
}
this . DataLoading = true ;
var basicForm = this . formEdit . getForm ( ) ;
basicForm . reset ( ) ;
basicForm . setValues ( data ) ;
this . LoadFuel = basicForm . findField ( 'LoadFuel' ) . value ;
this . NoLoadFuel = basicForm . findField ( 'NoLoadFuel' ) . value ;
this . DataLoading = false ;
} else {
Ext . MessageBox . alert ( '请求出现错误,请重试' , response . responseText ) ;
}
} ,
scope : this
} ) ;
var billno = '*' ;
var gid = '*' ;
if ( this . opStatus == 'edit' ) {
if ( this . FunType == "MsRptPcHeadQryIndex" ) {
billno = this . editRecord . get ( 'BillNo' ) ;
gid = this . editRecord . get ( 'GId' ) ;
} else {
billno = this . editRecord . get ( 'BillNo' ) ;
gid = this . editRecord . get ( 'GId' ) ;
}
}
this . storeBodyFix . load ( { params : { billno : gid } } ) ;
this . storeBodyChFee . load ( { params : { billno : gid } } ) ;
this . storeSealNo . load ( { params : { bsBillNo : refbillno } } ) ;
} , // end LoadDate
//#endregion
Save : function ( type ) {
var basicForm = this . formEdit . getForm ( ) ;
if ( ! basicForm . isValid ( ) ) {
return ;
}
basicForm . findField ( 'BillNo' ) . setDisabled ( false ) ;
var data = basicForm . getValues ( ) ;
data . isEnd = this . formEdit . getForm ( ) . findField ( 'isEnd' ) . getValue ( ) ? 1 : 0 ;
basicForm . findField ( 'BillNo' ) . setDisabled ( true ) ;
var bodyFixdatas = [ ] ;
for ( var i = 0 ; i < this . storeBodyFix . getCount ( ) ; i += 1 ) {
var member = this . storeBodyFix . getAt ( i ) ;
bodyFixdatas . push ( member ) ;
}
;
var jsonFixBody = ConvertRecordsToJson ( bodyFixdatas ) ;
var jsonFixDelBody = ConvertRecordsToJsonAll ( this . fixBodyDel ) ;
var bodyChFeeDatas = [ ] ;
for ( i = 0 ; i < this . storeBodyChFee . getCount ( ) ; i += 1 ) {
var memberyf = this . storeBodyChFee . getAt ( i ) ;
bodyChFeeDatas . push ( memberyf ) ;
var amount = memberyf . data . Amount ;
if ( amount == 0 ) {
Ext . Msg . show ( { title : '警告' ,
msg : '费用的金额不允许为0, 请修改后再保存' ,
icon : Ext . Msg . ERROR , buttons : Ext . Msg . OK
} ) ;
return ;
}
}
;
var jsonChFeeBody = ConvertRecordsToJson ( bodyChFeeDatas ) ;
var jsonChFeeDelBody = ConvertRecordsToJsonAll ( this . feeBodyDel ) ;
//原来的交运逻辑
Ext . Msg . wait ( '正在保存数据, 请稍侯..' ) ;
Ext . Ajax . request ( {
waitMsg : '正在保存数据...' ,
url : '/TruckMng/MsWlPc/Save' ,
scope : this ,
params : {
opstatus : this . opStatus ,
data : Ext . JSON . encode ( data ) ,
fixbody : jsonFixBody ,
fixdelbody : jsonFixDelBody ,
chfeebody : jsonChFeeBody ,
chfeedelbody : jsonChFeeDelBody
} ,
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 ( ) . 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 ( 'MsWlPcHead' , returnData ) ;
this . editRecord . fields . each ( function ( field ) {
if ( field . persist ) {
name = field . name ;
if ( name != 'BILLNO' )
this . editRecord . set ( name , editp . get ( name ) ) ;
}
} , this ) ;
this . editRecord . commit ( ) ;
}
if ( type == '0' ) {
this . opStatus = 'edit' ;
basicForm . findField ( 'BillNo' ) . setDisabled ( true ) ;
for ( var i = 0 ; i < this . storeBodyFix . getCount ( ) ; i += 1 ) {
var member = this . storeBodyFix . getAt ( i ) ;
member . set ( "BillNo" , this . editRecord . get ( 'BillNo' ) ) ;
member . commit ( ) ;
}
;
// for (var i = 0; i < this.storeBodyChFee.getCount(); i += 1) {
// var member = this.storeBodyChFee.getAt(i);
// //member.set("BsNo", this.editRecord.get('BillNo'));
// member.commit();
// };
let gid = this . editRecord . get ( 'GId' ) ;
this . storeBodyChFee . load ( { params : { billno : gid } } ) ;
/* this.storeBodyChFee.load({ params: { condition: "Bsno='" + gid + "' or Bsno='" + billno + "'" } });*/
} else if ( type == '1' ) {
window . close ( ) ;
} else {
this . LoadData ( 'add' , '' , this . RefBillNo ) ;
//basicForm.findField('BillNo').setDisabled(false);
}
} 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
//#region 明细操作
onAddDetailClick : function ( button , event , type ) {
var allow = this . getAllowOperationDetail ( ) ;
if ( allow == false ) {
return ;
}
var store = null ;
if ( type == 1 ) {
store = this . storeBodyFix ;
} else if ( type == 2 ) {
store = this . storeBodyChFee ;
} else {
alert ( '函数(onAddDetailClick)的参数type类型设置的不对' ) ;
return ;
}
var newSerialno = this . GetHandleSerialNo ( store , type ) ;
var record = null ;
if ( type == 1 ) {
record = Ext . create ( 'MsWlPcFixed' , {
GId : NewGuid ( ) ,
BillNo : '*' ,
SerialNo : newSerialno ,
FeeStatus : 1 ,
FeeStatus _Ref : '录入状态' ,
AuditStatus : 0 ,
CreditDebit : "2" ,
CreditDebit _Ref : "应付" ,
FeeTypeCode : '' ,
FeeTypeCode _Ref : '' ,
FeeTypeName : '' ,
DistCount : 0 ,
Price : 0 ,
FsTotal : 0 ,
JsTotal : 0 ,
Remark : ''
} ) ;
} else if ( type == 2 ) {
record = Ext . create ( 'MsChFee' , {
GId : NewGuid ( ) ,
BsNo : '*' ,
FeeStatus : 1 ,
FeeStatus _Ref : '录入状态' ,
FeeType : 1 ,
FeeType _Ref : '应收' ,
FeeName : '' ,
FeeName _Ref : '' ,
FeeDescription : '' ,
CustomerType : '' ,
CustomerName : this . getCustName ( ) ,
CustomerName _Ref : '' ,
Unit : '' ,
UnitPrice : 0 ,
Quantity : 1 ,
Amount : 0 ,
Currency : 'RMB' ,
ExChangerate : 1 ,
Reason : '' ,
Remark : '' ,
Commissionrate : 0 ,
Settlement : 0 ,
Invoice : 0 ,
OrderAmount : 0 ,
OrderInvoice : 0 ,
SubmitDate : null ,
Auditoperator : '' ,
AuditDate : null ,
EnteroPerator : GetCookie _UserId ( ) ,
EnterDate : null ,
DebitNo : '' ,
IsDebit : "0" ,
IsOpen : "0" ,
IsAdvancedpay : "0" ,
Sort : "0" ,
IsInvoice : "0" ,
FeeFrt : '' ,
IsCrmOrderFee : "0" ,
AuditStatus : 0 ,
InvoiceNum : '' ,
ChequeNum : '' ,
WmsOutBsNo : ''
} ) ;
}
store . add ( record ) ;
var editColumnIndex = 0 ;
var cellediting = null ;
if ( type == 1 ) {
cellediting = this . cellEditingFix ;
editColumnIndex = 2 ;
} else if ( type == 2 ) {
cellediting = this . cellEditingChFee ;
editColumnIndex = 4 ;
}
var n = store . getCount ( ) ;
cellediting . startEditByPosition ( { row : n - 1 , column : editColumnIndex } ) ;
} ,
GetHandleSerialNo : function ( store , type ) {
var result = 0 ;
if ( type == 1 ) {
result = this . fixSerialNo ;
} else if ( type == 2 ) {
result = this . feeSerialNo ;
}
if ( result == 0 ) {
for ( var i = 0 ; i < store . getCount ( ) ; i += 1 ) {
var member = store . getAt ( i ) ;
if ( member . data . SerialNo > result ) {
result = member . data . SerialNo ;
}
}
}
result = result + 1 ;
if ( type == 1 ) {
this . fixSerialNo = result ;
} else if ( type == 2 ) {
this . feeSerialNo = result ;
}
return result ;
} ,
onDelDetailClick : function ( button , event , type ) {
var allow = this . getAllowOperationDetail ( ) ;
if ( allow == false ) {
return ;
}
var store = null ;
if ( type == 1 ) {
store = this . storeBodyFix ;
} else if ( type == 2 ) {
store = this . storeBodyChFee ;
} else {
alert ( '函数(onAddDetailClick)的参数type类型设置的不对' ) ;
return ;
}
var result = 0 ;
if ( type == '1' ) {
result = this . fixSerialNo ;
} else if ( type == '2' ) {
result = this . feeSerialNo ;
}
if ( result == 0 ) {
for ( var i = 0 ; i < store . getCount ( ) ; i += 1 ) {
var member = store . getAt ( i ) ;
if ( member . data . SerialNo > this . giSerialNo ) {
result = member . data . SerialNo ;
}
}
}
if ( type == '1' ) {
this . fixSerialNo = result ;
} else if ( type == '2' ) {
this . feeSerialNo = result ;
}
var selectedRecords = [ ] ;
if ( type == '1' ) {
selectedRecords = this . gridListFix . selModel . getSelection ( ) ;
} else if ( type == '2' ) {
selectedRecords = this . gridListChFee . selModel . getSelection ( ) ;
var candelete = DsTruck . CheckChFeeDelete ( selectedRecords ) ;
if ( candelete == false )
return ;
}
if ( selectedRecords . length > 0 ) {
for ( var i = 0 ; i < selectedRecords . length ; i ++ ) {
var rec = selectedRecords [ i ] ;
if ( rec . BillNo != "" || rec . BillNo != "*" ) //如果是新增但没有保存的数据,没有必要提交到后台
{
if ( type == '1' ) {
this . fixBodyDel . push ( rec ) ;
} else if ( type == '2' ) {
this . feeBodyDel . push ( rec ) ;
}
}
if ( type == '1' ) {
this . storeBodyFix . remove ( selectedRecords [ i ] ) ;
} else if ( type == '2' ) {
this . storeBodyChFee . remove ( selectedRecords [ i ] ) ;
}
}
}
} ,
getAllowOperationDetail : function ( ) {
var feeStatus = this . getFeeStatus ( ) ;
if ( feeStatus == '0' )
return true ;
else {
Ext . Msg . show ( { title : '错误' , msg : "费用已锁定,不允许操作费用!" , icon : Ext . Msg . ERROR , buttons : Ext . Msg . OK } ) ;
return false ;
}
} ,
//#endregion
//#region 表格的AfterEdit
gridListFixAfterEdit : function ( editor , e , eOpts ) {
if ( e . field == 'FeeTypeCode' ) {
var records = DsStoreQueryBy ( this . storeFeeTypeCodeRef , 'FeeCode' , e . value ) ;
if ( records . getCount ( ) > 0 ) {
var data = records . getAt ( 0 ) . data ;
e . record . set ( 'FeeTypeCode_Ref' , data . Name ) ;
e . record . set ( 'FeeTypeName' , data . Name ) ;
} else {
e . record . set ( 'FeeTypeCode_Ref' , '' ) ;
e . record . set ( 'FeeTypeName' , '' ) ;
}
} else if ( e . field == 'CreditDebit' ) {
var recordsCreditDebit = DsStoreQueryBy ( this . storeCreditDebitRef , 'EnumValueId' , e . value ) ;
if ( recordsCreditDebit . getCount ( ) > 0 ) {
var dataCreditDebit = recordsCreditDebit . getAt ( 0 ) . data ;
e . record . set ( 'CreditDebit_Ref' , dataCreditDebit . EnumValueName ) ;
} else {
e . record . set ( 'CreditDebit_Ref' , '' ) ;
}
}
} ,
gridListChFeeAfterEdit : function ( editor , e , eOpts ) {
if ( e . field == 'FeeType' ) {
var records = DsStoreQueryBy ( this . storeFeeTypeRef , 'EnumValueId' , e . value ) ;
if ( records . getCount ( ) > 0 ) {
var data = records . getAt ( 0 ) . data ;
e . record . set ( 'FeeType_Ref' , data . EnumValueName ) ;
} else {
e . record . set ( 'FeeType_Ref' , '' ) ;
}
} else if ( e . field == 'UnitPrice' || e . field == 'Quantity' ) {
var unitPrice = e . record . data [ 'UnitPrice' ] ;
var quantity = e . record . data [ 'Quantity' ] ;
e . record . set ( 'Amount' , ( unitPrice * quantity ) . toFixed ( 2 ) ) ;
}
} ,
//#endregion
cellEditingFixBeforeEdit : function ( editor , e ) {
var feeStatus = this . getFeeStatus ( ) ;
var billStatus = this . getBillStatus ( ) ;
var canedit = feeStatus == '0' && billStatus == '0' ;
return canedit ;
} ,
cellEditingChFeeBeforeEdit : function ( editor , e ) {
var chfeefeeStatus = e . record . get ( 'FeeStatus' ) ;
var canedit = chfeefeeStatus == 1 || chfeefeeStatus == 6 ;
if ( canedit ) {
var feeStatus = this . getFeeStatus ( ) ;
var billStatus = this . getBillStatus ( ) ;
canedit = feeStatus == '0' && billStatus == '0' ;
}
return canedit ;
} ,
refBillNoSeChange : function ( field , newValue , oldValue ) {
// if (newValue != oldValue) {
// alert(newValue + "," + oldValue);
// }
} ,
realMilChange : function ( field , newValue , oldValue ) {
if ( this . DataLoading == true ) return ;
if ( newValue == oldValue ) return ;
var realMil = newValue ;
var basicForm = this . formEdit . getForm ( ) ;
basicForm . findField ( 'OverLoadMil' ) . setValue ( realMil ) ;
basicForm . findField ( 'NoLoadMil' ) . setValue ( realMil ) ;
this . getTruckOverLoadFuel ( ) ;
this . getTruckNoLoadFuel ( ) ;
var ratedFuel = this . LoadFuel + this . NoLoadFuel ;
basicForm . findField ( 'LoadFuel' ) . setValue ( this . LoadFuel ) ;
basicForm . findField ( 'NoLoadFuel' ) . setValue ( this . NoLoadFuel ) ;
basicForm . findField ( 'RatedFuel' ) . setValue ( ratedFuel ) ;
} ,
overLoadMilChange : function ( field , newValue , oldValue ) {
if ( this . DataLoading == true ) return ;
var basicForm = this . formEdit . getForm ( ) ;
this . getTruckOverLoadFuel ( ) ;
var ratedFuel = this . LoadFuel + this . NoLoadFuel ;
basicForm . findField ( 'LoadFuel' ) . setValue ( this . LoadFuel ) ;
basicForm . findField ( 'RatedFuel' ) . setValue ( ratedFuel ) ;
} ,
noLoadMilChange : function ( field , newValue , oldValue ) {
if ( this . DataLoading == true ) return ;
var basicForm = this . formEdit . getForm ( ) ;
this . getTruckNoLoadFuel ( ) ;
var ratedFuel = this . LoadFuel + this . NoLoadFuel ;
basicForm . findField ( 'NoLoadFuel' ) . setValue ( this . NoLoadFuel ) ;
basicForm . findField ( 'RatedFuel' ) . setValue ( ratedFuel ) ;
} ,
tonAndTruckNoChange : function ( field , newValue , oldValue ) {
if ( this . DataLoading == true ) return ;
this . getTruckOverLoadFuel ( ) ;
this . getTruckNoLoadFuel ( ) ;
var ratedFuel = this . LoadFuel + this . NoLoadFuel ;
var basicForm = this . formEdit . getForm ( ) ;
basicForm . findField ( 'LoadFuel' ) . setValue ( this . LoadFuel ) ;
basicForm . findField ( 'NoLoadFuel' ) . setValue ( this . NoLoadFuel ) ;
basicForm . findField ( 'RatedFuel' ) . setValue ( ratedFuel ) ;
if ( field . name == 'TruckNo' ) {
var records = DsStoreQueryBy ( this . storeTruckNo , 'TruckNo' , newValue ) ;
if ( records . getCount ( ) > 0 ) {
var data = records . getAt ( 0 ) . data ;
basicForm . findField ( 'DrvCode' ) . setValue ( data . DrvCode ) ;
this . setDrvName ( data . DrvCode ) ;
basicForm . findField ( 'Mobile' ) . setValue ( data . Mobile ) ;
} else {
basicForm . findField ( 'DrvCode' ) . setValue ( '' ) ;
basicForm . findField ( 'DrvName' ) . setValue ( '' ) ;
basicForm . findField ( 'Mobile' ) . setValue ( '' ) ;
}
}
} ,
onSubmitAuditClick : function ( button , event ) {
var records = this . feeGridCheckBoxModel . selected . items ;
DsTruck . MsChFeeAudit ( records , 2 , '正在提交审核数据, 请稍侯..' ) ;
this . InitData ( ) ;
} ,
setSaveBtnStatus : function ( enable ) {
var bsbtnSave = Ext . getCmp ( 'pcbtnSave' ) ;
var bsbtnSaveAndClose = Ext . getCmp ( 'pcbtnSaveAndClose' ) ;
var bsbtnSaveAndNew = Ext . getCmp ( 'pcbtnSaveAndNew' ) ;
var pcbtnNew = Ext . getCmp ( 'pcbtnNew' ) ;
if ( enable ) {
bsbtnSave . enable ( ) ;
bsbtnSaveAndClose . enable ( ) ;
bsbtnSaveAndNew . enable ( ) ;
pcbtnNew . enable ( ) ;
} else {
//bsbtnSave.disable();
//bsbtnSaveAndClose.disable();
bsbtnSaveAndNew . disable ( ) ;
pcbtnNew . disable ( ) ;
}
} ,
getFeeStatus : function ( ) {
var basicForm = this . formEdit . getForm ( ) ;
var feeStatus = basicForm . findField ( 'FeeStatus' ) . value ;
return feeStatus ;
} ,
getBillStatus : function ( ) {
var basicForm = this . formEdit . getForm ( ) ;
var billStatus = basicForm . findField ( 'BillStatus' ) . value ;
return billStatus ;
} ,
getCustName : function ( ) {
var custName = this . formEdit . getForm ( ) . findField ( 'RefCustomerName' ) ;
return custName . getValue ( ) ;
} ,
getTruckNo : function ( ) {
var truckNo = this . formEdit . getForm ( ) . findField ( 'TruckNo' ) ;
return truckNo . getValue ( ) ;
} ,
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 gid = basicForm . findField ( 'GId' ) . value ;
var refBillNo = basicForm . findField ( 'RefBillNo' ) . value ;
var printType = 'MSWLPC' ;
var sql1 = "SET LANGUAGE 'us_english' "
+ " select * from vMsWlPcHeadPrint WHERE BillNo = '" + billNo + "'" ;
var sql2 = "SET LANGUAGE 'us_english' SELECT * from ch_fee where BsNo='" + gid + "'" ;
var records = this . feeGridCheckBoxModel . selected . items ;
if ( records . length > 0 ) {
var feeGidSql = '' ;
for ( var i = 0 ; i < records . length ; i ++ ) {
var record = records [ i ] ;
var feeGId = "'" + record . get ( 'GId' ) + "'" ;
if ( feeGidSql == '' ) {
feeGidSql = feeGId ;
} else {
feeGidSql = feeGidSql + "," + feeGId ;
}
}
if ( feeGidSql != '' ) {
sql2 = sql2 + ' and Gid in (' + feeGidSql + ')' ;
}
}
var sql3 = "SET LANGUAGE 'us_english ' "
+ " select * from vMsWlBsHeadPrint WHERE BillNo = '" + refBillNo + "'" ;
var sql4 = "select top 1 * from vMsWlBSHeadPrint where billno in(select bs_billno from BS_PC_Status where pc_billno = '" + billNo + "' and bs_billno<>'" + refBillNo + "')" ;
var sql5 = "" ;
var sql6 = "" ;
PrintComm ( printType , sql1 , sql2 , sql3 , sql4 , sql5 , sql6 ) ;
} ,
//获取重驶油耗
getTruckOverLoadFuel : function ( ) {
var truckNo = this . getTruckNo ( ) ;
if ( truckNo == null || truckNo == "" ) {
this . LoadFuel = 0 ;
return ;
}
var basicForm = this . formEdit . getForm ( ) ;
var overLoadMil = basicForm . findField ( 'OverLoadMil' ) . value ;
var ton = basicForm . findField ( 'Ton' ) . value ;
if ( ton == null || ton == "" || overLoadMil == null || overLoadMil == 0 ) {
this . LoadFuel = 0 ;
return ;
}
this . getTruckFuel ( truckNo , "1" , ton , overLoadMil ) ;
} ,
//获取空驶油耗
getTruckNoLoadFuel : function ( ) {
var truckNo = this . getTruckNo ( ) ;
if ( truckNo == null || truckNo == "" ) {
this . NoLoadFuel = 0 ;
return ;
}
var basicForm = this . formEdit . getForm ( ) ;
var overLoadMil = basicForm . findField ( 'NoLoadMil' ) . value ;
var ton = basicForm . findField ( 'Ton' ) . value ;
if ( ton == null || ton == "" || overLoadMil == null || overLoadMil == 0 ) {
this . NoLoadFuel = 0 ;
return ;
}
this . getTruckFuel ( truckNo , "0" , ton , overLoadMil ) ;
} ,
getTruckFuel : function ( truckNo , loadType , ton , mil ) {
Ext . Ajax . request ( {
waitMsg : '正在计算车里油量信息...' ,
url : '/TruckMng/MsWlPc/GetTruckFuel' ,
async : false ,
params : {
truckNo : truckNo ,
loadType : loadType ,
ton : ton ,
mil : mil
} ,
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
} ) ;
if ( loadType == '1' )
this . LoadFuel = 0 ;
else
this . NoLoadFuel = 0 ;
}
var data = result . data ;
if ( loadType == '1' )
this . LoadFuel = data ;
else
this . NoLoadFuel = data ;
} else {
Ext . MessageBox . alert ( '请求出现错误,请重试' , response . responseText ) ;
if ( loadType == '1' )
this . LoadFuel = 0 ;
else
this . NoLoadFuel = 0 ;
}
} ,
scope : this
} ) ;
} ,
setDrvName : function ( drvCode ) {
var recs = DsStoreQueryBy ( this . storeDrvName , 'DrvCode' , drvCode ) ;
var basicForm = this . formEdit . getForm ( ) ;
var custname = basicForm . findField ( 'DrvName' ) ;
var mobile = basicForm . findField ( 'Mobile' ) ;
if ( recs . getCount ( ) > 0 ) {
var data = recs . getAt ( 0 ) . data ;
custname . setValue ( data . DrvName ) ;
mobile . setValue ( data . Mobile ) ;
} else {
custname . setValue ( '' ) ;
mobile . setValue ( '' ) ;
}
} ,
setBtnOnlyQuery : function ( ) {
var bsbtnSave = Ext . getCmp ( 'pcbtnSave' ) ;
var bsbtnSaveAndClose = Ext . getCmp ( 'pcbtnSaveAndClose' ) ;
var bsbtnSaveAndNew = Ext . getCmp ( 'pcbtnSaveAndNew' ) ;
var pcbtnNew = Ext . getCmp ( 'pcbtnNew' ) ;
bsbtnSave . setVisible ( false ) ;
bsbtnSaveAndClose . setVisible ( false ) ;
bsbtnSaveAndNew . setVisible ( false ) ;
pcbtnNew . setVisible ( false ) ;
}
} ) ;