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

615 lines
24 KiB
JavaScript

Ext.namespace('Shipping');
Shipping.PiliangPcFee = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.PiliangPcFee.superclass.constructor.call(this);
};
Ext.extend(Shipping.PiliangPcFee, Ext.Panel, {
ParentWin: null,
OpStatus: 'add',
StoreList: null,
EditRecord: null,
region: 'north',
BsNo: '',
feeType:null,
StoreFee: null,
StoreFeeUnit: null,
StoreFeeCust:null,
initUIComponents: function () {
this.formHead = Ext.widget('form', {
frame: true,
region: 'center',
bodyPadding: 1,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 70,
msgTarget: 'qtip'
},
items: [
{
xtype: 'fieldset',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [
{ xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '录入日期',
name: 'LrDate', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: '记账日期',
name: 'JzDate', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: '用户编码',
name: 'UserCode', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: '卸货工厂',
name: 'FactoryAddr', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: '组织编码',
name: 'OrgCode', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: '组织名称',
name: 'OrgName', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: 'gId',
name: 'gId', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: 'PGid',
name: 'PGid', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: 'RefBillNo',
name: 'RefBillNo', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: 'RefBillNose',
name: 'RefBillNose', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: 'BillNo',
name: 'BillNo', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: 'Property',
name: 'Property', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: 'FEESTATUS',
name: 'FEESTATUS', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: 'UserName',
name: 'UserName', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: 'BsType',
name: 'BsType', value: '装箱', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: '时间戳',
name: 'timeMark', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: '工作号',
name: 'CUSTNO'
}, {
fieldLabel: '委托单位',
name: 'CustomerName'
}, {
fieldLabel: '主提单号',
name: 'MblNoSe'
}, {
fieldLabel: '箱型',
name: 'ContainerType'
}, {
fieldLabel: '箱量',
name: 'ContainerQty'
}
]
}
]
}]
}); //end this.formEdit
//#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
}]
}); //end 按钮Toolbar
//#endregion
this.storeCustCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsTruckMng.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefListController' }
});
this.comboxCustCode = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '委托单位',
typeAhead: true,
store: this.storeCustCode,
queryMode: 'remote',
minChars: 1,
queryParam: 'CODENAME',
name: 'CustName',
valueField: 'CustName',
displayField: 'CodeAndName',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_thisZXindex.onRefreshClick();
}
}
}
});
this.formSearch = Ext.widget('form', {
frame: true,
region: 'north',
height: 40,
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 90,
msgTarget: 'qtip'
},
items: [
{//fieldset 1
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '编号',
name: 'MblNo',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
this.onRefreshClick();
}
}
}
}, this.comboxCustCode, {
fieldLabel: '从装箱日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'Fr_ArriveDate',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
this.onRefreshClick();
}
}
}
}, {
fieldLabel: '到装箱日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'To_ArriveDate',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
this.onRefreshClick();
}
}
}
}, {
xtype: 'button',
width: 90,
text: "执行查询",
iconCls: "btnrefresh",
handler: function (button, event) {
this.onRefreshClick(button, event);
},
scope: this
}
]
}]
}]
});
Ext.define('PCmb', {
extend: 'Ext.data.Model',
idProperty: '',
fields: [
{ name: 'ywType', type: 'string' },
{ name: 'PcBillType', type: 'string' },
{ name: 'PcBillTypeREF', type: 'string' },
{ name: 'timeMark', type: 'number' },
{ name: 'gId', type: 'string' },
{ name: 'PGid', type: 'string' },
{ name: 'BLTYPE', type: 'string' },
{ name: 'ACCDATE', type: 'string' },
{ name: 'RowNumber', type: 'string' },
{ name: 'BillNo', type: 'string' },
{ name: 'ExpDate', type: 'string', },
{ name: 'GroupDate', type: 'string' },
{ name: 'EndPortDate', type: 'string' },
{ name: 'EtDate', type: 'string' },
{ name: 'VoyVeg', type: 'string' },
{ name: 'VoyVegSe', type: 'string' },
{ name: 'ArriveDate', type: 'string' },
{ name: 'ReturnDate', type: 'string' },
{ name: 'CustomerName', type: 'string' },
{ name: 'F_CustomerName', type: 'string' },
{ name: 'DdName', 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: 'Ton', 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: 'DispatchName', type: 'string' },
{ name: 'INVOICENO', type: 'string' },
{ name: 'KINDPKGS', type: 'string' },
{ name: 'CUSTNO', type: 'string' },
{ name: 'SalesName', type: 'string' },
{ name: 'RoadFee', type: 'number' },
{ name: 'GoodsName', type: 'string' },
{ name: 'RtnDocStatus', type: 'string' },
{ name: 'RtnDocTime', type: 'string' },
{ name: 'PORTLOAD', type: 'string' },
{ name: 'DESTINATION', type: 'string' },
{ name: 'SALECORPID', type: 'string' },
{ name: 'SALECORP', type: 'string' },
{ name: 'DCLASS', type: 'string' },
{ name: 'DUNNO', type: 'string' },
{ name: 'OPSTATUS', type: 'string' },
{ name: 'FEESTATUSREF', type: 'string' },
{ name: 'BSSTATUSREF', type: 'string' },
{ name: 'COLOR', type: 'string' },
{ name: 'FuelPrice', type: 'number' },
{ name: 'FuelQty', type: 'number' },
{ name: 'RealMil', type: 'number' },
{ name: 'RatedMil', type: 'number' },
{ name: 'RatedFuel', type: 'number' },
{ name: 'RealFuel', type: 'number' },
{ name: 'DetiNationSe', type: 'string' },
{ name: 'FactoryAddrSe', type: 'string' },
{ name: 'ContainerNoSe', type: 'string' },
{ name: 'DRFEESTATUS', type: 'string' },
{ name: 'CRFEESTATUS', type: 'string' },
{ name: 'DRDUISTATUS', type: 'string' },
{ name: 'DRINVSTATUS', type: 'string' },
{ name: 'CRDUISTATUS', type: 'string' },
{ name: 'CRINVSTATUS', type: 'string' },
{ name: 'ISSHUISHI', type: 'boolean' },
{ name: 'ISGAOWEN', type: 'boolean' },
{ name: 'ISXIANLIANG', type: 'boolean' },
{ name: 'ISCHECHUAN', type: 'boolean' },
{ name: 'ISHAIWU', type: 'boolean' },
{ name: 'ISFENGXIANG', type: 'boolean' },
{ name: 'ISWEISHENBAO', type: 'boolean' },
{ name: 'ISBAOGUAN', type: 'boolean' },
{ name: 'ISRIZHAO', type: 'boolean' },
{ name: 'ISBOCHUAN', type: 'boolean' },
{ name: 'ISPINGTAI', type: 'boolean' },
{ name: 'FrTruckNo', type: 'string' },
{ name: 'FrDrvName', type: 'string' },
{ name: 'WmsTruckNo', type: 'string' },
{ name: 'WmsDrvName', type: 'string' },
{ name: 'ChangedReson', type: 'string' },
{ name: 'LoadFactory', type: 'string' },
{ name: 'DrvCode', type: 'string' },
{ name: 'EtDateSe', type: 'string' },
{ name: 'ContainerNo', type: 'string' },
{ name: 'SealNo', type: 'string' },
{ name: 'YardCodeSe', type: 'string' },
{ name: 'YardNameSe', type: 'string' },
{ name: 'DstAreaSe', type: 'string' },
{ name: 'SealNoSe', type: 'string' },
{ name: 'ContainerTypeSe', type: 'string' },
{ name: 'ISCANCEL', type: 'string' },
{ name: 'CargoID', type: 'string' }
]
});
this.storeList = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
model: 'PCmb',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/TruckMng/PcHeadEdit_WFSD/GetHYRDDataList',
reader: {
id: '',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
collapsed: false,
collapsible: true,
height: 140,
id: "BillHeadSeae",
items: [this.panelBtn, this.formSearch, this.formHead]
});
this.panelFee = new Shipping.FeeEditGrid({
region: 'center',
layout: 'border'
});
this.panelFee.stroplb = 'tMsWlPcHead';
this.panelFee.StoreCustType.add({ "SCUSTTYPE": "WTDW-委托单位", "CUSTTYPE": "委托单位", "CUSTNAME": "CustomerName" });
this.panelFee.StoreCustType.add({ "SCUSTTYPE": "CD-车队", "CUSTTYPE": "车队", "CUSTNAME": "F_CustomerName" });
this.panelFee.StoreDrOpRange.load({ params: { optype: "modOtherRecvFeeManagement" } });
this.panelFee.StoreCrOpRange.load({ params: { optype: "modOtherRecvFeeManagement" } });
this.panelFee.storeFeeNameRef.load({ params: { condition: "ISTRUCKING='1' " } });
Ext.apply(this, {
items: [this.panelTop, this.panelFee]
});
parentWin = window.parent.opener;
this.InitData();
},
//#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];
}
this.BsNo = this.EditRecord.get('gId');
this.LoadData();
}, //end InitData
LoadData: function () {
this.formHead.getForm().loadRecord(this.EditRecord);
this.panelFee.EditRecord = this.EditRecord;
var bsno = this.EditRecord.get('gId');
var bltype = this.EditRecord.get('BLTYPE');
this.panelFee.strBSNO = bsno;
this.panelFee.StoreDateCurr.load({ params: { optype: "tMsWlPcHead", bsno: bsno } });
this.panelFee.StoreUnit.load({ params: { bsno: bsno, bstype: "tMsWlPcHead" } });
this.panelFee.strbltype = bltype;
if (bltype == '派车主票') {
this.panelFee.LoadDrChFee2("FEETYPE=1 AND BSNO IN (SELECT BSNO FROM V_OP_BS WHERE MASTERNO='" + bsno + "')");
this.panelFee.LoadCrChFee2("FEETYPE=2 AND BSNO IN (SELECT BSNO FROM V_OP_BS WHERE MASTERNO='" + bsno + "')");
} else {
this.panelFee.storeDrChFee.load({ params: { billno: bsno, type: 1, optype: "tMsWlPcHead" } });
this.panelFee.storeCrChFee.load({ params: { billno: bsno, type: 2, optype: "tMsWlPcHead" } });
}
this.panelFee.storeBodySum.load({
params: { bsno: bsno, bltype: bltype, optype: "tMsWlPcHead" },
callback: function (r, options, success) {
if (success) {
_thisfee.setTotalHead();
}
}
});
this.panelFee.storeChFeeGain.load({ params: { bsno: bsno, bltype: bltype, optype: "普通货", oplb: "tMsWlPcHead" } });
this.panelFee.storeBodyList_GuDingFeeWeiHu.load();
if (this.panelFee.strbltype == '拼箱主票' || this.panelFee.strbltype == '派车主票') {
this.panelFee.tabTotal.add(this.panelFee.panelCustMaster);
this.panelFee.storeChFeeMasterGain.load({ params: { bsno: bsno } });
}
}, // end LoadDate
//#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 = 'MSOPSEAE';
var sql1 = "SET LANGUAGE 'us_english' SELECT * FROM op_seae WHERE BSNO = '" + billNo + "'";
var sql2 = "";
var sql3 = "";
var sql4 = "";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
},
//#endregion
onRefreshClick: function (button, event) {
var sql = this.getCondition();
this.storeList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: sql },
callback: function (r, options, success) {
if (success) {
if (this.storeList.getCount() > 0) {
this.EditRecord = this.storeList.getAt(0);
this.BsNo = this.EditRecord.get('BSNO');
this.LoadData();
} else {
}
}
},
waitMsg: "正在查询数据...",
scope: this
});
},
getCondition: function () {
var form = this.formSearch.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return '';
}
var sql = '';
//#region formSearch 查询面板
//编号包括(主提单号)
var MblNo = form.findField('MblNo').getValue();
sql = sql + getAndConSql(sql, MblNo, " (MblNo like '%" + MblNo + "%' or MBLNOse like '%" + MblNo + "%')");
//客户名称
var CUSTOMERNAME = form.findField('CustName').getValue();
sql = sql + getAndConSql(sql, CUSTOMERNAME, " customername='" + CUSTOMERNAME + "'"); //到港日期
var Fr_ArriveDate = form.findField('Fr_ArriveDate').getRawValue();
sql = sql + getAndConSql(sql, Fr_ArriveDate, " ArriveDate>='" + Fr_ArriveDate + "'");
var To_ArriveDate = form.findField('To_ArriveDate').getRawValue();
sql = sql + getAndConSql(sql, To_ArriveDate, " ArriveDate<='" + To_ArriveDate + " 23:59:59'");
return sql;
},
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;
}
if (j == this.StoreList.count) {
Ext.Msg.show({ title: '警告', msg: '已是最后一票', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
return;
}
j = j - 1;
this.EditRecord = this.StoreList.getAt(j);
this.BsNo = this.EditRecord.get('BSNO');
this.LoadData();
},
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;
}
j = j + 1;
this.EditRecord = this.StoreList.getAt(j);
this.BsNo = this.EditRecord.get('BSNO');
this.LoadData();
},
getModifyStatus: function () {
return this.panelFee.getModifyStatus();
},
feeType: function () {
return this.panelFee.feeType;
},
StoreFee: function () {
return this.panelFee.StoreFee;
},
StoreFeeUnit: function () {
return this.panelFee.StoreFeeUnit;
},
StoreFeeCust: function () {
return this.panelFee.StoreFeeCust;
}
});