Ext . namespace ( 'Shipping' ) ;
Shipping . MsOpExpressEdit = function ( config ) {
Ext . applyIf ( this , config ) ;
this . initUIComponents ( ) ;
window . Shipping . MsOpExpressEdit . superclass . constructor . call ( this ) ;
} ;
Ext . extend ( Shipping . MsOpExpressEdit , Ext . Panel , {
ParentWin : null ,
OpStatus : 'add' ,
StoreList : null ,
editRecord : null ,
initUIComponents : function ( ) {
this . formname = 'MsOpExpressEdit' ;
this . serialNo = 0 ;
this . workSerialNo = 0 ;
this . bodyDel = [ ] ;
this . BillSql = '' ;
//#region 编辑form
//枚举参照相关(编辑form)
//表参照相关(编辑form)
this . storeExpress = Ext . create ( 'DsExt.ux.RefTableStore' , {
model : 'DsShipping.ux.CustomRefModel' ,
proxy : { url : '/CommMng/BasicDataRef/GetCustomRefList' }
} ) ;
this . storeExpress . load ( { params : { condition : "ISEXPRESS='1'" } } ) ;
//船公司
this . comboxEXPRESS = Ext . create ( 'DsExt.ux.RefTableCombox' , {
fieldLabel : '快递公司' ,
store : this . storeExpress ,
forceSelection : true ,
name : 'EXPRESSCORP' ,
valueField : 'CustName' ,
displayField : 'CodeAndName'
} ) ;
this . storeReceive = Ext . create ( 'DsExt.ux.RefTableStore' , {
model : 'MsInfoClientModel' ,
proxy : { url : '/MvcShipping/MsInfoClient/GetDataListAll' }
} ) ;
this . storeReceive . load ( { params : { condition : "" } } ) ;
this . comboxReceive = Ext . create ( 'DsExt.ux.RefTableCombox' , {
fieldLabel : '收件公司' ,
store : this . storeReceive ,
width : 200 ,
forceSelection : true ,
name : 'RECEIVECUST' ,
valueField : 'SHORTNAME' ,
displayField : 'CodeAndName' ,
listeners : {
scope : this ,
'select' : function ( combo , records , eOpts ) {
if ( records . length > 0 ) {
this . storeReceiveAttn . removeAll ( ) ;
var curCorpName = records [ 0 ] . data . SHORTNAME ;
this . storeReceiveAttn . load ( { params : { CorpName : curCorpName } } ) ;
var RECEIVE = this . formEdit . getForm ( ) . findField ( 'RECEIVE' ) ;
RECEIVE . setValue ( records [ 0 ] . data . DESCRIPTION ) ;
var RECEIVEADDR = this . formEdit . getForm ( ) . findField ( 'RECEIVEADDR' ) ;
RECEIVEADDR . setValue ( records [ 0 ] . data . ADDR )
var RECEIVETEL = this . formEdit . getForm ( ) . findField ( 'RECEIVETEL' ) ;
RECEIVETEL . setValue ( records [ 0 ] . data . TEL ) ;
var RECEIVECITY = this . formEdit . getForm ( ) . findField ( 'RECEIVECITY' ) ;
RECEIVECITY . setValue ( records [ 0 ] . data . CITY ) ;
var RECEIVEATTN = this . formEdit . getForm ( ) . findField ( 'RECEIVEATTN' ) ;
RECEIVEATTN . setValue ( records [ 0 ] . data . CHIEF ) ;
var CUSTOMERNAME = this . formEdit . getForm ( ) . findField ( 'RECEIVECUST' ) . getValue ( ) ;
if ( CUSTOMERNAME == '' ) return ;
//var CUSTNAME = this.formSearch.getForm().findField('CUSTNAME');
//var tmpcust = CUSTNAME.getValue();
//if (tmpcust == '' || tmpcust == null || tmpcust == undefined) {
// CUSTNAME.setValue(CUSTOMERNAME);
//}
}
}
}
} ) ;
this . storeReceiveAttn = Ext . create ( 'Ext.data.Store' , {
fields : [
{ name : 'GID' , type : 'string' } ,
{ name : 'NAME' , type : 'string' } ,
{ name : 'CORPNAME' , type : 'string' } ,
{ name : 'CORPNAMERV' , type : 'string' } ,
{ name : 'ADDRESS' , type : 'string' } ,
{ name : 'PROVINCE' , type : 'string' } ,
{ name : 'DESTI' , type : 'string' } ,
{ name : 'TEL' , type : 'string' } ,
{ name : 'POSTCODE' , type : 'string' } ] ,
remoteSort : true ,
proxy : {
type : 'ajax' ,
url : '/MsOpExpress/GetAddressAttn' ,
reader : {
id : 'NAME' ,
root : 'data' ,
totalProperty : 'totalCount'
}
}
} ) ;
this . comboxReceiveAttn = Ext . create ( 'DsExt.ux.RefTableCombox' , {
fieldLabel : '收件人' ,
store : this . storeReceiveAttn ,
forceSelection : false ,
name : 'RECEIVEATTN' ,
valueField : 'NAME' ,
displayField : 'NAME' ,
listeners : {
scope : this ,
'select' : function ( combo , records , eOpts ) {
if ( records . length > 0 ) {
this . formEdit . getForm ( ) . findField ( 'RECEIVEPROVINCE' ) . setValue ( records [ 0 ] . data . PROVINCE ) ;
this . formEdit . getForm ( ) . findField ( 'RECEIVECITY' ) . setValue ( records [ 0 ] . data . DESTI ) ;
this . formEdit . getForm ( ) . findField ( 'RECEIVEADDR' ) . setValue ( records [ 0 ] . data . ADDRESS ) ;
this . formEdit . getForm ( ) . findField ( 'RECEIVEPOST' ) . setValue ( records [ 0 ] . data . POSTCODE ) ;
this . formEdit . getForm ( ) . findField ( 'RECEIVETEL' ) . setValue ( records [ 0 ] . data . TEL ) ;
this . formEdit . getForm ( ) . findField ( 'RECEIVE' ) . setValue ( records [ 0 ] . data . CORPNAMERV ) ;
}
}
}
} ) ;
this . storeSender = Ext . create ( 'DsExt.ux.RefTableStore' , {
model : 'MsCompanysEntity' ,
proxy : { url : '/MvcShipping/MsCompanys/GetDataList' }
} ) ;
this . storeSender . load ( { params : { condition : "" } } ) ;
this . comboxSender = Ext . create ( 'DsExt.ux.RefTableCombox' , {
fieldLabel : '寄件公司' ,
store : this . storeSender ,
forceSelection : true ,
name : 'SENDERCUST' ,
valueField : 'NAME' ,
displayField : 'NAME' ,
width : 200 ,
listeners : {
scope : this ,
'select' : function ( combo , records , eOpts ) {
if ( records . length > 0 ) {
var SENDER = this . formEdit . getForm ( ) . findField ( 'SENDER' ) ;
SENDER . setValue ( records [ 0 ] . data . FULLNAME ) ;
var SENDERADDR = this . formEdit . getForm ( ) . findField ( 'SENDERADDR' ) ;
SENDERADDR . setValue ( records [ 0 ] . data . ADDRESS ) ;
var SENDERTEL = this . formEdit . getForm ( ) . findField ( 'SENDERTEL' ) ;
SENDERTEL . setValue ( records [ 0 ] . data . OFFICEPHONE ) ;
var SENDERCITY = this . formEdit . getForm ( ) . findField ( 'SENDERCITY' ) ;
//SENDERCITY.setValue(records[0].data.CITY);
}
}
}
} ) ;
//收件人省份
//定义数据集
this . storeListRProvince = Ext . create ( 'Ext.data.Store' , {
fields : [
{ name : 'ProvinceName' , type : 'string' } ] ,
remoteSort : true ,
proxy : {
type : 'ajax' ,
url : '/MsOpExpress/GetProvinceList' ,
reader : {
id : 'ProvinceName' ,
root : 'data' ,
totalProperty : 'totalCount'
}
}
} ) ;
this . comboxRProvince = Ext . create ( 'DsExt.ux.RefTableCombox' , {
fieldLabel : '收件省份' ,
store : this . storeListRProvince ,
forceSelection : true ,
name : 'RECEIVEPROVINCE' ,
valueField : 'ProvinceName' ,
displayField : 'ProvinceName' ,
listeners : {
scope : this ,
'select' : function ( combo , records , eOpts ) {
if ( records . length > 0 ) {
var curProv = records [ 0 ] . data . ProvinceName ;
this . storeListRCity . load ( { params : { Province : curProv } } ) ;
}
}
}
} ) ;
this . storeListRProvince . load ( ) ;
//收件人城市
//定义数据集
this . storeListRCity = Ext . create ( 'Ext.data.Store' , {
fields : [
{ name : 'CityName' , type : 'string' } ] ,
remoteSort : true ,
proxy : {
type : 'ajax' ,
url : '/MsOpExpress/GetCityList' ,
reader : {
id : 'CityName' ,
root : 'data' ,
totalProperty : 'totalCount'
}
}
} ) ;
this . comboxRCity = Ext . create ( 'DsExt.ux.RefTableCombox' , {
fieldLabel : '收件城市' ,
store : this . storeListRCity ,
forceSelection : true ,
name : 'RECEIVECITY' ,
valueField : 'CityName' ,
displayField : 'CityName'
} ) ;
this . storeListRCity . load ( { params : { Province : '' } } ) ;
this . formReceive = Ext . widget ( 'form' , {
// region: 'north',
title : '收件人资料' ,
flex : 1 ,
frame : true ,
bodyPadding : 0 ,
collapsed : false ,
collapsible : true ,
trackResetOnLoad : true ,
fieldDefaults : {
margins : '2 2 2 2' ,
labelAlign : 'right' ,
flex : 1 ,
labelWidth : 110 ,
msgTarget : 'qtip'
} ,
items : [
{ //fieldset 1
xtype : 'fieldset' ,
defaultType : 'textfield' ,
layout : 'anchor' ,
defaults : {
anchor : '100%'
} ,
items : [ {
xtype : 'container' ,
layout : 'hbox' ,
defaultType : 'textfield' ,
items : [ this . comboxReceive , {
xtype : 'button' ,
iconCls : "btnedit" ,
handler : function ( button , event ) {
var curCorpName = this . formEdit . getForm ( ) . findField ( 'RECEIVECUST' ) . getValue ( ) ;
var sql = '' ;
sql = sql + getAndConSql ( sql , curCorpName , "CORPNAME='" + curCorpName + "'" ) ;
this . storeListAddress . load ( { params : { start : 0 , limit : this . PageSize , sort : '' , condition : sql } } ) ;
this . formAddressDetail . getForm ( ) . reset ( ) ;
this . formAddressDetail . getForm ( ) . findField ( 'CORPNAME' ) . setValue ( curCorpName ) ;
this . winAddress . show ( ) ;
} ,
scope : this
} , this . comboxReceiveAttn ]
} , {
xtype : 'container' ,
layout : 'hbox' ,
defaultType : 'textfield' ,
items : [ this . comboxRProvince , this . comboxRCity ]
} , {
xtype : 'container' ,
layout : 'hbox' ,
defaultType : 'textfield' ,
items : [ {
fieldLabel : '收件公司' ,
name : 'RECEIVE'
} ]
} , {
xtype : 'container' ,
layout : 'hbox' ,
defaultType : 'textfield' ,
items : [ {
xtype : 'textareafield' ,
grow : true ,
fieldLabel : '收件详细地址' ,
height : 40 ,
name : 'RECEIVEADDR' ,
anchor : '100%'
} ]
} , {
xtype : 'container' ,
layout : 'hbox' ,
defaultType : 'textfield' ,
items : [ {
fieldLabel : '收件人邮编' ,
name : 'RECEIVEPOST'
} ,
{
fieldLabel : '收件人电话' ,
name : 'RECEIVETEL'
} ]
}
] //end root items
} ]
} ) ; //
//寄件人省份
//定义数据集
this . storeListSProvince = Ext . create ( 'Ext.data.Store' , {
fields : [
{ name : 'ProvinceName' , type : 'string' } ] ,
remoteSort : true ,
proxy : {
type : 'ajax' ,
url : '/MsOpExpress/GetProvinceList' ,
reader : {
id : 'ProvinceName' ,
root : 'data' ,
totalProperty : 'totalCount'
}
}
} ) ;
this . comboxSProvince = Ext . create ( 'DsExt.ux.RefTableCombox' , {
fieldLabel : '寄件省份' ,
store : this . storeListSProvince ,
forceSelection : true ,
name : 'SENDERPROVINCE' ,
valueField : 'ProvinceName' ,
displayField : 'ProvinceName' ,
listeners : {
scope : this ,
'select' : function ( combo , records , eOpts ) {
if ( records . length > 0 ) {
var curProv = records [ 0 ] . data . ProvinceName ;
this . storeListSCity . load ( { params : { Province : curProv } } ) ;
}
}
}
} ) ;
this . storeListSProvince . load ( ) ;
//寄件人城市
//定义数据集
this . storeListSCity = Ext . create ( 'Ext.data.Store' , {
fields : [
{ name : 'CityName' , type : 'string' } ] ,
remoteSort : true ,
proxy : {
type : 'ajax' ,
url : '/MsOpExpress/GetCityList' ,
reader : {
id : 'CityName' ,
root : 'data' ,
totalProperty : 'totalCount'
}
}
} ) ;
this . comboxSCity = Ext . create ( 'DsExt.ux.RefTableCombox' , {
fieldLabel : '寄件城市' ,
store : this . storeListSCity ,
forceSelection : true ,
name : 'SENDERCITY' ,
valueField : 'CityName' ,
displayField : 'CityName'
} ) ;
this . storeListSCity . load ( { params : { Province : '' } } ) ;
//人员信息加载
this . storeOpCode = Ext . create ( 'DsExt.ux.RefTableStore' , {
model : 'DsShipping.ux.UserLinkRefModel' ,
proxy : { url : '/CommMng/BasicDataRef/GetUserLinkRefList' }
} ) ;
this . storeOpCode . load ( ) ;
//寄件人
this . comboxSenderAttn = Ext . create ( 'DsExt.ux.RefTableCombox' , {
fieldLabel : '寄件人' ,
store : this . storeOpCode ,
forceSelection : false ,
multiSelect : true ,
name : 'SENDERATTN' ,
valueField : 'UserName' ,
displayField : 'CodeAndName' ,
listeners : {
scope : this ,
'select' : function ( combo , records , eOpts ) {
if ( records . length > 0 ) {
var SENDERTEL = this . formEdit . getForm ( ) . findField ( 'SENDERTEL' ) ;
SENDERTEL . setValue ( records [ 0 ] . data . Tel ) ;
}
}
}
} ) ;
this . formSender = Ext . widget ( 'form' , {
// region: 'north',
title : '寄件人资料' ,
frame : true ,
flex : 1 ,
bodyPadding : 0 ,
collapsed : false ,
collapsible : true ,
trackResetOnLoad : true ,
fieldDefaults : {
margins : '2 2 2 2' ,
labelAlign : 'right' ,
flex : 1 ,
labelWidth : 110 ,
msgTarget : 'qtip'
} ,
items : [
{ //fieldset 1
xtype : 'fieldset' ,
defaultType : 'textfield' ,
layout : 'anchor' ,
defaults : {
anchor : '100%'
} ,
items : [ {
xtype : 'container' ,
layout : 'hbox' ,
defaultType : 'textfield' ,
items : [ this . comboxSender , this . comboxSenderAttn ]
} , {
xtype : 'container' ,
layout : 'hbox' ,
defaultType : 'textfield' ,
items : [ this . comboxSProvince , this . comboxSCity ]
} , {
xtype : 'container' ,
layout : 'hbox' ,
defaultType : 'textfield' ,
items : [ {
fieldLabel : '寄件公司' ,
name : 'SENDER'
} ]
} , {
xtype : 'container' ,
layout : 'hbox' ,
defaultType : 'textfield' ,
items : [ {
xtype : 'textareafield' ,
grow : true ,
fieldLabel : '寄件详细地址' ,
height : 40 ,
name : 'SENDERADDR' ,
anchor : '100%'
} ]
} , {
xtype : 'container' ,
layout : 'hbox' ,
defaultType : 'textfield' ,
items : [ {
fieldLabel : '寄件人邮编' ,
name : 'SENDERPOST'
} ,
{
fieldLabel : '寄件人电话' ,
name : 'SENDERTEL'
} ]
}
] //end root items
} ]
} ) ; //
this . formRemarks = Ext . widget ( 'form' , {
region : 'north' ,
title : '其他' ,
frame : true ,
bodyPadding : 0 ,
collapsed : false ,
collapsible : true ,
trackResetOnLoad : true ,
fieldDefaults : {
margins : '2 2 2 2' ,
labelAlign : 'right' ,
flex : 1 ,
labelWidth : 110 ,
msgTarget : 'qtip'
} ,
items : [
{ //fieldset 1
xtype : 'fieldset' ,
defaultType : 'textfield' ,
layout : 'anchor' ,
defaults : {
anchor : '100%'
} ,
items : [ {
xtype : 'container' ,
layout : 'hbox' ,
defaultType : 'textfield' ,
items : [ {
fieldLabel : '品名' ,
name : 'GOODSNAME'
} ]
} , {
xtype : 'container' ,
layout : 'hbox' ,
defaultType : 'textfield' ,
items : [ {
xtype : 'textareafield' ,
fieldLabel : '备注' ,
grow : true ,
height : 40 ,
name : 'REMARKS' ,
anchor : '100%'
}
] //end items(fieldset 1)
}
] //end root items
} ]
} ) ; //
this . StoreBillType = Ext . create ( 'DsExt.ux.RefEnumStore' , { } ) ;
this . StoreBillType . load ( { params : { enumTypeId : 97025 } } ) ;
this . comboxBillType = Ext . create ( 'DsExt.ux.RefTableCombox' , {
fieldLabel : '快递类型' ,
store : this . StoreBillType ,
forceSelection : true ,
name : 'BILLTYPE' ,
valueField : 'EnumValueName' ,
displayField : 'EnumValueName' ,
enableKeyEvents : true
} ) ;
//快递状态
this . StoreExpStatus = Ext . create ( 'Ext.data.Store' , {
fields : [ 'OpLb' ]
} ) ;
this . StoreExpStatus . add ( { "OpLb" : "" } ) ;
this . StoreExpStatus . add ( { "OpLb" : "新建" } ) ;
this . StoreExpStatus . add ( { "OpLb" : "已下单" } ) ;
this . StoreExpStatus . add ( { "OpLb" : "已发件" } ) ;
this . StoreExpStatus . add ( { "OpLb" : "已收件" } ) ;
this . comboxExpressStatus = Ext . create ( 'DsExt.ux.RefTableCombox' , {
fieldLabel : '快递状态' ,
store : this . StoreExpStatus ,
forceSelection : true ,
name : 'BILLSTATUS' ,
valueField : 'OpLb' ,
displayField : 'OpLb' ,
enableKeyEvents : true
} ) ;
//编辑form
this . formEdit = Ext . widget ( 'form' , {
region : 'north' ,
frame : true ,
bodyPadding : 0 ,
autoScroll : true ,
fieldDefaults : {
margins : '2 2 2 2' ,
labelAlign : 'right' ,
flex : 1 ,
labelWidth : 110 ,
msgTarget : 'qtip'
} ,
items : [
{ //fieldset 1
xtype : 'fieldset' ,
defaultType : 'textfield' ,
layout : 'anchor' ,
defaults : {
anchor : '100%'
} ,
items : [ {
xtype : 'container' ,
layout : 'hbox' ,
defaultType : 'textfield' ,
items : [ {
fieldLabel : 'GID' ,
name : 'GID' , flex : 0 , hidden : true , margins : '0'
} , {
fieldLabel : '快递号' ,
name : 'EXNO'
} , {
fieldLabel : '快递日期' ,
format : 'Y-m-d' ,
xtype : 'datefield' ,
name : 'BILLDATE'
} , this . comboxExpressStatus , this . comboxEXPRESS , this . comboxBillType ]
} , {
xtype : 'container' ,
layout : 'hbox' ,
defaultType : 'textfield' ,
items : [ this . formReceive , this . formSender ]
} , {
xtype : 'container' ,
layout : 'hbox' ,
defaultType : 'textfield' ,
items : [ {
fieldLabel : '品名' ,
flex : 1 , name : 'GOODSNAME'
} , {
fieldLabel : '寄托物数量' ,
decimalPrecision : 0 ,
xtype : 'numberfield' ,
flex : 1 , name : 'EXCOUNT'
} , {
fieldLabel : '快递费' ,
flex : 1 , name : 'BILLFEE'
} , {
fieldLabel : '备注' ,
flex : 4 , name : 'REMARKS'
} ]
}
] //end items(fieldset 1)
} //end fieldset 1
] //end root items
} ) ; //end this.formEdit
//#endregion
//#region 添加文件明细
this . storeCrmKeyCodeCode = Ext . create ( 'DsExt.ux.RefTableStore' , {
model : 'DsShipping.ux.CrmKeyCodeModel' ,
proxy : { url : '/CommMng/BasicDataRef/GetCrmKeyCodeList' }
} ) ;
this . storeCrmKeyCodeCode . load ( { params : { condition : " and KEYTYPE='单据类型'" } } ) ;
this . comboxRECEIPTTYPE = Ext . create ( 'DsExt.ux.RefTableCombox' , {
//fieldLabel: '单据类型',
store : this . storeCrmKeyCodeCode ,
// forceSelection: true,
name : 'RECEIPTTYPE' ,
valueField : 'KEYVALUE' ,
displayField : 'KEYVALUE'
} ) ;
this . storeBodyAddList = Ext . create ( 'Ext.data.Store' , {
pageSize : this . PageSize ,
model : 'MsOpReceiptEntity' ,
remoteSort : true ,
proxy : {
type : 'ajax' ,
url : '/MvcShipping/MsOpExpress/GetDocList' ,
reader : {
id : 'GID' ,
root : 'data' ,
totalProperty : 'totalCount'
}
}
} ) ;
this . comboxRECEIPNO = Ext . create ( 'DsExt.ux.RefTableCombox' , {
//fieldLabel: '单据类型',
store : this . storeBodyAddList ,
// forceSelection: true,
name : 'RECEIPTNO' ,
valueField : 'RECEIPTNO' ,
displayField : 'RECEIPTNO' ,
listeners : {
scope : this ,
'select' : function ( combo , records , eOpts ) {
if ( records . length > 0 ) {
}
}
}
} ) ;
var _this = this ;
this . initgirdcolumns = [ {
sortable : true ,
dataIndex : 'GID' ,
header : '惟一编号' ,
hidden : true ,
width : 0
} , {
sortable : true ,
dataIndex : 'BSNO' ,
header : '业务编号' ,
hidden : true ,
width : 0
} , {
sortable : true ,
dataIndex : 'DOCTYPE' ,
header : 'DOCTYPE' ,
hidden : true ,
width : 0
} , {
sortable : true ,
dataIndex : 'MBLNO' ,
header : '提单号' ,
editor : {
xtype : 'textfield' ,
selectOnFocus : true ,
enableKeyEvents : true ,
listeners : {
keyup : function ( textfield , e ) {
if ( e . getKey ( ) == 40 ) {
_this . onNextKeyClick ( 5 )
}
}
}
} ,
width : 120
} , {
sortable : true ,
dataIndex : 'RECEIPTTYPE' ,
header : '单据类型' ,
editor : this . comboxRECEIPTTYPE ,
width : 80
} , {
sortable : true ,
dataIndex : 'RECEIPTNO' ,
header : '单据编号' ,
editor : this . comboxRECEIPNO ,
width : 130
} , {
sortable : true ,
dataIndex : 'CUSTNO' ,
header : '委托编号' ,
width : 100
} , {
sortable : true ,
dataIndex : 'CUSTOMERNAME' ,
header : '客户名称' ,
width : 100
} , {
sortable : true ,
dataIndex : 'OPLBNAME' ,
header : '业务类型' ,
width : 100
} , {
sortable : true ,
dataIndex : 'SALE' ,
header : '销售' ,
width : 100
} , {
sortable : true ,
dataIndex : 'OP' ,
header : '操作' ,
width : 100
} , {
sortable : true ,
dataIndex : 'RECEIVE_MAN' ,
header : '接单人' ,
width : 80
} , {
sortable : true ,
dataIndex : 'RECEIVE_DATE' ,
header : '接单日期' ,
renderer : Ext . util . Format . dateRenderer ( 'Y-m-d' ) ,
width : 80
} , {
sortable : true ,
dataIndex : 'SEND_MAN' ,
header : '送单人' ,
width : 80
} , {
sortable : true ,
dataIndex : 'SEND_DATE' ,
header : '送单日期' ,
renderer : Ext . util . Format . dateRenderer ( 'Y-m-d' ) , //format是'm/d/Y', 结果是”09/24/2008”
width : 80
} , {
sortable : true ,
dataIndex : 'TRANCER' ,
header : '送单快递公司' ,
width : 80
} , {
sortable : true ,
dataIndex : 'TRANCNO' ,
header : '送单快递单号' ,
width : 8
} , {
sortable : true ,
dataIndex : 'ISREPEAT' ,
header : '是否回单' ,
width : 60
} , {
sortable : true ,
dataIndex : 'REPEAT_MAN' ,
header : '回单人' ,
width : 80
} , {
sortable : true ,
dataIndex : 'REPEAT_DATE' ,
header : '回单日期' ,
renderer : Ext . util . Format . dateRenderer ( 'Y-m-d' ) , //format是'm/d/Y', 结果是”09/24/2008”
width : 80
} , {
sortable : true ,
dataIndex : 'ISRECEIVE' ,
header : '是否还单' ,
width : 60
} , {
sortable : true ,
dataIndex : 'RETURN_MAN' ,
header : '还单人' ,
width : 80
} , {
sortable : true ,
dataIndex : 'RETURN_DATE' ,
header : '还单日期' ,
renderer : Ext . util . Format . dateRenderer ( 'Y-m-d' ) , //format是'm/d/Y', 结果是”09/24/2008”
width : 80
} , {
sortable : true ,
dataIndex : 'RETURN_TRANCER' ,
header : '还单的快递公司' ,
width : 100
} , {
sortable : true ,
dataIndex : 'RETURN_TRANCNO' ,
header : '还单的快递单号' ,
width : 100
} , {
sortable : true ,
dataIndex : 'REMARK' ,
header : '备注' ,
editor : {
xtype : 'textfield' ,
selectOnFocus : true ,
enableKeyEvents : true ,
listeners : {
keyup : function ( textfield , e ) {
if ( e . getKey ( ) == 40 ) {
_this . onNextKeyClick ( 25 )
}
}
}
} ,
width : 200
} , {
sortable : true ,
dataIndex : 'CORPID' ,
header : '分公司代码' ,
hidden : true ,
width : 0
} , {
sortable : true ,
dataIndex : 'CREATEUSER' ,
header : '创建人' ,
width : 0
} , {
sortable : true ,
dataIndex : 'CREATETIME' ,
header : '创建时间' ,
width : 0
} , {
sortable : true ,
dataIndex : 'MODIFIEDUSER' ,
header : '最后更改人' ,
width : 0
} , {
sortable : true ,
dataIndex : 'MODIFIEDTIME' ,
header : '最后更改时间' ,
width : 0
} ] ;
this . columns = this . initgirdcolumns ;
this . columns = DsTruck . GetGridPanel ( GID , this . formname , this . columns , 0 ) ;
this . storeBodyList = Ext . create ( 'Ext.data.Store' , {
model : 'MsOpReceiptEntity' ,
remoteSort : false ,
proxy : {
type : 'ajax' ,
url : '/MvcShipping/MsOpExpress/GetExpressDocList' ,
reader : {
id : 'GID' ,
root : 'data' ,
totalProperty : 'totalCount'
}
}
} ) ;
this . GridCheckBoxModel = Ext . create ( 'Ext.selection.CheckboxModel' ) ;
this . cellEditingDrOpReceipt = Ext . create ( 'Ext.grid.plugin.CellEditing' , {
clicksToEdit : 1
} ) ;
this . gridList = new Ext . grid . GridPanel ( {
store : this . storeBodyList ,
enableHdMenu : false ,
region : 'center' ,
// height: 145,
loadMask : { msg : "数据加载中,请稍等..." } ,
trackMouseOver : true ,
disableSelection : false ,
plugins : [ this . cellEditingDrOpReceipt ] ,
selModel : this . GridCheckBoxModel ,
tbar : [ {
text : '添加文件明细' ,
tooltip : '添加文件明细' ,
id : 'btnadddetail' ,
iconCls : "btnadddetail" ,
handler : function ( button , event ) {
this . onAddDetailClick ( ) ;
} ,
scope : this
} , '-' , {
text : '删除文件明细' ,
tooltip : '删除文件明细' ,
id : 'btndeldetail' ,
iconCls : "btndeletedetail" ,
handler : function ( button , event ) {
this . deleteBill ( ) ;
} ,
scope : this
} , '-' , {
text : "保存列表样式" ,
menu : [ {
text : "保存" ,
handler : function ( button , event ) {
_this . columns = DsTruck . SaveGridPanel ( GID , _this . formname , _this . gridList . columns , _this . columns , 0 , true ) ; //使用者id, 表名, 中间column数组, 跳过一开始的几列
}
} , {
text : "初始化" ,
handler : function ( menu , event ) {
_this . gridList . reconfigure ( _this . storeList , _this . initgirdcolumns ) ;
_this . columns = DsTruck . SaveGridPanel ( GID , _this . formname , _this . gridList . columns , _this . initgirdcolumns , 0 , true ) ; //使用者id, 表名, 中间column数组, 跳过一开始的几列
}
} ] ,
scope : this
} ] ,
columns : this . columns
} ) ;
this . gridList . on ( 'edit' , function ( editor , e , eOpts ) {
this . gridListAfterEdit ( editor , e , eOpts ) ;
} , this ) ;
this . cellEditingDrOpReceipt . on ( 'beforeedit' , function ( editor , e ) {
return this . cellEditingOpReceiptBeforeEdit ( editor , e ) ;
} , this ) ;
// this.AddGridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
// this.gridAddList = new Ext.grid.GridPanel({
// store: this.storeBodyAddList,
// enableHdMenu: false,
// region: 'center',
// loadMask: { msg: "数据加载中,请稍等..." },
// trackMouseOver: true,
// disableSelection: false,
// selModel: this.AddGridCheckBoxModel,
// tbar: [{
// text: '添加文件明细',
// tooltip: '添加文件明细',
// id: 'btnaddbill',
// iconCls: "btnadddetail",
// handler: function (button, event) {
// this.addBill();
// },
// scope: this
// }],
// columns: this.columns,
// // paging bar on the bottom
// bbar: Ext.create('Ext.PagingToolbar', {
// store: this.storeBodyAddList,
// displayInfo: true,
// displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
// emptyMsg: "没有数据"
// })
// });
// _this = this;
// this.storeCustCodefee = Ext.create('DsExt.ux.RefTableStore', {
// model: 'DsShipping.ux.CustomRefModel',
// proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
// });
// this.storeCustCodefee.load({ params: { condition: ""} });
// this.comboxAddCustCode = Ext.create('DsExt.ux.RefTableCombox', {
// fieldLabel: '客户名称',
// store: this.storeCustCodefee,
// forceSelection: true,
// name: 'CUSTNAME',
// valueField: 'CustName',
// displayField: 'CodeAndName',
// enableKeyEvents: true,
// listeners: {
// keyup: function (field, e) {
// if (e.getKey() == e.ENTER) {
// _this.onRefreshClick();
// }
// }
// }
// });
// this.StoreOpLb = Ext.create('DsExt.ux.RefEnumStore', {});
// this.StoreOpLb.load({ params: { enumTypeId: 96005} });
// this.comboxOpLb = Ext.create('DsExt.ux.RefTableCombox', {
// fieldLabel: '业务类别',
// store: this.StoreOpLb,
// valueField: 'EnumValueName',
// displayField: 'EnumValueName',
// forceSelection: true,
// name: 'OPLBNAME',
// enableKeyEvents: true,
// listeners: {
// keyup: function (field, e) {
// if (e.getKey() == e.ENTER) {
// _this.onRefreshClick();
// }
// }
// }
// });
// this.comboxRECEIPTTYPE2 = Ext.create('DsExt.ux.RefTableCombox', {
// fieldLabel: '单据类型',
// store: this.storeCrmKeyCodeCode,
// forceSelection: true,
// name: 'RECEIPTTYPE',
// valueField: 'KEYVALUE',
// displayField: 'KEYVALUE'
// });
// this.formSearch = Ext.widget('form', {
// frame: true,
// region: 'north',
// // height:60,
// bodyPadding: 5,
// fieldDefaults: {
// margins: '2 2 2 2',
// labelAlign: 'right',
// flex: 1,
// labelWidth: 90,
// msgTarget: 'qtip'
// },
// items: [
// {//fieldset 1
// xtype: 'container',
// defaultType: 'textfield',
// layout: 'anchor',
// defaults: {
// anchor: '100%'
// },
// items: [{
// xtype: 'container',
// layout: 'hbox',
// defaultType: 'textfield',
// items: [this.comboxAddCustCode, this.comboxRECEIPTTYPE2, {
// fieldLabel: '编号检索',
// name: 'CustomNo',
// enableKeyEvents: true,
// listeners: {
// specialkey: function (field, e) {
// if (e.getKey() == e.ENTER) {
// _this.onRefreshClick();
// }
// }
// }
// }, this.comboxOpLb, {
// xtype: 'button',
// width: 90,
// text: "执行查询",
// iconCls: "btnrefresh",
// handler: function (button, event) {
// this.onRefreshClick(button, event);
// },
// scope: this
// }, {
// xtype: 'button',
// width: 30,
// // text: "重置条件",
// iconCls: "btnreset",
// handler: function (button, event) {
// this.onClearSql(button, event);
// },
// scope: this
// }, {
// xtype: 'button',
// width: 30,
// // text: "高级查询",
// iconCls: "btnmore",
// handler: function (button, event) {
// var sql = this.getCondition();
// var winAccess = new Shipping.DsQuery({
// });
// winAccess.StoreList = this.storeBodyAddList;
// winAccess.formname = this.formname;
// winAccess.condition = sql;
// winAccess.show();
// return;
// },
// scope: this
// }
// ]
// }
// ]//end items(fieldset 1)
// }//end fieldset 1
// ]//end root items
// });
// this.paneladd = new Ext.Panel({
// title: '添加文件明细',
// layout: "border",
// // region: 'south',
// region: "center",
// // height: 420,
// items: [
// this.formSearch, this.gridAddList
// ]
// });
//#endregion
//#region 查询业务锁定数据
this . StoreOpLb = Ext . create ( 'DsExt.ux.RefEnumStore' , { } ) ;
this . StoreOpLb . load ( { params : { enumTypeId : 96005 } } ) ;
this . comboxOpLb = Ext . create ( 'DsExt.ux.RefTableCombox' , {
fieldLabel : '业务类型' ,
store : this . StoreOpLb ,
forceSelection : true ,
name : 'PS_OPLB' ,
valueField : 'EnumValueName' ,
displayField : 'EnumValueName' ,
enableKeyEvents : true ,
listeners : {
keyup : function ( field , e ) {
if ( e . getKey ( ) == e . ENTER ) {
//_this.onRefreshClick();
}
}
}
} ) ;
this . storeCustCode = Ext . create ( 'DsExt.ux.RefTableStore' , {
model : 'DsShipping.ux.CustomRefModel' ,
proxy : { url : '/CommMng/BasicDataRef/GetCustomRefList' }
} ) ;
this . storeCustCode . load ( { params : { condition : "ISCONTROLLER='1'" } } ) ;
this . comboxCustCode = Ext . create ( 'DsExt.ux.RefTableCombox' , {
fieldLabel : '委托单位' ,
store : this . storeCustCode ,
forceSelection : true ,
name : 'PS_CUSTOMERNAME' ,
valueField : 'CustName' ,
displayField : 'CodeAndName' ,
enableKeyEvents : true ,
listeners : {
keyup : function ( field , e ) {
if ( e . getKey ( ) == e . ENTER ) {
//_this.onRefreshClick();
}
}
}
} ) ;
this . formSearch = Ext . widget ( 'form' , {
frame : true ,
region : 'north' ,
bodyPadding : 5 ,
fieldDefaults : {
margins : '2 2 2 2' ,
labelAlign : 'right' ,
flex : 1 ,
labelWidth : 70 ,
msgTarget : 'qtip'
} ,
items : [
{ //fieldset 1
xtype : 'container' ,
defaultType : 'textfield' ,
layout : 'anchor' ,
defaults : {
anchor : '100%'
} ,
items : [ {
xtype : 'container' ,
layout : 'hbox' ,
defaultType : 'textfield' ,
items : [ this . comboxOpLb , {
fieldLabel : '编号' ,
name : 'PS_MBLNO' ,
enableKeyEvents : true ,
listeners : {
specialkey : function ( field , e ) {
if ( e . getKey ( ) == e . ENTER ) {
_this . onRefreshClick ( ) ;
}
}
}
} , {
fieldLabel : '船名' ,
name : 'PS_VESSEL' ,
enableKeyEvents : true ,
listeners : {
specialkey : function ( field , e ) {
if ( e . getKey ( ) == e . ENTER ) {
_this . onRefreshClick ( ) ;
}
}
}
} , {
fieldLabel : '航次' ,
name : 'PS_VOYNO' ,
enableKeyEvents : true ,
listeners : {
specialkey : function ( field , e ) {
if ( e . getKey ( ) == e . ENTER ) {
_this . onRefreshClick ( ) ;
}
}
}
} , this . comboxCustCode ,
{
fieldLabel : '从ETD' ,
format : 'Y-m-d' ,
xtype : 'datefield' ,
name : 'PS_ETDDATEBGN' ,
enableKeyEvents : true ,
listeners : {
specialkey : function ( field , e ) {
if ( e . getKey ( ) == e . ENTER ) {
_this . onRefreshClick ( ) ;
}
}
}
} , {
fieldLabel : '到ETD' ,
format : 'Y-m-d' ,
xtype : 'datefield' ,
name : 'PS_ETDDATEEND' ,
enableKeyEvents : true ,
listeners : {
specialkey : function ( field , e ) {
if ( e . getKey ( ) == e . ENTER ) {
_this . onRefreshClick ( ) ;
}
}
}
} , {
xtype : 'button' ,
text : "查询" ,
iconCls : "btnsearch" ,
handler : function ( button , event ) {
this . onRefreshClick ( ) ;
} ,
scope : this
} , {
xtype : 'button' ,
text : "高级查询" ,
iconCls : "btnmore" ,
handler : function ( button , event ) {
var sql = this . getCondition ( ) ;
var winAccess = new Shipping . DsQuery ( {
} ) ;
winAccess . StoreList = this . storeListFee ;
winAccess . formname = this . formname ;
winAccess . condition = sql ;
winAccess . show ( ) ;
return ;
} ,
scope : this
} , {
xtype : 'button' ,
text : "清空条件" ,
iconCls : "btnreset" ,
handler : function ( button , event ) {
this . onClearSql ( button , event ) ;
} ,
scope : this
}
]
}
] //end items(fieldset 1)
} //end fieldset 1
] //end root items
} ) ;
//#endregion
//region 财务管理--业务锁定 数据表
//定义数据集
this . storeListFee = Ext . create ( 'Ext.data.Store' , {
pageSize : this . PageSize ,
fields : [
{ name : 'BSNO' , type : 'string' } ,
{ name : 'OPLB' , type : 'string' } ,
{ name : 'OPTYPE' , type : 'string' } ,
{ name : 'OPLBNAME' , type : 'string' } ,
{ name : 'CUSTOMERNAME' , type : 'string' } ,
{ name : 'OPSTATUS' , type : 'string' } ,
{ name : 'ACCDATE' , type : 'string' } ,
{ name : 'CUSTNO' , type : 'string' } ,
{ name : 'MBLNO' , type : 'string' } ,
{ name : 'HBLNO' , type : 'string' } ,
{ name : 'ETD' , type : 'string' } ,
{ name : 'VESSEL' , type : 'string' } ,
{ name : 'VOYNO' , type : 'string' } ,
{ name : 'CREATETIME' , type : 'string' } ,
{ name : 'ISVOU' , type : 'string' } ,
{ name : 'VOUNO' , type : 'string' } ,
{ name : 'SALE' , type : 'string' } ,
{ name : 'OP' , type : 'string' } ,
{ name : 'DOC' , type : 'string' } ,
{ name : 'CUSTSERVICE' , type : 'string' } ,
{ name : 'PORTLOAD' , type : 'string' } ,
{ name : 'PORTDISCHARGE' , type : 'string' } ,
{ name : 'CONTRACTNO' , type : 'string' } ,
{ name : 'SERVICECONTRACTNO' , type : 'string' } ,
{ name : 'CARRIER' , type : 'string' } ,
{ name : 'OPDATE' , type : 'string' } ,
{ name : 'NETWEIGHT' , type : 'number' }
] ,
remoteSort : true ,
proxy : {
type : 'ajax' ,
url : '/Account/Chfee_lock/BsListData' ,
reader : {
id : '' ,
root : 'data' ,
totalProperty : 'totalCount'
}
}
} ) ;
//定义Grid
_this = this ;
this . initgirdcolumsFee = [ {
sortable : true ,
dataIndex : 'BSNO' ,
header : '编号' ,
hidden : true ,
width : 130
} ,
{
sortable : true ,
dataIndex : 'OPLBNAME' ,
header : '业务类型' ,
width : 70
} , {
sortable : true ,
id : '' ,
dataIndex : 'OPSTATUS' ,
header : '业务状态' ,
width : 60
} , {
sortable : true ,
dataIndex : 'OPTYPE' ,
header : '更改单' ,
width : 86
} , {
sortable : true ,
dataIndex : 'ACCDATE' ,
header : '会计期间' ,
width : 86
} , {
sortable : true ,
dataIndex : 'OPDATE' ,
header : '业务日期' ,
width : 86
} , {
sortable : true ,
dataIndex : 'CUSTOMERNAME' ,
header : '委托单位' ,
width : 120
} , {
sortable : true ,
dataIndex : 'CUSTNO' ,
header : '委托编号' ,
width : 136
} , {
sortable : true ,
dataIndex : 'CONTRACTNO' ,
header : '合约号' ,
width : 136
} , {
sortable : true ,
dataIndex : 'SERVICECONTRACTNO' ,
header : '参考号' ,
width : 136
} , {
sortable : true ,
dataIndex : 'MBLNO' ,
header : '主提单号' ,
width : 120
} , {
sortable : true ,
dataIndex : 'HBLNO' ,
header : '分提单号' ,
width : 120
} , {
sortable : true ,
dataIndex : 'ETD' ,
header : '开船日期' ,
width : 86
} , {
sortable : true ,
dataIndex : 'VESSEL' ,
header : '船名' ,
width : 200
} , {
sortable : true ,
dataIndex : 'VOYNO' ,
header : '航次' ,
width : 50
} , {
sortable : true ,
dataIndex : 'SALE' ,
header : '业务员' ,
width : 80
} , {
sortable : true ,
dataIndex : 'OP' ,
header : '操作' ,
width : 80
} , {
sortable : true ,
dataIndex : 'DOC' ,
header : '单证' ,
width : 80
} , {
sortable : true ,
dataIndex : 'CUSTSERVICE' ,
header : '客服' ,
width : 80
} , {
sortable : true ,
dataIndex : 'PORTLOAD' ,
header : '起运港' ,
width : 80
} , {
sortable : true ,
dataIndex : 'PORTDISCHARGE' ,
header : '目的港' ,
width : 150
} , {
sortable : true ,
dataIndex : 'CARRIER' ,
header : '船公司' ,
width : 80
} ] ;
this . girdcolumsFee = this . initgirdcolumsFee ;
this . girdcolumsFee = DsTruck . GetGridPanel ( GID , this . formname , this . girdcolumsFee , 0 ) ;
this . GridCheckBoxModelFee = Ext . create ( 'Ext.selection.CheckboxModel' ) ;
this . gridListFee = new Ext . grid . GridPanel ( {
store : this . storeListFee ,
enableHdMenu : false ,
region : 'center' ,
loadMask : { msg : "数据加载中,请稍等..." } ,
trackMouseOver : true ,
disableSelection : false ,
selModel : this . GridCheckBoxModelFee ,
tbar : [ {
text : '添加选中明细' ,
tooltip : '添加选中明细' ,
id : 'btnadd' ,
iconCls : "btnadd" ,
handler : function ( button , event ) {
this . onAddSelected ( ) ;
} ,
scope : this
} , '-' , {
text : "保存列表样式" ,
menu : [ {
text : "保存" ,
handler : function ( button , event ) {
_this . girdcolumsFee = DsTruck . SaveGridPanel ( GID , _this . formname , _this . gridListFee . columns , _this . girdcolumsFee , 0 , true ) ; //使用者id, 表名, 中间column数组, 跳过一开始的几列
}
} , {
text : "初始化" ,
handler : function ( menu , event ) {
_this . gridListFee . reconfigure ( _this . storeListFee , _this . initgirdcolumsFee ) ;
_this . girdcolumsFee = DsTruck . SaveGridPanel ( GID , _this . formname , _this . gridListFee . columns , _this . initgirdcolumsFee , 0 , true ) ; //使用者id, 表名, 中间column数组, 跳过一开始的几列
}
} ] ,
scope : this
} ] ,
columns : this . girdcolumsFee ,
viewConfig : {
enableTextSelection : true
} ,
features : [ {
ftype : 'summary' //Ext.grid.feature.Summary表格汇总特性
} ]
} ) ;
this . gridListFee . addListener ( 'itemdblclick' , function ( dataview , record , item , index , e , b ) {
//this.SelectedRecordFee = record;
} , this ) ;
//endregion
//#region 按钮Toolbar
this . panelBtn = new Ext . Panel ( {
region : "north" ,
tbar : [
{
text : "保存" ,
iconCls : "btnsave" ,
handler : function ( button , event ) {
this . Save ( '0' ) ;
} ,
scope : this
} ,
{
text : "保存并关闭" ,
handler : function ( button , event ) {
this . Save ( '1' ) ;
} ,
scope : this
} ,
'-' ,
{
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 ( 'GID' ) . setDisabled ( false ) ;
var field = basicForm . findField ( 'GID' ) ;
field . setValue ( NewGuid ( ) ) ;
basicForm . findField ( 'GID' ) . setDisabled ( true ) ;
} ,
scope : this
} , '-' , {
text : "下单顺丰快递" ,
iconCls : "" ,
handler : function ( button , event ) {
this . CreateOrderSF ( ) ;
} ,
scope : this
} , '-' , {
text : "打印" ,
iconCls : "btnprint" ,
handler : function ( button , event ) {
this . Print ( ) ;
} ,
scope : this
}
]
} ) ; //end 按钮Toolbar
//#endregion
//#region 布局
//控件布局
this . panelTop = new Ext . Panel ( {
layout : "border" ,
region : "north" ,
height : 320 ,
items : [ this . panelBtn , this . formEdit ]
} ) ;
this . panelDetail = new Ext . Panel ( {
layout : "border" ,
region : "center" ,
items : [ this . gridList ]
} ) ;
this . panelFee = new Ext . Panel ( {
layout : "border" ,
region : 'south' ,
frame : true ,
height : 200 ,
resizable : true ,
items : [ this . formSearch , this . gridListFee ]
} ) ;
this . panelDoc = new Ext . Panel ( {
layout : "border" ,
title : "邮寄文件明细" ,
region : "center" ,
items : [ this . panelDetail , this . panelFee ]
} ) ;
Ext . apply ( this , {
items : [ this . panelTop , this . panelDoc ]
} ) ;
//#endregion
this . ParentWin = window . parent . opener . _this ;
//初始化数据
this . InitData ( ) ;
//收件人地址管理
//定义数据集
this . storeListAddress = Ext . create ( 'Ext.data.Store' , {
fields : [
{ name : 'GID' , type : 'string' } ,
{ name : 'NAME' , type : 'string' } ,
{ name : 'CORPNAME' , type : 'string' } ,
{ name : 'CORPNAMERV' , type : 'string' } ,
{ name : 'ADDRESS' , type : 'string' } ,
{ name : 'PROVINCE' , type : 'string' } ,
{ name : 'DESTI' , type : 'string' } ,
{ name : 'TEL' , type : 'string' } ,
{ name : 'POSTCODE' , type : 'string' } ] ,
remoteSort : true ,
proxy : {
type : 'ajax' ,
url : '/MsOpExpress/GetAddressList' ,
reader : {
id : 'GID' ,
root : 'data' ,
totalProperty : 'totalCount'
}
}
} ) ;
//定义Grid
this . initgirdcolumsAddress = [ {
sortable : true ,
dataIndex : 'GID' ,
header : 'GID' ,
hidden : true ,
width : 130
} ,
{
sortable : true ,
dataIndex : 'NAME' ,
header : '姓名' ,
width : 70
} , {
sortable : true ,
dataIndex : 'TEL' ,
header : '电话' ,
width : 60
} , {
sortable : true ,
dataIndex : 'DESTI' ,
header : '城市' ,
width : 60
} ] ;
this . girdcolumsAddress = this . initgirdcolumsAddress ;
this . GridCheckBoxModelAddress = Ext . create ( 'Ext.selection.CheckboxModel' ) ;
this . gridListAddress = new Ext . grid . GridPanel ( {
store : this . storeListAddress ,
flex : 0.8 ,
enableHdMenu : false ,
region : 'center' ,
loadMask : { msg : "数据加载中,请稍等..." } ,
trackMouseOver : true ,
disableSelection : false ,
selModel : this . GridCheckBoxModelAddress ,
columns : this . girdcolumsAddress ,
tbar : [ {
text : '添加地址' ,
tooltip : '添加地址' ,
id : 'btnadddress' ,
iconCls : "btnadddetail" ,
handler : function ( button , event ) {
this . onAddressAdd ( ) ;
} ,
scope : this
} , '-' , {
text : '复制添加' ,
tooltip : '复制添加' ,
id : 'btncopyaddress' ,
iconCls : "btnadddetail" ,
handler : function ( button , event ) {
this . onAddressCopy ( ) ;
} ,
scope : this
} , '-' , {
text : '保存' ,
tooltip : '保存' ,
id : 'btnsaveadddress' ,
iconCls : "btnsave" ,
handler : function ( button , event ) {
this . onAddressSave ( ) ;
} ,
scope : this
} , '-' , {
text : '删除地址' ,
tooltip : '删除地址' ,
id : 'btndeladdress' ,
iconCls : "btndeletedetail" ,
handler : function ( button , event ) {
this . onAddressDel ( ) ;
} ,
scope : this
} ] ,
viewConfig : {
enableTextSelection : true
}
} ) ;
//单击事件
this . gridListAddress . addListener ( 'itemclick' , function ( dataview , record , item , index , e , b ) {
var addrData = record . data ;
this . formAddressDetail . getForm ( ) . setValues ( addrData ) ;
} , this ) ;
//双击事件
this . gridListAddress . addListener ( 'itemdblclick' , function ( dataview , record , item , index , e , b ) {
var addrData = record . data ;
this . formEdit . getForm ( ) . findField ( 'RECEIVEATTN' ) . setValue ( addrData . NAME ) ;
this . formEdit . getForm ( ) . findField ( 'RECEIVEPROVINCE' ) . setValue ( addrData . PROVINCE ) ;
this . formEdit . getForm ( ) . findField ( 'RECEIVECITY' ) . setValue ( addrData . DESTI ) ;
this . formEdit . getForm ( ) . findField ( 'RECEIVEADDR' ) . setValue ( addrData . ADDRESS ) ;
this . formEdit . getForm ( ) . findField ( 'RECEIVEPOST' ) . setValue ( addrData . POSTCODE ) ;
this . formEdit . getForm ( ) . findField ( 'RECEIVETEL' ) . setValue ( addrData . TEL ) ;
this . formEdit . getForm ( ) . findField ( 'RECEIVE' ) . setValue ( addrData . CORPNAMERV ) ;
this . winAddress . close ( ) ;
} , this ) ;
//收件人省份
//定义数据集
this . storeListProvince = Ext . create ( 'Ext.data.Store' , {
fields : [
{ name : 'ProvinceName' , type : 'string' } ] ,
remoteSort : true ,
proxy : {
type : 'ajax' ,
url : '/MsOpExpress/GetProvinceList' ,
reader : {
id : 'ProvinceName' ,
root : 'data' ,
totalProperty : 'totalCount'
}
}
} ) ;
this . comboxProvince = Ext . create ( 'DsExt.ux.RefTableCombox' , {
fieldLabel : '收件省份' ,
store : this . storeListProvince ,
forceSelection : true ,
name : 'PROVINCE' ,
valueField : 'ProvinceName' ,
displayField : 'ProvinceName' ,
listeners : {
scope : this ,
'select' : function ( combo , records , eOpts ) {
if ( records . length > 0 ) {
var curProv = records [ 0 ] . data . ProvinceName ;
this . storeListCity . load ( { params : { Province : curProv } } ) ;
}
}
}
} ) ;
this . storeListProvince . load ( ) ;
//城市
//定义数据集
this . storeListCity = Ext . create ( 'Ext.data.Store' , {
fields : [
{ name : 'CityName' , type : 'string' } ] ,
remoteSort : true ,
proxy : {
type : 'ajax' ,
url : '/MsOpExpress/GetCityList' ,
reader : {
id : 'CityName' ,
root : 'data' ,
totalProperty : 'totalCount'
}
}
} ) ;
this . comboxCity = Ext . create ( 'DsExt.ux.RefTableCombox' , {
fieldLabel : '收件城市' ,
store : this . storeListCity ,
forceSelection : true ,
name : 'DESTI' ,
valueField : 'CityName' ,
displayField : 'CityName'
} ) ;
this . storeListCity . load ( { params : { Province : '' } } ) ;
this . formAddressDetail = Ext . widget ( 'form' , {
//region: 'north',
title : '收件人资料' ,
flex : 1 ,
frame : true ,
bodyPadding : 0 ,
collapsed : false ,
collapsible : true ,
trackResetOnLoad : true ,
fieldDefaults : {
margins : '2 2 2 2' ,
labelAlign : 'right' ,
flex : 1 ,
labelWidth : 110 ,
msgTarget : 'qtip'
} ,
items : [
{ //fieldset 1
xtype : 'fieldset' ,
defaultType : 'textfield' ,
layout : 'anchor' ,
defaults : {
anchor : '100%'
} ,
items : [ {
xtype : 'container' ,
layout : 'hbox' ,
defaultType : 'textfield' ,
items : [ {
fieldLabel : 'GID' ,
name : 'GID' ,
hidden : true ,
} , {
fieldLabel : '收件人' ,
name : 'NAME'
} ]
} , {
xtype : 'container' ,
layout : 'hbox' ,
defaultType : 'textfield' ,
items : [ this . comboxProvince , this . comboxCity ]
} , {
xtype : 'container' ,
layout : 'hbox' ,
defaultType : 'textfield' ,
items : [ {
fieldLabel : '收件公司' ,
name : 'CORPNAMERV'
} ]
} , {
xtype : 'container' ,
layout : 'hbox' ,
defaultType : 'textfield' ,
items : [ {
xtype : 'textareafield' ,
grow : true ,
fieldLabel : '收件详细地址' ,
height : 40 ,
name : 'ADDRESS' ,
anchor : '100%'
} ]
} , {
xtype : 'container' ,
layout : 'hbox' ,
defaultType : 'textfield' ,
items : [ {
fieldLabel : '收件人邮编' ,
name : 'POSTCODE'
} ,
{
fieldLabel : '收件人电话' ,
name : 'TEL'
} ]
} , {
xtype : 'container' ,
layout : 'hbox' ,
defaultType : 'textfield' ,
items : [ {
fieldLabel : '收件公司' ,
hidden : true ,
name : 'CORPNAME'
} ]
} ] //end root items
} ]
} ) ; //
this . formAddress = 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 : 'hbox' ,
defaults : {
anchor : '100%'
} ,
items : [ this . gridListAddress , this . formAddressDetail ] //end items(fieldset 1)
} //end fieldset 1
] //end root items
} ) ;
me = this ;
this . winAddress = Ext . create ( 'Ext.window.Window' , {
title : '地址管理' , //"",
width : 850 ,
//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 . formAddress ]
} ) ;
} , //end initUIComponents
InitData : function ( ) {
this . opStatus = 'add' ;
var condition = '' ;
if ( this . ParentWin ) {
var ret = this . ParentWin . OprationSwap ( ) ;
this . opStatus = ret [ 0 ] ;
this . StoreList = ret [ 1 ] ;
this . editRecord = ret [ 2 ] ;
}
if ( this . opStatus == 'edit' )
condition = " GID='" + this . editRecord . get ( 'GID' ) + "'" ;
this . LoadData ( this . opStatus , condition ) ;
} , //end InitData
LoadData : function ( opstatus , condition ) {
this . serialNo = 0 ;
this . workSerialNo = 0 ;
this . bodyDel = [ ] ;
this . opStatus = opstatus ;
Ext . Ajax . request ( {
waitMsg : '正在查询主表数据...' ,
url : '/MvcShipping/MsOpExpress/GetData' ,
params : {
handle : opstatus ,
condition : condition
} ,
callback : function ( options , success , response ) {
if ( success ) {
var result = Ext . JSON . decode ( response . responseText ) ;
if ( ! result . Success ) {
Ext . Msg . show ( {
title : '提示' ,
msg : result . Message ,
icon : Ext . MessageBox . ERROR ,
buttons : Ext . Msg . OK
} ) ;
return ;
}
var data = result . data ;
this . formEdit . getForm ( ) . reset ( ) ;
this . formEdit . getForm ( ) . setValues ( data ) ;
var sql = " e.EXPID='" + data . GID + "'" ;
this . storeBodyList . load ( { params : { start : 0 , limit : this . PageSize , sort : '' , condition : sql } } ) ;
} else {
Ext . MessageBox . alert ( '请求出现错误,请重试' , response . responseText ) ;
}
} ,
scope : this
} ) ;
} , // end LoadDate
Save : function ( type ) {
var basicForm = this . formEdit . getForm ( ) ;
if ( ! basicForm . isValid ( ) ) {
return ;
}
this . cellEditingDrOpReceipt . startEditByPosition ( { row : 0 , column : 25 } ) ;
basicForm . findField ( 'GID' ) . setDisabled ( false ) ;
var data = basicForm . getValues ( ) ;
var tmpATTN = basicForm . findField ( 'SENDERATTN' ) . getValue ( ) ;
if ( tmpATTN . constructor == Array ) {
data . SENDERATTN = '' ;
for ( let i = 0 ; i < tmpATTN . length ; i ++ ) {
if ( i == 0 )
data . SENDERATTN += tmpATTN [ i ] ;
if ( i == 1 ) {
data . SENDERATTN += ',' ;
data . SENDERATTN += tmpATTN [ i ] ;
}
}
}
basicForm . findField ( 'GID' ) . setDisabled ( true ) ;
// if (this.opStatus == 'add') {
// data.GID = NewGuid();
// }
var bodydatas = [ ] ;
for ( var i = 0 ; i < this . storeBodyList . getCount ( ) ; i += 1 ) {
var member = this . storeBodyList . getAt ( i ) ;
if ( member . data . BSNO != '' )
bodydatas . push ( member ) ;
else {
Ext . MessageBox . alert ( '系统中不存在此票提单号业务,不允许保存' , member . data . MBLNO ) ;
return ;
}
if ( member . data . ISREPEAT == '否' )
member . data . ISREPEAT = 'false' ;
else
member . data . ISREPEAT = 'true' ;
if ( member . data . ISRECEIVE == '否' )
member . data . ISRECEIVE = 'false' ;
else
member . data . ISRECEIVE = 'true' ;
}
//
var jsonBody = ConvertRecordsToJsonAll ( bodydatas ) ;
Ext . Msg . wait ( '正在保存数据, 请稍侯..' ) ;
Ext . Ajax . request ( {
waitMsg : '正在保存数据...' ,
url : '/MvcShipping/MsOpExpress/Save' ,
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 ( ) . setValues ( returnData ) ;
var sql = " e.EXPID='" + returnData . GID + "'" ;
this . storeBodyList . load ( { params : { start : 0 , limit : this . PageSize , sort : '' , condition : sql } } ) ;
if ( this . opStatus == 'add' ) {
var arrNewRecords = this . StoreList . add ( returnData ) ;
this . editRecord = arrNewRecords [ 0 ] ;
}
else if ( this . opStatus == 'edit' ) {
var editp = Ext . create ( 'MsOpExpress' , returnData ) ;
this . editRecord . fields . each ( function ( field ) {
if ( field . persist ) {
name = field . name ;
if ( name != 'id' )
this . editRecord . set ( name , editp . get ( name ) ) ;
}
} , this ) ;
this . editRecord . commit ( ) ;
}
if ( type == '0' ) {
this . opStatus = 'edit' ;
basicForm . findField ( 'GID' ) . setDisabled ( true ) ;
} else if ( type == '1' ) {
window . close ( ) ;
} else if ( type == '3' ) {
this . addBillfn ( ) ;
} else {
this . LoadData ( 'add' , '' ) ;
basicForm . findField ( 'GID' ) . 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
onRefreshClick : function ( button , event ) {
var sql = this . getCondition ( ) ;
this . sqlcontext = sql ;
this . storeListFee . pageSize = this . PageSize ;
this . storeListFee . load ( {
params : { start : 0 , limit : 5 , condition : sql , type : 'BSVOUCHER' } ,
waitMsg : "正在查询数据..." ,
scope : this
} ) ;
} ,
onClearSql : function ( ) {
var form = this . formSearch . getForm ( ) ;
form . reset ( ) ;
} ,
CreateOrderSF : function ( ) {
var basicForm = this . formEdit . getForm ( ) ;
if ( ! basicForm . isValid ( ) ) {
return ;
}
if ( basicForm . findField ( 'BILLSTATUS' ) . getValue ( ) == '已下单' ) {
if ( ! ( confirm ( "确认重新下单?" ) ) )
return ;
}
if ( basicForm . findField ( 'RECEIVE' ) . getValue ( ) == '' ||
basicForm . findField ( 'RECEIVEATTN' ) . getValue ( ) == '' ||
basicForm . findField ( 'RECEIVETEL' ) . getValue ( ) == '' ||
basicForm . findField ( 'RECEIVEADDR' ) . getValue ( ) == '' ) {
Ext . MessageBox . alert ( '请求出现错误' , '收件方信息填写不全!' ) ;
return ;
}
if ( basicForm . findField ( 'SENDER' ) . getValue ( ) == '' ||
basicForm . findField ( 'SENDERATTN' ) . getValue ( ) == '' ||
basicForm . findField ( 'SENDERTEL' ) . getValue ( ) == '' ||
basicForm . findField ( 'SENDERADDR' ) . getValue ( ) == '' ) {
Ext . MessageBox . alert ( '请求出现错误' , '寄件方信息填写不全!' ) ;
return ;
}
if ( basicForm . findField ( 'GID' ) . getValue ( ) == '*' || basicForm . findField ( 'GID' ) . getValue ( ) == '' || basicForm . findField ( 'GID' ) . getValue ( ) == undefined ) {
Ext . MessageBox . alert ( '请求出现错误' , '请先保存快递单!' ) ;
return ;
}
_this = this ;
var data = basicForm . getValues ( ) ;
var tmpATTN = basicForm . findField ( 'SENDERATTN' ) . getValue ( ) ;
if ( tmpATTN . constructor == Array ) {
data . SENDERATTN = '' ;
for ( let i = 0 ; i < tmpATTN . length ; i ++ ) {
if ( i == 0 )
data . SENDERATTN += tmpATTN [ i ] ;
if ( i == 1 ) {
data . SENDERATTN += ',' ;
data . SENDERATTN += tmpATTN [ i ] ;
}
}
}
Ext . Ajax . request ( {
waitMsg : '正在下单,请稍等...' ,
url : '/MvcShipping/MsOpExpress/CreateOrderSF' ,
params : {
data : Ext . JSON . encode ( data )
} ,
callback : function ( options , success , response ) {
var jsonresult = Ext . JSON . decode ( response . responseText ) ;
if ( jsonresult . Success ) {
Ext . MessageBox . alert ( '系统提示' , '下单成功!' ) ;
_this . formEdit . getForm ( ) . findField ( 'EXNO' ) . setValue ( jsonresult . Message ) ;
_this . formEdit . getForm ( ) . findField ( 'BILLSTATUS' ) . setValue ( '已下单' ) ;
} else {
Ext . MessageBox . alert ( '请求出现错误,请重试' , response . responseText ) ;
}
} ,
scope : this
} ) ;
} ,
//添加选中的业务费用到文件明细
onAddSelected : function ( ) {
selectedRecords = this . gridListFee . selModel . getSelection ( ) ;
if ( selectedRecords . length < 1 ) return ;
var store = this . storeBodyList ;
var myDate = new Date ( ) ;
var EXPRESSCORP = this . formEdit . getForm ( ) . findField ( 'EXPRESSCORP' ) . getValue ( ) ;
var EXNO = this . formEdit . getForm ( ) . findField ( 'EXNO' ) . getValue ( ) ;
var SENDERADDR = this . formEdit . getForm ( ) . findField ( 'SENDERADDR' ) . getValue ( ) ;
for ( var i = 0 ; i < selectedRecords . length ; i ++ ) {
recordFee = selectedRecords [ i ] . data ;
var record = null ;
record = Ext . create ( 'MsOpReceiptEntity' , {
GID : NewGuid ( ) , // 惟一编号
BSNO : recordFee . BSNO , // 关联编号/业务编号BSNO
EXPID : '*' , // 关联编号/业务编号BSNO
DOCID : '*' , // 关联编号/业务编号BSNO
DOCTYPE : '2' , // 关联编号/业务编号BSNO
MBLNO : recordFee . MBLNO , // 关联编号/业务编号BSNO
RECEIPTNO : '' , // 单据编号
RECEIPTTYPE : '' , // 单据类型
CUSTOMERNAME : recordFee . CUSTOMERNAME , //客户名称
CUSTNO : recordFee . CUSTNO , //委托编号
SALE : recordFee . SALE , //业务员
OP : recordFee . OP , //操作
OPLBNAME : recordFee . OPLBNAME , //业务类型
RECEIVE _MAN : SHOWNAME , // 接单人
RECEIVE _DATE : myDate , // 接单日期
SEND _MAN : SENDERADDR , // 送单人
SEND _DATE : myDate , // 送单日期
TRANCER : EXPRESSCORP , // 送单的快递公司
TRANCNO : EXNO , // 送单的快递单号
ISREPEAT : '否' , // 是否回单
REPEAT _MAN : '' , // 回单人
REPEAT _DATE : null , // 回单日期
ISRECEIVE : '否' , // 是否还单
RETURN _MAN : '' , // 还单人
RETURN _DATE : null , // 还单日期
RETURN _TRANCER : '' , // 还单的快递公司
RETURN _TRANCNO : '' , // 还单的快递单号
REMARK : '' , // 备注
CORPID : '' , // 分公司代码
CREATEUSER : USERID , // 创建人GID
CREATETIME : null , // 创建时间
MODIFIEDUSER : USERID , // 更改操作人GID
MODIFIEDTIME : null // 更改操作时间
//Sort: newSerialno,
} ) ;
store . add ( record ) ;
this . storeListFee . remove ( recordFee ) ;
this . formEdit . getForm ( ) . findField ( 'RECEIVECUST' ) . setValue ( recordFee . CUSTOMERNAME ) ;
var receRecords = DsStoreQueryBy ( this . storeReceive , 'SHORTNAME' , recordFee . CUSTOMERNAME ) ;
if ( receRecords . getCount ( ) > 0 ) {
var receData = receRecords . getAt ( 0 ) . data ;
this . formEdit . getForm ( ) . findField ( 'RECEIVE' ) . setValue ( receData . DESCRIPTION ) ;
}
}
} ,
//#region 明细操作
onNextKeyClick : function ( col ) {
var rows = this . gridList . getSelectionModel ( ) . getSelection ( ) ;
var row = rows [ rows . length - 1 ] ;
var s = this . gridList . getStore ( ) ;
var number = s . indexOf ( row ) + 1 ;
if ( number == this . gridList . getStore ( ) . getCount ( ) ) {
this . onAddDetailClick ( s , event ) ;
} else {
this . cellEditingDrOpReceipt . startEditByPosition ( { row : number , column : col } ) ;
}
} ,
onAddDetailClick : function ( button , event ) {
var store = this . storeBodyList ;
var myDate = new Date ( ) ;
//myDate = this.GetDateStr(0);
var EXPRESSCORP = this . formEdit . getForm ( ) . findField ( 'EXPRESSCORP' ) . getValue ( ) ;
var EXNO = this . formEdit . getForm ( ) . findField ( 'EXNO' ) . getValue ( ) ;
var SENDERADDR = this . formEdit . getForm ( ) . findField ( 'SENDERADDR' ) . getValue ( ) ;
var record = null ;
record = Ext . create ( 'MsOpReceiptEntity' , {
GID : NewGuid ( ) , // 惟一编号
BSNO : '*' , // 关联编号/业务编号BSNO
EXPID : '*' , // 关联编号/业务编号BSNO
DOCID : '*' , // 关联编号/业务编号BSNO
DOCTYPE : '2' , // 关联编号/业务编号BSNO
MBLNO : '' , // 关联编号/业务编号BSNO
RECEIPTNO : '' , // 单据编号
RECEIPTTYPE : '' , // 单据类型
RECEIVE _MAN : SHOWNAME , // 接单人
RECEIVE _DATE : myDate , // 接单日期
SEND _MAN : SENDERADDR , // 送单人
SEND _DATE : myDate , // 送单日期
TRANCER : EXPRESSCORP , // 送单的快递公司
TRANCNO : EXNO , // 送单的快递单号
ISREPEAT : '否' , // 是否回单
REPEAT _MAN : '' , // 回单人
REPEAT _DATE : null , // 回单日期
ISRECEIVE : '否' , // 是否还单
RETURN _MAN : '' , // 还单人
RETURN _DATE : null , // 还单日期
RETURN _TRANCER : '' , // 还单的快递公司
RETURN _TRANCNO : '' , // 还单的快递单号
REMARK : '' , // 备注
CORPID : '' , // 分公司代码
CREATEUSER : USERID , // 创建人GID
CREATETIME : null , // 创建时间
MODIFIEDUSER : USERID , // 更改操作人GID
MODIFIEDTIME : null // 更改操作时间
//Sort: newSerialno,
} ) ;
store . add ( record ) ;
var editColumnIndex = 1 ;
var cellediting = this . cellEditingDrOpReceipt ;
var n = store . getCount ( ) ;
cellediting . startEditByPosition ( { row : n - 1 , column : editColumnIndex } ) ;
} ,
onCancelDetailClick : function ( menu , event ) {
var store = this . storeBodyList ;
for ( var i = 0 ; i < store . getCount ( ) ; i += 1 ) {
var member = store . getAt ( i ) ;
member . reject ( ) ;
}
} ,
GetHandleSerialNo : function ( store ) {
var result = 0 ;
if ( result == 0 ) {
for ( var i = 0 ; i < store . getCount ( ) ; i += 1 ) {
var member = store . getAt ( i ) ;
if ( member . data . Sort > result ) {
result = member . data . Sort ;
}
}
}
result = parseInt ( result ) + 1 ;
return result ;
} ,
//获取日期
GetDateStr : function ( AddDayCount ) {
var dd = new Date ( ) ;
dd . setDate ( dd . getDate ( ) + AddDayCount ) ; //获取AddDayCount天后的日期
var y = dd . getFullYear ( ) ;
var m = dd . getMonth ( ) + 1 ; //获取当前月份的日期
var d = dd . getDate ( ) ;
return y + "-" + m + "-" + d ;
} ,
//#endregion
//#region 表格的AfterEdit
gridListAfterEdit : function ( editor , e , eOpts ) {
if ( e . value == e . originalValue ) return ;
if ( e . field == 'MBLNO' ) {
Ext . Ajax . request ( {
waitMsg : '正在查询主表数据...' ,
url : '/MvcShipping/MsOpBill/GetBLData' ,
params : {
condition : "MBLNO='" + e . value + "'"
} ,
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 ;
e . record . set ( 'BSNO' , data . BSNO ) ;
e . record . set ( 'CUSTNO' , data . CUSTNO ) ;
e . record . set ( 'CUSTOMERNAME' , data . CUSTOMERNAME ) ;
e . record . set ( 'OPLBNAME' , data . OPLBNAME ) ;
e . record . set ( 'SALE' , data . SALE ) ;
e . record . set ( 'OP' , data . OP ) ;
if ( data . BSNO == "" ) {
Ext . Msg . show ( { title : '提示' , msg : '系统中不存在此票提单号,不允许保存!' , icon : Ext . Msg . INFO , buttons : Ext . Msg . OK } ) ;
} else this . storeBodyAddList . load ( { params : { start : 0 , limit : 100 , sort : '' , condition : " d.BSNO='" + data . BSNO + "'" } } ) ;
var RECEIVECUST = this . formEdit . getForm ( ) . findField ( 'RECEIVECUST' ) ;
if ( RECEIVECUST . getValue ( ) == '' && data . CUSTOMERNAME != '' ) {
var Cargoinforecords = DsStoreQueryBy ( this . storeReceive , 'SHORTNAME' , data . CUSTOMERNAME ) ;
if ( Cargoinforecords . getCount ( ) > 0 ) {
var Cargoinfodata = Cargoinforecords . getAt ( 0 ) . data ;
RECEIVECUST . setValue ( Cargoinfodata . SHORTNAME ) ;
var RECEIVE = this . formEdit . getForm ( ) . findField ( 'RECEIVE' ) ;
RECEIVE . setValue ( Cargoinfodata . DESCRIPTION ) ;
var RECEIVEADDR = this . formEdit . getForm ( ) . findField ( 'RECEIVEADDR' ) ;
RECEIVEADDR . setValue ( Cargoinfodata . ADDRESS ) ;
var RECEIVETEL = this . formEdit . getForm ( ) . findField ( 'RECEIVETEL' ) ;
RECEIVETEL . setValue ( Cargoinfodata . OFFICEPHONE ) ;
var RECEIVECITY = this . formEdit . getForm ( ) . findField ( 'RECEIVECITY' ) ;
RECEIVECITY . setValue ( Cargoinfodata . CITY ) ;
var RECEIVEATTN = this . formEdit . getForm ( ) . findField ( 'RECEIVEATTN' ) ;
RECEIVEATTN . setValue ( Cargoinfodata . CHIEF ) ;
}
}
} else {
Ext . MessageBox . alert ( '请求出现错误,请重试' , response . responseText ) ;
}
} ,
scope : this
} ) ;
} else if ( e . field == 'RECEIPTTYPE' ) {
if ( e . value == '发票' ) {
var CUSTOMERNAME = this . formEdit . getForm ( ) . findField ( 'RECEIVECUST' ) . getValue ( ) ;
this . storeBodyAddList . load ( { params : { start : 0 , limit : 100 , sort : '' , condition : " CUSTOMERNAME='" + CUSTOMERNAME + "'" , doctype : '发票' } } ) ;
}
}
else if ( e . field == 'RECEIPTNO' ) {
var Cargoinforecords = DsStoreQueryBy ( this . storeBodyAddList , 'RECEIPTNO' , e . value ) ;
if ( Cargoinforecords . getCount ( ) > 0 ) {
var Cargoinfodata = Cargoinforecords . getAt ( 0 ) . data ;
e . record . set ( 'DOCID' , Cargoinfodata . GID ) ;
e . record . set ( 'RECEIPTTYPE' , Cargoinfodata . RECEIPTTYPE ) ;
e . record . set ( 'RECEIVE_MAN' , Cargoinfodata . RECEIVE _MAN ) ;
e . record . set ( 'RECEIVE_DATE' , Cargoinfodata . RECEIVE _DATE ) ;
e . record . set ( 'SEND_MAN' , Cargoinfodata . SEND _MAN ) ;
e . record . set ( 'SEND_DATE' , Cargoinfodata . SEND _DATE ) ;
e . record . set ( 'TRANCER' , Cargoinfodata . TRANCER ) ;
e . record . set ( 'TRANCNO' , Cargoinfodata . TRANCNO ) ;
e . record . set ( 'ISREPEAT' , Cargoinfodata . ISREPEAT ) ;
e . record . set ( 'REPEAT_MAN' , Cargoinfodata . REPEAT _MAN ) ;
e . record . set ( 'REPEAT_DATE' , Cargoinfodata . REPEAT _DATE ) ;
e . record . set ( 'ISRECEIVE' , Cargoinfodata . ISRECEIVE ) ;
e . record . set ( 'RETURN_MAN' , Cargoinfodata . RETURN _MAN ) ;
e . record . set ( 'RETURN_DATE' , Cargoinfodata . RETURN _DATE ) ;
e . record . set ( 'RETURN_TRANCER' , Cargoinfodata . RETURN _TRANCER ) ;
e . record . set ( 'RETURN_TRANCNO' , Cargoinfodata . RETURN _TRANCNO ) ;
e . record . set ( 'REMARK' , Cargoinfodata . REMARK ) ;
e . record . set ( 'CORPID' , Cargoinfodata . CORPID ) ;
e . record . set ( 'CREATEUSER' , Cargoinfodata . CREATEUSER ) ;
e . record . set ( 'CREATETIME' , Cargoinfodata . CREATETIME ) ;
e . record . set ( 'MODIFIEDUSER' , Cargoinfodata . MODIFIEDUSER ) ;
e . record . set ( 'MODIFIEDTIME' , Cargoinfodata . MODIFIEDTIME ) ;
} else {
var EXPRESSCORP = this . formEdit . getForm ( ) . findField ( 'EXPRESSCORP' ) . getValue ( ) ;
var EXNO = this . formEdit . getForm ( ) . findField ( 'EXNO' ) . getValue ( ) ;
var SENDERADDR = this . formEdit . getForm ( ) . findField ( 'SENDERADDR' ) . getValue ( ) ;
e . record . set ( 'DOCID' , '*' ) ;
e . record . set ( 'RECEIPTTYPE' , '' ) ;
e . record . set ( 'RECEIVE_MAN' , '' ) ;
e . record . set ( 'RECEIVE_DATE' , '' ) ;
e . record . set ( 'SEND_MAN' , SENDERADDR ) ;
e . record . set ( 'SEND_DATE' , myDate ) ;
e . record . set ( 'TRANCER' , EXPRESSCORP ) ;
e . record . set ( 'TRANCNO' , EXNO ) ;
e . record . set ( 'ISREPEAT' , 'false' ) ;
e . record . set ( 'REPEAT_MAN' , '' ) ;
e . record . set ( 'REPEAT_DATE' , '' ) ;
e . record . set ( 'ISRECEIVE' , 'false' ) ;
e . record . set ( 'RETURN_MAN' , '' ) ;
e . record . set ( 'RETURN_DATE' , '' ) ;
e . record . set ( 'RETURN_TRANCER' , '' ) ;
e . record . set ( 'RETURN_TRANCNO' , '' ) ;
e . record . set ( 'REMARK' , '' ) ;
e . record . set ( 'CORPID' , '' ) ;
e . record . set ( 'CREATEUSER' , '' ) ;
e . record . set ( 'CREATETIME' , '' ) ;
e . record . set ( 'MODIFIEDUSER' , '' ) ;
e . record . set ( 'MODIFIEDTIME' , '' ) ;
}
}
} ,
//#endregion
cellEditingOpReceiptBeforeEdit : function ( editor , e ) {
// var DOCTYPE = e.record.get('DOCTYPE');
// var canedit = false;
// if (DOCTYPE == "2") {
// canedit = true
// };
// return canedit;
} ,
addBill : function ( ) {
var basicForm = this . formEdit . getForm ( ) ;
var selectedRecords = this . gridAddList . selModel . getSelection ( ) ;
if ( selectedRecords . length == 0 ) {
Ext . Msg . show ( { title : '提示' , msg : '没有选择要添加的业务!' , icon : Ext . Msg . INFO , buttons : Ext . Msg . OK } ) ;
return ;
} ;
var Duino = this . formEdit . getForm ( ) . findField ( 'GID' ) . getValue ( ) ;
_this = this ;
if ( ( Duino == '*' ) || basicForm . isDirty ( ) ) {
var CUSTOMERNAME = this . formEdit . getForm ( ) . findField ( 'RECEIVECUST' ) . getValue ( ) ;
if ( ( CUSTOMERNAME == '' ) || ( CUSTOMERNAME == null ) ) {
this . formEdit . getForm ( ) . findField ( 'RECEIVECUST' ) . setValue ( selectedRecords [ 0 ] . data . CUSTOMERNAME ) ;
}
if ( ! basicForm . isValid ( ) ) {
return ;
}
this . Save ( "3" ) ;
} else {
this . addBillfn ( ) ;
}
} , //end save
addBillfn : function ( ) {
var billcust = this . editRecord . data . RECEIVECUST ;
var billno = this . editRecord . data . GID ;
var selectedRecords = this . gridAddList . selModel . getSelection ( ) ;
if ( selectedRecords . length == 0 ) {
Ext . Msg . show ( { title : '提示' , msg : '没有选择要添加的业务!' , icon : Ext . Msg . INFO , buttons : Ext . Msg . OK } ) ;
return ;
} ;
var bodyAddDatas = [ ] ;
for ( var i = 0 ; i < selectedRecords . length ; i ++ ) {
var rec = selectedRecords [ i ] ;
if ( rec . data . CUSTOMERNAME == billcust )
bodyAddDatas . push ( rec ) ;
}
var jsonbodyAddDatas = ConvertRecordsToJsonAll ( bodyAddDatas ) ;
Ext . Ajax . request ( {
waitMsg : '正在添加数据...' ,
url : '/MvcShipping/MsOpExpress/AddBill' ,
params : {
billno : billno ,
data : jsonbodyAddDatas
} ,
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 {
dataList = result . Data ;
if ( dataList == null ) {
var sql = this . BillSql ;
// this.storeBodyAddList.load({ params: { start: 0, limit: _this.PageSize, sort: '', condition: sql} });
this . storeBodyList . load ( { params : { condition : " e.EXPID='" + billno + "'" } } ) ;
} else {
}
}
} else {
Ext . MessageBox . alert ( '请求出现错误,请重试' , response . responseText ) ;
}
} ,
scope : this
} ) ;
} ,
deleteBill : function ( type ) {
var billno = this . formEdit . getForm ( ) . findField ( 'GID' ) . getValue ( ) ;
var selectedRecords = this . gridList . selModel . getSelection ( ) ;
if ( selectedRecords . length == 0 ) {
Ext . Msg . show ( { title : '提示' , msg : '没有要删除的文件明细!' , icon : Ext . Msg . INFO , buttons : Ext . Msg . OK } ) ;
return ;
} ;
var bodyAddDatas = [ ] ;
for ( var i = 0 ; i < selectedRecords . length ; i ++ ) {
var rec = selectedRecords [ i ] ;
bodyAddDatas . push ( rec ) ;
}
var jsonbodyAddDatas = ConvertRecordsToJsonAll ( bodyAddDatas ) ;
var sql = this . BillSql ;
Ext . Ajax . request ( {
waitMsg : '正在删除数据...' ,
url : '/MvcShipping/MsOpExpress/DelBill' ,
params : {
billno : billno ,
data : jsonbodyAddDatas
} ,
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 {
var sql = this . BillSql ;
// this.storeBodyAddList.load({ params: { start: 0, limit: _this.PageSize, sort: '', condition: sql} });
this . storeBodyList . load ( { params : { condition : " e.EXPID='" + billno + "'" } } ) ;
}
} else {
Ext . MessageBox . alert ( '请求出现错误,请重试' , response . responseText ) ;
}
} ,
scope : this
} ) ;
} ,
getCondition : function ( ) {
var form = this . formSearch . getForm ( ) ;
var sql = '' ;
sql = "B.OPTYPE like '普通货' " ;
var mblNo = form . findField ( 'PS_MBLNO' ) . getValue ( ) ;
sql = sql + getAndConSql ( sql , mblNo , " (B.CUSTNO like '%" + mblNo + "%' or B.MBLNO like '%" + mblNo + "%' or B.HBLNO like '%" + mblNo + "%' or B.CUSTOMNO like '%" + mblNo + "%' or B.ORDERNO like '%" + mblNo + "%')" ) ;
var OPLB = form . findField ( 'PS_OPLB' ) . getValue ( ) ;
sql = sql + getAndConSql ( sql , OPLB , "B.OPLBNAME='" + OPLB + "'" ) ;
var VESSEL = form . findField ( 'PS_VESSEL' ) . getValue ( ) ;
sql = sql + getAndConSql ( sql , VESSEL , "B.VESSEL like '%" + VESSEL + "%'" ) ;
var VOYNO = form . findField ( 'PS_VOYNO' ) . getValue ( ) ;
sql = sql + getAndConSql ( sql , VOYNO , "B.VOYNO like '%" + VOYNO + "%'" ) ;
var PSCUSTOMERNAME = form . findField ( 'PS_CUSTOMERNAME' ) . getValue ( ) ;
sql = sql + getAndConSql ( sql , PSCUSTOMERNAME , "B.CUSTOMERNAME='" + PSCUSTOMERNAME + "'" ) ;
var etdDate _Min = form . findField ( 'PS_ETDDATEBGN' ) . getRawValue ( ) ;
sql = sql + getAndConSql ( sql , etdDate _Min , " B.ETD>='" + etdDate _Min + "'" ) ;
var etdDate _Max = form . findField ( 'PS_ETDDATEEND' ) . getRawValue ( ) ;
sql = sql + getAndConSql ( sql , etdDate _Max , " B.ETD<='" + etdDate _Max + " 23:59:59'" ) ;
return sql ;
} ,
onAddressAdd : function ( ) {
//this.formAddressDetail.getForm().reset();
this . ClearAddrDetail ( ) ;
var curCorpName = this . formEdit . getForm ( ) . findField ( 'RECEIVECUST' ) . getValue ( ) ;
this . formAddressDetail . getForm ( ) . findField ( 'CORPNAME' ) . setValue ( curCorpName ) ;
} ,
onAddressCopy : function ( ) {
var addressForm = this . formAddressDetail . getForm ( ) ;
addressForm . findField ( 'GID' ) . setValue ( '' ) ;
addressForm . findField ( 'NAME' ) . setValue ( '' ) ;
// addressForm.findField('PROVINCE').setValue('');
// addressForm.findField('DESTI').setValue('');
// addressForm.findField('CORPNAMERV').setValue('');
// addressForm.findField('ADDRESS').setValue('');
// addressForm.findField('POSTCODE').setValue('');
addressForm . findField ( 'TEL' ) . setValue ( '' ) ;
var curCorpName = this . formEdit . getForm ( ) . findField ( 'RECEIVECUST' ) . getValue ( ) ;
this . formAddressDetail . getForm ( ) . findField ( 'CORPNAME' ) . setValue ( curCorpName ) ;
opStatusAddress = 'add' ;
} ,
onAddressSave : function ( ) {
var addressForm = this . formAddressDetail . getForm ( ) ;
if ( ! addressForm . isValid ( ) ) {
return ;
}
var data = addressForm . getValues ( ) ;
var opStatusAddress = 'edit' ;
if ( data . GID == '' || data == null )
opStatusAddress = 'add' ;
Ext . Msg . wait ( '正在保存收件人地址数据, 请稍侯..' ) ;
Ext . Ajax . request ( {
waitMsg : '正在保存数据...' ,
url : '/MvcShipping/MsOpExpress/SaveAddress' ,
scope : this ,
params : {
opstatus : opStatusAddress ,
data : Ext . JSON . encode ( data )
} ,
callback : function ( options , success , response ) {
if ( success ) {
Ext . MessageBox . hide ( ) ;
var jsonresult = Ext . JSON . decode ( response . responseText ) ;
if ( jsonresult . Success ) {
this . formAddressDetail . getForm ( ) . findField ( 'GID' ) . setValue ( jsonresult . Data ) ;
var curCorpName = this . formEdit . getForm ( ) . findField ( 'RECEIVECUST' ) . getValue ( ) ;
var sql = '' ;
sql = sql + getAndConSql ( sql , curCorpName , "CORPNAME='" + curCorpName + "'" ) ;
this . storeListAddress . load ( { params : { start : 0 , limit : this . PageSize , sort : '' , condition : sql } } ) ;
}
} else {
Ext . Msg . show ( {
title : '请重试' ,
msg : '服务器响应出错' ,
icon : Ext . Msg . ERROR , buttons : Ext . Msg . OK
} ) ;
}
}
} ) ;
} ,
onAddressDel : function ( ) {
var addressForm = this . formAddressDetail . getForm ( ) ;
if ( ! addressForm . isValid ( ) ) {
return ;
} var data = addressForm . getValues ( ) ;
Ext . Msg . wait ( '正在删除地址数据, 请稍侯..' ) ;
Ext . Ajax . request ( {
waitMsg : '正在删除数据...' ,
url : '/MvcShipping/MsOpExpress/DeleteAddress' ,
scope : this ,
params : {
opstatus : 'del' ,
data : Ext . JSON . encode ( data )
} ,
callback : function ( options , success , response ) {
if ( success ) {
Ext . MessageBox . hide ( ) ;
var jsonresult = Ext . JSON . decode ( response . responseText ) ;
if ( jsonresult . Success ) {
this . ClearAddrDetail ( ) ;
//this.formAddressDetail.getForm().reset();
var curCorpName = this . formEdit . getForm ( ) . findField ( 'RECEIVECUST' ) . getValue ( ) ;
var sql = '' ;
sql = sql + getAndConSql ( sql , curCorpName , "CORPNAME='" + curCorpName + "'" ) ;
this . storeListAddress . load ( { params : { start : 0 , limit : this . PageSize , sort : '' , condition : sql } } ) ;
}
} else {
Ext . Msg . show ( {
title : '请重试' ,
msg : '服务器响应出错' ,
icon : Ext . Msg . ERROR , buttons : Ext . Msg . OK
} ) ;
}
}
} ) ;
} ,
ClearAddrDetail : function ( ) {
var addressForm = this . formAddressDetail . getForm ( ) ;
addressForm . findField ( 'GID' ) . setValue ( '' ) ;
addressForm . findField ( 'NAME' ) . setValue ( '' ) ;
addressForm . findField ( 'PROVINCE' ) . setValue ( '' ) ;
addressForm . findField ( 'DESTI' ) . setValue ( '' ) ;
addressForm . findField ( 'CORPNAMERV' ) . setValue ( '' ) ;
addressForm . findField ( 'ADDRESS' ) . setValue ( '' ) ;
addressForm . findField ( 'POSTCODE' ) . setValue ( '' ) ;
addressForm . findField ( 'TEL' ) . setValue ( '' ) ;
} ,
Print : function ( ) {
var basicForm = this . formEdit . getForm ( ) ;
var billNo = basicForm . findField ( 'GID' ) . value ;
if ( billNo == '*' || billNo == '' ) {
Ext . Msg . show ( { title : '错误' , msg : '单据还没有保存,请保存后再打印' , icon : Ext . Msg . ERROR , buttons : Ext . Msg . OK } ) ;
return ;
}
var printType = 'MSOPEXPRESS' ;
var sql1 =
"SET LANGUAGE 'us_english' select e.*,s.origincode,s.destcode,s.proCode,s.destRouteLabel,s.destTeamCode, " ;
sql1 += "s.codingMapping, s.codingMappingOut, s.twoDimensionCode, s.abFlag " ;
sql1 += " from op_express e left join op_express_sfprint s on e.EXNO = s.mailno WHERE e.GID = '" + billNo + "'" ;
var sql2 = "" ;
var sql3 = "" ;
var sql4 = "" ;
var sql5 = "" ;
var sql6 = "" ;
PrintComm ( printType , sql1 , sql2 , sql3 , sql4 , sql5 , sql6 ) ;
}
} ) ;