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/Areas/TruckMng/Viewsjs/MsOpTruckBulk/MsOpTruckBulkCtnEdit.js

3153 lines
123 KiB
JavaScript

2 years ago
Ext.namespace('Shipping');
Shipping.MsOpTruckBulkCtnEdit = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsOpTruckBulkCtnEdit.superclass.constructor.call(this);
};
Ext.extend(Shipping.MsOpTruckBulkCtnEdit, 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.StoreTRADETYPE = Ext.create('Ext.data.Store', {
fields: ['TRADETYPE']
});
this.StoreTRADETYPE.add({ "TRADETYPE": "出口" });
this.StoreTRADETYPE.add({ "TRADETYPE": "进口" });
this.comboxTRADETYPE = Ext.create('DsExt.ux.RefTableCombox', {
store: this.StoreTRADETYPE,
2 years ago
fieldLabel: '装运类型',
2 years ago
forceSelection: true,
name: 'TRADETYPE',
valueField: 'TRADETYPE',
displayField: 'TRADETYPE'
});
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.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: '新建'
}, this.comboxContract, this.comboxFeeTemplate, {
fieldLabel: '创建日期',
//format: 'Y-m-d',
//xtype: 'datefield',
readOnly: true,
name: 'CREATETIME'
}
//, this.comboxDDOP
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxSALE, this.comboxCUSTSERVICE, {
fieldLabel: '操作员',
readOnly: true,
name: 'OP'
}, {
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,
flex: 0.5,
name: 'BSSTATUSREF',
value: '未锁定'
}, {
fieldLabel: '费用锁定',
flex: 0.5,
readOnly: true,
name: 'FEESTATUSREF',
value: '未锁定'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '客户订单号',
readOnly: false,
name: 'ORDERNO'
}, this.comboxCustCode, this.comboxInfoClientContact, {
fieldLabel: '联系电话',
readOnly: false,
name: 'CUSTTEL'
}, {
fieldLabel: '接单日期',
format: 'Y-m-d',
xtype: 'datefield',
allowBlank: false,
name: 'BSDATE',
value: Ext.util.Format.date(Ext.Date.add(new Date(), Ext.Date.MONTH - 1, 1), "Y-m-d")
}]
}]//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.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.storeYARD = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefListYARD' }
});
this.storeYARD.load();
//
this.comboxYARD = Ext.create('DsExt.ux.RefTableCombox', {
2 years ago
fieldLabel: '场站', //'场站',
2 years ago
store: this.storeYARD,
forceSelection: true,
queryMode: 'remote',
minChars: 0,
queryParam: 'CODENAME',
name: 'YARD',
valueField: 'CustName',
displayField: 'CodeAndName'
});
//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.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', {
2 years ago
fieldLabel: '装卸货客户', //'费用类型',
2 years ago
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.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: [this.comboxTRADETYPE, {
2 years ago
fieldLabel: '要求派车日期',
2 years ago
format: 'Y-m-d',
xtype: 'datefield',
labelWidth: 110,
// allowBlank: false,
name: 'ETD',
value: this.myDate
}
//, {
// fieldLabel: '要求到货日期',
// format: 'Y-m-d',
// xtype: 'datefield',
// name: 'ETA'
//}
, this.comboxGOODSNAME, {
fieldLabel: '运输凭证编号',
name: 'ORDERNO1'
}, {
fieldLabel: '提单号',
name: 'MBLNO'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxLoadPort, this.comboxDistPort, {
fieldLabel: '箱型箱量',
name: 'CNTRTOTAL'
}, {
fieldLabel: '截港日期', //'截港日期',
format: 'Y-m-d',
flex: 1,
xtype: 'datetimefield',
name: 'CLOSINGDATE',
listeners: {
scope: this,
'select': function (combo, mdate) {
var mydate = new Date(mdate);
var mydatestr = Ext.util.Format.date(mydate, 'Y-m-d 12:00:00');
combo.setValue(mydatestr);
}
}
}, this.comboxYARD]
}, {
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: [
//this.comboxFeeUnit, this.comboxPriceUnit,
{
fieldLabel: '应收运费',
name: 'FREIGHT',
value: '0',
blankText: '请填写数值!',
allowBlank: false,
readOnly: true,
regex: /^\d+(\.\d{1,4})?$/,
regexText: '请输入正确的数值类型!'
}, {
fieldLabel: '应收杂费',
readOnly: true,
name: 'TTLOTDR'
}, {
fieldLabel: '应收合计',
readOnly: true,
name: 'TTLDR'
}, { xtype: 'hiddenfield' }, { xtype: 'hiddenfield' }]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: 'FEEUNIT',
name: 'FEEUNIT', hidden: true
}, {
fieldLabel: 'PRICEUNIT',
name: 'PRICEUNIT', hidden: true
}, {
fieldLabel: 'PCPKGS',
name: 'PCPKGS', hidden: true
}, {
fieldLabel: 'NOPCPKGS',
name: 'NOPCPKGS', hidden: true
}, {
fieldLabel: 'PCCBM',
name: 'PCCBM', hidden: true
}, {
fieldLabel: 'NOPCCBM',
name: 'NOPCCBM', hidden: true
}, {
fieldLabel: 'PKGS',
hidden: true,
value:0,
readOnly: true,
name: 'PKGS'
}, {
fieldLabel: 'KGS',
hidden: true,
value: 0,
readOnly: true,
name: 'KGS'
}, {
fieldLabel: 'NETWEIGHT',
hidden: true,
value: 0,
readOnly: true,
name: 'NETWEIGHT'
}, {
fieldLabel: 'CBM',
hidden: true,
value: 0,
readOnly: true,
name: 'CBM'
}, {
fieldLabel: 'TRUCKNUM',
hidden: true,
value: 0,
readOnly: true,
name: 'TRUCKNUM'
}, {
fieldLabel: 'UNITPRICE',
hidden: true,
value: 0,
readOnly: true,
name: 'UNITPRICE'
}, {
fieldLabel: '已分拨重量',
hidden: true,
readOnly:true,
name: 'PCKGS'
}, {
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.storeCodeCtn = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CodeCtnModel',
proxy: { url: '/CommMng/BasicDataRef/GetCodeCtnList' }
});
this.storeCodeCtn.load();
this.comboxCTNALL = Ext.create('DsExt.ux.RefTableCombox', {
//fieldLabel: Zi.LAN.CTNALL, //'箱型',
store: this.storeCodeCtn,
forceSelection: true,
name: 'CTNALL',
valueField: 'CTN',
displayField: 'CTN'
});
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: 'CTNALL',
header: '箱型', //'费用名称',
editor: this.comboxCTNALL,
width: 140
}, {
sortable: true,
dataIndex: 'CTNNUM',
header: '箱量', //'汇率',
editor: {
xtype: 'numberfield',
keyNavEnabled: false,
selectOnFocus: true,
hideTrigger: true,
mouseWheelEnabled: false,
enableKeyEvents: true
},
align: 'right',
width: 80
}, {
sortable: true,
dataIndex: 'PCCTNNUM',
header: '已派车箱量',
width: 80
}, {
sortable: true,
dataIndex: 'UNITPRICE',
header: '单价',
editor: {
xtype: 'numberfield',
selectOnFocus: true
},
width: 80
}, {
sortable: true,
dataIndex: 'FREIGHT',
header: '运费合计',
editor: {
xtype: 'numberfield',
// allowBlank: false,
selectOnFocus: true
},
width: 100
}, {
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');
//field.setValue(NewGuid());
//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('未锁定');
//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);
//this.formEdit.getForm().findField('ISFEE').setValue('0');
//this.formEdit.getForm().findField('PCKGS').setValue('0');
//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.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: '查看场站信息', //"青岛场站数据",
handler: function (menu, event) {
_this.onGETYARDClick(menu, event);
}
},'-',{
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";
data2.PKGS = "0";
data2.KGS = "0";
data2.CBM = "0";
data2.NETWEIGHT = "0";
data2.TRUCKNUM = "0";
data.TRANSTYPE = '集装箱';
if (data2.TRADETYPE=='出口'&&data2.YARD==''){
Ext.Msg.show({ title: '提示', msg: '托运类型为出口的话,提箱场站为必填项!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
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);
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.GetUnitPrice();
} else {
this.GetUnitPrice();
}
}
},
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.GetUnitPrice();
}
}
},
waitMsg: "正在查询数据...",
scope: this
});
}
},
gridAfterEdit: function (editor, e, eOpts) {
if (e.value == e.originalValue) return;
//需要自己实现里面的事件
if (e.field == 'CTNALL') {
var unitprice = _this.GetUnitPriceChange(e.value);
var unitpkgs = e.record.data['CTNNUM'];
var freight = 0;
if (unitprice != 0) {
freight = Mul(unitprice, unitpkgs);
} else freight = 0;
e.record.set('UNITPRICE', unitprice);
e.record.set('FREIGHT', freight);
e.record.set('ORUNITPRICE', unitprice);
e.record.set('ORFREIGHT', freight);
_this.setAllTotal();
} else if (e.field == 'CTNNUM') {
var unitprice = e.record.data['UNITPRICE'];
var unitpkgs = e.record.data['CTNNUM'];
var orunitprice = e.record.data['ORUNITPRICE'];
var freight = 0;
var orfreight = 0;
if (unitprice != 0) {
freight = Mul(unitprice, unitpkgs);
orfreight = Mul(orunitprice, unitpkgs);
} else {
freight = 0;
orfreight = 0;
}
e.record.set('FREIGHT', freight);
e.record.set('ORFREIGHT', orfreight);
_this.setAllTotal();
} else if (e.field == 'UNITPRICE') {
var unitprice = e.record.data['UNITPRICE'];
var unitpkgs = e.record.data['CTNNUM'];
var freight = 0;
if (unitprice != 0) {
freight = Mul(unitprice, unitpkgs);
} else freight = 0;
e.record.set('FREIGHT', freight);
_this.setAllTotal();
} else if (e.field == 'FREIGHT') {
_this.setAllTotal();
}
},
GetUnitPriceChange: function (ctnall) {
var unitprice = 0;
if (this.storeFeeTemplateDetail.getCount() == 0) return 0;
for (var j = 0; j < this.storeFeeTemplateDetail.getCount() ; j += 1) {
var memberbody = this.storeFeeTemplateDetail.getAt(j);
if (memberbody.data.UNIT == ctnall) {
unitprice=memberbody.data.UNITPRICE;
}
};
return unitprice;
},
GetUnitPrice: function () {
if (this.storeFeeTemplateDetail.getCount() == 0) {
for (var i = 0; i < this.storeBodyList.getCount() ; i += 1) {
var memberbody = this.storeBodyList.getAt(i);
memberbody.set("UNITPRICE", 0);
memberbody.set("FREIGHT", 0);
memberbody.set("ORUNITPRICE", 0);
memberbody.set("ORFREIGHT", 0);
memberbody.commit();
}
_this.setAllTotal();
} else {
for (var i = 0; i < this.storeBodyList.getCount() ; i += 1) {
var memberbody = this.storeBodyList.getAt(i);
var unitpkgs = e.record.data['CTNNUM'];
var CTNALL = e.record.data['CTNALL'];
var unitprice = _this.GetUnitPriceChange(CTNALL);
var freight = 0;
if (unitprice != 0) {
freight = Mul(unitprice, unitpkgs);
};
memberbody.set("UNITPRICE", unitprice);
memberbody.set("FREIGHT", freight);
memberbody.set("ORUNITPRICE", unitprice);
memberbody.set("ORFREIGHT", freight);
memberbody.commit();
}
_this.setAllTotal();
};
},
setAllTotal: function () {
this.setFREIGHTTotal();
this.setCTNTotal();
},
setFREIGHTTotal: function () {
var total = this.calcDetailTotal('FREIGHT');
this.setHeadFieldValue('FREIGHT', total);
var TTLOTDR = this.formEdit.getForm().findField('TTLOTDR').getValue();
var TTLDR = Add(total, TTLOTDR, 2)
this.setHeadFieldValue('TTLDR', TTLDR);
},
setCTNTotal: function () {
var total = this.calcCtnTotal();
this.setHeadFieldValue('CNTRTOTAL', total);
},
calcCtnTotal: function () {
var total = '';
for (var i = 0; i < this.storeBodyList.getCount() ; i += 1) {
var member = this.storeBodyList.getAt(i);
var value = member.get('CTNALL') + '*' + member.get('CTNNUM');
if (total=='')
total = value;
else total =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 = Add(total, value, 4);
}
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";
if (data2.TRADETYPE == '出口' && data2.YARD == '') {
Ext.Msg.show({ title: '提示', msg: '托运类型为出口的话,提箱场站为必填项!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
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/MsOpTruckBulkPc/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
onGETYARDClick: function (button, event) {
var BSNO = this.formHead.getForm().findField('BSNO').getValue();
var MBLNO = this.formEdit.getForm().findField('MBLNO').getValue();
var YARD = this.formEdit.getForm().findField('YARD').getValue();
if (MBLNO == "" || YARD == "") {
Ext.Msg.show({ title: '提示', msg: '提单号或场站不能为空!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); //'提单号和场站不能为空!'
return;
} else {
Ext.Msg.wait('正在操作数据');
Ext.Ajax.request({
waitMsg: '正在操作数据',
url: '/MvcShipping/MsOpSeae/GetyardctnList',
params: {
bs: BSNO,
mblno: MBLNO,
yard: YARD,
isweb: true
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
var statusdata = jsonresult.data;
var boxitems = "";
formCustomDataShow = Ext.widget('form', {
region: 'center',
autoScroll: true, height: 460,
// border: false,
bodyPadding: 0,
html: jsonresult.data
});
me = this;
winCustomDataShow = Ext.create('Ext.window.Window', {
title: "",
// closeAction: 'hide',
width: 1100,
height: 500,
layout: 'fit',
resizable: true,
modal: true,
closeAction: 'close',
closable: true,
items: [formCustomDataShow],
buttons: [{
text: '关闭', //"关闭",
minWidth: 70,
handler: function () {
winCustomDataShow.close();
}
}]
});
winCustomDataShow.show();
Ext.Msg.hide();
}
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
}
},
//#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 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();
btnadddetail.enable();
btndeletedetail.enable();
} else {
btnESave.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('UNITPRICE').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);
}
} 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);
}
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);
}
}
},
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 '';
}
});