Ext.namespace('Shipping');
Shipping.MsOpApplyLSEdit = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsOpApplyLSEdit.superclass.constructor.call(this);
};
Ext.extend(Shipping.MsOpApplyLSEdit, Ext.Panel, {
ParentWin: null,
OpStatus: 'add',
storeList: null,
editRecord: null,
Editdata: null,
MainEditRecord: null,
oplb: '',
initUIComponents: function () {
this.serialNo = 0;
this.bodyDel = [];
this.itemindex = 1;
var mainform = window.parent.panelEdit;
this.MainEditRecord = mainform.editRecord;
this.BsNo = this.MainEditRecord.get('BSNO');
this.oplb = mainform.stroplb;
this.MsPeriod = null;
this.ENTERSAMEASCUSTOMER = 0;
//枚举参照相关
//表参照相关
this.storeDefValue = Ext.create('Ext.data.Store', {
model: 'DsShipping.ux.OpDefValue',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsCodeOpDef/GetDataList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.storeMustBe = Ext.create('Ext.data.Store', {
model: 'DsShipping.ux.OpDefValue',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsCodeOpMustField/GetDataList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.storeListWmsIn = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
fields: [
{ name: 'GID', type: 'string' },
{ name: 'NAMEMODEL', type: 'string' },
{ name: 'GOODSNAME', type: 'string' },
{ name: 'GOODSMODEL', type: 'string' },
{ name: 'GOODSSTANDARD', type: 'string' },
{ name: 'GOODSPACK', type: 'number' },
{ name: 'GOODSPACKSTOCK', type: 'number' },
{ name: 'GOODAPPLYNUM', type: 'number' }
],
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsOpApply/GetWmsIn',
reader: {
id: '',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.comboxWmsIn = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeListWmsIn,
forceSelection: true,
// name: 'GoodsName',
valueField: 'GID',
displayField: 'NAMEMODEL'
});
this.storeListWmsNo = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
fields: [
{ name: 'WMSNO', type: 'string' }
],
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsOpApply/GetWmsNo',
reader: {
id: '',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.comboxWmsNo = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeListWmsNo,
fieldLabel: '入库单号',
name: 'WMSNO',
valueField: 'WMSNO',
displayField: 'WMSNO',
listeners: {
scope: this,
'blur': function (field) {
if (field.rawValue!=''){
this.storeListWmsIn.load({ params: { wmsno:field.rawValue} });
} else this.storeListWmsIn.load({ params: { wmsno:''} });
}
}
});
this.storeListBsCustomNo = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
fields: [
{ name: 'CUSTOMNO', type: 'string' }
],
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsOpApply/GetBsCustomNo',
reader: {
id: '',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.comboxBsCustomNo = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeListBsCustomNo,
fieldLabel: '关联报关单号',
name: 'BSCUSTOMNO',
valueField: 'CUSTOMNO',
displayField: 'CUSTOMNO'
});
this.storecodeservice = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsCodeOpService',
proxy: { url: '/MvcShipping/MsCodeOpService/GetDataList' }
});
this.storeSalesCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.UserRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetUserRefList' }
});
this.storeSalesCode.load();
this.comboxSalesCode = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '揽货人',
store: this.storeSalesCode,
forceSelection: true,
name: 'SALE',
valueField: 'UserName',
displayField: 'CodeAndName',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
var recs = DsStoreQueryBy(this.storeUserBase, 'USERID', records[0].data.GID);
var SALEDEPT = this.formHead.getForm().findField('SALEDEPT');
if (recs.getCount() > 0) {
var data = recs.getAt(0).data;
SALEDEPT.setValue(data.DEPTNAME);
} else {
SALEDEPT.setValue('');
}
}
}
}
});
this.storeOpCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.UserRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetUserRefList' }
});
this.storeOpCode.load();
this.comboxOp = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '操 作',
store: this.storeOpCode,
forceSelection: true,
name: 'OP',
valueField: 'UserName',
displayField: 'CodeAndName',
value: SHOWNAME
});
this.storeCustCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefListController' }
});
this.storeCustCode.load();
this.comboxCustCode = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '委托单位',
store: this.storeCustCode,
forceSelection: true,
queryMode: 'remote',
minChars: 1,
queryParam: 'CODENAME',
name: 'CUSTOMERNAME',
valueField: 'CustName',
displayField: 'CodeAndName',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (this.ENTERSAMEASCUSTOMER == 1) {
var ENTERP = this.formEdit.getForm().findField('ENTERP');
ENTERP.setValue(combo.value);
}
}
}
});
//委托单位_联系人
this.storeInfoClientContact = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.InfoClientContactModel',
proxy: { url: '/CommMng/BasicDataRef/GetInfoClientContactList' }
});
//this.storeInfoClientContact.load();
this.comboxInfoClientContact = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '客户操作',
store: this.storeInfoClientContact,
name: 'OPERATORCODE',
valueField: 'SHOWNAME',
displayField: 'SHOWNAME',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
var Cargoinforecords = DsStoreQueryBy(this.storeInfoClientContact, 'GID', records[0].data.GID);
if (Cargoinforecords.getCount() > 0) {
var Cargoinfodata = Cargoinforecords.getAt(0).data;
// this.formHead.getForm().findField('OPERATOREMAIL').setValue(Cargoinfodata.EMAIL);
this.formHead.getForm().findField('OPERATORTEL').setValue(Cargoinfodata.TEL);
// this.formHead.getForm().findField('OPERATORFAX').setValue(Cargoinfodata.FAX);
} else {
// this.formHead.getForm().findField('OPERATOREMAIL').setValue('');
this.formHead.getForm().findField('OPERATORTEL').setValue('');
// this.formHead.getForm().findField('OPERATORFAX').setValue('');
}
}
}
}
});
this.StoreOpRange = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsOP',
proxy: { url: '/MvcShipping/MsBaseInfo/GetOpRang' }
});
this.storeCustomCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
this.storeCustomCode.load({ params: { condition: "ISCUSTOM='1'"} });
this.comboxCustomCode = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '报关行',
store: this.storeCustomCode,
forceSelection: true,
name: 'CUSTOMSER',
valueField: 'CustName',
displayField: 'CodeAndName'
});
this.storeSource = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.SourceModel',
proxy: { url: '/CommMng/BasicDataRef/GetSource' }
});
this.storeSource.load();
this.storeSourceDetail = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.SourceDetailModel',
proxy: { url: '/CommMng/BasicDataRef/GetSourceDetail' }
});
this.comboxSource = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '业务来源',
store: this.storeSource,
forceSelection: true,
name: 'BSSOURCE',
valueField: 'SourceName',
displayField: 'SourceName',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
var recs = DsStoreQueryBy(this.storeSource, 'SourceID', records[0].data.SourceID);
if (recs.getCount() > 0) {
var data = recs.getAt(0).data;
var s = data.SourceID;
this.storeSourceDetail.load({
params: {
SourceId: s
}
});
} else {
var BSSOURCEDETAIL = this.formEdit.getForm().findField('BSSOURCEDETAIL');
BSSOURCEDETAIL.setValue('');
}
}
}
}
});
this.comboxSourceDetail = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '来源明细',
store: this.storeSourceDetail,
// forceSelection: true,
name: 'BSSOURCEDETAIL',
valueField: 'SourceDetail',
displayField: 'SourceDetail'
});
this.storeUserBase = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.UserBaseModel',
proxy: { url: '/MvcShipping/MsBaseInfo/GetUserBaseList' }
});
this.storeUserBase.load();
this.storeDept = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.DeptModel',
proxy: { url: '/CommMng/BasicDataRef/GetDeptList' }
});
this.storeDept.load();
this.comboxDept = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '所属部门',
store: this.storeDept,
forceSelection: true,
name: 'SALEDEPT',
valueField: 'DeptName',
displayField: 'DeptName',
hidden: true
});
this.storeBsType = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeBsType.load({ params: { enumTypeId: 96004} });
this.comboxBsType = Ext.create('DsExt.ux.RefEnumCombox', {
fieldLabel: '运输类型',
store: this.storeBsType,
forceSelection: true,
name: 'BSTYPE'
});
//键值维护表_贸易方式
this.storeCrmKeyCodeCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CrmKeyCodeModel',
proxy: { url: '/CommMng/BasicDataRef/GetCrmKeyCodeList' }
});
this.storeCrmKeyCodeCode.load({ params: { condition: " and KEYTYPE='贸易方式'"} });
this.comboxTRADETYPE = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '贸易方式',
store: this.storeCrmKeyCodeCode,
forceSelection: true,
id: 'TRADETYPE',
name: 'TRADETYPE',
valueField: 'KEYVALUE',
displayField: 'KEYVALUE'
});
// this.storeENTERP = Ext.create('DsExt.ux.RefTableStore', {
// model: 'MsENTERP',
// proxy: { url: '/MvcShipping/MsOpApply/GetENTERPLIST' }
// });
// this.storeENTERP.load();
// this.comboxENTERP = Ext.create('DsExt.ux.RefTableCombox', {
// fieldLabel: '经营单位',
// store: this.storeENTERP,
// name: 'ENTERP',
// valueField: 'ENTERPNAME',
// displayField: 'ENTERPID'
// });
this.storeEnterpCode = Ext.create('DsExt.ux.RefTableStore', {
fields: [
{ name: 'CUSTOMER', type: 'string' },
{ name: 'ENTERPID', type: 'string' }
],
proxy: { url: '/MvcShipping/MsOpApply/GetENTERPLIST' }
});
this.storeEnterpCode.load();
this.comboxEnterp = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '经营单位',
store: this.storeEnterpCode,
name: 'ENTERP',
valueField: 'CUSTOMER',
displayField: 'CUSTOMER',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
var Cargoinforecords = DsStoreQueryBy(this.storeEnterpCode, 'CUSTOMER', combo.value);
if (Cargoinforecords.getCount() > 0) {
var Cargoinfodata = Cargoinforecords.getAt(0).data;
this.formEdit.getForm().findField('ENTERPID').setValue(Cargoinfodata.ENTERPID);
} else {
this.formEdit.getForm().findField('ENTERPID').setValue('');
}
}
}
}
});
this.storeINSPECTSERVICE = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeINSPECTSERVICE.load({ params: { enumTypeId: 97024} });
this.comboxINSPECTSERVICE = Ext.create('DsExt.ux.RefEnumCombox', {
fieldLabel: '报检项目',
store: this.storeINSPECTSERVICE,
forceSelection: true,
name: 'INSPECTSERVICE'
});
this.storeTRADETERM = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeTRADETERM.load({ params: { enumTypeId: 97023} });
this.comboxTRADETERM = Ext.create('DsExt.ux.RefEnumCombox', {
fieldLabel: '贸易条款',
store: this.storeTRADETERM,
forceSelection: true,
name: 'TRADETERM'
});
this.storeCUSTOMTYPE = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeCUSTOMTYPE.load({ params: { enumTypeId: 97046} });
this.comboxCUSTOMTYPE = Ext.create('DsExt.ux.RefEnumCombox', {
fieldLabel: '报关类型',
store: this.storeCUSTOMTYPE,
// forceSelection: true,
name: 'CUSTOMTYPE'
});
this.storeISCLEAR = Ext.create('Ext.data.Store', {
fields: ['FType', 'NAME']
});
this.storeISCLEAR.add({ "FType": '1', "NAME": "是" });
this.storeISCLEAR.add({ "FType": '0', "NAME": "否" });
this.comboxISCLEAR = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeISCLEAR,
fieldLabel: '是否通关',
valueField: 'FType',
displayField: 'NAME',
forceSelection: true,
name: 'ISCLEAR'
});
this.storeISCUSTOMEND = Ext.create('Ext.data.Store', {
fields: ['FType', 'NAME']
});
this.storeISCUSTOMEND.add({ "FType": '1', "NAME": "是" });
this.storeISCUSTOMEND.add({ "FType": '0', "NAME": "否" });
this.comboxISCUSTOMEND = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeISCUSTOMEND,
fieldLabel: '报关完结',
valueField: 'FType',
ReadOnly: true,
displayField: 'NAME',
forceSelection: true,
name: 'ISCUSTOMEND'
});
this.storeList = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
model: 'MsOpApply',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsOpApply/GetDataList',
reader: {
id: 'BSNO',
root: 'data',
totalProperty: 'totalCount'
}
}
});
Ext.define('Ext.grid.column.Actiontextcolumn', {
extend: 'Ext.grid.column.Column',
alias: ['widget.actiontextcolumn'],
defaultRenderer: function (value) {
var me = this;
prefix = Ext.baseCSSPrefix;
scope = me.origScope || me;
// if (value == "") {
// }
// else
value = value + '';
// value = '';
return value;
},
processEvent: function (type, view, cell, recordIndex, cellIndex, e, record, row) {
var me = this;
if (type == 'click') {
me.handler.call(me.scope || me.origScope || me, view, recordIndex, cellIndex, e, record, row);
}
}
});
this.girdcolums = [{
sortable: true,
dataIndex: 'BSNO',
header: '业务编号',
hidden: true,
width: 150
}, {
sortable: true,
dataIndex: 'CUSTOMNO',
header: '报关单号',
width: 120
}, {
sortable: true,
dataIndex: 'CUSTNO',
header: '委托编号',
width: 130
}, {
sortable: true,
dataIndex: 'BSDATE',
header: '录入日期',
width: 90
}, {
sortable: true,
dataIndex: 'BSCUSTNO',
header: '自理编号',
width: 130
},
{
sortable: true,
id: '',
dataIndex: 'BSSTATUSREF',
header: '业务锁定',
align: 'center',
width: 60,
renderer: function (value, cellmeta) {
if (value == '锁定') {
return "";
}
}
},
{
sortable: true,
id: '',
dataIndex: 'FEESTATUSREF',
header: '费用锁定',
align: 'center',
width: 60,
renderer: function (value, cellmeta) {
if (value == '锁定') {
return "";
}
}
}, {
sortable: true,
dataIndex: 'BSTYPEREF',
header: '运输类型',
width: 90
}, {
sortable: true,
dataIndex: 'ACCDATE',
header: '会计期间',
width: 80
}, {
sortable: true,
dataIndex: 'OPDATE',
header: '业务日期',
width: 80
}, {
sortable: true,
dataIndex: 'MBLNO',
header: '提单号',
width: 100
}, {
sortable: true,
dataIndex: 'HBLNO',
header: '分提单号',
width: 100
}, {
sortable: true,
dataIndex: 'CUSTOMERNAME',
header: '委托单位',
width: 100
}, {
sortable: true,
dataIndex: 'ENTERP',
header: '经营单位',
width: 100
}, {
sortable: true,
dataIndex: 'BSTYPE',
header: '业务类型',
hidden: true,
width: 80
}, {
sortable: true,
dataIndex: 'VESSEL',
header: '船名',
width: 100
}, {
sortable: true,
dataIndex: 'VOYNO',
header: '航次',
width: 40
}, {
sortable: true,
dataIndex: 'ETD',
header: '开船日期',
width: 90
}, {
sortable: true,
dataIndex: 'ETA',
header: '到港日期',
width: 90
}, {
sortable: true,
dataIndex: 'PORTLOAD',
header: '装货港',
width: 100
}, {
sortable: true,
dataIndex: 'PORTDISCHARGE',
header: '卸货港',
width: 100
}, {
sortable: true,
dataIndex: 'OP',
header: '操作',
width: 80
}, {
sortable: true,
dataIndex: 'SALE',
header: '销售',
width: 80
}, {
sortable: true,
dataIndex: 'CUSTOMSER',
header: '报关行',
width: 80
}, {
sortable: true,
dataIndex: 'BSSOURCE',
header: '业务来源',
width: 100
}, {
sortable: true,
dataIndex: 'BSSOURCEDETAIL',
header: '来源明细',
width: 80
}, {
sortable: true,
dataIndex: 'PKGS',
header: '件数',
width: 80
}, {
sortable: true,
dataIndex: 'KGS',
header: '重量',
width: 80
}, {
sortable: true,
dataIndex: 'NETWEIGHT',
header: '净重',
width: 80
}, {
sortable: true,
dataIndex: 'CBM',
header: '尺码',
width: 80
}, {
sortable: true,
dataIndex: 'CUSTOMDATE',
header: '报关日期',
width: 100
}, {
sortable: true,
dataIndex: 'INSPECTIONNO',
header: '商检单号',
width: 100
}, {
sortable: true,
dataIndex: 'INSPECTIONDATE',
header: '商检日期',
hidden: true,
width: 80
}, {
sortable: true,
dataIndex: 'INVNO',
header: '发票号',
width: 80
}, {
sortable: true,
dataIndex: 'CONTRACTNO',
header: '合同号',
width: 160
}, {
sortable: true,
dataIndex: 'ARCOUNTRY',
header: '货源国别',
width: 80
}, {
sortable: true,
dataIndex: 'GOODSOURCE',
header: '货源地',
width: 80
}, {
sortable: true,
dataIndex: 'DOCNO',
header: '批准文号',
width: 80
}, {
sortable: true,
dataIndex: 'TRADETYPE',
header: '贸易方式',
width: 80
}, {
sortable: true,
dataIndex: 'BSSTATUS',
header: '业务锁定',
width: 100
}, {
sortable: true,
dataIndex: 'FEESTATUS',
header: '费用锁定',
width: 100
}
];
//定义Grid
this.gridListLS = new Ext.grid.GridPanel({
store: this.storeList,
enableHdMenu: false,
region: 'west',
width: 160,
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
columns: this.girdcolums,
bbar: Ext.create('Ext.PagingToolbar', {
store: this.storeList,
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"
})
});
_this = this;
this.gridListLS.addListener('itemclick', function (dataview, record, item, index, e, b) {
_this.editRecord = record;
_this.OpStatus = 'edit';
_this.LoadData("edit", "BSNO='" + record.data.BSNO + "'");
}, this);
this.formHead = Ext.widget('form', {
region: 'north',
frame: true,
bodyPadding: 5,
trackResetOnLoad: 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: [
{
fieldLabel: '业务编号',
name: 'BSNO', hidden: true
}, {
fieldLabel: '业务编号',
name: 'MASTERNO', hidden: true
}, {
fieldLabel: 'ISDY',
name: 'ISDY', hidden: true
}, {
fieldLabel: 'DOCSTATUS',
name: 'DOCSTATUS', hidden: true
}, {
fieldLabel: 'CUSCIQNO',
name: 'CUSCIQNO', hidden: true
}, {
fieldLabel: 'TRANCUSTOMNO',
name: 'TRANCUSTOMNO', hidden: true
}, {
fieldLabel: 'CUSTOMLOCKNO',
name: 'CUSTOMLOCKNO', hidden: true
}, {
fieldLabel: 'EXPCUSTOMTYPE',
name: 'EXPCUSTOMTYPE', hidden: true
}, {
fieldLabel: 'DESPPORT',
name: 'DESPPORT', hidden: true
}, {
fieldLabel: '业务锁定状态',
name: 'BSSTATUS', flex: 0, hidden: true
}, {
fieldLabel: '费用锁定状态',
name: 'FEESTATUS', flex: 0, hidden: true
}, {
fieldLabel: '费用锁定状态',
name: 'INPUTBY', flex: 0, hidden: true
}, {
fieldLabel: '客户操作',
name: 'OPERATORCODE', flex: 0, hidden: true
},
{
fieldLabel: '委托编号',
readOnly: false,
name: 'CUSTNO'
}, {
fieldLabel: '业务锁定',
readOnly: true,
name: 'BSSTATUSREF'
}, {
fieldLabel: '费用锁定',
readOnly: true,
name: 'FEESTATUSREF'
}, {
fieldLabel: '会计期间',
xtype: 'monthfield',
name: 'ACCDATE'
}, this.comboxISCLEAR
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxCustCode, this.comboxSource, this.comboxSourceDetail, {
fieldLabel: '业务日期',
format: 'Y-m-d',
xtype: 'datefield',
allowBlank: false,
name: 'OPDATE'
}, this.comboxWmsNo
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxOp, this.comboxSalesCode, this.comboxDept, this.comboxBsType, {
fieldLabel: '报关单号',
name: 'CUSTOMNO'
}, this.comboxCUSTOMTYPE
]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
}); //end this.formEdit
//币别
this.storeCodeCurrency = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CodeCurrencyModel',
proxy: { url: '/CommMng/BasicDataRef/GetCodeCurrencyList' }
});
this.storeCodeCurrency.load();
this.comboxCodeCurrency = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '币别', //'币别',
store: this.storeCodeCurrency,
forceSelection: true,
// flex: 0.4,
// labelWidth: 40,
id: 'CURRENCY',
name: 'CURRENCY',
valueField: 'CODENAME',
displayField: 'CODENAME'
});
//编辑form
this.formEdit = Ext.widget('form', {
region: 'north',
frame: true,
bodyPadding: 5,
trackResetOnLoad: 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: [{
fieldLabel: '主提单号',
name: 'MBLNO',
listeners: {
scope: this,
'blur': function (field) {
if (field.value!=''){
var BSNO = this.formHead.getForm().findField('BSNO').getValue();
this.storeListBsCustomNo.load({ params: { constr:" MBLNO='"+field.value+"' AND BSNO<>'"+data.BSNO+"'" }});
this.storeListWmsNo.load({ params: { constr:" w.BLNO='"+field.value+"'" }});
}
}
}
}, {
fieldLabel: '船名',
name: 'VESSEL'
}, {
fieldLabel: '航次',
name: 'VOYNO'
}, {
fieldLabel: '开船日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'ETD'
}, {
fieldLabel: '分提单号',
name: 'HBLNO'
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '装货港',
name: 'PORTLOAD'
}, {
fieldLabel: '卸货港',
name: 'PORTDISCHARGE'
}, {
fieldLabel: '到港日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'ETA'
}, {
fieldLabel: '货源国别',
name: 'ARCOUNTRY'
}, {
fieldLabel: '货源地',
name: 'GOODSOURCE'
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '报关日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'CUSTOMDATE'
}, {
fieldLabel: '商检单号',
name: 'INSPECTIONNO'
}, {
fieldLabel: '商检日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'INSPECTIONDATE'
}, this.comboxCustomCode, {
fieldLabel: '通关日期',
format: 'Y-m-d',
flex: 1,
xtype: 'datefield',
name: 'CLEARCUSTOMDATE',
listeners: {
scope: this,
'blur': function (field) {
if (field.rawValue!=''){
this.formHead.getForm().findField('ISCLEAR').setValue('1');
} else this.formHead.getForm().findField('ISCLEAR').setValue('0');
}
}
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxEnterp, {
fieldLabel: '经营单位编码',
name: 'ENTERPID'
}, {
fieldLabel: '手册号',
name: 'BOOKNO'
}, {
fieldLabel: '发票号',
flex: 1,
name: 'INVNO'
}, {
fieldLabel: '合同号',
flex: 1,
name: 'CONTRACTNO'
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '件数',
name: 'PKGS',
value: 0
}, {
fieldLabel: '毛重',
name: 'KGS',
value: 0
}, {
fieldLabel: '净重',
name: 'NETWEIGHT',
value: 0
}, {
fieldLabel: '尺码',
name: 'CBM',
value: 0
}, {
fieldLabel: '所在海关',
name: 'BYCUSTOM'
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxTRADETYPE, {
fieldLabel: '是否多品名',
flex: 1,
inputValue: true,
xtype: 'checkboxfield',
name: 'ISMOREGOOD'
}, {
fieldLabel: '报关项数',
name: 'CUSTOMSNUM',
value: 1
}, this.comboxINSPECTSERVICE, {
fieldLabel: '批准文号',
name: 'DOCNO'
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [ this.comboxTRADETERM, {
fieldLabel: '自理编号',
readOnly: true,
name: 'BSCUSTNO'
}, this.comboxBsCustomNo, {
fieldLabel: '关联报关序号',
name: 'CUSTOMSLNO'
}, this.comboxISCUSTOMEND
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxCodeCurrency, {
fieldLabel: '货值',
name: 'CARGOVALUE'
}, {
fieldLabel: '检验检疫号',
name: 'INQUNO'
}, { xtype: 'hiddenfield' }, { xtype: 'hiddenfield' }
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '备注',
name: 'REMARK'
}
]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
}); //end this.formEdit
//明细表-数据集
this.storeBodyList = Ext.create('Ext.data.Store', {
model: 'MsOpApplyDetail',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsOpApply/GetBodyList',
reader: {
id: 'BsNo,SerialNo',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//明细表表格
this.gridListCellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});
this.girdcolums1 = [{
sortable: true,
dataIndex: 'BsNo',
header: '业务编号',
hidden: true,
width: 120
}, {
sortable: true,
dataIndex: 'SerialNo',
header: '序号',
width: 30
}, {
sortable: true,
dataIndex: 'GoodsCode',
header: '商品编码',
editor: {
xtype: 'textfield',
selectOnFocus: true
},
width: 120
}, {
sortable: true,
dataIndex: 'GoodsName',
header: '商品名称',
editor: {
xtype: 'textfield',
selectOnFocus: true
},
width: 120
}, {
sortable: true,
dataIndex: 'GOODSMODEL',
header: '型号/品牌',
editor: {
xtype: 'textfield',
selectOnFocus: true
},
width: 120
}, {
sortable: true,
dataIndex: 'GOODSSTANDARD',
header: '规格',
editor: {
xtype: 'textfield',
selectOnFocus: true
},
width: 120
}, {
sortable: true,
dataIndex: 'GOODSNUM',
header: '件数',
editor: {
xtype: 'numberfield',
allowBlank: false,
selectOnFocus: true
},
width: 120
}, {
sortable: true,
dataIndex: 'Pkgs',
header: '报关件数',
editor: {
xtype: 'numberfield',
allowBlank: false,
selectOnFocus: true
},
width: 120
}, {
sortable: true,
dataIndex: 'Price',
header: '单价',
editor: {
xtype: 'numberfield',
allowBlank: false,
selectOnFocus: true
},
width: 100,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
try {
var lsValue = usMoney(value, 2, '', false);
if (lsValue != "NaN") {
value = lsValue; if (parseFloat(lsValue) < 0) {
return '' + lsValue + '';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
}
}, {
sortable: true,
dataIndex: 'Total',
header: '总价',
editor: {
xtype: 'numberfield',
allowBlank: false,
selectOnFocus: true
},
width: 120,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
try {
var lsValue = usMoney(value, 2, '', false);
if (lsValue != "NaN") {
value = lsValue; if (parseFloat(lsValue) < 0) {
return '' + lsValue + '';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
}
}, {
sortable: true,
dataIndex: 'Currency',
header: '币别',
editor: {
xtype: 'textfield',
allowBlank: false,
selectOnFocus: true
},
width: 120
}, {
sortable: true,
dataIndex: 'Remark',
header: '其他',
editor: {
xtype: 'textfield',
selectOnFocus: true
},
width: 110
}
];
this.girdcolums2 = [{
sortable: true,
dataIndex: 'BsNo',
header: '业务编号',
hidden: true,
width: 120
}, {
sortable: true,
dataIndex: 'SerialNo',
header: '序号',
width: 30
}, {
sortable: true,
dataIndex: 'WMSIN_GID',
header: '商品名称',
editor: this.comboxWmsIn,
width: 120,
renderer: function (value, p, record) {
return record.data.GoodsName;
},
}, {
sortable: true,
dataIndex: 'GOODSMODEL',
header: '型号/品牌',
width: 120
}, {
sortable: true,
dataIndex: 'GOODSSTANDARD',
header: '瓶/规格',
width: 120
}, {
sortable: true,
dataIndex: 'GOODSNUM',
header: '规格件数',
editor: {
xtype: 'numberfield',
allowBlank: false,
selectOnFocus: true
},
width: 120
}, {
sortable: true,
dataIndex: 'GoodsCode',
header: '商品编码',
editor: {
xtype: 'textfield',
selectOnFocus: true
},
width: 120
}, {
sortable: true,
dataIndex: 'Pkgs',
header: '报关件数',
editor: {
xtype: 'numberfield',
allowBlank: false,
selectOnFocus: true
},
width: 120
}, {
sortable: true,
dataIndex: 'Price',
header: '单价',
editor: {
xtype: 'numberfield',
allowBlank: false,
selectOnFocus: true
},
width: 100,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
try {
var lsValue = usMoney(value, 2, '', false);
if (lsValue != "NaN") {
value = lsValue; if (parseFloat(lsValue) < 0) {
return '' + lsValue + '';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
}
}, {
sortable: true,
dataIndex: 'Total',
header: '总价',
editor: {
xtype: 'numberfield',
allowBlank: false,
selectOnFocus: true
},
width: 120,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
try {
var lsValue = usMoney(value, 2, '', false);
if (lsValue != "NaN") {
value = lsValue; if (parseFloat(lsValue) < 0) {
return '' + lsValue + '';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
}
}, {
sortable: true,
dataIndex: 'Currency',
header: '币别',
editor: {
xtype: 'textfield',
allowBlank: false,
selectOnFocus: true
},
width: 120
}, {
sortable: true,
dataIndex: 'Remark',
header: '其他',
editor: {
xtype: 'textfield',
selectOnFocus: true
},
width: 110
}
];
this.girdcolumdetail = this.girdcolums2;
this.gridList = new Ext.grid.GridPanel({
store: this.storeBodyList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
plugins: [this.gridListCellEditing],
selType: 'cellmodel',
tbar: [{
text: '增加明细',
tooltip: '增加明细',
id: "btnadddetail",
iconCls: "btnadddetail",
handler: function (button, event) {
this.onAddDetailClick(button, event);
},
scope: this
}, '-', {
text: '删除明细',
tooltip: '删除明细',
id: "btndeldetail",
iconCls: "btndeletedetail",
handler: function (button, event) {
this.onDelDetailClick(button, event);
},
scope: this
}],
columns:this.girdcolumdetail
});
//#region EDI及其他信息 //需求编号:SR2017081100003
//枚举维护表tSysEnumValue_易航线业务类型97049
this.storeTSysEnumValueCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.TSysEnumValueDataModel',
proxy: { url: '/CommMng/BasicDataRef/GetTSysEnumValueList' }
});
this.storeTSysEnumValueCode.load({ params: { condition: " and EnumTypeID=97049"} });
this.comboxEDIYWLX = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '业务类型',
store: this.storeTSysEnumValueCode,
//forceSelection: true,
name: 'EDIYWLX',
valueField: 'EnumValueID',
displayField: 'CodeAndName'
});
//枚举维护表tSysEnumValue_易航线费用类型97050
this.storeTSysEnumValueCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.TSysEnumValueDataModel',
proxy: { url: '/CommMng/BasicDataRef/GetTSysEnumValueList' }
});
this.storeTSysEnumValueCode.load({ params: { condition: " and EnumTypeID=97050"} });
this.comboxCARRIAGETYPE = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '运费类型',
store: this.storeTSysEnumValueCode,
forceSelection: true,
name: 'CARRIAGETYPE',
valueField: 'EnumValueName',
displayField: 'EnumValueName'
});
//枚举维护表tSysEnumValue_易航线费用类型97050
this.storeTSysEnumValueCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.TSysEnumValueDataModel',
proxy: { url: '/CommMng/BasicDataRef/GetTSysEnumValueList' }
});
this.storeTSysEnumValueCode.load({ params: { condition: " and EnumTypeID=97050"} });
this.comboxPREMIUMTYPE = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '保费类型',
store: this.storeTSysEnumValueCode,
forceSelection: true,
name: 'PREMIUMTYPE',
valueField: 'EnumValueName',
displayField: 'EnumValueName'
});
this.formEdi = Ext.widget('form', {
title: '易航线补充信息',
region: 'north',
frame: true,
//bodyPadding: 5,
//trackResetOnLoad: true,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 70,
msgTarget: 'qtip'
},
items: [{
xtype: 'container',//fieldset
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxEDIYWLX, {
fieldLabel: '备案号',
name: 'RECORDSN'
}, {
fieldLabel: '征税比例',
name: 'PAYMENT'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxCARRIAGETYPE, {
fieldLabel: '运费金额',
name: 'CARRIAGEPRICE'
}, {
fieldLabel: '运费币制',
name: 'CARRIAGECURRENCY'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxPREMIUMTYPE, {
fieldLabel: '保费金额',
name: 'PREMIUMPRICE'
}, {
fieldLabel: '保费币制',
name: 'PREMIUMCURRENCY'
}]
}]//end items(fieldset 1)
}]//end root items
});
//#endregion
//按钮Toolbar
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [{
text: "新建",
handler: function (button, event) {
this.LoadData('add', '');
},
scope: this
},
'-',
{
id: 'btnESave',
text: "保存",
iconCls: "btnsave",
handler: function (button, event) {
this.Save('0');
},
scope: this
},
{
id: 'btnESaveAndNew',
text: "保存并新建",
handler: function (button, event) {
this.Save('2');
},
scope: this
},
{
id: 'btnECopyNew',
text: "复制新建",
handler: function (button, event) {
var basicForm = this.formHead.getForm();
this.opStatus = 'add';
basicForm.findField('BSNO').setDisabled(false);
var field = basicForm.findField('BSNO');
field.setValue(NewGuid());
basicForm.findField('BSNO').setDisabled(true);
field = basicForm.findField('CUSTNO');
field.setValue('');
field = basicForm.findField('INPUTBY');
field.setValue(SHOWNAME);
this.formHead.getForm().findField('MASTERNO').setValue(this.MainEditRecord.get('BSNO'));
this.formEdit.getForm().findField('BSCUSTNO').setValue(this.MainEditRecord.get('CUSTNO'));
var field = basicForm.findField('BSSTATUS');
field.setValue(false);
var field = basicForm.findField('BSSTATUSREF');
field.setValue('未锁定');
var field = basicForm.findField('FEESTATUS');
field.setValue(false);
var field = basicForm.findField('FEESTATUSREF');
field.setValue('未锁定');
var myDate = new Date();
var mydatestr = Ext.util.Format.date(myDate, 'Y-m-d');
field = basicForm.findField('OPDATE');
field.setValue(mydatestr);
field = this.formEdit.getForm().findField('CUSTOMDATE');
field.setValue(mydatestr);
var mydatestr = Ext.util.Format.date(myDate, 'Y-m');
field = basicForm.findField('ACCDATE');
field.setValue(mydatestr);
for (var j = 0; j < this.storeBodyList.getCount(); j += 1) {
var memberbody = this.storeBodyList.getAt(j);
memberbody.set("BSNO", '*');
memberbody.commit();
};
this.GetEditStatus();
this.LoadPeriodStatus(this.opStatus);
var children = this.panelpage2.items;
if (children) {
for (var i = 0, len = children.length; i < len; i++) {
this.panelpage2.remove(children.items[i], true);
}
}
for (i = 0; i < this.myCheckboxGroup.items.getCount(); i += 1) {
if (this.myCheckboxGroup.items.items[i].checked) {
var panelservice = this.CreateMenuPanel(this.myCheckboxGroup.items.items[i].boxLabel, this.myCheckboxGroup.items.items[i].name);
this.panelpage2.add(panelservice);
this.panelpage2.doLayout();
}
};
var children = this.tabapplypanel.items;
if (children) {
for (var i = children.length - 1, len = 0; i >= len; i--) {
if (children.items[i].id) {
if (children.items[i].id == 'pnlmodOpApplyOpwt') {
// this.tabSeaepanel.setActiveTab(i);
} else {
children.items[i].close();
}
}
}
}
this.tabapplypanel.doLayout();
var btnESave = Ext.getCmp('btnESave');
var btnESaveAndNew = Ext.getCmp('btnESaveAndNew');
var btnEAddDetail = Ext.getCmp('btnadddetail');
var btnEDeleteDetail = Ext.getCmp('btndeldetail');
btnESave.enable();
btnESaveAndNew.enable();
btnEAddDetail.enable();
btnEDeleteDetail.enable();
},
scope: this
},
'-',
{
text: "删除",
iconCls: "btndelete",
handler: function (button, event) {
this.onDeleteClick(button, event);
},
scope: this
},
'-',
{
text: "打印",
iconCls: "btnprint",
handler: function (button, event) {
this.Print();
},
scope: this
}
]
}); //end 按钮Toolbar
this.panelBodyChFee = new Ext.Panel({
title: '商品明细',
layout: "border",
region: 'center',
margin: '5 10',
frame: true,
items: [this.gridList]
});
this.panelpage1 = new Ext.Panel({
title: '基本信息',
layout: "border",
region: 'center',
animate: true,
autoScroll: true,
containerScroll: true,
frame: false,
items: [this.formEdit, this.panelBodyChFee]
});
this.panelpage2 = new Ext.Panel({
title: '服务项目流程明细',
layout: "border",
region: 'center',
animate: true,
autoScroll: true,
// containerScroll: true,
frame: false
});
this.panelpage3 = new Ext.Panel({
title: 'EDI及其他信息',
layout: "border",
region: 'center',
animate: true,
autoScroll: true,
containerScroll: true,
frame: false,
items: [this.formEdi]
});
this.tabpanel = new Ext.TabPanel
({
activeTab: 0,
autoWidth: true,
border: false,
frame: false,
region: 'center',
id: "TabPanelID",
enableTabScroll: true,
items:
[
this.panelpage1,
this.panelpage2,
this.panelpage3
]
});
this.panelapply = new Ext.Panel({
title: '报关委托信息',
id: 'pnlmodOpApplyOpwt',
layout: "border",
region: 'center',
animate: true,
autoScroll: true,
frame: false,
items: [this.formHead, this.tabpanel]
});
Ext.apply(this, {
items: [this.panelBtn, this.gridListLS, this.panelapply]
});
parentWin = window.parent.opener;
this.storecodeservice.load({ params: { condition: "OPTYPE='5'" },
callback: function (r, options, success) {
if (success) {
if (r.length != 0) {
var checkboxitems = "";
checkboxitems = "[";
for (i = 0; i < this.storecodeservice.getCount(); i += 1) {
var memberyf = this.storecodeservice.getAt(i);
if (i == 0) {
var checkboxSingleItem = "{boxLabel:'" + memberyf.data.SERVICENAME + "',inputValue:'1',name:'Is" + memberyf.data.OPField + "',id:'Is" + memberyf.data.OPField + "'";
checkboxSingleItem += "}";
} else {
var checkboxSingleItem = ",{boxLabel:'" + memberyf.data.SERVICENAME + "',inputValue:'1',name:'Is" + memberyf.data.OPField + "',id:'Is" + memberyf.data.OPField + "'";
checkboxSingleItem += "}";
}
checkboxitems += checkboxSingleItem;
};
checkboxitems += "]";
_this.myCheckboxGroup = new Ext.form.CheckboxGroup({
id: 'myGroup',
xtype: 'checkboxgroup',
fieldLabel: '服务项目',
columns: 8,
items: eval(checkboxitems)
});
//for (i = 0; i < this.storecodeservice.getCount(); i += 1) {
// _this.myCheckboxGroup.items.items[i].addListener('change', function (field, newValue, oldValue, eOpts) {
// this.serviceCheckChange(field, newValue, oldValue, eOpts);
// }, this);
//};
this.formHead.add(_this.myCheckboxGroup);
this.formHead.doLayout();
}
this.InitData();
}
},
scope: this
});
this.LoadMustBe();
//绑定事件
this.gridList.on('edit', function (editor, e, eOpts) {
this.gridAfterEdit(editor, e, eOpts);
}, this);
Ext.Ajax.request({
waitMsg: '',
url: '/MvcShipping/MsSysParamSet/GetData',
params: {
condition: "PARAMNAME='APPLYGOODSUSEWMS'"
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (result.Success != true) {
} else {
var data = result.data;
if (data.PARAMVALUE == '1') {
} else {
this.gridList.reconfigure(this.storeBodyList, this.girdcolums1);
}
}
} else {
}
},
scope: this
});
Ext.Ajax.request({
waitMsg: '',
url: '/MvcShipping/MsSysParamSet/GetData',
params: {
condition: "PARAMNAME='ENTERSAMEASCUSTOMER'"
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (result.Success != true) {
} else {
var data = result.data;
if (data.PARAMVALUE == '1') {
this.ENTERSAMEASCUSTOMER = 1;
} else {
}
}
} else {
}
},
scope: this
});
}, //end initUIComponents
InitData: function () {
this.opStatus = 'add';
var condition = '';
_this = this;
this.storeList.load({ params: { condition: "MASTERNO='" + this.BsNo + "'" },
callback: function (r, options, success) {
if (success) {
if (this.storeList.getCount() > 0) {
var member = this.storeList.getAt(0);
_this.editRecord = member;
_this.LoadData("edit", "BSNO='" + member.data.BSNO + "'");
if (this.opStatus == 'edit') {
condition = " BsNo='" + member.data.BSNO + "'";
var s = " SOURCEID=(select SOURCEID from code_source where SOURCENAME='" + member.data.BSSOURCE + "')";
this.storeSourceDetail.load({ params: { condition: s} });
}
} else {
_this.LoadData('add', '');
}
}
},
scope: this
});
}, //end InitData
LoadData: function (opstatus, condition) {
this.serialNo = 0;
this.bodyDel = [];
this.opStatus = opstatus;
if (this.opStatus == 'add') {
this.formHead.getForm().reset();
this.formHead.getForm().setValues(this.MainEditRecord.data);
this.formHead.getForm().findField('MASTERNO').setValue(this.MainEditRecord.get('BSNO'));
this.formEdit.getForm().findField('BSCUSTNO').setValue(this.MainEditRecord.get('CUSTNO'));
var basicForm = this.formHead.getForm();
this.opStatus = 'add';
basicForm.findField('BSNO').setDisabled(false);
var field = basicForm.findField('BSNO');
field.setValue(NewGuid());
basicForm.findField('BSNO').setDisabled(true);
field = basicForm.findField('CUSTNO');
field.setValue('');
field = basicForm.findField('INPUTBY');
field.setValue(SHOWNAME);
var field = basicForm.findField('BSSTATUS');
field.setValue(false);
var field = basicForm.findField('BSSTATUSREF');
field.setValue('未锁定');
var field = basicForm.findField('FEESTATUS');
field.setValue(false);
var field = basicForm.findField('FEESTATUSREF');
field.setValue('未锁定');
var myDate = new Date();
var mydatestr = Ext.util.Format.date(myDate, 'Y-m-d');
field = basicForm.findField('OPDATE');
field.setValue(mydatestr);
field = this.formEdit.getForm().findField('CUSTOMDATE');
field.setValue(mydatestr);
var mydatestr = Ext.util.Format.date(myDate, 'Y-m');
field = basicForm.findField('ACCDATE');
field.setValue(mydatestr);
// field = basicForm.findField('BSTYPE');
field = this.comboxBsType;
if (this.oplb == "海运出口")
field.setValue('1');
else if (this.oplb == "海运进口")
field.setValue('2');
else if (this.oplb == "空运出口")
field.setValue('3');
else if (this.oplb == "空运进口")
field.setValue('4');
else if (this.oplb == "铁路运输")
field.setValue('5');
this.formEdit.getForm().reset();
this.formEdit.getForm().setValues(this.MainEditRecord.data);
this.formEdit.getForm().findField('REMARK').setValue('');
if (this.oplb == "海运进口"){
this.formEdit.getForm().findField('ETA').setValue(this.MainEditRecord.data.ETD);
this.formEdit.getForm().findField('ETD').setValue(this.MainEditRecord.data.ETA);
}
var basicForm = this.formEdit.getForm();
field = basicForm.findField('PKGS');
if (field.getValue() == '')
field.setValue(0);
field = basicForm.findField('KGS');
if (field.getValue() == '')
field.setValue(0);
field = basicForm.findField('NETWEIGHT');
if (field.getValue() == '')
field.setValue(0);
field = basicForm.findField('CBM');
if (field.getValue() == '')
field.setValue(0);
var basicForm = this.formEdi.getForm();
field = basicForm.findField('EDIYWLX');
if (field.getValue() == ''||field.getValue() ==undefined)
field.setValue(0);
field = basicForm.findField('CARRIAGEPRICE');
if (field.getValue() == ''||field.getValue() ==undefined)
field.setValue(0);
field = basicForm.findField('PREMIUMPRICE');
if (field.getValue() == ''||field.getValue() ==undefined)
field.setValue(0);
this.LoadPeriod(this.opStatus);
} else {
Ext.Ajax.request({
waitMsg: '正在查询主表数据...',
url: '/MvcShipping/MsOpApply/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;
}
data = result.data;
this.formEdit.getForm().reset();
this.formEdit.getForm().setValues(data);
this.formHead.getForm().reset();
this.formHead.getForm().setValues(data);
this.formEdi.getForm().reset();
this.formEdi.getForm().setValues(data);
this.formEdit.getForm().findField('BSCUSTNO').setValue(this.MainEditRecord.get('CUSTNO'));
this.GetEditStatus();
if (this.opStatus == 'add') {
this.LoadDefValue();
}
this.LoadPeriod(this.opStatus);
if (data.WMSNO != '') {
this.storeListWmsIn.load({ params: { wmsno: data.WMSNO} });
} else this.storeListWmsIn.load({ params: { wmsno:''} });
if (data.MBLNO!=''){
this.storeListBsCustomNo.load({ params: { constr:" MBLNO='"+data.MBLNO+"' AND BSNO<>'"+data.BSNO+"'" }});
this.storeListWmsNo.load({ params: { constr:" w.BLNO='"+data.MBLNO+"'" }});
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
};
var billno = '*';
var gid = '*';
if (this.opStatus == 'edit') {
billno = this.editRecord.get('BSNO');
}
this.storeBodyList.load({ params: { BsNo: billno} });
},
LoadPeriod: function (opstatus) {
Ext.Ajax.request({
waitMsg: '正在查询主表数据...',
url: '/Account/ChMonthClose/GetNowPeriod',
params: {
condition: ''
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
return;
}
data = result.data;
this.MsPeriod = data;
this.LoadPeriodStatus(opstatus);
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
},
LoadPeriodStatus: function (opstatus) {
var ETD = this.formEdit.getForm().findField('CUSTOMDATE').getRawValue();
if (ETD == '') {
this.formEdit.getForm().findField('CUSTOMDATE').setMinValue(this.MsPeriod.FDAY);
this.formEdit.getForm().findField('CUSTOMDATE').setReadOnly(false);
} else {
var oDate1 = new Date(ETD);
var oDate2 = new Date(this.MsPeriod.FDAY);
if (oDate1.getTime() >= oDate2.getTime()) {
this.formEdit.getForm().findField('CUSTOMDATE').setMinValue(this.MsPeriod.FDAY);
this.formEdit.getForm().findField('CUSTOMDATE').setReadOnly(false);
} else {
if (opstatus == 'add' || opstatus == 'copyadd') {
this.formEdit.getForm().findField('CUSTOMDATE').setMinValue(this.MsPeriod.FDAY);
this.formEdit.getForm().findField('CUSTOMDATE').setReadOnly(false);
}
else {
this.formEdit.getForm().findField('CUSTOMDATE').setMinValue('');
this.formEdit.getForm().findField('CUSTOMDATE').setReadOnly(true);
}
}
}
var ACCDATE = this.formHead.getForm().findField('ACCDATE').getValue();
var oDate1 = new Date(ACCDATE + '-01');
var oDate2 = new Date(this.MsPeriod.PERIOD + '-01');
if (oDate1.getTime() >= oDate2.getTime()) {
this.formHead.getForm().findField('ACCDATE').setMinValue(this.MsPeriod.PERIOD);
this.formHead.getForm().findField('ACCDATE').setReadOnly(false);
} else {
if (opstatus == 'add' || opstatus == 'copyadd') {
this.formHead.getForm().findField('ACCDATE').setMinValue(this.MsPeriod.PERIOD);
this.formHead.getForm().findField('ACCDATE').setReadOnly(false);
}
else {
this.formHead.getForm().findField('ACCDATE').setMinValue('');
this.formHead.getForm().findField('ACCDATE').setReadOnly(true);
}
}
},
// end LoadDate
Save: function (type) {
var basicForm = this.formEdit.getForm();
var basicForm2 = this.formHead.getForm();
if (!basicForm.isValid()) {
return;
}
if (!basicForm2.isValid()) {
return;
}
var bodydatas = [];
for (var i = 0; i < this.storeBodyList.getCount(); i += 1) {
var member = this.storeBodyList.getAt(i);
bodydatas.push(member);
}
var jsonBody = ConvertRecordsToJsonAll(bodydatas);
var jsonDelBody = ConvertRecordsToJsonAll(this.bodyDel);
this.formHead.getForm().findField('BSNO').setDisabled(false);
var data = this.formHead.getForm().getValues(false, false, false);
var data2 = this.formEdit.getForm().getValues(false, false, false);
var data3 = this.formEdi.getForm().getValues(false, false, false);
this.formHead.getForm().findField('BSNO').setDisabled(true);
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/MvcShipping/MsOpApply/Save',
scope: this,
params: {
opstatus: this.opStatus,
data: Ext.JSON.encode(data),
data2: Ext.JSON.encode(data2),
data3: Ext.JSON.encode(data3),
body: jsonBody
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
var returnData = jsonresult.Data;
this.formEdit.getForm().reset();
this.formEdit.getForm().setValues(returnData);
this.formHead.getForm().reset();
this.formHead.getForm().setValues(returnData);
this.formEdi.getForm().reset();
this.formEdi.getForm().setValues(returnData);
if (this.opStatus == 'add') {
var arrNewRecords = this.storeList.insert(0, returnData);
this.editRecord = this.storeList.getAt(0);
}
else if (this.opStatus == 'edit') {
var editp = Ext.create('MsOpApply', returnData);
this.editRecord.fields.each(function (field) {
if (field.persist) {
name = field.name;
if (name != 'id')
this.editRecord.set(name, editp.get(name));
}
}, this);
this.editRecord.commit();
}
if (type == '0') {
this.opStatus = 'edit';
basicForm2.findField('BSNO').setDisabled(true);
for (var j = 0; j < this.storeBodyList.getCount(); j += 1) {
var memberbody = this.storeBodyList.getAt(j);
memberbody.set("BSNO", this.editRecord.get('BSNO'));
memberbody.commit();
};
this.LoadPeriodStatus(this.opStatus);
if (returnData.WMSNO != '') {
this.storeListWmsIn.load({ params: { wmsno: returnData.WMSNO} });
} else this.storeListWmsIn.load({ params: { wmsno:''} });
if (returnData.MBLNO!=''){
this.storeListBsCustomNo.load({ params: { constr:" MBLNO='"+returnData.MBLNO+"' AND BSNO<>'"+returnData.BSNO+"'" }});
this.storeListWmsNo.load({ params: { constr:" w.BLNO='"+returnData.MBLNO+"'" }});
}
} else if (type == '1') {
window.close();
} else if (type == '2') {
this.LoadData('add', '');
}
} else {
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
} else {
Ext.Msg.show({ title: '请重试',
msg: '服务器响应出错',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
}
}
});
} //end save
,
onAddDetailClick: function (button, event) {
if (this.formHead.getForm().isDirty() == true || this.formEdit.getForm().isDirty() == true) {
var basicForm = this.formEdit.getForm();
var basicForm2 = this.formHead.getForm();
if (!basicForm.isValid()) {
return;
}
if (!basicForm2.isValid()) {
return;
}
var bodydatas = [];
for (var i = 0; i < this.storeBodyList.getCount(); i += 1) {
var member = this.storeBodyList.getAt(i);
bodydatas.push(member);
}
var jsonBody = ConvertRecordsToJsonAll(bodydatas);
var jsonDelBody = ConvertRecordsToJsonAll(this.bodyDel);
this.formHead.getForm().findField('BSNO').setDisabled(false);
var data = this.formHead.getForm().getValues(false, false, false);
var data2 = this.formEdit.getForm().getValues(false, false, false);
var data3 = this.formEdi.getForm().getValues(false, false, false);
this.formHead.getForm().findField('BSNO').setDisabled(true);
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/MvcShipping/MsOpApply/Save',
scope: this,
params: {
opstatus: this.opStatus,
data: Ext.JSON.encode(data),
data2: Ext.JSON.encode(data2),
data3: Ext.JSON.encode(data3),
body: jsonBody
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
var returnData = jsonresult.Data;
this.formEdit.getForm().reset();
this.formEdit.getForm().setValues(returnData);
this.formHead.getForm().reset();
this.formHead.getForm().setValues(returnData);
this.formEdi.getForm().reset();
this.formEdi.getForm().setValues(returnData);
if (this.opStatus == 'add') {
var arrNewRecords = this.storeList.insert(0, returnData);
this.editRecord = this.storeList.getAt(0);
}
else if (this.opStatus == 'edit') {
var editp = Ext.create('MsOpApply', returnData);
this.editRecord.fields.each(function (field) {
if (field.persist) {
name = field.name;
if (name != 'id')
this.editRecord.set(name, editp.get(name));
}
}, this);
this.editRecord.commit();
}
this.opStatus = 'edit';
basicForm2.findField('BSNO').setDisabled(true);
for (var j = 0; j < this.storeBodyList.getCount(); j += 1) {
var memberbody = this.storeBodyList.getAt(j);
memberbody.set("BSNO", this.editRecord.get('BSNO'));
memberbody.commit();
};
this.LoadPeriodStatus(this.opStatus);
if (returnData.WMSNO != '') {
this.storeListWmsIn.load({ params: { wmsno: returnData.WMSNO} });
} else this.storeListWmsIn.load({ params: { wmsno:''} });
this.addDetail();
} 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
});
}
}
});
} else {
this.addDetail();
}
}, //end onAddDetailClick
onDelDetailClick: function (button, event) {
this.deleteDetail();
}, //onDelDetailClick
gridAfterEdit: function (editor, e, eOpts) {
if (e.field == 'Pkgs' || e.field == 'Price') {
var Pkgs = e.record.data['Pkgs'];
var Price = e.record.data['Price'];
e.record.set('Total', (Pkgs * Price).toFixed(2));
} else if (e.field=='WMSIN_GID'){
var records = DsStoreQueryBy(this.storeListWmsIn, 'GID', e.value);
if (records.getCount() > 0) {
var data = records.getAt(0).data;
var GoodsName = data.GOODSNAME;
var GOODSMODEL = data.GOODSMODEL;
var GOODSSTANDARD = data.GOODSSTANDARD;
var GOODSPACK = data.GOODSPACK;
var GOODAPPLYNUM = this.calcApplyDetailTotal(e.value);
var GOODSNUM=Add(GOODSPACK,-GOODAPPLYNUM);
if (GOODSNUM<0) GOODSNUM=0;
var Pkgs=Mul(GOODSNUM, GOODSSTANDARD);
e.record.set('GoodsName', GoodsName);
e.record.set('GOODSMODEL', GOODSMODEL);
e.record.set('GOODSSTANDARD', GOODSSTANDARD);
e.record.set('GOODSNUM', GOODSNUM);
e.record.set('NOAPPLYNUM', GOODSNUM);
e.record.set('Pkgs', Pkgs);
this.setPkgsTotal();
}
}else if (e.field=='GOODSNUM'){
var GOODSNUM=e.value;
var WMSIN_GID = e.record.data['WMSIN_GID'];
var GOODAPPLYNUM = this.calcApplyDetailTotal(WMSIN_GID);
GOODAPPLYNUM=Add(GOODAPPLYNUM,-GOODSNUM);
var NOAPPLYNUM =0;
var GOODSSTANDARD = e.record.data['GOODSSTANDARD'];
var GOODSPACK=0;
var WMSNO = this.formHead.getForm().findField('WMSNO').getValue();
if (WMSNO!=''){
var records = DsStoreQueryBy(this.storeListWmsIn, 'GID',WMSIN_GID);
if (records.getCount() > 0) {
var data = records.getAt(0).data;
GOODSPACK = data.GOODSPACK;
NOAPPLYNUM=Add(GOODSPACK,-GOODAPPLYNUM);
}
if (GOODSNUM>NOAPPLYNUM){
GOODSNUM=NOAPPLYNUM;
if (GOODSNUM<0) GOODSNUM=0;
e.record.set('GOODSNUM', GOODSNUM);
Ext.Msg.show({ title: '提示', msg: '规格数量不能大于未报关数量!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
}
this.setPkgsTotal();
var Pkgs=Mul(GOODSNUM, GOODSSTANDARD);
e.record.set('Pkgs', Pkgs);
}
},
setPkgsTotal: function () {
var total = this.calcDetailTotal('GOODSNUM');
this.setHeadFieldValue('PKGS', total);
},
calcApplyDetailTotal: function (WMSIN_GID) {
var total = 0;
for (var i = 0; i < this.storeBodyList.getCount(); i += 1) {
var member = this.storeBodyList.getAt(i);
var value = member.get('GOODSNUM');
var GID = member.get('WMSIN_GID');
if (GID==WMSIN_GID){
total = Add(total,value);
}
}
return total;
},
calcDetailTotal: function (fieldName) {
var total = 0;
for (var i = 0; i < this.storeBodyList.getCount(); i += 1) {
var member = this.storeBodyList.getAt(i);
var value = member.get(fieldName);
total = total + value;
}
return total;
},
setHeadFieldValue: function (fieldName, value) {
var field = this.formEdit.getForm().findField(fieldName);
field.setValue(value);
},
onDeleteClick: function (button, event) {
var selections = this.gridListLS.getSelectionModel().getSelection();
if (selections.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var record = selections[0];
if (record.data.BSSTATUS == '1') {
Ext.Msg.show({ title: '警告', msg: '业务已锁定,不允许删除!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
return;
}
if (record.data.FEESTATUS == '1') {
Ext.Msg.show({ title: '警告', msg: '费用已锁定,不允许删除!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
return;
}
if (this.StoreOpRange.getCount() == 0) {
Ext.Msg.show({ title: '警告', msg: '权限不足,不允许删除!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
return;
} else {
var op = record.data.OP;
var inputby = record.data.INPUTBY;
var records = DsStoreQueryBy(this.StoreOpRange, 'OPID', op);
if (records.getCount() > 0) {
} else {
var recordins = DsStoreQueryBy(this.StoreOpRange, 'OPID', inputby);
if (recordins.getCount() > 0) {
} else {
canedit = false;
Ext.Msg.show({ title: '警告', msg: '权限不足,不允许删除!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
return;
}
}
}
Ext.MessageBox.confirm('提示', '确定删除该记录吗?', function (btn) {
if (btn == 'yes') {
Ext.Msg.wait('正在删除数据...');
Ext.Ajax.request({
waitMsg: '正在删除数据...',
url: '/MvcShipping/MsOpApply/Delete',
params: {
data: Ext.JSON.encode(record.data)
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
this.storeList.remove(record);
if (this.storeList.getCount() > 0) {
var member = this.storeList.getAt(0);
this.LoadData("edit", "BSNO='" + member.data.BSNO + "'");
this.editRecord = member;
} else {
this.LoadData('add', '');
}
Ext.Msg.show({ title: '提示', msg: jsonresult.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
else {
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
}
},
failure: function (response, options) {
Ext.Msg.show({ title: '警告', msg: '服务器响应出错,请重试', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
},
success: function (response, options) {
},
scope: this
}); //end Ext.Ajax.request
}
}, this);
},
serviceCheckChange: function (field, newValue, oldValue, eOpts) {
if (field.checked) {
if (Ext.getCmp('pnl' + field.id)) { } else {
var panelservice = this.CreateMenuPanel(field.boxLabel, field.name);
this.panelpage2.add(panelservice);
this.panelpage2.doLayout();
}
} else {
_this = this;
if (Ext.getCmp('pnl' + field.id)) {
var children = _this.panelpage2.items;
if (children) {
_this.panelpage2.remove('pnl' + field.id, true);
_this.panelpage2.doLayout();
}
}
}
},
CreateMenuPanel: function (title, TypeID) {
var bsno = this.formHead.getForm().findField('BSNO').value;
var type = Ext.util.Format.substr(TypeID, 2, 9)
var storeServiceList = Ext.create('Ext.data.Store', {
model: 'MsOpApplyServiceDetail',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsOpApplyService/GetServiceDetailList',
reader: {
id: 'BSNO,SerialNo',
root: 'data',
totalProperty: 'totalCount'
}
}
});
storeServiceList.on('beforeload', function (store) {
Ext.apply(store.proxy.extraParams, { BsNo: bsno, OPField: type });
}, this);
storeServiceList.load({ params: { BsNo: bsno, OPField: type} });
var gridserviceListCellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});
var panelserviceBtn = new Ext.Panel({
region: "north",
tbar: [
{
id: TypeID + 'Save',
text: "保存",
iconCls: "btnsave",
handler: function (button, event) {
var basicForm = servicepanel.getForm();
if (!basicForm.isValid()) {
return;
}
var bodydatas = [];
for (var i = 0; i < storeServiceList.getCount(); i += 1) {
var member = storeServiceList.getAt(i);
bodydatas.push(member);
}
var jsonBody = ConvertRecordsToJsonAll(bodydatas);
var data = servicepanel.getForm().getValues();
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/MvcShipping/MsOpApplyService/Save',
scope: this,
params: {
bsno: bsno,
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;
servicepanel.getForm().setValues(returnData);
for (var j = 0; j < storeServiceList.getCount(); j += 1) {
var memberbody = storeServiceList.getAt(j);
memberbody.set("BSNO", bsno);
memberbody.commit();
};
} 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
});
}
}
});
},
scope: this
},
{
id: TypeID + 'btnWorkNew',
text: "添加流程",
iconCls: "btnadd",
handler: function (button, event) {
var newSerialno = this.GetHandleSerialNo(storeServiceList);
var record = Ext.create('MsOpApplyServiceDetail', {
BSNO: '*',
GID: '',
SerialNo: newSerialno,
OPFIELD: type,
STATUS: '未完成',
WORK: '',
ISFINISH: 0,
NOFINISHRESON: '',
OTADVICE: '',
HELPOP: '',
ENDOP: '',
REMARK: ''
});
storeServiceList.add(record);
var n = storeServiceList.getCount();
gridserviceListCellEditing.startEditByPosition({ row: n - 1, column: 1 });
},
scope: this
}, {
id: TypeID + 'btnWorkdel',
text: "删除流程",
iconCls: "btndelete",
handler: function (button, event) {
var selectedRecords = servicegridList.selModel.getSelection();
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
storeServiceList.remove(selectedRecords[i]);
}
},
scope: this
}, {
id: TypeID + 'btnWorkover',
text: "流程确认完成",
handler: function (button, event) {
var selectedRecords = servicegridList.selModel.getSelection();
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
rec.data.STATUS = '已完成';
rec.data.ENDOP = SHOWNAME;
var myDate = new Date();
rec.data.ENDDATETIME = myDate;
rec.commit();
}
},
scope: this
}, {
id: TypeID + 'btnWorkOpover',
text: "流程审核完成",
handler: function (button, event) {
var field = servicepanel.getForm().findField('STATUS');
field.setValue('已完成');
var myDate = new Date();
var field2 = servicepanel.getForm().findField('ENDDATETIME');
var mydatestr = Ext.util.Format.date(myDate, 'Y-m-d H:i:s');
field2.setValue(mydatestr);
var field3 = servicepanel.getForm().findField('ENDOP');
field3.setValue(SHOWNAME);
},
scope: this
}, {
id: TypeID + 'btnWorkOpback',
text: "流程驳回",
handler: function (button, event) {
var selectedRecords = servicegridList.selModel.getSelection();
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
rec.data.STATUS = '操作驳回';
rec.data.ENDOP = SHOWNAME;
var myDate = new Date();
rec.data.ENDDATETIME = myDate;
rec.commit();
}
},
scope: this
},
{
id: TypeID + 'btnWorkOpover',
text: "流程审核完成",
handler: function (button, event) {
var selectedRecords = servicegridList.selModel.getSelection();
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
rec.data.STATUS = '已完成';
rec.data.ENDOP = SHOWNAME;
var myDate = new Date();
rec.data.ENDDATETIME = myDate;
rec.commit();
}
},
scope: this
},
'-',
{
id: TypeID + 'btnover',
text: "确认完成",
handler: function (button, event) {
var opstr = this.formHead.getForm().findField('OP').getValue();
if (SHOWNAME != opstr) {
Ext.Msg.show({ title: '警告', msg: '你无权确认完成 !!!', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
return;
}
var field = servicepanel.getForm().findField('STATUS');
field.setValue('已完成');
var myDate = new Date();
var field2 = servicepanel.getForm().findField('ENDDATETIME');
var mydatestr = Ext.util.Format.date(myDate, 'Y-m-d H:i:s');
field2.setValue(mydatestr);
var field3 = servicepanel.getForm().findField('ENDOP');
field3.setValue(SHOWNAME);
},
scope: this
},
{
id: TypeID + 'btnopover',
text: "审核完成",
handler: function (button, event) {
var opstr = this.formHead.getForm().findField('OP').getValue();
if (SHOWNAME != opstr) {
Ext.Msg.show({ title: '警告', msg: '你无权审核完成 !!!', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
return;
}
var field = servicepanel.getForm().findField('STATUS');
field.setValue('已完成');
var myDate = new Date();
var field2 = servicepanel.getForm().findField('ENDDATETIME');
var mydatestr = Ext.util.Format.date(myDate, 'Y-m-d H:i:s');
field2.setValue(mydatestr);
var field3 = servicepanel.getForm().findField('ENDOP');
field3.setValue(SHOWNAME);
},
scope: this
}
]
});
var storeOpCodeSvr = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.UserRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetUserRefList' }
});
storeOpCodeSvr.load();
var opstr = this.formHead.getForm().findField('OP').getValue();
var comboxOp = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: title + '操作',
store: storeOpCodeSvr,
forceSelection: true,
name: 'OP',
labelWidth: 60,
width: 170,
value: opstr,
valueField: 'UserName',
displayField: 'CodeAndName'
});
var storeCodeService = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsCodeOpServiceDetail',
proxy: { url: '/MvcShipping/MsCodeOpService/GetBodyList' }
});
var condition = "OS_ID in (select OS_ID from code_op_service where OPTYPE='5' and OPField='" + type + "')"
storeCodeService.load({ params: { condition: condition} });
var comboxCodeService = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '服务项目类别',
store: storeCodeService,
forceSelection: true,
name: 'SERVICE',
labelWidth: 80,
width: 170,
valueField: 'NAME',
displayField: 'NAME'
});
var storeCodeWork = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsCodeOpServiceDetail',
proxy: { url: '/MvcShipping/MsCodeOpService/GetWorkList' }
});
storeCodeWork.load({ params: { condition: condition} });
var comboxCodeWork = Ext.create('DsExt.ux.RefTableCombox', {
store: storeCodeWork,
forceSelection: true,
name: 'WORK',
labelWidth: 80,
valueField: 'NAME',
displayField: 'NAME'
});
var comboxhelpOp = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeOpCode,
forceSelection: true,
name: 'HELPOP',
valueField: 'UserName',
displayField: 'CodeAndName'
});
var servicepanel = Ext.widget('form', {
bodyPadding: 3,
layout: "border",
region: 'north',
height: 40,
frame: false, fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
msgTarget: 'qtip'
},
items: [
{//fieldset 1
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%',
margins: '0 5 5 5'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '业务编号',
name: 'BSNO', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: '服务项目',
name: 'OPFIELD', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: '当前状态',
labelWidth: 60,
width: 120,
readOnly: true,
name: 'STATUS'
}, comboxOp, comboxCodeService, {
fieldLabel: '开始时间',
format: 'Y-m-d',
xtype: 'datetimefield',
labelWidth: 60,
width: 220,
name: 'STARTDATETIME'
}, {
fieldLabel: '计划完成时间',
format: 'Y-m-d',
xtype: 'datetimefield',
labelWidth: 80,
width: 220,
name: 'PLANENDTIME'
}, {
fieldLabel: '实际完成时间',
format: 'Y-m-d',
xtype: 'datetimefield',
labelWidth: 80,
width: 220,
readOnly: true,
name: 'ENDDATETIME'
}, {
fieldLabel: '完成人',
labelWidth: 50,
width: 120,
readOnly: true,
name: 'ENDOP'
}
]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
});
Ext.Ajax.request({
waitMsg: '正在查询主表数据...',
url: '/MvcShipping/MsOpApplyService/GetData',
params: {
BsNo: bsno,
OPField: type
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
Ext.Msg.show({
title: '提示',
msg: result.Message,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
return;
}
data = result.data;
servicepanel.getForm().reset();
servicepanel.getForm().setValues(data);
if (servicepanel.getForm().findField('OP').getValue() == '')
servicepanel.getForm().findField('OP').setValue(opstr);
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
var serviceGridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
var servicegridList = new Ext.grid.GridPanel({
store: storeServiceList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
plugins: [gridserviceListCellEditing],
selModel: serviceGridCheckBoxModel,
selType: 'cellmodel',
columns: [{
sortable: true,
dataIndex: 'BSNO',
header: '业务编号',
hidden: true,
width: 120
}, {
sortable: true,
dataIndex: 'OPFIELD',
header: '服务类型',
hidden: true,
width: 120
}, {
sortable: true,
dataIndex: 'GID',
header: 'GID',
hidden: true,
width: 120
}, {
sortable: true,
dataIndex: 'SerialNo',
header: '序号',
width: 30
}, {
sortable: true,
dataIndex: 'WORK',
header: '流程',
editor: comboxCodeWork,
width: 120
}, {
sortable: true,
dataIndex: 'STATUS',
header: '流程状态',
width: 120
}
/*
, {
sortable: true,
dataIndex: 'STARTDATETIME',
header: '开始时间',
editor: {
xtype: 'datetimefield',
format: 'Y-m-d',
allowBlank: false,
selectOnFocus: true
},
renderer: Ext.util.Format.dateRenderer('Y-m-d H:i:s'),
width: 130
}
*/
, {
sortable: true,
dataIndex: 'PLANENDTIME',
header: '计划完成时间',
editor: {
xtype: 'datetimefield',
format: 'Y-m-d',
allowBlank: false,
selectOnFocus: true
},
renderer: Ext.util.Format.dateRenderer('Y-m-d H:i:s'),
width: 130
}, {
sortable: true,
dataIndex: 'ENDDATETIME',
header: '完成时间',
renderer: Ext.util.Format.dateRenderer('Y-m-d H:i:s'),
width: 130
}, {
sortable: true,
dataIndex: 'NOFINISHRESON',
header: '未完成原因',
editor: {
xtype: 'textfield',
allowBlank: false,
selectOnFocus: true
},
width: 120
}, {
sortable: true,
dataIndex: 'NEXTPLAN',
header: '下步计划',
editor: {
xtype: 'textfield',
selectOnFocus: true
},
width: 110
}, {
sortable: true,
dataIndex: 'HELPOP',
header: '协助解决人',
editor: comboxhelpOp,
width: 110
}, {
sortable: true,
dataIndex: 'ENDOP',
header: '完成人',
width: 110
}
]
});
var panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 60,
items: [panelserviceBtn, servicepanel]
});
storeServiceList.load({ params: { BsNo: bsno, OPField: type},
callback: function (r, options, success) {
if (success) {
if (storeServiceList.getCount() > 0){
}else {
storeWorkList = Ext.create('Ext.data.Store', {
model: 'MsCodeOpServiceDetail',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsCodeOpService/GetWorkList',
reader: {
id: 'OS_ID,SerialNo',
root: 'data',
totalProperty: 'totalCount'
}
}
});
storeWorkList.load({ params: { condition: "OS_ID in (select OS_ID from code_op_service where OPField='"+type+"' and OPTYPE=5)" },
callback: function (r, options, success) {
if (success) {
if (storeWorkList.getCount() > 0) {
for (var j = 0; j < storeWorkList.getCount(); j += 1) {
var member = storeWorkList.getAt(j);
var newSerialno = _this.GetHandleSerialNo(storeServiceList);
var record = Ext.create('MsOpApplyServiceDetail', {
BSNO: '*',
GID: '',
SerialNo: newSerialno,
OPFIELD: type,
STATUS: '未完成',
WORK: member.data.NAME,
ISFINISH: 0,
NOFINISHRESON: '',
OTADVICE: '',
HELPOP: '',
ENDOP: '',
REMARK: ''
});
storeServiceList.add(record);
};
var basicForm = servicepanel.getForm();
if (!basicForm.isValid()) {
return;
}
var bodydatas = [];
for (var i = 0; i < storeServiceList.getCount(); i += 1) {
var member = storeServiceList.getAt(i);
bodydatas.push(member);
}
var jsonBody = ConvertRecordsToJsonAll(bodydatas);
var data = servicepanel.getForm().getValues();
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/MvcShipping/MsOpApplyService/Save',
scope: this,
params: {
bsno: bsno,
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;
servicepanel.getForm().setValues(returnData);
for (var j = 0; j < storeServiceList.getCount(); j += 1) {
var memberbody = storeServiceList.getAt(j);
memberbody.set("BSNO", bsno);
memberbody.commit();
};
} 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
});
}
}
});
} else {
}
}
},
scope: this
});
}
}
}
});
return new Ext.Panel({
title: title,
height: 200,
id: 'pnl' + TypeID,
layout: "border",
region: 'north',
animate: true,
// autoScroll: true,
// containerScroll: true,
frame: false,
items: [panelTop, servicegridList]
});
},
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.SerialNo > result) {
result = member.data.SerialNo;
}
}
}
result = result + 1;
return result;
},
addDetail: function () {
var newSerialno = DsGetNewSerialNo(this.storeBodyList, this.serialNo);
this.serialNo = newSerialno;
// this.tabtree.expandAll();
var record = Ext.create('MsOpApplyDetail', {
BsNo: '*',
SerialNo: newSerialno,
GoodsCode: '',
GoodsName: '',
Pkgs: 0,
Price: 0,
Total: 0,
Currency: '',
Remark: ''
});
this.storeBodyList.add(record);
var n = this.storeBodyList.getCount();
this.gridListCellEditing.startEditByPosition({ row: n - 1, column: 2 });
},
deleteDetail: function () {
this.serialNo = DsGetCurSerialNo(this.storeBodyList, this.serialNo);
var selectedRecords = this.gridList.selModel.getSelection();
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (rec.BsNo != "" || rec.BsNo != "*") //如果是新增但没有保存的数据,没有必要提交到后台
{
this.bodyDel.push(rec);
}
this.storeBodyList.remove(selectedRecords[i]);
}
},
GetEditStatus: function () {
var canedit = false;
var bsStatus = this.formHead.getForm().findField('BSSTATUS').getValue();
var inputby = this.formHead.getForm().findField('INPUTBY').getValue();
var op = this.formHead.getForm().findField('OP').getValue();
_this = this;
if (bsStatus == "true") {
canedit = false;
this.setSaveBtnStatus(canedit);
} else {
this.StoreOpRange.load({ params: { optype: "modOpApplyOpwt" },
callback: function (r, options, success) {
if (success) {
if (r.length != 0) {
var records = DsStoreQueryBy(_this.StoreOpRange, 'OPID', op);
if (records.getCount() > 0) {
canedit = true;
} else {
var recordins = DsStoreQueryBy(_this.StoreOpRange, 'OPID', inputby);
if (recordins.getCount() > 0) {
canedit = true;
} else {
canedit = false;
}
}
} else { canedit = false; }
_this.setSaveBtnStatus(canedit);
}
}
});
}
_this = this;
Ext.Ajax.request({
waitMsg: '正在查询委托编号状态...',
url: '/MvcShipping/MsBaseInfo/GetRuleEdit',
params: {
rulename: '委托编号',
ruletype: '4'
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (result.Success != true) {
var custno = _this.formHead.getForm().findField('CUSTNO');
custno.setReadOnly(true);
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
},
LoadDefValue: function () {
this.storeDefValue.load({ params: { condition: "BSTYPE='报关业务'" },
callback: function (r, options, success) {
if (success) {
if (this.storeDefValue.getCount() > 0) {
for (var j = 0; j < this.storeDefValue.getCount(); j += 1) {
var member = this.storeDefValue.getAt(j);
var headfield = this.formHead.getForm().findField(member.data.FIELDNAME);
if (headfield != NaN && headfield != null)
headfield.setValue(member.data.DEFVALUE);
var headfield = this.formEdit.getForm().findField(member.data.FIELDNAME);
if (headfield != NaN && headfield != null)
headfield.setValue(member.data.DEFVALUE);
};
} else {
}
}
},
scope: this
});
},
LoadMustBe: function () {
this.storeMustBe.load({ params: { condition: "BSTYPE='报关业务'" },
callback: function (r, options, success) {
if (success) {
if (this.storeMustBe.getCount() > 0) {
for (var j = 0; j < this.storeMustBe.getCount(); j += 1) {
var member = this.storeMustBe.getAt(j);
var headfield = this.formHead.getForm().findField(member.data.FIELDNAME);
if (headfield != NaN && headfield != null) {
if (member.data.ISMUST == "1")
headfield.allowBlank = false;
if (member.data.ISCOLOR == "1")
headfield.setFieldStyle({ background: '#ffc' });
}
var headfield = this.formEdit.getForm().findField(member.data.FIELDNAME);
if (headfield != NaN && headfield != null) {
if (member.data.ISMUST == "1")
headfield.allowBlank = false;
if (member.data.ISCOLOR == "1")
headfield.setFieldStyle({ background: '#ffc' });
}
};
} else {
}
}
},
scope: this
});
},
setSaveBtnStatus: function (enable) {
var btnESave = Ext.getCmp('btnESave');
var btnESaveAndNew = Ext.getCmp('btnESaveAndNew');
var btnEAddDetail = Ext.getCmp('btnadddetail');
var btnEDeleteDetail = Ext.getCmp('btndeldetail');
if (enable) {
btnESave.enable();
btnESaveAndNew.enable();
btnEAddDetail.enable();
btnEDeleteDetail.enable();
for (var i = 0; i < this.myCheckboxGroup.items.getCount(); i += 1) {
this.myCheckboxGroup.items.items[i].readOnly = false;
};
} else {
btnESave.disable();
btnESaveAndNew.disable();
btnEAddDetail.disable();
btnEDeleteDetail.disable();
for (var i = 0; i < this.myCheckboxGroup.items.getCount(); i += 1) {
this.myCheckboxGroup.items.items[i].readOnly = true;
};
}
},
Print: function () {
var basicForm = this.formHead.getForm();
var billNo = basicForm.findField('BSNO').value;
if (billNo == '*' || billNo == '') {
Ext.Msg.show({ title: '错误', msg: '单据还没有保存,请保存后再打印', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
return;
}
var printType = 'MSOPAPPLY';
var sql1 = "SET LANGUAGE 'us_english' SELECT * FROM op_apply WHERE BSNO = '" + billNo + "'";
var sql2 = "";
var sql3 = "";
var sql4 = "";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
},
getIsModify: function () {
var feepanel = Ext.getCmp('pnlmodApplyAllFee');
if (feepanel != NaN && feepanel != null) {
var feemodify = feepanel.panelFee.getModifyStatus();
if (feemodify) {
return '费用信息';
}
}
if (this.formHead.getForm().isDirty() == true || this.formEdit.getForm().isDirty() == true) {
return '业务信息';
}
else return '';
}
});