|
@@ -237,7 +237,7 @@ ProjectGLJ.prototype.updatePrice = function (recode, updateField, newval,from) {
|
|
|
let pgljID = from=="rg"?recode.projectGLJID:recode.id;//和定额工料机统一接口,项目工料机ID取值不一样
|
|
|
let glj = _.find(projectGljs, {'id': pgljID});
|
|
|
if (glj) {
|
|
|
- let data = {id: glj.unit_price.id, field: updateField, newval: newval};
|
|
|
+ let data = {id: glj.unit_price.id, field: updateField, newval: newval,project_id:glj.project_id};
|
|
|
let callback = function (data) {
|
|
|
if (updateField == 'base_price') {
|
|
|
glj.unit_price.base_price = newval;
|
|
@@ -254,6 +254,8 @@ ProjectGLJ.prototype.updatePrice = function (recode, updateField, newval,from) {
|
|
|
gljs.push(glj);
|
|
|
let nodes = me.getImpactRationNodes(gljs);//取到因为改变工料机价格而受影响的定额
|
|
|
projectObj.project.calcProgram.calcRationsAndSave(nodes);//触发计算程序
|
|
|
+ socket.emit('unitFileChangeNotify', JSON.stringify(data));
|
|
|
+ projectObj.project.markUpdateProject({projectID:projectObj.project.ID(),'unitFileID':socketObject.getUnitFileRoomID()},"unitFile");
|
|
|
$.bootstrapLoading.end();
|
|
|
}
|
|
|
$.bootstrapLoading.start();
|
|
@@ -370,7 +372,7 @@ ProjectGLJ.prototype.setAdjustPrice = function (glj) {
|
|
|
ProjectGLJ.prototype.getAdjustPrice = function (glj) {
|
|
|
GLJTypeConst = this.datas.constData.GLJTypeConst !== undefined ? JSON.parse(this.datas.constData.GLJTypeConst) : GLJTypeConst;
|
|
|
let decimal = getDecimal("glj.unitPrice");
|
|
|
- let quantity_decimal = getDecimal("glj.quantity")
|
|
|
+ let quantity_decimal = getDecimal("glj.quantity");
|
|
|
if (glj.unit_price.type == GLJTypeConst.LABOUR || glj.unit_price.type == GLJTypeConst.MACHINE_LABOUR) {//人工、机上人工,调整价根据定额价*调整系数计算得出。
|
|
|
let labour = projectObj.project.calcProgram.compiledLabourCoes[glj.adjCoe];
|
|
|
//let labour=1;
|
|
@@ -394,12 +396,59 @@ ProjectGLJ.prototype.getAdjustPrice = function (glj) {
|
|
|
} else {//对于其他普通材料等,无调整系数,调整价=定额价。
|
|
|
return glj.unit_price.base_price
|
|
|
}
|
|
|
+};
|
|
|
+
|
|
|
+ProjectGLJ.prototype.getBasePrice = function(glj){
|
|
|
+ let price_decimal = getDecimal("glj.unitPrice");
|
|
|
+ let quantity_decimal = getDecimal("glj.quantity");
|
|
|
+ if (notEditType.indexOf(glj.unit_price.type)>0&&glj.ratio_data.length>0) {//对于混凝土、配合比、砂浆、机械台班等有组成物的材料,价格需根据组成物计算得出。
|
|
|
+ let p =0;
|
|
|
+ for(let ratio of glj.ratio_data){
|
|
|
+ let tem = _.find( projectObj.project.projectGLJ.datas.gljList,{
|
|
|
+ 'code': ratio.code,
|
|
|
+ 'name': ratio.name,
|
|
|
+ 'specs':ratio.specs,
|
|
|
+ 'type': ratio.type,
|
|
|
+ 'unit': ratio.unit
|
|
|
+ });
|
|
|
+ if(tem){
|
|
|
+ p+=scMathUtil.roundForObj(tem.unit_price.base_price*scMathUtil.roundForObj(ratio.consumption,quantity_decimal),price_decimal);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return scMathUtil.roundForObj(p,price_decimal);
|
|
|
+ }else {
|
|
|
+ return scMathUtil.roundForObj(glj.unit_price.base_price,price_decimal);
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
+ProjectGLJ.prototype.getMarketPrice = function (glj) {
|
|
|
+ let price_decimal = getDecimal("glj.unitPrice");
|
|
|
+ let quantity_decimal = getDecimal("glj.quantity");
|
|
|
+ if (notEditType.indexOf(glj.unit_price.type)>0&&glj.ratio_data.length>0) {//对于混凝土、配合比、砂浆、机械台班等有组成物的材料,价格需根据组成物计算得出。
|
|
|
+ let p =0;
|
|
|
+ for(let ratio of glj.ratio_data){
|
|
|
+ let tem = _.find( projectObj.project.projectGLJ.datas.gljList,{
|
|
|
+ 'code': ratio.code,
|
|
|
+ 'name': ratio.name,
|
|
|
+ 'specs':ratio.specs,
|
|
|
+ 'type': ratio.type,
|
|
|
+ 'unit': ratio.unit
|
|
|
+ });
|
|
|
+ if(tem){
|
|
|
+ p+=scMathUtil.roundForObj(tem.unit_price.market_price*scMathUtil.roundForObj(ratio.consumption,quantity_decimal),price_decimal);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return scMathUtil.roundForObj(p,price_decimal);
|
|
|
+ }else {
|
|
|
+ return scMathUtil.roundForObj(glj.unit_price.market_price,price_decimal);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
+
|
|
|
ProjectGLJ.prototype.getShortNameByID = function (ID) {
|
|
|
let gljTypeMap = this.datas.constData.gljTypeMap;
|
|
|
return gljTypeMap["typeId" + ID].shortName;
|
|
|
-}
|
|
|
+};
|
|
|
|
|
|
ProjectGLJ.prototype.calcQuantity = function (){
|
|
|
let project_gljs = this.datas.gljList;
|