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/MvcShipping/Viewsjs/MsOpOther/MsOpOther_KuaiDiEdit.js

2057 lines
82 KiB
JavaScript

Ext.namespace('Shipping');
Shipping.MsOpOtherEdit = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsOpOtherEdit.superclass.constructor.call(this);
};
Ext.extend(Shipping.MsOpOtherEdit, 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.SALEORDERDEPTBYOP = 0;
this.copyfee = false;
this.bsno = getUrlParam('bsno');
this.storePLList = Ext.create('Ext.data.Store', {
model: 'MsOpOtherEntity'
});
this.storeDefValue = Ext.create('Ext.data.Store', {
model: 'DsShipping.ux.OpDefValue',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsCodeOpDef/GetDataList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.storeMustBe = Ext.create('Ext.data.Store', {
model: 'DsShipping.ux.OpDefValue',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsCodeOpMustField/GetDataList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.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,
// flex: 0.5,
forceSelection: true,
name: 'CUSTSERVICE',
valueField: 'UserName',
displayField: 'CodeAndName',
value: SHOWNAME
});
this.storeOpCode2 = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.UserRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetUserRefList' }
});
this.storeOpCode2.load();
//揽货人
this.comboxSALE = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '揽货人',
store: this.storeOpCode2,
forceSelection: true,
name: 'SALE',
valueField: 'UserName',
displayField: 'CodeAndName',
value: SHOWNAME,
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
if (this.SALEORDERDEPTBYOP == 0)
this.formHead.getForm().findField('SALEDEPT').setValue(records[0].data.DEPTNAME);
}
}
}
});
//所属部门
this.storeDept = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.DeptModel',
proxy: { url: '/CommMng/BasicDataRef/GetDeptList' }
});
this.storeDept.load();
this.comboxDept = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '所属部门', //'所属部门',
store: this.storeDept,
// flex: 0.5,
// labelWidth: 60,
forceSelection: true,
name: 'SALEDEPT',
value: DEPTNAME,
valueField: 'DeptName',
displayField: 'DeptName'
//,hidden: true
});
//操 作
this.comboxOP = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '操 作',
store: this.storeOpCode,
forceSelection: true,
name: 'OP',
valueField: 'UserName',
displayField: 'CodeAndName',
value: SHOWNAME,
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
if (this.SALEORDERDEPTBYOP == 1)
this.formHead.getForm().findField('SALEDEPT').setValue(records[0].data.DEPTNAME);
}
}
}
});
this.comboxFRCUSTSERVICE = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '海外客服',
store: this.storeOpCode,
forceSelection: true,
// flex: 0.5,
// labelWidth: 60,
name: 'FRCUSTSERVICE',
valueField: 'UserName',
displayField: 'CodeAndName'
});
//委托单位
this.storeCustCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
this.storeCustCode.load({ params: { condition: "ISCONTROLLER='1'"} });
this.comboxCustCode = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '委托单位',
store: this.storeCustCode,
forceSelection: true,
name: 'CUSTOMERNAME',
valueField: 'CustName',
displayField: 'CodeAndName',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
var basicForm = _this.formEdit.getForm();
var ENTERP = basicForm.findField('ENTERP').getValue();
if (ENTERP == '' || ENTERP == null) {
basicForm.findField('ENTERP').setValue(combo.value);
}
this.formHead.getForm().findField('SALECORPID').setValue(records[0].data.SALECORPID);
this.formHead.getForm().findField('SALE').setValue(records[0].data.SALE);
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
});
if (records[0].data.BSSOURCE != '') {
this.formEdit.getForm().findField('BSSOURCE').setValue(records[0].data.BSSOURCE);
var recs = DsStoreQueryBy(this.storeSource, 'SourceName', records[0].data.BSSOURCE);
if (recs.getCount() > 0) {
var data = recs.getAt(0).data;
var s = "SOURCEID='" + data.SourceID + "'";
this.storeSourceDetail.load({ params: { condition: s } });
} else {
var BSSOURCEDETAIL = this.formHead.getForm().findField('BSSOURCEDETAIL');
BSSOURCEDETAIL.setValue('');
}
}
}
}
}
});
//委托单位_联系人
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: 'OPERATOR',
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'
// });
//新版键值维护表_运输类型//报关业务类型96004
this.storeTSysEnumValueCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.TSysEnumValueDataModel',
proxy: { url: '/CommMng/BasicDataRef/GetTSysEnumValueList' }
});
this.storeTSysEnumValueCode.load({ params: { condition: " and EnumTypeID=96004"} });
this.comboxTRANSTYPE = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '运输类型',
store: this.storeTSysEnumValueCode,
forceSelection: true,
name: 'TRANSTYPE',
value: '',
valueField: 'EnumValueName',
displayField: 'EnumValueName'
});
//键值维护表_贸易方式
this.storeCrmKeyCodeCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CrmKeyCodeModel',
proxy: { url: '/CommMng/BasicDataRef/GetCrmKeyCodeList' }
});
this.storeCrmKeyCodeCode.load({ params: { condition: " and KEYTYPE='贸易方式'"} });
this.comboxTRADETYPE = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '贸易方式',
store: this.storeCrmKeyCodeCode,
forceSelection: true,
name: 'TRADETYPE',
valueField: 'KEYVALUE',
displayField: 'KEYVALUE'
});
//品名
this.storeCodeGoodsList = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CodeGoodsModel',
proxy: { url: '/CommMng/BasicDataRef/GetCodeGoodsList' }
});
this.storeCodeGoodsList.load();
this.comboxGOODSNAME = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '品名',
store: this.storeCodeGoodsList,
name: 'GOODSNAME',
valueField: 'GOODNAME',
displayField: 'CodeAndName'
});
//权限范围
this.StoreOpRange = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsOP',
proxy: { url: '/MvcShipping/MsBaseInfo/GetOpRang' }
});
//业务来源
this.storeSource = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.SourceModel',
proxy: { url: '/CommMng/BasicDataRef/GetSource' }
});
this.storeSource.load();
this.storeSourceDetail = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.SourceDetailModel',
proxy: { url: '/CommMng/BasicDataRef/GetSourceDetail2' }
});
this.comboxBSSOURCE = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '业务来源',
store: this.storeSource,
forceSelection: true,
name: 'BSSOURCE',
valueField: 'SourceName',
displayField: 'SourceName',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
var recs = DsStoreQueryBy(this.storeSource, 'SourceID', records[0].data.SourceID);
if (recs.getCount() > 0) {
var data = recs.getAt(0).data;
var s = "SOURCEID='" + data.SourceID + "'";
this.storeSourceDetail.load({ params: { condition: s} });
} else {
var BSSOURCEDETAIL = this.formHead.getForm().findField('BSSOURCEDETAIL');
BSSOURCEDETAIL.setValue('');
}
}
}
}
});
this.comboxBSSOURCEDETAIL = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '来源明细',
store: this.storeSourceDetail,
//forceSelection: true,
name: 'BSSOURCEDETAIL',
valueField: 'SourceDetail',
displayField: 'SourceDetail'
});
//
this.storeUserBase = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.UserBaseModel',
proxy: { url: '/MvcShipping/MsBaseInfo/GetUserBaseList' }
});
this.storeUserBase.load();
this.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.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: '箱型',
store: this.storeCodeCtn,
flex: 0.6,
name: 'CTNALL',
valueField: 'CTN',
displayField: 'CTN'
});
//
this.storeEnterpCode = Ext.create('DsExt.ux.RefTableStore', {
fields: [
{ name: 'CUSTOMER', type: 'string' },
{ name: 'ENTERPID', type: 'string' }
],
proxy: { url: '/MvcShipping/MsOpOther/GetENTERPLIST' }
});
this.storeEnterpCode.load();
this.comboxEnterp = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '经营单位',
store: this.storeEnterpCode,
name: 'ENTERP',
valueField: 'CUSTOMER',
displayField: 'CUSTOMER'
});
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 = this;
this.formHead = Ext.widget('form', {
region: 'north',
frame: true,
collapsed: false,
collapsible: true,
// height:160,
trackResetOnLoad: true,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 70,
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: 'OPLBNAME',
name: 'OPLBNAME', hidden: true
},
{
fieldLabel: '业务状态',
readOnly: true,
name: 'BSSTATUSREF',
value: '未锁定'
}, {
fieldLabel: '费用状态',
readOnly: true,
name: 'FEESTATUSREF',
value: '未锁定'
}, {
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: '接单日期',
format: 'Y-m-d',
xtype: 'datefield',
// flex: 0.5,
allowBlank: false,
name: 'BSDATE',
value: Ext.util.Format.date(Ext.Date.add(new Date(), Ext.Date.MONTH - 1, 1), "Y-m-d")
}, this.comboxDept, this.comboxSaleCompany]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxCustCode, this.comboxOP, this.comboxSALE, this.comboxCUSTSERVICE, this.comboxFRCUSTSERVICE, this.comboxInfoClientContact]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
xtype: 'container',
layout: 'hbox',
flex: 1,
defaultType: 'textfield',
items: [{
fieldLabel: '委托编号', //'委托编号',
allowBlank: true,
name: 'CUSTNO'
}, {
xtype: 'button',
id: 'btnCUSTNO',
iconCls: "btncancel",
handler: function (button, event) {
this.ClearCustNo();
},
scope: this
}]
}, {
fieldLabel: '主提单号',
name: 'MBLNO',
listeners: {
scope: this,
blur: function (field, The, eOpts) {
_this.formHead.getForm().findField('MBLNO').setValue(field.value.toUpperCase().trim());
}
}
//allowBlank: false
}, {
fieldLabel: '分提单号',
name: 'HBLNO',
listeners: {
scope: this,
blur: function (field, The, eOpts) {
_this.formHead.getForm().findField('HBLNO').setValue(field.value.toUpperCase().trim());
}
}
}, {
fieldLabel: '合同号',
name: 'CONTRACTNO'
}, this.comboxStlName, {
fieldLabel: '结算日期',
format: 'Y-m-d',
readOnly: true,
flex: 1,
xtype: 'datefield',
name: 'STLDATE'
}]
}]//end items(fieldset 1)
}]//end root items
}); //end this.formHead
this.storeCUSTOMSER = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
this.storeCUSTOMSER.load({ params: { condition: "ISCUSTOM='1'" } });
this.comboxCUSTOMSER = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel:'报关行', //'报关行',
store: this.storeCUSTOMSER,
forceSelection: true,
id: 'CUSTOMSER',
name: 'CUSTOMSER',
valueField: 'CustName',
displayField: 'CodeAndName',
value: ''
});
this.storeCustWmsCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
this.storeCustWmsCode.load({ params: { condition: "ISWAREHOUSE='1'" } });
this.comboxCustWmsCode = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel:'仓库',
store: this.storeCustWmsCode,
forceSelection: true,
id: 'WAREHOUSE',
name: 'WAREHOUSE',
valueField: 'CustName',
displayField: 'CodeAndName'
// allowBlank: false,
});
//#region 原产地
Ext.define('ConutryRef', {
extend: 'Ext.data.Model',
fields: [
{ name: 'countryid', type: 'string' },
{ name: 'country', type: 'string' },
{ name: 'country_idandname', type: 'string' }
]
});
this.storeCountry = Ext.create('DsExt.ux.RefTableStore', {
model: 'ConutryRef',
proxy: { url: '/CommMng/BasicDataRef/GetCountryRefList' }
});
this.storeCountry.load({ params: { condition: "" } });
this.comboxCountry = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel:'原产国',
forceSelection: true,
store: this.storeCountry,
name: 'COUNTRYOFORIGIN',
valueField: 'country',
displayField: 'country'
});
//#endregion
this.formEdit = Ext.widget('form', {
region: 'north',
height: 170,
frame: true,
collapsed: false,
//collapsible: true,
// bodyPadding: 5,
trackResetOnLoad: true,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 70,
msgTarget: 'qtip'
},
items: [{
xtype: 'fieldset',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxBSSOURCE, this.comboxBSSOURCEDETAIL, {
fieldLabel: '装货港',
name: 'PORTLOAD'
}, {
fieldLabel: '卸货港',
name: 'PORTDISCHARGE'
}, this.comboxTRANSTYPE, this.comboxTRADETYPE]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '业务日期',
format: 'Y-m-d',
xtype: 'datefield',
allowBlank: false,
name: 'ETD',
value: this.myDate
}, {
fieldLabel: '运输工具',
name: 'VESSEL'
}, {
fieldLabel: '班次号',
name: 'VOYNO'
},{
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);
}
}
}, {
fieldLabel: '截单日期', //'截单日期',
format: 'Y-m-d',
flex: 1,
xtype: 'datetimefield',
name: 'CLOSEDOCDATE',
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.comboxGOODSNAME]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [ {
fieldLabel: '毛重',
name: 'KGS',
id: 'KGS',
value: '0',
blankText: '请填写数值!',
allowBlank: false,
regex: /^\d+(\.\d{1,4})?$/,
regexText: '请输入正确的数值类型!'
}, {
fieldLabel: '净重',
name: 'NETWEIGHT',
id: 'NETWEIGHT',
value: '0',
blankText: '请填写数值!',
allowBlank: false,
regex: /^\d+(\.\d{1,4})?$/,
regexText: '请输入正确的数值类型!'
}, {
fieldLabel: '件数',
name: 'PKGS',
id: 'PKGS',
value: '0',
blankText: '请填写数值!',
allowBlank: false,
regex: /^\d+(\.\d{1,4})?$/,
regexText: '请输入正确的数值类型!'
}, {
fieldLabel: '件数包装',
name: 'KINDPKGS'
}, {
fieldLabel: '尺码',
name: 'CBM',
id: 'CBM',
value: '0',
blankText: '请填写数值!',
allowBlank: false,
regex: /^\d+(\.\d{1,4})?$/,
regexText: '请输入正确的数值类型!'
}, this.comboxCustWmsCode]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '订舱编号',
name: 'ORDERNO'
}, this.comboxCTNALL, {
fieldLabel: '箱量',
labelWidth: 30,
value: '0',
flex: 0.4,
blankText: '请填写数值!',
allowBlank: false,
name: 'CTNNUM'
}, this.comboxEnterp, {
fieldLabel: '手册号',
name: 'BOOKNO'
}, this.comboxCUSTOMSER, this.comboxCountry]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '最后一次更改人',
name: 'MODIFIEDUSER',
hidden: true
}, {
fieldLabel: '备注',
name: 'REMARK',
height:40,
xtype: "textarea"
}]
}]//end items(fieldset 1)
}]//end root items
}); //end this.formHead
//按钮Toolbar
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [{
id: 'btnEPrev',
text: "上一票", //"上一票",
// iconCls: "btnsave",
handler: function (button, event) {
this.PrevRecord();
},
scope: this
}, {
id: 'btnENext',
text: "下一票", //"下一票",
// iconCls: "btnsave",
handler: function (button, event) {
this.NextRecord();
},
scope: this
},{
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
}, , {
text: '复制新建', //"国外舱单",
menu: [{
id: 'btnECopyNew',
text: "复制新建",
handler: function (button, event) {
var btnESave = Ext.getCmp('btnESave');
if (btnESave.isDisabled() || this.getIsModify == '') {
var basicForm = this.formHead.getForm();
this.opStatus = 'add';
basicForm.findField('BSNO').setDisabled(false);
var field = basicForm.findField('BSNO');
var oldbsno = field.getValue();
this.LoadCopyData(oldbsno, false);
this.LoadPeriodStatus(this.opStatus);
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 == 'pnlmodOpOtherInfo') {
// this.tabSeaepanel.setActiveTab(i);
} else {
children.items[i].close();
}
}
}
}
this.tabOtherPanel.doLayout();
} else {
this.CopyNew();
}
this.panelOcr.hide();
},
scope: this
}, {
id: 'btnECopyNewFee',
text: '复制新建(含费用)', //"复制新建",
handler: function (button, event) {
var btnESave = Ext.getCmp('btnESave');
if (btnESave.isDisabled() || this.getIsModify == '') {
var basicForm = this.formHead.getForm();
this.opStatus = 'add';
basicForm.findField('BSNO').setDisabled(false);
var field = basicForm.findField('BSNO');
var oldbsno = field.getValue();
this.LoadCopyData(oldbsno,true);
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 == 'pnlmodOpOtherInfo') {
// this.tabSeaepanel.setActiveTab(i);
} else {
children.items[i].close();
}
}
}
}
this.tabOtherPanel.doLayout();
} else {
this.copyfee = true;
this.CopyNew();
}
this.panelOcr.hide();
},
scope: this
}]
}, '-', {
text: "关闭",
handler: function (button, event) {
window.close();
},
scope: this
}, {
text: "新建",
id: 'btnENew',
handler: function (button, event) {
this.LoadData('add', '');
},
scope: this
}, '-', {
text: "打印",
iconCls: "btnprint",
handler: function (button, event) {
this.Print();
},
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: 'E44F0B49-6F61-40FB-AC28-E630591BE557'
}
});
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 == 'modOpOtherAllFee') {
// var paneltabitems = new Shipping.OtherFee({
// id: 'pnl' + record.data.NAME,
// layout: "border",
// region: "center",
// autoScroll: true,
// frame: false,
// closable: true,
// title: record.data.DESCRIPTION
// });
//} else
if (record.data.NAME == 'modOpOtherAmendFee') {
var paneltabitems = new Shipping.OtherAmendFee({
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.panelFee = new Shipping.FeeEditGrid({
region: 'center',
layout: 'border'
});
this.panelFee.stroplb = 'op_other';
this.panelFee.StoreCustType.add({ "SCUSTTYPE": "WTDW-委托单位", "CUSTTYPE": "委托单位", "CUSTNAME": "CUSTOMERNAME" });
this.panelFee.StoreCustType.add({ "SCUSTTYPE": "BGH-报关行", "CUSTTYPE": "报关行", "CUSTNAME": "CUSTOMSER" });
this.panelFee.StoreCustType.add({ "SCUSTTYPE": "HG-海关", "CUSTTYPE": "海关", "CUSTNAME": "BYCUSTOM" });
this.panelFee.StoreCustType.add({ "SCUSTTYPE": "DCDL-订舱代理", "CUSTTYPE": "订舱代理", "CUSTNAME": "BYCUSTOM" });
this.panelFee.StoreDrOpRange.load({ params: { optype: "modOtherRecvFeeManagement" } });
this.panelFee.StoreCrOpRange.load({ params: { optype: "modOtherPayFeeManagement" } });
this.panelFee.storeFeeNameRef.load({ params: { condition: "" } });
this.panelFee.storeBodyList_GuDingFeeWeiHu.load();
this.panelpage = new Ext.Panel({
// title: '订舱说明',
layout: "border",
region: 'center',
animate: true,
autoScroll: true,
// containerScroll: true,
frame: false,
items: [this.formEdit, this.panelFee]
});
this.panelOther = new Ext.Panel({
title: '委托信息',
id: 'pnlmodOpOtherInfo', //pnlmodOpOtherOpwt
layout: "border",
region: 'center',
animate: true,
autoScroll: true,
frame: false,
items: [this.panelBtn, this.formHead, this.panelpage]
});
this.tabOtherPanel = new Ext.TabPanel({
activeTab: 0,
autoWidth: true,
border: true,
frame: false,
region: 'center',
id: "tabOtherPanel",
enableTabScroll: true,
items:
[
this.panelOther
],
listeners: {
scope: this,
'beforetabchange': function (tabPanel, newCard, oldCard, eOpts) {
if (oldCard != null && oldCard.id == "pnlmodOpOtherAllFee") {
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 == "pnlmodOpOtherAmendFee") {
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
});
Ext.Ajax.request({
waitMsg: '',
url: '/MvcShipping/MsSysParamSet/GetData',
params: {
condition: "PARAMNAME='SALEORDERDEPTBYOP'"
},
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.SALEORDERDEPTBYOP = 1;
} else {
}
}
} else {
}
},
scope: this
});
}, //end initUIComponents
InitData: function () {
this.opStatus = 'add';
var condition = '';
if (parentWin) {
var ret = parentWin.OprationSwap();
this.opStatus = ret[0];
this.StoreList = ret[1];
this.editRecord = ret[2];
}
this.LoadPeriod(this.opStatus);
if (this.opStatus == 'copyaddfee') {
this.opStatus = 'copyadd';
this.copyfee = true;
}
//
if (this.opStatus == 'edit') {
var s = "SOURCEID=(select SOURCEID from code_source where SOURCENAME='" + this.editRecord.get('BSSOURCE') + "')";
this.storeSourceDetail.load({ params: { condition: s} }); //来源明细加载
//
condition = " BSNO='" + this.editRecord.get('BSNO') + "'";
} else if (this.opStatus == 'add') {
this.LoadDefValue();
}
this.storecodeservice.load({ params: { condition: "OPTYPE='7'" },
callback: function (r, options, success) {
if (success) {
if (r.length != 0) {
var checkboxitems = "";
checkboxitems = "[";
for (i = 0; i < this.storecodeservice.getCount(); i += 1) {
var memberyf = this.storecodeservice.getAt(i);
if (i == 0) {
var checkboxSingleItem = "{boxLabel:'" + memberyf.data.SERVICENAME + "',inputValue:'1',name:'Is" + memberyf.data.OPField + "',id:'Is" + memberyf.data.OPField + "'";
checkboxSingleItem += "}";
} else {
var checkboxSingleItem = ",{boxLabel:'" + memberyf.data.SERVICENAME + "',inputValue:'1',name:'Is" + memberyf.data.OPField + "',id:'Is" + memberyf.data.OPField + "'";
checkboxSingleItem += "}";
}
checkboxitems += checkboxSingleItem;
};
checkboxitems += "]";
_this.myCheckboxGroup = new Ext.form.CheckboxGroup({
// id: 'myGroup',
xtype: 'checkboxgroup',
fieldLabel: '服务项目',
columns: 8,
items: eval(checkboxitems)
});
_this.formHead.add(_this.myCheckboxGroup);
_this.formHead.doLayout();
}
if (this.opStatus == 'copyadd') {
this.LoadCopyData(this.editRecord.get('BSNO'),this.copyfee);
} else {
if (this.opStatus == 'edit')
this.LoadData(this.opStatus, condition);
}
//if (this.opStatus == 'add') {
// this.LoadPeriod('add');
//}
}
},
scope: this
});
}, //end InitData
LoadData: function (opstatus, condition) {
this.bodyDel = [];
this.opStatus = opstatus;
Ext.Ajax.request({
waitMsg: '正在查询主表数据...',
url: '/MvcShipping/MsOpOther/GetData',
params: {
handle: opstatus,
condition: condition
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
Ext.Msg.show({
title: '提示',
msg: result.Message,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
return;
}
data = result.data;
this.formHead.getForm().reset();
this.formHead.getForm().setValues(data);
this.formEdit.getForm().reset();
this.formEdit.getForm().setValues(data);
this.GetEditStatus();
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('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 (this.opStatus == 'copyadd')
this.CopyNewData(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} });
}
this.LoadPeriod(this.opStatus);
this.panelFee.EditRecord = this.editRecord;
this.panelFee.strBSNO = this.editRecord.get('BSNO');
this.panelFee.strMBLNO = this.editRecord.get('MBLNO');
this.panelFee.StoreUnit.load({ params: { BSNO: data.BSNO, bstype: "op_other" } });
this.panelFee.StoreDateCurr.load({ params: { optype: "op_other", BSNO: data.BSNO } });
this.panelFee.storeDrChFee.load({ params: { billno: data.BSNO, type: 1, optype: "op_other" } });
this.panelFee.storeCrChFee.load({ params: { billno: data.BSNO, type: 2, optype: "op_other" } });
this.panelFee.storeBodySum.load({
params: { bsno: data.BSNO, optype: "op_other" },
callback: function (r, options, success) {
if (success) {
_thisfee.setTotalHead();
}
}
});
this.panelFee.storeChFeeGain.load({ params: { bsno: data.BSNO, optype: "op_other" } });
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
var billno = '*';
var gid = '*';
if (this.opStatus == 'edit') {
billno = this.editRecord.get('BSNO');
}
},
LoadCopyData: function (bsno, CopyFee) {
Ext.Ajax.request({
waitMsg: '正在查询主表数据...',
url: '/MvcShipping/MsOpOther/GetCopyData',
params: {
condition: "BSNO='" + bsno + "'",
copyfee: CopyFee
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
Ext.Msg.show({
title: '提示',
msg: result.Message,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
return;
}
data = result.data;
//this.LoadInit(data);
this.formHead.getForm().reset();
this.formHead.getForm().setValues(data);
this.formEdit.getForm().reset();
this.formEdit.getForm().setValues(data);
this.opStatus = 'add';
var arrNewRecords = this.storePLList.add(data);
this.editRecord = arrNewRecords[0];
this.Editdata = data;
this.GetEditStatus();
this.LoadPeriod(this.opStatus);
this.panelFee.EditRecord = this.editRecord;
this.panelFee.strBSNO = this.editRecord.get('BSNO');
this.panelFee.strMBLNO = this.editRecord.get('MBLNO');
this.panelFee.StoreUnit.load({ params: { BSNO: data.BSNO, bstype: "op_other" } });
this.panelFee.StoreDateCurr.load({ params: { optype: "op_other", BSNO: data.BSNO } });
this.panelFee.storeDrChFee.load({ params: { billno: data.BSNO, type: 1, optype: "op_other" } });
this.panelFee.storeCrChFee.load({ params: { billno: data.BSNO, type: 2, optype: "op_other" } });
this.panelFee.storeBodySum.load({
params: { bsno: data.BSNO, optype: "op_other" },
callback: function (r, options, success) {
if (success) {
_thisfee.setTotalHead();
}
}
});
this.panelFee.storeChFeeGain.load({ params: { bsno: data.BSNO, optype: "op_other" } });
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
},
CopyNewData: function () {
var basicForm = this.formHead.getForm();
this.opStatus = 'add';
basicForm.findField('BSNO').setDisabled(false);
var BSNO = NewGuid();
var field = basicForm.findField('BSNO');
field.setValue(BSNO);
basicForm.findField('BSNO').setDisabled(true);
field = basicForm.findField('CUSTNO');
field.setValue('');
field = basicForm.findField('OP');
field.setValue(SHOWNAME);
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);
this.GetEditStatus();
this.LoadPeriodStatus(this.opStatus);
this.panelFee.strBSNO = BSNO;
this.panelFee.storeDrChFee.removeAll();
this.panelFee.storeCrChFee.removeAll();
},
CopyNew: function (type) {
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 jsonDelBody = ConvertRecordsToJsonAll(this.bodyDel);
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);
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/MvcShipping/MsOpOther/Save',
scope: this,
params: {
opstatus: this.opStatus,
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);
if (this.opStatus == 'add') {
var arrNewRecords = this.StoreList.add(returnData);
this.editRecord = arrNewRecords[0];
}
else if (this.opStatus == 'edit') {
var editp = Ext.create('MsOpOtherEntity', 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();
}
var basicForm = this.formHead.getForm();
this.opStatus = 'add';
basicForm.findField('BSNO').setDisabled(false);
var field = basicForm.findField('BSNO');
var oldbsno = field.getValue();
this.LoadCopyData(oldbsno, this.copyfee);
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 == 'pnlmodOpOtherInfo') {
// this.tabSeaepanel.setActiveTab(i);
} else {
children.items[i].close();
}
}
}
}
this.tabOtherPanel.doLayout();
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
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.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 jsonDelBody = ConvertRecordsToJsonAll(this.bodyDel);
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);
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/MvcShipping/MsOpOther/Save',
scope: this,
params: {
opstatus: this.opStatus,
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);
if (this.opStatus == 'add') {
var arrNewRecords = this.StoreList.add(returnData);
this.editRecord = arrNewRecords[0];
}
else if (this.opStatus == 'edit') {
var editp = Ext.create('MsOpOtherEntity', 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.LoadPeriodStatus(this.opStatus);
this.panelFee.EditRecord = this.editRecord;
this.panelFee.strBSNO = this.editRecord.get('BSNO');
this.panelFee.strMBLNO = this.editRecord.get('MBLNO');
this.panelFee.StoreUnit.load({ params: { BSNO: data.BSNO, bstype: "op_other" } });
this.panelFee.StoreDateCurr.load({ params: { optype: "op_other", BSNO: data.BSNO } });
} else if (type == '1') {
this.opStatus = 'edit';
window.close();
} else if (type == '2') {
this.LoadData('add', '');
}
this.panelFee.onPostDetailClick('', '', 1);
this.panelFee.onPostDetailClick('', '', 2);
} 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 清空委托编号
ClearCustNo: function () {
var CUSTNO = this.formHead.getForm().findField('CUSTNO').getValue();
Ext.Ajax.request({
waitMsg: '正在查询委托编号状态...', //'正在查询委托编号状态...',
url: '/MvcShipping/MsSysBillNoSet/DeleteBsNo',
params: {
custno: CUSTNO
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (result.Success != true) {
} else {
this.formHead.getForm().findField('CUSTNO').setValue('');
}
} else {
Ext.MessageBox.alert('服务器响应出错...', response.responseText);
}
},
scope: this
});
},
//#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();
//
_this = this;
if (BSSTATUSREF == "锁定") {
canedit = false;
this.setSaveBtnStatus(canedit);
} else {
this.StoreOpRange.load({ params: { optype: "modOpOtherList" },
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;
Ext.Ajax.request({
waitMsg: Zi.LAN.ZhengZaiChaXunShuJu, //'正在查询委托编号状态...',
url: '/MvcShipping/MsSysBillNoSet/GetData',
params: {
condition: "OPLBNAME='综合业务' AND RULEBLNO='委托编号'",
handle: 'edit'
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (result.Success != true) {
var custno = _this.formHead.getForm().findField('CUSTNO');
custno.setReadOnly(true);
} else {
var data = result.data;
if (data.ISEDIT == '1') {
var custno = _this.formHead.getForm().findField('CUSTNO');
custno.setReadOnly(false);
_this.GetFeeCustNoStatus();
;
} else {
if (data.RULEBLNO == '') {
var custno = _this.formHead.getForm().findField('CUSTNO');
custno.setReadOnly(false);
} else {
var custno = _this.formHead.getForm().findField('CUSTNO');
custno.setReadOnly(true);
}
_this.GetFeeCustNoStatus();
}
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
},
GetFeeCustNoStatus: function () {
var BSNO = this.formHead.getForm().findField('BSNO').getValue();
var custno = _this.formHead.getForm().findField('CUSTNO');
Ext.Ajax.request({
waitMsg: '',
url: '/MvcShipping/MsBaseInfo/GetFeeCustNoEnable',
params: {
bsno: BSNO,
custno: custno
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (result.Success == true) {
custno.setReadOnly(true);
}
} else {
}
},
scope: this
});
},
LoadDefValue: function () {
this.storeDefValue.load({ params: { condition: "BSTYPE='综合业务'" },
callback: function (r, options, success) {
if (success) {
if (this.storeDefValue.getCount() > 0) {
for (var j = 0; j < this.storeDefValue.getCount(); j += 1) {
var member = this.storeDefValue.getAt(j);
var headfield = this.formHead.getForm().findField(member.data.FIELDNAME);
if (headfield != NaN && headfield != null)
headfield.setValue(member.data.DEFVALUE);
var headfield = this.formEdit.getForm().findField(member.data.FIELDNAME);
if (headfield != NaN && headfield != null)
headfield.setValue(member.data.DEFVALUE);
};
} else {
}
}
},
scope: this
});
this.GetEditStatus();
this.formHead.getForm().findField("OPLBNAME").setValue("快递业务");
},
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
});
},
setSaveBtnStatus: function (enable) {
var btnESave = Ext.getCmp('btnESave');
var btnESaveAndClose = Ext.getCmp('btnESaveAndClose');
var btnESaveAndNew = Ext.getCmp('btnESaveAndNew');
if (enable) {
btnESave.enable();
btnESaveAndClose.enable();
btnESaveAndNew.enable();
} else {
btnESave.disable();
btnESaveAndClose.disable();
btnESaveAndNew.disable();
}
},
//#region 上一票,下一票
PrevRecord: function () {
var j = this.StoreList.indexOf(this.editRecord);
if (j == 0) {
Ext.Msg.show({ title:'警告', msg:'已经是最前一票', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); //'警告', '已是最前一票'
return;
}
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 == 'pnlmodOpOtherInfo') {
// this.tabSeaepanel.setActiveTab(i);
} else {
children.items[i].close();
}
}
}
}
this.tabOtherPanel.doLayout();
j = j - 1;
this.editRecord = this.StoreList.getAt(j);
if (this.opStatus == 'edit') {
condition = "BSNO='" + this.editRecord.get('BSNO') + "'";
//this.storeBodyList.load({ params: { condition: condition} });
}
this.LoadData(this.opStatus, condition);
},
NextRecord: function () {
var j = this.StoreList.indexOf(this.editRecord);
if (j == (this.StoreList.data.length - 1)) {
Ext.Msg.show({ title: '警告', msg: '已经是最后一票', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); //'警告', '已是最后一票'
return;
}
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 == 'pnlmodOpOtherInfo') {
//this.tabSeaepanel.setActiveTab(i);
} else {
children.items[i].close();
}
}
}
}
this.tabOtherPanel.doLayout();
j = j + 1;
this.editRecord = this.StoreList.getAt(j);
if (this.opStatus == 'edit') {
condition = "BSNO='" + this.editRecord.get('BSNO') + "'";
//this.storeBodyList.load({ params: { condition: condition} });
}
this.LoadData(this.opStatus, condition);
},
//#endregion
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 '';
}
});