|
@@ -101,13 +101,14 @@ let divideObj = {
|
|
|
if(!$('#divide_glj_nav').hasClass('active')) return;
|
|
if(!$('#divide_glj_nav').hasClass('active')) return;
|
|
|
this.divideSubSpread.setActiveSheetIndex(0);
|
|
this.divideSubSpread.setActiveSheetIndex(0);
|
|
|
this.rationGLJDatas = getTreeRationGLJDatas();
|
|
this.rationGLJDatas = getTreeRationGLJDatas();
|
|
|
-
|
|
|
|
|
|
|
+ console.log(this.rationGLJDatas);
|
|
|
|
|
|
|
|
let rationGLJSheet = this.divideSubSpread.getSheet(0)
|
|
let rationGLJSheet = this.divideSubSpread.getSheet(0)
|
|
|
rationGLJSheet.setRowCount(this.rationGLJDatas.length);
|
|
rationGLJSheet.setRowCount(this.rationGLJDatas.length);
|
|
|
sheetCommonObj.showTreeData(rationGLJSheet, gljCol.ration_glj_setting,this.rationGLJDatas);
|
|
sheetCommonObj.showTreeData(rationGLJSheet, gljCol.ration_glj_setting,this.rationGLJDatas);
|
|
|
function getTreeRationGLJDatas(){
|
|
function getTreeRationGLJDatas(){
|
|
|
let datas = [];
|
|
let datas = [];
|
|
|
|
|
+ let temDatas=[];//临时存放主工料机
|
|
|
let selected = divideObj.getSelectedItem();
|
|
let selected = divideObj.getSelectedItem();
|
|
|
let divideSetting = projectObj.project.divide_setting.datas;
|
|
let divideSetting = projectObj.project.divide_setting.datas;
|
|
|
let projectGLJ = projectObj.project.projectGLJ
|
|
let projectGLJ = projectObj.project.projectGLJ
|
|
@@ -119,26 +120,56 @@ let divideObj = {
|
|
|
if(r.rationID == selected.ID){
|
|
if(r.rationID == selected.ID){
|
|
|
let newr = Object.assign(r);
|
|
let newr = Object.assign(r);
|
|
|
newr.ParentID = -1;
|
|
newr.ParentID = -1;
|
|
|
- datas.push(newr);
|
|
|
|
|
|
|
+ temDatas.push(newr);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- if(datas.length > 0){
|
|
|
|
|
- datas = gljUtil.sortRationGLJ(datas);
|
|
|
|
|
|
|
+ if(temDatas.length > 0){
|
|
|
|
|
+ temDatas = gljUtil.sortRationGLJ(temDatas);
|
|
|
let pgljMap = _.indexBy(projectGljs, 'id');
|
|
let pgljMap = _.indexBy(projectGljs, 'id');
|
|
|
- for(let d of datas){
|
|
|
|
|
|
|
+ for(let d of temDatas){
|
|
|
let glj = pgljMap[d.projectGLJID];
|
|
let glj = pgljMap[d.projectGLJID];
|
|
|
if(!glj) continue;
|
|
if(!glj) continue;
|
|
|
if(projectGLJ.isEstimateType(d.type )) d.isEstimate = glj.is_evaluate;
|
|
if(projectGLJ.isEstimateType(d.type )) d.isEstimate = glj.is_evaluate;
|
|
|
d.shortName=projectGLJ.getShortNameByID(d.type);
|
|
d.shortName=projectGLJ.getShortNameByID(d.type);
|
|
|
d.isAdd = glj.unit_price.is_add;
|
|
d.isAdd = glj.unit_price.is_add;
|
|
|
- d=this.setGLJPrice(d,glj,false);//设置工料机价格
|
|
|
|
|
- let connect_index = this.getIndex(glj, gljKeyArray);
|
|
|
|
|
-
|
|
|
|
|
|
|
+ d=gljOprObj.setGLJPrice(d,glj,false);//设置工料机价格
|
|
|
|
|
+ //计算工料机的总消耗量
|
|
|
|
|
+ d.totalQuantity = gljUtil.getTotalQuantity(d,selected,getDecimal("ration.quantity"),getDecimal("glj.quantity"));
|
|
|
|
|
+ datas.push(d);
|
|
|
|
|
+ let connect_index = gljOprObj.getIndex(glj, gljKeyArray);
|
|
|
|
|
+ if(mixRatioMap[connect_index]){//有组成物
|
|
|
|
|
+ let mList = gljUtil.sortMixRatio(mixRatioMap[connect_index]);
|
|
|
|
|
+ for(let m of mList){
|
|
|
|
|
+ let mIndex = gljOprObj.getIndex(m,gljKeyArray);
|
|
|
|
|
+ var mpg = _.find(projectGljs, function (item) {
|
|
|
|
|
+ return gljOprObj.getIndex(item,gljKeyArray) == mIndex
|
|
|
|
|
+ });
|
|
|
|
|
+ if(!mpg) continue;
|
|
|
|
|
+ let tem = {
|
|
|
|
|
+ ParentID:d.ID,
|
|
|
|
|
+ projectGLJID: mpg.id,
|
|
|
|
|
+ code: mpg.code,
|
|
|
|
|
+ name: mpg.name,
|
|
|
|
|
+ specs: mpg.specs,
|
|
|
|
|
+ unit: mpg.unit,
|
|
|
|
|
+ type:m.type,
|
|
|
|
|
+ shortName: projectGLJ.getShortNameByID(m.type),
|
|
|
|
|
+ consumption:m.consumption,
|
|
|
|
|
+ rationItemQuantity: scMathUtil.roundForObj(m.consumption, getDecimal("glj.quantity")),
|
|
|
|
|
+ isMixRatio: true,
|
|
|
|
|
+ isAdd: mpg.unit_price.is_add,
|
|
|
|
|
+ GLJID: mpg.glj_id
|
|
|
|
|
+ };
|
|
|
|
|
+ if(projectGLJ.isEstimateType(mpg.type)){
|
|
|
|
|
+ tem.isEstimate = mpg.is_evaluate;
|
|
|
|
|
+ }
|
|
|
|
|
+ tem.totalQuantity = scMathUtil.roundToString(tem.rationItemQuantity * parseFloat(d.totalQuantity), getDecimal("glj.quantity"));
|
|
|
|
|
+ gljOprObj.setGLJPrice(tem,mpg);
|
|
|
|
|
+ datas.push(tem);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
return datas;
|
|
return datas;
|
|
|
}
|
|
}
|