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

2086 lines
76 KiB
JavaScript

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

//集运管理-路单查询
Ext.namespace('DsTruck');
DsTruck.MsPcEditIndex = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.DsTruck.MsPcEditIndex.superclass.constructor.call(this);
};
Ext.extend(DsTruck.MsPcEditIndex, Ext.Panel, {
PageSize: 100,
PageSize2: 300,
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
initUIComponents: function () {
this.formname = "tmswlPcList_ADL_edit";
Ext.define('PCmb', {
extend: 'Ext.data.Model',
idProperty: '',
fields: [
{ name: 'GId', type: 'string' },
{ name: 'PCSTATUSREF', type: 'string' },
{ name: 'BillNo', type: 'string' },
{ name: 'ExpDate', type: 'date', dateFormat: 'Y-m-d H:i:s' },
{ name: 'CustomerName', type: 'string' },
{ name: 'CustomerNameFull', type: 'string' },
{ name: 'F_CustomerName', type: 'string' },
{ name: 'DstArea', type: 'string' },
{ name: 'LoadPlace', type: 'string' },
{ name: 'FactoryAddr', type: 'string' },
{ name: 'DetiNation', type: 'string' },
{ name: 'ContainerType', type: 'string' },
{ name: 'ContainerTypeSe', type: 'string' },
{ name: 'ContainerType_Ref', type: 'string' },
{ name: 'ContainerTypeSe', type: 'string' },
{ name: 'ContainerQty', type: 'number' },
{ name: 'TruckSpec', type: 'string' },
{ name: 'TruckNo', type: 'string' },
{ name: 'MblNo', type: 'string' },
{ name: 'EndPortDate', type: 'date' },
{ name: 'DrvCode', type: 'string' },
{ name: 'DrvName', type: 'string' },
{ name: 'Mobile', type: 'string' },
{ name: 'YardCode', type: 'string' },
{ name: 'YardCode_Ref', type: 'string' },
{ name: 'RtnYardCode', type: 'string' },
{ name: 'RtnYardCode_Ref', type: 'string' },
{ name: 'VoyVeg', type: 'string' },
{ name: 'OrgCode', type: 'string' },
{ name: 'DDCode', type: 'string' },
{ name: 'PropertyRef', type: 'string' },
{ name: 'RowNumber', type: 'string' },
{ name: 'GroupDate', type: 'string' },
{ name: 'BsType', type: 'string' },
{ name: 'RefBillNo', type: 'string' },
{ name: 'RefBillNoSe', type: 'string' },
{ name: 'DGTYPE', type: 'string' },
{ name: 'DGTYPECODE', type: 'string' },
{ name: 'SECOND_DRV', type: 'string' },
{ name: 'ArriveDate', type: 'date' },
{ name: 'ArriveTime', type: 'string' },
{ name: 'DRFEESTATUS', type: 'string' },
{ name: 'CRFEESTATUS', type: 'string' },
{ name: 'GOODSCOUNT', type: 'string' },
{ name: 'Remark', type: 'string' },
{ name: 'GoodsName', type: 'string' },
{ name: 'CBM', type: 'string' },
{ name: 'ISHW', type: 'string' },
{ name: 'Ton', type: 'number' },
{ name: 'CreateTime', type: 'string' },
{ name: 'PGId', type: 'string' },
{ name: 'ContainerNo', type: 'string' },
{ name: 'SealNo', type: 'string' },
{ name: 'ContainerNoSe', type: 'string' },
{ name: 'SealNoSe', type: 'string' }
]
});
Ext.define('Tradermb', {
extend: 'Ext.data.Model',
idProperty: 'gid',
fields: [
{ name: 'gid', type: 'string' },
{ name: 'name', type: 'string' },
{ name: 'codename', type: 'string' }
]
});
Ext.define('MsWlBsHead', {
extend: 'Ext.data.Model',
idProperty: 'BillNo',
fields: [
{ name: 'BillNo', type: 'string' },
{ name: 'LrDate', type: 'string' },
{ name: 'JzDate', type: 'string' },
{ name: 'UserCode', type: 'string' },
{ name: 'UserName', type: 'string' },
{ name: 'OrgCode', type: 'string' },
{ name: 'OrgName', type: 'string' },
{ name: 'LogisticsNo', type: 'string' },
{ name: 'CustCode', type: 'string' },
{ name: 'CustName', type: 'string' },
{ name: 'CustName_Ref', type: 'string' },
{ name: 'CustDate', type: 'string' },
{ name: 'VoyVeg', type: 'string' },
{ name: 'VoyVeg_Ref', type: 'string' },
{ name: 'EtDate', type: 'string' },
{ name: 'EndPortDate', type: 'string' },
{ name: 'MblNo', type: 'string' },
{ name: 'SalesCode', type: 'string' },
{ name: 'SalesCode_Ref', type: 'string' },
{ name: 'SalesName', type: 'string' },
{ name: 'LoadPlace', type: 'string' },
{ name: 'FactoryAddr', type: 'string' },
{ name: 'DispatchCode', type: 'string' },
{ name: 'DispatchCode_Ref', type: 'string' },
{ name: 'DispatchName', type: 'string' },
{ name: 'SendYardCode', type: 'string' },
{ name: 'SendYardCode_Ref', type: 'string' },
{ name: 'SendYardName', type: 'string' },
{ name: 'RtnYardCode', type: 'string' },
{ name: 'RtnYard', type: 'string' },
{ name: 'DstArea', type: 'string' },
{ name: 'DetiNation', type: 'string' },
{ name: 'DetiLinkTel', type: 'string' },
{ name: 'DetiLinkMan', type: 'string' },
{ name: 'BsType', type: 'string' },
{ name: 'BsType_Ref', type: 'string' },
{ name: 'Remark', type: 'string' },
{ name: 'BillStatus', type: 'string' },
{ name: 'BillStatus_Ref', type: 'string' },
{ name: 'FEESTATUS', type: 'string' },
{ name: 'FeeStatus_Ref', type: 'string' },
{ name: 'TimeMark', type: 'number' },
{ name: 'GId', type: 'string' },
{ name: 'CustLikeManCode', type: 'string' },
{ name: 'CustLikeManName', type: 'string' },
{ name: 'CustTel', type: 'string' },
{ name: 'BillRises1', type: 'string' },
{ name: 'FeeOpStatus', type: 'string' },
{ name: 'FeeOpStatus_Ref', type: 'string' },
{ name: 'VoyVegSe', type: 'string' },
{ name: 'GoodsName', type: 'string' },
{ name: 'PcType', type: 'string' },
{ name: 'TruckNo', type: 'string' },
{ name: 'PKGS', type: 'number' },
{ name: 'KGS', type: 'number' },
{ name: 'CBM', type: 'number' },
{ name: 'PCPKGS', type: 'number' },
{ name: 'PCKGS', type: 'number' },
{ name: 'PCCBM', type: 'number' },
{ name: 'NPKGS', type: 'number' },
{ name: 'NKGS', type: 'number' },
{ name: 'NCBM', type: 'number' },
{ name: 'KINDPKGS', type: 'string' },
{ name: 'CtnInfo', type: 'string' }
]
});
//#region 定义数据集
_this = this;
this.storeYardCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsTruckMng.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
this.storeYardCode.load({ params: { condition: "ISYARD='1'"} });
this.comboxYardCode = Ext.create('DsExt.ux.RefTableCombox', {
//fieldLabel: '拖箱场站',
store: this.storeYardCode,
name: 'YardCode',
valueField: 'CustCode',
displayField: 'CodeAndName'
//afteredit 设置CustName
});
this.storeRtnYardCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsTruckMng.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
this.storeRtnYardCode.load({ params: { condition: "ISYARD='1'"} });
this.comboxRtnYardCode = Ext.create('DsExt.ux.RefTableCombox', {
//fieldLabel: '返箱场站',
store: this.storeRtnYardCode,
name: 'RtnYardCode',
valueField: 'CustCode',
displayField: 'CodeAndName'
});
this.storeContainerType = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsTruckMng.ux.CtnRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCtnRefList' }
});
this.storeContainerType.load({ params: { condition: ""} });
this.comboxContainerType = Ext.create('DsExt.ux.RefTableCombox', {
//fieldLabel: '箱型',
store: this.storeContainerType,
name: 'ContainerType',
valueField: 'CtnCode',
displayField: 'CtnName', flex: 1//CtnName
, labelWidth: 30
});
this.storeCustomerName = Ext.create('DsExt.ux.RefTableStore', {
model: 'Tradermb',
proxy: { url: '/CommMng/BasicDataRef/GetTrader' }
});
this.storeCustomerName.load({ params: { condition: ""} });
this.comboxCustomerName = Ext.create('DsExt.ux.RefTableCombox', {
//fieldLabel: '客户',
id: "CustomerName", //hidden: true,
forceSelection: true,
store: this.storeCustomerName,
name: 'CustomerName',
valueField: 'name',
displayField: 'codename'
});
this.storeF_CustomerName = Ext.create('DsExt.ux.RefTableStore', {
model: 'F_Tradermb',
proxy: { url: '/CommMng/BasicDataRef/GetPCTrader' }
});
this.storeF_CustomerName.load({ params: { condition: ""} });
this.comboxF_CustomerName = Ext.create('DsExt.ux.RefTableCombox', {
//fieldLabel: '最终客户',
id: "F_CustomerName", //hidden: true,
forceSelection: true,
store: this.storeF_CustomerName,
name: 'F_CustomerName',
valueField: 'name',
displayField: 'codename'
});
this.storeTruckNo = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsWlBsHeadRefMsWlTruck',
proxy: { url: '/TruckMng/MsWlPc/GetTruckNoCanUse' },
//params: { condition: " A.truckno not in (select DISTINCT truckno from tMsWlPcHead where isnull(isend,0)=0 )"},
autoLoad: false
});
this.storeTruckNoShow = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsWlBsHeadRefMsWlTruck',
proxy: { url: '/TruckMng/MsWlPc/GetTruckNoCanUse' },
//params: { condition: " A.truckno not in (select DISTINCT truckno from tMsWlPcHead where isnull(isend,0)=0 )"},
autoLoad: false
});
this.storeTruckNoSearch = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsWlBsHeadRefMsWlTruck',
proxy: { url: '/TruckMng/MsWlPc/GetTruckNoCanUse' },
//params: { condition: " A.truckno not in (select DISTINCT truckno from tMsWlPcHead where isnull(isend,0)=0 )"},
autoLoad: false
});
this.storeTruckNo.load({ params: { condition: "" },
callback: function (r, options, success) {
if (success) {
this.storeTruckNoShow.removeAll();
this.storeTruckNoShow.add(r);
this.storeTruckNoSearch.removeAll();
this.storeTruckNoSearch.add(r);
}
},
scope: this
});
var _this = this;
this.comboxTruckNo = Ext.create('DsExt.ux.RefTableCombox', {
//fieldLabel: '车牌号',
//multiSelect:true,
store: this.storeTruckNoShow, //readOnly:true,
queryMode: 'remote',
name: 'TruckNo', id: "TruckNo",
valueField: 'TruckNo',
displayField: 'TruckNo',
//matchFieldWidth: false,
//submitValue: false,
validateOnChange: false,
listeners:
{
'change': function (field, e) {
//alert(field.lastValue);
_this.SetTruckNo(field.lastValue);
}
}
});
this.comboxTruckNoSearch = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '车牌号',
flex: 1,
//multiSelect:true,
store: this.storeTruckNoSearch, //readOnly:true,
name: 'TruckNo',
valueField: 'TruckNo',
displayField: 'TruckNo'
});
this.storeDrvName = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsWlBsHeadRefMsWlDriver',
proxy: { url: '/TruckMng/MsWlPc/GetDrvNameList' }
});
this.storeDrvName.load({ params: { condition: ""} });
this.comboxDrvName = Ext.create('DsExt.ux.RefTableCombox', {
//fieldLabel: '司机',
store: this.storeDrvName,
name: 'DrvCode',
valueField: 'DrvCode',
displayField: 'CodeAndName'
});
this.comboxDrvName2 = Ext.create('DsExt.ux.RefTableCombox', {
//fieldLabel: '司机',
store: this.storeDrvName,
name: 'SECOND_DRV',
valueField: 'DrvName',
displayField: 'CodeAndName'
});
//客户加载_车队
this.storeTRUCKER = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
this.storeTRUCKER.load({ params: { condition: "ISTRUCK='1'"} });
this.comboxTRUCKER = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeTRUCKER,
name: 'TruckSpec',
valueField: 'CustName',
displayField: 'CodeAndName'
});
//客户加载_工厂
this.storeFactry = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsCodeFactry',
proxy: { url: '/MvcShipping/MsCodeFactry/GetDataList' }
});
this.storeFactry.load();
//工厂
this.comboxFactry = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeFactry,
name: 'FactoryAddr',
valueField: 'FACTRYNAME',
displayField: 'CodeAndName'
});
this.storeBsList = Ext.create('Ext.data.Store', {
pageSize: this.PageSize2,
model: 'MsWlBsHead',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/TruckMng/MsWlBs/GetDataList',
reader: {
id: 'BillNo',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.storeBsList.load({ params: { condition: "(BsStatus is null or BsStatus<>'9')"} });
this.comboxBsList = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeBsList,
name: 'RefBillNoSe',
valueField: 'BillNo',
displayField: 'CustName_Ref'
});
//目的地
Ext.define('ModelMudidi', {
extend: 'Ext.data.Model',
fields: [
{ name: 'mudidi', type: 'string' }
]
});
this.storeMudidi = Ext.create('Ext.data.Store', {
pageSize: this.PageSize2,
model: 'ModelMudidi',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/TruckMng/MsRptPcHeadEdit/GetMuDiDi',
reader: {
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.storeMudidi.load({ params: { condition: ""} });
this.comboxMudidi = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeMudidi,
name: 'DstArea',
valueField: 'mudidi',
displayField: 'mudidi'
});
//始发地
Ext.define('ModelShifadi', {
extend: 'Ext.data.Model',
fields: [
{ name: 'shifadi', type: 'string' }
]
});
this.storeShifadi = Ext.create('Ext.data.Store', {
pageSize: this.PageSize2,
model: 'ModelShifadi',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/TruckMng/MsRptPcHeadEdit/GetShifadi',
reader: {
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.storeShifadi.load({ params: { condition: ""} });
this.comboxShifadi = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeShifadi,
name: 'LoadPlace',
valueField: 'shifadi',
displayField: 'shifadi'
});
this.comboxShifadi2 = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeShifadi,
fieldLabel: '始发地',
name: 'LoadPlace',
valueField: 'shifadi',
displayField: 'shifadi'
});
//#endregion
/////////////////////////////////////////
this.storeList = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
model: 'PCmb',
remoteSort: true,
groupField: 'GroupDate',
proxy: {
type: 'ajax',
//url: '/TruckMng/MsRptPcHeadOperate/QryData_ADL',
url: '/TruckMng/MsRptPcHeadEdit/GetDataList',
//this.storeList.proxy.url = '/TruckMng/MsRptPcHeadOperate/QryData_ADL';
reader: {
id: '',
root: 'data',
totalProperty: 'totalCount'
}
}
});
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.column = [
{
sortable: true, hidden: true,
dataIndex: 'GId',
header: 'GId',
width: 130
}, {
sortable: true, hidden: true,
dataIndex: 'BsType',
header: 'BsType',
width: 70,
align: 'center'
}, {
sortable: true,
dataIndex: 'RowNumber',
header: '当日序号',
width: 70,
align: 'center'
}, {
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: 150
}, {
sortable: true,
dataIndex: 'GroupDate',
header: '派车日期',
width: 160,
renderer: Ext.util.Format.dateRenderer('Y-m-d')
}, {
sortable: true,
dataIndex: 'RefBillNoSe',
header: '托单号',
width: 180,
editor: this.comboxBsList
}, {
sortable: true,
dataIndex: 'ExpDate',
header: '派车时间',
width: 160,
renderer: Ext.util.Format.dateRenderer('Y-m-d H:i:s'),
editor: {
//format: 'Y-m-d H:i:s',
xtype: 'datetimefield'
/*,
labelWidth: 60,
width: 220,
name: 'STARTDATETIME'*/
}
}, {
sortable: true,
dataIndex: 'TruckSpec',
header: '车队',
width: 130,
editor: this.comboxTRUCKER
}, {
sortable: true,
dataIndex: 'TruckNo',
header: '车号',
width: 130,
editor: this.comboxTruckNo
}, {
sortable: true,
dataIndex: 'CustomerName',
header: '客户',
width: 90,
editor: this.comboxCustomerName
}, {
sortable: true,
dataIndex: 'CustomerNameFull',
header: '客户全称',
width: 140
}, {
sortable: true,
dataIndex: 'F_CustomerName',
header: '最终客户',
width: 90,
editor: this.comboxF_CustomerName
}, {
sortable: true,
dataIndex: 'ContainerType',
header: '箱型',
width: 50,
renderer: function (value, p, record) {
if (value == null || value == '') return '';
else {
if (record.data.ContainerType_Ref == null || record.data.ContainerType_Ref == '') return record.data.ContainerType;
else {
return record.data.ContainerType_Ref;
}
}
},
editor: this.comboxContainerType
}, {
sortable: true,
dataIndex: 'ContainerTypeSe',
header: '箱型参考',
width: 50
}, {
sortable: true, hidden: true,
dataIndex: 'ContainerType_Ref',
header: 'ContainerType_Ref',
width: 50
}, {
sortable: true,
dataIndex: 'ContainerQty',
header: '箱量',
width: 50,
editor: {
xtype: 'numberfield',
selectOnFocus: true
}, summaryType: 'sum',
summaryRenderer: function (value) {
return Ext.util.Format.number(value, '0.00');
}
}, {
sortable: true,
dataIndex: 'LoadPlace',
header: '始发地点',
width: 120,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
// editor: this.comboxShifadi
}, {
sortable: true,
dataIndex: 'DstArea',
header: '目的地',
width: 120,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
// editor: this.comboxMudidi
}, {
sortable: true,
dataIndex: 'FactoryAddr',
header: '工厂',
width: 120,
editor: this.comboxFactry
}, {
sortable: true,
dataIndex: 'DetiNation',
header: '工厂地址',
width: 200,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
}, {
sortable: true,
dataIndex: 'YardCode',
header: '拖箱场站',
width: 150,
renderer: function (value, p, record) {
if (value == null || value == '') return '';
else return record.data.YardCode_Ref;
},
editor: this.comboxYardCode
}, {
sortable: true,
dataIndex: 'RtnYardCode',
header: '返箱场站',
width: 150,
renderer: function (value, p, record) {
if (value == null || value == '') return '';
else return record.data.RtnYardCode_Ref;
},
editor: this.comboxRtnYardCode
}, {
sortable: true, hidden: true,
dataIndex: 'YardCode_Ref',
header: '拖箱场站',
width: 150
}, {
sortable: true, hidden: true,
dataIndex: 'RtnYardCode_Ref',
header: '返箱场站',
width: 150
}, {
sortable: true,
dataIndex: 'MblNo',
header: '提单号',
width: 120,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
}, {
sortable: true,
dataIndex: 'EndPortDate',
header: '截港日期',
width: 120,
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
editor: {
xtype: 'datefield',
selectOnFocus: true
}
}, {
sortable: true,
dataIndex: 'DrvCode',
header: '司机姓名',
width: 65,
editor: this.comboxDrvName
,
renderer: function (value, p, record) {
if (value == null || value == '') return '';
else return record.data.DrvName;
}
}, {
sortable: true, hidden: true,
dataIndex: 'DrvName',
header: 'DrvName',
width: 65
//,editor: this.comboxDrvName
}, {
sortable: true,
dataIndex: 'Mobile',
header: '司机手机',
width: 76
}, {
sortable: true,
dataIndex: 'VoyVeg',
header: '船名航次',
width: 150,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
}, {
sortable: true,
dataIndex: 'PropertyRef',
header: '车辆性质',
width: 80
}, {
sortable: true,
dataIndex: 'RefBillNo',
header: '合同号',
width: 80,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
}, {
sortable: true,
dataIndex: 'DGTYPE',
header: '危险品类型',
width: 80,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
}, {
sortable: true,
dataIndex: 'DGTYPECODE',
header: '危险品代码',
width: 80,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
}, {
sortable: true,
dataIndex: 'SECOND_DRV',
header: '押车人员',
width: 80,
editor: this.comboxDrvName2
}, {
sortable: true,
dataIndex: 'ArriveDate',
header: '到厂日期',
width: 80,
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
editor: {
xtype: 'datefield',
selectOnFocus: true
}
}, {
sortable: true,
dataIndex: 'ArriveTime',
header: '到厂时间',
width: 80,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
}, {
sortable: true,
dataIndex: 'GoodsName',
header: '货物名称',
width: 150,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
}, {
sortable: true,
dataIndex: 'Remark',
header: '备注',
width: 150,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
}, {
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,
editor: {
xtype: 'numberfield',
selectOnFocus: true
}
},
{
sortable: true,
dataIndex: 'CBM',
header: '体积(CBM)',
width: 80,
editor: {
xtype: 'numberfield',
selectOnFocus: true
}
},
{
sortable: true,
dataIndex: 'ISHW',
header: '是否有海污',
width: 80,
editor: {
xtype: 'checkboxfield',
inputValue: '1',
uncheckedValue: '0'
// selectOnFocus: true
},
renderer: function (value, cellmeta) {
if (value == '1' || value == true) {
return "√";
}
}
}, {
sortable: true,
dataIndex: 'Ton',
header: '货重(吨)',
width: 80,
editor: {
xtype: 'numberfield',
selectOnFocus: true,
allowDecimals: true,
decimalPrecision: 3
},
summaryType: 'sum',
summaryRenderer: function (value, summaryData, dataIndex) {
return Ext.util.Format.number(value, '0.000');
}
}, {
sortable: true,
dataIndex: 'CreateTime',
header: '录入时间',
width: 80
}, {
dataIndex: 'PGId',
hidden: true,
readOnly: true,
header: 'PGId',
width: 0
}, {
sortable: true,
dataIndex: 'ContainerNo',
header: '箱号',
width: 150,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
}, {
sortable: true,
dataIndex: 'SealNo',
header: '封号',
width: 150,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
}, {
sortable: true,
dataIndex: 'ContainerNoSe',
header: '双背箱号',
width: 150,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
}, {
sortable: true,
dataIndex: 'SealNoSe',
header: '双背封号',
width: 150,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
}, {
sortable: true,
dataIndex: 'DDCode',
header: '调度员代码',
width: 150
}
];
this.cellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});
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: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
selModel: this.MainCB,
columns: this.column,
plugins: [this.cellEditing],
listeners: {
'beforeedit': function (editor, e, eOpts) {
if (e.field == 'Ton') {
var Gid = e.record.get('GId');
Ext.Ajax.request({
waitMsg: '',
url: '/TruckMng/MsChFee/IsFee',
params: {
billno: Gid
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (result.Success != true) {
return true;
} else {
Ext.Msg.show({ title: '警告', msg: '已录入费用,不允许修改', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
return false;
}
} else {
}
},
scope: this
});
}
},
scope: this
},
features: [
{
id: 'group',
ftype: 'groupingsummary',
groupHeaderTpl: '{name}',
hideGroupedHeader: false,
// startCollapsed: true,
enableGroupingMenu: true
}
// ,
//
// {
// ftype: 'summary'//Ext.grid.feature.Summary表格汇总特性
// }
],
bbar: [Ext.create('Ext.PagingToolbar', {
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);
////////////////////////////
//////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////
//#region formSearch
//#region formSearch枚举参照相关
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',
flex: 1,
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',
flex: 1,
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',
flex: 1,
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',
flex: 1,
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();
}
}
}
});
//客户加载_车队
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();
}
}
}
});
//#endregion
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: '编号',
flex: 1,
name: 'PS_MBLNO',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '司机姓名',
name: 'PS_DRVNAME',
flex: 1,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, this.comboxTruckNoSearch
, {
fieldLabel: '目的地/工厂',
name: 'DstArea',
flex: 1,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}
, {
fieldLabel: '船名/航次',
flex: 1,
name: 'VoyVeg',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}
]
}, {
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
, this.comboxPCSTATUS
, {
fieldLabel: '录入日期',
flex: 1,
format: 'Y-m-d',
xtype: 'datefield',
name: 'CreateTime'
}, {
fieldLabel: '箱号',
id: "ContainerNo",
name: 'ContainerNo',
flex: 1,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}
]
}, {
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: '从派车日期',
format: 'Y-m-d',
xtype: 'datefield',
flex: 1,
name: 'PS_EXPDATEBGN',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '到派车日期',
format: 'Y-m-d',
xtype: 'datefield',
flex: 1,
name: 'PS_EXPDATEEND',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}
, this.comboxFeeNameRef
, this.comboxFeeNameRef2
, this.comboxShifadi2
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
this.comboxTRUCKER,
{ xtype: 'hiddenfield' },
{ xtype: 'hiddenfield' },
{ xtype: 'hiddenfield' },
{ xtype: 'hiddenfield' }
]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
});
//#endregion formSearch
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';
//DsOpenEditWin("/TruckMng/MsWlPc/Edit_ADL", "", "700", "1000");
this.onAddPCClick(); //
},
scope: this
}, {
text: "复制新建", id: "btncopyadd", //hidden: true,
iconCls: "btncopy",
handler: function (button, event) {
//this.OprationStatus = 'add';
//DsOpenEditWin("/TruckMng/MsWlPc/Edit_ADL", "", "700", "1000");
this.onCopyPCClick(); //onCopyPCClick
},
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
}, {
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",
iconCls: "btnsave",
handler: function (button, event) {
this.onSaveClick(button, event);
},
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);
this.gridList.on('edit', function (editor, e, eOpts) {
this.PCAfterEdit(editor, e, eOpts);
}, this);
this.cellEditing.on('beforeedit', function (editor, e) {
//alert("beforeedit");
return this.PCBeforeEdit(editor, e);
}, this);
this.LoadInitData();
}, //end initUIComponents
LoadInitData: function () {
//this.storeTruckNo.load({ params: { condition: " A.truckno not in (select DISTINCT truckno from tMsWlPcHead where isnull(isend,0)=0 ) "} });
},
onAuditRefuseClick: function (button, event) {
var sql = " A.GID in (select bsno from ch_fee where FEESTATUS=6)";
this.PageSize = this.Pagenum.getValue();
this.storeList.pageSize = this.PageSize;
this.storeList.load({
params: { start: 0, limit: this.PageSize, condition: sql, expdatewithtime:"true" },
waitMsg: "正在查询数据...",
scope: this
});
},
onRefreshClick: function (button, event) {
if (!this.checkSearchCondition())
return;
var sql = this.getCondition();
this.PageSize = this.Pagenum.getValue();
this.storeList.pageSize = this.PageSize;
this.storeList.load({
params: { start: 0, limit: this.PageSize, condition: sql, expdatewithtime: "true" },
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 + "%' or BillNo like '%" + mblNo + "%' or RefBillNo like '%" + mblNo + "%' or RefBillNose 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 LoadPlace = form.findField('LoadPlace').getValue();
sql = sql + getAndConSql(sql, LoadPlace, " LoadPlace like '%" + LoadPlace + "%' ");
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 TRUCKSPEC = form.findField('TruckSpec').getValue();
sql = sql + getAndConSql(sql, TRUCKSPEC, "TRUCKSPEC like '%" + TRUCKSPEC + "%' ");
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 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 CreateTime = form.findField('CreateTime').getRawValue();
sql = sql + getAndConSql(sql, CreateTime, " CONVERT(varchar(100), CreateTime, 23) = '" + CreateTime + "'");
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') != "" && rec.get('MblNo') != "" && isEnd == "1") {
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
}
,
onSaveClick: function () {
var bodyList = [];
for (i = 0; i < this.storeList.getCount(); i += 1) {
var member = this.storeList.getAt(i);
if (member.data.ISHW == 'true') {
member.set('ISHW', 1);
} else {
member.set('ISHW', 0);
}
if (member.data.RowNumber != '合计')
bodyList.push(member);
};
var jsonBody = ConvertRecordsToJson(bodyList);
if (jsonBody == '') {
return;
}
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/TruckMng/MsRptPcHeadEdit/SaveList',
scope: this,
params: {
data: jsonBody
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
//this.storeList.commitChanges();
this.onRefreshClick();
this.storeBsList.reload();
} else {
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
} else {
Ext.Msg.show({ title: '请重试',
msg: '服务器响应出错',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
}
//alert('03');
}
});
}
,
onAddPCClick: function (button, event) {
var record = Ext.create('PCmb', {
'GId': '',
'BsType': '1',
'PCSTATUSREF': '接单',
'BillNo': '',
'ExpDate': '',
'CustomerName': '',
'F_CustomerName': '',
'DstArea': '',
'FactoryAddr': '',
'DetiNation': '',
'ContainerType': '',
'ContainerType_Ref': '',
'ContainerTypeSe':'',
'ContainerQty': '0',
'TruckSpec': '',
'TruckNo': '',
'MblNo': '',
'EndPortDate': '',
'DrvName': '',
'Mobile': '',
'YardCode': '',
'YardCode_Ref': '',
'RtnYardCode': '',
'RtnYardCode_Ref': '',
'VoyVeg': '',
'OrgCode': COMPANYID,
'DDCode': usercode,
'GOODSCOUNT': '0',
'CBM': '0',
'ISHW': '0',
'Ton': '0'
});
this.storeList.insert(0, record);
var n = this.storeList.getCount();
this.cellEditing.startEditByPosition({ row: n - 1, column: 6 });
//this.storeTruckNo.load({ params: { condition: " A.truckno not in (select DISTINCT truckno from tMsWlPcHead where isnull(isend,0)=0 ) "} });
}
,
onCopyPCClick: 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 _Oldrecord = selections[0];
var Oldrecord = _Oldrecord.data;
var record = Ext.create('PCmb', {
'GId': '',
'BsType': '1',
'PCSTATUSREF': '接单',
'BillNo': '',
'ExpDate': '', //Oldrecord.ExpDate,
'GroupDate': Oldrecord.GroupDate,
'CustomerName': Oldrecord.CustomerName,
'F_CustomerName': Oldrecord.F_CustomerName,
'DstArea': Oldrecord.DstArea,
'FactoryAddr': Oldrecord.FactoryAddr,
'DetiNation': Oldrecord.DetiNation,
'ContainerType': Oldrecord.ContainerType,
'ContainerType_Ref': Oldrecord.ContainerType_Ref,
'ContainerQty': Oldrecord.ContainerQty,
'TruckNo': Oldrecord.TruckNo,
'TruckSpec': Oldrecord.TruckSpec,
'MblNo': Oldrecord.MblNo,
'EndPortDate': Oldrecord.EndPortDate,
'DrvName': '',
'Mobile': '',
'YardCode': Oldrecord.YardCode,
'YardCode_Ref': Oldrecord.YardCode_Ref,
'RtnYardCode': Oldrecord.RtnYardCode,
'RtnYardCode_Ref': Oldrecord.RtnYardCode_Ref,
'VoyVeg': Oldrecord.VoyVeg,
'OrgCode': COMPANYID,
'DDCode': usercode,
'PropertyRef': Oldrecord.PropertyRef,
'CustomerNameFull': Oldrecord.CustomerNameFull,
'LoadPlace': Oldrecord.LoadPlace,
'RefBillNo': Oldrecord.RefBillNo,
'DGTYPECODE': Oldrecord.DGTYPECODE,
'ArriveDate': Oldrecord.ArriveDate,
'ArriveTime': Oldrecord.ArriveTime,
'GOODSCOUNT': '0',
'CBM': '0',
'ISHW': Oldrecord.ISHW
});
this.storeList.insert(0, record);
for (var i = 0; i < this.storeList.getCount(); i++) {
_f = this.storeList.getAt(i); //遍历每一行
if (_f.get('BillNo') == "") {
_f.set('ExpDate', Oldrecord.ExpDate);
} //Oldrecord.ExpDate,
}
var n = this.storeList.getCount();
this.cellEditing.startEditByPosition({ row: n - 1, column: 6 });
//this.storeTruckNo.load({ params: { condition: " A.truckno not in (select DISTINCT truckno from tMsWlPcHead where isnull(isend,0)=0 ) "} });
}
,
PCAfterEdit: function (editor, e, eOpts) {
//if (e.value == e.originalValue) { return; }
if (e.field == 'ContainerType') {//箱号
var CTNrecords = DsStoreQueryBy(this.storeContainerType, 'CtnCode', e.value);
if (CTNrecords.getCount() > 0) {
var CTNdata = CTNrecords.getAt(0).data;
e.record.set('ContainerType_Ref', CTNdata.CtnName);
} else {
e.record.set('ContainerType_Ref', '');
}
}
if (e.field == 'YardCode') {
var Yardrecords = DsStoreQueryBy(this.storeYardCode, 'CustCode', e.value);
if (Yardrecords.getCount() > 0) {
var Yarddata = Yardrecords.getAt(0).data;
e.record.set('YardCode_Ref', Yarddata.CodeAndName);
} else {
e.record.set('YardCode_Ref', '');
}
}
if (e.field == 'RtnYardCode') {
var Yardrecords = DsStoreQueryBy(this.storeRtnYardCode, 'CustCode', e.value);
if (Yardrecords.getCount() > 0) {
var Yarddata = Yardrecords.getAt(0).data;
e.record.set('RtnYardCode_Ref', Yarddata.CodeAndName);
} else {
e.record.set('RtnYardCode_Ref', '');
}
}
if (e.field == 'DrvCode') {
var Yardrecords = DsStoreQueryBy(this.storeDrvName, 'DrvCode', e.value);
if (Yardrecords.getCount() > 0) {
var Yarddata = Yardrecords.getAt(0).data;
e.record.set('DrvName', Yarddata.DrvName);
e.record.set('Mobile', Yarddata.Mobile);
} else {
e.record.set('DrvName', '');
e.record.set('Mobile', '');
}
}
if (e.field == 'TruckNo') {
var _datas = DsStoreQueryBy(this.storeTruckNo, 'TruckNo', e.value);
if (_datas.getCount() > 0) {
var _t = _datas.getAt(0).data;
e.record.set('DrvCode', _t.DrvCode);
e.record.set('DrvName', _t.DrvName);
e.record.set('Mobile', _t.Mobile);
// e.record.set('TruckSpec', _t.TEAMNAME);
//2017年10月25日10:04:44 李桂莲 车队关联到车辆归属人
e.record.set('TruckSpec', _t.DrvName);
} else {
e.record.set('DrvCode', "");
e.record.set('DrvName', "");
e.record.set('Mobile', "");
}
}
if (e.field == 'F_CustomerName') {
var _datas = DsStoreQueryBy(this.storeF_CustomerName, 'name', e.value);
if (_datas.getCount() > 0) {
var _t = _datas.getAt(0).data;
e.record.set('DetiNation', _t.ADDR);
} else {
e.record.set('DrvName', "");
}
}
if (e.field == 'RefBillNoSe') {
var _datas = DsStoreQueryBy(this.storeBsList, 'BillNo', e.value);
if (_datas.getCount() > 0) {
var _t = _datas.getAt(0).data;
e.record.set('CustomerName', _t.CustName);
e.record.set('MblNo', _t.MblNo);
e.record.set('VoyVeg', _t.VoyVeg);
e.record.set('EndPortDate', _t.EndPortDate);
e.record.set('EtDate', _t.EtDate);
e.record.set('LoadPlace', _t.LoadPlace);
e.record.set('YardCode', _t.SendYardCode);
e.record.set('FactoryAddr', _t.FactoryAddr);
e.record.set('CBM', _t.NCBM);
e.record.set('Ton', _t.NKGS);
e.record.set('RtnYardCode', _t.RtnYardCode);
e.record.set('DetiNation', _t.DetiNation);
e.record.set('GOODSCOUNT', _t.NPKGS);
e.record.set('GoodsName', _t.GoodsName);
e.record.set('DstArea', _t.DstArea);
} else {
// e.record.set('DrvName', "");
}
}
if (e.field == 'FactoryAddr') {
var _datas = DsStoreQueryBy(this.storeFactry, 'FACTRYNAME', e.value);
if (_datas.getCount() > 0) {
var _t = _datas.getAt(0).data;
e.record.set('DetiNation', _t.FACTRYADDR);
} else {
e.record.set('DetiNation', "");
}
}
}
,
PCBeforeEdit: function (editor, e, eOpts) {
/*
if (e.field == 'TruckNo') {//箱号
if (e.value != "") {
this.SearchTruckNo(e.value);
} else
*/
this.SetTruckNo();
/*
}
*/
}
,
SetTruckNo: function (_TRUCKNO) {
var TruckNoList = [];
for (i = 0; i < this.storeList.getCount(); i += 1) {
var member = this.storeList.getAt(i);
if (member.data.PCSTATUSREF != "完成" && member.data.TruckNo != "") {
TruckNoList.push(member.data.TruckNo);
}
};
var records = [];
this.storeTruckNo.each(function (r) {
if (typeof (_TRUCKNO) != "undefined" && _TRUCKNO != null && _TRUCKNO.length != 0 && _TRUCKNO.length < 7
) {
if (r.data.TruckNo.indexOf(_TRUCKNO) != -1) {
records.push(r.copy());
}
} else
records.push(r.copy());
});
this.storeTruckNoShow.removeAll();
//store2.add(records);
if (TruckNoList.length > 0) {
for (var j = 0; j < TruckNoList.length; j++) {
//alert(TruckNoList[j]);
for (var i = 0; i < records.length; i++) {
var _R = records[i].data;
if (TruckNoList[j] == _R.TruckNo) {
records.splice(i, 1);
}
}
}
this.storeTruckNoShow.add(records);
} else {
this.storeTruckNoShow.add(records);
}
}
});