You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
DS7/DSWeb/TruckMng/Viewsjs/MsOpTruckBulk/MsOpTruckBulkEdit.js

3323 lines
134 KiB
JavaScript

2 years ago
Ext.namespace('Shipping');
Shipping.MsOpTruckBulkEdit = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsOpTruckBulkEdit.superclass.constructor.call(this);
};
Ext.extend(Shipping.MsOpTruckBulkEdit, Ext.Panel, {
ParentWin: null,
OpStatus: 'add',
StoreList: null,
editRecord: null,
Editdata: null,
stroplb: '陆运普货订单',
initUIComponents: function () {
this.bodyDel = [];
this.itemindex = 1;
this.myDate = new Date();
this.accdatesameetd = 0;
this.MsPeriod = null;
this.Audit = false;
_this = this;
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.storeFeeTemplateDetail = Ext.create('Ext.data.Store', {
fields: [
{ name: 'GID', type: 'string' },
{ name: 'TEMPLATEID', type: 'string' },
{ name: 'UNIT', type: 'string' },
{ name: 'UNITTYPE', type: 'string' },
{ name: 'UNITPRICE', type: 'number' },
{ name: 'LOADPORT', type: 'string' },
{ name: 'DISTPORT', type: 'string' },
{ name: 'STARTWEIGHT', type: 'number' },
{ name: 'ENDWEIGHT', type: 'number' },
{ name: 'CREATEUSER', type: 'string' },
{ name: 'CREATETIME', type: 'string' },
{ name: 'REMARK', type: 'string' }
],
remoteSort: true,
proxy: {
type: 'ajax',
url: '/TruckMng/MsCustTruckFeeTemplate/GetBodyList',
reader: {
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.storecodeservice = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsCodeOpService',
proxy: { url: '/MvcShipping/MsCodeOpService/GetDataList' }
});
//人员信息加载
this.storeOpCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.UserRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetUserRefList' }
});
this.storeOpCode.load();
//客服
this.comboxCUSTSERVICE = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '运营经理',
store: this.storeOpCode,
forceSelection: true,
name: 'CUSTSERVICE',
valueField: 'UserName',
displayField: 'CodeAndName'
});
//揽货人
this.comboxSALE = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '客户经理',
store: this.storeOpCode,
forceSelection: true,
name: 'SALE',
valueField: 'UserName',
displayField: 'CodeAndName'
});
//操 作
this.comboxOP = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '操 作',
store: this.storeOpCode,
forceSelection: true,
name: 'OP',
valueField: 'UserName',
displayField: 'CodeAndName',
value: SHOWNAME
});
//操 作
this.comboxDDOP = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '调 度',
store: this.storeOpCode,
forceSelection: true,
name: 'DDOP',
valueField: 'UserName',
displayField: 'CodeAndName'
});
//委托单位
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,
queryMode: 'remote',
minChars: 0,
queryParam: 'CODENAME',
forceSelection: true,
name: 'CUSTOMERNAME',
valueField: 'CustName',
displayField: 'CodeAndFull',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
var basicForm = _this.formEdit.getForm();
// this.formHead.getForm().findField('SALECORPID').setValue(records[0].data.SALECORPID);
var s = " LINKID in (select gid from [info_client] where SHORTNAME='" + combo.value + "')";
this.storeInfoClientContact.load({ params: { condition: s },
callback: function (r, options, success) {
if (success) {
if (this.storeInfoClientContact.getCount() > 0) {
var member = this.storeInfoClientContact.getAt(0);
this.comboxInfoClientContact.setValue(member.data.SHOWNAME);
} else {
this.comboxInfoClientContact.setValue('');
}
}
},
scope: this
});
this.getContractNo();
}
}
}
});
//委托单位_联系人
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,
// forceSelection: true,
name: 'CUSTATTN',
valueField: 'SHOWNAME',
displayField: 'SHOWNAME'
});
// //运输类型
// this.storeTRANSTYPE = Ext.create('DsExt.ux.RefEnumStore', {});
// this.storeTRANSTYPE.load({ params: { enumTypeId: 96004} });
// this.comboxTRANSTYPE = Ext.create('DsExt.ux.RefEnumComboxList', {
// fieldLabel: '运输类型',
// store: this.storeTRANSTYPE,
// forceSelection: true,
// name: 'TRANSTYPE'
// });
//品名
this.storeCodeGoodsList = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CodeGoodsModel',
proxy: { url: '/CommMng/BasicDataRef/GetCodeGoodsListRm' }
});
this.storeCodeGoodsList.load();
this.comboxGOODSNAME = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '品名',
store: this.storeCodeGoodsList,
queryMode: 'remote',
minChars: 0,
queryParam: 'CODENAME',
name: 'GOODSNAME',
valueField: 'GOODNAME',
displayField: 'CodeAndName',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
this.getContractNo();
}
}
}
});
this.storeCodeGoodsList2 = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CodeGoodsModel',
proxy: { url: '/CommMng/BasicDataRef/GetCodeGoodsList' }
});
this.storeCodeGoodsList2.load();
this.comboxGOODSNAME2 = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeCodeGoodsList2,
name: 'GOODSNAME',
valueField: 'GOODNAME',
displayField: 'CodeAndName'
});
//权限范围
this.StoreOpRange = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsOP',
proxy: { url: '/MvcShipping/MsBaseInfo/GetOpRang' }
});
//
this.storeUserBase = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.UserBaseModel',
proxy: { url: '/MvcShipping/MsBaseInfo/GetUserBaseList' }
});
this.storeUserBase.load();
this.StoreStlName = Ext.create('Ext.data.Store', {
fields: ['STLNAME']
});
this.StoreStlName.add({ "STLNAME": "票结" });
this.StoreStlName.add({ "STLNAME": "半月结" });
this.StoreStlName.add({ "STLNAME": "月结" });
this.StoreStlName.add({ "STLNAME": "周结" });
this.comboxStlName = Ext.create('DsExt.ux.RefTableCombox', {
store: this.StoreStlName,
fieldLabel: '结算方式',
forceSelection: true,
name: 'STLNAME',
valueField: 'STLNAME',
displayField: 'STLNAME'
});
this.storeSaleCompany = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsCompanysEntity',
proxy: { url: '/MvcShipping/MsCompanys/GetNoPicDataList' }
});
this.storeSaleCompany.load({ params: { condition: "" } });
this.comboxSaleCompany = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel:'所属分部', //'委托分公司',
store: this.storeSaleCompany,
forceSelection: true,
name: 'SALECORPID',
valueField: 'GID',
displayField: 'NAME'
});
this.storeListGetContract = Ext.create('Ext.data.Store', {
fields: [
{ name: 'GID', type: 'string' },
{ name: 'LINKID', type: 'string' },
{ name: 'CONTRACTNO', type: 'string' },
{ name: 'SIGNINGDATE', type: 'string' },
{ name: 'STARTDATE', type: 'string' },
{ name: 'CANCELDATE', type: 'string' },
{ name: 'CHIEF', type: 'string' },
{ name: 'REMARK', type: 'string' },
{ name: 'CORPID', type: 'string' }
],
pageSize: 5000,
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsInfoClient/GetContractDataList',
reader: {
id: '',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.comboxContract = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeListGetContract,
// forceSelection: true,
fieldLabel: '合同号', //'费用类型',
valueField: 'CONTRACTNO',
name: 'CONTRACTNO',
displayField: 'CONTRACTNO',
listeners: {
scope: this,
'focus': function (combo, records, eOpts) {
var custname = this.formHead.getForm().findField('CUSTOMERNAME').getValue();
if (custname != '') {
var sql = "LINKID in (select GID FROM INFO_CLIENT WHERE SHORTNAME='" + custname + "')";
this.storeListGetContract.load({
params: { start: 0, limit: 5000, sort: '', condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
}
}
}
});
this.storeListFeeTemplate = Ext.create('Ext.data.Store', {
fields: [
{ name: 'GID', type: 'string' },
{ name: 'LINKID', type: 'string' },
{ name: 'CONTRACTNO', type: 'string' },
{ name: 'TEMPLATENAME', type: 'string' },
{ name: 'CUSTOMERNAME', type: 'string' },
{ name: 'GOODNAME', type: 'string' },
{ name: 'TRANTYPE', type: 'string' },
{ name: 'FEEUNIT', type: 'string' },
{ name: 'PRICEUNIT', type: 'string' },
{ name: 'LOADPORT', type: 'string' },
{ name: 'DISTPORT', type: 'string' },
{ name: 'CREATEUSER', type: 'string' },
{ name: 'CREATEUSERREF', type: 'string' },
{ name: 'CREATETIME', type: 'string' },
{ name: 'CORPID', type: 'string' },
{ name: 'REMARK', type: 'string' }
],
remoteSort: true,
proxy: {
type: 'ajax',
url: '/TruckMng/MsCustTruckFeeTemplate/GetDataList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.comboxFeeTemplate = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeListFeeTemplate,
// forceSelection: true,
fieldLabel: '计费方案', //'费用类型',
valueField: 'TEMPLATENAME',
name: 'TEMPLATENAME',
displayField: 'TEMPLATENAME',
listeners: {
scope: this,
'focus': function (combo, records, eOpts) {
var CONTRACTNO = this.formHead.getForm().findField('CONTRACTNO').getValue();
if (CONTRACTNO != '') {
var sql = " CONTRACTNO='" + CONTRACTNO + "' and TRANTYPE='普货' and BSSTATUS='审核通过' ";
this.storeListFeeTemplate.load({
params: { start: 0, limit: 5000, sort: '', condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
} else this.storeListFeeTemplate.removeAll();
},
'select': function (combo, records, eOpts) {
if (records.length > 0) {
var CONTRACTNO = this.formHead.getForm().findField('CONTRACTNO').getValue();
var PORTLOAD = this.formEdit.getForm().findField('PORTLOAD').getValue();
var PORTDISCHARGE = this.formEdit.getForm().findField('PORTDISCHARGE').getValue();
if (PORTLOAD != '' && PORTDISCHARGE != '' && CONTRACTNO != '') {
var s = " LOADPORT='" + PORTLOAD + "' and DISTPORT='" + PORTDISCHARGE + "' and TEMPLATEID in (select gid from [Cust_Truck_feetemplate] where TEMPLATENAME='" + combo.value + "' and CONTRACTNO='" + CONTRACTNO + "')";
this.storeFeeTemplateDetail.load({
params: { condition: s },
scope: this
});
}
}
}
}
});
this.storeListTruckLoadPort = Ext.create('Ext.data.Store', {
fields: [
{ name: 'PORTID', type: 'string' },
{ name: 'PORTCODE', type: 'string' },
{ name: 'PORT', type: 'string' },
{ name: 'CODEANDNAME', type: 'string' },
{ name: 'PROVINCE', type: 'string' }
],
pageSize: 5000,
remoteSort: true,
proxy: {
type: 'ajax',
url: '/TruckMng/MsCodeTruckPort/GetDataListRm',
reader: {
id: '',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.storeListTruckLoadPort.load();
this.comboxLoadPort = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '起运地', //'费用类型',
store: this.storeListTruckLoadPort,
valueField: 'PORT',
displayField: 'CODEANDNAME',
queryMode: 'remote',
minChars: 0,
queryParam: 'CODENAME',
forceSelection: true,
name: 'PORTLOAD',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
this.getContractNo();
}
}
}
});
this.storeListTruckDistPort = Ext.create('Ext.data.Store', {
fields: [
{ name: 'PORTID', type: 'string' },
{ name: 'PORTCODE', type: 'string' },
{ name: 'PORT', type: 'string' },
{ name: 'CODEANDNAME', type: 'string' },
{ name: 'PROVINCE', type: 'string' }
],
pageSize: 5000,
remoteSort: true,
proxy: {
type: 'ajax',
url: '/TruckMng/MsCodeTruckPort/GetDataListRm',
reader: {
id: '',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.storeListTruckDistPort.load();
this.comboxDistPort = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '目的地', //'费用类型',
store: this.storeListTruckDistPort,
valueField: 'PORT',
displayField: 'CODEANDNAME',
queryMode: 'remote',
minChars: 0,
queryParam: 'CODENAME',
forceSelection: true,
name: 'PORTDISCHARGE',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
this.getContractNo();
}
}
}
});
this.storeListConsigneeName = Ext.create('Ext.data.Store', {
fields: [
{ name: 'CONSIGNEENAME', type: 'string' },
{ name: 'CONSIGNEETEL', type: 'string' },
{ name: 'CONSIGNEEATTN', type: 'string' },
{ name: 'CONSIGNEEADDR', type: 'string' },
{ name: 'DISTPORT', type: 'string' }
],
pageSize: 5000,
remoteSort: true,
proxy: {
type: 'ajax',
url: '/TruckMng/MsCustTruckConsignee/GetDataListRm',
reader: {
id: '',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.storeListConsigneeName.load();
this.comboxConsigneeName = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '收货方', //'费用类型',
store: this.storeListConsigneeName,
valueField: 'CONSIGNEENAME',
displayField: 'CONSIGNEENAME',
queryMode: 'remote',
minChars: 0,
queryParam: 'CODENAME',
// forceSelection: true,
name: 'CONSIGNEENAME',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
this.formEdit.getForm().findField('CONSIGNEEADDR').setValue(records[0].data.CONSIGNEEADDR);
this.formEdit.getForm().findField('CONSIGNEEATTN').setValue(records[0].data.CONSIGNEEATTN);
this.formEdit.getForm().findField('CONSIGNEETEL').setValue(records[0].data.CONSIGNEETEL);
}
}, 'focus': function (combo, records, eOpts) {
var PORTDISCHARGE = this.formEdit.getForm().findField('PORTDISCHARGE').getValue();
if (PORTDISCHARGE != '') {
var sql = " DISTPORT='" + PORTDISCHARGE + "' ";
this.storeListConsigneeName.load({
params: { start: 0, limit: 5000, sort: '', condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
}
}
}
});
this.storeListConsigneeName.on('beforeload', function (store) {
var PORTDISCHARGE = this.formEdit.getForm().findField('PORTDISCHARGE').getValue();
var sql = " DISTPORT='" + PORTDISCHARGE + "' ";
Ext.apply(store.proxy.extraParams, { condition: sql });
}, this);
this.formHead = Ext.widget('form', {
region: 'north',
frame: true,
trackResetOnLoad: true,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth:80,
msgTarget: 'qtip'
},
items: [{
xtype: 'fieldset',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '业务编号',
name: 'BSNO', hidden: true
}, {
fieldLabel: 'CORPID',
name: 'CORPID', hidden: true
}, {
fieldLabel: 'ORUNITPRICE',
name: 'ORUNITPRICE', hidden: true
}, {
fieldLabel: 'ORFREIGHT',
name: 'ORFREIGHT', hidden: true
}, {
fieldLabel: 'TRANSTYPE',
value:'普运',
name: 'TRANSTYPE', hidden: true
}, {
fieldLabel: '订单编号',
readOnly: false,
name: 'CUSTNO'
}, {
fieldLabel: '订单状态',
readOnly: true,
name: 'TRANSSTATUS',
value: '新建'
}, {
fieldLabel: '业务锁定',
readOnly: true,
// flex: 0.5,
name: 'BSSTATUSREF',
value: '未锁定'
}, {
fieldLabel: '费用锁定',
// flex: 0.5,
readOnly: true,
name: 'FEESTATUSREF',
value: '未锁定'
}, this.comboxContract, this.comboxFeeTemplate
//, this.comboxDDOP
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '会计期间',
xtype: 'monthfield',
editable: false,
name: 'ACCDATE',
value: Ext.util.Format.date(Ext.Date.add(new Date(), Ext.Date.MONTH - 1, 1), "Y-m")
}, {
fieldLabel: '操作员',
readOnly: true,
name: 'OP'
}, {
fieldLabel: '创建日期',
//format: 'Y-m-d',
//xtype: 'datefield',
readOnly: true,
name: 'CREATETIME'
}, {
fieldLabel: '接单日期',
format: 'Y-m-d',
xtype: 'datefield',
allowBlank: false,
name: 'BSDATE'
}, { xtype: 'hiddenfield' }, { xtype: 'hiddenfield' }]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [ {
fieldLabel: '客户订单号',
readOnly: false,
name: 'ORDERNO'
}, this.comboxCustCode, this.comboxInfoClientContact, {
fieldLabel: '联系电话',
readOnly: false,
name: 'CUSTTEL'
}, this.comboxSALE, this.comboxCUSTSERVICE]
}]//end items(fieldset 1)
}]//end root items
}); //end this.formHead
//this.StoreUnitType = Ext.create('Ext.data.Store', {
// fields: ['UnitType']
//});
//this.StoreUnitType.add({ "UnitType": "吨" });
//this.StoreUnitType.add({ "UnitType": "车型" });
//this.StoreUnitType.add({ "UnitType": "公斤" });
//this.StoreUnitType.add({ "UnitType": "立方" });
this.storeEmUnitType = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeEmUnitType.load({ params: { enumTypeId: 50001 } });
this.comboxUnitType = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeEmUnitType,
fieldLabel: '计费单位', //'费用类型',
forceSelection: true,
name: 'UNITTYPE',
// flex: 0.5,
valueField: 'EnumValueName',
displayField: 'EnumValueName',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
this.GetUnitPrice();
}
}
}
});
//this.StoreUnit = Ext.create('Ext.data.Store', {
// fields: ['Unit']
//});
//this.StoreUnit.add({ "Unit": "4.2M" });
//this.StoreUnit.add({ "Unit": "7.2M" });
//this.StoreUnit.add({ "Unit": "9.6M" });
//this.StoreUnit.add({ "Unit": "12.5M" });
//this.StoreUnit.add({ "Unit": "17.5M" });
this.storeEmTruckType = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeEmTruckType.load({ params: { enumTypeId: 50002 } });
this.comboxUnit = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeEmTruckType,
fieldLabel: '车型', //'费用类型',
forceSelection: true,
// labelWidth: 50,
// flex: 0.5,
name: 'UNIT',
valueField: 'EnumValueName',
displayField: 'EnumValueName',
listeners: {
scope: this,
'focus': function (combo, records, eOpts) {
var UNITTYPE = this.formEdit.getForm().findField('UNITTYPE').getValue();
if (UNITTYPE == '车型') {
this.storeEmTruckType.load({ params: { enumTypeId: 50002 } });
} else this.storeEmTruckType.removeAll();
},
blur: function (field, The, eOpts) {
this.GetUnitPriceChange();
}
}
});
this.storeISFEE = Ext.create('Ext.data.Store', {
fields: ['FSTATUS', 'NAME']
});
this.storeISFEE.add({ "FSTATUS": "1", "NAME": "是" });
this.storeISFEE.add({ "FSTATUS": "0", "NAME": "否" });
this.comboxISFEE = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '是否生成费用', //是否开垫付
store: this.storeISFEE,
valueField: 'FSTATUS',
displayField: 'NAME',
forceSelection: true,
name: 'ISFEE',
readOnly: true,
value: '',
enableKeyEvents: true
});
//件数包装
this.storeCodePackage = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CodePackageModel',
proxy: { url: '/CommMng/BasicDataRef/GetCodePackageList' }
});
this.storeCodePackage.load();
this.comboxKINDPKGS = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '计量单位', //'包 装',
// labelWidth: 35,
store: this.storeCodePackage,
name: 'KINDPKGS',
valueField: 'PKGS',
displayField: 'PKGS'
});
//this.storeFeeUnit = Ext.create('Ext.data.Store', {
// fields: ['DC', 'NAME']
//});
//this.storeFeeUnit.add({ "DC": "毛重", "NAME": "毛重" });
//this.storeFeeUnit.add({ "DC": "净重", "NAME": "净重" });
//this.comboxFeeUnit = Ext.create('DsExt.ux.RefTableCombox', {
// fieldLabel: '计费单位', //'费用类型',
// store: this.storeFeeUnit,
// valueField: 'DC',
// labelWidth: 60,
// flex: 0.5,
// displayField: 'NAME',
// forceSelection: true,
// name: 'FEEUNIT',
// listeners: {
// scope: this,
// blur: function (field, The, eOpts) {
// this.GetUnitPriceChange();
// }
// }
//});
//this.storePriceUnit = Ext.create('Ext.data.Store', {
// fields: ['DC', 'NAME']
//});
//this.storePriceUnit.add({ "DC": "毛重", "NAME": "毛重" });
//this.storePriceUnit.add({ "DC": "净重", "NAME": "净重" });
//this.comboxPriceUnit = Ext.create('DsExt.ux.RefTableCombox', {
// fieldLabel: '计费区间单位', //'费用类型',
// store: this.storePriceUnit,
// valueField: 'DC',
// flex: 0.5,
// displayField: 'NAME',
// forceSelection: true,
// name: 'PRICEUNIT'
//});
this.formEdit = Ext.widget('form', {
region: 'north',
frame: true,
// bodyPadding: 5,
trackResetOnLoad: true,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 80,
msgTarget: 'qtip'
},
items: [
//{
//xtype: 'fieldset',
//defaultType: 'textfield',
//layout: 'anchor',
//defaults: {
// anchor: '100%'
//},
//items: [
{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '要求派车日期',
format: 'Y-m-d',
xtype: 'datefield',
// allowBlank: false,
name: 'ETD',
value: this.myDate
}, {
fieldLabel: '要求到货日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'ETA'
}, this.comboxLoadPort, this.comboxDistPort,this.comboxGOODSNAME ]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxConsigneeName, {
fieldLabel: '收货地址',
flex: 2,
name: 'CONSIGNEEADDR'
}, {
fieldLabel: '收货联系人',
name: 'CONSIGNEEATTN'
}, {
fieldLabel: '电话',
name: 'CONSIGNEETEL'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '数量',
name: 'PKGS',
id: 'PKGS',
value: '0',
blankText: '请填写数值!',
allowBlank: false,
regex: /^\d+(\.\d{1,4})?$/,
regexText: '请输入正确的数值类型!'
},this.comboxKINDPKGS , {
fieldLabel: '净重',
name: 'NETWEIGHT',
id: 'NETWEIGHT',
value: '0',
blankText: '请填写数值!',
allowBlank: false,
regex: /^\d+(\.\d{1,6})?$/,
regexText: '请输入正确的数值类型!',
listeners: {
scope: this,
blur: function (field, The, eOpts) {
this.GetUnitPriceChange();
}
}
}, {
fieldLabel: '毛重',
name: 'KGS',
id: 'KGS',
value: '0',
blankText: '请填写数值!',
allowBlank: false,
regex: /^\d+(\.\d{1,6})?$/,
regexText: '请输入正确的数值类型!',
listeners: {
scope: this,
blur: function (field, The, eOpts) {
this.GetUnitPriceChange();
}
}
}, {
fieldLabel: '车数',
name: 'TRUCKNUM',
value: '0',
blankText: '请填写数值!',
allowBlank: false,
regex: /^\d+(\.\d{1,4})?$/,
regexText: '请输入正确的数值类型!',
listeners: {
scope: this,
blur: function (field, The, eOpts) {
this.GetUnitPriceChange();
}
}
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [ {
fieldLabel: '已分拨数量',
readOnly: true,
name: 'PCPKGS'
}, {
fieldLabel: '已分拨净重',
readOnly: true,
name: 'PCNETWEIGHT'
}, {
fieldLabel: '已分拨毛重',
readOnly: true,
name: 'PCKGS'
}, this.comboxUnitType, this.comboxUnit]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
//this.comboxFeeUnit, this.comboxPriceUnit,
{
fieldLabel: '单价',
name: 'UNITPRICE',
value: '0',
blankText: '请填写数值!',
allowBlank: false,
regex: /^\d+(\.\d{1,4})?$/,
regexText: '请输入正确的数值类型!',
listeners: {
scope: this,
blur: function (field, The, eOpts) {
this.GetPriceChange();
}
}
}, {
fieldLabel: '应收运费',
name: 'FREIGHT',
value: '0',
blankText: '请填写数值!',
allowBlank: false,
regex: /^\d+(\.\d{1,4})?$/,
regexText: '请输入正确的数值类型!'
}, {
fieldLabel: '应收杂费',
readOnly: true,
name: 'TTLOTDR'
}, {
fieldLabel: '应收合计',
readOnly: true,
name: 'TTLDR'
}, {
fieldLabel: '尺码',
name: 'CBM',
value: '0',
blankText: '请填写数值!',
allowBlank: false,
regex: /^\d+(\.\d{1,6})?$/,
regexText: '请输入正确的数值类型!',
listeners: {
scope: this,
blur: function (field, The, eOpts) {
this.GetUnitPriceChange();
}
}
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: 'FEEUNIT',
name: 'FEEUNIT', hidden: true
}, {
fieldLabel: 'PRICEUNIT',
name: 'PRICEUNIT', hidden: true
}, {
fieldLabel: 'NOPCPKGS',
name: 'NOPCPKGS', hidden: true
}, {
fieldLabel: 'PCCBM',
name: 'PCCBM', hidden: true
}, {
fieldLabel: 'NOPCCBM',
name: 'NOPCCBM', hidden: true
}, {
fieldLabel: '未分拨重量',
readOnly: true,
hidden: true,
name: 'NOPCKGS'
}, {
fieldLabel: '应收运费',
hidden: true,
readOnly: true,
name: 'TTLYFDR'
}, {
fieldLabel: 'ISFEE',
hidden: true,
readOnly: true,
name: 'ISFEE'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '最后一次更改人',
name: 'MODIFIEDUSER',
hidden: true
}, {
fieldLabel: '备注',
name: 'REMARK',
height:30,
xtype: "textarea"
}]
}]//end items(fieldset 1)
//}]//end root items
}); //end this.formHead
//明细表表格相关
//明细表-数据集
this.storeBodyList = Ext.create('Ext.data.Store', {
model: 'MsOpTruckBulkDetail',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/TruckMng/MsOpTruckBulk/GetBodyList',
reader: {
root: 'data',
totalProperty: 'totalCount'
}
}
});
//明细表表格
this.gridListCellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});
this.GridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
this.gridList = new Ext.grid.GridPanel({
store: this.storeBodyList,
enableHdMenu: false,
region: 'center',
loadMask: { msg:'数据加载中...'},
trackMouseOver: true,
disableSelection: false,
selModel: this.GridCheckBoxModel,
plugins: [this.gridListCellEditing],
selType: 'cellmodel',
tbar: [{
text: '增加明细', //'增加费用明细',
tooltip: '增加明细', //'增加费用明细',
id: 'btnadddetail',
iconCls: "btnadddetail",
handler: function (button, event) {
this.onAddDetailClick(button, event, 1);
},
scope: this
}, '-', {
text: '删除明细', //'删除费用明细',
id: 'btndeletedetail',
tooltip:'删除明细', //'删除费用明细',
iconCls: "btndeletedetail",
handler: function (button, event) {
this.onDelDetailClick(button, event, 1);
},
scope: this
}],
columns: [{
sortable: true,
dataIndex: 'GID',
header: 'GID', //'GID',
hidden: true,
width: 100
}, {
sortable: true,
dataIndex: 'BSNO',
header: 'BSNO', //'TEMPLATEID',
hidden: true,
width: 100
}, {
sortable: true,
dataIndex: 'GOODSNAME',
header: '商品名称', //'费用名称',
editor: this.comboxGOODSNAME2,
width: 140
},{
sortable: true,
dataIndex: 'PKGS',
header: '数量', //'汇率',
editor: {
xtype: 'numberfield',
keyNavEnabled: false,
selectOnFocus: true,
hideTrigger: true,
mouseWheelEnabled: false,
enableKeyEvents: true
},
align: 'right',
width: 80
}
//, {
// sortable: true,
// dataIndex: 'UNITKGS',
// header: '单位重量', //'单价',
// editor: {
// xtype: 'numberfield',
// keyNavEnabled: false,
// selectOnFocus: true,
// hideTrigger: true,
// mouseWheelEnabled: false,
// enableKeyEvents: true
// },
// align: 'right',
// width: 120
//}
, {
sortable: true,
dataIndex: 'KGS',
header: '毛重', //'单价',
editor: {
xtype: 'numberfield',
keyNavEnabled: false,
selectOnFocus: true,
hideTrigger: true,
decimalPrecision: 6,
mouseWheelEnabled: false,
enableKeyEvents: true
},
align: 'right',
width: 120
}, {
sortable: true,
dataIndex: 'NETWEIGHT',
header: '净重', //'单价',
editor: {
xtype: 'numberfield',
keyNavEnabled: false,
selectOnFocus: true,
decimalPrecision: 6,
hideTrigger: true,
mouseWheelEnabled: false,
enableKeyEvents: true
},
align: 'right',
width: 120
}
, {
sortable: true,
dataIndex: 'TRUCKNUM',
header: '车数', //'单价',
editor: {
xtype: 'numberfield',
keyNavEnabled: false,
selectOnFocus: true,
hideTrigger: true,
mouseWheelEnabled: false,
enableKeyEvents: true
},
align: 'right',
width: 80
}
, {
sortable: true,
dataIndex: 'CBM',
header: '尺码', //'单价',
editor: {
xtype: 'numberfield',
keyNavEnabled: false,
selectOnFocus: true,
decimalPrecision: 6,
hideTrigger: true,
mouseWheelEnabled: false,
enableKeyEvents: true
},
align: 'right',
width: 80
}
, {
sortable: true,
dataIndex: 'REMARK',
header: '备注', //'备注',
editor: {
xtype: 'textfield',
selectOnFocus: true,
enableKeyEvents: true
},
width: 150
}
]
});
//绑定事件
this.gridList.on('edit', function (editor, e, eOpts) {
this.gridAfterEdit(editor, e, eOpts);
}, this);
this.gridListCellEditing.on('beforeedit', function (editor, e) {
return this.cellEditingBeforeEdit(editor, e);
}, this);
this.storeBodyList.on('beforeload', function (store) {
var cargoid = 0;
if (this.opStatus == 'edit') {
cargoid = this.editRecord.get('BSNO');
}
var sql = " BSNO='" + cargoid + "'";
Ext.apply(store.proxy.extraParams, { condition: sql });
}, this);
//按钮Toolbar
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [{
id: 'btnESave',
text: "保存",
iconCls: "btnsave",
handler: function (button, event) {
this.Save('0');
},
scope: this
}
//, {
// id: 'btnESaveAndClose',
// text: "保存并关闭",
// handler: function (button, event) {
// this.Save('1');
// },
// scope: this
//}, {
// id: 'btnESaveAndNew',
// text: "保存并新建",
// handler: function (button, event) {
// this.Save('2');
// },
// scope: this
//}
, {
id: 'btnECopyNew',
text: "再来一单",
handler: function (button, event) {
//var basicForm = this.formHead.getForm();
//this.opStatus = 'add';
//basicForm.findField('BSNO').setDisabled(false);
//var field = basicForm.findField('BSNO');
//var BSNO = NewGuid();
//field.setValue(BSNO);
//basicForm.findField('BSNO').setDisabled(true);
//field = basicForm.findField('CUSTNO');
//field.setValue('');
//field = basicForm.findField('OP');
//field.setValue(SHOWNAME);
//field = basicForm.findField('TRANSSTATUS');
//field.setValue('新建');
//var field = basicForm.findField('BSSTATUSREF');
//field.setValue('未锁定');
//var field = basicForm.findField('FEESTATUSREF');
//field.setValue('未锁定');
//this.formEdit.getForm().findField('ISFEE').setValue('0');
//this.formEdit.getForm().findField('PCKGS').setValue('0');
//var myDate = new Date();
//var mydatestr = Ext.util.Format.date(myDate, 'Y-m-d');
//field = basicForm.findField('BSDATE');
//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);
//this.editRecord.set('BSNO', BSNO);
this.LoadData('copy', '');
var children = this.tabOtherPanel.items;
if (children) {
for (var i = children.length - 1, len = 0; i >= len; i--) {
if (children.items[i].id) {
if (children.items[i].id == 'pnlmodOpTruckBulkInfo') {
// this.tabSeaepanel.setActiveTab(i);
} else {
children.items[i].close();
}
}
}
}
this.tabOtherPanel.doLayout();
},
scope: this
}, '-', {
text: "新建",
handler: function (button, event) {
this.LoadData('add', '');
},
scope: this
},
//'-', {
// id: 'btnCreateFee',
// text: '生成费用',
// tooltip: '生成费用',
// handler: function (button, event) {
// this.onCreateFeeClick();
// },
// scope: this
//},
'-', {
id: 'btnSubmitAudit',
text: '提交审核',
tooltip: '提交审核',
handler: function (button, event) {
this.onSubmitAuditClick();
},
scope: this
}, {
id: 'btnSubmitAuditBack',
text: '撤销提交',
tooltip: '撤销提交',
handler: function (button, event) {
this.onSubmitAuditBackClick();
},
scope: this
}, '-', {
id: 'btnAudit',
text: '审核通过',
tooltip: '审核通过',
handler: function (button, event) {
this.onAudit();
},
scope: this
},
{
text: "驳回提交",
id: 'btnAuditBack',
iconCls: "btndelete",
handler: function (button, event) {
var billstatus = this.formHead.getForm().findField('TRANSSTATUS').getValue();
if ((billstatus != "提交审核") && (billstatus != "审核通过")) {
Ext.Msg.show({ title: '提示', msg: '当前状态无法驳回!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
this.winAuditBackShow.show();
},
scope: this
},'-',{
text: "打印",
iconCls: "btnprint",
handler: function (button, event) {
this.Print();
},
scope: this
}, '-', {
text: "关闭",
handler: function (button, event) {
window.close();
},
scope: this
}]
}); //end 按钮Toolbar
this.treestore = new Ext.data.TreeStore({
model: 'DsShipping.ux.ModuleModel',
nodeParam: 'PARENTID',
proxy: {
type: 'ajax',
url: '/MvcShipping/MsBaseInfo/GetModuTreeRefList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
},
autoLoad: true,
root: {
name: '根节点',
expanded: true,
//id: '5E301DAB-1DC4-4635-85FC-711F3FD94D39'
id: '817A9BFF-6E33-4B86-A37F-65DF5F39720B'
}
});
this.tabtree = new Ext.tree.Panel({
region: 'west',
title: '陆运普货订单',
split: true,
width: 180,
collapsible: true,
margins: '0 0 0 0',
store: this.treestore,
rootVisible: false,
hideHeaders: true,
animate: false,
lines: false,
columns: [{
xtype: 'treecolumn',
text: '模块名称',
width: 178,
dataIndex: 'DESCRIPTION'
}],
listeners: {
scope: this,
'itemclick': function (_this, record, item, index, e, eOpts) {
if (record.data.MODULEURL == '@') {
this.tabOtherPanel.setActiveTab(0);
} else if (record.data.MODULEURL != '#') {
if (Ext.getCmp('pnl' + record.data.NAME)) {
var children = this.tabOtherPanel.items;
if (children) {
for (var i = 0, len = children.length; i < len; i++) {
if (children.items[i].id) {
if (children.items[i].id == 'pnl' + record.data.NAME) {
this.tabOtherPanel.setActiveTab(i);
}
}
}
}
} else {
if (this.formHead.getForm().findField('BSNO').getValue() == "") {
Ext.Msg.show({ title: '注意', msg: '请先保存业务信息后再打开其他模块!', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
} else {
if (record.data.NAME == 'modOpTruckBulkAllFee') {
var paneltabitems = new Shipping.TruckBulkFee({
id: 'pnl' + record.data.NAME,
layout: "border",
region: "center",
autoScroll: true,
frame: false,
closable: true,
title: record.data.DESCRIPTION
});
} else if (record.data.NAME == 'modOpTruckBulkAmendFee') {
var paneltabitems = new Shipping.TruckBulkAmendFee({
id: 'pnl' + record.data.NAME,
layout: "border",
region: "center",
autoScroll: true,
frame: false,
closable: true,
title: record.data.DESCRIPTION
});
} else {
var paneltabitems = new Ext.Panel({
id: 'pnl' + record.data.NAME,
layout: "fit",
region: "center",
autoScroll: true,
frame: false,
closable: true,
title: record.data.DESCRIPTION,
html: ' <iframe scrolling="auto" frameborder="0" width="100%" height="100%" src="' + record.data.MODULEURL + '"> </iframe>'
});
}
this.tabOtherPanel.add(paneltabitems);
this.tabOtherPanel.setActiveTab(paneltabitems);
this.tabOtherPanel.doLayout();
}
}
}
}
}
});
this.panelOther = new Ext.Panel({
title: '订单信息',
id: 'pnlmodOpTruckBulkInfo', //pnlmodOpOtherOpwt
layout: "border",
region: 'center',
animate: true,
autoScroll: true,
frame: false,
items: [this.panelBtn, this.formHead, this.formEdit, this.gridList]
});
this.tabOtherPanel = new Ext.TabPanel({
activeTab: 0,
autoWidth: true,
border: true,
frame: false,
region: 'center',
id: "tabTruckBulkPcPanel",
enableTabScroll: true,
items:
[
this.panelOther
],
listeners: {
scope: this,
'beforetabchange': function (tabPanel, newCard, oldCard, eOpts) {
if (oldCard != null && oldCard.id == "modOpTruckBulkAllFee") {
var feemodify = oldCard.panelFee.getModifyStatus();
if (feemodify) {
Ext.Msg.show({ title: '警告', msg: '费用未保存,请先保存费用!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
return false;
}
}
if (oldCard != null && oldCard.id == "modOpTruckBulkAmendFee") {
var feemodify = oldCard.panelFee.getModifyStatus();
if (feemodify) {
Ext.Msg.show({ title: '警告', msg: '更改单未保存,请先保存更改单!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
return false;
}
}
}
}
});
Ext.apply(this, {
items: [this.tabtree, this.tabOtherPanel]
});
parentWin = window.parent.opener;
this.InitData();
this.LoadMustBe();
Ext.Ajax.request({
waitMsg: '',
url: '/MvcShipping/MsSysParamSet/GetData',
params: {
condition: "PARAMNAME='ACCDATESAMEETD'"
},
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.accdatesameetd = 1;
} else {
}
}
} else {
}
},
scope: this
});
this.formAuditBack = Ext.widget('form', {
frame: true,
region: 'center',
title: "<a href='#'><font color='#FF0000'>驳回原因</font></a>",
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 90,
msgTarget: 'qtip'
},
items: [{
xtype: 'textareafield',
grow: true,
fieldLabel: '',
labelSeparator: '',
labelWidth: 0,
height: 100,
name: 'ORREASON',
anchor: '100%'
}
]//end root items
});
me = this;
this.winAuditBackShow = Ext.create('Ext.window.Window', {
title: "驳回派车申请",
width: 450,
//height : 120,
//plain : true,
iconCls: "addicon",
resizable: false,
// 是否可以拖动
// draggable:false,
collapsible: true, // 允许缩放条
closeAction: 'close',
closable: true,
modal: 'true',
buttonAlign: "center",
bodyStyle: "padding:0 0 0 0",
items: [this.formAuditBack],
buttons: [{
text: "确认驳回",
minWidth: 70,
handler: function () {
var form = me.formAuditBack.getForm();
var ORREASON = form.findField('ORREASON').getRawValue();
if (ORREASON == '' || ORREASON == null || ORREASON == undefined) {
Ext.Msg.show({ title: '提示', msg: '驳回原因为必填!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
me.onAuditBack(ORREASON);
}
}, {
text: "关闭",
minWidth: 70,
handler: function () {
me.winAuditBackShow.close();
}
}]
});
}, //end initUIComponents
InitData: function () {
this.opStatus = 'add';
var condition = '';
_this = this;
if (parentWin) {
var ret = parentWin.OprationSwap();
this.opStatus = ret[0];
this.StoreList = ret[1];
this.editRecord = ret[2];
this.Audit = ret[6];
}
//
if (this.opStatus == 'edit') {
//
condition = " op_truck_bulk.BSNO='" + this.editRecord.get('BSNO') + "'";
} else if (this.opStatus == 'add') {
this.LoadDefValue();
}
//if (this.opStatus == 'edit')
this.LoadData(this.opStatus, condition);
if (this.opStatus == 'add') {
this.LoadPeriod('add');
}
}, //end InitData
LoadData: function (opstatus, condition) {
this.bodyDel = [];
if (opstatus=='copy')
this.opStatus ='add';
else
this.opStatus = opstatus;
Ext.Ajax.request({
waitMsg: '正在查询主表数据...',
url: '/TruckMng/MsOpTruckBulk/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;
var CUSTOMERNAME = data.CUSTOMERNAME;
if (CUSTOMERNAME != '') {
var s = " LINKID in (select gid from [info_client] where SHORTNAME='" + CUSTOMERNAME + "')";
this.storeInfoClientContact.load({ params: { condition: s } });
}
if (data.PORTLOAD != '' && data.PORTDISCHARGE != '' && data.CONTRACTNO != '' && data.TEMPLATENAME != '') {
var s = " LOADPORT='" + data.PORTLOAD + "' and DISTPORT='" + data.PORTDISCHARGE + "' and TEMPLATEID in (select gid from [Cust_Truck_feetemplate] where TEMPLATENAME='" + data.TEMPLATENAME + "' and CONTRACTNO='" + data.CONTRACTNO + "')";
this.storeFeeTemplateDetail.load({
params: { condition: s },
scope: this
});
}
this.formHead.getForm().reset();
this.formHead.getForm().setValues(data);
this.formEdit.getForm().reset();
this.formEdit.getForm().setValues(data);
if (this.opStatus == 'add') {
var basicForm = this.formHead.getForm();
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('OP');
field.setValue(SHOWNAME);
field = basicForm.findField('TRANSTYPE');
field.setValue('普运');
//field = basicForm.findField('CUSTSERVICE');
//field.setValue(SHOWNAME);
field = basicForm.findField('SALE');
field.setValue(SHOWNAME);
var field = basicForm.findField('BSSTATUSREF');
field.setValue('未锁定');
var field = basicForm.findField('FEESTATUSREF');
field.setValue('未锁定');
var myDate = new Date();
var mydatestr = Ext.util.Format.date(myDate, 'Y-m-d');
field = basicForm.findField('BSDATE');
field.setValue(mydatestr);
var mydatestr = Ext.util.Format.date(myDate, 'Y-m');
field = basicForm.findField('ACCDATE');
field.setValue(mydatestr);
if (opstatus=='copy') this.LoadMustBeCopy();
}
this.GetEditStatus();
this.LoadPeriod(this.opStatus);
} 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: { condition: " BSNO='" + billno + "'" } });
} else {
this.storeBodyList.removeAll();
}
},
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('ETD').getRawValue();
var ACCDATE = this.formHead.getForm().findField('ACCDATE').getValue();
if (ETD == '') {
this.formEdit.getForm().findField('ETD').setMinValue(this.MsPeriod.FDAY);
this.formEdit.getForm().findField('ETD').setReadOnly(false);
} else {
var oDate1 = new Date(ETD);
var oDate2 = new Date(this.MsPeriod.FDAY);
if (oDate1.getTime() >= oDate2.getTime()) {
this.formEdit.getForm().findField('ETD').setMinValue(this.MsPeriod.FDAY);
this.formEdit.getForm().findField('ETD').setReadOnly(false);
} else {
if (opstatus == 'add' || opstatus == 'copyadd') {
this.formEdit.getForm().findField('ETD').setValue(this.MsPeriod.FDAY);
this.formEdit.getForm().findField('ETD').setMinValue(this.MsPeriod.FDAY);
this.formEdit.getForm().findField('ETD').setReadOnly(false);
}
else {
this.formEdit.getForm().findField('ETD').setMinValue('');
this.formEdit.getForm().findField('ETD').setReadOnly(true);
}
}
}
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').setValue(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 basicForm2 = this.formHead.getForm();
if (!basicForm2.isValid()) {
return;
}
var basicForm = this.formEdit.getForm();
if (!basicForm.isValid()) {
return;
}
if (this.storeBodyList.getCount() == 0) {
Ext.Msg.show({ title: '提示', msg: '没有商品明细,不允许保存!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
if (this.accdatesameetd == 1) {
var ETD = this.formEdit.getForm().findField('ETD').getRawValue();
if (ETD == '') {
} else {
var oDate1 = new Date(ETD);
var oDate2 = new Date(this.MsPeriod.FDAY);
if (oDate1.getTime() >= oDate2.getTime()) {
var mydatestr = Ext.util.Format.date(ETD, 'Y-m');
if (this.MsPeriod.CLOSEDAY != 0) {
var myday = Ext.util.Format.date(ETD, 'd');
if (myday > this.MsPeriod.CLOSEDAY) {
var mymonth = Ext.util.Format.date(ETD, 'm');
var myyear = Ext.util.Format.date(ETD, 'Y');
mymonth = parseInt(mymonth) + 1;
var mymonthstr = mymonth.toString();
if (mymonthstr.length == 1) mymonthstr = '0' + mymonthstr;
mydatestr = myyear.toString() + '-' + mymonthstr;
}
} else {
}
var field = this.formHead.getForm().findField('ACCDATE');
field.setValue(mydatestr);
}
}
}
var bodydatas = [];
for (var i = 0; i < this.storeBodyList.getCount() ; i += 1) {
var member = this.storeBodyList.getAt(i);
bodydatas.push(member);
}
var jsonBody = ConvertRecordsToJsonAll(bodydatas);
this.formHead.getForm().findField('BSNO').setDisabled(false);
var data = this.formHead.getForm().getValues(false, false, false);
this.formHead.getForm().findField('BSNO').setDisabled(true);
var data2 = this.formEdit.getForm().getValues(false, false, false);
data2.PCKGS = "0";
data2.NOPCKGS = "0";
data2.PCPKGS = "0";
data2.NOPCPKGS = "0";
data2.PCCBM = "0";
data2.NOPCCBM = "0";
data.TRANSTYPE = '普运';
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/TruckMng/MsOpTruckBulk/Save',
scope: this,
params: {
opstatus: this.opStatus,
data: Ext.JSON.encode(data),
data2: Ext.JSON.encode(data2),
body: jsonBody
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
var returnData = jsonresult.Data;
this.formHead.getForm().reset();
this.formHead.getForm().setValues(returnData);
this.formEdit.getForm().reset();
this.formEdit.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('MsOpTruckBulk', 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);
this.storeBodyList.load({ params: { condition: " BSNO='" + returnData.BSNO + "'" } });
// this.storeBodyList.reload();
//for (var j = 0; j < this.storeBodyList.getCount() ; j += 1) {
// var memberbody = this.storeBodyList.getAt(j);
// memberbody.set("BSNO", returnData.BSNO);
// memberbody.commit();
//};
this.LoadPeriodStatus(this.opStatus);
} else if (type == '1') {
this.opStatus = 'edit';
window.close();
} else if (type == '2') {
this.LoadData('add', '');
var children = this.tabOtherPanel.items;
if (children) {
for (var i = children.length - 1, len = 0; i >= len; i--) {
if (children.items[i].id) {
if (children.items[i].id == 'pnlmodOpTruckBulkInfo') {
// this.tabSeaepanel.setActiveTab(i);
} else {
children.items[i].close();
}
}
}
}
this.tabOtherPanel.doLayout();
}
} 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,type) {
var newSerialno = 0;
var goodsname = this.formEdit.getForm().findField('GOODSNAME').getValue();
store = this.storeBodyList;
var record = Ext.create('MsOpTruckBulkDetail', {
GID: '',
BSNO: '*',
GOODSNAME: goodsname,
UNITKGS: 0,
KGS: 0,
NETWEIGHT: 0,
PKGS: 0,
CBM: 0,
TRUCKNUM: 0,
CTNNUM: 0,
FREIGHT: 0,
REMARK: ""
});
var z=store.add(record);
var feeid = z[0].internalId;
var rown = store.data.keys.indexOf(feeid);
this.gridListCellEditing.startEditByPosition({ row: rown, column: 2 });
},
onDelDetailClick: function (button, event, type) {
var BSSTATUSREF = this.formHead.getForm().findField('TRANSSTATUS').getValue();
if (BSSTATUSREF != '新建' && BSSTATUSREF != '' && BSSTATUSREF != '驳回提交') {
Ext.Msg.show({ title: '提示', msg: '当前状态无法提交!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var selectedRecords = this.gridList.selModel.getSelection();
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (rec.data.BSNO == "" || rec.data.BSNO == "*")//如果是新增但没有保存的数据,没有必要提交到后台
{
this.storeBodyList.remove(selectedRecords[i]);
_this.setAllTotal();
}
else {
if (rec.data.ISFEE == '1') {
Ext.Msg.show({ title: '警告', msg: '已生成费用,不允许删除!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
return;
} else {
Ext.MessageBox.confirm('提示', '确定要删除计费明细吗?', function (btn) {
if (btn == 'yes') {
Ext.Msg.wait('正在删除数据...');
Ext.Ajax.request({
waitMsg: '正在删除数据...', //'正在删除数据...',
url: '/TruckMng/MsOpTruckBulk/DeletetruckBulkDetail',
params: {
data: Ext.JSON.encode(rec.data)
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
this.storeBodyList.remove(rec);
_this.setAllTotal();
Ext.Msg.show({ title: '提示', msg: jsonresult.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
else {
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
}
},
failure: function (response, options) {
Ext.Msg.show({ title: '警告', msg: '服务器响应出错', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
},
scope: this
}); //end Ext.Ajax.request
}
}, this);
}
}
//this.storeBodyList.remove(selectedRecords[i]);
}
},
cellEditingBeforeEdit: function (editor, e) {
var ISFEE = e.record.get('ISFEE');
if (ISFEE == '1') {
Ext.Msg.show({ title:'提示', msg: '已生成费用不能修改!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });//当前费用已対帐无法修改!
return false;
}
},
getContractNo: function () {
var CUSTOMERNAME = this.formHead.getForm().findField('CUSTOMERNAME').getValue();
var GOODSNAME = this.formEdit.getForm().findField('GOODSNAME').getValue();
var PORTLOAD = this.formEdit.getForm().findField('PORTLOAD').getValue();
var PORTDISCHARGE = this.formEdit.getForm().findField('PORTDISCHARGE').getValue();
this.formHead.getForm().findField('CONTRACTNO').setValue('');
this.formHead.getForm().findField('TEMPLATENAME').setValue('');
if (CUSTOMERNAME != '' && GOODSNAME != '' && PORTLOAD != '' && PORTDISCHARGE != '') {
var myDate = new Date();
var mydatestr = Ext.util.Format.date(myDate, 'Y-m-d');
var sql = " CUSTOMERNAME='" + CUSTOMERNAME + "' and GOODNAME='" + GOODSNAME + "' and TRANTYPE='普货' and BSSTATUS='审核通过' and GID IN (SELECT TEMPLATEID FROM Cust_Truck_feetemplatedetail WHERE LOADPORT='"
+ PORTLOAD + "' and DISTPORT='" + PORTDISCHARGE + "') and CONTRACTNO not in (select CONTRACTNO from info_client_contract where CANCELDATE<'" + mydatestr + "')";
this.storeListFeeTemplate.load({
params: { start: 0, limit: 5000, sort: '', condition: sql },
callback: function (r, options, success) {
if (success) {
if (this.storeListFeeTemplate.getCount() > 0) {
var member = this.storeListFeeTemplate.getAt(0);
this.formHead.getForm().findField('CONTRACTNO').setValue(member.data.CONTRACTNO);
this.formHead.getForm().findField('TEMPLATENAME').setValue(member.data.TEMPLATENAME);
this.formEdit.getForm().findField('FEEUNIT').setValue(member.data.FEEUNIT);
this.formEdit.getForm().findField('PRICEUNIT').setValue(member.data.PRICEUNIT);
if (member.data.CONTRACTNO != '' && member.data.TEMPLATENAME != '') {
var s = " LOADPORT='"+ PORTLOAD + "' and DISTPORT='" + PORTDISCHARGE + "' and TEMPLATEID in (select gid from [Cust_Truck_feetemplate] where TEMPLATENAME='" + member.data.TEMPLATENAME + "' and CONTRACTNO='" + member.data.CONTRACTNO + "')";
this.storeFeeTemplateDetail.load({
params: { condition: s },
callback: function (r, options, success) {
if (success) {
if (this.storeFeeTemplateDetail.getCount() > 0) {
var member = this.storeFeeTemplateDetail.getAt(0);
this.formEdit.getForm().findField('UNITTYPE').setValue(member.data.UNITTYPE);
// this.formEdit.getForm().findField('UNIT').setReadOnly(true);
this.formEdit.getForm().findField('UNITTYPE').setReadOnly(true);
// this.formEdit.getForm().findField('UNITPRICE').setReadOnly(true);
this.formEdit.getForm().findField('FEEUNIT').setReadOnly(true);
this.formEdit.getForm().findField('PRICEUNIT').setReadOnly(true);
this.GetUnitPrice();
} else {
this.formEdit.getForm().findField('UNITTYPE').setValue('');
this.formEdit.getForm().findField('UNITPRICE').setValue(0);
this.formEdit.getForm().findField('FREIGHT').setValue(0);
}
}
},
scope: this
});
}
if (CUSTOMERNAME!=''&&member.data.CONTRACTNO != '') {
//var sql = "LINKID in (select GID FROM INFO_CLIENT WHERE SHORTNAME='" + CUSTOMERNAME + "')";
//this.storeListGetContract.load({
// params: { start: 0, limit: 5000, sort: '', condition: sql },
// callback: function (r, options, success) {
// if (success) {
// if (this.storeListGetContract.getCount() > 0) {
// for (var j = 0; j < this.storeListGetContract.getCount() ; j += 1) {
// var membercontract = this.storeListGetContract.getAt(j);
// if (member.data.CONTRACTNO==membercontract.data.CONTRACTNO)
// this.formHead.getForm().findField('SALE').setValue(membercontract.data.CHIEF);
// }
// }
// }
// },
// waitMsg: "正在查询数据...",
// scope: this
//});
}
} else {
this.formEdit.getForm().findField('UNITTYPE').setValue('');
this.formEdit.getForm().findField('UNITPRICE').setValue(0);
this.formEdit.getForm().findField('FREIGHT').setValue(0);
}
}
},
waitMsg: "正在查询数据...",
scope: this
});
}
},
gridAfterEdit: function (editor, e, eOpts) {
if (e.value == e.originalValue) return;
//需要自己实现里面的事件
if (e.field == 'PKGS' || e.field == 'UNITKGS') {
var PKGS = e.record.data['PKGS'];
var UNITKGS = e.record.data['UNITKGS'];
var UNITTYPE = e.record.data['UNITTYPE'];
var UNIT = e.record.data['UNIT'];
var KGS = 0;
if (PKGS != 0 && PKGS != '') {
KGS = Mul(PKGS, UNITKGS);
e.record.set('KGS', KGS);
}
var CBM= e.record.data['CBM'];
//var unitprice = this.GetUnitPrice(KGS, CBM, UNITTYPE, UNIT);
//var freight = 0;
//var unitpkgs = 0;
//if (unitprice != 0) {
// if (UNITTYPE == '车型') {
// unitpkgs = 1;
// } else if (UNITTYPE == "吨" || UNIT == "公斤") {
// unitpkgs = KGS;
// } else if (UNITTYPE == "立方") {
// unitpkgs = CBM;
// }
// freight = Mul(unitprice, unitpkgs);
//} else freight = 0;
//e.record.set('UNITPRICE', unitprice);
//e.record.set('FREIGHT', freight);
_this.setAllTotal();
} else if (e.field == 'CBM' || e.field == 'KGS' || e.field == 'TRUCKNUM' || e.field == 'NETWEIGHT' || e.field == 'UNITTYPE') {
var PKGS = e.record.data['PKGS'];
var UNITKGS = e.record.data['UNITKGS'];
var UNITTYPE = e.record.data['UNITTYPE'];
var UNIT = e.record.data['UNIT'];
var KGS = e.record.data['KGS'];
var CBM = e.record.data['CBM'];
//var unitprice = this.GetUnitPrice(KGS, CBM, UNITTYPE, UNIT);
//var freight = 0;
//var unitpkgs = 0;
//if (unitprice != 0) {
// if (UNITTYPE == '车型') {
// unitpkgs = 1;
// } else if (UNITTYPE == "吨" || UNIT == "公斤") {
// unitpkgs = KGS;
// } else if (UNITTYPE == "立方") {
// unitpkgs = CBM;
// }
// freight = Mul(unitprice, unitpkgs);
//} else freight = 0;
//e.record.set('UNITPRICE', unitprice);
//e.record.set('FREIGHT', freight);
_this.setAllTotal();
} else if (e.field == 'UNITPRICE') {
var PKGS = e.record.data['PKGS'];
var UNITKGS = e.record.data['UNITKGS'];
var UNITTYPE = e.record.data['UNITTYPE'];
var UNIT = e.record.data['UNIT'];
var KGS = e.record.data['KGS'];
var CBM = e.record.data['CBM'];
//var unitprice = e.record.data['UNITPRICE'];
//var freight = 0;
//var unitpkgs = 0;
//if (unitprice != 0) {
// if (UNITTYPE == '车型') {
// unitpkgs = 1;
// } else if (UNITTYPE == "吨" || UNIT == "公斤") {
// unitpkgs = KGS;
// } else if (UNITTYPE == "立方") {
// unitpkgs = CBM;
// }
// freight = Mul(unitprice, unitpkgs);
//} else freight = 0;
//e.record.set('UNITPRICE', unitprice);
//e.record.set('FREIGHT', freight);
}
},
GetUnitPrice: function () {
if (this.storeFeeTemplateDetail.getCount() == 0) return 0;
var KGS = this.formEdit.getForm().findField('KGS').getValue();
var CBM = this.formEdit.getForm().findField('CBM').getValue();
var UNITTYPE = this.formEdit.getForm().findField('UNITTYPE').getValue();
var UNIT = this.formEdit.getForm().findField('UNIT').getValue();
var NETWEIGHT = this.formEdit.getForm().findField('NETWEIGHT').getValue();
var FEEUNIT = this.formEdit.getForm().findField('FEEUNIT').getValue();
var PRICEUNIT = this.formEdit.getForm().findField('PRICEUNIT').getValue();
var TRUCKNUM = this.formEdit.getForm().findField('TRUCKNUM').getValue();
var FEEKGS = 0;
var PRICEKGS = 0;
if (FEEUNIT == '净重') FEEKGS = NETWEIGHT; else FEEKGS = KGS;
if (PRICEUNIT == '净重') PRICEKGS = NETWEIGHT; else PRICEKGS = KGS;
this.formEdit.getForm().findField('UNITPRICE').setValue(0);
this.formEdit.getForm().findField('FREIGHT').setValue(0);
this.formHead.getForm().findField('ORUNITPRICE').setValue(0);
this.formHead.getForm().findField('ORFREIGHT').setValue(0);
if (UNITTYPE == "") return 0;
if ((UNITTYPE == "车型" && UNIT == "") && (TRUCKNUM == 0 || TRUCKNUM == "")) return 0;
if ((UNITTYPE == "吨" || UNIT == "公斤") && (KGS == 0 || KGS == "")) return 0;
if ((UNITTYPE == "净重") && (NETWEIGHT == 0 || NETWEIGHT == "")) return 0;
if ((UNITTYPE == "立方") && (CBM == 0 || CBM == "")) return 0;
if (UNITTYPE == "车型") {
for (var j = 0; j < this.storeFeeTemplateDetail.getCount() ; j += 1) {
var memberbody = this.storeFeeTemplateDetail.getAt(j);
if (memberbody.data.UNIT == UNIT) {
// return memberbody.data.UNITPRICE;
var freight = Mul(memberbody.data.UNITPRICE, TRUCKNUM);
this.formEdit.getForm().findField('UNITPRICE').setValue(memberbody.data.UNITPRICE);
this.formEdit.getForm().findField('FREIGHT').setValue(freight);
this.formHead.getForm().findField('ORUNITPRICE').setValue(memberbody.data.UNITPRICE);
this.formHead.getForm().findField('ORFREIGHT').setValue(freight);
}
};
}
if (UNITTYPE == "吨" || UNIT == "公斤") {
for (var j = 0; j < this.storeFeeTemplateDetail.getCount() ; j += 1) {
var memberbody = this.storeFeeTemplateDetail.getAt(j);
if (PRICEKGS >= memberbody.data.STARTWEIGHT && PRICEKGS < memberbody.data.ENDWEIGHT) {
this.formEdit.getForm().findField('UNITPRICE').setValue(memberbody.data.UNITPRICE);
var freight = Mul(memberbody.data.UNITPRICE, FEEKGS)
this.formEdit.getForm().findField('FREIGHT').setValue(freight)
this.formHead.getForm().findField('ORUNITPRICE').setValue(memberbody.data.UNITPRICE);
this.formHead.getForm().findField('ORFREIGHT').setValue(freight)
}
};
}
//if (UNITTYPE == "净重") {
// for (var j = 0; j < this.storeFeeTemplateDetail.getCount() ; j += 1) {
// var memberbody = this.storeFeeTemplateDetail.getAt(j);
// if (KGS >= memberbody.data.STARTWEIGHT && NETWEIGHT <= memberbody.data.ENDWEIGHT) {
// this.formEdit.getForm().findField('UNITPRICE').setValue(memberbody.data.UNITPRICE);
// var freight = Mul(memberbody.data.UNITPRICE, KGS)
// this.formEdit.getForm().findField('FREIGHT').setValue(freight)
// }
// };
//}
if (UNITTYPE == "立方") {
for (var j = 0; j < this.storeFeeTemplateDetail.getCount() ; j += 1) {
var memberbody = this.storeFeeTemplateDetail.getAt(j);
if (CBM >= memberbody.data.STARTWEIGHT && CBM < memberbody.data.ENDWEIGHT) {
this.formEdit.getForm().findField('UNITPRICE').setValue(memberbody.data.UNITPRICE);
var freight = Mul(memberbody.data.UNITPRICE, CBM)
this.formEdit.getForm().findField('FREIGHT').setValue(freight)
this.formHead.getForm().findField('ORUNITPRICE').setValue(memberbody.data.UNITPRICE);
this.formHead.getForm().findField('ORFREIGHT').setValue(freight)
}
};
}
},
GetUnitPriceChange: function () {
if (this.storeFeeTemplateDetail.getCount() == 0) return 0;
var KGS = this.formEdit.getForm().findField('KGS').getValue();
var CBM = this.formEdit.getForm().findField('CBM').getValue();
var UNITTYPE = this.formEdit.getForm().findField('UNITTYPE').getValue();
var UNIT = this.formEdit.getForm().findField('UNIT').getValue();
var UNITPRICE = this.formEdit.getForm().findField('UNITPRICE').getValue();
var NETWEIGHT = this.formEdit.getForm().findField('NETWEIGHT').getValue();
var FEEUNIT = this.formEdit.getForm().findField('FEEUNIT').getValue();
var PRICEUNIT = this.formEdit.getForm().findField('PRICEUNIT').getValue();
var TRUCKNUM = this.formEdit.getForm().findField('TRUCKNUM').getValue();
var FEEKGS = 0;
if (FEEUNIT == '净重') FEEKGS = NETWEIGHT; else FEEKGS = KGS;
if (UNITTYPE == "") return 0;
if ((UNITTYPE == "车型" && UNIT == "") && (TRUCKNUM == 0 || TRUCKNUM == "")) return 0;
if ((UNITTYPE == "吨" || UNIT == "公斤") && (KGS == 0 || KGS == "")) return 0;
if ((UNITTYPE == "立方") && (CBM == 0 || CBM == "")) return 0;
if (UNITTYPE == "车型") {
var freight = Mul(UNITPRICE, TRUCKNUM);
this.formEdit.getForm().findField('FREIGHT').setValue(freight);
this.formHead.getForm().findField('ORFREIGHT').setValue(freight);
}
if (UNITTYPE == "吨" || UNIT == "公斤") {
var freight = Mul(UNITPRICE, FEEKGS);
this.formEdit.getForm().findField('FREIGHT').setValue(freight);
this.formHead.getForm().findField('ORFREIGHT').setValue(freight);
}
if (UNITTYPE == "立方") {
var freight = Mul(UNITPRICE, CBM);
this.formEdit.getForm().findField('FREIGHT').setValue(freight);
this.formHead.getForm().findField('ORFREIGHT').setValue(freight);
}
},
GetPriceChange: function () {
if (this.storeFeeTemplateDetail.getCount() == 0) return 0;
var KGS = this.formEdit.getForm().findField('KGS').getValue();
var CBM = this.formEdit.getForm().findField('CBM').getValue();
var UNITTYPE = this.formEdit.getForm().findField('UNITTYPE').getValue();
var UNIT = this.formEdit.getForm().findField('UNIT').getValue();
var UNITPRICE = this.formEdit.getForm().findField('UNITPRICE').getValue();
var NETWEIGHT = this.formEdit.getForm().findField('NETWEIGHT').getValue();
var FEEUNIT = this.formEdit.getForm().findField('FEEUNIT').getValue();
var PRICEUNIT = this.formEdit.getForm().findField('PRICEUNIT').getValue();
var TRUCKNUM = this.formEdit.getForm().findField('TRUCKNUM').getValue();
var FEEKGS = 0;
if (FEEUNIT == '净重') FEEKGS = NETWEIGHT; else FEEKGS = KGS;
if (UNITTYPE == "") return 0;
if ((UNITTYPE == "车型" && UNIT == "") && (TRUCKNUM == 0 || TRUCKNUM == "")) return 0;
if ((UNITTYPE == "吨" || UNIT == "公斤") && (KGS == 0 || KGS == "")) return 0;
if ((UNITTYPE == "立方") && (CBM == 0 || CBM == "")) return 0;
if (UNITTYPE == "车型") {
var freight = Mul(UNITPRICE, TRUCKNUM);
this.formEdit.getForm().findField('FREIGHT').setValue(freight);
}
if (UNITTYPE == "吨" || UNIT == "公斤") {
var freight = Mul(UNITPRICE, FEEKGS)
this.formEdit.getForm().findField('FREIGHT').setValue(freight)
}
if (UNITTYPE == "立方") {
var freight = Mul(UNITPRICE, CBM)
this.formEdit.getForm().findField('FREIGHT').setValue(freight)
}
},
setAllTotal: function () {
this.setPKGSTotal();
this.setKGSTotal();
this.setCBMTotal();
this.setNETWEIGHTTotal();
this.setTRUCKNUMotal();
this.GetUnitPrice();
},
setPKGSTotal: function () {
var total = this.calcDetailTotal('PKGS');
this.setHeadFieldValue('PKGS', total);
},
setKGSTotal: function () {
var total = this.calcDetailTotal('KGS');
this.setHeadFieldValue('KGS', total);
},
setCBMTotal: function () {
var total = this.calcDetailTotal('CBM');
this.setHeadFieldValue('CBM', total);
},
setNETWEIGHTTotal: function () {
var total = this.calcDetailTotal('NETWEIGHT');
this.setHeadFieldValue('NETWEIGHT', total);
},
setTRUCKNUMotal: function () {
var total = this.calcDetailTotal('TRUCKNUM');
this.setHeadFieldValue('TRUCKNUM', total);
},
calcDetailTotal: function (fieldName) {
var total = 0;
for (var i = 0; i < this.storeBodyList.getCount() ; i += 1) {
var member = this.storeBodyList.getAt(i);
var value = member.get(fieldName);
total = Add(total, value, 6);
}
return total;
},
setHeadFieldValue: function (fieldName, value) {
var field = this.formEdit.getForm().findField(fieldName);
field.setValue(value);
},
onCreateFeeClick: function () {
var basicForm2 = this.formHead.getForm();
if (!basicForm2.isValid()) {
return;
}
var basicForm = this.formEdit.getForm();
if (!basicForm.isValid()) {
return;
}
if (this.accdatesameetd == 1) {
var ETD = this.formEdit.getForm().findField('ETD').getRawValue();
if (ETD == '') {
} else {
var oDate1 = new Date(ETD);
var oDate2 = new Date(this.MsPeriod.FDAY);
if (oDate1.getTime() >= oDate2.getTime()) {
var mydatestr = Ext.util.Format.date(ETD, 'Y-m');
if (this.MsPeriod.CLOSEDAY != 0) {
var myday = Ext.util.Format.date(ETD, 'd');
if (myday > this.MsPeriod.CLOSEDAY) {
var mymonth = Ext.util.Format.date(ETD, 'm');
var myyear = Ext.util.Format.date(ETD, 'Y');
mymonth = parseInt(mymonth) + 1;
var mymonthstr = mymonth.toString();
if (mymonthstr.length == 1) mymonthstr = '0' + mymonthstr;
mydatestr = myyear.toString() + '-' + mymonthstr;
}
} else {
}
var field = this.formHead.getForm().findField('ACCDATE');
field.setValue(mydatestr);
}
}
}
var bodydatas = [];
for (var i = 0; i < this.storeBodyList.getCount() ; i += 1) {
var member = this.storeBodyList.getAt(i);
bodydatas.push(member);
}
var jsonBody = ConvertRecordsToJsonAll(bodydatas);
this.formHead.getForm().findField('BSNO').setDisabled(false);
var data = this.formHead.getForm().getValues(false, false, false);
this.formHead.getForm().findField('BSNO').setDisabled(true);
var data2 = this.formEdit.getForm().getValues(false, false, false);
data2.PCKGS = "0";
data2.NOPCKGS = "0";
data2.PCPKGS = "0";
data2.NOPCPKGS = "0";
data2.PCCBM = "0";
data2.NOPCCBM = "0";
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/TruckMng/MsOpTruckBulk/CreateFee',
scope: this,
params: {
opstatus: this.opStatus,
data: Ext.JSON.encode(data),
data2: Ext.JSON.encode(data2),
body: jsonBody
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
var returnData = jsonresult.Data;
this.formHead.getForm().reset();
this.formHead.getForm().setValues(returnData);
this.formEdit.getForm().reset();
this.formEdit.getForm().setValues(returnData);
if (this.opStatus == 'add') {
var arrNewRecords = this.StoreList.add(returnData);
this.editRecord = arrNewRecords[0];
}
else if (this.opStatus == 'edit') {
var editp = Ext.create('MsOpTruckBulk', 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", returnData.BSNO);
memberbody.commit();
};
this.LoadPeriodStatus(this.opStatus);
this.GetEditStatus();
} else {
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
} else {
Ext.Msg.show({
title: '请重试',
msg: '服务器响应出错',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
}
}
});
}, //end save
//#region 提交 审核 撤销审核
onSubmitAuditClick: function () {
var basicForm2 = this.formHead.getForm();
if (!basicForm2.isValid()) {
return;
}
var basicForm = this.formEdit.getForm();
if (!basicForm.isValid()) {
return;
}
if (this.storeBodyList.getCount() == 0) {
Ext.Msg.show({ title: '提示', msg: '没有商品明细,不允许提交!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var BSSTATUSREF = this.formHead.getForm().findField('TRANSSTATUS').getValue();
if (BSSTATUSREF != '新建' && BSSTATUSREF != '' && BSSTATUSREF != '驳回提交') {
Ext.Msg.show({ title: '提示', msg: '当前状态无法提交!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
if (this.accdatesameetd == 1) {
var ETD = this.formEdit.getForm().findField('ETD').getRawValue();
if (ETD == '') {
} else {
var oDate1 = new Date(ETD);
var oDate2 = new Date(this.MsPeriod.FDAY);
if (oDate1.getTime() >= oDate2.getTime()) {
var mydatestr = Ext.util.Format.date(ETD, 'Y-m');
if (this.MsPeriod.CLOSEDAY != 0) {
var myday = Ext.util.Format.date(ETD, 'd');
if (myday > this.MsPeriod.CLOSEDAY) {
var mymonth = Ext.util.Format.date(ETD, 'm');
var myyear = Ext.util.Format.date(ETD, 'Y');
mymonth = parseInt(mymonth) + 1;
var mymonthstr = mymonth.toString();
if (mymonthstr.length == 1) mymonthstr = '0' + mymonthstr;
mydatestr = myyear.toString() + '-' + mymonthstr;
}
} else {
}
var field = this.formHead.getForm().findField('ACCDATE');
field.setValue(mydatestr);
}
}
}
var bodydatas = [];
for (var i = 0; i < this.storeBodyList.getCount() ; i += 1) {
var member = this.storeBodyList.getAt(i);
bodydatas.push(member);
}
var jsonBody = ConvertRecordsToJsonAll(bodydatas);
this.formHead.getForm().findField('BSNO').setDisabled(false);
var data = this.formHead.getForm().getValues(false, false, false);
this.formHead.getForm().findField('BSNO').setDisabled(true);
var data2 = this.formEdit.getForm().getValues(false, false, false);
data2.PCKGS = "0";
data2.NOPCKGS = "0";
data2.PCPKGS = "0";
data2.NOPCPKGS = "0";
data2.PCCBM = "0";
data2.NOPCCBM = "0";
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/TruckMng/MsOpTruckBulk/SubmitAudit',
scope: this,
params: {
opstatus: this.opStatus,
data: Ext.JSON.encode(data),
data2: Ext.JSON.encode(data2),
body: jsonBody
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
var returnData = jsonresult.Data;
this.formHead.getForm().reset();
this.formHead.getForm().setValues(returnData);
this.formEdit.getForm().reset();
this.formEdit.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('MsOpTruckBulk', 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", returnData.BSNO);
memberbody.commit();
};
this.LoadPeriodStatus(this.opStatus);
this.GetEditStatus();
} 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
onSubmitAuditBackClick: function () {
var basicForm2 = this.formHead.getForm();
if (!basicForm2.isValid()) {
return;
}
var basicForm = this.formEdit.getForm();
if (!basicForm.isValid()) {
return;
}
var BSSTATUSREF = this.formHead.getForm().findField('TRANSSTATUS').getValue();
if (BSSTATUSREF != '提交审核') {
Ext.Msg.show({ title: '提示', msg: '当前状态无法撤销提交!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
this.formHead.getForm().findField('BSNO').setDisabled(false);
var data = this.formHead.getForm().getValues(false, false, false);
this.formHead.getForm().findField('BSNO').setDisabled(true);
var data2 = this.formEdit.getForm().getValues(false, false, false);
data2.PCKGS = "0";
data2.NOPCKGS = "0";
data2.PCPKGS = "0";
data2.NOPCPKGS = "0";
data2.PCCBM = "0";
data2.NOPCCBM = "0";
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/TruckMng/MsOpTruckBulk/SubmitAuditBack',
scope: this,
params: {
data: Ext.JSON.encode(data),
data2: Ext.JSON.encode(data2)
},
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.formHead.getForm().reset();
this.formHead.getForm().setValues(returnData);
this.formEdit.getForm().reset();
this.formEdit.getForm().setValues(returnData);
var editp = Ext.create('MsOpTruckBulk', 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);
this.LoadPeriodStatus(this.opStatus);
this.GetEditStatus();
} 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
onAudit: function () {
var basicForm2 = this.formHead.getForm();
if (!basicForm2.isValid()) {
return;
}
var basicForm = this.formEdit.getForm();
if (!basicForm.isValid()) {
return;
}
var BSSTATUSREF = this.formHead.getForm().findField('TRANSSTATUS').getValue();
if (BSSTATUSREF != '提交审核' && BSSTATUSREF != '驳回提交') {
Ext.Msg.show({ title: '提示', msg: '当前状态无法审核!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
this.formHead.getForm().findField('BSNO').setDisabled(false);
var data = this.formHead.getForm().getValues(false, false, false);
this.formHead.getForm().findField('BSNO').setDisabled(true);
var data2 = this.formEdit.getForm().getValues(false, false, false);
data2.PCKGS = "0";
data2.NOPCKGS = "0";
data2.PCPKGS = "0";
data2.NOPCPKGS = "0";
data2.PCCBM = "0";
data2.NOPCCBM = "0";
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/TruckMng/MsOpTruckBulk/Audit',
scope: this,
params: {
data: Ext.JSON.encode(data),
data2: Ext.JSON.encode(data2)
},
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.formHead.getForm().reset();
this.formHead.getForm().setValues(returnData);
this.formEdit.getForm().reset();
this.formEdit.getForm().setValues(returnData);
var editp = Ext.create('MsOpTruckBulk', 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);
this.LoadPeriodStatus(this.opStatus);
} 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
onAuditBack: function (reason) {
var basicForm2 = this.formHead.getForm();
if (!basicForm2.isValid()) {
return;
}
var basicForm = this.formEdit.getForm();
if (!basicForm.isValid()) {
return;
}
var BSSTATUSREF = this.formHead.getForm().findField('TRANSSTATUS').getValue();
if (BSSTATUSREF != '审核通过') {
Ext.Msg.show({ title: '提示', msg: '当前状态无法撤销审核!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var ISFEE = this.formEdit.getForm().findField('ISFEE').getValue();
if (ISFEE == '1') {
Ext.Msg.show({ title: '提示', msg: '已生成费用不能驳回!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var PCKGS = this.formEdit.getForm().findField('PCKGS').getValue();
if (PCKGS != '0') {
Ext.Msg.show({ title: '提示', msg: '已派车不能驳回!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
this.formHead.getForm().findField('BSNO').setDisabled(false);
var data = this.formHead.getForm().getValues(false, false, false);
this.formHead.getForm().findField('BSNO').setDisabled(true);
var data2 = this.formEdit.getForm().getValues(false, false, false);
data2.PCKGS = "0";
data2.NOPCKGS = "0";
data2.PCPKGS = "0";
data2.NOPCPKGS = "0";
data2.PCCBM = "0";
data2.NOPCCBM = "0";
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/TruckMng/MsOpTruckBulk/AuditBack',
scope: this,
params: {
data: Ext.JSON.encode(data),
data2: Ext.JSON.encode(data2),
reason: reason
},
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.formHead.getForm().reset();
this.formHead.getForm().setValues(returnData);
this.formEdit.getForm().reset();
this.formEdit.getForm().setValues(returnData);
var editp = Ext.create('MsOpTruckBulk', 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);
this.LoadPeriodStatus(this.opStatus);
this.winAuditBackShow.close();
} else {
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
} else {
Ext.Msg.show({
title: '请重试',
msg: '服务器响应出错',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
}
}
});
}, //end save
//#endregion
GetEditStatus: function () {
var canedit = false;
var BSSTATUSREF = this.formHead.getForm().findField('BSSTATUSREF').getValue();
var op = this.formHead.getForm().findField('OP').getValue();
var MODIFIEDUSER = this.formEdit.getForm().findField('MODIFIEDUSER').getValue();
var CUSTSERVICE = this.formHead.getForm().findField('CUSTSERVICE').getValue();
var TRANSSTATUS = this.formHead.getForm().findField('TRANSSTATUS').getValue();
//
_this = this;
if (BSSTATUSREF == "锁定" || (TRANSSTATUS != '新建' && TRANSSTATUS != '驳回提交')) {
canedit = false;
this.setSaveBtnStatus(canedit);
} else {
this.StoreOpRange.load({
params: { optype: "modOpTruckBulkList" },
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', MODIFIEDUSER);
if (recordins.getCount() > 0) {
canedit = true;
} else {
recordins = DsStoreQueryBy(_this.StoreOpRange, 'OPID', CUSTSERVICE);
if (recordins.getCount() > 0) {
canedit = true;
} else {
canedit = false;
}
}
}
} else { canedit = false; }
_this.setSaveBtnStatus(canedit);
}
}
});
}
//
_this = 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
});
this.GetEditStatus();
},
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' });
if (member.data.ISREADONLY == "1")
headfield.setReadOnly(true);
}
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' });
if (member.data.ISREADONLY == "1")
headfield.setReadOnly(true);
}
};
} else {
}
}
},
scope: this
});
},
LoadMustBeCopy: 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.setValue(this.editRecord.get(member.data.FIELDNAME));
}
var headfield = this.formEdit.getForm().findField(member.data.FIELDNAME);
if (headfield != NaN && headfield != null) {
if (member.data.ISMUST == "1")
headfield.setValue(this.editRecord.get(member.data.FIELDNAME));
}
};
} else {
}
}
},
scope: this
});
},
setSaveBtnStatus: function (enable) {
var btnESave = Ext.getCmp('btnESave');
var btnESaveAndClose = Ext.getCmp('btnESaveAndClose');
var btnESaveAndNew = Ext.getCmp('btnESaveAndNew');
var btnadddetail = Ext.getCmp('btnadddetail');
var btndeletedetail = Ext.getCmp('btndeletedetail');
var btnSubmitAudit = Ext.getCmp('btnSubmitAudit');
var btnSubmitAuditBack = Ext.getCmp('btnSubmitAuditBack');
var btnAudit = Ext.getCmp('btnAudit');
var btnAuditBack = Ext.getCmp('btnAuditBack');
//var btnCreateFee = Ext.getCmp('btnCreateFee');
if (this.Audit) {
btnSubmitAudit.disable();
btnSubmitAuditBack.disable();
btnAudit.enable();
btnAuditBack.enable();
enable = false;
} else {
btnSubmitAudit.enable();
btnSubmitAuditBack.enable();
btnAudit.disable();
btnAuditBack.disable();
}
if (enable) {
btnESave.enable();
//btnESaveAndClose.enable();
//btnESaveAndNew.enable();
btnadddetail.enable();
btndeletedetail.enable();
} else {
btnESave.disable();
//btnESaveAndClose.disable();
//btnESaveAndNew.disable();
btnadddetail.disable();
btndeletedetail.disable();
// btnCreateFee.disable();
}
var ISFEE = this.formEdit.getForm().findField('ISFEE').getValue();
var TEMPLATENAME = this.formHead.getForm().findField('TEMPLATENAME').getValue();
var TRANSSTATUS = this.formHead.getForm().findField('TRANSSTATUS').getValue();
var PCKGS = this.formEdit.getForm().findField('PCKGS').getValue();
if (TEMPLATENAME!=null&&TEMPLATENAME != '') {
if (ISFEE == '1' || PCKGS!='0') {
//btnCreateFee.setText('取消生成');
this.formHead.getForm().findField('CUSTOMERNAME').setReadOnly(true);
this.formHead.getForm().findField('CONTRACTNO').setReadOnly(true);
this.formHead.getForm().findField('TEMPLATENAME').setReadOnly(true);
this.formEdit.getForm().findField('PORTLOAD').setReadOnly(true);
this.formEdit.getForm().findField('PORTDISCHARGE').setReadOnly(true);
this.formEdit.getForm().findField('GOODSNAME').setReadOnly(true);
this.formEdit.getForm().findField('KGS').setReadOnly(true);
this.formEdit.getForm().findField('UNIT').setReadOnly(true);
this.formEdit.getForm().findField('UNITTYPE').setReadOnly(true);
this.formEdit.getForm().findField('UNITPRICE').setReadOnly(true);
this.formEdit.getForm().findField('FEEUNIT').setReadOnly(true);
this.formEdit.getForm().findField('PRICEUNIT').setReadOnly(true);
}
else {
//btnCreateFee.setText('生成费用');
this.formHead.getForm().findField('CUSTOMERNAME').setReadOnly(false);
this.formHead.getForm().findField('CONTRACTNO').setReadOnly(false);
this.formHead.getForm().findField('TEMPLATENAME').setReadOnly(false);
this.formEdit.getForm().findField('PORTLOAD').setReadOnly(false);
this.formEdit.getForm().findField('PORTDISCHARGE').setReadOnly(false);
this.formEdit.getForm().findField('GOODSNAME').setReadOnly(false);
this.formEdit.getForm().findField('KGS').setReadOnly(false);
this.formEdit.getForm().findField('UNIT').setReadOnly(false);
this.formEdit.getForm().findField('UNITTYPE').setReadOnly(false);
this.formEdit.getForm().findField('UNITPRICE').setReadOnly(false);
this.formEdit.getForm().findField('FEEUNIT').setReadOnly(false);
this.formEdit.getForm().findField('PRICEUNIT').setReadOnly(false);
}
} else {
if ((TRANSSTATUS != '新建' && TRANSSTATUS != '驳回提交') || (PCKGS != '0'&&PCKGS != '')) {
this.formHead.getForm().findField('CUSTOMERNAME').setReadOnly(true);
this.formHead.getForm().findField('CONTRACTNO').setReadOnly(true);
this.formHead.getForm().findField('TEMPLATENAME').setReadOnly(true);
this.formEdit.getForm().findField('PORTLOAD').setReadOnly(true);
this.formEdit.getForm().findField('PORTDISCHARGE').setReadOnly(true);
this.formEdit.getForm().findField('GOODSNAME').setReadOnly(true);
this.formEdit.getForm().findField('KGS').setReadOnly(true);
this.formEdit.getForm().findField('UNIT').setReadOnly(true);
this.formEdit.getForm().findField('UNITTYPE').setReadOnly(true);
this.formEdit.getForm().findField('UNITPRICE').setReadOnly(true);
this.formEdit.getForm().findField('FEEUNIT').setReadOnly(true);
this.formEdit.getForm().findField('PRICEUNIT').setReadOnly(true);
}
else {
this.formHead.getForm().findField('CUSTOMERNAME').setReadOnly(false);
this.formHead.getForm().findField('CONTRACTNO').setReadOnly(false);
this.formHead.getForm().findField('TEMPLATENAME').setReadOnly(false);
this.formEdit.getForm().findField('PORTLOAD').setReadOnly(false);
this.formEdit.getForm().findField('PORTDISCHARGE').setReadOnly(false);
this.formEdit.getForm().findField('GOODSNAME').setReadOnly(false);
this.formEdit.getForm().findField('KGS').setReadOnly(false);
this.formEdit.getForm().findField('UNIT').setReadOnly(false);
this.formEdit.getForm().findField('UNITTYPE').setReadOnly(false);
this.formEdit.getForm().findField('UNITPRICE').setReadOnly(false);
this.formEdit.getForm().findField('FEEUNIT').setReadOnly(false);
this.formEdit.getForm().findField('PRICEUNIT').setReadOnly(false);
// btnCreateFee.setText('生成费用');
}
}
},
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 = 'MSOPOHTER';
var sql1 = "SET LANGUAGE 'us_english' SELECT * FROM op_other 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('pnlmodOpOtherAllFee');
if (feepanel != NaN && feepanel != null) {
var feemodify = feepanel.panelFee.getModifyStatus();
if (feemodify) {
return '费用信息';
}
}
var feeamendpanel = Ext.getCmp('pnlmodOpOtherAmendFee');
if (feeamendpanel != NaN && feeamendpanel != null) {
var feemodify = feeamendpanel.panelFee.getModifyStatus();
if (feemodify) {
return '更改单信息';
}
}
if (this.formHead.getForm().isDirty() == true) {
return '业务信息';
}
else return '';
}
});