Ext.namespace('Shipping');
Shipping.MsOpSeaiSaleEdit = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsOpSeaiSaleEdit.superclass.constructor.call(this);
};
Ext.extend(Shipping.MsOpSeaiSaleEdit, Ext.Panel, {
ParentWin: null,
OpStatus: 'add',
StoreList: null,
EditRecord: null,
Editdata: null,
MainEditRecord: null,
stroplb: '海运进口',
isfen: false,
initUIComponents: function () {
this.itemindex = 1;
this.storecodeservice = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsCodeOpService',
proxy: { url: '/MvcShipping/MsCodeOpService/GetDataList' }
});
//#region formSearch 下拉框信息加载
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.StoreOpRange = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsOP',
proxy: { url: '/MvcShipping/MsBaseInfo/GetOpRang' }
});
this.StoreOpRange.load({ params: { optype: "modSeaImportList"} });
//客服
this.storeCUSTSERVICECode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.UserRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetUserRefList' }
});
this.storeCUSTSERVICECode.load();
this.comboxCUSTSERVICE = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '客服',
store: this.storeCUSTSERVICECode,
forceSelection: true,
id: 'CUSTSERVICE',
name: 'CUSTSERVICE',
valueField: 'UserName',
displayField: 'CodeAndName'
});
//揽货人
this.storeSALECode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.UserRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetUserRefList' }
});
this.storeSALECode.load();
this.comboxSALE = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '揽货人',
store: this.storeSALECode,
forceSelection: true,
id: 'SALE',
name: 'SALE',
valueField: 'UserName',
displayField: 'CodeAndName',
value: SHOWNAME
});
//操 作
this.storeOpCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.UserRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetUserRefList' }
});
this.storeOpCode.load();
this.comboxOP = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '操 作',
store: this.storeOpCode,
forceSelection: true,
id: 'OP',
name: 'OP',
valueField: 'UserName',
displayField: 'CodeAndName',
value: SHOWNAME,
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
var rec = records[0].data;
//alert(rec.DEPTNAME);
var DEPTNAME = rec.DEPTNAME;
Ext.getCmp("SALEDEPT").setValue(DEPTNAME);
}
}
}
});
//录入人
this.storeINPUTBYCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.UserRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetUserRefList' }
});
this.storeINPUTBYCode.load();
this.comboxINPUTBY = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '录入人',
store: this.storeINPUTBYCode,
forceSelection: true,
id: 'INPUTBY',
name: 'INPUTBY',
valueField: 'UserName',
displayField: 'CodeAndName',
value: SHOWNAME,
hidden: true
});
//仓储出库货主
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: 'CUSTOMERNAME_WMS',
name: 'CUSTOMERNAME_WMS',
valueField: 'CustName',
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,
id: 'CUSTOMERNAME',
name: 'CUSTOMERNAME',
valueField: 'CustName',
displayField: 'CodeAndName',
allowBlank: false,
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
var data = combo.value;
var s = "LINKID in (select gid from [info_client] where SHORTNAME='" + combo.value + "')";
this.storeInfoClientContact.load({ params: { condition: s} });
this.storeShipper.load({ params: { condition: "shippertype=2 AND (ISPUBLIC=1 OR CODENAME IN (SELECT CODENAME FROM info_client WHERE SHORTNAME='" + combo.value + "') )"} });
this.storeConsignee.load({ params: { condition: "shippertype=1 AND (ISPUBLIC=1 OR CODENAME IN (SELECT CODENAME FROM info_client WHERE SHORTNAME='" + combo.value + "') )"} });
this.storenotifyparty.load({ params: { condition: "shippertype=3 AND (ISPUBLIC=1 OR CODENAME IN (SELECT CODENAME FROM info_client WHERE SHORTNAME='" + combo.value + "') )"} });
}
}
}
});
//委托单位_联系人
this.storeInfoClientContact = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.InfoClientContactModel',
proxy: { url: '/CommMng/BasicDataRef/GetInfoClientContactList' }
});
this.comboxInfoClientContact = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '联系人',
store: this.storeInfoClientContact,
id: 'SHOWNAME_Client',
name: 'SHOWNAME_Client',
valueField: 'SHOWNAME',
displayField: 'SHOWNAME',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
var Cargoinforecords = DsStoreQueryBy(this.storeInfoClientContact, 'GID', records[0].data.GID);
if (Cargoinforecords.getCount() > 0) {
var Cargoinfodata = Cargoinforecords.getAt(0).data;
// this.formHead.getForm().findField('EMAIL').setValue(Cargoinfodata.EMAIL);
this.formHead.getForm().findField('TEL').setValue(Cargoinfodata.TEL);
// this.formHead.getForm().findField('FAX').setValue(Cargoinfodata.FAX);
} else {
// this.formHead.getForm().findField('EMAIL').setValue('');
this.formHead.getForm().findField('TEL').setValue('');
// this.formHead.getForm().findField('FAX').setValue('');
}
}
}
}
});
//客户加载_贸易代理
this.storeTRADINGAGENCY = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
this.storeTRADINGAGENCY.load({ params: { condition: "ISTRADINGAGENCY='1'"} });
this.comboxTRADINGAGENCY = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '贸易代理',
store: this.storeTRADINGAGENCY,
forceSelection: true,
id: 'TRADINGAGENCY',
name: 'TRADINGAGENCY',
valueField: 'CustName',
displayField: 'CodeAndName'
});
//客户加载_船公司
this.storeCARRIER = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
this.storeCARRIER.load({ params: { condition: "ISCARRIER='1'"} });
this.comboxCARRIER = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '船公司',
store: this.storeCARRIER,
forceSelection: true,
id: 'CARRIER',
name: 'CARRIER',
valueField: 'CustName',
displayField: 'CodeAndName'
});
//客户加载_车队
this.storeTRUCKER = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
this.storeTRUCKER.load({ params: { condition: "ISTRUCK='1'"} });
this.comboxTRUCKER = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '车队',
store: this.storeTRUCKER,
forceSelection: true,
id: 'TRUCKER',
name: 'TRUCKER',
valueField: 'CustName',
displayField: 'CodeAndName'
});
//客户加载_报关
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'
});
this.comboxCustENTERP = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '经营单位',
store: this.storeCustCode,
forceSelection: true,
name: 'ENTERP',
valueField: 'CustName',
displayField: 'CodeAndName'
});
//客户加载_报检
this.storeINSPECTION = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
this.storeINSPECTION.load({ params: { condition: "ISCUSTOM='1'"} });
this.comboxINSPECTION = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '报检',
store: this.storeINSPECTION,
forceSelection: true,
id: 'INSPECTION',
name: 'INSPECTION',
valueField: 'CustName',
displayField: 'CodeAndName'
});
//键值维护表_贸易方式
this.storeCrmKeyCodeCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CrmKeyCodeModel',
proxy: { url: '/CommMng/BasicDataRef/GetCrmKeyCodeList' }
});
this.storeCrmKeyCodeCode.load({ params: { condition: " and KEYTYPE='贸易方式'"} });
this.comboxTRADETYPE = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '贸易方式',
store: this.storeCrmKeyCodeCode,
forceSelection: true,
id: 'TRADETYPE',
name: 'TRADETYPE',
valueField: 'KEYVALUE',
displayField: 'KEYVALUE'
});
this.storeTRADETERM = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeTRADETERM.load({ params: { enumTypeId: 97023} });
this.comboxTRADETERM = Ext.create('DsExt.ux.RefEnumCombox', {
fieldLabel: '贸易条款',
store: this.storeTRADETERM,
forceSelection: true,
name: 'TRADETERM'
});
//键值维护表_仓储类型
this.storeCrmKeyCodeCode2 = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CrmKeyCodeModel',
proxy: { url: '/CommMng/BasicDataRef/GetCrmKeyCodeList' }
});
this.storeCrmKeyCodeCode2.load({ params: { condition: " and KEYTYPE='仓储类型'"} });
this.comboxWMSTYPE = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '仓储类型',
store: this.storeCrmKeyCodeCode2,
forceSelection: true,
id: 'WMSTYPE',
name: 'WMSTYPE',
valueField: 'KEYVALUE',
displayField: 'KEYVALUE'
});
//键值维护表_装运方式
this.storeCrmKeyCodeCode3 = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CrmKeyCodeModel',
proxy: { url: '/CommMng/BasicDataRef/GetCrmKeyCodeList' }
});
this.storeCrmKeyCodeCode3.load({ params: { condition: " and KEYTYPE='装运方式'"} });
this.comboxBLTYPE = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '装运方式',
store: this.storeCrmKeyCodeCode3,
forceSelection: true,
id: 'BLTYPE',
name: 'BLTYPE',
valueField: 'KEYVALUE',
displayField: 'KEYVALUE',
value: '整箱',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
if (combo.value == "拼箱单票" || combo.value == "拼箱分票") {
if (this.storeBodyList.getCount() > 0) {
combo.setValue(combo.originalValue);
alert("拼箱单票、拼箱分票是不允许添加集装箱信息的,因此请先删除集装箱信息!");
return;
}
else {
this.panelBodyChFee.hide();
}
this.formEdit.getForm().findField('CNTRTOTAL').setValue('LCL');
}
else {
this.panelBodyChFee.show();
}
//
}
}
}
});
//键值维护表_委托单类型
this.storeCrmKeyCodeCode4 = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CrmKeyCodeModel',
proxy: { url: '/CommMng/BasicDataRef/GetCrmKeyCodeList' }
});
this.storeCrmKeyCodeCode4.load({ params: { condition: " and KEYTYPE='委托单类型'"} });
this.comboxBSTYPE = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '委托单类型',
store: this.storeCrmKeyCodeCode4,
forceSelection: true,
id: 'BSTYPE',
name: 'BSTYPE',
valueField: 'KEYVALUE',
displayField: 'KEYVALUE',
value: '普通货',
readOnly: true
});
//品名类型
this.storeCodeGoodsType = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CodeGoodsTypeModel',
proxy: { url: '/CommMng/BasicDataRef/GetCodeGoodsTypeList' }
});
this.storeCodeGoodsType.load();
this.comboxGOODSTYPENAME = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '品名类型',
store: this.storeCodeGoodsType,
forceSelection: true,
id: 'GOODSTYPENAME',
name: 'GOODSTYPENAME',
valueField: 'GoodsTypeName',
displayField: 'CodeAndName',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
var data = combo.value;
var s = "GoodsTypeGID in (select gid from [code_goodsType] where GOODSTYPENAME='" + combo.value + "')";
this.storeCodeGoodsList.load({ params: { condition: s} });
}
}
}
});
//品名
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,
id: 'GOODSNAME',
name: 'GOODSNAME',
valueField: 'GOODNAME',
displayField: 'CodeAndName',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
var Cargoinforecords = DsStoreQueryBy(this.storeCodeGoodsList, 'GOODNAME', records[0].data.GOODNAME);
if (Cargoinforecords.getCount() > 0) {
var Cargoinfodata = Cargoinforecords.getAt(0).data;
this.formEdit.getForm().findField('GOODSTYPENAME').setValue(Cargoinfodata.GoodsTypeName);
} else {
this.formEdit.getForm().findField('GOODSTYPENAME').setValue('');
}
}
}
}
});
//业务来源
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,
id: 'BSSOURCE',
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.storeSourceDetail.load();
this.comboxBSSOURCEDETAIL = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '贸易条款',
store: this.storeSourceDetail,
forceSelection: true,
id: 'BSSOURCEDETAIL',
name: 'BSSOURCEDETAIL',
valueField: 'SourceDetail',
displayField: 'SourceDetail'
});
//状态_业务状态
Ext.define('BSSTATUSModel', {
extend: 'Ext.data.Model',
fields: [
{ name: 'Name', type: 'string' }
]
});
var dataBSSTATUS = [{ "Name": "未锁定" }, { "Name": "锁定" }, { "Name": ""}];
var storeBSSTATUS = Ext.create('Ext.data.Store', {
model: 'BSSTATUSModel',
data: dataBSSTATUS
});
//业务状态
this.comboxBSSTATUS = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '业务状态',
forceSelection: true,
store: storeBSSTATUS,
id: 'BSSTATUS',
name: 'BSSTATUS',
valueField: 'Name',
displayField: 'Name'
});
//费用状态
this.comboxFEESTATUS = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '费用状态',
forceSelection: true,
store: storeBSSTATUS,
id: 'FEESTATUS',
name: 'FEESTATUS',
valueField: 'Name',
displayField: 'Name'
});
//所属部门
this.storeDept = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.DeptModel',
proxy: { url: '/CommMng/BasicDataRef/GetDeptList' }
});
this.storeDept.load();
this.comboxDept = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '所属部门',
store: this.storeDept,
forceSelection: true,
id: 'SALEDEPT',
name: 'SALEDEPT',
valueField: 'DeptName',
displayField: 'DeptName'
//,hidden: true
});
//国际港口(进口装货港、出口卸货港)
this.storeCodeDisport = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CodeDisportModel',
proxy: { url: '/CommMng/BasicDataRef/GetCodeDisportList' }
});
this.storeCodeDisport.load();
this.comboxPORTLOAD = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '装货港',
store: this.storeCodeDisport,
forceSelection: true,
id: 'PORTLOAD',
name: 'PORTLOAD',
valueField: 'PORT',
displayField: 'CodeAndName',
matchFieldWidth: false, //下拉款自适应宽度
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
if (records[0].data.EDICODE.toString().trim() != "") {
this.formBill.getForm().findField('PORTLOADID').setValue(records[0].data.EDICODE);
}
//
var BLFRT = this.formBill.getForm().findField('BLFRT').getValue();
if (BLFRT.indexOf("PREPAID") > -1) {
this.formBill.getForm().findField('PREPARDAT').setValue(combo.value.toString()); //预付
this.formBill.getForm().findField('PAYABLEAT').setValue(''); //到付
this.formBill.getForm().findField('ISSUEPLACE').setValue(combo.value.toString()); //签单
//this.formBill.getForm().findField('ISSUEPLACEID').setValue(portloadid);
}
}
}
}
//
});
//国内港口(出口装货港、进口卸货港)
this.storeCodeLoadport = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CodeLoadportModel',
proxy: { url: '/CommMng/BasicDataRef/GetCodeLoadportList' }
});
this.storeCodeLoadport.load();
this.comboxPORTDISCHARGE = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '卸货港',
store: this.storeCodeLoadport,
//forceSelection: true,
id: 'PORTDISCHARGE',
name: 'PORTDISCHARGE',
valueField: 'PORT',
displayField: 'CodeAndName',
matchFieldWidth: false, //下拉款自适应宽度
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
if (records[0].data.EDICODE.toString().trim() != "") {
this.formBill.getForm().findField('PORTDISCHARGEID').setValue(records[0].data.EDICODE);
this.formBill.getForm().findField('DESTINATIONID').setValue(records[0].data.EDICODE);
this.formBill.getForm().findField('PLACEDELIVERYID').setValue(records[0].data.EDICODE);
}
if (records[0].data.PORT.toString().trim() != "") {
this.formBill.getForm().findField('DESTINATION').setValue(records[0].data.PORT);
this.formBill.getForm().findField('PLACEDELIVERY').setValue(records[0].data.PORT);
}
//
var BLFRT = this.formBill.getForm().findField('BLFRT').getValue();
if (BLFRT.indexOf("COLLECT") > -1) {
this.formBill.getForm().findField('PREPARDAT').setValue(''); //预付
this.formBill.getForm().findField('PAYABLEAT').setValue(combo.value.toString()); //到付
this.formBill.getForm().findField('ISSUEPLACE').setValue(combo.value.toString()); //签单
//this.formBill.getForm().findField('ISSUEPLACEID').setValue(PORTDISCHARGEID);
}
}
}
}
//
});
//客户加载_场站
this.storeYARD = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
//船公司
this.comboxYARD = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '场站',
store: this.storeYARD,
forceSelection: true,
name: 'YARD',
valueField: 'CustName',
displayField: 'CodeAndName'
});
//客户加载_订舱代理
this.storeFORWARDER = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
//货代
this.comboxFORWARDER = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '货代',
store: this.storeFORWARDER,
forceSelection: true,
name: 'FORWARDER',
valueField: 'CustName',
displayField: 'CodeAndName'
});
//客户加载_订舱代理
this.storeAGENT = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
//货代
this.comboxAGENT = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '国外代理',
store: this.storeAGENT,
forceSelection: true,
name: 'AGENTID',
valueField: 'CustName',
displayField: 'CodeAndName'
});
//件数包装
this.storeCodePackage = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CodePackageModel',
proxy: { url: '/CommMng/BasicDataRef/GetCodePackageList' }
});
this.storeCodePackage.load();
this.comboxKINDPKGS = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '件数包装',
store: this.storeCodePackage,
forceSelection: true,
id: 'KINDPKGS',
name: 'KINDPKGS',
valueField: 'PKGS',
displayField: 'PKGS'
});
//件数包装_集装箱列表中的下拉框加载
this.storeCodePackage_CTN = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CodePackageModel',
proxy: { url: '/CommMng/BasicDataRef/GetCodePackageList' }
});
this.storeCodePackage_CTN.load();
this.comboxKINDPKGS_CTN = Ext.create('DsExt.ux.RefTableCombox', {
//fieldLabel: '件数包装',
store: this.storeCodePackage_CTN,
forceSelection: true,
id: 'KINDPKGS_CTN',
name: 'KINDPKGS_CTN',
valueField: 'PKGS',
displayField: 'PKGS'
});
//箱型_集装箱列表中的下拉框加载
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,
forceSelection: true,
id: 'CTNALL',
name: 'CTNALL',
valueField: 'CTN',
displayField: 'CTN'
});
//计费单位
Ext.define('UNITOFWEIGHTModel', {
extend: 'Ext.data.Model',
fields: [
{ name: 'Name', type: 'string' }
]
});
var dataUNITOFWEIGHT = [{ "Name": "吨" }, { "Name": "CBM" }, { "Name": "千克" }, { "Name": ""}];
var storeUNITOFWEIGHT = Ext.create('Ext.data.Store', {
model: 'UNITOFWEIGHTModel',
data: dataUNITOFWEIGHT
});
this.comboxUNITOFWEIGHT = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '计费单位',
forceSelection: true,
store: storeUNITOFWEIGHT,
id: 'UNITOFWEIGHT',
name: 'UNITOFWEIGHT',
valueField: 'Name',
displayField: 'Name'
});
//币别
this.storeCodeCurrency = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CodeCurrencyModel',
proxy: { url: '/CommMng/BasicDataRef/GetCodeCurrencyList' }
});
this.storeCodeCurrency.load();
this.comboxCodeCurrency = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '币别',
store: this.storeCodeCurrency,
forceSelection: true,
flex: 0.4,
labelWidth: 40,
id: 'CURRENCY',
name: 'CURRENCY',
valueField: 'CODENAME',
displayField: 'CODENAME'
});
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.storeLANE = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.Lane',
proxy: { url: '/CommMng/BasicDataRef/GetCodeLaneList' }
});
this.storeLANE.load();
this.comboxLANE = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '航线',
store: this.storeLANE,
// forceSelection: true,
name: 'LANE',
valueField: 'LANE',
displayField: 'LANE'
});
this.storeINSPECTSERVICE = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeINSPECTSERVICE.load({ params: { enumTypeId: 97024} });
this.comboxINSPECTSERVICE = Ext.create('DsExt.ux.RefEnumCombox', {
fieldLabel: '报检项目',
store: this.storeINSPECTSERVICE,
forceSelection: true,
name: 'INSPECTSERVICE'
});
//#endregion
//#region 编辑formHead 基本信息
this.formHead = Ext.widget('form', {
region: 'north',
frame: true,
bodyPadding: 5,
trackResetOnLoad: true,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 70,
msgTarget: 'qtip'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '业务编号',
name: 'BSNO',
hidden: true,
value: 'topseai' + NewGuid().toString().replace(/-/g, '')
}, {
fieldLabel: '业务编号',
name: 'MASTERNO', hidden: true
}, {
fieldLabel: '业务锁定',
readOnly: true,
name: 'BSSTATUSREF'
}, {
fieldLabel: '费用锁定',
readOnly: true,
name: 'FEESTATUSREF'
}, {
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',
name: 'BSDATE',
value: Ext.util.Format.date(Ext.Date.add(new Date(), Ext.Date.MONTH - 1, 1), "Y-m-d")
}, this.comboxINPUTBY]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxCustCode, this.comboxBLTYPE, this.comboxBSSOURCE, this.comboxBSSOURCEDETAIL]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxStlName, {
fieldLabel: '结算日期',
format: 'Y-m-d',
flex: 1,
xtype: 'datefield',
name: 'STLDATE'
}, this.comboxInfoClientContact, {
fieldLabel: 'TEL',
name: 'TEL'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '委托编号',
name: 'CUSTNO'
}, {
fieldLabel: '主提单号',
name: 'MBLNO'
}, {
fieldLabel: '分提单号',
name: 'HBLNO'
}, {
fieldLabel: '业务编号',
name: 'ORDERNO'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxOP, this.comboxSALE, this.comboxCUSTSERVICE, this.comboxDept]
}]//end items(fieldset 1)
}); //end this.formEdit
//#endregion
//#region 编辑formEdit 货物信息
this.formEdit = Ext.widget('form', {
title: '货物信息',
region: 'north',
height: 360,
frame: true,
bodyPadding: 5,
trackResetOnLoad: true,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 70,
msgTarget: 'qtip'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '船名',
name: 'VESSEL'
}, {
fieldLabel: '航次',
name: 'VOYNO'
}, this.comboxPORTLOAD, this.comboxPORTDISCHARGE, {
fieldLabel: '到港日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'ETD',
listeners: {
scope: this,
'blur': function (field) {
this.getBMDDATE();
this.getMDTDATE();
}
}
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '换单日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'CHANGEDOCDATE'
}, {
fieldLabel: '免箱期',
name: 'FBP',
id: 'FBP',
value: 0, blankText: '请填写数值!',
regex: /^(0|[1-9][0-9]*)$/,
regexText: '请输入正确的数值!',
listeners: {
scope: this,
'blur': function (field) {
this.getBMDDATE();
}
}
}, {
fieldLabel: '箱使到期日',
format: 'Y-m-d',
name: 'BMDDATE',
listeners: {
scope: this,
'onfocus': function (field) {
this.getBMDDATE2(field.getValue());
},
'blur': function (field) {
this.getBMDDATE2(field.getValue());
}
}
}, {
fieldLabel: '搬倒日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'MDTDATE',
listeners: {
scope: this,
'onfocus': function (field) {
this.getMDTDATE2(field.getValue());
},
'blur': function (field) {
this.getMDTDATE2(field.getValue());
}
}
}, this.comboxYARD]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxCARRIER, this.comboxLANE, this.comboxCustENTERP, this.comboxFORWARDER, this.comboxAGENT]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxTRUCKER, this.comboxGOODSNAME, this.comboxGOODSTYPENAME, {
fieldLabel: '原产地',
name: 'COUNTRYOFORIGIN'
}, {
fieldLabel: '牌号',
name: 'NUMBERPLATE'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '件数',
name: 'PKGS',
value: 0,
id: 'PKGS',
blankText: '请填写数值!',
allowBlank: false,
regex: /^\d+(\.\d{1,4})?$/,
regexText: '请输入正确的数值!'
}, this.comboxKINDPKGS, {
fieldLabel: '毛重',
name: 'KGS',
value: 0,
id: 'KGS',
blankText: '请填写数值!',
allowBlank: false,
regex: /^\d+(\.\d{1,4})?$/,
regexText: '请输入正确的数值!'
}, {
fieldLabel: '净重',
name: 'NETWEIGHT',
value: 0,
id: 'NETWEIGHT',
blankText: '请填写数值!',
allowBlank: false,
regex: /^\d+(\.\d{1,4})?$/,
regexText: '请输入正确的数值!'
}, {
fieldLabel: '尺码',
name: 'CBM',
value: 0,
id: 'CBM',
blankText: '请填写数值!',
allowBlank: false,
regex: /^\d+(\.\d{1,4})?$/,
regexText: '请输入正确的数值!'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '审批单号',
name: 'APPROVENO'
}, this.comboxUNITOFWEIGHT, this.comboxTRADETYPE, this.comboxTRADETERM, {
fieldLabel: '合同号',
name: 'CONTRACTNO'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxWMSTYPE, {
fieldLabel: 'BALES',
name: 'BALES'
}, {
fieldLabel: '箱型箱量',
readOnly: true,
name: 'CNTRTOTAL'
}, {
fieldLabel: '发票号',
name: 'INVNO'
}, { xtype: 'hiddenfield'}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxCUSTOMSER, {
fieldLabel: '报关单号',
name: 'CUSTOMNO'
}, {
fieldLabel: '通关日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'CUSTOMDATE'
}, {
fieldLabel: '申报日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'UPDATETIME'
}, {
fieldLabel: '交关税时间',
format: 'Y-m-d',
xtype: 'datefield',
name: 'TARRIFSPAIEDTIEM'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxINSPECTION, {
fieldLabel: '报检单号',
name: 'INSPECTIONNO'
}, {
fieldLabel: '报检日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'INSPECTIONDATE'
}, {
fieldLabel: '货值',
name: 'IMPORTVALUE',
value: 0,
id: 'IMPORTVALUE',
blankText: '请填写数值!',
allowBlank: false,
regex: /^\d+(\.\d{1,4})?$/,
regexText: '请输入正确的数值!',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
try {
var lsValue = usMoney(value, 2, '', false);
if (lsValue != "NaN") {
value = lsValue; if (parseFloat(lsValue) < 0) {
return '' + lsValue + '';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
}
}, {
fieldLabel: '单价',
name: 'UNITPRICE',
flex: 0.6,
value: 0,
id: 'UNITPRICE',
blankText: '请填写数值!',
allowBlank: false,
regex: /^\d+(\.\d{1,4})?$/,
regexText: '请输入正确的数值!',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
try {
var lsValue = usMoney(value, 2, '', false);
if (lsValue != "NaN") {
value = lsValue; if (parseFloat(lsValue) < 0) {
return '' + lsValue + '';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
}
}, this.comboxCodeCurrency]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '报关票数',
name: 'CUSTOMSNUM',
value: 0,
regex: /^\d+(\.\d{1,4})?$/,
regexText: '请输入正确的数值!'
}, {
fieldLabel: '是否多品名',
inputValue: true,
xtype: 'checkboxfield',
name: 'ISMOREGOOD'
}, this.comboxINSPECTSERVICE, { xtype: 'hiddenfield' }, { xtype: 'hiddenfield'}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textarea',
items: [{
fieldLabel: '备注',
height: 54,
name: 'REMARK',
flex: 4
}]//, { xtype: 'hiddenfield'}
}]//end items(fieldset 1)
}); //end this.formEdit
//#endregion
//#region 空白form信息
this.formBlank = Ext.widget('form', {
region: 'south',
height: 50,
frame: true,
items: [{ xtype: 'container'}]
});
//#endregion
//#region 危险品信息
this.panelBodyDr = new Ext.Panel({
title: '危险品信息',
layout: "border",
hidden: true,
height: 60,
frame: true,
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
defaults: {
anchor: '96%'
},
items: [{
fieldLabel: '危险品等级',
flex: 1,
labelWidth: 70,
name: 'DCLASS'
}, {
fieldLabel: '危险品编号',
flex: 1,
labelWidth: 70,
name: 'DUNNO'
}, {
fieldLabel: '危险品页号',
flex: 1,
labelWidth: 70,
name: 'DPAGE'
}, {
fieldLabel: '危险品标签',
flex: 1,
labelWidth: 70,
name: 'DLABEL'
}, {
fieldLabel: '危险品联系人',
flex: 1,
labelWidth: 90,
name: 'LINKMAN'
}]
}]
});
this.panelBodyRf = new Ext.Panel({
title: '冻柜信息',
layout: "border",
hidden: true,
height: 60,
//margin: '5 10',
frame: true,
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '冷藏通风量',
name: 'REEFERF'
}, {
fieldLabel: '设置温度',
name: 'TEMPSET'
}, {
fieldLabel: '温度单位',
name: 'TEMPID'
}]
}]
});
this.StoreCargoid = Ext.create('Ext.data.Store', {
fields: ['ID', 'NAME']
});
this.StoreCargoid.add({ "ID": "S", "NAME": "S普通货" });
this.StoreCargoid.add({ "ID": "R", "NAME": "R冻柜" });
this.StoreCargoid.add({ "ID": "D", "NAME": "D危险品" });
this.StoreCargoid.add({ "ID": "O", "NAME": "O超限箱" });
this.comboxCargoid = Ext.create('DsExt.ux.RefTableCombox', {
store: this.StoreCargoid,
fieldLabel: '货物标示',
forceSelection: true,
name: 'CARGOID',
valueField: 'ID',
displayField: 'NAME',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
if (combo.value == 'R') {
this.panelBodyDr.setVisible(false);
this.panelBodyRf.setVisible(true);
} else if (combo.value == 'D') {
this.panelBodyDr.setVisible(true);
this.panelBodyRf.setVisible(false);
} else {
this.panelBodyDr.setVisible(false);
this.panelBodyRf.setVisible(false);
}
}
}
}
});
//#endregion
//#region 收、发货人通知人
//客户加载_发货人
this.storeShipper = Ext.create('DsExt.ux.RefTableStore', {
model: 'OpSeaeShipper',
proxy: { url: '/MvcShipping/MsOpSeae/GetShipperList' }
});
// this.storeShipper.load({ params: { condition: "ISCONTROLLER='1'"} });
//发货人
this.comboxShipper = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: 'Shipper (发货人)',
store: this.storeShipper,
// forceSelection: true,
labelWidth: 150,
labelAlign: 'left',
name: 'SHIPPERID',
valueField: 'SHORTNAME',
displayField: 'CodeAndName',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
var selectrecords = DsStoreQueryBy(this.storeShipper, 'SHORTNAME', combo.value);
if (selectrecords.getCount() > 0) {
var selectdata = selectrecords.getAt(0).data;
this.formBill.getForm().findField('SHIPPER').setValue(selectdata.SHIPPERDETAIL);
} else {
this.formBill.getForm().findField('SHIPPER').setValue('');
}
}
}
}
});
//客户加载_收货人
this.storeConsignee = Ext.create('DsExt.ux.RefTableStore', {
model: 'OpSeaeShipper',
proxy: { url: '/MvcShipping/MsOpSeae/GetShipperList' }
});
// this.storeShipper.load({ params: { condition: "ISCONTROLLER='1'"} });
//收货人
this.comboxConsignee = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: 'Consignee (收货人)',
labelWidth: 150,
labelAlign: 'left',
store: this.storeConsignee,
// forceSelection: true,
name: 'CONSIGNEEID',
valueField: 'SHORTNAME',
displayField: 'CodeAndName',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
var selectrecords = DsStoreQueryBy(this.storeConsignee, 'SHORTNAME', combo.value);
if (selectrecords.getCount() > 0) {
var selectdata = selectrecords.getAt(0).data;
this.formBill.getForm().findField('CONSIGNEE').setValue(selectdata.SHIPPERDETAIL);
} else {
this.formBill.getForm().findField('CONSIGNEE').setValue('');
}
}
}
}
});
//客户加载_通知人
this.storenotifyparty = Ext.create('DsExt.ux.RefTableStore', {
model: 'OpSeaeShipper',
proxy: { url: '/MvcShipping/MsOpSeae/GetShipperList' }
});
// this.storeShipper.load({ params: { condition: "ISCONTROLLER='1'"} });
//通知人
this.comboxNotifyParty = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: 'Notify Party (通知人)',
store: this.storenotifyparty,
labelWidth: 150,
labelAlign: 'left',
// forceSelection: true,
name: 'NOTIFYPARTYID',
valueField: 'SHORTNAME',
displayField: 'CodeAndName',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
var selectrecords = DsStoreQueryBy(this.storenotifyparty, 'SHORTNAME', combo.value);
if (selectrecords.getCount() > 0) {
var selectdata = selectrecords.getAt(0).data;
this.formBill.getForm().findField('NOTIFYPARTY').setValue(selectdata.SHIPPERDETAIL);
} else {
this.formBill.getForm().findField('NOTIFYPARTY').setValue('');
}
}
}
}
});
//#endregion
//#region 编辑formbill 基本信息
this.formBill = Ext.widget('form', {
region: 'north',
frame: true,
bodyPadding: 5,
layout: 'anchor',
trackResetOnLoad: true,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 70,
msgTarget: 'qtip'
},
items: [{
xtype: 'fieldset',
defaultType: 'textfield',
layout: 'hbox',
defaults: {
anchor: '96%'
},
items: [{
xtype: 'container',
layout: 'anchor',
flex: 1,
defaultType: 'textfield',
items: [this.comboxShipper, {
xtype: 'textareafield',
grow: true,
labelWidth: 0,
height: 90,
name: 'SHIPPER',
anchor: '100%'
}, this.comboxConsignee, {
xtype: 'textareafield',
grow: true,
labelWidth: 0,
height: 90,
name: 'CONSIGNEE',
anchor: '100%'
}, this.comboxNotifyParty, {
xtype: 'textareafield',
grow: true,
labelWidth: 0,
height: 90,
name: 'NOTIFYPARTY',
anchor: '100%'
}
]
}, {
xtype: 'container',
layout: 'anchor',
flex: 1,
defaultType: 'textfield',
defaults: {
anchor: '99%'
},
items: [{
xtype: 'container',
defaultType: 'textfield',
layout: 'hbox',
items: [{
fieldLabel: '开船日期',
format: 'Y-m-d',
flex: 1,
xtype: 'datefield',
name: 'ETA'//'ETD'
}, {
fieldLabel: '装港代码',
name: 'PORTLOADID'
}, {
fieldLabel: '卸港代码',
name: 'PORTDISCHARGEID'
}]
}, {
xtype: 'container',
defaultType: 'textfield',
layout: 'hbox',
items: [{
fieldLabel: '目的代码',
name: 'DESTINATIONID'
}, {
fieldLabel: '目的地',
name: 'DESTINATION'
}]
}, {
xtype: 'container',
defaultType: 'textfield',
layout: 'hbox',
items: [{
fieldLabel: '交货代码',
name: 'PLACEDELIVERYID'
}, {
fieldLabel: '交货地',
name: 'PLACEDELIVERY'
}]
}
]
}
]
}, {
xtype: 'container',
layout: 'anchor',
flex: 1,
defaultType: 'textfield',
defaults: {
anchor: '99%'
},
items: [{
xtype: 'container',
defaultType: 'textfield',
layout: 'hbox',
items: [{
xtype: 'container',
layout: 'anchor',
flex: 1,
defaultType: 'textfield',
items: [{
xtype: 'label',
html: 'Seal No.(封志号)
Marks & Nos.(标记与号码) '
}, {
xtype: 'textareafield',
grow: true,
height: 250,
name: 'MARKS',
anchor: '100%'
}
]
}, {
xtype: 'container',
layout: 'anchor',
flex: 3,
defaultType: 'textfield',
items: [{
xtype: 'container',
defaultType: 'textfield',
layout: 'hbox',
defaults: {
anchor: '100%'
},
items: [this.comboxCargoid]
}, {
xtype: 'textareafield',
grow: true,
fieldLabel: '  ',
labelSeparator: '',
labelWidth: 20,
height: 250,
name: 'DESCRIPTION',
anchor: '100%'
}]
}, {
xtype: 'container',
layout: 'anchor',
flex: 1,
defaultType: 'textfield',
items: [{
xtype: 'label',
html: '         No.of containers or pkgs.
         (箱数或件数)'
}, {
xtype: 'textareafield',
grow: true,
fieldLabel: '  ',
labelWidth: 20,
labelSeparator: '',
height: 40,
name: 'NOPKGS',
anchor: '100%'
}, {
xtype: 'label',
html: '          Gross Weight 毛重(公斤)'
}, {
xtype: 'textareafield',
grow: true,
height: 40,
labelWidth: 20,
labelSeparator: '',
fieldLabel: '  ',
name: 'GROSSWEIGHT',
anchor: '100%'
}, {
xtype: 'label',
html: '          Measurement 尺码(立方米)'
}, {
xtype: 'textareafield',
grow: true,
height: 40,
labelWidth: 20,
labelSeparator: '',
fieldLabel: '  ',
name: 'MEASUREMENT',
anchor: '100%'
}
]
}
]
}, this.panelBodyDr, this.panelBodyRf, {
xtype: 'container',
defaultType: 'textfield',
layout: 'hbox',
items: [{
fieldLabel: '签单方式',
name: 'ISSUETYPE'
}, {
fieldLabel: '签单日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'ISSUEDATE'
}, {
fieldLabel: '签单地点',
name: 'ISSUEPLACE'
}, {
fieldLabel: '提单份数',
name: 'NOBILL'
}]
}, {
xtype: 'container',
defaultType: 'textfield',
layout: 'hbox',
items: [{
fieldLabel: '付费方式',
name: 'BLFRT'
}, {
fieldLabel: '预付地点',
name: 'PREPARDAT'
}, {
fieldLabel: '到付地点',
name: 'PAYABLEAT'
}, {
fieldLabel: '运输条款',
name: 'SERVICE'
}]
}]
}
]
}); //end this.formEdit
//#endregion
//#region 集装箱-数据集
this.storeBodyList = Ext.create('Ext.data.Store', {
model: 'MsOpSeaiDetail',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsOpSeai/GetBodyList',
reader: {
id: 'BsNo,CTNCODE,CTN_ID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//明细表表格
this.gridListCellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});
this.gridList = new Ext.grid.GridPanel({
store: this.storeBodyList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
plugins: [this.gridListCellEditing],
selType: 'cellmodel',
columns: [{
sortable: true,
dataIndex: 'CTN_ID',
header: '编号',
hidden: true,
width: 0
}, {
sortable: true,
dataIndex: 'BSNO',
header: '业务编号',
hidden: true,
width: 0
}, {
sortable: true,
dataIndex: 'CTNCODE',
header: '序号',
width: 30
}, {
dataIndex: 'CTNALL',
header: '箱型',
width: 70,
editor: this.comboxCTNALL
}, {
dataIndex: 'CTNNUM',
header: '箱量',
width: 50,
editor: {
xtype: 'numberfield',
allowBlank: false,
selectOnFocus: true
}
}, {
dataIndex: 'CNTRNO',
header: '箱号',
width: 100,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
}, {
dataIndex: 'SEALNO',
header: '封号',
width: 80,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
}, {
sortable: true,
dataIndex: 'PKGS',
header: '件数',
width: 60,
editor: {
xtype: 'numberfield',
allowBlank: false,
selectOnFocus: true
}
}, {
dataIndex: 'KINDPKGS',
header: '件数包装',
width: 100,
editor: this.comboxKINDPKGS_CTN
}, {
dataIndex: 'KGS',
header: '重量',
width: 60,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
}, {
dataIndex: 'TAREWEIGHT',
header: '箱皮重',
width: 60,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
}, {
dataIndex: 'CBM',
header: '尺码',
width: 60,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
}, {
dataIndex: 'REMARK',
header: '备注',
width: 150,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
}]
});
//#endregion
//#region 按钮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
}, '-', {
text: "关闭",
handler: function (button, event) {
window.close();
},
scope: this
}, '-', {
text: "打印",
iconCls: "btnprint",
handler: function (button, event) {
this.Print();
},
scope: this
}]
}); //end 按钮Toolbar
//#endregion
//#region 框架结构
this.panelSeai = new Ext.Panel({
title: '委托信息',
id: 'pnlmodNewOpSeaiInfo',
//layout: "border",
//region: 'center',
//animate: true,
autoScroll: true,
//height: 900,
//frame: false,
//closable:true,
items: [this.panelBtn, this.formHead, this.formEdit, this.gridList, this.formBlank]
});
this.panelBill = new Ext.Panel({
title: '舱单信息',
layout: "border",
region: 'center',
animate: true,
autoScroll: true,
containerScroll: true,
frame: false,
items: [this.formBill]
});
this.tabSeaipanel = new Ext.TabPanel({
activeTab: 0,
autoScroll: true,
autoWidth: true,
border: true,
frame: false,
region: 'center',
id: "TabSeaiPanel",
enableTabScroll: true,
items:
[
this.panelSeai,
this.panelBill
],
listeners: {
scope: this,
'beforetabchange': function (tabPanel, newCard, oldCard, eOpts) {
if (oldCard.id == "pnlmodSeaiAllFee") {
var feemodify = oldCard.panelFee.getModifyStatus();
if (feemodify) {
Ext.Msg.show({ title: '警告', msg: '费用未保存,请先保存费用!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
return false;
}
}
if (oldCard.id == "pnlmodSeaiAmendFee") {
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.tabSeaipanel]
});
//#endregion
//#region 其他
// parentWin = window.parent.opener;
parentWin = window.parent.opener._thisfenlist;
if (parentWin == NaN || parentWin == null) {
parentWin = window.parent.opener._this;
} else {
this.isfen = true;
}
this.InitData();
this.LoadMustBe();
this.storeYARD.load({ params: { condition: "ISYARD='1'"} });
this.storeAGENT.load({ params: { condition: "ISAGENT='1'"} });
this.storeFORWARDER.load({ params: { condition: "ISBOOKING='1'"} });
//绑定事件
this.gridList.on('edit', function (editor, e, eOpts) {
this.gridAfterEdit(editor, e, eOpts);
}, this);
//#endregion
}, //end initUIComponents
//#region 加载事件
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];
if (this.isfen) this.MainEditRecord = ret[3];
}
this.storecodeservice.load({ params: { condition: "OPTYPE='2'" },
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:true,name:'" + memberyf.data.OPField + "',id:'" + memberyf.data.OPField + "'";
checkboxSingleItem += "}";
} else {
var checkboxSingleItem = ",{boxLabel:'" + memberyf.data.SERVICENAME + "',inputValue:true,name:'" + memberyf.data.OPField + "',id:'" + 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();
}
condition = "BSNO='" + this.editRecord.get('BSNO') + "'";
this.LoadData('edit', condition);
}
},
scope: this
});
// if (this.opStatus == 'edit') {
// condition = "BSNO='" + this.editRecord.get('BSNO') + "'";
// this.LoadData('edit', condition);
// } else if (this.opStatus == 'add') {
// this.LoadDefValue();
// }
}, //end InitData
LoadData: function (opstatus, condition) {
this.opStatus = opstatus;
if (this.opStatus == 'edit') {
var sMBLNO = this.editRecord.get('MBLNO').toString().trim();
if (sMBLNO != "") {
document.title = "海运出口-主提单号:" + this.editRecord.get('MBLNO').toString().trim();
}
else {
document.title = "海运出口-委托编号:" + this.editRecord.get('CUSTNO').toString().trim();
}
}
else {
document.title = "海运出口-新增";
}
Ext.Ajax.request({
waitMsg: '正在查询主表数据...',
url: '/MvcShipping/MsOpSeai/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;
var s = "LINKID in (select gid from [info_client] where SHORTNAME='" + CUSTOMERNAME + "')";
this.storeInfoClientContact.load({ params: { condition: s} });
//
this.formHead.getForm().reset();
this.formHead.getForm().setValues(data);
this.formEdit.getForm().reset();
this.formEdit.getForm().setValues(data);
this.formBill.getForm().reset();
this.formBill.getForm().setValues(data);
this.LoadInit(data);
//
if (opstatus == "add") {
this.GetAddText();
}
this.GetEditStatus();
var paneltabfee = new Shipping.SeaiFee({
id: 'pnlmodSeaiAllFee',
layout: "border",
region: "center",
autoScroll: true,
frame: false,
closable: true,
title: '费用信息'
});
this.tabSeaipanel.add(paneltabfee);
var paneltabfeeamend = new Shipping.SeaiAmendFee({
id: 'pnlmodSeaiAmendFee',
layout: "border",
region: "center",
autoScroll: true,
frame: false,
closable: true,
title: '更改单信息'
});
this.tabSeaipanel.add(paneltabfeeamend);
this.tabSeaipanel.doLayout();
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
//var billno = '*';
//var gid = '*';
if (this.opStatus == 'edit') {
//billno = this.editRecord.get('BSNO');
//condition = "BSNO='" + this.editRecord.get('BSNO') + "'";
this.storeBodyList.load({ params: { condition: condition} });
}
}, // end LoadDate
//#endregion
//#region 保存
Save: function (type) {
var basicForm = this.formEdit.getForm();
var basicForm2 = this.formHead.getForm();
if (!basicForm.isValid()) {
return;
}
if (!basicForm2.isValid()) {
return;
}
//
var bodydatas = [];
var iCount = this.storeBodyList.getCount();
for (var i = 1; i <= iCount; i++) {
var member = this.storeBodyList.getAt(i - 1);
var sn = i.toString();
var al = iCount.toString().length;
var bl = i.toString().length;
if (iCount.toString().length > i.toString().length) {
for (var j = 0; j < (iCount.toString().length - i.toString().length); j++) {
sn = "0" + i.toString().toString();
}
}
member.data.CTNCODE = sn;
bodydatas.push(member);
}
//
var jsonBody = ConvertRecordsToJsonAll(bodydatas);
this.formHead.getForm().findField('BSNO').setDisabled(false);
var data = this.formHead.getForm().getValues(false, false, false);
var data2 = this.formEdit.getForm().getValues(false, false, false);
var data3 = this.formBill.getForm().getValues(false, false, false);
this.formHead.getForm().findField('BSNO').setDisabled(true);
//
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/MvcShipping/MsOpSeai/Save',
scope: this,
params: {
opstatus: this.opStatus,
data: Ext.JSON.encode(data),
data2: Ext.JSON.encode(data2),
data3: Ext.JSON.encode(data3),
body: jsonBody
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
var returnData = jsonresult.Data;
this.formEdit.getForm().reset();
this.formEdit.getForm().setValues(returnData);
this.formHead.getForm().reset();
this.formHead.getForm().setValues(returnData);
this.formBill.getForm().reset();
this.formBill.getForm().setValues(returnData);
bodydatas = [];
//
if (this.opStatus == 'add') {
var arrNewRecords = this.StoreList.add(returnData);
this.editRecord = arrNewRecords[0];
}
else if (this.opStatus == 'edit') {
var editp = Ext.create('MsOpSeaiModel', 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';
if (type == '0') {
this.formHead.getForm().findField('BSNO').setDisabled(false);
this.formHead.getForm().findField('BSNO').setValue(returnData.BSNO);
this.formHead.getForm().findField('BSNO').setDisabled(true);
var condition = "BSNO='" + returnData.BSNO + "'";
this.storeBodyList.load({ params: { condition: condition} });
// for (var j = 0; j < this.storeBodyList.getCount(); j += 1) {
// var memberbody = this.storeBodyList.getAt(j);
// memberbody.set("BSNO", this.editRecord.get('BSNO'));
// memberbody.commit();
// };
} else if (type == '1') {
window.close();
} else if (type == '2') {
this.LoadData('add', '');
}
} else {
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
} else {
Ext.Msg.show({ title: '请重试',
msg: '服务器响应出错',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
}
}
});
}, //end save
//#endregion
//#region 集装箱按钮事件
onAddDetailClick: function (button, event) {
this.addDetail();
}, //end onAddDetailClick
onDelDetailClick: function (button, event) {
this.deleteDetail();
}, //onDelDetailClick
// gridAfterEdit: function (editor, e, eOpts) {
// if (e.field == 'Pkgs' || e.field == 'Price') {
// var Pkgs = e.record.data['Pkgs'];
// var Price = e.record.data['Price'];
// e.record.set('Total', (Pkgs * Price).toFixed(2));
// }
// },
addDetail: function () {
var newSerialno = this.DsGetNewNo(this.storeBodyList);
//this.tabtree.expandAll(); //展开所有树节点
//collapseAll():收缩所有树节点
//getRootNode():获取根节点
var record = Ext.create('MsOpSeaiDetail', {
CTN_ID: '*',
CTNCODE: newSerialno,
CTNALL: '',
CTNNUM: 1,
CNTRNO: '',
SEALNO: '',
PKGS: 0,
KINDPKGS: '',
KGS: 0,
TAREWEIGHT: 0,
CBM: 0,
REMARK: ''
});
this.storeBodyList.add(record);
var n = this.storeBodyList.getCount();
this.gridListCellEditing.startEditByPosition({ row: n - 1, column: 2 });
},
DsGetNewNo: function (store) {
var result = store.getCount();
if (result == 0) {
return 1;
}
var record = store.getAt(result - 1).data.CTNCODE;
result = parseInt(record) + 1;
return result;
},
deleteDetail: function () {
var BSSTATUS = this.formHead.getForm().findField('BSSTATUSREF').getValue();
if (BSSTATUS == '锁定') {
Ext.Msg.show({ title: '警告', msg: '业务已锁定,不允许操作!', icon: Ext.Msg.WARNING, 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.CTN_ID == "" || rec.data.CTN_ID == "*")//如果是新增但没有保存的数据,没有必要提交到后台
{
this.storeBodyList.remove(selectedRecords[i]);
}
else {
Ext.MessageBox.confirm('提示', '确定删除该记录吗?', function (btn) {
if (btn == 'yes') {
Ext.Msg.wait('正在删除数据...');
Ext.Ajax.request({
waitMsg: '正在删除数据...',
url: '/MvcShipping/MsOpSeai/DeleteDetail',
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);
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]);
}
},
//#endregion
//#region 编辑时按钮等的状态
GetEditStatus: function () {
},
GetAddText: function () {
if (this.opStatus != 'edit') {
var basicForm = this.formHead.getForm();
basicForm.findField('BSNO').setDisabled(false);
var field = basicForm.findField('BSNO');
var oldbsno = field.getValue();
var oldmasterno = basicForm.findField('MASTERNO').getValue();
var strbsno = "topseai" + NewGuid().toString().replace(/-/g, '')
field.setValue(strbsno);
// var BSNO = 'topseae' + NewGuid();
// field.setValue(BSNO);
if (oldbsno == oldmasterno) {
field = basicForm.findField('MASTERNO');
field.setValue(strbsno);
}
//field.setValue('*');alert("abacacf".replace(/a/g,'9'));
basicForm.findField('BSNO').setDisabled(true);
field = basicForm.findField('CUSTNO');
field.setValue('');
field = basicForm.findField('MBLNO');
field.setValue('');
field = basicForm.findField('HBLNO');
field.setValue('');
field = basicForm.findField('OP');
field.setValue(SHOWNAME);
field = basicForm.findField('INPUTBY');
field.setValue(SHOWNAME);
var field = basicForm.findField('BSSTATUSREF');
field.setValue('未锁定');
var field = basicForm.findField('FEESTATUSREF');
field.setValue('未锁定');
//field = basicForm.findField('BSTYPE');
//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.storeBodyList.removeAll(); //清空所有;
//
var CUSTOMERNAME = this.formHead.getForm().findField('CUSTOMERNAME').getValue();
if (CUSTOMERNAME != null) {
var s = "LINKID in (select gid from [info_client] where SHORTNAME='" + CUSTOMERNAME + "')";
this.storeInfoClientContact.load({ params: { condition: s} });
}
else {
this.formHead.getForm().findField('SHOWNAME_Client').setValue('');
}
//
this.GetEditStatus();
if (Ext.getCmp('pnlmodSeaiAllFee')) {
var pnlfee = Ext.getCmp('pnlmodSeaiAllFee');
pnlfee.close();
this.tabSeaipanel.doLayout();
}
}
},
//#endregion
//#region 联动事件集
getBMDDATE: function () {
//Ext.getCmp('text2').setValue(Ext.getCmp('text1').getValue());
//this.formHead.getForm().findField('EMAIL').setValue('');
//this.formHead.getForm().findField('EMAIL').getValue();
var tbETD = this.formEdit.getForm().findField('ETD').getRawValue();
var tbFBP = this.formEdit.getForm().findField('FBP').getValue();
//
if (tbETD == "") {
return;
}
if (tbFBP == "" || tbFBP == "0" || tbFBP == "1") {
this.formEdit.getForm().findField('BMDDATE').setValue(tbETD);
return;
}
//
// var myDate = new Date(Date.parse(tbETD.toString()));
// myDate.setDate(myDate.getDate() + (parseInt(tbFBP) - 1));
// var lsDate = Ext.util.Format.date(myDate, 'Y-m-d');
// if (lsDate.indexOf("-00-") > -1) {
// lsDate = (myDate.getFullYear() - 1) + "-12-" + myDate.getDate();
// }
var lsDate = getNewDay(tbETD, tbFBP);
this.formEdit.getForm().findField('BMDDATE').setValue(lsDate);
},
getMDTDATE: function () {
var tbETD = this.formEdit.getForm().findField('ETD').getRawValue();
if (tbETD == "") {
return;
}
var lsDate = getNewDay(tbETD, 9);
this.formEdit.getForm().findField('MDTDATE').setValue(lsDate);
},
getBMDDATE2: function (tbBMDDATE) {
if (tbBMDDATE == "") {
this.getBMDDATE();
}
},
getMDTDATE2: function (tbMDTDATE) {
if (tbMDTDATE == "") {
this.getMDTDATE();
}
},
//#endregion
//#region 保存报关
SaveBG: function (type) {
var basicForm = this.formEdit.getForm();
var basicForm2 = this.formHead.getForm();
if (!basicForm.isValid()) {
return;
}
if (!basicForm2.isValid()) {
return;
}
this.formHead.getForm().findField('BSNO').setDisabled(false);
var data = this.formHead.getForm().getValues(false, false, false);
var data2 = this.formEdit.getForm().getValues(false, false, false);
var data3 = this.formBill.getForm().getValues(false, false, false);
this.formHead.getForm().findField('BSNO').setDisabled(true);
Ext.Msg.wait('正在生成数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在生成数据...',
url: '/MvcShipping/MsOpSeai/SaveBG',
scope: this,
params: {
data: Ext.JSON.encode(data),
data2: Ext.JSON.encode(data2),
data3: Ext.JSON.encode(data3)
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
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 });
}
} else {
Ext.Msg.show({ title: '请重试',
msg: '服务器响应出错',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
}
}
});
}, //end save
//#endregion
//#region 其他函数
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);
var headfield = this.formBill.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' });
}
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' });
}
var headfield = this.formBill.getForm().findField(member.data.FIELDNAME);
if (headfield != NaN && headfield != null) {
if (member.data.ISMUST == "1")
headfield.allowBlank = false;
if (member.data.ISCOLOR == "1")
headfield.setFieldStyle({ background: '#ffc' });
}
};
} else { }
}
},
scope: this
});
},
//#endregion
//#region 打印
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 = 'MSOPSEAI';
var sql1 = "SET LANGUAGE 'us_english' SELECT * FROM OP_SEAI WHERE BSNO= '" + billNo + "'";
var sql2 = "";
var sql3 = "";
var sql4 = "";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
},
//#endregion
//#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.tabSeaipanel.items;
if (children) {
for (var i = children.length - 1, len = 0; i >= len; i--) {
if (children.items[i].id) {
if (children.items[i].id == 'pnlmodNewOpSeaiInfo') {
// this.tabSeaepanel.setActiveTab(i);
} else {
children.items[i].close();
}
}
}
}
this.tabSeaipanel.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.tabSeaipanel.items;
if (children) {
for (var i = children.length - 1, len = 0; i >= len; i--) {
if (children.items[i].id) {
if (children.items[i].id == 'pnlmodNewOpSeaiInfo') {
// this.tabSeaepanel.setActiveTab(i);
} else {
children.items[i].close();
}
}
}
}
this.tabSeaipanel.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
//#region 其他舱单信息
LoadInit: function (data) {
var CUSTOMERNAME = this.formHead.getForm().findField('CUSTOMERNAME').getValue();
this.storeShipper.load({ params: { condition: "shippertype=2 AND (ISPUBLIC=1 OR CODENAME IN (SELECT CODENAME FROM info_client WHERE SHORTNAME='" + CUSTOMERNAME + "') )" },
callback: function (r, options, success) {
if (success) {
this.formBill.getForm().findField('SHIPPERID').setValue(data.SHIPPERID);
}
},
scope: this
});
this.storeConsignee.load({ params: { condition: "shippertype=1 AND (ISPUBLIC=1 OR CODENAME IN (SELECT CODENAME FROM info_client WHERE SHORTNAME='" + CUSTOMERNAME + "') )" },
callback: function (r, options, success) {
if (success) {
this.formBill.getForm().findField('CONSIGNEEID').setValue(data.CONSIGNEEID);
}
},
scope: this
});
this.storenotifyparty.load({ params: { condition: "shippertype=3 AND (ISPUBLIC=1 OR CODENAME IN (SELECT CODENAME FROM info_client WHERE SHORTNAME='" + CUSTOMERNAME + "') )" },
callback: function (r, options, success) {
if (success) {
this.formBill.getForm().findField('NOTIFYPARTYID').setValue(data.NOTIFYPARTYID);
}
},
scope: this
});
},
getIsModify: function () {
var feepanel = Ext.getCmp('pnlmodSeaiAllFee');
if (feepanel != NaN && feepanel != null) {
var feemodify = feepanel.panelFee.getModifyStatus();
if (feemodify) {
return '费用信息';
}
}
var feeamendpanel = Ext.getCmp('pnlmodSeaiAmendFee');
if (feeamendpanel != NaN && feeamendpanel != null) {
var feemodify = feeamendpanel.panelFee.getModifyStatus();
if (feemodify) {
return '更改单信息';
}
}
if (this.formHead.getForm().isDirty() == true || this.formEdit.getForm().isDirty() == true || this.formBill.getForm().isDirty() == true) {
return '业务信息';
}
else return '';
},
gridAfterEdit: function (editor, e, eOpts) {
if (e.field == 'PKGS' || e.field == 'KGS' || e.field == 'CBM') {
this.setAllTotal();
if (e.field == 'KGS') {
var KGS = this.formEdit.getForm().findField('KGS').getValue();
this.formBill.getForm().findField('GROSSWEIGHT').setValue(KGS + 'KGS');
}
if (e.field == 'CBM') {
var CBM = this.formEdit.getForm().findField('CBM').getValue();
this.formBill.getForm().findField('MEASUREMENT').setValue(CBM + 'CBM');
}
if (e.field == 'PKGS') {
var PKGS = this.formEdit.getForm().findField('PKGS').getValue();
var KINDPKGS = this.formEdit.getForm().findField('KINDPKGS').getValue();
this.formBill.getForm().findField('NOPKGS').setValue(PKGS + KINDPKGS);
// this.formEdit.getForm().findField('TOTALNO').setValue('SAY:' + ToEn(PKGS).toUpperCase() + ' ' + KINDPKGS + ' ONLY.');
}
} else if (e.field == 'KINDPKGS') {
var KINDPKGS = e.record.data['KINDPKGS'];
this.setHeadFieldValue('KINDPKGS', KINDPKGS);
var PKGS = this.formEdit.getForm().findField('PKGS').getValue();
this.formBill.getForm().findField('NOPKGS').setValue(PKGS + KINDPKGS);
// this.formEdit.getForm().findField('TOTALNO').setValue('SAY:' + ToEn(PKGS).toUpperCase() + ' ' + KINDPKGS + ' ONLY.');
for (var j = 0; j < this.storeBodyList.getCount(); j += 1) {
var memberbody = this.storeBodyList.getAt(j);
if (memberbody.data.KINDPKGS == "" || memberbody.data.KINDPKGS == NaN || memberbody.data.KINDPKGS == null) {
memberbody.set("KINDPKGS", KINDPKGS);
memberbody.commit();
}
};
}
},
setAllTotal: function () {
this.setPKGSTotal();
this.setKGSTotal();
this.setCBMTotal();
},
setPKGSTotal: function () {
var total = this.calcDetailTotal('PKGS');
this.setHeadFieldValue('PKGS', total);
},
setKGSTotal: function () {
var total = this.calcDetailTotal('KGS');
this.setHeadFieldValue('KGS', total);
},
setCBMTotal: function () {
var total = this.calcDetailTotal('CBM');
this.setHeadFieldValue('CBM', total);
},
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);
}
return total;
},
setHeadFieldValue: function (fieldName, value) {
var field = this.formEdit.getForm().findField(fieldName);
field.setValue(value);
},
onUpDetailClick: function () {
var StoreCtn = Ext.create('Ext.data.Store', {
fields: [{ name: 'CTN', type: 'string' },
{ name: 'CTNNUM', type: 'number' },
{ name: 'PKGS', type: 'number' },
{ name: 'KINDPKGS', type: 'string' },
{ name: 'KGS', type: 'number' },
{ name: 'CBM', type: 'number' }
]
});
for (var j = 0; j < this.storeBodyList.getCount(); j += 1) {
var memberbody = this.storeBodyList.getAt(j);
if (memberbody.data.CTNNUM > 1) {
StoreCtn.add({ "CTN": memberbody.data.CTNALL, "CTNNUM": memberbody.data.CTNNUM, "PKGS": memberbody.data.PKGS, "KINDPKGS": memberbody.data.KINDPKGS, "KGS": memberbody.data.KGS, "CBM": memberbody.data.CBM });
};
var pkgs = memberbody.data.PKGS;
var kgs = memberbody.data.KGS;
var cbm = memberbody.data.CBM;
var ctnnum = memberbody.data.CTNNUM;
memberbody.set("CTNNUM", 1);
memberbody.set("PKGS", Div(pkgs, ctnnum));
memberbody.set("KGS", Div(kgs, ctnnum));
memberbody.set("CBM", Div(cbm, ctnnum));
memberbody.commit();
};
for (var j = 0; j < StoreCtn.getCount(); j += 1) {
var memberbody = StoreCtn.getAt(j);
for (var I = 0; I < memberbody.data.CTNNUM - 1; I += 1) {
var pkgs = memberbody.data.PKGS;
var kgs = memberbody.data.KGS;
var cbm = memberbody.data.CBM;
var ctnnum = memberbody.data.CTNNUM;
var kingpkgs = memberbody.data.KINDPKGS;
var newSerialno = this.DsGetNewNo(this.storeBodyList);
this.serialNo = newSerialno;
var record = Ext.create('MsOpSeaiDetail', {
CTN_ID: '*',
BSNO: '*',
CTNCODE: newSerialno,
CTNALL: memberbody.data.CTN,
CTNNUM: 0,
CNTRNO: '',
SEALNO: '',
PKGS: Div(pkgs, ctnnum),
KINDPKGS: kingpkgs,
KGS: Div(kgs, ctnnum),
TAREWEIGHT: 0,
CBM: Div(cbm, ctnnum),
REMARK: ''
});
this.storeBodyList.add(record);
var _c = this.storeBodyList.getCount() - 1;
var _d = this.storeBodyList.getAt(_c);
_d.set('CTNNUM', 1);
}
};
var n = this.storeBodyList.getCount();
this.gridListCellEditing.startEditByPosition({ row: n - 1, column: 2 });
}
//#endregion
});