|
@@ -11,55 +11,63 @@ materialCalcObj = {
|
|
|
{headerName: "编号", headerWidth: 80, dataCode: "code", dataType: "String"},
|
|
{headerName: "编号", headerWidth: 80, dataCode: "code", dataType: "String"},
|
|
|
{headerName: "名称", headerWidth: 100, dataCode: "name", dataType: "String"},
|
|
{headerName: "名称", headerWidth: 100, dataCode: "name", dataType: "String"},
|
|
|
{headerName: "预算价", headerWidth: 70, dataCode: "marketPrice", hAlign: "right", dataType: "Number",validator:"number"},
|
|
{headerName: "预算价", headerWidth: 70, dataCode: "marketPrice", hAlign: "right", dataType: "Number",validator:"number"},
|
|
|
- {headerName: "供应地点", headerWidth: 100, dataCode: "unit", hAlign: "left", dataType: "String"},
|
|
|
|
|
- {headerName: "原价", headerWidth: 45, dataCode: "originalPrice", hAlign: "center", dataType: "String"},
|
|
|
|
|
- {headerName: "单位运费", headerWidth: 80, dataCode: "unitFreight", hAlign: "right", dataType: "Number",validator:"number"},//,decimalField:'glj.unitPrice'
|
|
|
|
|
- {headerName: "单位毛重(吨)", headerWidth: 60, dataCode: "unitWeight", hAlign: "right", dataType: "Number"},//,decimalField:"glj.unitPrice"
|
|
|
|
|
- {headerName: "装卸总次数", headerWidth: 50, dataCode: "totalLoadingTimes", hAlign: "right", dataType: "Number",validator:"number"},//,decimalField:"glj.unitPrice"
|
|
|
|
|
- {headerName: "每增加一次装卸损耗率", headerWidth: 80, dataCode: "handlingLossRate", hAlign: "right", dataType: "Number",decimalField:"glj.quantity",validator:"number"},
|
|
|
|
|
- {headerName: "场外运输损耗率", headerWidth: 60, dataCode: "offSiteTransportLossRate", hAlign: "right", dataType: "Number"},//,decimalField:"glj.unitPrice"
|
|
|
|
|
|
|
+ {headerName: "供应地点", headerWidth: 100, dataCode: "supplyLocation", hAlign: "left", dataType: "String"},
|
|
|
|
|
+ {headerName: "原价", headerWidth: 60, dataCode: "originalPrice", hAlign: "right", dataType: "String"},
|
|
|
|
|
+ {headerName: "单位运费", headerWidth: 60, dataCode: "unitFreight", hAlign: "right", dataType: "Number",validator:"number"},//,decimalField:'glj.unitPrice'
|
|
|
|
|
+ {headerName: "单位毛重(吨)", headerWidth: 60, dataCode: "grossWeightCoe_n", hAlign: "right", dataType: "Number"},//,decimalField:"glj.unitPrice"
|
|
|
|
|
+ {headerName: "装卸总次数", headerWidth: 60, dataCode: "totalLoadingTimes", hAlign: "right", dataType: "Number",validator:"number"},//,decimalField:"glj.unitPrice"
|
|
|
|
|
+ {headerName: "每增加一次装卸损耗率", headerWidth: 80, dataCode: "handlingLossRate_n", hAlign: "right", dataType: "Number",validator:"number"},
|
|
|
|
|
+ {headerName: "场外运输损耗率", headerWidth: 60, dataCode: "offSiteTransportLossRate_n", hAlign: "right", dataType: "Number"},//,decimalField:"glj.unitPrice"
|
|
|
{headerName: "场外运输损耗", headerWidth: 60, dataCode: "offSiteTransportLoss", hAlign: "right", dataType: "Number"},//,decimalField:"glj.unitPrice"
|
|
{headerName: "场外运输损耗", headerWidth: 60, dataCode: "offSiteTransportLoss", hAlign: "right", dataType: "Number"},//,decimalField:"glj.unitPrice"
|
|
|
- {headerName: "采购及保管费率", headerWidth: 60, dataCode: "purchaseStorageRate", hAlign: "right", dataType: "Number"},//,decimalField:"glj.unitPrice"
|
|
|
|
|
|
|
+ {headerName: "采购及保管费率", headerWidth: 60, dataCode: "purchaseStorageRate_n", hAlign: "right", dataType: "Number"},//,decimalField:"glj.unitPrice"
|
|
|
{headerName: "采购及保管费", headerWidth: 60, dataCode: "purchaseStorage", hAlign: "right", dataType: "Number"},//,decimalField:"glj.unitPrice"
|
|
{headerName: "采购及保管费", headerWidth: 60, dataCode: "purchaseStorage", hAlign: "right", dataType: "Number"},//,decimalField:"glj.unitPrice"
|
|
|
{headerName: "包装品回收价值", headerWidth: 60, dataCode: "packageRecoverValue", hAlign: "right", dataType: "Number"}//,decimalField:"glj.unitPrice"
|
|
{headerName: "包装品回收价值", headerWidth: 60, dataCode: "packageRecoverValue", hAlign: "right", dataType: "Number"}//,decimalField:"glj.unitPrice"
|
|
|
],
|
|
],
|
|
|
view: {
|
|
view: {
|
|
|
- lockColumns: [0,1,2,3,4,5,6,7],
|
|
|
|
|
|
|
+ lockColumns: ["code","name","marketPrice",'offSiteTransportLoss','purchaseStorage'],
|
|
|
colHeaderHeight:45
|
|
colHeaderHeight:45
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
freightSpread:null,
|
|
freightSpread:null,
|
|
|
freightSheet:null,
|
|
freightSheet:null,
|
|
|
freightDatas:[],
|
|
freightDatas:[],
|
|
|
|
|
+ conveyanceOptions:["汽车","火车","船舶","马车","手推车","拖拉机"],
|
|
|
freightSetting:{
|
|
freightSetting:{
|
|
|
header:[
|
|
header:[
|
|
|
{headerName: "起讫地点", headerWidth: 80, dataCode: "start", dataType: "String"},
|
|
{headerName: "起讫地点", headerWidth: 80, dataCode: "start", dataType: "String"},
|
|
|
{headerName: "运输工具", headerWidth: 80, dataCode: "conveyance", dataType: "String"},
|
|
{headerName: "运输工具", headerWidth: 80, dataCode: "conveyance", dataType: "String"},
|
|
|
- {headerName: "单位运价", headerWidth: 70, dataCode: "unitFreight", hAlign: "right", dataType: "Number",validator:"number"},
|
|
|
|
|
- {headerName: "km运距", headerWidth: 50, dataCode: "kmDistance", hAlign: "left", dataType: "String"},
|
|
|
|
|
- {headerName: "装卸费单价", headerWidth: 45, dataCode: "unitLoadingFee", hAlign: "center", dataType: "String"},
|
|
|
|
|
- {headerName: "装卸次数", headerWidth: 80, dataCode: "loadingTimes", hAlign: "right", dataType: "Number",validator:"number"},//,decimalField:'glj.unitPrice'
|
|
|
|
|
- {headerName: "其它费用", headerWidth: 60, dataCode: "otherFee", hAlign: "right", dataType: "Number"},//,decimalField:"glj.unitPrice"
|
|
|
|
|
- {headerName: "运价增加率(%)", headerWidth: 80, dataCode: "freightIncreaseRate", hAlign: "right", dataType: "Number",validator:"number"},//,decimalField:"glj.unitPrice"
|
|
|
|
|
- {headerName: "加权系数", headerWidth: 80, dataCode: "weightCoe", hAlign: "right", dataType: "Number",decimalField:"glj.quantity",validator:"number"},
|
|
|
|
|
- {headerName: "计算式", headerWidth: 60, dataCode: "exp", hAlign: "right", dataType: "Number"},//,decimalField:"glj.unitPrice"
|
|
|
|
|
|
|
+ {headerName: "单位运价", headerWidth: 60, dataCode: "unitFreight", hAlign: "right", dataType: "Number",validator:"number"},
|
|
|
|
|
+ {headerName: "km运距", headerWidth: 60, dataCode: "kmDistance", hAlign: "right", dataType: "String",validator:"number"},
|
|
|
|
|
+ {headerName: "装卸费\n单价", headerWidth: 60, dataCode: "unitLoadingFee", hAlign: "right", dataType: "String",validator:"number"},
|
|
|
|
|
+ {headerName: "装卸\n次数", headerWidth: 60, dataCode: "loadingTimes", hAlign: "right", dataType: "Number",validator:"number"},//,decimalField:'glj.unitPrice'
|
|
|
|
|
+ {headerName: "其它\n费用", headerWidth: 60, dataCode: "otherFee", hAlign: "right", dataType: "Number",validator:"number"},//,decimalField:"glj.unitPrice"
|
|
|
|
|
+ {headerName: "运价增\n加率(%)", headerWidth: 60, dataCode: "freightIncreaseRate", hAlign: "right", dataType: "Number",validator:"number"},//,decimalField:"glj.unitPrice"
|
|
|
|
|
+ {headerName: "加权\n系数", headerWidth: 60, dataCode: "weightCoe", hAlign: "right", dataType: "Number",validator:"number"},
|
|
|
|
|
+ {headerName: "计算式", headerWidth: 170, dataCode: "exp", hAlign: "right", dataType: "Number",getText:'forExp'},//,decimalField:"glj.unitPrice"
|
|
|
],
|
|
],
|
|
|
view: {
|
|
view: {
|
|
|
- lockColumns: [0,1,2,3,4,5,6,7],
|
|
|
|
|
|
|
+ lockColumns: ["exp"],
|
|
|
colHeaderHeight:45
|
|
colHeaderHeight:45
|
|
|
|
|
+ },
|
|
|
|
|
+ getText:{
|
|
|
|
|
+ forExp:function (item) {
|
|
|
|
|
+ let material = materialCalcObj.getMaterialSelected();
|
|
|
|
|
+ //(单位运价×km运距×(1+运距增加率%)+装卸费单价×装卸次数+其它费用)×单位毛重×加权系数
|
|
|
|
|
+ return `(${item.unitFreight}x${item.kmDistance}x(1+${item.freightIncreaseRate}%)+${item.unitLoadingFee}x${item.loadingTimes}+${item.otherFee})x${material.grossWeightCoe_n}x${item.weightCoe}`
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
priceSpread:null,
|
|
priceSpread:null,
|
|
|
priceSheet:null,
|
|
priceSheet:null,
|
|
|
- priceData:[],
|
|
|
|
|
|
|
+ priceDatas:[],
|
|
|
priceSetting:{
|
|
priceSetting:{
|
|
|
header:[
|
|
header:[
|
|
|
- {headerName: "供应地点", headerWidth: 80, dataCode: "start", dataType: "String"},
|
|
|
|
|
- {headerName: "供应价", headerWidth: 70, dataCode: "unitFreight", hAlign: "right", dataType: "Number",validator:"number"},
|
|
|
|
|
- {headerName: "加权系数", headerWidth: 80, dataCode: "loadingTimes", hAlign: "right", dataType: "Number",validator:"number"},//,decimalField:'glj.unitPrice'
|
|
|
|
|
|
|
+ {headerName: "供应地点", headerWidth: 80, dataCode: "supplyLocation", dataType: "String"},
|
|
|
|
|
+ {headerName: "供应价", headerWidth: 70, dataCode: "supplyPrice", hAlign: "right", dataType: "Number",validator:"number"},
|
|
|
|
|
+ {headerName: "加权系数", headerWidth: 80, dataCode: "coe", hAlign: "right", dataType: "Number",validator:"number"},//,decimalField:'glj.unitPrice'
|
|
|
],
|
|
],
|
|
|
view: {
|
|
view: {
|
|
|
- lockColumns: [0,1,2],
|
|
|
|
|
|
|
+ lockColumns: [],
|
|
|
colHeaderHeight:45
|
|
colHeaderHeight:45
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
@@ -68,11 +76,14 @@ materialCalcObj = {
|
|
|
sheetCommonObj.spreadDefaultStyle(this.materialSpread);
|
|
sheetCommonObj.spreadDefaultStyle(this.materialSpread);
|
|
|
this.materialSheet = this.materialSpread.getSheet(0);
|
|
this.materialSheet = this.materialSpread.getSheet(0);
|
|
|
sheetCommonObj.initSheet(this.materialSheet, this.materialSetting, 30);
|
|
sheetCommonObj.initSheet(this.materialSheet, this.materialSetting, 30);
|
|
|
- /* this.materialSheet.bind(GC.Spread.Sheets.Events.EditEnded, this.onAssEditEnded);
|
|
|
|
|
- this.materialSheet.bind(GC.Spread.Sheets.Events.RangeChanged, this.onAssRangeChanged);*/
|
|
|
|
|
|
|
+ this.materialSheet.bind(GC.Spread.Sheets.Events.ValueChanged, this.onMaterialValueChange);
|
|
|
|
|
+ this.materialSheet.bind(GC.Spread.Sheets.Events.SelectionChanged,this.onMaterialSelectionChange);
|
|
|
|
|
+ this.materialSheet.bind(GC.Spread.Sheets.Events.EditStarting,this.onMaterialEditStarting);
|
|
|
this.materialSheet.name('material_calc');
|
|
this.materialSheet.name('material_calc');
|
|
|
if(projectReadOnly){
|
|
if(projectReadOnly){
|
|
|
disableSpread(this.materialSpread);
|
|
disableSpread(this.materialSpread);
|
|
|
|
|
+ }else {
|
|
|
|
|
+ this.initRightClick("materialCalcSheet",this.materialSpread)
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
initFreightSpread:function(){
|
|
initFreightSpread:function(){
|
|
@@ -80,11 +91,14 @@ materialCalcObj = {
|
|
|
sheetCommonObj.spreadDefaultStyle(this.freightSpread);
|
|
sheetCommonObj.spreadDefaultStyle(this.freightSpread);
|
|
|
this.freightSheet = this.freightSpread.getSheet(0);
|
|
this.freightSheet = this.freightSpread.getSheet(0);
|
|
|
sheetCommonObj.initSheet(this.freightSheet, this.freightSetting, 30);
|
|
sheetCommonObj.initSheet(this.freightSheet, this.freightSetting, 30);
|
|
|
- /* this.freightSheet.bind(GC.Spread.Sheets.Events.EditEnded, this.onAssEditEnded);
|
|
|
|
|
- this.freightSheet.bind(GC.Spread.Sheets.Events.RangeChanged, this.onAssRangeChanged);*/
|
|
|
|
|
|
|
+ this.freightSheet.bind(GC.Spread.Sheets.Events.ValueChanged, this.onFreightValueChange);
|
|
|
|
|
+ this.freightSheet.bind(GC.Spread.Sheets.Events.SelectionChanged,this.onFreightSelectionChange);
|
|
|
|
|
+ this.freightSheet.bind(GC.Spread.Sheets.Events.EditStarting,this.onFreightEditStarting);
|
|
|
this.freightSheet.name('freight_calc');
|
|
this.freightSheet.name('freight_calc');
|
|
|
if(projectReadOnly){
|
|
if(projectReadOnly){
|
|
|
disableSpread(this.freightSpread);
|
|
disableSpread(this.freightSpread);
|
|
|
|
|
+ }else {
|
|
|
|
|
+ this.initRightClick("freightSheet",this.freightSpread)
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
initPriceSpread:function(){
|
|
initPriceSpread:function(){
|
|
@@ -92,27 +106,49 @@ materialCalcObj = {
|
|
|
sheetCommonObj.spreadDefaultStyle(this.priceSpread);
|
|
sheetCommonObj.spreadDefaultStyle(this.priceSpread);
|
|
|
this.priceSheet = this.priceSpread.getSheet(0);
|
|
this.priceSheet = this.priceSpread.getSheet(0);
|
|
|
sheetCommonObj.initSheet(this.priceSheet, this.priceSetting, 30);
|
|
sheetCommonObj.initSheet(this.priceSheet, this.priceSetting, 30);
|
|
|
- /* this.freightSheet.bind(GC.Spread.Sheets.Events.EditEnded, this.onAssEditEnded);
|
|
|
|
|
- this.freightSheet.bind(GC.Spread.Sheets.Events.RangeChanged, this.onAssRangeChanged);*/
|
|
|
|
|
|
|
+ this.priceSheet.bind(GC.Spread.Sheets.Events.ValueChanged, this.onPriceValueChange);
|
|
|
|
|
+ this.priceSheet.bind(GC.Spread.Sheets.Events.EditStarting,this.onPriceEditStarting);
|
|
|
this.priceSheet.name('price_calc');
|
|
this.priceSheet.name('price_calc');
|
|
|
if(projectReadOnly){
|
|
if(projectReadOnly){
|
|
|
disableSpread(this.priceSpread);
|
|
disableSpread(this.priceSpread);
|
|
|
|
|
+ }else {
|
|
|
|
|
+ this.initRightClick("priceSheet",this.priceSpread)
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
showFreightDatas:function () {
|
|
showFreightDatas:function () {
|
|
|
if(!$('#freightSheet').is(':visible')) return;
|
|
if(!$('#freightSheet').is(':visible')) return;
|
|
|
|
|
+ let sel = this.freightSheet.getSelections()[0];
|
|
|
|
|
+ let oldData = sel.row<this.freightDatas.length?this.freightDatas[sel.row]:"";
|
|
|
this.freightSheet.setRowCount(0);
|
|
this.freightSheet.setRowCount(0);
|
|
|
|
|
+ this.freightDatas = this.getFreightDatas();
|
|
|
sheetCommonObj.showData(this.freightSheet, this.freightSetting,this.freightDatas);
|
|
sheetCommonObj.showData(this.freightSheet, this.freightSetting,this.freightDatas);
|
|
|
|
|
+ this.freightSheet.setRowCount(this.freightDatas+20);
|
|
|
|
|
+ let convCol = _.findIndex(this.freightSetting.header,{'dataCode':'conveyance'});
|
|
|
|
|
+ sheetCommonObj.setComboBox(-1,convCol,this.freightSheet,this.conveyanceOptions,false);
|
|
|
|
|
+ sel.row = oldData?_.findIndex(this.freightDatas,{'ID':oldData.ID}):sel.row ;
|
|
|
|
|
+ this.freightSheet.setSelection(sel.row==-1?0:sel.row,sel.col,sel.rowCount,sel.colCount);
|
|
|
},
|
|
},
|
|
|
showMaterialCalcDatas:function(){
|
|
showMaterialCalcDatas:function(){
|
|
|
|
|
+ let sel = this.materialSheet.getSelections()[0];
|
|
|
|
|
+ let oldData = sel.row<this.materialDatas.length?this.materialDatas[sel.row]:"";
|
|
|
this.materialSheet.setRowCount(0);
|
|
this.materialSheet.setRowCount(0);
|
|
|
|
|
+ this.materialDatas = this.getMaterialCalcDatas();
|
|
|
sheetCommonObj.showData(this.materialSheet, this.materialSetting,this.materialDatas);
|
|
sheetCommonObj.showData(this.materialSheet, this.materialSetting,this.materialDatas);
|
|
|
this.materialSheet.setRowCount(this.materialDatas.length);
|
|
this.materialSheet.setRowCount(this.materialDatas.length);
|
|
|
|
|
+ sel.row = oldData?_.findIndex(this.materialDatas,{'id':oldData.id}):-1;
|
|
|
|
|
+ this.materialSheet.setSelection(sel.row==-1?0:sel.row,sel.col,sel.rowCount,sel.colCount);
|
|
|
},
|
|
},
|
|
|
showPriceDatas:function () {
|
|
showPriceDatas:function () {
|
|
|
if(!$('#priceSheet').is(':visible')) return;
|
|
if(!$('#priceSheet').is(':visible')) return;
|
|
|
|
|
+ let sel = this.priceSheet.getSelections()[0];
|
|
|
|
|
+ let oldData = sel.row<this.priceDatas.length?this.priceDatas[sel.row]:"";
|
|
|
this.priceSheet.setRowCount(0);
|
|
this.priceSheet.setRowCount(0);
|
|
|
- sheetCommonObj.showData(this.priceSheet, this.priceSetting,this.priceData);
|
|
|
|
|
|
|
+ this.priceDatas = this.getPriceDatas();
|
|
|
|
|
+ sheetCommonObj.showData(this.priceSheet, this.priceSetting,this.priceDatas);
|
|
|
|
|
+ this.priceSheet.setRowCount(this.priceDatas.length+20);
|
|
|
|
|
+ sel.row = oldData?_.findIndex(this.priceDatas,{'ID':oldData.ID}):sel.row ;
|
|
|
|
|
+ this.priceSheet.setSelection(sel.row==-1?0:sel.row,sel.col,sel.rowCount,sel.colCount);
|
|
|
|
|
+
|
|
|
},
|
|
},
|
|
|
showDatas:function(){
|
|
showDatas:function(){
|
|
|
if(!$('#materialCalcSheet').is(':visible')) return;
|
|
if(!$('#materialCalcSheet').is(':visible')) return;
|
|
@@ -124,6 +160,200 @@ materialCalcObj = {
|
|
|
this.showPriceDatas();
|
|
this.showPriceDatas();
|
|
|
projectGljObject.refreshSubViews();
|
|
projectGljObject.refreshSubViews();
|
|
|
},
|
|
},
|
|
|
|
|
+ getMaterialSelected:function () {
|
|
|
|
|
+ let sel = this.materialSheet.getSelections()[0];
|
|
|
|
|
+ if(sel.row != -1 && this.materialDatas.length>sel.row){
|
|
|
|
|
+ return this.materialDatas[sel.row]
|
|
|
|
|
+ }
|
|
|
|
|
+ return null;
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ getPriceDatas:function () {
|
|
|
|
|
+ let list = projectObj.project.projectGLJ.datas.originalList;
|
|
|
|
|
+ let material = this.getMaterialSelected();
|
|
|
|
|
+ return material?_.filter(list,{"connect_key":gljUtil.getIndex(material)}):[];
|
|
|
|
|
+ },
|
|
|
|
|
+ getFreightDatas:function () {
|
|
|
|
|
+ let list = projectObj.project.projectGLJ.datas.freightList;
|
|
|
|
|
+ let material = this.getMaterialSelected();
|
|
|
|
|
+ return material?_.filter(list,{"connect_key":gljUtil.getIndex(material)}):[];
|
|
|
|
|
+ },
|
|
|
|
|
+ getMaterialCalcDatas:function () {
|
|
|
|
|
+ let gljList = projectObj.project.projectGLJ.datas.gljList;
|
|
|
|
|
+ let datas = [];
|
|
|
|
|
+ for(let g of gljList){
|
|
|
|
|
+ if(g.quantity !== 0 && g.quantity !== '0' && g.unit_price.calcMaterial == 1){
|
|
|
|
|
+ let data = {
|
|
|
|
|
+ id:g.id,
|
|
|
|
|
+ code:g.code,
|
|
|
|
|
+ name:g.name,
|
|
|
|
|
+ type:g.type,
|
|
|
|
|
+ unit:g.unit,
|
|
|
|
|
+ specs:g.specs,
|
|
|
|
|
+ unit_price:{id:g.unit_price.id,type:g.type,unit_price_file_id:g.unit_price.unit_price_file_id},//type用来排序
|
|
|
|
|
+ supplyLocation:g.unit_price.supplyLocation,
|
|
|
|
|
+ originalPrice:g.unit_price.originalPrice?g.unit_price.originalPrice:0,
|
|
|
|
|
+ unitFreight:g.unit_price.unitFreight?g.unit_price.unitFreight:0,
|
|
|
|
|
+ // unitWeight:g.unit_price.unitWeight?g.unit_price.unitWeight:0,
|
|
|
|
|
+ totalLoadingTimes:g.unit_price.totalLoadingTimes?g.unit_price.totalLoadingTimes:0,
|
|
|
|
|
+ handlingLossRate_n:g.unit_price.handlingLossRate_n?g.unit_price.handlingLossRate_n:0,
|
|
|
|
|
+ offSiteTransportLossRate_n:g.unit_price.offSiteTransportLossRate_n?g.unit_price.offSiteTransportLossRate_n:0,
|
|
|
|
|
+ offSiteTransportLoss:g.unit_price.offSiteTransportLoss?g.unit_price.offSiteTransportLoss:0,
|
|
|
|
|
+ purchaseStorageRate_n:g.unit_price.purchaseStorageRate_n?g.unit_price.purchaseStorageRate_n:0,
|
|
|
|
|
+ purchaseStorage:g.unit_price.purchaseStorage?g.unit_price.purchaseStorage:0,
|
|
|
|
|
+ grossWeightCoe_n:g.unit_price.grossWeightCoe_n?g.unit_price.grossWeightCoe_n:0,
|
|
|
|
|
+ packageRecoverValue:g.unit_price.packageRecoverValue?g.unit_price.packageRecoverValue:0
|
|
|
|
|
+ };
|
|
|
|
|
+ gljOprObj.setGLJPrice(data,g);
|
|
|
|
|
+ datas.push(data);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return gljUtil.sortProjectGLJ(datas);
|
|
|
|
|
+ },
|
|
|
|
|
+ onMaterialSelectionChange:function(sender,args){
|
|
|
|
|
+ let me = materialCalcObj;
|
|
|
|
|
+ let newSel = args.newSelections[0];
|
|
|
|
|
+ let oldSel = args.oldSelections?args.oldSelections[0]:{};
|
|
|
|
|
+ if(newSel.row != oldSel.row){
|
|
|
|
|
+ me.showPriceDatas();
|
|
|
|
|
+ me.showFreightDatas();
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ onFreightSelectionChange:function (sender,args) {
|
|
|
|
|
+ args.sheet.repaint();
|
|
|
|
|
+ },
|
|
|
|
|
+ onPriceEditStarting:function (sender,args) {
|
|
|
|
|
+ let me = materialCalcObj;
|
|
|
|
|
+ if(!me.getMaterialSelected()){
|
|
|
|
|
+ args.cancel = true;
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ onFreightEditStarting:function(sender,args){
|
|
|
|
|
+ let me = materialCalcObj;
|
|
|
|
|
+ if(!me.getMaterialSelected()){
|
|
|
|
|
+ args.cancel = true;
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ onMaterialEditStarting:function (sender,args) {
|
|
|
|
|
+ let me = materialCalcObj;
|
|
|
|
|
+ let dataCode = me.materialSetting.header[args.col].dataCode;
|
|
|
|
|
+ if(dataCode == "supplyLocation" ||dataCode == "originalPrice"){//原价计算表有数据时只读,
|
|
|
|
|
+ args.cancel = me.getPriceDatas().length > 0;
|
|
|
|
|
+ }
|
|
|
|
|
+ if(dataCode == "unitFreight"){//当运费计算表有数据时,则只读
|
|
|
|
|
+ args.cancel = me.getFreightDatas().length > 0;
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ onMaterialValueChange:function (sender,args) {
|
|
|
|
|
+ let me = materialCalcObj;
|
|
|
|
|
+ let dataCode = me.materialSetting.header[args.col].dataCode;
|
|
|
|
|
+ let value = args.newValue;
|
|
|
|
|
+ if (value&&!sheetCommonObj.checkData(args.col,me.materialSetting,value)) {
|
|
|
|
|
+ alert('输入的数据类型不对,请重新输入!');
|
|
|
|
|
+ me.showDatas();
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ if(dataCode != 'supplyLocation'){
|
|
|
|
|
+ value = value?scMathUtil.roundForObj(value,getDecimal("glj.unitPrice"))+'':'0'//4舍五入加默认为0
|
|
|
|
|
+ }
|
|
|
|
|
+ let recode = me.materialDatas[args.row];
|
|
|
|
|
+ if(recode[dataCode] == value) return;
|
|
|
|
|
+ let doc = {};
|
|
|
|
|
+ doc[dataCode] = value;
|
|
|
|
|
+ projectObj.project.projectGLJ.updateMaterialCalc([{id:recode.id,doc:doc}]);
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ onFreightValueChange:function (sender,args) {
|
|
|
|
|
+ let me = materialCalcObj;
|
|
|
|
|
+ let dataCode = me.freightSetting.header[args.col].dataCode;
|
|
|
|
|
+ let value = args.newValue;
|
|
|
|
|
+ let material = me.getMaterialSelected();
|
|
|
|
|
+ if (value&&!sheetCommonObj.checkData(args.col,me.freightSetting,value)) {
|
|
|
|
|
+ alert('输入的数据类型不对,请重新输入!');
|
|
|
|
|
+ me.showDatas();
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ if(dataCode != 'start'&&dataCode != 'conveyance'){
|
|
|
|
|
+ value = value?scMathUtil.roundForObj(value,getDecimal("glj.unitPrice"))+'':'0'//4舍五入加默认为0
|
|
|
|
|
+ }
|
|
|
|
|
+ if(args.row >= me.freightDatas.length){//新增
|
|
|
|
|
+ let newData = {
|
|
|
|
|
+ start:"",//起讫地点
|
|
|
|
|
+ conveyance:"汽车",//运输工具
|
|
|
|
|
+ unitFreight:'0',//单位运价
|
|
|
|
|
+ kmDistance:'0',//km运距
|
|
|
|
|
+ unitLoadingFee:'0',//装卸费单价
|
|
|
|
|
+ loadingTimes:'0',//装卸次数
|
|
|
|
|
+ otherFee:'0',//其它费用
|
|
|
|
|
+ freightIncreaseRate:'0',//运价增加率
|
|
|
|
|
+ weightCoe:'1',//加权系数
|
|
|
|
|
+ connect_key:gljUtil.getIndex(material),
|
|
|
|
|
+ unit_price_file_id:material.unit_price.unit_price_file_id
|
|
|
|
|
+ };
|
|
|
|
|
+ newData[dataCode] = value;
|
|
|
|
|
+ projectObj.project.projectGLJ.addFreightCalc([newData],material.id);
|
|
|
|
|
+ }else {//修改
|
|
|
|
|
+ let recode = me.freightDatas[args.row];
|
|
|
|
|
+ if(recode[dataCode] == value) return;
|
|
|
|
|
+ let doc = {};
|
|
|
|
|
+ doc[dataCode] = value;
|
|
|
|
|
+ projectObj.project.projectGLJ.updateFreightCalc([{ID:recode.ID,doc:doc}],material.id);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ },
|
|
|
|
|
+ onPriceValueChange:function(sender,args){
|
|
|
|
|
+ let me = materialCalcObj;
|
|
|
|
|
+ let dataCode = me.priceSetting.header[args.col].dataCode;
|
|
|
|
|
+ let value = args.newValue;
|
|
|
|
|
+ let material = me.getMaterialSelected();
|
|
|
|
|
+ //输入有效性判断, to do
|
|
|
|
|
+ if (value&&!sheetCommonObj.checkData(args.col,me.priceSetting,value)) {
|
|
|
|
|
+ alert('输入的数据类型不对,请重新输入!');
|
|
|
|
|
+ me.showDatas();
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ if(dataCode == 'coe'||dataCode == 'supplyPrice'){
|
|
|
|
|
+ value = value?scMathUtil.roundForObj(value,getDecimal("glj.unitPrice"))+'':'0'//4舍五入加默认为0
|
|
|
|
|
+ }
|
|
|
|
|
+ if(args.row >= me.priceDatas.length){//新增
|
|
|
|
|
+ let newData = {
|
|
|
|
|
+ supplyLocation:"",
|
|
|
|
|
+ supplyPrice:'0',
|
|
|
|
|
+ coe:'1',
|
|
|
|
|
+ connect_key:gljUtil.getIndex(material),
|
|
|
|
|
+ unit_price_file_id:material.unit_price.unit_price_file_id
|
|
|
|
|
+ };
|
|
|
|
|
+ newData[dataCode] = value;
|
|
|
|
|
+ projectObj.project.projectGLJ.addPriceCalc([newData],material.id);
|
|
|
|
|
+ }else {//修改
|
|
|
|
|
+ let recode = me.priceDatas[args.row];
|
|
|
|
|
+ if(recode[dataCode] == value) return;
|
|
|
|
|
+ let doc = {};
|
|
|
|
|
+ doc[dataCode] = value;
|
|
|
|
|
+ projectObj.project.projectGLJ.updatePriceCalc([{ID:recode.ID,doc:doc}],material.id);
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ deleteMaterialCal:function (row) {
|
|
|
|
|
+ let record = this.materialDatas[row];//修改材料计算标记的同时还要删除原价计算,运费计算等
|
|
|
|
|
+ if(record){
|
|
|
|
|
+ projectObj.project.projectGLJ.updateCalcMaterial(record,'calcMaterial',0);
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ deletePriceCalc:function (row) {
|
|
|
|
|
+ let record = this.priceDatas[row];
|
|
|
|
|
+ if(record){
|
|
|
|
|
+ let material = this.getMaterialSelected();
|
|
|
|
|
+ projectObj.project.projectGLJ.deletePriceCalc(record.ID,material.id);
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ deleteFreightCalc:function (row) {
|
|
|
|
|
+ let record = this.freightDatas[row];
|
|
|
|
|
+ if(record){
|
|
|
|
|
+ let material = this.getMaterialSelected();
|
|
|
|
|
+ projectObj.project.projectGLJ.deleteFreightCalc(record.ID,material.id);
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
getSideResize: function () {
|
|
getSideResize: function () {
|
|
|
let rg_sideResizeEles = {};
|
|
let rg_sideResizeEles = {};
|
|
|
rg_sideResizeEles.eleObj = {
|
|
rg_sideResizeEles.eleObj = {
|
|
@@ -139,6 +369,34 @@ materialCalcObj = {
|
|
|
};
|
|
};
|
|
|
return rg_sideResizeEles;
|
|
return rg_sideResizeEles;
|
|
|
},
|
|
},
|
|
|
|
|
+ initRightClick:function (id,spread) {
|
|
|
|
|
+ let me = this;
|
|
|
|
|
+ $.contextMenu({
|
|
|
|
|
+ selector: '#'+id,
|
|
|
|
|
+ build: function ($trigger, e) {
|
|
|
|
|
+ me.rightClickTarget = SheetDataHelper.safeRightClickSelection($trigger, e, spread);
|
|
|
|
|
+ return me.rightClickTarget.hitTestType === GC.Spread.Sheets.SheetArea.viewport ||
|
|
|
|
|
+ me.rightClickTarget.hitTestType === GC.Spread.Sheets.SheetArea.rowHeader;
|
|
|
|
|
+ },
|
|
|
|
|
+ items: {
|
|
|
|
|
+ "delete": {
|
|
|
|
|
+ name: "删除",
|
|
|
|
|
+ icon: 'fa-trash-o',
|
|
|
|
|
+ disabled: function () {
|
|
|
|
|
+ if(id == "priceSheet") return me.rightClickTarget.row >= me.priceDatas.length;
|
|
|
|
|
+ if(id == "freightSheet") return me.rightClickTarget.row >= me.freightDatas.length;
|
|
|
|
|
+ return me.rightClickTarget.row === undefined;
|
|
|
|
|
+ },
|
|
|
|
|
+ callback: function (key, opt) {
|
|
|
|
|
+ let row = me.rightClickTarget.row;
|
|
|
|
|
+ if (id == "materialCalcSheet") me.deleteMaterialCal(row);
|
|
|
|
|
+ if (id == "priceSheet") me.deletePriceCalc(row);
|
|
|
|
|
+ if(id == "freightSheet") me.deleteFreightCalc(row);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
initTabWidth:function () {
|
|
initTabWidth:function () {
|
|
|
if($("#mix_ratio_sheet").is(':visible')) return ;//如果是组成物计算界面,返回
|
|
if($("#mix_ratio_sheet").is(':visible')) return ;//如果是组成物计算界面,返回
|
|
|
let mr_sideResizeEles = this.getSideResize();
|
|
let mr_sideResizeEles = this.getSideResize();
|