Ext.namespace('DsTruck');
DsTruck.MsWl_LKPCEdit = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.DsTruck.MsWl_LKPCEdit.superclass.constructor.call(this);
};
Ext.extend(DsTruck.MsWl_LKPCEdit, Ext.Panel, {
ParentWin: null, //弹出式
ParentPanel: null, //Tab页编辑模式
FunType: '',
OpStatus: 'add',
StoreList: null,
EditRecord: null,
RefBillNo: '*',
DataLoading: true,
LoadFuel: 0,
NoLoadFuel: 0,
ratedFuel: 0,
//主要是为了处理修改事件。使用focus和blur模拟change事件。
RealMil: 0,
OverLoadMil: 0,
NoLoadMil: 0,
Ton: 0,
initUIComponents: function () {
//this.poundSerialNo = 0;
this.CargoDel = [];
this.CargoDoDel = [];
this.fixSerialNo = 0;
this.fixBodyDel = [];
this.feeSerialNo = 0;
this.feeBodyDel = [];
//#region 编辑form
//枚举参照相关(编辑form)
this.storePcBillType = Ext.create('DsExt.ux.RefEnumStore', {});
_this = this;
this.storePcBillType.load({ params: { enumTypeId: 99046} });
this.comboxPcBillType = Ext.create('DsExt.ux.RefEnumCombox', {
fieldLabel: '路单类型',
store: this.storePcBillType,
name: 'PcBillType', id: "PcBillType",
allowBlank: false,
listeners: {
focus: function (field, eOpts) {
if (_this.opStatus != "add") {
alert("已经保存的路单不能更改属性");
Ext.getCmp("PcBillType").readOnly = true;
} else {
for (var i = _this.storePcBillType.getCount() - 1; i >= 0; i--) {
var rec = _this.storePcBillType.getAt(i);
if (rec.data.EnumValueId != "4" && rec.data.EnumValueId != "5") {
_this.storePcBillType.remove(_this.storePcBillType.getAt(i));
}
}
}
},
blur: function (field, eOpts) {
},
change: function (field, newValue, oldValue) {
//alert(newValue);
if (newValue == "4") {
_this.storeLine.load({ params: { start: 0, limit: 500, condition: " LINETYPE='干线' "} });
_this.storePoint.load({ params: { start: 0, limit: 500, condition: " POINTTYPE='干线' "} });
_this.storePoint2.load({ params: { start: 0, limit: 500, condition: " POINTTYPE='干线' "} });
}
if (newValue == "5") {
_this.storeLine.load({ params: { start: 0, limit: 500, condition: " LINETYPE='水站' "} });
_this.storePoint.load({ params: { start: 0, limit: 500, condition: " POINTTYPE='水站' "} });
_this.storePoint2.load({ params: { start: 0, limit: 500, condition: " POINTTYPE='水站' "} });
}
},
scope: this
}
});
this.storeLine = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsWl_LK_Linemb',
proxy: { url: '/TruckMng/MsWl_LK_Line/GetDataList' }
});
this.storeLine2 = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsWl_LK_Linemb',
proxy: { url: '/TruckMng/MsWl_LK_Line/GetDataList' }
});
var _this = this;
this.storeLine.load({ params: { start: 0, limit: 500, condition: "" }
, callback: function (r, success, response) {
_this.storeLine2.add(r);
}
});
this.comboxLine = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '派车路线',
store: this.storeLine,
name: 'RefBillNoSe',
valueField: 'GID',
displayField: 'NAME',
listeners: {
blur: function (field, eOpts) {
//根据选择的路线 填写重驶里程/空驶里程
var form = this.formEdit.getForm();
var records = DsStoreQueryBy(this.storeLine, 'GID', field.lastValue);
if (records.getCount() > 0) {
var data = records.getAt(0).data;
OverLoadMil = form.findField('OverLoadMil');
OverLoadMil.setValue(data.OverLoadMil);
NoLoadMil = form.findField('NoLoadMil');
NoLoadMil.setValue(data.NoLoadMil);
TotalMil = form.findField('TotalMil');
TotalMil.setValue(Add(data.OverLoadMil, data.NoLoadMil));
this.LoadPoint(data.GID); //
} else {
OverLoadMil.setValue(0);
NoLoadMil.setValue(0);
TotalMil.setValue(0);
}
},
scope: this
}, flex: 1
});
//表参照相关(编辑form)
this.storeTruckNo = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsWlPcHeadRefMsWlTruck',
proxy: { url: '/TruckMng/MsWl_LKPC/GetTruckNoList' }
});
this.storeTruckNo.load({ params: { condition: "orgcode=(select codename from company where gid='" + COMPANYID + "')"} });
this.comboxTruckNo = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '车牌号',
store: this.storeTruckNo,
name: 'TruckNo',
valueField: 'TruckNo',
displayField: 'TruckNo',
listeners: {
blur: function (field, eOpts) {
this.tonAndTruckNoChange(field, field.lastValue, field.oldValue);
},
scope: this
}
});
var _this = this;
this.storeDrvName = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsWlBsHeadRefMsWlDriver',
proxy: { url: '/TruckMng/MsWl_LKPC/GetDrvNameList' }
});
this.storeDrvName.load({ params: { condition: ""} });
this.comboxDrvName = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '司机',
store: this.storeDrvName,
name: 'DrvCode',
valueField: 'DrvCode',
displayField: 'CodeAndName',
listeners: {
blur: function (field, eOpts) {
_this.setDrvName(field.lastValue);
}
}
});
this.storeDdCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsTruckMng.ux.UserRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetUserRefList' }
});
this.storeDdCode.load({ params: { condition: ""} });
this.comboxDdCode = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '调度员编码',
store: this.storeDdCode,
name: 'DdCode',
valueField: 'UserCode',
displayField: 'CodeAndName'
});
//编辑form
this.formEdit = Ext.widget('form', {
region: 'center',
frame: true,
bodyPadding: 5,
autoScroll: true,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 90,
msgTarget: 'qtip'
},
items: [
{
//fieldset 1
xtype: 'fieldset',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
//#region 界面需要的但不需要显示的控件
{
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: 'UserName',
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: '司机姓名',
name: 'DrvName',
flex: 0,
hidden: true,
margins: '0'
}, {
fieldLabel: '调度员姓名',
name: 'DdName',
flex: 0,
hidden: true,
margins: '0'
}, {
fieldLabel: '时间戳',
name: 'TimeMark',
flex: 0,
hidden: true,
margins: '0'
},
{
fieldLabel: '相关托单物流号',
name: 'RefBillNo',
flex: 1,
hidden: true,
margins: '0'
}, {
fieldLabel: '单据锁定状态',
name: 'BillStatus',
flex: 0,
hidden: true,
margins: '0'
}, {
fieldLabel: '费用锁定状态',
name: 'FeeStatus',
flex: 0,
hidden: true,
margins: '0'
}, {
fieldLabel: 'GID',
name: 'GID',
flex: 0,
hidden: true,
margins: '0'
},
//#endregion
this.comboxPcBillType,
{
fieldLabel: '物流号',
allowBlank: true,
disabled: true,
name: 'BillNo',
id: "BillNo"
}, this.comboxDdCode
,{
fieldLabel: '统计期间',
name: 'ACCDATE',
xtype: 'monthfield'
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
this.comboxTruckNo,
this.comboxDrvName, {
fieldLabel: '司机手机',
name: 'Mobile'
}, {
fieldLabel: '派车日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'ExpDate',
listeners: {
change: function (field, eOpts) {
if (field.lastValue != "") {
var ACCDATE = (this.formEdit.getForm().findField('ACCDATE').getRawValue());
if (ACCDATE == "" || ACCDATE == null) {
_M = field.lastValue.getMonth() + 1;
var _M2 = "";
if (_M < 10) {
_M2 = "0" + _M;
} else {
_M2 = "" + _M;
}
_a = field.lastValue.getFullYear() + '-' + _M2;
this.formEdit.getForm().findField('ACCDATE').setValue(_a);
}
}
this.Cansearch = false;
},
scope: this
}
}, {
fieldLabel: '返回日期', hidden: true,
format: 'Y-m-d',
xtype: 'datefield',
name: 'ReturnDate'
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxLine
, {
fieldLabel: '本次加油量',
xtype: 'numberfield',
allowBlank: false,
hideTrigger: true,
keyNavEnabled: false,
mouseWheelEnabled: false,
disabled: true,
flex: 1,
name: 'FuelQty'
}, {
fieldLabel: '运行次数', //hidden: true,
xtype: 'numberfield',
allowBlank: true,
hideTrigger: true,
keyNavEnabled: false,
mouseWheelEnabled: false,
allowDecimals: false, flex: 1,
name: 'LoadCount'
}, {
fieldLabel: '周转量',hidden:true,
name: 'AroundTon', id: "AroundTon",
flex: 1,
//hidden: true,
margins: '0'
},{
fieldLabel: '运量',
name: 'Ton', id: "Ton",
flex: 1,
//hidden: true,
margins: '0'
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '重驶里程',
xtype: 'numberfield',
allowBlank: false,
name: 'OverLoadMil',
hideTrigger: true,
keyNavEnabled: false,
mouseWheelEnabled: false
}, {
fieldLabel: '空驶里程',
xtype: 'numberfield',
allowBlank: false,
name: 'NoLoadMil',
hideTrigger: true,
keyNavEnabled: false,
mouseWheelEnabled: false
}, {
fieldLabel: '合计里程',
xtype: 'numberfield',
allowBlank: false,
name: 'TotalMil',
hideTrigger: true,
keyNavEnabled: false,
mouseWheelEnabled: false,
listeners: {
blur: function (field, eOpts) {
this.tonAndTruckNoChange(field, field.lastValue, field.oldValue);
},
scope: this
}
}, {
fieldLabel: '额定油耗', //hidden: true,
xtype: 'numberfield',
//allowBlank: false,
hideTrigger: true,
keyNavEnabled: false,
mouseWheelEnabled: false,
name: 'RatedFuel'
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '变动里程', hidden: true,
xtype: 'numberfield',
//allowBlank: false,
hideTrigger: true,
keyNavEnabled: false,
mouseWheelEnabled: false,
name: 'ChangedMil'
}, {
fieldLabel: '变动油耗', hidden: true,
xtype: 'numberfield',
//allowBlank: false,
hideTrigger: true,
keyNavEnabled: false,
mouseWheelEnabled: false,
name: 'ChangedFuel'
}, {
fieldLabel: '变动原因', hidden: true,
name: 'ChangedReson'
}, {
fieldLabel: '实际油耗', hidden: true,
xtype: 'numberfield',
//allowBlank: false,
hideTrigger: true,
keyNavEnabled: false,
name: 'RealFuel'
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textarea',
height: 36,
items: [{
fieldLabel: '备注',
height: 34,
name: 'Remark'
}, {
fieldLabel: 'ISPC', hidden: true,
xtype: 'numberfield',
//allowBlank: false,
hideTrigger: true,
keyNavEnabled: false,
name: 'ISPC', id: "ISPC"
}, {
fieldLabel: 'ISBACK', hidden: true,
xtype: 'numberfield',
//allowBlank: false,
hideTrigger: true,
keyNavEnabled: false,
name: 'ISBACK', id: "ISBACK"
}
]
}
]//end items(fieldset 1)
} //end fieldset 1
]//end root items
}); //end this.formEdit
//#endregion
//#region 按钮Toolbar
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [
{
id: 'pcbtnSave',
text: "保存",
iconCls: "btnsave",
handler: function (button, event) {
this.Save('0');
},
scope: this
},
{
id: 'pcbtnSaveAndClose',
text: "保存并关闭",
handler: function (button, event) {
this.Save('1');
},
scope: this
},
'-',
{
id: 'pcbtnSaveAndNew',
text: "保存并新建",
handler: function (button, event) {
this.Save('2');
},
scope: this
},
'-',
{
text: "关闭",
handler: function (button, event) {
window.close();
},
scope: this
},
{
id: 'pcbtnNew',
text: "新建",
handler: function (button, event) {
this.LoadData('add', '', this.RefBillNo);
var basicForm = this.formEdit.getForm();
basicForm.findField('BillNo').setDisabled(false);
},
scope: this
},
'-',
{
text: "打印",
iconCls: "btnprint",
handler: function (button, event) {
this.Print();
},
scope: this
},
'-',
{
text: "锁定派车",
iconCls: "btnyes", id: "LOCKPC",
handler: function (button, event) {
this.LOCKPC('1');
},
scope: this
},
{
text: "取消锁定派车",
iconCls: "btncancel", id: "UNLOCKPC",
handler: function (button, event) {
this.LOCKPC('0');
},
scope: this
},
'-',
{
text: "锁定返回",
iconCls: "btnyes", id: "LOCKBACK",
handler: function (button, event) {
this.LOCKBACK('1');
},
scope: this
},
{
text: "取消锁定返回",
iconCls: "btncancel", id: "UNLOCKBACK",
handler: function (button, event) {
this.LOCKBACK('0');
},
scope: this
}
]
}); //end 按钮Toolbar
//#endregion
//#region 明细表 运行
//派车明细表表格相关
this.storeCargoInfo = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsWl_LK_CargoInfomb',
proxy: { url: '/TruckMng/MsWl_LK_CargoInfo/GetDataList' }
});
this.storeCargoInfo.load({ params: { start: 0, limit:999,condition: ""} });
this.comboxCargoInfo = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeCargoInfo,
name: 'CARGOINFO_GID',
valueField: 'GID',
displayField: 'CARGONAME',
allowBlank: false,
editable: false
});
this.storePoint = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsWl_LK_Pointmb',
proxy: { url: '/TruckMng/MsWl_LK_Line/GetPointList' }
});
//this.storePoint.load({ params: { condition: ""} });
this.comboxPoint = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storePoint,
name: 'POINT_GID',
valueField: 'GID',
displayField: 'NAME'
});
//明细表-送货商品
this.storeCargo = Ext.create('Ext.data.Store', {
model: 'MsWl_LK_Cargomb',
remoteSort: false,
proxy: {
type: 'ajax',
url: '/TruckMng/MsWl_LKPC/GetBodyList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//明细表表格
this.gridListCargoCellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});
this.cargoCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
this.gridListCargo = new Ext.grid.GridPanel({
store: this.storeCargo,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
plugins: [this.gridListCargoCellEditing],
selModel: this.cargoCheckBoxModel,
selType: 'cellmodel',
tbar: [{
text: '按路线添加站点',
tooltip: '按路线添加站点',
iconCls: "btnadddetail",
handler: function (button, event) {
this.onAddAllCargoClick(button, event);
},
scope: this
}, '-', {
text: '增加明细',
tooltip: '增加明细',
iconCls: "btnadddetail",
handler: function (button, event) {
this.onAddCargoClick(button, event);
},
scope: this
}, '-', {
text: '删除明细',
tooltip: '删除明细',
iconCls: "btndeletedetail",
handler: function (button, event) {
this.onDelCargoClick(button, event);
},
scope: this
}],
columns: [
{
sortable: true, hidden: true,
dataIndex: 'GID',
header: 'GID',
width: 80
},
{
sortable: true,
dataIndex: 'SEQUENCE',
header: '顺序号',
editor: {
xtype: 'numberfield',
allowBlank: false,
selectOnFocus: true
},
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'PC_BILLNO',
header: 'PC_BILLNO',
width: 80
},
{
sortable: true,
dataIndex: 'CARGOINFO_GID',
header: '货物名称',
editor: this.comboxCargoInfo,
renderer: function (value, p, record) {
if (value == null || value == '') return '';
else return record.data.CARGO_NAME;
},
width: 120
},
{
sortable: true, hidden: true,
dataIndex: 'CARGO_NAME',
header: 'CARGO_NAME',
width: 80
},
{
sortable: true,
dataIndex: 'CargoType',
header: '货物类型',
width: 80
},
{
sortable: true,
dataIndex: 'AREA',
header: '站点区域',
width: 60
}, {
sortable: true, hidden: true,
dataIndex: 'BOXCOUNT',
header: 'BOXCOUNT',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'BOXWEIGHT',
header: 'BOXWEIGHT',
width: 80
},
{
sortable: true,
dataIndex: 'PalletCount',
header: '托盘数量',
renderer: Ext.util.Format.numberRenderer('00'),
editor: {
xtype: 'numberfield',
allowBlank: false,
selectOnFocus: true
},
width: 80
},
{
sortable: true,
dataIndex: 'CargoCount',
header: '货物件数',
renderer: Ext.util.Format.numberRenderer('00'),
editor: {
xtype: 'numberfield',
allowBlank: false,
selectOnFocus: true
},
width: 80
},
{
sortable: true,
dataIndex: 'WEIGHT',
header: '总重量',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '' + lsValue + ''; } } else { return value; } } catch (e) { return value; } return value; },
editor: {
xtype: 'numberfield',
allowBlank: false,
selectOnFocus: true
},
width: 80
},
{
sortable: true,
dataIndex: 'POINT_GID',
header: '站点名称',
editor: this.comboxPoint,
renderer: function (value, p, record) {
if (value == null || value == '') return '';
else return record.data.NAME;
},
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'NAME',
header: 'NAME',
width: 80
},
{
sortable: true,
dataIndex: 'ADDRESS',
header: '地址',
width: 120
},
{
sortable: true,
dataIndex: 'CONTACTER',
header: '联系人',
width: 80
},
{
sortable: true,
dataIndex: 'TEL',
header: '电话',
width: 120
},
{
sortable: true,
dataIndex: 'Remark',
header: '备注',
width: 200
}]
});
//明细表-库存变动明细
this.storeCargoDo = Ext.create('Ext.data.Store', {
model: 'MsWl_LK_CargoDomb',
remoteSort: false,
proxy: {
type: 'ajax',
url: '/TruckMng/MsWl_LKPC/GetCargoDoList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//明细表表格
this.gridListCargoDoCellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});
this.cargoCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
this.gridListCargoDo = new Ext.grid.GridPanel({
store: this.storeCargoDo,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
plugins: [this.gridListCargoDoCellEditing],
selModel: this.cargoCheckBoxModel,
selType: 'cellmodel',
tbar: [{
text: '增加明细',
tooltip: '增加明细',
iconCls: "btnadddetail",
handler: function (button, event) {
this.onAddCargoDoClick(button, event);
},
scope: this
}, '-', {
text: '删除明细',
tooltip: '删除明细',
iconCls: "btndeletedetail",
handler: function (button, event) {
this.onDelCargoDoClick(button, event);
},
scope: this
}],
columns: [
{
sortable: true, hidden: true,
dataIndex: 'GID',
header: 'GID',
width: 80
},
{
sortable: true,
dataIndex: 'SEQUENCE',
header: '顺序号',
editor: {
xtype: 'numberfield',
allowBlank: false,
selectOnFocus: true
},
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'PC_BILLNO',
header: 'PC_BILLNO',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'CARGO_GID',
header: 'CARGO_GID',
width: 120
},
{
sortable: true,
dataIndex: 'POINT_GID',
header: '站点名称',
editor: this.comboxPoint,
renderer: function (value, p, record) {
if (value == null || value == '') return '';
else return record.data.POINT_NAME;
},
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'POINT_NAME',
header: 'POINT_NAME',
width: 80
},
{
sortable: true,
dataIndex: 'CARGOINFO_GID',
header: '货物名称',
editor: this.comboxCargoInfo,
renderer: function (value, p, record) {
if (value == null || value == '') return '';
else return record.data.CARGO_NAME;
},
width: 120
},
{
sortable: true, hidden: true,
dataIndex: 'CARGO_NAME',
header: 'CARGO_NAME',
width: 80
},
{
sortable: true,
dataIndex: 'CargoType',
header: '货物类型',
width: 80
},
{
sortable: true,
dataIndex: 'INNUM',
header: '入库数量',
editor: {
xtype: 'numberfield',
allowBlank: false,
selectOnFocus: true
},
width: 80
},
{
sortable: true,
dataIndex: 'OUTNUM',
header: '出库数量',
editor: {
xtype: 'numberfield',
allowBlank: false,
selectOnFocus: true
},
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'DODATE',
header: 'DODATE',
width: 80
},
{
sortable: true,
dataIndex: 'Remark',
header: '备注',
width: 200,
editor: {
xtype: 'textfield',
allowBlank: false,
selectOnFocus: true
}
}]
});
//#endregion 明细表
//#region 费用表
//固定费用
this.storeCreditDebitRef = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeCreditDebitRef.load({ params: { enumTypeId: 99020} });
this.comboxCreditDebitRef = Ext.create('DsExt.ux.RefEnumCombox', {
store: this.storeCreditDebitRef,
name: 'CreditDebit'
});
this.storeFeeTypeCodeRef = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsTruckMng.ux.FeeTypeRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetFeeTypeRefList' }
});
this.storeFeeTypeCodeRef.load({ params: { condition: "ISTRUCKING='1' and ISTRUCKINGFIXED ='1'"} });
this.comboxFeeTypeCodeRef = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeFeeTypeCodeRef,
name: 'FeeTypeCode',
valueField: 'FeeCode',
displayField: 'CodeAndName'
});
this.storeBodyFix = Ext.create('Ext.data.Store', {
model: 'MsWlPcFixed',
remoteSort: false,
proxy: {
type: 'ajax',
url: '/TruckMng/MsWlPc/GetFeeFixBodyList',
reader: {
id: 'GId',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.cellEditingFix = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});
this.gridListFix = new Ext.grid.GridPanel({
store: this.storeBodyFix,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
plugins: [this.cellEditingFix],
selType: 'cellmodel',
tbar: [{
text: '增加明细',
tooltip: '增加明细',
iconCls: "btnadddetail",
handler: function (button, event) {
this.onAddDetailClick(button, event, '1');
},
scope: this
}, '-', {
text: '删除明细',
tooltip: '删除明细',
iconCls: "btndeletedetail",
handler: function (button, event) {
this.onDelDetailClick(button, event, '1');
},
scope: this
}],
columns: [{
sortable: true,
dataIndex: 'BillNo',
header: '单据号',
hidden: true,
width: 120
}, {
sortable: true,
dataIndex: 'SerialNo',
header: '序号',
width: 40
}, {
sortable: true,
dataIndex: 'FeeTypeCode',
header: '费用编码',
renderer: function (value, p, record) {
if (value == null || value == '')
return '';
else
return value + '-' + record.data.FeeTypeCode_Ref;
},
editor: this.comboxFeeTypeCodeRef,
width: 80
}, {
sortable: true,
dataIndex: 'FeeTypeName',
header: '费用名称',
hidden: true,
width: 120
}, {
sortable: true,
dataIndex: 'FsTotal',
header: '金额',
editor: {
xtype: 'numberfield',
allowBlank: false,
selectOnFocus: true
},
width: 60
}, {
sortable: true,
dataIndex: 'Remark',
header: '备注',
editor: {
xtype: 'textfield',
selectOnFocus: true
},
width: 150
}
]
});
this.gridListFix.on('edit', function (editor, e, eOpts) {
this.gridListFixAfterEdit(editor, e, eOpts);
}, this);
this.cellEditingFix.on('beforeedit', function (editor, e) {
return this.cellEditingFixBeforeEdit(editor, e);
}, this);
//费用
this.storeFeeTypeRef = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeFeeTypeRef.load({ params: { enumTypeId: 99020} });
this.comboxFeeTypeRef = Ext.create('DsExt.ux.RefEnumCombox', {
store: this.storeFeeTypeRef,
name: 'FeeType'
});
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', {
store: this.storeFeeNameRef,
name: 'FeeName',
valueField: 'Name',
displayField: 'CodeAndName'
});
this.storeCustomerNameRef = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsTruckMng.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
this.storeCustomerNameRef.load({ params: { condition: ""} });
this.comboxCustomerNameRef = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeCustomerNameRef,
name: 'CustomerName',
valueField: 'CustName',
displayField: 'CodeAndName'
});
//明细表-数据集
this.storeBodyChFee = Ext.create('Ext.data.Store', {
model: 'MsChFee',
remoteSort: false,
proxy: {
type: 'ajax',
url: '/TruckMng/MsChFee/GetDataList',
reader: {
id: 'GId',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//明细表表格
this.cellEditingChFee = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});
this.feeGridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
this.gridListChFee = new Ext.grid.GridPanel({
store: this.storeBodyChFee,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
plugins: [this.cellEditingChFee],
selModel: this.feeGridCheckBoxModel,
selType: 'cellmodel',
viewConfig: {
autoFill: true,
getRowClass: function (record, rowIndex, rowParams, store) {
var feeStatus = record.get('FeeStatus');
return DsTruck.MsChFeeGetRowClass(feeStatus);
}
},
tbar: [{
text: '增加明细',
tooltip: '增加明细',
iconCls: "btnadddetail",
handler: function (button, event) {
this.onAddDetailClick(button, event, '2');
},
scope: this
}, '-', {
text: '删除明细',
tooltip: '删除明细',
iconCls: "btndeletedetail",
handler: function (button, event) {
this.onDelDetailClick(button, event, '2');
},
scope: this
}, '-', {
text: '提交审核',
tooltip: '提交审核',
iconCls: 'btnsubmitaudit',
handler: function (button, event) {
this.onSubmitAuditClick(button, event);
},
scope: this
}, {
text: '审核通过',
tooltip: '审核通过',
iconCls: 'btnsubmitaudit',
handler: function (button, event) {
this.onPassAuditClick(button, event);
},
scope: this
}, {
text: '撤销审核',
tooltip: '撤销审核',
iconCls: 'btnsubmitaudit',
handler: function (button, event) {
this.onCancelAuditClick(button, event);
},
scope: this
}],
columns: [{
sortable: true,
dataIndex: 'GId',
header: '惟一编号',
hidden: true,
width: 160
}, {
sortable: true,
dataIndex: 'BsNo',
header: '业务编号',
hidden: true,
width: 200
}, {
sortable: true,
dataIndex: 'FeeStatus',
header: '费用状态',
renderer: function (value, p, record) {
return record.data.FeeStatus_Ref;
},
width: 66
}, {
sortable: true,
dataIndex: 'FeeName',
header: '费用名称',
editor: this.comboxFeeNameRef,
width: 100
}, {
sortable: true,
dataIndex: 'FeeType',
header: '收付方式',
renderer: function (value, p, record) {
if (value == null || value == '')
return '';
else
return value + '-' + record.data.FeeType_Ref;
},
editor: this.comboxFeeTypeRef,
width: 66
}, {
sortable: true,
dataIndex: 'FeeDescription',
header: '费用英文名称',
hidden: true,
width: 200
}, {
sortable: true,
dataIndex: 'CustomerType',
header: '客户类别',
hidden: true,
width: 200
}, {
sortable: true,
dataIndex: 'CustomerName',
header: '结算对象',
editor: this.comboxCustomerNameRef,
width: 120
}, {
sortable: true,
dataIndex: 'Unit',
header: '单位标准',
hidden: true,
width: 200
}, {
sortable: true,
dataIndex: 'UnitPrice',
header: '单价',
editor: {
xtype: 'numberfield',
selectOnFocus: true
},
width: 60
}, {
sortable: true,
dataIndex: 'Quantity',
header: '数量',
editor: {
xtype: 'numberfield',
selectOnFocus: true
},
width: 60
}, {
sortable: true,
dataIndex: 'Amount',
header: '金额',
width: 60
}, {
sortable: true,
dataIndex: 'Currency',
header: '币别',
hidden: true,
width: 200
}, {
sortable: true,
dataIndex: 'ExChangerate',
header: '汇率',
hidden: true,
width: 160
}, {
sortable: true,
dataIndex: 'Reason',
header: '原因',
hidden: true,
width: 200
}, {
sortable: true,
dataIndex: 'Remark',
header: '备注',
editor: {
xtype: 'textfield',
selectOnFocus: true
},
width: 150
}
]
});
this.gridListChFee.on('edit', function (editor, e, eOpts) {
this.gridListChFeeAfterEdit(editor, e, eOpts);
}, this);
this.cellEditingChFee.on('beforeedit', function (editor, e) {
return this.cellEditingChFeeBeforeEdit(editor, e);
}, this);
//#endregion
//#region formSearch_MC
var _this = this;
this.storeGX = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeGX.load({
params: { enumTypeId: 99047 },
callback: function (options, success, response) {
var member = _this.storeGX.getAt(0);
var firstValue = member.data.EnumValueId; //这种方法也可以获得第一项的值
_this.comboxGX.setValue(firstValue); //选中
}
});
this.comboxGX = Ext.create('DsExt.ux.RefEnumCombox', {
fieldLabel: '干线调拨单状态',
forceSelection: true,
store: this.storeGX,
name: 'GXSTATE', id: "GXSTATE",
value: "所有状态",
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
//_this.onRefreshClick();
}
}
}
});
this.storeFB = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeFB.load({ params: { enumTypeId: 99048 },
callback: function (options, success, response) {
var member = _this.storeFB.getAt(0);
var firstValue = member.data.EnumValueId; //这种方法也可以获得第一项的值
_this.comboxFB.setValue(firstValue); //选中
}
});
this.comboxFB = Ext.create('DsExt.ux.RefEnumCombox', {
fieldLabel: '分拨装运单状态',
forceSelection: true,
store: this.storeFB,
name: 'FBSTATE', id: "FBSTATE",
value: "0",
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
//_this.onRefreshClick();
}
}
}
});
this.comboxLine2 = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '派车路线',
store: this.storeLine2,
name: 'RefBillNoSe',
valueField: 'GID',
displayField: 'NAME'
});
this.storePoint2 = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsWl_LK_Pointmb',
proxy: { url: '/TruckMng/MsWl_LK_Line/GetPointList' }
});
this.storePoint2.load({ params: { start: 0, limit: 999, condition: ""} });
this.comboxPoint2 = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '站点名称',
store: this.storePoint2,
name: 'POINT_GID',
valueField: 'GID',
displayField: 'NAME'
});
this.formSearch_MC = Ext.widget('form', {
frame: true,
region: 'north',
height: 65,
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: [{
xtype: 'button',
width: 90,
text: "执行查询",
iconCls: "btnrefresh",
handler: function (button, event) {
//var PcBillType = Ext.getCmp("PcBillType").getValue();
this.SearchMC();
},
scope: this
}, this.comboxLine2
, this.comboxPoint2
, {
fieldLabel: '从制单日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'BeginDate',
id: "BeginDate"
}, {
fieldLabel: '到制单日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'EndDate',
id: "EndDate"
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
{
xtype: 'button',
width: 90,
text: "添加",
iconCls: "btnadddetail",
handler: function (button, event) {
this.AddMCCargoToCargo();
},
scope: this
}
, this.comboxGX
, this.comboxFB
, {
fieldLabel: '单号',
name: 'SheetCode'
},
{ xtype: 'hiddenfield', flex: 1 }
]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
});
//#endregion formSearch
//#region 从列表 美驰系统的站点/商品信息
//定义数据集
this.storeMCCargoList = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
model: 'MsWl_LK_MCCargomb',
remoteSort: false,
groupField: 'SheetCode',
proxy: {
type: 'ajax',
url: '/TruckMng/MsWl_LKPC/GetMCCargoList',
reader: {
id: 'ID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//定义Grid
this.MCCargoCMB = Ext.create('Ext.selection.CheckboxModel');
this.gridMCCargoList = new Ext.grid.GridPanel({
store: this.storeMCCargoList,
enableHdMenu: false,
region: 'center',
split: true,
selModel: this.MCCargoCMB,
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
columns: [{
sortable: true, hidden: true,
dataIndex: 'ID',
header: 'ID',
width: 80
},
{
sortable: true, //hidden: true,
dataIndex: 'SheetCode_Parent',
header: '单号',
width: 155
}, {
sortable: true,
dataIndex: 'SheetCode',
header: '需求单号',
width: 150
},
{
sortable: true, hidden: true,
dataIndex: 'SEQUENCE',
header: '顺序号',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'PC_BILLNO',
header: '派车单号',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'POINT_GID',
header: 'POINT_GID',
width: 80
},
{
sortable: true,
dataIndex: 'POINT_NAME',
header: '站点名称',
width: 120
},
{
sortable: true, hidden: true,
dataIndex: 'CARGOINFO_GID',
header: 'CARGOINFO_GID',
width: 80
},
{
sortable: true,
dataIndex: 'CARGO_NAME',
header: '货物名称',
width: 100
},
{
sortable: true,
dataIndex: 'PalletCount',
header: '托盘数',
renderer: Ext.util.Format.numberRenderer('00'),
width: 80
},
{
sortable: true,
dataIndex: 'CargoCount',
header: '货物数量',
renderer: Ext.util.Format.numberRenderer('00'),
width: 80
},
{
sortable: true,
dataIndex: 'CargoCount_Do',
header: '已经安排数量',
width: 80,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
if (parseFloat(record.data.CargoCount) > parseFloat(value)) {
return "" + usMoney(value, 0, '', true); +"";
} else if (parseFloat(record.data.CargoCount) == parseFloat(value)) {
return "" + usMoney(value, 0, '', true); +"";
} else {
return "" + usMoney(value, 0, '', true); +"";
}
}
},
{
sortable: true, //hidden: true,
dataIndex: 'WEIGHT',
header: '站点托盘数',
renderer: Ext.util.Format.numberRenderer('00'),
width: 60
},
{
sortable: true,
dataIndex: 'Remark',
header: '备注',
width: 80
},
{
sortable: true,
dataIndex: 'StateName',
header: '刺猬网单状态',
width: 80
},
{
sortable: true,
dataIndex: 'SignInQuantity',
header: '签收数量',
renderer: Ext.util.Format.numberRenderer('00'),
width: 80
}
],
features: [{
id: 'group',
ftype: 'grouping',
groupHeaderTpl: '{name}',
hideGroupedHeader: false,
enableGroupingMenu: true
}],
bbar: Ext.create('Ext.PagingToolbar', {
store: this.storeMCCargoList,
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"
})
});
//#endregion
//#region 布局
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 224,
items: [this.panelBtn, this.formEdit]
});
this.panelCargo = new Ext.Panel({
title: '货物/站点明细',
layout: "border",
region: 'center',
margin: '0 0',
height: 280,
items: [this.gridListCargo]
});
this.panelCargoDo = new Ext.Panel({
title: '货物变动明细',
layout: "border",
region: 'center',
margin: '0 0',
items: [this.gridListCargoDo]
});
this.panelBodyFix = new Ext.Panel({
title: '固定费用(仅报销,不计入利润统计)',
layout: "border",
region: 'west',
width: 270,
margin: '0 0',
items: [this.gridListFix]
});
this.panelBodyChFee = new Ext.Panel({
title: '费用(计入利润统计的应收应付)',
layout: "border",
region: 'center',
margin: '0 0',
items: [this.gridListChFee]
});
this.panelFee = new Ext.Panel({
layout: "border",
region: "center",
title: '费用信息',
items: [
this.panelBodyFix, this.panelBodyChFee
]
});
this.MainTab = new Ext.tab.Panel({
layout: "border",
region: "north",
split: true,
height: 240,
items: [this.panelCargo, this.panelCargoDo
]
});
this.panelMC = new Ext.Panel({
layout: "border",
region: "center",
title: '刺猬网派车信息',
items: [
this.formSearch_MC, this.gridMCCargoList
]
});
this.MainTab_MC = new Ext.tab.Panel({
layout: "border",
region: "center",
split: true,
items: [this.panelMC, this.panelFee
]
});
Ext.apply(this, {
items: [this.panelTop, this.MainTab, this.MainTab_MC]
});
//#endregion
this.opStatus = 'add';
this.ParentWin = window.parent.opener;
//初始化数据
this.InitData();
this.gridListCargoCellEditing.on('beforeedit', function (editor, e) {
return this.CargoBeforeEdit(editor, e);
}, this);
this.gridListCargo.on('edit', function (editor, e, eOpts) {
this.gridListCargoAfterEdit(editor, e, eOpts);
}, this);
this.gridListCargoDo.on('edit', function (editor, e, eOpts) {
this.gridListCargoDoAfterEdit(editor, e, eOpts);
}, this);
}, //end initUIComponents
//#region 加载数据
InitData: function () {
var condition = '';
if (this.ParentWin) {
var ret = this.ParentWin.OprationSwap();
this.opStatus = ret[0];
this.StoreList = ret[1];
this.editRecord = ret[2];
this.RefBillNo = ret[3];
}
if (this.opStatus == 'add') {
condition = " BillNo='*'";
} else if (this.opStatus == 'edit') {
condition = " BillNo='" + this.editRecord.get('BillNo') + "'";
}
this.LoadData(this.opStatus, condition, this.RefBillNo);
}, //end InitData
LoadData: function (opstatus, condition, refbillno) {
this.poundSerialNo = 0;
this.CargoDel = [];
this.CargoDoDel = [];
this.fixSerialNo = 0;
this.fixBodyDel = [];
this.feeSerialNo = 0;
this.feeBodyDel = [];
this.opStatus = opstatus;
Ext.Ajax.request({
waitMsg: '正在查询主表数据...',
url: '/TruckMng/MsWl_LKPC/GetData',
params: {
handle: opstatus,
condition: condition
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
Ext.Msg.show({
title: '提示',
msg: result.Message,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
return;
}
var data = result.data;
if (this.opStatus == 'add') {
data.RefBillNo = this.RefBillNo;
}
this.DataLoading = true;
var basicForm = this.formEdit.getForm();
basicForm.reset();
basicForm.setValues(data);
this.LoadPoint(data.RefBillNoSe);
this.DataLoading = false;
this.SetLockBtnState(data);
Ext.getCmp("BeginDate").setValue(data.ExpDate);
Ext.getCmp("EndDate").setValue(data.ExpDate);
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
var billno = '*';
var gid = '*';
if (this.opStatus == 'edit') {
billno = this.editRecord.get('BillNo');
gid = this.editRecord.get('GID');
}
this.storeBodyFix.load({ params: { billno: gid} });
this.storeBodyChFee.load({ params: { billno: gid} });
this.storeCargo.load({ params: { billno: billno} });
this.storeCargoDo.load({ params: { billno: billno} });
}, // end LoadData
SetLockBtnState: function (data) {
if (data.ISPC == "0" && data.ISBACK == "0") {
Ext.getCmp('LOCKPC').enable(); //保存按钮置灰
Ext.getCmp('UNLOCKPC').disable(); //enable;
Ext.getCmp('LOCKBACK').disable();
Ext.getCmp('UNLOCKBACK').disable();
} else
if (data.ISPC == "1" && data.ISBACK == "0") {
Ext.getCmp('LOCKPC').disable(); //保存按钮置灰
Ext.getCmp('UNLOCKPC').enable(); //enable;
Ext.getCmp('LOCKBACK').enable();
Ext.getCmp('UNLOCKBACK').disable();
} else
if (data.ISPC == "1" && data.ISBACK == "1") {
Ext.getCmp('LOCKPC').disable(); //保存按钮置灰
Ext.getCmp('UNLOCKPC').disable(); //enable;
Ext.getCmp('LOCKBACK').disable();
Ext.getCmp('UNLOCKBACK').enable();
}
},
//#endregion
//#region 美驰系统的查询
getCondition_GX: function () {
var form = this.formSearch_MC.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return '';
}
var sql = " SheetCode_Parent in(select sheetcode from tmswl_lk_MCHead where PcBillType=4) ";
var BeginDate = form.findField('BeginDate').getRawValue();
sql = sql + getAndConSql(sql, BeginDate, " SheetCode_Parent in(select sheetcode from tmswl_lk_MCHead where PreArrivalDate >='" + BeginDate + "') ");
var EndDate = form.findField('EndDate').getRawValue();
sql = sql + getAndConSql(sql, EndDate, " SheetCode_Parent in(select sheetcode from tmswl_lk_MCHead where PreArrivalDate <'" + EndDate + " 23:59:59') ");
var GXSTATE = form.findField('GXSTATE').getValue();
if (GXSTATE != "0") {
sql = sql + getAndConSql(sql, GXSTATE, " SheetCode_Parent in(select sheetcode from tmswl_lk_MCHead where state = '" + GXSTATE + "')");
}
var RefBillNoSe = form.findField('RefBillNoSe').getValue();
if (RefBillNoSe != "0") {
sql = sql + getAndConSql(sql, RefBillNoSe, " GID in(select POINTGID from tMsWl_LK_LINEDETAIL where LINEGID='" + RefBillNoSe + "')");
}
var SheetCode = form.findField('SheetCode').getValue();
sql = sql + getAndConSql(sql, SheetCode, " SheetCode_parent like '%" + SheetCode + "%' ");
var POINT_GID = form.findField('POINT_GID').getValue();
sql = sql + getAndConSql(sql, POINT_GID, " POINT_GID = '" + POINT_GID + "' ");
return sql;
},
getCondition_FB: function () {
var form = this.formSearch_MC.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return '';
}
var sql = " SheetCode_Parent in(select sheetcode from tmswl_lk_MCHead where PcBillType=5 )";
var BeginDate = form.findField('BeginDate').getRawValue();
sql = sql + getAndConSql(sql, BeginDate, " SheetCode_Parent in(select sheetcode from tmswl_lk_MCHead where PreDepartDate >='" + BeginDate + "') ");
var EndDate = form.findField('EndDate').getRawValue();
sql = sql + getAndConSql(sql, EndDate, " SheetCode_Parent in(select sheetcode from tmswl_lk_MCHead where PreDepartDate <'" + EndDate + " 23:59:59') ");
var FBSTATE = form.findField('FBSTATE').getValue();
if (FBSTATE != "0") {
sql = sql + getAndConSql(sql, FBSTATE, " SheetCode_Parent in(select sheetcode from tmswl_lk_MCHead where state = '" + FBSTATE + "')");
}
var RefBillNoSe = form.findField('RefBillNoSe').getValue();
if (RefBillNoSe != "0") {
sql = sql + getAndConSql(sql, RefBillNoSe, " Point_GID in(select POINT_GID from tMsWl_LK_LINEDETAIL where LINE_GID='" + RefBillNoSe + "')");
}
var SheetCode = form.findField('SheetCode').getValue();
sql = sql + getAndConSql(sql, SheetCode, " SheetCode_Parent like '%" + SheetCode + "%' ");
var POINT_GID = form.findField('POINT_GID').getValue();
sql = sql + getAndConSql(sql, POINT_GID, " POINT_GID = '" + POINT_GID + "' ");
return sql;
},
SearchMC: function () {
var PcBillType = Ext.getCmp("PcBillType").getValue();
if (PcBillType == "4") {
this.SearchGX();
}
if (PcBillType == "5") {
this.SearchFB();
}
},
SearchGX: function (button, event) {
var sql = this.getCondition_GX();
this.storeMCCargoList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
},
SearchFB: function (button, event) {
var sql = this.getCondition_FB();
this.storeMCCargoList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
},
//#endregion
Save: function (type) {
var basicForm = this.formEdit.getForm();
if (!basicForm.isValid()) {
return;
}
basicForm.findField('BillNo').setDisabled(false);
var data = basicForm.getValues();
basicForm.findField('BillNo').setDisabled(true);
var bodypounddatas = [];
for (var i = 0; i < this.storeCargo.getCount(); i += 1) {
var member = this.storeCargo.getAt(i);
bodypounddatas.push(member);
};
var CargoBody = ConvertRecordsToJson(bodypounddatas);
var CargoDelBody = ConvertRecordsToJsonAll(this.CargoDel);
var bodyCargoDo = [];
for (var i = 0; i < this.storeCargoDo.getCount(); i += 1) {
var member = this.storeCargoDo.getAt(i);
bodyCargoDo.push(member);
};
var CargoDoBody = ConvertRecordsToJson(bodyCargoDo);
var CargoDoDelBody = ConvertRecordsToJsonAll(this.CargoDoDel);
var bodyFixdatas = [];
for (var i = 0; i < this.storeBodyFix.getCount(); i += 1) {
var member = this.storeBodyFix.getAt(i);
bodyFixdatas.push(member);
};
var jsonFixBody = ConvertRecordsToJson(bodyFixdatas);
var jsonFixDelBody = ConvertRecordsToJsonAll(this.fixBodyDel);
var bodyChFeeDatas = [];
for (i = 0; i < this.storeBodyChFee.getCount(); i += 1) {
var memberyf = this.storeBodyChFee.getAt(i);
bodyChFeeDatas.push(memberyf);
var amount = memberyf.data.Amount;
if (amount == 0) {
Ext.Msg.show({ title: '警告',
msg: '费用的金额不允许为0,请修改后再保存',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
return;
}
}
;
var jsonChFeeBody = ConvertRecordsToJson(bodyChFeeDatas);
var jsonChFeeDelBody = ConvertRecordsToJsonAll(this.feeBodyDel);
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/TruckMng/MsWl_LKPC/Save',
scope: this,
async: false,
params: {
opstatus: this.opStatus,
data: Ext.JSON.encode(data),
Cargobody: CargoBody,
Cargodelbody: CargoDelBody,
CargoDobody: CargoDoBody,
CargoDodelbody: CargoDoDelBody,
fixbody: jsonFixBody,
fixdelbody: jsonFixDelBody,
chfeebody: jsonChFeeBody,
chfeedelbody: jsonChFeeDelBody
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
var returnData = jsonresult.Data;
this.formEdit.getForm().setValues(returnData);
if (this.opStatus == 'add') {
var arrNewRecords = this.StoreList.add(returnData);
this.editRecord = arrNewRecords[0];
} else if (this.opStatus == 'edit') {
var editp = Ext.create('MsWlPcHead', returnData);
this.editRecord.fields.each(function (field) {
if (field.persist) {
name = field.name;
if (name != 'id')
this.editRecord.set(name, editp.get(name));
}
}, this);
this.editRecord.commit();
}
if (type == '0') {
this.opStatus = 'edit';
basicForm.findField('BillNo').setDisabled(true);
for (var i = 0; i < this.storeCargo.getCount(); i += 1) {
var member = this.storeCargo.getAt(i);
member.set("PC_BILLNO", this.editRecord.get('BillNo'));
member.commit();
};
for (var i = 0; i < this.storeBodyFix.getCount(); i += 1) {
var member = this.storeBodyFix.getAt(i);
member.set("BillNo", this.editRecord.get('BillNo'));
member.commit();
}
;
// for (var i = 0; i < this.storeBodyChFee.getCount(); i += 1) {
// var member = this.storeBodyChFee.getAt(i);
// //member.set("BsNo", this.editRecord.get('BillNo'));
// member.commit();
// };
let gid = this.editRecord.get('GId');
let billno = this.editRecord.get('BillNo')
this.storeBodyChFee.load({ params: { condition: "Bsno='" + gid + "' or Bsno='" + billno + "'" } });
for (var i = 0; i < this.storeCargoDo.getCount(); i += 1) {
var member = this.storeCargoDo.getAt(i);
member.set("PC_BILLNO", this.editRecord.get('BillNo'));
member.commit();
};
this.SearchMC();
} else if (type == '1') {
window.close();
} else {
this.LoadData('add', '', this.RefBillNo);
//basicForm.findField('BillNo').setDisabled(false);
}
} else {
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
} else {
Ext.Msg.show({
title: '请重试',
msg: '服务器响应出错',
icon: Ext.Msg.ERROR,
buttons: Ext.Msg.OK
});
}
}
});
}, //end save
reLine: function (button, event) {
var _L = 1;
this.storeCargo.each(function (record) {
var ln = _L + "";
_L = _L + 1;
record.set('SEQUENCE', ln);
});
},
onAddCargoClick: function (button, event, type) {
var allow = this.getAllowOperationDetail();
if (allow == false) {
return;
}
//var newSerialno = this.GetHandleSerialNo(store, type);
var record = null;
var linenum = this.storeCargo.getCount() + 1;
record = Ext.create('MsWl_LK_Cargomb', {
GID: NewGuid(),
SEQUENCE: linenum,
PC_BILLNO: '',
CARGOINFO_GID: '',
CARGO_NAME: '',
CargoType: '',
BOXCOUNT: '0',
BOXWEIGHT: '0',
PalletCount: '0',
CargoCount: '0',
WEIGHT: '0',
POINT_GID: '',
NAME: '',
ADDRESS: '',
CONTACTER: '',
TEL: '',
Remark: ''
});
this.storeCargo.add(record);
cellediting = this.gridListCargoCellEditing;
editColumnIndex = 2;
var n = this.storeCargo.getCount();
cellediting.startEditByPosition({ row: n - 1, column: editColumnIndex });
},
//end onAddDetailClick
onAddAllCargoClick: function (button, event, type) {
if (this.CargoBeforeEdit() == true) {
for (var i = 0; i < this.storePoint.getCount(); i += 1) {
var member = this.storePoint.getAt(i);
var _P = member.data;
var record = null;
var linenum = this.storeCargo.getCount() + 1;
record = Ext.create('MsWl_LK_Cargomb', {
GID: NewGuid(),
SEQUENCE: linenum,
PC_BILLNO: '',
CARGOINFO_GID: '',
CARGO_NAME: '',
CargoType: '',
BOXCOUNT: '0',
BOXWEIGHT: '0',
PalletCount: '0',
CargoCount: '0',
WEIGHT: '0',
POINT_GID: _P.GID,
NAME: _P.NAME,
ADDRESS: _P.ADDRESS,
CONTACTER: _P.CONTACTER,
TEL: _P.TEL,
Remark: ''
});
this.storeCargo.add(record);
cellediting = this.gridListCargoCellEditing;
editColumnIndex = 2;
var n = this.storeCargo.getCount();
cellediting.startEditByPosition({ row: n - 1, column: editColumnIndex });
};
}
},
onDelCargoClick: function (button, event) {
var selectedRecords = this.gridListCargo.selModel.getSelection();
Ext.MessageBox.confirm('提示', '确定删除记录吗?', function (btn) {
if (btn == 'yes') {
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (rec.data.PC_BILLNO != "" || rec.data.PC_BILLNO != "*") //如果是新增但没有保存的数据,没有必要提交到后台
{
this.CargoDel.push(rec);
}
this.storeCargo.remove(selectedRecords[i]);
}
var _r = this.reLine();
}
}, this);
}, //onDelDetailClick
CargoBeforeEdit: function (editor, e, eOpts) {
var basicForm = this.formEdit.getForm();
var data = basicForm.getValues();
if (data.RefBillNoSe == "") {
//alert("请先选择线路");
//return false;
return true;
} else {
//this.LoadPoint(data.RefBillNoSe);
return true;
}
}
,
LoadPoint: function () {
var basicForm = this.formEdit.getForm();
var data = basicForm.getValues();
if (data.RefBillNoSe == "") {
} else {
//alert(data.RefBillNoSe);
this.storePoint.load({ params: { start: 0, limit: 500, condition: "GID in(select POINT_GID from tmswl_LK_linedetail where LINE_GID='" + data.RefBillNoSe + "')"} });
}
}
,
gridListCargoAfterEdit: function (editor, e, eOpts) {
//需要自己实现里面的事件
if (e.field == 'CARGOINFO_GID') {
var records = DsStoreQueryBy(this.storeCargoInfo, 'GID', e.value);
if (records.getCount() > 0) {
var data = records.getAt(0).data;
//var CARGO_NAME = data.CARGONAME;
//var CargoType = data.CargoType;
e.record.set('CARGO_NAME', data.CARGONAME);
e.record.set('CargoType', data.CARGOTYPE);
e.record.set('BOXCOUNT', data.BOXCOUNT);
e.record.set('BOXWEIGHT', data.BOXWEIGHT);
} else {
e.record.set('CARGO_NAME', '');
e.record.set('CargoType', '');
e.record.set('BOXCOUNT', '');
e.record.set('BOXWEIGHT', '');
}
}
if (e.field == 'POINT_GID') {
var records = DsStoreQueryBy(this.storePoint, 'GID', e.value);
if (records.getCount() > 0) {
var data = records.getAt(0).data;
//var CARGO_NAME = data.CARGONAME;
//var CargoType = data.CargoType;
e.record.set('NAME', data.NAME);
e.record.set('ADDRESS', data.ADDRESS);
e.record.set('CONTACTER', data.CONTACTER);
e.record.set('TEL', data.TEL);
} else {
e.record.set('NAME', '');
e.record.set('ADDRESS', '');
e.record.set('CONTACTER', '');
e.record.set('TEL', '');
}
}
if (e.field == 'PalletCount') {
CargoCount = Mul(e.value, e.record.get('BOXCOUNT'));
WEIGHT = Mul(e.value, e.record.get('BOXWEIGHT'));
e.record.set('CargoCount', CargoCount);
e.record.set('WEIGHT', WEIGHT);
}
var _WeightTotal = 0;
for (var i = 0; i < this.storeCargo.getCount(); i += 1) {
var member = this.storeCargo.getAt(i);
_WeightTotal = Add(_WeightTotal, member.data.WEIGHT);
};
Ext.getCmp("Ton").setValue(_WeightTotal);
},
gridListCargoDoAfterEdit: function (editor, e, eOpts) {
//需要自己实现里面的事件
if (e.field == 'CARGOINFO_GID') {
var records = DsStoreQueryBy(this.storeCargoInfo, 'GID', e.value);
if (records.getCount() > 0) {
var data = records.getAt(0).data;
//var CARGO_NAME = data.CARGONAME;
//var CargoType = data.CargoType;
e.record.set('CARGO_NAME', data.CARGONAME);
e.record.set('CargoType', data.CARGOTYPE);
//e.record.set('BOXCOUNT', data.BOXCOUNT);
//e.record.set('BOXWEIGHT', data.BOXWEIGHT);
} else {
e.record.set('CARGO_NAME', '');
e.record.set('CargoType', '');
//e.record.set('BOXCOUNT', '');
//e.record.set('BOXWEIGHT', '');
}
}
if (e.field == 'POINT_GID') {
var records = DsStoreQueryBy(this.storePoint, 'GID', e.value);
if (records.getCount() > 0) {
var data = records.getAt(0).data;
e.record.set('POINT_NAME', data.NAME);
} else {
e.record.set('POINT_NAME', '');
}
}
if (e.value != e.originalValue) {
var _Remark = e.record.get('Remark');
e.record.set('Remark', _Remark.replace("自动生成", ""));
}
},
AddMCCargoToCargo: function (editor, e, eOpts) {
var BillNo = Ext.getCmp("BillNo").getValue();
if (BillNo == "" || BillNo == "*") {
var type = "0";
var basicForm = this.formEdit.getForm();
if (!basicForm.isValid()) {
return;
}
basicForm.findField('BillNo').setDisabled(false);
var data = basicForm.getValues();
basicForm.findField('BillNo').setDisabled(true);
var bodypounddatas = [];
for (var i = 0; i < this.storeCargo.getCount(); i += 1) {
var member = this.storeCargo.getAt(i);
bodypounddatas.push(member);
};
var CargoBody = ConvertRecordsToJson(bodypounddatas);
var CargoDelBody = ConvertRecordsToJsonAll(this.CargoDel);
var bodyCargoDo = [];
for (var i = 0; i < this.storeCargoDo.getCount(); i += 1) {
var member = this.storeCargoDo.getAt(i);
bodyCargoDo.push(member);
};
var CargoDoBody = ConvertRecordsToJson(bodyCargoDo);
var CargoDoDelBody = ConvertRecordsToJsonAll(this.CargoDoDel);
var bodyFixdatas = [];
for (var i = 0; i < this.storeBodyFix.getCount(); i += 1) {
var member = this.storeBodyFix.getAt(i);
bodyFixdatas.push(member);
};
var jsonFixBody = ConvertRecordsToJson(bodyFixdatas);
var jsonFixDelBody = ConvertRecordsToJsonAll(this.fixBodyDel);
var bodyChFeeDatas = [];
for (i = 0; i < this.storeBodyChFee.getCount(); i += 1) {
var memberyf = this.storeBodyChFee.getAt(i);
bodyChFeeDatas.push(memberyf);
var amount = memberyf.data.Amount;
if (amount == 0) {
Ext.Msg.show({ title: '警告',
msg: '费用的金额不允许为0,请修改后再保存',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
return;
}
}
;
var jsonChFeeBody = ConvertRecordsToJson(bodyChFeeDatas);
var jsonChFeeDelBody = ConvertRecordsToJsonAll(this.feeBodyDel);
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/TruckMng/MsWl_LKPC/Save',
scope: this,
async: false,
params: {
opstatus: this.opStatus,
data: Ext.JSON.encode(data),
Cargobody: CargoBody,
Cargodelbody: CargoDelBody,
CargoDobody: CargoDoBody,
CargoDodelbody: CargoDoDelBody,
fixbody: jsonFixBody,
fixdelbody: jsonFixDelBody,
chfeebody: jsonChFeeBody,
chfeedelbody: jsonChFeeDelBody
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
var returnData = jsonresult.Data;
this.formEdit.getForm().setValues(returnData);
if (this.opStatus == 'add') {
var arrNewRecords = this.StoreList.add(returnData);
this.editRecord = arrNewRecords[0];
} else if (this.opStatus == 'edit') {
var editp = Ext.create('MsWlPcHead', returnData);
this.editRecord.fields.each(function (field) {
if (field.persist) {
name = field.name;
if (name != 'id')
this.editRecord.set(name, editp.get(name));
}
}, this);
this.editRecord.commit();
}
if (type == '0') {
this.opStatus = 'edit';
basicForm.findField('BillNo').setDisabled(true);
for (var i = 0; i < this.storeCargo.getCount(); i += 1) {
var member = this.storeCargo.getAt(i);
member.set("PC_BILLNO", this.editRecord.get('BillNo'));
member.commit();
};
for (var i = 0; i < this.storeBodyFix.getCount(); i += 1) {
var member = this.storeBodyFix.getAt(i);
member.set("BillNo", this.editRecord.get('BillNo'));
member.commit();
}
;
// for (var i = 0; i < this.storeBodyChFee.getCount(); i += 1) {
// var member = this.storeBodyChFee.getAt(i);
// //member.set("BsNo", this.editRecord.get('BillNo'));
// member.commit();
// };
let gid = this.editRecord.get('GId');
let billno = this.editRecord.get('BillNo')
this.storeBodyChFee.load({ params: { condition: "Bsno='" + gid + "' or Bsno='" + billno + "'" } });
for (var i = 0; i < this.storeCargoDo.getCount(); i += 1) {
var member = this.storeCargoDo.getAt(i);
member.set("PC_BILLNO", this.editRecord.get('BillNo'));
member.commit();
};
//this.SearchMC();
} else if (type == '1') {
window.close();
} else {
this.LoadData('add', '', this.RefBillNo);
//basicForm.findField('BillNo').setDisabled(false);
}
} 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
});
}
}
});
}
var BillNo = Ext.getCmp("BillNo").getValue();
if (BillNo == "") {
return;
} else {
}
var selectedRecords = this.gridMCCargoList.selModel.getSelection();
var IDList = "";
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (IDList == "")
{
IDList = "'" + rec.data.ID + "'";
} else {
IDList = IDList + ",'" + rec.data.ID + "'";
}
}
//20160809 如果是分拨 则根据站点写入区域
var basicForm = this.formEdit.getForm();
var PcBillType= basicForm.findField('PcBillType').getValue();
Ext.Ajax.request({
waitMsg: '正在添加信息...',
url: '/TruckMng/MsWl_LKPC/AddMCCargoToCargo',
async: false,
params: {
BillNo: BillNo,
IDList: IDList,
PcBillType: PcBillType
},
callback: function (options, success, response) {
if (success) {
//重新加载两个子表
this.storeCargo.load({ params: { billno: BillNo} });
this.SearchMC();
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
resultFuel = 0;
}
},
scope: this
});
},
//#region 明细表合计
setAllTotal: function () {
this.setOverLoadMilTotal();
this.setNoLoadMilTotal();
this.setLoadCountTotal();
// this.setWeightCountTotal();
this.setNoFuelCountTotal();
},
setOverLoadMilTotal: function () {
var total = this.calcDetailTotal('OverLoadMil');
this.setHeadFieldValue('OverLoadMil', total);
},
setNoLoadMilTotal: function () {
var total = this.calcDetailTotal('NoLoadMil');
this.setHeadFieldValue('NoLoadMil', total);
},
setLoadCountTotal: function () {
var total = this.calcDetailTotal('LoadCount');
this.setHeadFieldValue('LoadCount', total);
},
setNoFuelCountTotal: function () {
var total = this.calcDetailTotal('RatedFuel');
this.setHeadFieldValue('RatedFuel', total);
},
calcDetailTotal: function (fieldName) {
var total = 0;
for (var i = 0; i < this.storePoundBodyList.getCount(); i += 1) {
var member = this.storePoundBodyList.getAt(i);
var value = member.get(fieldName);
total = total + value;
}
return total;
},
setHeadFieldValue: function (fieldName, value) {
var field = this.formEdit.getForm().findField(fieldName);
field.setValue(value);
},
//#endregion
copyBulkHeadData: function (e, bulkHeadData) {
if (bulkHeadData != null) {
e.record.set('CustCode', bulkHeadData.CustCode);
e.record.set('CustCode_Ref', bulkHeadData.CustName);
e.record.set('CustName', bulkHeadData.CustName);
e.record.set('ClsName', bulkHeadData.ClsName);
e.record.set('PNum', bulkHeadData.PNum - bulkHeadData.OverPNum);
e.record.set('PKgs', bulkHeadData.PKgs);
e.record.set('Weight', (bulkHeadData.PNum - bulkHeadData.OverPNum) * bulkHeadData.PKgs);
e.record.set('LoadPlace', bulkHeadData.SedArea);
e.record.set('UnLoadPlace', bulkHeadData.DstArea);
} else {
e.record.set('CustCode', '');
e.record.set('CustCode_Ref', '');
e.record.set('CustName', '');
e.record.set('ClsName', '');
e.record.set('PNum', 0);
e.record.set('PKgs', 0);
e.record.set('Weight', 0);
e.record.set('LoadPlace', '');
e.record.set('UnLoadPlace', '');
}
},
//#region 商品变动表操作
onAddCargoDoClick: function (button, event, type) {
var allow = this.getAllowOperationDetail();
if (allow == false) {
return;
}
//var newSerialno = this.GetHandleSerialNo(store, type);
var record = null;
var linenum = this.storeCargoDo.getCount() + 1;
record = Ext.create('MsWl_LK_CargoDomb', {
GID: NewGuid(),
SEQUENCE: linenum,
PC_BILLNO: '',
CARGO_GID: '',
CARGOINFO_GID: '',
CARGO_NAME: '',
INNUM: '0',
OUTNUM: '0',
DODATE: '',
Remark: ''
});
this.storeCargoDo.add(record);
cellediting = this.gridListCargoDoCellEditing;
editColumnIndex = 2;
var n = this.storeCargoDo.getCount();
cellediting.startEditByPosition({ row: n - 1, column: editColumnIndex });
},
onDelCargoDoClick: function (button, event) {
var selectedRecords = this.gridListCargoDo.selModel.getSelection();
Ext.MessageBox.confirm('提示', '确定删除记录吗?', function (btn) {
if (btn == 'yes') {
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (rec.data.PC_BILLNO != "" || rec.data.PC_BILLNO != "*") //如果是新增但没有保存的数据,没有必要提交到后台
{
this.CargoDoDel.push(rec);
}
this.storeCargoDo.remove(selectedRecords[i]);
}
var _r = this.reLine();
}
}, this);
}, //onDelDetailClick
//#endregion
//#region 明细操作
onAddDetailClick: function (button, event, type) {
var allow = this.getAllowOperationDetail();
if (allow == false) {
return;
}
var store = null;
if (type == 1) {
store = this.storeBodyFix;
} else if (type == 2) {
store = this.storeBodyChFee;
} else if (type == 3) {
store = this.storePoundBodyList;
} else {
alert('函数(onAddDetailClick)的参数type类型设置的不对');
return;
}
var newSerialno = this.GetHandleSerialNo(store, type);
var record = null;
if (type == 1) {
record = Ext.create('MsWlPcFixed', {
GId: NewGuid(),
BillNo: '*',
SerialNo: newSerialno,
FeeStatus: 1,
FeeStatus_Ref: '录入状态',
AuditStatus: 0,
CreditDebit: "2",
CreditDebit_Ref: "应付",
FeeTypeCode: '',
FeeTypeCode_Ref: '',
FeeTypeName: '',
DistCount: 0,
Price: 0,
FsTotal: 0,
JsTotal: 0,
Remark: ''
});
} else if (type == 2) {
record = Ext.create('MsChFee', {
GId: NewGuid(),
BsNo: '*',
FeeStatus: 1,
FeeStatus_Ref: '录入状态',
FeeType: 1,
FeeType_Ref: '应收',
FeeName: '',
FeeName_Ref: '',
FeeDescription: '',
CustomerType: '',
CustomerName: this.getPoundcustname(),
CustomerName_Ref: '',
Unit: '',
UnitPrice: 0,
Quantity: 1,
Amount: 0,
Currency: 'RMB',
ExChangerate: 1,
Reason: '',
Remark: '',
Commissionrate: 0,
Settlement: 0,
Invoice: 0,
OrderAmount: 0,
OrderInvoice: 0,
SubmitDate: null,
Auditoperator: '',
AuditDate: null,
EnteroPerator: GetCookie_UserId(),
EnterDate: null,
DebitNo: '',
IsDebit: "0",
IsOpen: "0",
IsAdvancedpay: "0",
Sort: "0",
IsInvoice: "0",
FeeFrt: '',
IsCrmOrderFee: "0",
AuditStatus: 0,
InvoiceNum: '',
ChequeNum: '',
WmsOutBsNo: ''
});
} else if (type == 3) {
record = Ext.create('MsWlDjPound', {
BillNo: '*',
SerialNo: newSerialno,
DjBillNo: '',
DjBillNo_Ref: '',
GId: NewGuid(),
CustCode: '',
CustCode_Ref: '',
CustName: '',
ClsName: '',
DepartureDate: '',
LoadPlace: '',
UnLoadPlace: '',
PlanOverLoadMil: 0,
PlanNoLoadMil: 0,
PlanLoadCount: 0,
OverLoadMil: 0,
NoLoadMil: 0,
LoadCount: 0,
PNum: 0,
PKgs: 0,
Weight: 0,
WorkTime: ''
});
}
store.add(record);
var editColumnIndex = 0;
var cellediting = null;
if (type == 1) {
cellediting = this.cellEditingFix;
editColumnIndex = 2;
} else if (type == 2) {
cellediting = this.cellEditingChFee;
editColumnIndex = 4;
} else if (type == 3) {
cellediting = this.PoundgridListCellEditing;
editColumnIndex = 2;
}
var n = store.getCount();
cellediting.startEditByPosition({ row: n - 1, column: editColumnIndex });
},
GetHandleSerialNo: function (store, type) {
var result = 0;
if (type == 1) {
result = this.fixSerialNo;
} else if (type == 2) {
result = this.feeSerialNo;
} else if (type == 3) {
result = this.poundSerialNo;
}
if (result == 0) {
for (var i = 0; i < store.getCount(); i += 1) {
var member = store.getAt(i);
if (member.data.SerialNo > result) {
result = member.data.SerialNo;
}
}
}
result = result + 1;
if (type == 1) {
this.fixSerialNo = result;
} else if (type == 2) {
this.feeSerialNo = result;
} else if (type == 3) {
this.poundSerialNo = result;
}
return result;
},
onDelDetailClick: function (button, event, type) {
var allow = this.getAllowOperationDetail();
if (allow == false) {
return;
}
var store = null;
if (type == 1) {
store = this.storeBodyFix;
} else if (type == 2) {
store = this.storeBodyChFee;
} else if (type == 3) {
store = this.storePoundBodyList;
} else {
alert('函数(onAddDetailClick)的参数type类型设置的不对');
return;
}
var result = 0;
if (type == '1') {
result = this.fixSerialNo;
} else if (type == '2') {
result = this.feeSerialNo;
} else if (type == '3') {
result = this.poundSerialNo;
}
if (result == 0) {
for (var i = 0; i < store.getCount(); i += 1) {
var member = store.getAt(i);
if (member.data.SerialNo > this.giSerialNo) {
result = member.data.SerialNo;
}
}
}
if (type == '1') {
this.fixSerialNo = result;
} else if (type == '2') {
this.feeSerialNo = result;
} else if (type == '3') {
this.poundSerialNo = result;
}
var selectedRecords = [];
if (type == '1') {
selectedRecords = this.gridListFix.selModel.getSelection();
} else if (type == '2') {
selectedRecords = this.gridListChFee.selModel.getSelection();
var candelete = DsTruck.CheckChFeeDelete(selectedRecords);
if (candelete == false)
return;
} else if (type == '3') {
selectedRecords = this.PoundgridList.selModel.getSelection();
}
if (selectedRecords.length > 0) {
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (rec.BillNo != "" || rec.BillNo != "*") //如果是新增但没有保存的数据,没有必要提交到后台
{
if (type == '1') {
this.fixBodyDel.push(rec);
} else if (type == '2') {
this.feeBodyDel.push(rec);
} else if (type == '3') {
this.CargoDel.push(rec);
}
}
if (type == '1') {
this.storeBodyFix.remove(selectedRecords[i]);
} else if (type == '2') {
this.storeBodyChFee.remove(selectedRecords[i]);
} else if (type == '3') {
this.storePoundBodyList.remove(selectedRecords[i]);
this.setAllTotal();
}
}
}
},
getAllowOperationDetail: function () {
var feeStatus = this.getFeeStatus();
if (feeStatus == '0')
return true;
else {
//Ext.Msg.show({ title: '错误', msg: "费用已锁定,不允许操作费用!", icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
//return false;
}
},
//#endregion
//#region 站点/商品操作
GetHandleSerialNo: function (store, type) {
var result = 0;
if (type == 1) {
result = this.fixSerialNo;
} else if (type == 2) {
result = this.feeSerialNo;
} else if (type == 3) {
result = this.poundSerialNo;
}
if (result == 0) {
for (var i = 0; i < store.getCount(); i += 1) {
var member = store.getAt(i);
if (member.data.SerialNo > result) {
result = member.data.SerialNo;
}
}
}
result = result + 1;
if (type == 1) {
this.fixSerialNo = result;
} else if (type == 2) {
this.feeSerialNo = result;
} else if (type == 3) {
this.poundSerialNo = result;
}
return result;
},
onDelDetailClick: function (button, event, type) {
var allow = this.getAllowOperationDetail();
if (allow == false) {
return;
}
var store = null;
if (type == 1) {
store = this.storeBodyFix;
} else if (type == 2) {
store = this.storeBodyChFee;
} else if (type == 3) {
store = this.storePoundBodyList;
} else {
alert('函数(onAddDetailClick)的参数type类型设置的不对');
return;
}
var result = 0;
if (type == '1') {
result = this.fixSerialNo;
} else if (type == '2') {
result = this.feeSerialNo;
} else if (type == '3') {
result = this.poundSerialNo;
}
if (result == 0) {
for (var i = 0; i < store.getCount(); i += 1) {
var member = store.getAt(i);
if (member.data.SerialNo > this.giSerialNo) {
result = member.data.SerialNo;
}
}
}
if (type == '1') {
this.fixSerialNo = result;
} else if (type == '2') {
this.feeSerialNo = result;
} else if (type == '3') {
this.poundSerialNo = result;
}
var selectedRecords = [];
if (type == '1') {
selectedRecords = this.gridListFix.selModel.getSelection();
} else if (type == '2') {
selectedRecords = this.gridListChFee.selModel.getSelection();
var candelete = DsTruck.CheckChFeeDelete(selectedRecords);
if (candelete == false)
return;
} else if (type == '3') {
selectedRecords = this.PoundgridList.selModel.getSelection();
}
if (selectedRecords.length > 0) {
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (rec.BillNo != "" || rec.BillNo != "*") //如果是新增但没有保存的数据,没有必要提交到后台
{
if (type == '1') {
this.fixBodyDel.push(rec);
} else if (type == '2') {
this.feeBodyDel.push(rec);
} else if (type == '3') {
this.CargoDel.push(rec);
}
}
if (type == '1') {
this.storeBodyFix.remove(selectedRecords[i]);
} else if (type == '2') {
this.storeBodyChFee.remove(selectedRecords[i]);
} else if (type == '3') {
this.storePoundBodyList.remove(selectedRecords[i]);
this.setAllTotal();
}
}
}
},
getAllowOperationDetail: function () {
var feeStatus = this.getFeeStatus();
if (feeStatus == '0')
return true;
else {
Ext.Msg.show({ title: '错误', msg: "费用已锁定,不允许操作费用!", icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
return false;
}
},
//#endregion
//#region 表格的AfterEdit
gridListFixAfterEdit: function (editor, e, eOpts) {
if (e.field == 'FeeTypeCode') {
var records = DsStoreQueryBy(this.storeFeeTypeCodeRef, 'FeeCode', e.value);
if (records.getCount() > 0) {
var data = records.getAt(0).data;
e.record.set('FeeTypeCode_Ref', data.Name);
e.record.set('FeeTypeName', data.Name);
} else {
e.record.set('FeeTypeCode_Ref', '');
e.record.set('FeeTypeName', '');
}
} else if (e.field == 'CreditDebit') {
var recordsCreditDebit = DsStoreQueryBy(this.storeCreditDebitRef, 'EnumValueId', e.value);
if (recordsCreditDebit.getCount() > 0) {
var dataCreditDebit = recordsCreditDebit.getAt(0).data;
e.record.set('CreditDebit_Ref', dataCreditDebit.EnumValueName);
} else {
e.record.set('CreditDebit_Ref', '');
}
}
},
gridListChFeeAfterEdit: function (editor, e, eOpts) {
if (e.field == 'FeeType') {
var records = DsStoreQueryBy(this.storeFeeTypeRef, 'EnumValueId', e.value);
if (records.getCount() > 0) {
var data = records.getAt(0).data;
e.record.set('FeeType_Ref', data.EnumValueName);
} else {
e.record.set('FeeType_Ref', '');
}
} else if (e.field == 'UnitPrice' || e.field == 'Quantity') {
var unitPrice = e.record.data['UnitPrice'];
var quantity = e.record.data['Quantity'];
e.record.set('Amount', (unitPrice * quantity).toFixed(2));
}
},
//#endregion
cellEditingFixBeforeEdit: function (editor, e) {
var feeStatus = this.getFeeStatus();
var billStatus = this.getBillStatus();
var canedit = feeStatus == '0' && billStatus == '0';
return canedit;
},
cellEditingChFeeBeforeEdit: function (editor, e) {
var chfeefeeStatus = e.record.get('FeeStatus');
var canedit = chfeefeeStatus == 1 || chfeefeeStatus == 6;
if (canedit) {
var feeStatus = this.getFeeStatus();
var billStatus = this.getBillStatus();
canedit = feeStatus == '0' && billStatus == '0';
}
return canedit;
},
refBillNoSeChange: function (field, newValue, oldValue) {
// if (newValue != oldValue) {
// alert(newValue + "," + oldValue);
// }
},
realMilChange: function (field, newValue, oldValue) {
if (this.DataLoading == true) return;
if (newValue == oldValue) return;
var realMil = newValue;
var basicForm = this.formEdit.getForm();
basicForm.findField('OverLoadMil').setValue(realMil);
basicForm.findField('NoLoadMil').setValue(realMil);
},
overLoadMilChange: function (field, newValue, oldValue) {
if (this.DataLoading == true) return;
var basicForm = this.formEdit.getForm();
// basicForm.findField('LoadFuel').setValue(this.LoadFuel);
basicForm.findField('RatedFuel').setValue(this.ratedFuel);
},
noLoadMilChange: function (field, newValue, oldValue) {
if (this.DataLoading == true) return;
var basicForm = this.formEdit.getForm();
},
tonAndTruckNoChange: function (field, newValue, oldValue) {
if (this.DataLoading == true) return;
var basicForm = this.formEdit.getForm();
// basicForm.findField('LoadFuel').setValue(this.LoadFuel);
// basicForm.findField('NoLoadFuel').setValue(this.NoLoadFuel);
//basicForm.findField('RatedFuel').setValue(this.ratedFuel);
if (field.name == 'TruckNo') {
var records = DsStoreQueryBy(this.storeTruckNo, 'TruckNo', newValue);
if (records.getCount() > 0) {
var data = records.getAt(0).data;
this.getTruckFuel(newValue, '1', 30, 0);
var TotalMil = basicForm.findField('TotalMil').getValue();
var RatedFuel = Mul(TotalMil, this.LoadFuel);
basicForm.findField('RatedFuel').setValue("0");
} else {
}
}
if (field.name == 'TotalMil') {
var TruckNo = basicForm.findField('TruckNo').getValue();
var records = DsStoreQueryBy(this.storeTruckNo, 'TruckNo', TruckNo);
if (records.getCount() > 0) {
var data = records.getAt(0).data;
var TotalMil = basicForm.findField('TotalMil').getValue();
this.getTruckFuel(TruckNo, '1', 30, TotalMil);
basicForm.findField('RatedFuel').setValue(this.LoadFuel);
} else {
}
}
},
getTruckFuel: function (truckNo, loadType, ton, mil) {
Ext.Ajax.request({
waitMsg: '正在计算车辆油量信息...',
url: '/TruckMng/MsWlPc/GetTruckFuel',
async: false,
params: {
truckNo: truckNo,
loadType: loadType,
ton: ton,
mil: mil
},
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
});
if (loadType == '1')
this.LoadFuel = 0;
else
this.NoLoadFuel = 0;
}
var data = result.data;
if (loadType == '1')
this.LoadFuel = data;
else
this.NoLoadFuel = data;
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
if (loadType == '1')
this.LoadFuel = 0;
else
this.NoLoadFuel = 0;
}
},
scope: this
});
},
onSubmitAuditClick: function (button, event) {
var records = this.feeGridCheckBoxModel.selected.items;
DsTruck.MsChFeeAudit(records, 2, '正在提交审核数据, 请稍侯..' );
this.InitData();
},
onPassAuditClick: function (button, event) {
var records = this.feeGridCheckBoxModel.selected.items;
DsTruck.MsChFeeAudit(records, 0, '正在审核数据, 请稍侯..' );
this.InitData();
},
onCancelAuditClick: function (button, event) {
var records = this.feeGridCheckBoxModel.selected.items;
DsTruck.MsChFeeAudit(records, 1, '正在撤销提交审核数据, 请稍侯..' );
this.InitData();
},
setSaveBtnStatus: function (enable) {
var bsbtnSave = Ext.getCmp('pcbtnSave');
var bsbtnSaveAndClose = Ext.getCmp('pcbtnSaveAndClose');
var bsbtnSaveAndNew = Ext.getCmp('pcbtnSaveAndNew');
var pcbtnNew = Ext.getCmp('pcbtnNew');
if (enable) {
bsbtnSave.enable();
bsbtnSaveAndClose.enable();
bsbtnSaveAndNew.enable();
pcbtnNew.enable();
} else {
//bsbtnSave.disable();
//bsbtnSaveAndClose.disable();
bsbtnSaveAndNew.disable();
pcbtnNew.disable();
}
},
getFeeStatus: function () {
var basicForm = this.formEdit.getForm();
var feeStatus = basicForm.findField('FeeStatus').value;
return feeStatus;
},
getBillStatus: function () {
var basicForm = this.formEdit.getForm();
var billStatus = basicForm.findField('BillStatus').value;
return billStatus;
},
getTruckNo: function () {
var truckNo = this.formEdit.getForm().findField('TruckNo');
return truckNo.getValue();
},
Print: function () {
var basicForm = this.formEdit.getForm();
var billNo = basicForm.findField('BillNo').value;
if (billNo == '*' || billNo == '') {
Ext.Msg.show({ title: '错误', msg: '单据还没有保存,请保存后再打印', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
return;
}
var gid = basicForm.findField('GID').value;
var refBillNo = basicForm.findField('RefBillNo').value;
var printType = 'MSWL_LKPC';
var sql1 = "SET LANGUAGE 'us_english' "
+ " select *,(select Mobile from user_baseinfo where USERID=(select GID from [user] where codename=ddcode)) 调度手机"
+ " ,(select sum(palletCount) from tmswl_LK_Cargo where PC_BILLNO='" + billNo + "') 托盘数"
+ " from vMsWlPcHeadPrint WHERE BillNo = '" + billNo + "'";
var sql2 = "SET LANGUAGE 'us_english' SELECT * from ch_fee where BsNo='" + gid + "'";
var records = this.feeGridCheckBoxModel.selected.items;
if (records.length > 0) {
var feeGidSql = '';
for (var i = 0; i < records.length; i++) {
var record = records[i];
var feeGId = "'" + record.get('GId') + "'";
if (feeGidSql == '') {
feeGidSql = feeGId;
} else {
feeGidSql = feeGidSql + "," + feeGId;
}
}
if (feeGidSql != '') {
sql2 = sql2 + ' and Gid in (' + feeGidSql + ')';
}
}
var sql3 = "select distinct PointName 站点名称,[address] 站点地址,CONTACTER 联系人,TEL 电话"//convert(varchar,convert(DECIMAL,TEL))
sql3 = sql3 + " ,PC_BILLNO,POINT_GID,dbo.F_LK_Cargo(PC_BILLNO,POINT_GID) 货物信息,sum(PalletCount) 托盘数,sum(CargoCount) 桶数, min(sequence) ";
sql3 = sql3 + " from(select c.GID,c.SEQUENCE,c.PC_BILLNO,c.CARGOINFO_GID,I.CARGONAME CARGO_NAME,I.CARGOTYPE CargoType ";
sql3 = sql3 + " ,c.PalletCount,c.CargoCount,c.[WEIGHT],c.POINT_GID,P.NAME PointName,P.[ADDRESS],P.CONTACTER,P.TEL,C.Remark ";
sql3 = sql3 + " ,I.BOXCOUNT,I.BOXWEIGHT ";
sql3 = sql3 + " from tMsWl_LK_Cargo C ";
sql3 = sql3 + " left join tMsWl_LK_CargoInfo I on I.gid=c.CARGOINFO_GID ";
sql3 = sql3 + " left join tMsWl_LK_Point P on P.gid=c.POINT_GID ";
sql3 = sql3 + " where C.PC_BILLNO='" + billNo + "')tt group by PointName,address,CONTACTER,TEL,PC_BILLNO,POINT_GID order by min(sequence) ";
var sql4 = "SET LANGUAGE 'us_english' select A.*,B.* from vMsWlPcHeadPrint A,tMsWlPcFixed B where A.Gid=B.BillNo and A.BillNo='" + billNo + "' order by A.BillNo";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
},
//获取油耗
getTruckLoadFuel: function (ton, mil, type) {
var resultFuel = 0;
var truckNo = this.getTruckNo();
if (truckNo == null || truckNo == "") {
resultFuel = 0;
return resultFuel;
}
if (ton == null || ton == "" || mil == null) {
resultFuel = 0;
return resultFuel;
}
resultFuel = this.getTruckFuel(truckNo, type, ton, mil);
return resultFuel;
},
setDrvName: function (drvCode) {
var recs = DsStoreQueryBy(this.storeDrvName, 'DrvCode', drvCode);
var basicForm = this.formEdit.getForm();
var custname = basicForm.findField('DrvName');
var mobile = basicForm.findField('Mobile');
if (recs.getCount() > 0) {
var data = recs.getAt(0).data;
custname.setValue(data.DrvName);
mobile.setValue(data.Mobile);
} else {
custname.setValue('');
mobile.setValue('');
}
},
setBtnOnlyQuery: function () {
var bsbtnSave = Ext.getCmp('pcbtnSave');
var bsbtnSaveAndClose = Ext.getCmp('pcbtnSaveAndClose');
var bsbtnSaveAndNew = Ext.getCmp('pcbtnSaveAndNew');
var pcbtnNew = Ext.getCmp('pcbtnNew');
bsbtnSave.setVisible(false);
bsbtnSaveAndClose.setVisible(false);
bsbtnSaveAndNew.setVisible(false);
pcbtnNew.setVisible(false);
},
LOCKPC: function (type) {
var BillNo = this.editRecord.get('BillNo');
if (BillNo == "" || BillNo == "*") {
alert("请先保存然后锁定");
return;
}
var IOType = "2"; //锁定派车减库存
if (type == "1") {//锁定派车
//4 干线 5 分拨
if (this.editRecord.get('PcBillType') == "4") {
//干线派车 减空桶
for (var i = 0; i < this.storeCargo.getCount(); i += 1) {
var member = this.storeCargo.getAt(i);
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/TruckMng/MsWl_LKPC/MakeChildDo',
scope: this,
async: false,
params: {
CARGO_GID: member.data.GID,
IOType: IOType,
AREA: member.data.AREA
},
callback: function (options, success, response) {
Ext.MessageBox.hide();
if (success) {
//this.InitData();
} else {
Ext.Msg.show({
title: '请重试',
msg: '服务器响应出错',
icon: Ext.Msg.ERROR,
buttons: Ext.Msg.OK
});
}
}
});
};
} else {
//分拨派车 减库存
for (var i = 0; i < this.storeCargo.getCount(); i += 1) {
var member = this.storeCargo.getAt(i);
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/TruckMng/MsWl_LKPC/MakeCargoDo',
scope: this,
async: false,
params: {
CARGO_GID: member.data.GID,
IOType: IOType
},
callback: function (options, success, response) {
Ext.MessageBox.hide();
if (success) {
//this.InitData();
} else {
Ext.Msg.show({
title: '请重试',
msg: '服务器响应出错',
icon: Ext.Msg.ERROR,
buttons: Ext.Msg.OK
});
}
}
});
};
}
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/TruckMng/MsWl_LKPC/MakeBoxDo',
scope: this,
async: false,
params: {
PC_BILLNO: BillNo,
IOType: IOType
},
callback: function (options, success, response) {
Ext.MessageBox.hide();
if (success) {
this.InitData();
} else {
Ext.Msg.show({
title: '请重试',
msg: '服务器响应出错',
icon: Ext.Msg.ERROR,
buttons: Ext.Msg.OK
});
}
}
});
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/TruckMng/MsWl_LKPC/LOCKPC',
scope: this,
async: false,
params: {
PC_BILLNO: BillNo,
LOCKType: type
},
callback: function (options, success, response) {
Ext.MessageBox.hide();
if (success) {
this.InitData();
} else {
Ext.Msg.show({
title: '请重试',
msg: '服务器响应出错',
icon: Ext.Msg.ERROR,
buttons: Ext.Msg.OK
});
}
}
});
}
/////////////////////////
if (type == "0") {//解除锁定派车
var ISBACK = Ext.getCmp("ISPC").setValue("1");
if (ISBACK == "1") {
alert("请先取消返回锁定");
return;
}
for (var i = 0; i < this.storeCargo.getCount(); i += 1) {
var member = this.storeCargo.getAt(i);
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/TruckMng/MsWl_LKPC/DelCargoDo',
scope: this,
async: false,
params: {
CARGO_GID: member.data.GID,
IOType: IOType
},
callback: function (options, success, response) {
Ext.MessageBox.hide();
if (success) {
//this.InitData();
} else {
Ext.Msg.show({
title: '请重试',
msg: '服务器响应出错',
icon: Ext.Msg.ERROR,
buttons: Ext.Msg.OK
});
}
}
});
};
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/TruckMng/MsWl_LKPC/LOCKPC',
scope: this,
async: false,
params: {
PC_BILLNO: BillNo,
LOCKType: type
},
callback: function (options, success, response) {
Ext.MessageBox.hide();
if (success) {
this.InitData();
} else {
Ext.Msg.show({
title: '请重试',
msg: '服务器响应出错',
icon: Ext.Msg.ERROR,
buttons: Ext.Msg.OK
});
}
}
});
}
},
LOCKBACK: function (type) {
var BillNo = this.editRecord.get('BillNo');
if (BillNo == "" || BillNo == "*") {
alert("请先保存然后锁定");
return;
}
var IOType = "1"; //锁定返回 加库存
//锁定返回
if (type == "1") {
//4 干线 5 分拨
if (this.editRecord.get('PcBillType') == "4") {
//干线返回 加库存商品
for (var i = 0; i < this.storeCargo.getCount(); i += 1) {
var member = this.storeCargo.getAt(i);
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/TruckMng/MsWl_LKPC/MakeCargoDo',
scope: this,
async: false,
params: {
CARGO_GID: member.data.GID,
IOType: IOType
},
callback: function (options, success, response) {
Ext.MessageBox.hide();
if (success) {
//this.InitData();
} else {
Ext.Msg.show({
title: '请重试',
msg: '服务器响应出错',
icon: Ext.Msg.ERROR,
buttons: Ext.Msg.OK
});
}
}
});
};
}
else {
//分拨返回 加库存空桶
for (var i = 0; i < this.storeCargo.getCount(); i += 1) {
var member = this.storeCargo.getAt(i);
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/TruckMng/MsWl_LKPC/MakeChildDo',
scope: this,
async: false,
params: {
CARGO_GID: member.data.GID,
IOType: IOType,
AREA: member.data.AREA
},
callback: function (options, success, response) {
Ext.MessageBox.hide();
if (success) {
//this.InitData();
} else {
Ext.Msg.show({
title: '请重试',
msg: '服务器响应出错',
icon: Ext.Msg.ERROR,
buttons: Ext.Msg.OK
});
}
}
});
};
}
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/TruckMng/MsWl_LKPC/MakeBoxDo',
scope: this,
async: false,
params: {
PC_BILLNO: BillNo,
IOType: IOType
},
callback: function (options, success, response) {
Ext.MessageBox.hide();
if (success) {
this.InitData();
} else {
Ext.Msg.show({
title: '请重试',
msg: '服务器响应出错',
icon: Ext.Msg.ERROR,
buttons: Ext.Msg.OK
});
}
}
});
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/TruckMng/MsWl_LKPC/LOCKBACK',
scope: this,
async: false,
params: {
PC_BILLNO: BillNo,
LOCKType: type
},
callback: function (options, success, response) {
Ext.MessageBox.hide();
if (success) {
this.InitData();
} else {
Ext.Msg.show({
title: '请重试',
msg: '服务器响应出错',
icon: Ext.Msg.ERROR,
buttons: Ext.Msg.OK
});
}
}
});
}
//解除锁定返回
if (type == "0") {
var ISBACK = Ext.getCmp("ISPC").setValue("1");
if (ISBACK == "1") {
alert("请先取消返回锁定");
return;
}
for (var i = 0; i < this.storeCargo.getCount(); i += 1) {
var member = this.storeCargo.getAt(i);
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/TruckMng/MsWl_LKPC/DelCargoDo',
scope: this,
async: false,
params: {
CARGO_GID: member.data.GID,
IOType: IOType
},
callback: function (options, success, response) {
Ext.MessageBox.hide();
if (success) {
//this.InitData();
} else {
Ext.Msg.show({
title: '请重试',
msg: '服务器响应出错',
icon: Ext.Msg.ERROR,
buttons: Ext.Msg.OK
});
}
}
});
};
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/TruckMng/MsWl_LKPC/LOCKBACK',
scope: this,
async: false,
params: {
PC_BILLNO: BillNo,
LOCKType: type
},
callback: function (options, success, response) {
Ext.MessageBox.hide();
if (success) {
this.InitData();
} else {
Ext.Msg.show({
title: '请重试',
msg: '服务器响应出错',
icon: Ext.Msg.ERROR,
buttons: Ext.Msg.OK
});
}
}
});
}
}
});