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/MsPcHeadListIndex.js

1415 lines
54 KiB
JavaScript

2 years ago
//爱德林 路单管理
Ext.namespace('DsTruck');
DsTruck.MsRptPcHeadQryIndex = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.DsTruck.MsRptPcHeadQryIndex.superclass.constructor.call(this);
};
Ext.extend(DsTruck.MsRptPcHeadQryIndex, Ext.Panel, {
PageSize: 100,
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
sqlcontext: '',
initUIComponents: function () {
this.sqlcontext = "";
this.formname = "tmswlPcList_ADL";
this.formname_edit = "tmswlPcList_ADL_edit";
this.winAccess = null;
//定义数据集
this.storeList = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
fields: [
{ name: 'BillNo', type: 'string' },
{ name: 'GId', type: 'string' },
{ name: 'BsType', type: 'string' },
{ name: 'DdCode', type: 'string' },
{ name: 'DdCode_Ref', type: 'string' },
{ name: 'DDNAME', type: 'string' },
{ name: 'ExpDate', type: 'string' },
{ name: 'CustCode', type: 'string' },
{ name: 'CustName', type: 'string' },
{ name: 'TruckSpec', type: 'string' },
{ name: 'TruckNo', type: 'string' },
{ name: 'MblNo', type: 'string' },
{ name: 'DrvName', type: 'string' },
{ name: 'DrvName_Ref', type: 'string' },
{ name: 'Mobile', type: 'string' },
{ name: 'ContainerType', type: 'string' },
{ name: 'ContainerType_Ref', type: 'string' },
{ name: 'ContainerQty', type: 'string' },
{ name: 'YardCode_Ref', type: 'string' },
{ name: 'VoyVeg', type: 'string' },
{ name: 'DstArea', type: 'string' },
{ name: 'NOLOADMIL', type: 'number' },
{ name: 'OverLoadMil', type: 'number' },
{ name: 'RatedFuel', type: 'number' },
{ name: 'REALFUEL', type: 'number' },
{ name: 'LrDate', type: 'string' },
{ name: 'UserCode', type: 'string' },
{ name: 'UserName', type: 'string' },
{ name: 'RefBillNo', type: 'string' },
{ name: 'DetiNation', type: 'string' },
{ name: 'ContainerNo', type: 'string' },
{ name: 'SealNo', type: 'string' },
{ name: 'ArriveDate', type: 'string' },
{ name: 'ArriveTime', type: 'string' }
, { name: 'CustomerName', type: 'string' }
, { name: 'CustomerNameFull', type: 'string' }
, { name: 'F_CustomerName', type: 'string' }
, { name: 'EndPortDate', type: 'string' }
, { name: 'isEnd', type: 'string' }
, { name: 'PCSTATUSREF', type: 'string' }
, { name: 'DRFEESTATUS', type: 'string' }
, { name: 'CRFEESTATUS', type: 'string' }
, { name: 'GoodsName', type: 'string' }
, { name: 'GOODSCOUNT', type: 'string' }
, { name: 'CBM', type: 'string' }
, { name: 'ISHW', type: 'string' }
, { name: 'PINMING', type: 'string' }
, { name: 'Ton', type: 'string' }
, { name: 'Remark', type: 'string' }
, { name: 'LoadPlace', type: 'string' }
],
remoteSort: false,
proxy: {
type: 'ajax',
//url: '/TruckMng/MsRptPcHeadOperate/QryData_ADL',
url: '/TruckMng/MsWlPc/GetDataList_ADL',
//this.storeList.proxy.url = '/TruckMng/MsRptPcHeadOperate/QryData_ADL';
reader: {
id: '',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.column = [
{
sortable: true, hidden: true,
dataIndex: 'GId',
header: 'GId',
width: 130
}, {
sortable: true,
dataIndex: 'PCSTATUSREF',
header: '状态',
width: 50,
renderer: function (value) {
if (value == "接单") {
return "<a><font color='#333333'>" + value + "</font></a>";
} else if (value == "派车") {
return "<a><font color='#0000FF'>" + value + "</font></a>";
} else if (value == "完成") {
return "<a><font color='#00FF00'>" + value + "</font></a>";
}
}
}, {
sortable: true,
dataIndex: 'BillNo',
header: '路单号',
width: 130
}, {
sortable: true,
dataIndex: 'BsType',
header: '托单类型',
width: 130
}, {
sortable: true,
dataIndex: 'DdCode_Ref',
header: '调度',
width: 100
}, {
sortable: true,
dataIndex: 'ExpDate',
header: '派车日期',
width: 70
}, {
sortable: true,
dataIndex: 'CustomerName',
header: '客户',
width: 120
}, {
sortable: true,
dataIndex: 'CustomerNameFull',
header: '客户全称',
width: 140
}, {
sortable: true,
dataIndex: 'F_CustomerName',
header: '最终客户',
width: 120
}, {
sortable: true,
dataIndex: 'PINMING',
header: '品名',
width: 120
}, {
sortable: true,
dataIndex: 'TruckSpec',
header: '车队',
width: 130
}, {
sortable: true,
dataIndex: 'TruckNo',
header: '车号',
width: 65
}, {
sortable: true,
dataIndex: 'RefBillNo',
header: '合同号',
width: 80
}, {
sortable: true,
dataIndex: 'MblNo',
header: '提单号',
width: 120
}, {
sortable: true,
dataIndex: 'DrvName',
header: '司机姓名',
width: 65
}, {
sortable: true,
dataIndex: 'Mobile',
header: '司机手机',
width: 76
}, {
sortable: true,
dataIndex: 'ContainerType_Ref',
header: '箱型',
width: 50
}, {
sortable: true,
dataIndex: 'ContainerQty',
header: '箱量',
width: 50
}, {
sortable: true,
dataIndex: 'YardCode_Ref',
header: '场站',
width: 150
}, {
sortable: true,
dataIndex: 'VoyVeg',
header: '船名航次',
width: 150
}, {
sortable: true,
dataIndex: 'EndPortDate',
header: '截港日期',
width: 150
}, {
sortable: true,
dataIndex: 'LoadPlace',
header: '始发地',
width: 80
}, {
sortable: true,
dataIndex: 'DstArea',
header: '目的地',
width: 80
}, {
sortable: true,
dataIndex: 'FactoryAddr',
header: '工厂',
width: 200
}, {
sortable: true,
dataIndex: 'DetiNation',
header: '工厂地址',
width: 200
}, {
sortable: true,
dataIndex: 'ArriveDate',
header: '到厂日期',
width: 60
}, {
sortable: true,
dataIndex: 'ArriveTime',
header: '到厂时间',
width: 60
}, {
sortable: true,
dataIndex: 'OverLoadMil',
header: '行驶里程',
width: 60,
summaryType: 'sum',
summaryRenderer: function (value) {
return Ext.util.Format.number(value, '0.00');
}
}, /*{
sortable: true,
dataIndex: 'NOLOADMIL',
header: '空驶里程',
width: 60
},*/{
sortable: true,
dataIndex: 'RatedFuel',
header: '额定油耗',
width: 60
}, {
sortable: true, hidden: true,
dataIndex: 'REALFUEL',
header: '实际油耗',
width: 60
}, {
sortable: true,
dataIndex: 'UserName',
header: '录入人',
width: 60
}, {
sortable: true,
dataIndex: 'LrDate',
header: '录入日期',
width: 80
}, {
sortable: true,
dataIndex: 'ContainerNo',
header: '箱号',
width: 80
}, {
sortable: true,
dataIndex: 'SealNo',
header: '封号',
width: 80
}, {
sortable: true,
id: '',
dataIndex: 'DRFEESTATUS',
header: '应收费用',
align: 'center',
width: 60,
renderer: function (value, meta) {
if (value == '审核通过') {
meta.tdCls = 'feestatus_pass';
} else if (value == '录入状态') {
} else if (value == '提交审核') {
meta.tdCls = 'feestatus_refer';
} else if (value == '部分结算') {
meta.tdCls = 'feestatus_refer';
} else if (value == '结算完毕') {
meta.tdCls = 'feestatus_settle';
} else if (value == '未录入') {
} else if (value == '部分结算') {
meta.tdCls = 'feestatus_settle';
} else if (value == '部分审核') {
meta.tdCls = 'feestatus_pass';
} else if (value == '部分提交') {
meta.tdCls = 'feestatus_refer';
}
return value;
}
},
{
sortable: true,
id: '',
dataIndex: 'CRFEESTATUS',
header: '应付费用',
align: 'center',
width: 60,
renderer: function (value, meta) {
if (value == '审核通过') {
meta.tdCls = 'feestatus_pass';
} else if (value == '录入状态') {
} else if (value == '提交审核') {
meta.tdCls = 'feestatus_refer';
} else if (value == '部分结算') {
meta.tdCls = 'feestatus_refer';
} else if (value == '结算完毕') {
meta.tdCls = 'feestatus_settle';
} else if (value == '未录入') {
} else if (value == '部分结算') {
meta.tdCls = 'feestatus_settle';
} else if (value == '部分审核') {
meta.tdCls = 'feestatus_pass';
} else if (value == '部分提交') {
meta.tdCls = 'feestatus_refer';
}
return value;
}
}, {
sortable: true,
dataIndex: 'GOODSCOUNT',
header: '件数',
width: 80
},
{
sortable: true,
dataIndex: 'CBM',
header: '体积(CBM)',
width: 80
},
{
sortable: true,
dataIndex: 'ISHW',
header: '是否有海污',
width: 80,
renderer: function (value, cellmeta) {
if (value == '1' || value == true) {
return "√";
}
}
}, {
sortable: true,
dataIndex: 'Remark',
header: '备注',
width: 150
}, {
sortable: true,
dataIndex: 'Ton',
header: '货重(吨)',
width: 150,
summaryType: 'sum',
summaryRenderer: function (value) {
return Ext.util.Format.number(value, '0.00');
}
}
];
this.Pagenum = Ext.create('Ext.form.field.Number', {
name: 'bottles',
fieldLabel: '每页记录数',
labelAlign: 'right',
value: this.PageSize,
maxValue: 100000,
width: 180,
minValue: 0,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.MainCB = Ext.create('Ext.selection.CheckboxModel', { checkOnly: true });
Ext.grid.RowNumberer = Ext.extend(Ext.grid.RowNumberer, {
width: 40
});
this.gridList = new Ext.grid.GridPanel({
store: this.storeList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
viewConfig: {
enableTextSelection: true
},
features: [{
ftype: 'summary'//Ext.grid.feature.Summary表格汇总特性
}],
trackMouseOver: true,
disableSelection: false,
selModel: this.MainCB,
columns: this.column,
bbar: [Ext.create('Ext.PagingToolbar', {
id: "bbar_ALL",
store: this.storeList,
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"
}), this.Pagenum]
});
/////////////以下部分为获取存储的gridpanel显示样式
this.column = DsTruck.GetGridPanel(USERID, this.formname, this.column);
//使用者id表名 中间column数组
this.column.unshift(new Ext.grid.RowNumberer());
this.gridList.reconfigure(this.storeList, this.column);
////////////////////////////
this.gridList.addListener('itemdblclick', function (dataview, record, item, index, e, b) {
this.SelectedRecord = record;
this.OprationStatus = 'edit';
var openSet = "height=780, width=1100, toolbar=no, menubar=no,scrollbars=1, resizable=1,location=no, status=no,Top= 10,Left= " + (screen.width - 1100) / 2
var openType = "_blank";
var openUrl = "/TruckMng/MsWlPc/Edit_ADL";
window.open(openUrl, openType, openSet);
// DsOpenEditWin("/TruckMng/MsWlPc/Edit_ADL", "", "800", "1100");
}, this);
//////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////
//#region formSearch
//#region formSearch枚举参照相关
_this = this;
this.storeFeeNameRef = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsTruckMng.ux.FeeTypeRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetFeeTypeRefList' }
});
this.storeFeeNameRef.load({ params: { condition: " ISTRUCKING='1' "} });
this.comboxFeeNameRef = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '不含此费用',
store: this.storeFeeNameRef,
name: 'FeeName',
valueField: 'Name',
displayField: 'CodeAndName',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.comboxFeeNameRef2 = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '含此费用',
store: this.storeFeeNameRef,
name: 'FeeName2',
valueField: 'Name',
displayField: 'CodeAndName',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.storeCustCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsTruckMng.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
this.storeCustCode.load({ params: { condition: "ISCONTROLLER='1'"} });
this.comboxCustCode = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '客户',
typeAhead: true,
store: this.storeCustCode,
name: 'CustName',
valueField: 'CustName',
displayField: 'CodeAndName',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.storeF_CustCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsTruckMng.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
this.storeF_CustCode.load({ params: { condition: "ISCONTROLLER='1'"} });
this.comboxF_CustCode = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '最终客户',
typeAhead: true,
store: this.storeF_CustCode,
name: 'F_CustName',
valueField: 'CustName',
displayField: 'CodeAndName',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
Ext.define('PCSTATUSmd', {
extend: 'Ext.data.Model',
fields: [
{ name: 'ID', type: 'string' },
{ name: 'STATUSNAME', type: 'string' }
]
});
var PCSTATUSData = [{ "ID": "0", "STATUSNAME": "接单" },
{ "ID": "1", "STATUSNAME": "派车" },
{ "ID": "2", "STATUSNAME": "完成"}];
this.storePCSTATUS = Ext.create('Ext.data.Store', {
model: 'PCSTATUSmd',
data: PCSTATUSData
});
this.comboxPCSTATUS = Ext.create('Ext.ux.form.field.BoxSelect', {
fieldLabel: '状态',
autosize: true,
bodyPadding: 5,
flex: 1,
//width: 500,
labelWidth: 85,
store: this.storePCSTATUS,
queryMode: 'local',
triggerOnClick: false,
valueField: 'ID',
displayField: 'STATUSNAME',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
Ext.define('FEESTATUSmd', {
extend: 'Ext.data.Model',
fields: [
{ name: 'ID', type: 'string' },
{ name: 'STATUSNAME', type: 'string' }
]
});
var FEESTATUSData = [{ "ID": "0:", "STATUSNAME": "审核通过" },
{ "ID": "1:", "STATUSNAME": "录入状态" },
{ "ID": "2:", "STATUSNAME": "提交审核" },
{ "ID": "8:", "STATUSNAME": "部分结算" },
{ "ID": "9:", "STATUSNAME": "结算完毕" },
{ "ID": "__", "STATUSNAME": "未录入" },
{ "ID": "3:", "STATUSNAME": "申请修改" },
{ "ID": "4:", "STATUSNAME": "申请删除" },
{ "ID": "6:", "STATUSNAME": "驳回提交" },
{ "ID": "7:", "STATUSNAME": "驳回申请" },
{ "ID": "_9:", "STATUSNAME": "部分结算" },
{ "ID": "_0:", "STATUSNAME": "部分审核" },
{ "ID": "_2:", "STATUSNAME": "部分提交"}];
this.storeDRFEESTATUS = Ext.create('Ext.data.Store', {
model: 'FEESTATUSmd',
data: FEESTATUSData
});
this.storeCRFEESTATUS = Ext.create('Ext.data.Store', {
model: 'FEESTATUSmd',
data: FEESTATUSData
});
this.comboxDRFEESTATUS = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '应收费用状态',
typeAhead: true,
store: this.storeDRFEESTATUS,
name: 'DRFEESTATUS',
valueField: 'ID',
displayField: 'STATUSNAME',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.comboxCRFEESTATUS = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '应付费用状态',
typeAhead: true,
store: this.storeCRFEESTATUS,
name: 'CRFEESTATUS',
valueField: 'ID',
displayField: 'STATUSNAME',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
//#endregion
//客户加载_车队
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,
flex:1,
name: 'TruckSpec',
valueField: 'CustName',
displayField: 'CodeAndName',
enableKeyEvents: true,
listeners: {
specialkey: function(field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.formSearch = Ext.widget('form', {
frame: true,
region: 'center',
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 85,
msgTarget: 'qtip'
},
items: [
{//fieldset 1
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '提单号',
name: 'PS_MBLNO',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '司机姓名',
name: 'PS_DRVNAME',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '车牌号',
name: 'TruckNo',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '目的地/工厂',
name: 'DstArea',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}
, {
fieldLabel: '船名/航次',
name: 'VoyVeg',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}
, this.comboxDRFEESTATUS
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '单据(路单)号',
name: 'PS_BILLNO',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}
, {
fieldLabel: '组织编码', hidden: true,
name: 'OrgCode'
}, this.comboxCustCode
, this.comboxF_CustCode,
{
fieldLabel: '始发地',
name: 'LoadPlace',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}
, this.comboxPCSTATUS
, this.comboxCRFEESTATUS
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
{
fieldLabel: '合同号',
id: "PS_REFBILLNO",
name: 'PS_REFBILLNO',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}
, {
fieldLabel: '箱号',
id: "ContainerNo",
name: 'ContainerNo',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
},
{
fieldLabel: '从派车日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'PS_EXPDATEBGN',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '到派车日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'PS_EXPDATEEND',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}
, this.comboxFeeNameRef
, this.comboxFeeNameRef2
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
{ fieldLabel: '品名',
id: "PINMING",
name: 'PINMING'
}, this.comboxTRUCKER,
{
fieldLabel: '从到厂日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'ARRIVEDATE_BGN',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '到到厂日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'ARRIVEDATE_END',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
},
{ xtype: 'hiddenfield' },
{ xtype: 'hiddenfield' }
]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
});
//#endregion formSearch
/*
var _this = this;
this.CB_EditMode = new Ext.form.Checkbox({
fieldLabel: '编辑模式',
labelwidth: 50, id: "CheckEdit",
listeners: {
change: function (newValue, oldValue, eOpts)//change事件
{
if (newValue.checked) {
Ext.getCmp('SaveBtn').show();
_this.gridList.hide();
_this.gridList_edit.show();
//_this.onRefreshClick();
} else {
Ext.getCmp('SaveBtn').hide();
_this.gridList.show();
_this.gridList_edit.hide();
//_this.onRefreshClick();
}
}
}
});*/
//查询工具条
var menu1 = new Ext.menu.Menu({
id: 'basicMenu',
items: [{
text: '批量设为完成',
handler: clickEnd
}, {
text: '批量设为未完成',
handler: clickNotEnd
}]
});
function clickEnd() {
panelTest.SetEnd("1");
};
function clickNotEnd() {
panelTest.SetEnd("0");
};
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [
{
text: "新建", id: "btnadd", hidden: true,
iconCls: "btnadd",
handler: function (button, event) {
this.OprationStatus = 'add';
var openSet = "height=780, width=1100, toolbar=no, menubar=no,scrollbars=1, resizable=1,location=no, status=no,Top= 10,Left= " + (screen.width - 1100) / 2
var openType = "_blank";
var openUrl = "/TruckMng/MsWlPc/Edit_ADL";
window.open(openUrl, openType, openSet);
// DsOpenEditWin("/TruckMng/MsWlPc/Edit_ADL", "", "700", "1000");
},
scope: this
}, {
text: "删除", id: "btndelete", hidden: true,
iconCls: "btndelete",
handler: function (button, event) {
this.onDeleteClick(button, event);
},
scope: this
}, '-',
{
text: "执行查询",
iconCls: "btnrefresh",
handler: function (button, event) {
this.onRefreshClick(button, event);
},
scope: this
}, {
xtype: 'button',
//width: 40,
text: "高级查询",
iconCls: "btnmore",
handler: function (button, event) {
var sql = this.getCondition();
if (this.winAccess) { this.winAccess.close(); }
this.winAccess = new Shipping.DsQuery({
});
this.winAccess.StoreList = this.storeList;
this.winAccess.formname = this.formname;
this.winAccess.condition = sql;
this.winAccess.show();
return;
},
scope: this
}, '-', {
text: "导出Excel",
id: "btnExportExcel",
iconCls: 'btnexportexcel',
handler: function (button, event) {
this.onExportClick(button, event);
},
scope: this
}, '-', /*{
id: "btnFeeAuditReject",
text: '驳回提交费用业务',
tooltip: '驳回提交费用业务',
iconCls: "btnrefuse",
handler: function (button, event) {
this.onAuditRefuseClick(button, event);
},
scope: this
},*/
{text: "批量设置完成", menu: menu1, scope: this },
{
text: "保存列表样式",
id: "btntest",
handler: function (button, event) {
var formname = this.formname;
var tempcolumns = this.gridList.columns;
DsTruck.SaveGridPanel(USERID, formname, tempcolumns, this.column, 0, false);
},
scope: this
}, {
text: "保存修改", id: "SaveBtn", hidden: true,
iconCls: "btnsave",
handler: function (button, event) {
//this.onSaveClick(button, event);
},
scope: this
},
'-',
{
text: "打印",
iconCls: "btnprint",
handler: function (button, event) {
this.Print();
},
scope: this
}
//,this.CB_EditMode
]
});
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 150,
items: [this.formSearch, this.panelBtn]
});
Ext.apply(this, {
items: [this.panelTop, this.gridList, this.gridList_edit]
});
///以下集中绑定事件
this.storeList.on('beforeload', function (store) {
if (!this.checkSearchCondition())
return;
var sql = this.getCondition();
Ext.apply(store.proxy.extraParams, { condition: sql });
}, this);
}, //end initUIComponents
onAuditRefuseClick: function (button, event) {
var sql = " A.GID in (select bsno from ch_fee where FEESTATUS=6)";
this.storeList.load({
params: { start: 0, limit: this.PageSize, condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
},
onRefreshClick: function (button, event) {
if (!this.checkSearchCondition())
return;
var sql = this.getCondition();
this.sqlcontext = sql;
this.PageSize = this.Pagenum.getValue();
this.storeList.load({
params: { start: 0, limit: this.PageSize, condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
//}
},
onDsQuery: function () {
//var girdcolums = this.gridList.getColumnMode();
var sql = this.sqlcontext;
this.PageSize = this.Pagenum.getValue();
this.storeList.pageSize = this.PageSize;
this.storeList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
},
onDeleteClick: function (button, event) {
var selections = this.gridList.getSelectionModel().getSelection();
if (selections.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择单据!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var record = selections[0];
Ext.MessageBox.confirm('提示', '确定删除该记录吗?', function (btn) {
if (btn == 'yes') {
Ext.Msg.wait('正在删除数据...');
Ext.Ajax.request({
waitMsg: '正在删除数据...',
url: '/TruckMng/MsWlPc/Delete',
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);
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 });
},
success: function (response, options) {
},
scope: this
}); //end Ext.Ajax.request
}
}, this);
}, //onDeleteClick
getCondition: function () {
var form = this.formSearch.getForm();
var sql = '';
/*
var sqldata = form.getValues();
sql = Ext.JSON.encode(sqldata);
*/
var mblNo = form.findField('PS_MBLNO').getValue();
sql = sql + getAndConSql(sql, mblNo, " (MblNo like '%" + mblNo + "%' or MBLNOse like '%" + mblNo + "%') ");
var drvName = form.findField('PS_DRVNAME').getValue();
sql = sql + getAndConSql(sql, drvName, " (DrvName like '%" + drvName + "%' or TruckNo='" + drvName + "') ");
var TruckNo = form.findField('TruckNo').getValue();
sql = sql + getAndConSql(sql, TruckNo, " TruckNo like '%" + TruckNo + "%' ");
var DstArea = form.findField('DstArea').getValue();
sql = sql + getAndConSql(sql, DstArea, " (DstArea like '%" + DstArea + "%' or DetiNation like '%" + DstArea + "%') ");
var VoyVeg = form.findField('VoyVeg').getValue();
sql = sql + getAndConSql(sql, VoyVeg, " (VoyVeg like '%" + VoyVeg + "%' ) ");
var pcBillNo = form.findField('PS_BILLNO').getValue();
sql = sql + getAndConSql(sql, pcBillNo, " BillNo like '%" + pcBillNo + "%'");
var billNo = form.findField('PS_REFBILLNO').getValue();
sql = sql + getAndConSql(sql, billNo, " (RefBillNo like '%" + billNo + "%' or RefBillNose like '%" + billNo + "%')");
var ContainerNo = form.findField('ContainerNo').getValue();
sql = sql + getAndConSql(sql, ContainerNo, " ContainerNo like '%" + ContainerNo + "%' ");
var expDate_Min = form.findField('PS_EXPDATEBGN').getRawValue();
sql = sql + getAndConSql(sql, expDate_Min, " ExpDate>='" + expDate_Min + "'");
var expDate_Max = form.findField('PS_EXPDATEEND').getRawValue();
sql = sql + getAndConSql(sql, expDate_Max, " ExpDate<='" + expDate_Max + " 23:59:59'");
var orgCode = form.findField('OrgCode').getValue();
sql = sql + getAndConSql(sql, orgCode, "OrgCode like '%" + orgCode + "%'");
var CustName = form.findField('CustName').getValue();
sql = sql + getAndConSql(sql, CustName, " customername like '%" + CustName + "%' ");
var F_CustName = form.findField('F_CustName').getValue();
sql = sql + getAndConSql(sql, F_CustName, " f_customername like '%" + F_CustName + "%' ");
var FEENAME = form.findField('FeeName').getValue();
sql = sql + getAndConSql(sql, FEENAME, " GID not in( select distinct BSNO from ch_fee where feename='" + FEENAME + "')");
var FEENAME2 = form.findField('FeeName2').getValue();
sql = sql + getAndConSql(sql, FEENAME2, " GID in( select distinct BSNO from ch_fee where feename='" + FEENAME2 + "')");
var PINMING = form.findField('PINMING').getValue();
sql = sql + getAndConSql(sql, PINMING, " pinming like '%" + PINMING + "%' ");
var TRUCKSPEC = form.findField('TruckSpec').getValue();
sql = sql + getAndConSql(sql, TRUCKSPEC, "TRUCKSPEC like '%" + TRUCKSPEC + "%' ");
var PCSTATUS = this.comboxPCSTATUS.getValue();
if (PCSTATUS != "") {
//sql = sql + getAndConSql(sql, Mainstate, "m.Mainstate in (" + Mainstate + ")");
//alert(PCSTATUS);
if (PCSTATUS == "0") {
sql = sql + getAndConSql(sql, PCSTATUS, "TruckNo=''");
}
if (PCSTATUS == "1") {
sql = sql + getAndConSql(sql, PCSTATUS, "(TruckNo<>'' and isend=0)");
}
if (PCSTATUS == "2") {
sql = sql + getAndConSql(sql, PCSTATUS, "isend=1");
}
if (PCSTATUS == "0,1") {
sql = sql + getAndConSql(sql, PCSTATUS, "isend=0");
}
if (PCSTATUS == "1,2") {
sql = sql + getAndConSql(sql, PCSTATUS, "TruckNo<>''");
}
if (PCSTATUS == "0,2") {
sql = sql + getAndConSql(sql, PCSTATUS, "(TruckNo='' or isend=1)");
}
}
var FEESTATUS = this.comboxDRFEESTATUS.getValue();
var FEESTATUSREF = this.comboxDRFEESTATUS.getRawValue();
if (FEESTATUSREF != "") {
//sql = sql + getAndConSql(sql, Mainstate, "m.Mainstate in (" + Mainstate + ")");
//alert(PCSTATUS);
if (FEESTATUS == "0:" || FEESTATUS == "1:" || FEESTATUS == "2:" || FEESTATUS == "8:" || FEESTATUS == "9:" ||
FEESTATUS == "" || FEESTATUS == "3:" || FEESTATUS == "4:" || FEESTATUS == "6:" || FEESTATUS == "7:") {
sql = sql + getAndConSql(sql, FEESTATUS, "dbo.F_GetBillDrFeeStatus(tMsWlPcHead.GId)='" + FEESTATUS + "'");
}
if (FEESTATUS == "_9:") {
sql = sql + getAndConSql(sql, FEESTATUS, " dbo.F_GetBillDrFeeStatus(tMsWlPcHead.GId) not in('','0:','1:','2:','8:','9:','3:','4:','6:','7:') "
+ "and dbo.F_GetBillDrFeeStatus(tMsWlPcHead.GId) like '%9:%' and dbo.F_GetBillDrFeeStatus(tMsWlPcHead.GId) not like '%0:%' and dbo.F_GetBillDrFeeStatus(tMsWlPcHead.GId) not like '%2:%' ");
}
if (FEESTATUS == "_0:") {
sql = sql + getAndConSql(sql, FEESTATUS, " dbo.F_GetBillDrFeeStatus(tMsWlPcHead.GId) not in('','0:','1:','2:','8:','9:','3:','4:','6:','7:') "
+ "and dbo.F_GetBillDrFeeStatus(tMsWlPcHead.GId) like '%0:%' and dbo.F_GetBillDrFeeStatus(tMsWlPcHead.GId) not like '%2:%' ");
}
if (FEESTATUS == "_2:") {
sql = sql + getAndConSql(sql, FEESTATUS, " dbo.F_GetBillDrFeeStatus(tMsWlPcHead.GId) not in('','0:','1:','2:','8:','9:','3:','4:','6:','7:') and dbo.F_GetBillDrFeeStatus(tMsWlPcHead.GId) like '%2:%'");
}
if (FEESTATUS == "__") {
sql = sql + getAndConSql(sql, FEESTATUS, " tMsWlPcHead.GId not in (SELECT BSNO FROM CH_FEE WHERE FEETYPE=1 ) ");
}
}
var LoadPlace = form.findField('LoadPlace').getValue();
sql = sql + getAndConSql(sql, LoadPlace, " LoadPlace = '" + LoadPlace + "' ");
var CRFEESTATUS = this.comboxCRFEESTATUS.getValue();
var CRFEESTATUSREF = this.comboxCRFEESTATUS.getRawValue();
if (CRFEESTATUSREF != "") {
//sql = sql + getAndConSql(sql, Mainstate, "m.Mainstate in (" + Mainstate + ")");
//alert(PCSTATUS);
if (CRFEESTATUS == "0:" || CRFEESTATUS == "1:" || CRFEESTATUS == "2:" || CRFEESTATUS == "8:" || CRFEESTATUS == "9:" ||
CRFEESTATUS == "" || CRFEESTATUS == "3:" || CRFEESTATUS == "4:" || CRFEESTATUS == "6:" || CRFEESTATUS == "7:") {
sql = sql + getAndConSql(sql, CRFEESTATUS, "dbo.F_GetBillCrFeeStatus(tMsWlPcHead.GId)='" + CRFEESTATUS + "'");
}
if (CRFEESTATUS == "_9:") {
sql = sql + getAndConSql(sql, CRFEESTATUS, " dbo.F_GetBillCrFeeStatus(tMsWlPcHead.GId) not in('','0:','1:','2:','8:','9:','3:','4:','6:','7:') "
+ "and dbo.F_GetBillCrFeeStatus(tMsWlPcHead.GId) like '%9:%' and dbo.F_GetBillCrFeeStatus(tMsWlPcHead.GId) not like '%0:%' and dbo.F_GetBillCrFeeStatus(tMsWlPcHead.GId) not like '%2:%' ");
}
if (CRFEESTATUS == "_0:") {
sql = sql + getAndConSql(sql, CRFEESTATUS, " dbo.F_GetBillCrFeeStatus(tMsWlPcHead.GId) not in('','0:','1:','2:','8:','9:','3:','4:','6:','7:') "
+ "and dbo.F_GetBillCrFeeStatus(tMsWlPcHead.GId) like '%0:%' and dbo.F_GetBillCrFeeStatus(tMsWlPcHead.GId) not like '%2:%' ");
}
if (CRFEESTATUS == "_2:") {
sql = sql + getAndConSql(sql, CRFEESTATUS, " dbo.F_GetBillCrFeeStatus(tMsWlPcHead.GId) not in('','0:','1:','2:','8:','9:','3:','4:','6:','7:') and dbo.F_GetBillCrFeeStatus(tMsWlPcHead.GId) like '%2:%'");
}
if (CRFEESTATUS == "__") {
sql = sql + getAndConSql(sql, CRFEESTATUS, " tMsWlPcHead.GId not in (SELECT BSNO FROM CH_FEE WHERE FEETYPE=2 ) ");
}
}
var ARRIVEDATE_BGN = form.findField('ARRIVEDATE_BGN').getRawValue();
sql = sql + getAndConSql(sql, ARRIVEDATE_BGN, " ARRIVEDATE>='" + ARRIVEDATE_BGN + "'");
var ARRIVEDATE_END = form.findField('ARRIVEDATE_END').getRawValue();
sql = sql + getAndConSql(sql, ARRIVEDATE_END, " ARRIVEDATE<='" + ARRIVEDATE_END + " 23:59:59'");
return sql;
},
checkSearchCondition: function () {
var form = this.formSearch.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return false;
}
return true;
},
OprationSwap: function () {
var ret = new Array();
ret[0] = this.OprationStatus;
ret[1] = this.storeList;
ret[2] = this.SelectedRecord;
if (this.OprationStatus == "add") {
ret[3] = "";
} else {
ret[3] = this.SelectedRecord.data.RefBillNo;
}
ret[4] = "MsRptPcHeadQryIndex";
ret[5] = formtype;
return ret;
},
onExportClick: function (button, event) {
GridExportExcelPage(this.gridList);
},
SetEnd: function (isEnd) {
selectedRecords = this.gridList.selModel.getSelection();
var GIDList = "";
var needalert = false;
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (rec.get('TruckNo') != "") {
if (GIDList == "") { GIDList = "'" + rec.get('GId') + "'"; }
else {
GIDList = GIDList + ",'" + rec.get('GId') + "'";
}
}
else { needalert = true; }
}
if (needalert == true) {
alert("不能将接单状态的业务设置为完成");
}
if (GIDList == "") {
return;
}
Ext.Ajax.request({
waitMsg: '正在查询毛利数据...',
url: '/TruckMng/MsWlPc/SetEnd',
async: false,
params: {
GIDList: GIDList,
isEnd: isEnd
},
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;
}
var _count = result.data;
this.onRefreshClick();
if (needalert == true) {
alert("注意,未派车(未选择车号)的业务不能设置为完成。");
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
}); //request over
}
,
Print: function () {//
var MainList = "";
var selectedRecords = this.gridList.selModel.getSelection();
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (MainList == "") { MainList = "'" + rec.get('GId') + "'"; }
else {
MainList = MainList + ",'" + rec.get('GId') + "'";
}
}
var printType = 'Print_PcHeadList'; //船期
var sql1 = " SELECT BillNo 路单号,dbo.trimdate(LrDate) 录入日期,JzDate,UserCode,UserName 录入人,OrgCode,OrgName ";
sql1 = sql1 + " ,TruckNo 车号,(select TruckNo from tMsWlTruck where TruckNo=tMsWlPcHead.TruckNo) as TruckNo_Ref ";
sql1 = sql1 + " ,DrvCode,(select DrvName from tMsWlDriver where DrvCode=tMsWlPcHead.DrvCode) as DrvCode_Ref ";
sql1 = sql1 + " ,DrvName,Mobile 司机手机,dbo.trimdate(ExpDate) 派车日期,ContainerType, ";
sql1 = sql1 + " (select CtnName from vMsTruckCtn where CtnCode=tMsWlPcHead.ContainerType) as 箱型 ";
sql1 = sql1 + " ,ContainerQty 箱量,VoyVeg 船名航次,(select CodeAndName from vMsTruckVoyInfo where VoyCode=tMsWlPcHead.VoyVeg) as VoyVeg_Ref ";
sql1 = sql1 + " ,EtDate,dbo.trimdate(EndPortDate) 截港日期,MblNo 提单号,YardCode, ";
sql1 = sql1 + " (select shortname from info_client where CODENAME=YardCode) 场站 ";
sql1 = sql1 + " ,YardName,RtnYardCode,RtnYardName as RtnYardCode_Ref ";
sql1 = sql1 + " ,RtnYardName,DstArea 目的地,DetiNation 工厂地址,FactoryAddr,LinkTel,LinkMan,RatedMil ";
sql1 = sql1 + " ,RatedFuel 额定油耗,FuelQty,RealMil,RealFuel 实际油耗,NoLoadMil,OverLoadMil 行驶里程,Ton,ActualWeight ";
sql1 = sql1 + " ,AroundTon,LoadCount,ArriveDate 到厂日期,DdCode, ";
sql1 = sql1 + " (select CodeAndName from vMsTruckUser where UserCode=tMsWlPcHead.DdCode) as 调度 ";
sql1 = sql1 + " ,DdName,ReturnDate,RefBillNo 合同号,Remark,IsDouble,RefBillNoSe,ContainerTypeSe, ";
sql1 = sql1 + " (select CodeAndName from vMsTruckCtn where CtnCode=tMsWlPcHead.ContainerTypeSe) as ContainerTypeSe_Ref ";
sql1 = sql1 + " ,ContainerQtySe,MblNoSe,VoyVegSe, ";
sql1 = sql1 + " (select CodeAndName from vMsTruckVoyInfo where VoyCode=tMsWlPcHead.VoyVegSe) as VoyVegSe_Ref ";
sql1 = sql1 + " ,EtDateSe,EndPortDateSe,YardCodeSe, ";
sql1 = sql1 + " YardNameSe as YardCodeSe_Ref,YardNameSe,DstAreaSe,FactoryAddrSe,DetiNationSe,LinkManSe,LinkTelSe,RtnYardCodeSe, ";
sql1 = sql1 + " RtnYardNameSe as RtnYardCodeSe_Ref ";
sql1 = sql1 + " ,RtnYardNameSe,BillStatus,(select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=99026 and EnumValueID=tMsWlPcHead.BillStatus) as BillStatus_Ref ";
sql1 = sql1 + " ,FeeStatus,(select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=99027 and EnumValueID=tMsWlPcHead.FeeStatus) as FeeStatus_Ref ";
sql1 = sql1 + " ,GId,TotalMil, convert(bigint ,TimeMark) as TimeMark,LoadPlace,LoadFuel,NoLoadFuel,BsType, ";
sql1 = sql1 + " (select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=99025 and EnumValueID=tMsWlPcHead.BsType) as BsType_Ref ";
sql1 = sql1 + " ,ArriveTime 到厂时间,ReturnTime,CustLikeManCode,CustLikeManName,CustTel ";
sql1 = sql1 + " ,BillRises1,ChangedMil,ChangedFuel,ChangedReson ";
sql1 = sql1 + " ,FeeOpStatus,(select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=99035 and EnumValueID=tMsWlPcHead.FeeOpStatus) as FeeOpStatus_Ref ";
sql1 = sql1 + " ,RunTimes,ContainerNo 箱号,SealNo 封号,ContainerNoSe,SealNoSe ";
sql1 = sql1 + " ,CustomerName 客户,(select description from info_client where shortname=tMsWlPcHead.CustomerName) 客户全称 ";
sql1 = sql1 + " ,F_CustomerName 最终客户,dbo.trimdate(CutoffTime) CutoffTime,isEnd ";
sql1 = sql1 + " ,FuelPrice,isnull(RatedFuel,0)*isnull(FuelPrice,0) FuelAmount ";
sql1 = sql1 + " ,RoadFee,case when TruckNo='' then '接单' else case when isnull(isend,0)=0 then '派车' else '完成' end end 派车状态,ACCDATE ";
sql1 = sql1 + " ,DGTYPE,DGTYPECODE,SECOND_DRV,dbo.trimdate(ArriveDate) ArriveDate,ArriveTime ";
sql1 = sql1 + " ,dbo.F_GetBillDrFeeStatus(tMsWlPcHead.GId) 应收费用状态 ";
sql1 = sql1 + " ,dbo.F_GetBillCrFeeStatus(tMsWlPcHead.GId) 应付费用状态 ";
sql1 = sql1 + " ,GOODSCOUNT 件数,CBM [体积(CBM)],ISHW 是否有海污 ";
sql1 = sql1 + " from tMsWlPcHead "; ///WHERE M.HTH LIKE '%1433%'
if (MainList == "") {
var T = this.getCondition();
if (T != "") { T = " where " + T; };
sql1 = sql1 + T;
} else {
sql1 = sql1 + " where Gid in( " + MainList + " ) "; //and isnull(dbo.trimdate(m.inspection_date),'')=''
}
sql1 = sql1 + " order by ExpDate,TruckNo ";
var sql2 = "";
var sql3 = "";
var sql4 = "";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
}
});