DS7/DSWeb/Areas/MvcShipping/Viewsjs/MsOpLetter/MsOpPcLSEdit.js

1804 lines
69 KiB
JavaScript

Ext.namespace('Shipping');
Shipping.MsOpPcLSEdit = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsOpPcLSEdit.superclass.constructor.call(this);
};
Ext.extend(Shipping.MsOpPcLSEdit, Ext.Panel, {
ParentWin: null,
OpStatus: 'add',
StoreList: null,
editRecord: null,
Editdata: null,
MainEditRecord: null,
oplb: '',
initUIComponents: function () {
this.serialNo = 0;
//this.bodyDel = [];
this.itemindex = 1;
var mainform = window.parent.panelEdit;
this.MainEditRecord = mainform.editRecord;
this.BsNo = this.MainEditRecord.get('BSNO');
this.oplb = mainform.stroplb;
Ext.define('PCmb', {
extend: 'Ext.data.Model',
idProperty: '',
fields: [
{ name: 'ywType', type: 'string' },
{ name: 'PcBillType', type: 'string' },
{ name: 'PcBillTypeREF', type: 'string' },
{ name: 'timeMark', type: 'string' },
{ name: 'gId', type: 'string' },
{ name: 'PGid', type: 'string' },
{ name: 'BLTYPE', type: 'string' },
{ name: 'RowNumber', type: 'string' },
{ name: 'BillNo', type: 'string' },
{ name: 'ExpDate', type: 'date', dateFormat: 'Y-m-d H:i:s' },
{ name: 'GroupDate', type: 'string' },
{ name: 'ArriveDate', type: 'string' },
{ name: 'ReturnDate', type: 'string' },
{ name: 'CustomerName', type: 'string' },
{ name: 'F_CustomerName', type: 'string' },
{ name: 'DrvName', type: 'string' },
{ name: 'TruckNo', type: 'string' },
{ name: 'MblNo', type: 'string' },
{ name: 'LinkMan', type: 'string' },
{ name: 'DstArea', type: 'string' },
{ name: 'DetiNation', type: 'string' },
{ name: 'ContainerQty', type: 'string' },
{ name: 'ContainerNo', type: 'string' },
{ name: 'SealNo', type: 'string' },
{ name: 'GOODSCOUNT', type: 'string' },
{ name: 'Ton', type: 'string' },
{ name: 'CBM', type: 'string' },
{ name: 'LoadCount', type: 'string' },
{ name: 'LoadPlace', type: 'string' },
{ name: 'TruckSpec', type: 'string' },
{ name: 'IsDouble', type: 'string' },
{ name: 'Property', type: 'string' },
{ name: 'YUNFEI', type: 'string' },
{ name: 'HCHJ', type: 'string' },
{ name: 'ZXF', type: 'string' },
{ name: 'DDF', type: 'string' },
{ name: 'QTFee', type: 'string' },
{ name: 'TotalFee', type: 'string' },
{ name: 'Remark', type: 'string' },
{ name: 'FEESTATUS', type: 'string' },
{ name: 'UserCode', type: 'string' },
{ name: 'UserName', type: 'string' },
{ name: 'OrgName', type: 'string' },
{ name: 'LrDate', type: 'string' },
{ name: 'PCSTATUSREF', type: 'string' },
{ name: 'RefBillNo', type: 'string' },
{ name: 'RefBillNose', type: 'string' },
{ name: 'MblNoSe', type: 'string' },
{ name: 'ContainerType', type: 'string' },
{ name: 'LinkTel', type: 'string' },
{ name: 'YardName', type: 'string' },
{ name: 'LinkManSe', type: 'string' },
{ name: 'LinkTelSe', type: 'string' },
{ name: 'RtnYardName', type: 'string' },
{ name: 'BsType', type: 'string' },
{ name: 'CustName', type: 'string' },
{ name: 'CustLikeManName', type: 'string' },
{ name: 'CustTel', type: 'string' },
{ name: 'ChangedReson', type: 'string' },
{ name: 'RoadFee', type: 'number' },
{ name: 'INVOICENO', type: 'string' },
{ name: 'KINDPKGS', type: 'string' },
{ name: 'CUSTNO', type: 'string' },
{ name: 'GoodsName', type: 'string' },
{ name: 'PORTLOAD', type: 'string' },
{ name: 'DESTINATION', type: 'string' },
{ name: 'FactoryAddr', type: 'string' }
]
});
Ext.define('Tradermb', {
extend: 'Ext.data.Model',
idProperty: 'gid',
fields: [
{ name: 'gid', type: 'string' },
{ name: 'name', type: 'string' },
{ name: 'codename', type: 'string' }
]
});
//权限范围
this.StoreOpRange = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsOP',
proxy: { url: '/MvcShipping/MsBaseInfo/GetOpRang' }
});
this.StoreOpRange.load({ params: { optype: "modOrderManagement"} });
this.storeFM = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.UserLinkRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetUserLinkRefList' }
});
//客户加载_车队
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: Zi.LAN.TRUCKER,
store: this.storeTRUCKER,
name: 'HEAD_TO',
valueField: 'CustName',
displayField: 'CodeAndName',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
this.formEdit.getForm().findField('F_CustomerName').setValue(combo.value);
var s = " ISOPERATOR=1 and 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);
this.formHead.getForm().findField('HEAD_ATTNTEL').setValue(member.data.TEL);
this.formHead.getForm().findField('HEAD_ATTNFAX').setValue(member.data.FAX);
} else {
this.comboxInfoClientContact.setValue('');
this.formHead.getForm().findField('HEAD_ATTNTEL').setValue('');
this.formHead.getForm().findField('HEAD_ATTNFAX').setValue('');
}
}
},
scope: this
});
}
}
}
});
//委托单位_联系人
this.storeInfoClientContact = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.InfoClientContactModel',
proxy: { url: '/CommMng/BasicDataRef/GetInfoClientContactList' }
});
this.comboxInfoClientContact = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: 'ATTN',
store: this.storeInfoClientContact,
name: 'HEAD_ATTN',
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('HEAD_ATTNTEL').setValue(Cargoinfodata.TEL);
this.formHead.getForm().findField('HEAD_ATTNFAX').setValue(Cargoinfodata.FAX);
} else {
// this.formHead.getForm().findField('HEAD_ATTNTEL').setValue('');
// this.formHead.getForm().findField('HEAD_ATTNFAX').setValue('');
}
}
}
}
});
this.StoreTRUCKSTATUS = Ext.create('Ext.data.Store', {
fields: ['BLTYPE', 'DISPLAYNAME']
});
this.StoreTRUCKSTATUS.add({ "BLTYPE": "待派车", "DISPLAYNAME": Zi.LAN.DPCHE });
this.StoreTRUCKSTATUS.add({ "BLTYPE": "接单", "DISPLAYNAME": Zi.LAN.JIEDAN});
this.StoreTRUCKSTATUS.add({ "BLTYPE": "派车", "DISPLAYNAME": Zi.LAN.PAICHE});
this.StoreTRUCKSTATUS.add({ "BLTYPE": "完成", "DISPLAYNAME": Zi.LAN.WANCHENG});
this.comboxTRUCKSTATUS = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: Zi.LAN.TRUCKSTATUS,
store: this.StoreTRUCKSTATUS,
forceSelection: true,
name: 'PCSTATUSREF',
valueField: 'BLTYPE',
displayField: 'DISPLAYNAME',
value: '待派车'
});
this.storePcBillType = Ext.create('DsExt.ux.RefEnumStore', {});
this.storePcBillType.load({ params: { enumTypeId: 99046} });
this.comboxPcBillType = Ext.create('DsExt.ux.RefEnumCombox', {
fieldLabel: Zi.LAN.PcBillType,
store: this.storePcBillType,
forceSelection: true,
name: 'PcBillType'
});
this.StoreBLTYPE = Ext.create('Ext.data.Store', {
fields: ['BLTYPE', 'DISPLAYNAME']
});
this.StoreBLTYPE.add({ "BLTYPE": "派车主票", "DISPLAYNAME": Zi.LAN.PCZD});
this.StoreBLTYPE.add({ "BLTYPE": "派车分票", "DISPLAYNAME": Zi.LAN.PCFD });
this.StoreBLTYPE.add({ "BLTYPE": "派车单票", "DISPLAYNAME": Zi.LAN.PCDP});
this.comboxBLTYPE = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: Zi.LAN.PCBLTYPE,
store: this.StoreBLTYPE,
forceSelection: true,
name: 'BLTYPE',
valueField: 'BLTYPE',
displayField: 'DISPLAYNAME',
value: '派车单票'
});
this.storeList = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
model: 'PCmb',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/TruckMng/PcHeadEdit_WFSD/GetDataList',
reader: {
id: 'BSNO',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.girdcolums = [{
sortable: true, hidden: true,
dataIndex: 'PcBillType',
header: 'PcBillType',
width: 80
},
{
sortable: true,
dataIndex: 'LrDate',
header: Zi.LAN.INPUTTIME ,
width: 110
},
{
sortable: true,
dataIndex: 'FactoryAddr',
header: Zi.LAN.companyname2,
width: 80
},
{
sortable: true,
dataIndex: 'PcBillTypeREF',
header: Zi.LAN.PcBillType,
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'UserCode',
header: 'UserCode',
width: 80
},
{
sortable: true,
dataIndex: 'UserName',
header: Zi.LAN.UserName,
width: 80
}, {
sortable: true,
dataIndex: 'PCSTATUSREF',
header: Zi.LAN.TRUCKSTATUS ,
width: 50,
renderer: function (value) {
if (value == "接单") {
value = Zi.LAN.JIEDAN;
return "<a><font color='#333333'>" + value + "</font></a>";
} else if (value == "派车") {
value = Zi.LAN.PAICHE;
return "<a><font color='#0000FF'>" + value + "</font></a>";
} else if (value == "完成") {
value = Zi.LAN.WANCHENG;
return "<a><font color='#00FF00'>" + value + "</font></a>";
}
}
},
{
sortable: true, hidden: true,
dataIndex: 'timeMark',
header: 'timeMark',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'gId',
header: 'gId',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'FEESTATUS',
header: '费用锁定',
width: 80
},
{
sortable: true,
dataIndex: 'RowNumber',
header: Zi.LAN.RowNumber,
width: 60,
align: 'center'
},
{
sortable: true,
dataIndex: 'BillNo',
header: Zi.LAN.BillNo,
width: 80
},
{
sortable: true,
dataIndex: 'ExpDate',
header: Zi.LAN.TRUCKDATE,
width: 160,
renderer: Ext.util.Format.dateRenderer('Y-m-d H:i:s')
},
{
sortable: true,
dataIndex: 'GroupDate',
header: Zi.LAN.GroupDate,
width: 80
},
{
sortable: true,
dataIndex: 'ArriveDate',
header: Zi.LAN.ArriveDate,
width: 80,
renderer: Ext.util.Format.dateRenderer('Y-m-d')
},
{
sortable: true,
dataIndex: 'ReturnDate',
header: Zi.LAN.ReturnDate,
width: 80,
renderer: Ext.util.Format.dateRenderer('Y-m-d')
},
{
sortable: true,
dataIndex: 'CustomerName',
header: Zi.LAN.CUSTOMERNAME,
width: 80
},
{
sortable: true,
dataIndex: 'CustName',
header: Zi.LAN.CustName,
width: 80,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
},
{
sortable: true,
dataIndex: 'F_CustomerName',
header: Zi.LAN.TRUCKER,
width: 80
},
{
sortable: true,
dataIndex: 'TruckNo',
header: Zi.LAN.TruckNo,
width: 80
},
{
sortable: true,
dataIndex: 'MblNo',
header: Zi.LAN.MBLNO,
width: 80
},
{
sortable: true,
dataIndex: 'BsType',
header: Zi.LAN.BsType,
width: 110
},
{
sortable: true,
dataIndex: 'DstArea',
header: Zi.LAN.DstArea,
width: 120
},
{
sortable: true,
dataIndex: 'DetiNation',
header: Zi.LAN.FACTRYADDR,
width: 120
},
{
sortable: true,
dataIndex: 'ContainerQty',
header: Zi.LAN.CTNS,
width: 80
},
{
sortable: true,
dataIndex: 'GOODSCOUNT',
header: Zi.LAN.GOODSCOUNT,
width: 80
},
{
sortable: true,
dataIndex: 'Ton',
header: Zi.LAN.Ton,
width: 80
},
{
sortable: true,
dataIndex: 'CBM',
header: Zi.LAN.CBM,
width: 80
},
{
sortable: true,
dataIndex: 'LoadPlace',
header: Zi.LAN.LoadPlace ,
width: 80
},
{
sortable: true,
dataIndex: 'TruckSpec',
header: Zi.LAN.TruckSpec,
width: 80
}
];
//定义Grid
this.gridList = new Ext.grid.GridPanel({
store: this.storeList,
enableHdMenu: false,
region: 'west',
width: 300,
loadMask: { msg: Zi.LAN.ZhengZaiChaXunShuJu },
trackMouseOver: true,
disableSelection: false,
columns: this.girdcolums,
bbar: Ext.create('Ext.PagingToolbar', {
store: this.storeList,
displayInfo: true,
displayMsg: Zi.LAN.displayMsg,
emptyMsg: Zi.LAN.emptyMsg
})
});
_this = this;
this.gridList.addListener('itemclick', function (dataview, record, item, index, e, b) {
_this.editRecord = record;
_this.OpStatus = 'edit';
_this.LoadData("edit", "BillNo='" + record.data.BillNo + "'", record.data.RefBillNose);
}, this);
this.storeList.on('beforeload', function (store) {
var sql = " RefBillNo='" + this.BsNo + "'";
Ext.apply(store.proxy.extraParams, { condition: sql });
}, this);
//#region 编辑formHead 基本信息
this.formHead = Ext.widget('form', {
region: 'north',
frame: true,
bodyPadding: 5,
collapsed: false,
collapsible: true,
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
}, {
fieldLabel: 'LE_ID',
hidden: true,
name: 'LE_ID'
}, {
fieldLabel: 'INPUTTIME',
hidden: true,
name: 'INPUTTIME'
}, {
fieldLabel: 'LETTERNAME',
hidden: true,
name: 'LETTERNAME',
value: '派车通知'
}, this.comboxTRUCKER]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxInfoClientContact, {
fieldLabel: Zi.LAN.HEAD_ATTNTEL,
name: 'HEAD_ATTNTEL'
}, {
fieldLabel: Zi.LAN.HEAD_ATTNFAX,
name: 'HEAD_ATTNFAX'
}, { xtype: 'hiddenfield'}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: 'FROM',
name: 'INPUTBY'
}, {
fieldLabel: Zi.LAN.HEAD_FMTEL,
name: 'HEAD_FMTEL'
}, {
fieldLabel: Zi.LAN.HEAD_FMFAX,
name: 'HEAD_FMFAX'
}, {
fieldLabel: 'EMAIL',
name: 'HEAD_FMEMAIL'
}]
}
]//end items(fieldset 1)
}); //end this.formEdit
//#endregion
//客户加载_场站
this.storeYARD = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomYardRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomYardRefList' }
});
this.storeYARD.load({ params: { condition: "ISYARD='1'"} });
//船公司
var yardname = Zi.LAN.YARD;
if (this.oplb == "海运进口" || this.oplb == "空运进口") {
yardname = Zi.LAN.TXMT
}
this.comboxYARD = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: yardname,
store: this.storeYARD,
forceSelection: true,
name: 'YardName',
valueField: 'CustName',
displayField: 'CodeAndName',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
var data = combo.value;
var s = " ISOPERATOR=1 and LINKID in (select gid from [info_client] where SHORTNAME='" + combo.value + "')";
this.storeInfoClientContactYard.load({ params: { condition: s },
callback: function (r, options, success) {
if (success) {
if (this.storeInfoClientContactYard.getCount() > 0) {
var member = this.storeInfoClientContactYard.getAt(0);
this.comboxInfoClientContactYard.setValue(member.data.SHOWNAME);
this.formEdit.getForm().findField('LinkTel').setValue(member.data.TEL);
} else {
this.comboxInfoClientContactYard.setValue('');
this.formEdit.getForm().findField('LinkTel').setValue('');
}
}
},
scope: this
});
}
}
}
});
//委托单位_联系人
this.storeInfoClientContactYard = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.InfoClientContactModel',
proxy: { url: '/CommMng/BasicDataRef/GetInfoClientContactList' }
});
this.comboxInfoClientContactYard = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: Zi.LAN.YARDATTN,
store: this.storeInfoClientContactYard,
name: 'LinkMan',
valueField: 'SHOWNAME',
displayField: 'SHOWNAME',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
this.formEdit.getForm().findField('LinkTelSe').setValue(records[0].data.TEL);
}
}
}
});
//客户加载_场站
this.storeYARD2 = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomYardRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomYardRefList' }
});
this.storeYARD2.load({ params: { condition: "ISYARD='1'"} });
//船公司
this.comboxYARD2 = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: Zi.LAN.RETURNYARD,
store: this.storeYARD,
forceSelection: true,
name: 'RtnYardName',
valueField: 'CustName',
displayField: 'CodeAndName',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
var data = combo.value;
var s = " ISOPERATOR=1 and LINKID in (select gid from [info_client] where SHORTNAME='" + combo.value + "')";
this.storeInfoClientContactYard2.load({ params: { condition: s },
callback: function (r, options, success) {
if (success) {
if (this.storeInfoClientContactYard2.getCount() > 0) {
var member = this.storeInfoClientContactYard2.getAt(0);
this.comboxInfoClientContactYard2.setValue(member.data.SHOWNAME);
this.formEdit.getForm().findField('LinkTelSe').setValue(member.data.TEL);
} else {
this.comboxInfoClientContactYard2.setValue('');
this.formEdit.getForm().findField('LinkTelSe').setValue('');
}
}
},
scope: this
});
}
}
}
});
//委托单位_联系人
this.storeInfoClientContactYard2 = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.InfoClientContactModel',
proxy: { url: '/CommMng/BasicDataRef/GetInfoClientContactList' }
});
this.comboxInfoClientContactYard2 = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: Zi.LAN.YARDATTN,
store: this.storeInfoClientContactYard2,
name: 'LinkManSe',
valueField: 'SHOWNAME',
displayField: 'SHOWNAME',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
this.formEdit.getForm().findField('LinkTelSe').setValue(records[0].data.TEL);
}
}
}
});
var companyname = Zi.LAN.companyname ;
if (this.oplb == "海运进口" || this.oplb == "空运进口") {
companyname = Zi.LAN.companyname2
}
//客户加载_工厂
this.storeFactry = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsCodeFactry',
proxy: { url: '/MvcShipping/MsCodeFactry/GetDataList' }
});
this.storeFactry.load();
//工厂
this.comboxFactry = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel:companyname,
store: this.storeFactry,
name: 'FactoryAddr',
valueField: 'FACTRYNAME',
displayField: 'CodeAndName',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
var DetiNation = this.formEdit.getForm().findField('DetiNation');
DetiNation.setValue(records[0].data.FACTRYADDR);
var CustLikeManName = this.formEdit.getForm().findField('CustLikeManName');
CustLikeManName.setValue(records[0].data.FACTRYATTN);
var CustTel = this.formEdit.getForm().findField('CustTel');
CustTel.setValue(records[0].data.FACTRYTEL);
}
}
}
});
this.storeContainerType = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CtnRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCtnRefList' }
});
this.storeContainerType.load({ params: { condition: "" } });
this.comboxContainerType = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: Zi.LAN.CTNALL,
store: this.storeContainerType,
name: 'ContainerType',
valueField: 'CtnCode',
displayField: 'CtnName', flex: 0.6//CtnName
, labelWidth: 30
});
//#region 编辑formEdit 派车通知
this.formEdit = Ext.widget('form', {
region: 'north',
height: 460,
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: 'UserCode',
name: 'UserCode', hidden: true
}, {
fieldLabel: 'UserName',
name: 'UserName', hidden: true
}, {
fieldLabel: 'OrgCode',
name: 'OrgCode', hidden: true
}, {
fieldLabel: 'OrgName',
name: 'OrgName', hidden: true
}, {
fieldLabel: 'RefBillNose',
hidden: true,
name: 'RefBillNose'
}, {
fieldLabel: 'RefBillNo',
hidden: true,
name: 'RefBillNo'
}, {
fieldLabel: 'BsType',
hidden: true,
name: 'BsType'
}, {
fieldLabel: 'gId',
hidden: true,
name: 'gId'
}, {
fieldLabel: 'PGid',
hidden: true,
name: 'PGid'
}, {
fieldLabel: 'LrDate',
hidden: true,
name: 'LrDate'
}, {
fieldLabel: 'MblNo',
hidden: true,
name: 'MblNo'
}, {
fieldLabel: 'MblNoSe',
hidden: true,
name: 'MblNoSe'
}, {
fieldLabel: 'EtDate',
hidden: true,
name: 'EtDate'
}, {
fieldLabel: 'VoyVeg',
hidden: true,
name: 'VoyVeg'
}, {
fieldLabel: 'CustomerName',
hidden: true,
name: 'CustomerName'
}, {
fieldLabel: 'FEESTATUS',
hidden: true,
name: 'FEESTATUS'
}
, {
fieldLabel: Zi.LAN.BillNo,
readOnly: true,
name: 'BillNo'
}
, this.comboxPcBillType
, this.comboxContainerType, {
fieldLabel: Zi.LAN.CTNNUM ,
flex: 0.4,
labelWidth: 30,
name: 'ContainerQty'
}
, {
fieldLabel: Zi.LAN.ContainerTypeSe,
//hidden: true,
//flex: 0.6,
labelWidth:55,
name: 'ContainerTypeSe'
}, {
fieldLabel: Zi.LAN.TRUCKFEE,
xtype: 'numberfield',
name: 'RoadFee',
value: 0
}
]
}
, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxYARD, this.comboxInfoClientContactYard, {
fieldLabel: Zi.LAN.TEL ,
name: 'LinkTel'
}, this.comboxBLTYPE]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxFactry, {
fieldLabel: Zi.LAN.TRUCKDATE,
format: 'Y-m-d',
flex: 1,
xtype: 'datetimefield',
name: 'ExpDate'
}, {
fieldLabel: Zi.LAN.TruckNo,
name: 'TruckNo'
}, this.comboxTRUCKSTATUS]
}
, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: Zi.LAN.FACTRYADDR,
name: 'DetiNation'
}, {
fieldLabel: Zi.LAN.ArriveDate,
//labelWidth: 80,
format: 'Y-m-d',
flex: 1,
xtype: 'datetimefield',
name: 'ArriveDate'
}]
}
, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: Zi.LAN.FACTRYATTN ,
name: 'CustLikeManName'
}, {
fieldLabel: Zi.LAN.FACTRYTEL,
name: 'CustTel'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: Zi.LAN.GoodsName ,
name: 'GoodsName'
}, {
fieldLabel: Zi.LAN.TRUCKER ,
readOnly:true,
name: 'F_CustomerName'
}, {
fieldLabel: Zi.LAN.PORTLOAD,
name: 'PORTLOAD'
}, {
fieldLabel: Zi.LAN.PORTDISCHARGE,
name: 'DESTINATION'
}]
}
, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxYARD2, this.comboxInfoClientContactYard2, {
fieldLabel: Zi.LAN.TEL,
name: 'LinkTelSe'
}, {
fieldLabel: Zi.LAN.ReturnDate, labelWidth: 80,
format: 'Y-m-d',
flex: 1,
xtype: 'datetimefield',
name: 'ReturnDate'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: Zi.LAN.ContainerNo,
name: 'ContainerNo'
}, {
fieldLabel: Zi.LAN.SealNo ,
name: 'SealNo'
}, {
fieldLabel: Zi.LAN.GOODSCOUNT,
name: 'GOODSCOUNT',
anchor: '100%'
}, {
fieldLabel: Zi.LAN.Ton,
name: 'Ton',
anchor: '100%'
}, {
fieldLabel: Zi.LAN.CBM ,
name: 'CBM',
anchor: '100%'
}]
}
, {
xtype: 'textareafield',
grow: true,
fieldLabel: Zi.LAN.TRUCKDETAIL ,
height: 60,
name: 'ChangedReson',
anchor: '100%'
}, {
xtype: 'textareafield',
grow: true,
fieldLabel: Zi.LAN.REMARK,
height: 40,
name: 'Remark',
anchor: '100%'
}, {
xtype: 'textfield', hidden: true,
fieldLabel: '发票号',
name: 'INVOICENO',
anchor: '100%'
}, {
xtype: 'textfield', hidden: true,
fieldLabel: '运单号',
name: 'CUSTNO',
anchor: '100%'
}, {
xtype: 'textfield', hidden: true,
fieldLabel: '包装',
name: 'KINDPKGS',
anchor: '100%'
}, {
xtype: 'textfield', hidden: true,
fieldLabel: '截港日期',
name: 'EndPortDate',
anchor: '100%'
}
]//end items(fieldset 1)
}); //end this.formEdit
//#endregion
//#region 按钮Toolbar
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [{
text: Zi.LAN.btnNew ,
handler: function (button, event) {
this.LoadData('add', '');
},
scope: this
}, '-', {
id: 'btnESave',
text: Zi.LAN.btnESave,
iconCls: "btnsave",
handler: function (button, event) {
this.Save('0');
},
scope: this
}, {
id: 'btnESaveAndNew',
text: Zi.LAN.btnESaveAndNew,
handler: function (button, event) {
this.Save('2');
},
scope: this
}, '-', {
id: 'btnCtnFen',
text: Zi.LAN.CtnFen,
handler: function (button, event) {
this.CtnFen();
},
scope: this
}, '-', {
text: Zi.LAN.LoadInt ,
tooltip: Zi.LAN.LoadInt ,
iconCls: "btnrefresh",
handler: function (button, event) {
var billno=this.formEdit.getForm().findField('BillNo').getValue();
var LE_ID=this.formHead.getForm().findField('LE_ID').getValue();
this.LoadData("edit", "BillNo='" +billno+ "'",LE_ID);
},
scope: this
}, '-',
{
text: Zi.LAN.btnDelete,
iconCls: "btndelete",
handler: function (button, event) {
this.onDeleteClick(button, event);
},
scope: this
}, '-', {
text: Zi.LAN.Print,
iconCls: "btnprint",
handler: function (button, event) {
this.Print();
},
scope: this
}]
}); //end 按钮Toolbar
//#endregion
//#region 框架结构
this.panelpage = new Ext.Panel({
title: Zi.LAN.PCDETAIL,
layout: "border",
region: 'center',
animate: true,
autoScroll: true,
// containerScroll: true,
frame: false,
items: [this.formEdit]
});
this.paneltruckdetail = new Ext.Panel({
layout: "border",
region: 'center',
animate: true,
autoScroll: true,
// containerScroll: true,
frame: false,
items: [this.formHead, this.panelpage]
});
Ext.apply(this, {
items: [this.panelBtn, this.gridList, this.paneltruckdetail]
});
//#endregion
//#region 其他
parentWin = window.parent.opener;
this.InitData();
//#endregion
}, //end initUIComponents
//#region 加载事件
InitData: function () {
this.opStatus = 'add';
var condition = '';
_this = this;
this.storeList.load({ params: { condition: "RefBillNo='" + this.BsNo + "'" },
callback: function (r, options, success) {
if (success) {
if (this.storeList.getCount() > 0) {
var member = this.storeList.getAt(0);
_this.LoadData("edit", "BillNo='" + member.data.BillNo + "'", member.data.RefBillNose);
} else {
_this.LoadData('add', '', '');
}
}
},
scope: this
});
}, //end InitData
LoadData: function (opstatus, condition, le_id) {
this.serialNo = 0;
//this.bodyDel = [];
this.opStatus = opstatus;
if (this.opStatus == 'add') {
this.formHead.getForm().reset();
this.formHead.getForm().findField('HEAD_TO').setValue(this.MainEditRecord.get('TRUCKER'));
this.formHead.getForm().findField('BSNO').setValue(this.MainEditRecord.get('BSNO'));
var trucker = this.MainEditRecord.get('TRUCKER');
if (trucker != '') {
var s = " ISOPERATOR=1 and LINKID in (select gid from [info_client] where SHORTNAME='" + trucker + "')";
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);
this.formHead.getForm().findField('HEAD_ATTNTEL').setValue(member.data.TEL);
this.formHead.getForm().findField('HEAD_ATTNFAX').setValue(member.data.FAX);
}
}
},
scope: this
});
}
this.formHead.getForm().findField('INPUTBY').setValue(SHOWNAME);
this.storeFM.load({ params: { condition: '' },
callback: function (r, options, success) {
if (success) {
if (this.storeFM.getCount() > 0) {
var Cargoinforecords = DsStoreQueryBy(this.storeFM, 'UserName', SHOWNAME);
if (Cargoinforecords.getCount() > 0) {
var Cargoinfodata = Cargoinforecords.getAt(0).data;
this.formHead.getForm().findField('HEAD_FMTEL').setValue(Cargoinfodata.Tel);
this.formHead.getForm().findField('HEAD_FMFAX').setValue(Cargoinfodata.Fax);
this.formHead.getForm().findField('HEAD_FMEMAIL').setValue(Cargoinfodata.Email);
} else {
}
}
}
},
scope: this
});
this.formEdit.getForm().reset();
var yard = this.MainEditRecord.get('YARD');
this.formEdit.getForm().findField('YardName').setValue(yard);
this.formEdit.getForm().findField('RtnYardName').setValue(yard);
if (yard != '') {
var s = " ISOPERATOR=1 and LINKID in (select gid from [info_client] where SHORTNAME='" + yard + "')";
this.storeInfoClientContactYard2.load({ params: { condition: s },
callback: function (r, options, success) {
if (success) {
if (this.storeInfoClientContactYard2.getCount() > 0) {
var member = this.storeInfoClientContactYard2.getAt(0);
this.formEdit.getForm().findField('LinkManSe').setValue(member.data.SHOWNAME);
this.formEdit.getForm().findField('LinkTelSe').setValue(member.data.TEL);
this.formEdit.getForm().findField('LinkMan').setValue(member.data.SHOWNAME);
this.formEdit.getForm().findField('LinkTel').setValue(member.data.TEL);
} else {
this.formEdit.getForm().findField('LinkManSe').setValue('');
this.formEdit.getForm().findField('LinkTelSe').setValue('');
this.formEdit.getForm().findField('LinkMan').setValue('');
this.formEdit.getForm().findField('LinkTel').setValue('');
}
}
},
scope: this
});
this.storeInfoClientContactYard.load({ params: { condition: s} });
}
this.formEdit.getForm().findField('Remark').setValue('');
if (this.oplb == '海运出口' || this.oplb == '海运进口') {
this.formEdit.getForm().findField('VoyVeg').setValue(this.MainEditRecord.get('VESSEL') + ' ' + this.MainEditRecord.get('VOYNO'));
this.formEdit.getForm().findField('ContainerType').setValue(this.MainEditRecord.get('CNTRTOTAL'));
this.formEdit.getForm().findField('ContainerTypeSe').setValue(this.MainEditRecord.get('CNTRTOTAL'));
} else if (this.oplb == '空运出口' || this.oplb == '空运进口') {
this.formEdit.getForm().findField('VoyVeg').setValue(this.MainEditRecord.get('VESSEL'));
}
//SR2020031700001_1 将CUSTNO和MBLNO的存放位置颠倒了一下
this.formEdit.getForm().findField('MblNo').setValue(this.MainEditRecord.get('MBLNO'));
this.formEdit.getForm().findField('MblNoSe').setValue(this.MainEditRecord.get('CUSTNO'));
this.formEdit.getForm().findField('CustomerName').setValue(this.MainEditRecord.get('CUSTOMERNAME'));
_PKGS = this.MainEditRecord.get('PKGS');
if (isNullorEmpty(_PKGS)) _PKGS = 0;
this.formEdit.getForm().findField('GOODSCOUNT').setValue(_PKGS);
_KGS = this.MainEditRecord.get('KGS');
if (isNullorEmpty(_KGS)) _KGS = 0;
this.formEdit.getForm().findField('Ton').setValue(_KGS);
_CBM = this.MainEditRecord.get('CBM');
if (isNullorEmpty(_CBM)) _CBM = 0;
this.formEdit.getForm().findField('CBM').setValue(_CBM);
this.formEdit.getForm().findField('RoadFee').setValue(0);
this.formEdit.getForm().findField('BsType').setValue(this.oplb);
this.formEdit.getForm().findField('PcBillType').setValue('0');
this.formEdit.getForm().findField('EtDate').setValue(this.MainEditRecord.get('ETD'));
this.formEdit.getForm().findField('EndPortDate').setValue(this.MainEditRecord.get('CLOSINGDATE'));
this.formEdit.getForm().findField('PORTLOAD').setValue(this.MainEditRecord.get('PORTLOAD'));
this.formEdit.getForm().findField('DESTINATION').setValue(this.MainEditRecord.get('DESTINATION'));
this.formEdit.getForm().findField('FEESTATUS').setValue('0');
// this.formEdit.getForm().findField('EndPortDate').setValue(this.MainEditRecord.get('CLOSINGDATE'));
this.formEdit.getForm().findField('BillNo').setValue('');
} else {
Ext.Ajax.request({
waitMsg: '正在查询主表数据...',
url: '/MvcShipping/MsOpLetter/GetData',
params: {
handle: opstatus,
condition: "LE_ID='" + le_id + "'"
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
Ext.Msg.show({
title: Zi.LAN.TiShi,
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().findField('CUSTOMERNAME').setValue(this.MainEditRecord.get('CUSTOMERNAME'));
// this.GetEditStatus();
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
Ext.Ajax.request({
waitMsg: '正在查询主表数据...',
url: '/TruckMng/PcHeadEdit_WFSD/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: Zi.LAN.TiShi,
msg: result.Message,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
return;
}
data = result.data;
this.formEdit.getForm().reset();
this.formEdit.getForm().setValues(data);
// this.formEdit.getForm().findField('PcBillType').setValue('1');
this.LoadInit();
// this.GetEditStatus();
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
}
//20160219 获取业务主表内的件数重量尺码,用于在生成散货派车单时传递
//this.formEdit.getForm().findField('PKGS').setValue(this.MainEditRecord.get('PKGS'));
//this.formEdit.getForm().findField('KGS').setValue(this.MainEditRecord.get('KGS'));
//this.formEdit.getForm().findField('CBM').setValue(this.MainEditRecord.get('CBM'));
}, // end LoadDate
//#endregion
//#region 保存
Save: function (type) {
var basicForm = this.formEdit.getForm();
if (!basicForm.isValid()) {
return;
}
var data = this.formHead.getForm().getValues(false, false, false);
var body = this.formEdit.getForm().getValues(false, false, false);
//
Ext.Msg.wait(Zi.LAN.ZhengZaiCaoZuoShuJu);
Ext.Ajax.request({
waitMsg: Zi.LAN.ZhengZaiCaoZuoShuJu,
url: '/MvcShipping/MsOpLetter/SaveLSTruck',
scope: this,
params: {
opstatus: this.opStatus,
data: Ext.JSON.encode(data),
body: Ext.JSON.encode(body),
oplb:this.oplb
},
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);
//
if (this.opStatus == 'add') {
var arrNewRecords = this.storeList.add(returnData);
this.editRecord = arrNewRecords[0];
var editp = Ext.create('PCmb', returnData);
this.formHead.getForm().findField('LE_ID').setValue(editp.get('RefBillNose'));
}
else if (this.opStatus == 'edit') {
var editp = Ext.create('PCmb', 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';
} else if (type == '1') {
window.close();
} else if (type == '2') {
this.LoadData('add', '');
}
} else {
Ext.Msg.show({ title: Zi.LAN.ChuoWu, msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
} else {
Ext.Msg.show({ title: '请重试',
msg: Zi.LAN.FuWuQiXiangYingChuCuo,
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
}
}
});
}, //end save
//#endregion
//#region 保存
CtnFen: function () {
var basicForm = this.formEdit.getForm();
if (!basicForm.isValid()) {
return;
}
var data = this.formHead.getForm().getValues(false, false, false);
var body = this.formEdit.getForm().getValues(false, false, false);
//
Ext.Msg.wait(Zi.LAN.ZhengZaiCaoZuoShuJu);
Ext.Ajax.request({
waitMsg: Zi.LAN.ZhengZaiCaoZuoShuJu,
url: '/MvcShipping/MsOpLetter/SaveLSCtnTruck',
scope: this,
params: {
data: Ext.JSON.encode(data),
body: Ext.JSON.encode(body),
oplb: this.oplb
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
this.InitData();
} else {
Ext.Msg.show({ title: Zi.LAN.ChuoWu, msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
} else {
Ext.Msg.show({
title: '请重试',
msg: Zi.LAN.FuWuQiXiangYingChuCuo,
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
}
}
});
}, //end save
//#endregion
SavePC: function () {
var basicForm = this.formEdit.getForm();
if (!basicForm.isValid()) {
return;
}
var url = '/MvcShipping/MsOpLetter/SavePC';
if (this.oplb == '空运出口' || this.oplb == '空运出口') {
url = '/MvcShipping/MsOpLetter/SaveAirPC';
}
var TRUCKSTATUS = this.formEdit.getForm().findField('TRUCKSTATUS').getValue();
if (TRUCKSTATUS != "待派车") {
Ext.Msg.show({ title: '警告', msg: Zi.LAN.ZYDTCZTCYXSCPCD, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
return;
}
var data = this.formHead.getForm().getValues(false, false, false);
var body = this.formEdit.getForm().getValues(false, false, false);
var bs = this.MainEditRecord.data;
_this = this;
//
Ext.Msg.wait(Zi.LAN.ZhengZaiCaoZuoShuJu);
Ext.Ajax.request({
waitMsg: Zi.LAN.ZhengZaiCaoZuoShuJu,
url: url,
scope: this,
params: {
opstatus: this.opStatus,
data: Ext.JSON.encode(data),
body: Ext.JSON.encode(body),
bs: Ext.JSON.encode(bs),
oplb: _this.oplb
},
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);
if (this.opStatus == 'add') {
// var arrNewRecords = this.StoreList.add(returnData);
this.editRecord = arrNewRecords[0];
var editp = Ext.create('MsOpLetter', returnData);
this.formHead.getForm().findField('LE_ID').setValue(editp.get('LE_ID'));
}
else if (this.opStatus == 'edit') {
var editp = Ext.create('MsOpLetter', 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';
Ext.Msg.show({ title: Zi.LAN.TiShi, msg: jsonresult.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
} else {
Ext.Msg.show({ title: Zi.LAN.ChuoWu, msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
} else {
Ext.Msg.show({ title: '请重试',
msg: Zi.LAN.FuWuQiXiangYingChuCuo,
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
}
}
});
}, //end save
SavePC_SH: function () {
var basicForm = this.formEdit.getForm();
if (!basicForm.isValid()) {
return;
}
var url = '/MvcShipping/MsOpLetter/SavePC_SH';
if (this.oplb == '空运出口' || this.oplb == '空运出口') {
url = '/MvcShipping/MsOpLetter/SaveAirPC_SH';
}
var TRUCKSTATUS = this.formEdit.getForm().findField('TRUCKSTATUS').getValue();
if (TRUCKSTATUS != "待派车") {
Ext.Msg.show({ title: '警告', msg: Zi.LAN.ZYDTCZTCYXSCPCD , icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
return;
}
var data = this.formHead.getForm().getValues(false, false, false);
var body = this.formEdit.getForm().getValues(false, false, false);
_this = this;
var bs = this.MainEditRecord.data;
//
Ext.Msg.wait(Zi.LAN.ZhengZaiCaoZuoShuJu);
Ext.Ajax.request({
waitMsg: Zi.LAN.ZhengZaiCaoZuoShuJu,
url: url,
scope: this,
params: {
opstatus: this.opStatus,
data: Ext.JSON.encode(data),
body: Ext.JSON.encode(body),
bs: Ext.JSON.encode(bs),
oplb: _this.oplb
},
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);
if (this.opStatus == 'add') {
var arrNewRecords = this.StoreList.add(returnData);
this.editRecord = arrNewRecords[0];
var editp = Ext.create('MsOpLetter', returnData);
this.formEdit.getForm().findField('LE_ID').setValue(editp.get('LE_ID'));
}
else if (this.opStatus == 'edit') {
var editp = Ext.create('MsOpLetter', 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';
Ext.Msg.show({ title: Zi.LAN.TiShi, msg: jsonresult.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
} else {
Ext.Msg.show({ title: Zi.LAN.ChuoWu, msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
} else {
Ext.Msg.show({ title: '请重试',
msg: Zi.LAN.FuWuQiXiangYingChuCuo,
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
}
}
});
}, //end save
onDeleteClick: function (button, event) {
var selections = this.gridList.getSelectionModel().getSelection();
if (selections.length == 0) {
Ext.Msg.show({ title: Zi.LAN.TiShi, msg: Zi.LAN.QingXuanZeYeWu, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var record = selections[0];
var TRUCKSTATUS = record.data.PCSTATUSREF;
if (TRUCKSTATUS == "派车" || TRUCKSTATUS == "完成") {
Ext.Msg.show({ title: '警告', msg: Zi.LAN.DQZTBYXSC, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
return;
}
Ext.MessageBox.confirm(Zi.LAN.TiShi, Zi.LAN.QueDingShanChuGaiJiLuMa, function (btn) {
if (btn == 'yes') {
Ext.Msg.wait(Zi.LAN.ZhengZaiCaoZuoShuJu);
Ext.Ajax.request({
waitMsg: Zi.LAN.ZhengZaiCaoZuoShuJu,
url: '/MvcShipping/MsOpLetter/DeleteLS',
params: {
data: Ext.JSON.encode(record.data)
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
this.storeList.remove(record);
if (this.storeList.getCount() > 0) {
var member = this.storeList.getAt(0);
this.editRecord = member;
this.LoadData("edit", "BillNo='" + member.data.BillNo + "'", member.data.RefBillNose);
} else {
this.LoadData('add', '');
}
Ext.Msg.show({ title: Zi.LAN.TiShi, msg: jsonresult.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
else {
Ext.Msg.show({ title: Zi.LAN.ChuoWu, msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
}
},
failure: function (response, options) {
Ext.Msg.show({ title: '警告', msg: Zi.LAN.FuWuQiXiangYingChuCuo, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
},
success: function (response, options) {
},
scope: this
}); //end Ext.Ajax.request
}
}, this);
}, //onDeleteClick
//#region
LoadInit: function () {
var CUSTOMERNAME = this.MainEditRecord.get('CUSTOMERNAME');
var s = " ISOPERATOR=1 and LINKID in (select gid from [info_client] where SHORTNAME='" + CUSTOMERNAME + "')";
this.storeInfoClientContact.load({ params: { condition: s} });
var YARD = this.formEdit.getForm().findField('YardName').getValue();
var s = " ISOPERATOR=1 and LINKID in (select gid from [info_client] where SHORTNAME='" + YARD + "')";
this.storeInfoClientContactYard.load({ params: { condition: s} });
var YARD2 = this.formEdit.getForm().findField('RtnYardName').getValue();
var s = " ISOPERATOR=1 and LINKID in (select gid from [info_client] where SHORTNAME='" + YARD2 + "')";
this.storeInfoClientContactYard2.load({ params: { condition: s} });
},
//#endregion
//#region 编辑时按钮等的状态
GetEditStatus: function () {
var canedit = false;
//var bsStatus = this.formHead.getForm().findField('BSSTATUS').getValue();
var BSSTATUS = this.formHead.getForm().findField('BSSTATUSREF').getValue();
var inputby = this.formHead.getForm().findField('INPUTBY').getValue();
var op = this.formHead.getForm().findField('OP').getValue();
_this = this;
if (BSSTATUS == '锁定') {
canedit = false;
this.setSaveBtnStatus(canedit);
} else {
this.StoreOpRange.load({ params: { optype: "modOrderManagement" },
callback: function (r, options, success) {
if (success) {
if (r.length != 0) {
var records = DsStoreQueryBy(_this.StoreOpRange, 'OPID', op);
if (records.getCount() > 0) {
canedit = true;
} else {
var recordins = DsStoreQueryBy(_this.StoreOpRange, 'OPID', inputby);
if (recordins.getCount() > 0) {
canedit = true;
} else {
canedit = false;
}
}
} else { canedit = false; }
_this.setSaveBtnStatus(canedit);
}
}
});
}
},
setSaveBtnStatus: function (enable) {
var btnESave = Ext.getCmp('btnESave');
var btnESaveAndClose = Ext.getCmp('btnESaveAndClose');
var btnESaveAndNew = Ext.getCmp('btnESaveAndNew');
var btnEAddDetail = Ext.getCmp('btnadddetail');
var btnEDeleteDetail = Ext.getCmp('btndeldetail');
var btnCtnFen = Ext.getCmp('btnCtnFen');
if (enable) {
btnESave.enable();
btnESaveAndClose.enable();
btnESaveAndNew.enable();
btnCtnFen.enable();
btnEAddDetail.enable();
btnEDeleteDetail.enable();
} else {
btnESave.disable();
btnESaveAndClose.disable();
btnESaveAndNew.disable();
btnEAddDetail.disable();
btnEDeleteDetail.disable();
btnCtnFen.disable();
}
},
//#endregion
//#region 打印
Print: function () {
var basicForm = this.formHead.getForm();
var le_id = basicForm.findField('LE_ID').value;
var bsNo = basicForm.findField('BSNO').value;
var billNo = this.formEdit.getForm().findField('BillNo').getValue();
if (billNo == '*' || billNo == '' || billNo == NaN) {
Ext.Msg.show({ title: Zi.LAN.ChuoWu, msg: Zi.LAN.pCdmybc , icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
return;
}
var MBLNO = this.MainEditRecord.get('MBLNO') + '派车通知';
var printType = 'MSOPLETTERTRUCKLS';
if (this.oplb == "海运进口") {
printType = 'MSOPLETTERTRUCKSEAILS'
} else if (this.oplb == "空运进口") {
printType = 'MSOPLETTERTRUCKAIRILS'
} else if (this.oplb == "空运出口") {
printType = 'MSOPLETTERTRUCKAIRELS'
}
var sql1 = "SET LANGUAGE 'us_english' SELECT * FROM op_letter WHERE LE_ID = '" + le_id + "'";
var sql2 = "SET LANGUAGE 'us_english' SELECT * FROM tMsWlPcHead WHERE billNo = '" + billNo + "'";
var sql3 = "";
if (this.oplb == "海运进口")
sql3 = "SET LANGUAGE 'us_english' SELECT * FROM op_seai WHERE BSNO = '" + bsNo + "'";
else if (this.oplb == "空运进口")
sql3 = "SET LANGUAGE 'us_english' SELECT * FROM op_airi WHERE BSNO = '" + bsNo + "'";
else if (this.oplb == "空运出口")
sql3 = "SET LANGUAGE 'us_english' SELECT * FROM op_aire WHERE BSNO = '" + bsNo + "'";
else
sql3 = "SET LANGUAGE 'us_english' SELECT * FROM op_seae WHERE BSNO = '" + bsNo + "'";
var sql4 = "";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6, MBLNO, '', '', '', bsNo);
}
// #endregion
});