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.

1814 lines
61 KiB
JavaScript

12 months ago
Ext.namespace('Shipping');
Shipping.MsOpCtnBsCardReAuditEdit = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsOpCtnBsCardReAuditEdit.superclass.constructor.call(this);
};
Ext.extend(Shipping.MsOpCtnBsCardReAuditEdit, Ext.Panel, {
ParentWin: null,
OpStatus: 'add',
StoreList: null,
editRecord: null,
editFactryRecord: null,
FactryStatus: 'add',
initUIComponents: function () {
this.serialNo = 0;
this.workSerialNo = 0;
this.bodyDel = [];
this.bsno = getUrlParam('bsno');
this.sqlctn = "";
//#region head
this.storeBLTYPE = Ext.create('Ext.data.Store', {
fields: ['FSTATUS', 'NAME']
});
this.storeBLTYPE.add({ "FSTATUS": "空返", "NAME": "空返" });
this.storeBLTYPE.add({ "FSTATUS": "调拨", "NAME": "调拨" });
this.storeBLTYPE.add({ "FSTATUS": "空返-调拨", "NAME": "空返-调拨" });
this.storeBLTYPE.add({ "FSTATUS": "调拨-空返", "NAME": "调拨-空返" });
this.comboxBLTYPE= Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '类型',
store: this.storeBLTYPE,
valueField: 'FSTATUS',
displayField: 'NAME',
forceSelection: true,
name: 'BLTYPE'
});
this.StoreDateCurr = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsFeeCurr',
proxy: { url: '/MvcShipping/MsChFee/GetFeeDateCurrList' }
});
this.StoreDateCurr.load();
this.StoreCurr = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsFeeCurr',
proxy: { url: '/MvcShipping/MsChFee/GetFeeCurrList' }
});
this.StoreCurr.load({ params: { condition: "" } });
this.formHead = Ext.widget('form', {
region: 'north',
frame: true,
collapsed: false,
//collapsible: true,
height:80,
trackResetOnLoad: true,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 70,
msgTarget: 'qtip'
},
items: [{
xtype: 'fieldset',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '业务编号',
name: 'GID', hidden: true
}, {
fieldLabel: '业务编号',
name: 'BSNO', hidden: true
}, {
fieldLabel: '业务编号',
name: 'PRICEGID', hidden: true
}, {
fieldLabel: 'BILLSTATUS',
name: 'BILLSTATUS', hidden: true
},{
fieldLabel: '申请状态',
readOnly: true,
name: 'BILLSTATUSREF',
value: '录入状态'
}, {
fieldLabel: '委托编号',
readOnly: true,
name: 'CUSTNO'
}, {
fieldLabel: '主提单号',
readOnly: true,
name: 'MBLNO'
}, {
fieldLabel: '申请人',
readOnly: true,
name: 'APPLICANTREF'
}, {
fieldLabel: '申请时间',
readOnly: true,
name: 'APPLYTIME'
}, this.comboxBLTYPE]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '审核人',
readOnly: true,
name: 'AUDITUSERREF'
}, {
fieldLabel: '审核时间',
readOnly: true,
name: 'AUDITTIME'
}, {
fieldLabel: '驳回人',
readOnly: true,
name: 'REJECTUSERREF'
}, {
fieldLabel: '驳回时间',
readOnly: true,
name: 'REJECTTIME'
}, {
fieldLabel: '箱量',
readOnly: true,
flex: 0.5,
name: 'CTNNUM'
}, {
fieldLabel: '驳回原因',
readOnly: true,
flex: 1.5,
name: 'REJECTREASON'
}]
}]//end items(fieldset 1)
}]//end root items
}); //end this.formHead
//#endregion
//枚举参照相关(编辑form)
this.formname = 'MsOpCtnBsCardReAuditEdit';
//表参照相关(编辑form)
_this = this;
//#region 按钮Toolbar
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [{
id: 'btnSubmitAudit',
text: '提交审核',
tooltip: '提交审核',
handler: function (button, event) {
this.onSubmitAuditClick();
},
scope: this
}, {
id: 'btnSubmitAuditBack',
text: '取消提交',
tooltip: '取消提交',
handler: function (button, event) {
this.onSubmitAuditBackClick();
},
scope: this
}, {
text: '引入运价方案',
tooltip: '引入运价方案',
id: "btnadddetail",
iconCls: "btnadddetail",
handler: function (button, event) {
this.addPriceProject();
},
scope: this
}
]
}); //end 按钮Toolbar
//#endregion
//#region 运价方案form
//编辑form
this.formEdit = Ext.widget('form', {
region: 'north',
height:145,
frame: true,
bodyPadding: 5,
autoScroll: true,
trackResetOnLoad: true,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 70,
msgTarget: 'qtip'
},
items: [
{//fieldset 1
xtype: 'fieldset',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: 'GID',
name: 'GID', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: 'COMPANYID',
name: 'COMPANYID', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: 'PRICETYPE',
name: 'PRICETYPE', flex: 0, hidden: true, margins: '0'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '方案类别',
readOnly: true,
name: 'PRJECTTYPE'
}, {
fieldLabel: '运价来源',
readOnly: true,
name: 'PRJECTSOURCE'
}, {
fieldLabel: '代理',
readOnly: true,
name: 'AGENTNAME'
}, {
fieldLabel: '开始日期',
format: 'Y-m-d',
flex: 1,
xtype: 'datefield',
name: 'BEGINDATE'
}, {
fieldLabel: '有效日期',
format: 'Y-m-d',
flex: 1,
xtype: 'datefield',
name: 'VALIDETD'
},{
fieldLabel: '起运港',
readOnly: true,
name: 'PORTLOAD'
}, {
fieldLabel: '目的港',
readOnly: true,
name: 'PORTDISCHARGE'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '船公司',
readOnly: true,
name: 'CARRIER'
}, {
fieldLabel: '货物类别',
readOnly: true,
name: 'GOODTYPE'
}, {
fieldLabel: '方案状态',
readOnly:true,
name: 'BSSTATUS'
},{
fieldLabel: '是否中转',
name: 'ISTRANSPORT'
}, {
fieldLabel: '是否最优方案',
labelWidth: 90,
name: 'ISBEST'
}, {
fieldLabel: '报价日期',
format: 'Y-m-d',
flex: 1,
xtype: 'datefield',
name: 'PRICEDATE'
}, {
fieldLabel: '是否停用',
name: 'ISSTOP'
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [ {
fieldLabel: '航程',
name: 'VOYAGE'
}, {
fieldLabel: '日租金',
name: 'RENTOFDAY'
}, {
fieldLabel: '租金',
name: 'RENTAMOUNT'
},{
fieldLabel: '运输条款',
name: 'SERVICE'
}, {
fieldLabel: '箱状态',
name: 'CTNSTATUS'
},{
fieldLabel: '佣金比率',
name: 'CHANGERATE',
regex: /^(-?\d+)(\.\d+)?$/,
regexText: '请输入正确的数值!'
}, {
fieldLabel: '创建人',
readOnly: true,
disabled: true,
name: 'INPUTBYREF'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [ {
fieldLabel: '创建日期',
readOnly: true,
disabled: true,
name: 'INPUTTIME'
}, {
fieldLabel: '维护人',
name: 'OPREF'
},{
fieldLabel: '方案批注',
name: 'PRJECTMARK'
},{
fieldLabel: '备注',
flex: 3,
name: 'REMARKS'
}, {
fieldLabel: '单罐成本',
name: 'TTLINUSDCOST'
}, {
fieldLabel: '总成本',
name: 'TTLCOST'
}]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
}); //end this.formEdit
//#endregion
//#region 运价明细信息
this.storeBodyList = Ext.create('Ext.data.Store', {
model: 'MsOpPriceItems',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcContainer/MsOpCtnBsCardReAudit/GetPriceItemsList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.storeBodyPriceList = Ext.create('Ext.data.Store', {
model: 'MsOpPriceItems',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcContainer/MsOpPrice/GetPriceItemsList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//明细表表格
this.gridListCellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});
this.initgirdbillcolums = [{
sortable: true,
dataIndex: 'GID',
header: '编号',
hidden: true,
width: 0
}, {
sortable: true,
dataIndex: 'LINKGID',
header: '业务编号',
hidden: true,
width: 0
}, {
sortable: true,
dataIndex: 'ITEMSNO',
header: '序号',
renderer: Ext.util.Format.numberRenderer('00'),
align: 'right',
width: 60
}, {
sortable: true,
dataIndex: 'CUSTOMERNAME',
header: '付款方',
width: 110
}, {
sortable: true,
dataIndex: 'FEENAME',
header: '费用名称',
width: 140
}, {
sortable: true,
dataIndex: 'UNIT',
header: '标准',
width: 100
}, {
sortable: true,
dataIndex: 'CURRENCY',
header: '币别',
width: 100
}, {
sortable: true,
dataIndex: 'EXCHANGERATE',
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 '<SPAN style="COLOR: red">' + lsValue + '</SPAN>'; } } else { return value; } } catch (e) { return value; } return value; },
align: 'right',
editor: {
xtype: 'numberfield',
keyNavEnabled: false,
selectOnFocus: true,
hideTrigger: true,
mouseWheelEnabled: false,
enableKeyEvents: true
},
width: 110
}, {
sortable: true,
dataIndex: 'UNITPRICE',
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 '<SPAN style="COLOR: red">' + lsValue + '</SPAN>'; } } else { return value; } } catch (e) { return value; } return value; },
align: 'right',
width: 110
}, {
sortable: true,
dataIndex: 'QUANTITY',
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 '<SPAN style="COLOR: red">' + lsValue + '</SPAN>'; } } else { return value; } } catch (e) { return value; } return value; },
align: 'right',
editor: {
xtype: 'numberfield',
keyNavEnabled: false,
selectOnFocus: true,
hideTrigger: true,
mouseWheelEnabled: false,
enableKeyEvents: true
},
width: 110
}, {
sortable: true,
dataIndex: 'AMOUNT',
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 '<SPAN style="COLOR: red">' + lsValue + '</SPAN>'; } } else { return value; } } catch (e) { return value; } return value; },
align: 'right',
editor: {
xtype: 'numberfield',
keyNavEnabled: false,
selectOnFocus: true,
hideTrigger: true,
mouseWheelEnabled: false,
enableKeyEvents: true
},
width: 110
}, {
sortable: true,
dataIndex: 'REMARKS',
header: '备注',
width: 250
}, {
sortable: true,
dataIndex: 'PRICECLASS',
header: '类别归属',
width: 100
}, {
sortable: true,
dataIndex: 'ISSTOP',
header: '是否停用', //'是否海运',
width: 60,
renderer: function (value, cellmeta) {
if (value == '1' || value == true || value == 'true') {
return "是";
} else {
return "否";
}
}
}, {
sortable: true,
dataIndex: 'FEESTATUS_REF',
header: '费用状态',
width: 60
}, {
sortable: true,
dataIndex: 'REASON',
header: '原因',
width: 60
}, {
sortable: true,
dataIndex: 'INPUTBYREF',
header: '创建人',
width: 60
}, {
sortable: true,
dataIndex: 'INPUTTIME',
header: '创建日期',
width: 80
}, {
sortable: true,
dataIndex: 'MODIFYUSERREF',
header: '录入人',
width: 60
}, {
sortable: true,
dataIndex: 'MODIFYTIME',
header: '录入日期',
width: 80
}, {
sortable: true,
dataIndex: 'AUDITNAME',
header: '审核人',
width: 60
}, {
sortable: true,
dataIndex: 'AUDITDATE',
header: '审核日期',
width: 80
}];
this.girdbillcolums = this.initgirdbillcolums;
this.GridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
this.gridListBody = new Ext.grid.GridPanel({
store: this.storeBodyList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
plugins: [this.gridListCellEditing],
selModel: this.GridCheckBoxModel,
selType: 'cellmodel',
viewConfig: {
autoFill: true,
getRowClass: function (record, rowIndex, rowParams, store) {
var feeStatus = record.get('FEESTATUS');
return Shipping.FeeGetRowClass(feeStatus);
}
},
tbar: [ {
text: '删除明细',
tooltip: '删除明细',
id: "btndeldetail",
iconCls: "btndeletedetail",
handler: function (button, event) {
this.onDeletePriceItemsClick();
},
scope: this
}, '-',{
text: '保存列表样式',
menu: [
{
text: '保存',
handler: function (button, event) {
_this.girdbillcolums = DsTruck.SaveGridPanel(USERID, _this.formname + 'bill', _this.gridListBody.columns, _this.girdbillcolums, 1, true);
}
}, {
text: '初始化',
handler: function (menu, event) {
_this.girdbillcolums = DsTruck.SaveGridPanel(USERID, _this.formname + 'bill', _this.gridListBody.columns, _this.initgirdbillcolums, 1, true);
}
}],
scope: this
}],
columns: this.girdbillcolums
});
this.gridListBody.on('edit', function (editor, e, eOpts) {
this.gridListAfterEdit(editor, e, eOpts);
}, this);
//#endregion
//#region 业务卡信息
this.storeList = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
model: 'MsOpCtnBsCard',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcContainer/MsOpCtnBsCard/GetDataList',
reader: {
id: 'GId',
root: 'data',
totalProperty: 'totalCount'
}
}
});
Ext.grid.RowNumberer = Ext.extend(Ext.grid.RowNumberer, {
width: 30
});
this.initgirdcolums = [{
sortable: true,
dataIndex: 'GID',
header: 'GID',
hidden: true,
width: 120
}, {
sortable: true,
id: '',
dataIndex: '',
header: '',
width: 0
}, {
sortable: true,
dataIndex: 'COMPANYID',
header: 'COMPANYID',
hidden: true,
width: 120
}, {
sortable: true,
dataIndex: 'CTNNO',
header: '箱号',
width: 200
}, {
sortable: true,
dataIndex: 'APPLYNO',
header: '放箱申请编号',
width: 120
}, {
sortable: true,
dataIndex: 'CTNPROP',
header: '箱属',
width: 200
}, {
sortable: true,
dataIndex: 'BSNO',
header: '业务编号',
width: 200
}, {
sortable: true,
dataIndex: 'ISCLOSE',
header: '锁定',
width: 100,
renderer: function (value, cellmeta) {
if (value == 'true') {
return "<img src='../../../../TruckMng/Content/Images/Lock.png' />";
}
}
}, {
sortable: true,
dataIndex: 'IS_PUTCTN',
header: '放箱通知发送',
width: 100,
renderer: function (value, cellmeta) {
if (value == 'true') {
return "是";
}
}
}, {
sortable: true,
dataIndex: 'PUTCTNDATE',
header: '放箱通知发送时间',
width: 100
}, {
sortable: true,
dataIndex: 'CUSTOMERNAME',
header: '委托单位',
width: 200
}, {
sortable: true,
dataIndex: 'GOODSNAME',
header: '货物名称',
width: 100
}, {
sortable: true,
dataIndex: 'PREGOODSNAME',
header: '前装货品名',
width: 100
}, {
sortable: true,
dataIndex: 'ETD',
header: '开船日期',
width: 100
}, {
sortable: true,
dataIndex: 'ETA',
header: '到港日期',
width: 100
}, {
sortable: true,
dataIndex: 'AGENTNAME',
header: '目的港代理',
width: 100
}, {
sortable: true,
dataIndex: 'CUR_PORT',
header: '当前位置',
width: 100
}, {
sortable: true,
dataIndex: 'CUR_DATE',
header: '当前时间',
width: 100
}, {
sortable: true,
dataIndex: 'CYCLE_DAY',
header: '周期',
width: 100
}, {
sortable: true,
dataIndex: 'CUSTNO',
header: '委托编号',
width: 200
}, {
sortable: true,
dataIndex: 'OP',
header: '操作',
width: 200
}, {
sortable: true,
dataIndex: 'MBLNO',
header: '主提单号',
width: 200
}, {
sortable: true,
dataIndex: 'CARRIER',
header: '船公司',
width: 200
}, {
sortable: true,
dataIndex: 'PORTLOAD_STATOIN',
header: '起运港场站',
width: 200
}, {
sortable: true,
dataIndex: 'PORTLOAD_CNT_TIME',
header: '起运港提箱日期',
width: 200
}, {
sortable: true,
dataIndex: 'LOADFACTORY',
header: '装货工厂',
width: 200
}, {
sortable: true,
dataIndex: 'PORTLOAD',
header: '起运港',
width: 200
}, {
sortable: true,
dataIndex: 'DESTPORT',
header: '目的港',
width: 100
}, {
sortable: true,
dataIndex: 'DEST_CNT_TIME',
header: '目的港提箱日期',
width: 200
}, {
sortable: true,
dataIndex: 'DEST_RTCNT_TIME',
header: '目的港还箱日期',
width: 200
}, {
sortable: true,
dataIndex: 'DESTPORT_STATOIN',
header: '目的港场站',
width: 200
}, {
sortable: true,
dataIndex: 'DETAIN_CTN_DAYS',
header: '滞箱天数',
width: 200
}, {
sortable: true,
dataIndex: 'PRE_CNT_TIME',
header: '预计提箱日期',
width: 200
}, {
sortable: true,
dataIndex: 'IS_RETURE_EMPTY',
header: '是否返空',
width: 100
}, {
sortable: true,
dataIndex: 'IS_POD_CLEAN',
header: '否目的港清洗',
width: 100
}, {
sortable: true,
dataIndex: 'IS_BOOKING',
header: '是否订舱',
width: 200
}, {
sortable: true,
dataIndex: 'I_CUSTNO',
header: '空返委托编号',
width: 100
}, {
sortable: true,
dataIndex: 'I_MBLNO',
header: '空返提单号',
width: 120
}, {
sortable: true,
dataIndex: 'I_CARRIER',
header: '空返船公司',
width: 100
}, {
sortable: true,
dataIndex: 'I_CONTRACT',
header: '运费约价',
width: 100
}, {
sortable: true,
dataIndex: 'I_PORTLOAD_CNT_TIME',
header: '空返起运港提箱日期',
width: 100
}, {
sortable: true,
dataIndex: 'I_PORTLOAD',
header: '空返起运港',
width: 100
}, {
sortable: true,
dataIndex: 'I_ETD',
header: '空返开船日期',
width: 100
}, {
sortable: true,
dataIndex: 'I_DESTPORT',
header: '空返目的港',
width: 100
}, {
sortable: true,
dataIndex: 'I_ETA',
header: '空返到港日期',
width: 100
}, {
sortable: true,
dataIndex: 'I_DESTPORT_STATOIN',
header: '空返目的港场站',
width: 100
}, {
sortable: true,
dataIndex: 'I_DEST_CNT_TIME',
header: '空返目的港提箱日期',
width: 100
}, {
sortable: true,
dataIndex: 'I_DEST_RTCNT_TIME',
header: '空返目的港还箱日期',
width: 100
}, {
sortable: true,
dataIndex: 'PORTLOAD_FREE_DAYS',
header: '起运港免箱使天数',
width: 100
}, {
sortable: true,
dataIndex: 'PORTLOAD_OVER_DAYS',
header: '起运港超期天数',
width: 100
}, {
sortable: true,
dataIndex: 'PORTLOAD_OVER_DAYS_FEE',
header: '起运港箱使费/天',
width: 100
}, {
sortable: true,
dataIndex: 'PORTLOAD_OVER_DAYS_AMT',
header: '起运港箱使费',
width: 100
}, {
sortable: true,
dataIndex: 'DESTPORT_FREE_DAYS',
header: '目的港免箱使天数',
width: 100
}, {
sortable: true,
dataIndex: 'DESTPORT_OVER_DAYS',
header: '目的港超期天数',
width: 100
}, {
sortable: true,
dataIndex: 'DESTPORT_OVER_DAYS_FEE',
header: '目的港箱使费/天',
width: 100
}, {
sortable: true,
dataIndex: 'DESTPORT_OVER_DAYS_AMT',
header: '目的港箱使费',
width: 100
}, {
sortable: true,
dataIndex: 'BOOKGOODNAME',
header: '订舱品名',
width: 100
}, {
sortable: true,
dataIndex: 'CUSTOMGOODNAME',
header: '报关品名',
width: 100
}, {
sortable: true,
dataIndex: 'TRUCKNAME',
header: '录车队',
width: 100
}, {
sortable: true,
dataIndex: 'INPUTBYREF',
header: '录入人',
width: 100
}, {
sortable: true,
dataIndex: 'INPUTTIME',
header: '录入时间',
width: 100
}
];
this.girdcolums = this.initgirdcolums;
this.GridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
_this = this;
//定义Grid
this.gridList = new Ext.grid.GridPanel({
store: this.storeList,
enableHdMenu: false,
region: 'north',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
height: 150,
disableSelection: false,
viewConfig: {
enableTextSelection: true
},
selModel: this.GridCheckBoxModel,
columns: this.girdcolums
,
// paging bar on the bottom
bbar: Ext.create('Ext.PagingToolbar', {
store: this.storeList,
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"
})
});
this.girdcolums = DsTruck.GetGridPanel(USERID, this.formname, this.girdcolums, 1); //使用者id表名中间column数组跳过一开始的几列
this.girdcolums.unshift(new Ext.grid.RowNumberer());
this.gridList.reconfigure(this.storeList, this.girdcolums);
//#endregion
//#region 费用表
this.panelFee = new Shipping.FeeEditGrid({
region: 'center',
layout: 'border'
});
this.panelFee.stroplb = 'OpCtnBsCard';
this.panelFee.StoreCustType.add({ "SCUSTTYPE": "WTDW-委托单位", "CUSTTYPE": "委托单位", "CUSTNAME": "CUSTOMERNAME" });
this.panelFee.StoreCustType.add({ "SCUSTTYPE": "CD-车队", "CUSTTYPE": "车队", "CUSTNAME": "TRUCKNAME" });
this.panelFee.StoreCustType.add({ "SCUSTTYPE": "MDGDL-目的港代理", "CUSTTYPE": "目的港代理", "CUSTNAME": "AGENTNAME" });
this.panelFee.StoreCustType.add({ "SCUSTTYPE": "DCGS-订舱公司", "CUSTTYPE": "订舱公司", "CUSTNAME": "AGENTNAME" });
this.panelFee.StoreDrOpRange.load({ params: { optype: "modOtherRecvFeeManagement" } });
this.panelFee.StoreCrOpRange.load({ params: { optype: "modOtherPayFeeManagement" } });
this.panelFee.storeFeeNameRef.load({ params: { condition: "" } });
//#endregion
this.panelCtnBody = new Ext.Panel({
title: '业务卡信息',
layout: "border",
region: 'center',
animate: true,
// autoScroll: true,
// containerScroll: true,
frame: false,
items: [this.gridList, this.panelFee]
});
this.panelBody = new Ext.Panel({
title: '运价方案信息',
layout: "border",
region: 'center',
animate: true,
// autoScroll: true,
// containerScroll: true,
frame: false,
items: [this.formEdit,this.gridListBody]
});
this.MainTab = new Ext.tab.Panel({
layout: "border",
region: "center", split: true,
items: [
this.panelCtnBody,this.panelBody
]
});
//#region 布局
//控件布局
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 115,
items: [this.panelBtn, this.formHead]
});
Ext.apply(this, {
items: [this.panelTop, this.MainTab]
});
//#endregion
//绑定查询窗体
this.storeBodyList.on('beforeload', function (store) {
var pricegid = this.formHead.getForm().findField('GID').getValue();
var acondition = " LINKGID='" + pricegid + "'";
Ext.apply(store.proxy.extraParams, { condition: acondition });
}, this);
this.ParentWin = window.parent.opener;
//初始化数据
if (this.bsno != undefined && this.bsno != '') {
this.InitData();
}
this.storeSalesCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.UserRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetUserActionRefListRm' }
});
this.storeSalesCode.on('beforeload', function (store) {
Ext.apply(store.proxy.extraParams, { MODULENAME: 'modBsCardReAudit' });
}, this);
this.storeSalesCode.load();
this.comboxAuditer = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '审核人', //揽货人
store: this.storeSalesCode,
forceSelection: true,
name: 'PS_AUDIT',
id: 'PS_AUDIT',
valueField: 'GID',
displayField: 'CodeAndName',
enableKeyEvents: true
});
this.formAuditShow = Ext.widget('form', {
frame: true,
region: 'center',
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 100,
msgTarget: 'qtip'
},
items: [
this.comboxAuditer
]//end root items
});
this.winAuditShow = Ext.create('Ext.window.Window', {
title: "提交通过",
width: 320,
//height : 120,
//plain : true,
iconCls: "addicon",
resizable: false,
// 是否可以拖动
// draggable:false,
collapsible: true, // 允许缩放条
closeAction: 'close',
closable: true,
modal: 'true',
buttonAlign: "center",
bodyStyle: "padding:0 0 0 0",
items: [this.formAuditShow],
buttons: [{
text: "提交审核",
minWidth: 70,
handler: function () {
var form = _this.formAuditShow.getForm();
var auditer = form.findField('PS_AUDIT').getValue();
if (auditer == null || auditer == '') {
Ext.Msg.show({ title: '提示', msg: '审核人为空无法提交审核!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
_this.onSubmitAuditClickFn(auditer);
}
}, {
text: "关闭",
minWidth: 70,
handler: function () {
_this.winAuditShow.close();
}
}]
});
//绑定事件
}, //end initUIComponents
InitData: function () {
this.opStatus = 'edit';
var condition = '';
if (this.opStatus == 'edit')
condition = " b.BSNO='" + this.bsno + "'";
this.LoadData(this.opStatus, condition);
}, //end InitData
LoadData: function (opstatus, condition) {
this.serialNo = 0;
this.workSerialNo = 0;
this.bodyDel = [];
this.opStatus = opstatus;
Ext.Ajax.request({
waitMsg: '正在查询主表数据...',
url: '/MvcContainer/MsOpCtnBsCardReAudit/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;
this.formHead.getForm().reset();
this.formHead.getForm().setValues(data);
if (data.PRICEGID != '') {
this.LoadPriceData('edit', "GID='" + data.PRICEGID + "'", data.TTLINUSDCOST, data.TTLCOST);
}
this.sqlctn = " (SELECT BSCARDGID FROM op_ctnbscard_reaudit_detail where LINKGID='" + data.GID + "') ";
this.storeList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: " GID IN "+this.sqlctn },
waitMsg: "正在查询数据...",
scope: this
});
this.LoadFeeData();
var acondition = "";
acondition = " LINKGID='" + data.GID + "'";
this.storeBodyList.load({ params: { condition: acondition } });
this.GetEditStatus();
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
}, // end LoadDate
LoadPriceData: function (opstatus, condition,TTLINUSDCOST,TTLCOST) {
this.serialNo = 0;
this.workSerialNo = 0;
this.bodyDel = [];
this.opStatus = opstatus;
Ext.Ajax.request({
waitMsg: '正在查询主表数据...',
url: '/MvcContainer/MsOpPrice/GetProjectData',
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;
this.formEdit.getForm().reset();
this.formEdit.getForm().setValues(data);
this.formEdit.getForm().findField('TTLINUSDCOST').setValue(TTLINUSDCOST);
this.formEdit.getForm().findField('TTLCOST').setValue(TTLCOST);
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
}, // end LoadDate
ImportPriceData: function (opstatus, condition) {
this.serialNo = 0;
this.workSerialNo = 0;
this.bodyDel = [];
this.opStatus = opstatus;
Ext.Ajax.request({
waitMsg: '正在查询主表数据...',
url: '/MvcContainer/MsOpPrice/GetProjectData',
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;
this.formEdit.getForm().reset();
this.formEdit.getForm().setValues(data);
//var acondition = "";
//acondition = " LINKGID='" + data.GID + "'";
//this.storeBodyList.removeAll();
//this.storeBodyPriceList.load({
// params: { condition: acondition },
// callback: function (r, options, success) {
// if (success) {
// if (_this.storeBodyPriceList.getCount() > 0) {
// _this.LoadPriceDetail();
// }
// }
// }, });
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
}, // end LoadDate
LoadPriceDetail: function () {
for (var i = 0; i < this.storeBodyPriceList.getCount(); i++) {
var memberyf = this.storeBodyPriceList.getAt(i);
var QUANTITY = 1;
var AMOUNT = memberyf.data.UNITPRICE;
if (memberyf.data.UNIT=='20TK') {
QUANTITY = this.formHead.getForm().findField('CTNNUM').getValue();
AMOUNT = Mul(memberyf.data.UNITPRICE, QUANTITY);
}
var exchange = this.calExchange(memberyf.data.CURRENCY);
var record = Ext.create('MsOpPriceItems', {
GID: '*',
LINKGID: '*',
PRICEGID: memberyf.data.LINKGID,
ITEMSNO: memberyf.data.ITEMSNO,
CUSTOMERNAME: memberyf.data.CUSTOMERNAME,
FEENAME: memberyf.data.FEENAME,
UNIT: memberyf.data.UNIT,
UNITPRICE: memberyf.data.UNITPRICE,
QUANTITY: QUANTITY,
AMOUNT: AMOUNT,
CURRENCY: memberyf.data.CURRENCY,
EXCHANGERATE: exchange,
GOODSNAME: memberyf.data.GOODSNAME,
REMARKS: memberyf.data.REMARKS,
INPUTBY: memberyf.data.INPUTBY,
INPUTBYREF: memberyf.data.INPUTBYREF,
INPUTTIME: memberyf.data.INPUTTIME,
FEESTATUS: memberyf.data.FEESTATUS,
FREEDAY: memberyf.data.FREEDAY,
FEESTATUS_REF: memberyf.data.FEESTATUS_REF,
CTNSTATUS: memberyf.data.CTNSTATUS,
VALIDETD: memberyf.data.VALIDETD,
ISSTOP: memberyf.data.ISSTOP,
BEGINDATE: memberyf.data.BEGINDATE,
ENDDATE: memberyf.data.ENDDATE,
DATETYPE: memberyf.data.DATETYPE,
PRICECLASS: memberyf.data.PRICECLASS,
AUDITOPERATOR: memberyf.data.AUDITOPERATOR,
AUDITDATE: memberyf.data.AUDITDATE,
AUDITNAME: memberyf.data.AUDITNAME,
MODIFYTIME: memberyf.data.MODIFYTIME,
MODIFYUSERREF: memberyf.data.MODIFYUSERREF,
MODIFYUSER: memberyf.data.MODIFYUSER,
REASON: memberyf.data.REASON,
APPLYTIME: memberyf.data.APPLYTIME,
APPLYUSERREF: memberyf.data.APPLYUSERREF
});
record.id = NewGuid();
record.internalId = NewGuid();
this.storeBodyList.add(record);
};
},
LoadFeeData: function () {
var BSNOStr = '';
var feesql = " and isnull(ch_fee.WMSOUTBSNO,'')='' AND ch_fee.BSNO IN " + this.sqlctn;
this.panelFee.feecondition =feesql;
this.panelFee.CR_condition = " ch_fee.INPUTMODE='代理报价' and ch_fee.Feetype=2 " + this.panelFee.feecondition;
this.panelFee.EditRecord = this.EditRecord;
this.panelFee.strBSNO = this.BsNo;
this.panelFee.strPBSNO = this.BsNo;
this.panelFee.strMBLNO = this.BsNo;
this.panelFee.StoreDateCurr.load({ params: { optype: "OpCtnBsCard", bsno: this.BsNo } });
this.panelFee.StoreUnit.load({ params: { bsno: this.BsNo, bstype: "OpCtnBsCard" } });
//this.panelFee.LoadDrChFee();
this.panelFee.LoadInputMode(" ch_fee.Feetype=2 " + this.panelFee.feecondition);
this.panelFee.LoadCrChFee();
}, // end LoadDate
GetHandleSerialNo: function (store) {
var result = 0;
if (result == 0) {
for (var i = 0; i < store.getCount(); i += 1) {
var member = store.getAt(i);
if (parseInt(member.data.ITEMSNO) > parseInt(result)) {
result = member.data.ITEMSNO;
}
}
}
result = parseInt(result) + 1;
return result;
},
gridListAfterEdit: function (editor, e, eOpts) {
if (e.value == e.originalValue) return;
if (e.field == 'UNITPRICE' || e.field == 'QUANTITY') {
var unitPrice = e.record.data['UNITPRICE'];
var quantity = e.record.data['QUANTITY'];
var amount = Mul(unitPrice, quantity);
e.record.set('AMOUNT', amount);
}
},
calExchange: function (curr) {
var result = 1;
if (curr != 'RMB') {
var FFrecords = DsStoreQueryBy(this.StoreDateCurr, 'CURR', curr);
if (FFrecords.getCount() > 0) {
var ffdata = FFrecords.getAt(0).data;
result = ffdata.DEFRATE;
} else {
var DFrecords = DsStoreQueryBy(this.StoreCurr, 'CURR', curr);
if (DFrecords.getCount() > 0) {
var dfdata = DFrecords.getAt(0).data;
result = dfdata.DEFRATE;
} else {
}
}
}
return result;
},
onDeletePriceItemsClick: function () {
var selections = this.gridListBody.getSelectionModel().getSelection();
if (selections.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择要删除的费用信息!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var bodyAddDatas = [];
for (var i = 0; i < selections.length; i++) {
var rec = selections[i];
if (rec.data.LINKGID == "*" || rec.data.LINKGID == "") {
this.storeBodyList.remove(selections[i]);
} else {
bodyAddDatas.push(rec);
}
}
if (bodyAddDatas.length == 0) return;
var record = selections[0];
Ext.MessageBox.confirm('提示', '确定删除该记录吗?', function (btn) {
if (btn == 'yes') {
var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas);
Ext.Msg.wait('正在删除数据...');
Ext.Ajax.request({
waitMsg: '正在删除数据...',
url: '/MvcContainer/MsOpCtnBsCardReAudit/DeletePriceItems',
params: {
data: jsonbodyAddDatas
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
this.storeBodyList.reload();
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);
},
onSubmitAuditClick: function () {
this.winAuditShow.show();
},
onSubmitAuditClickFn: function (auditer) {
var billstatus = this.formHead.getForm().findField('BILLSTATUSREF').getValue();
if ((billstatus == "提交审核") || (billstatus == "审核通过")) {
Ext.Msg.show({ title: '提示', msg: '当前状态无法提交审核!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var basicForm = this.formHead.getForm();
if (!basicForm.isValid()) {
return;
}
basicForm.findField('GID').setDisabled(false);
var data = basicForm.getValues();
basicForm.findField('GID').setDisabled(true);
if (this.opStatus == 'add') {
data.GID = NewGuid();
}
var bodydatas = [];
for (var i = 0; i < this.storeBodyList.getCount(); i += 1) {
var member = this.storeBodyList.getAt(i);
var VALIDETD = member.data.STARTTIME;
if (VALIDETD != '')
VALIDETD = Ext.util.Format.date(VALIDETD, 'Y-m-d');
member.data.VALIDETD = VALIDETD;
bodydatas.push(member);
}
var jsonBody = ConvertRecordsToJsonAll(bodydatas);
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/MvcContainer/MsOpCtnBsCardReAudit/Save',
scope: this,
params: {
opstatus: this.opStatus,
data: Ext.JSON.encode(data),
body: jsonBody,
audit:auditer,
issub:true
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
var returnData = jsonresult.Data;
this.formHead.getForm().setValues(returnData);
this.GetEditStatus();
this.winAuditShow.close();
var acondition = " LINKGID='" + returnData.GID + "'";
this.storeBodyList.load({ params: { condition: acondition } });
} 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
});
}
}
});
},
onSubmitAuditBackClick: function () {
var GID = this.formEdit.getForm().findField('GID').getValue();
var billstatus = this.formHead.getForm().findField('BILLSTATUSREF').getValue();
if (billstatus != "提交审核" && billstatus != "录入状态" && billstatus != "驳回提交") {
Ext.Msg.show({ title: '提示', msg: '当前状态无法撤销提交!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
this.formHead.getForm().findField('GID').setDisabled(false);
var data = this.formHead.getForm().getValues(false, false, false);
this.formHead.getForm().findField('GID').setDisabled(true);
_this = this;
Ext.Ajax.request({
waitMsg: '正在添加数据...',
url: '/MvcContainer/MsOpCtnBsCardReAudit/Delete',
params: {
data: Ext.JSON.encode(data)
},
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;
} else {
var condition = " b.BSNO='111111'";
this.LoadData('edit', condition);
window.close();
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
},
onViewWorkFlowDetailClick: function () {
var Gid = this.formHead.getForm().findField('GID').getValue();
var openSet = "height=700, width=1024, toolbar=no, menubar=no,scrollbars=1, resizable=1,location=no, status=no,Top= " + (screen.height - 750) / 2 + ",Left= " + (screen.width - 1100) / 2
var openType = "_blank";
var openUrl = "";
var openUrl = "../../Account/Chfee_payapplication/Map?bsno=" + Gid + "&name=";
window.open(openUrl, openType, openSet);
},
setHeadFieldValue: function (fieldName, value) {
var field = this.formHead.getForm().findField(fieldName);
field.setValue(value);
},
setEditFieldValue: function (fieldName, value) {
var field = this.formEdit.getForm().findField(fieldName);
field.setValue(value);
},
addPriceProject: function () {
window.open('/MvcContainer/MsOpPrice/AddPriceProjectIndex', "引入报价方案", 'width=1200,height=760,top=0,left=0,resizable=yes,status=yes,menubar=no,scrollbars=yes');
},
//#region 编辑时按钮等的状态
GetEditStatus: function () {
var canedit = false;
var btnSubmitAudit = Ext.getCmp('btnSubmitAudit');
var btnSubmitAuditBack = Ext.getCmp('btnSubmitAuditBack');
var btnadddetail = Ext.getCmp('btnadddetail');
var BILLSTATUSREF = this.formHead.getForm().findField('BILLSTATUSREF').getValue();
if (BILLSTATUSREF == '审核通过') {
btnSubmitAudit.disable();
btnSubmitAuditBack.disable();
btnadddetail.disable();
} else if (BILLSTATUSREF == '提交审核') {
btnSubmitAudit.disable();
btnadddetail.disable();
} else {
}
},
setSaveBtnStatus: function (enable) {
var btnESave = Ext.getCmp('btnsave');
var btnESaveAndClose = Ext.getCmp('btnsaveandclose');
var btnESaveAndNew = Ext.getCmp('btnsaveandnew');
var btnECopyAndNew = Ext.getCmp('btncopyandsave');
var btnadddetail = Ext.getCmp('btnadddetail');
var btndeldetail = Ext.getCmp('btndeldetail');
if (enable) {
btnESave.enable();
btnESaveAndClose.enable();
btnESaveAndNew.enable();
btnECopyAndNew.enable();
btnadddetail.enable();
btndeldetail.enable();
} else {
btnESave.disable();
btnESaveAndClose.disable();
btnESaveAndNew.disable();
btnECopyAndNew.disable();
btnadddetail.disable();
btndeldetail.disable();
}
},
//#endregion
PrevRecord: function () {
var modifystr = this.getIsModify();
if (modifystr != "") {
Ext.Msg.show({ title: '警告', msg: modifystr + '未保存,如果离开此页,将丢失未保存的更改 ', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
return;
}
var j = this.StoreList.indexOf(this.editRecord);
if (j == 0) {
Ext.Msg.show({ title: '警告', msg: '已是最前一票', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
return;
}
if (j == this.StoreList.count) {
Ext.Msg.show({ title: '警告', msg: '已是最后一票', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
return;
}
var condition = '';
j = j - 1;
this.editRecord = this.StoreList.getAt(j);
if (this.opStatus == 'edit') {
condition = "GID='" + this.editRecord.get('GID') + "'";
//this.storeBodyList.load({ params: { condition: condition} });
}
this.LoadData(this.opStatus, condition);
},
NextRecord: function () {
var modifystr = this.getIsModify();
if (modifystr != "") {
Ext.Msg.show({ title: '警告', msg: modifystr + '未保存,如果离开此页,将丢失未保存的更改 ', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
return;
}
var j = this.StoreList.indexOf(this.editRecord);
if (j == (this.StoreList.data.length - 1)) {
Ext.Msg.show({ title: '警告', msg: '已是最后一票', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
return;
}
var condition = '';
j = j + 1;
this.editRecord = this.StoreList.getAt(j);
if (this.opStatus == 'edit') {
condition = "GID='" + this.editRecord.get('GID') + "'";
//this.storeBodyList.load({ params: { condition: condition} });
}
this.LoadData(this.opStatus, condition);
},
getIsModify: function () {
var drmodify = this.storeBodyList.getModifiedRecords();
if (drmodify.length != 0)
return '运价详细信息';
if (panelEdit.formEdit.getForm().isDirty() == true)
return '运价信息';
else return '';
} //
});