Compare commits

...

2 Commits

Author SHA1 Message Date
z
37c3d0e4d3 Merge remote-tracking branch 'origin/main' 2025-03-06 10:33:22 +08:00
z
372aa8565f 其他成本 2025-03-06 10:33:08 +08:00
14 changed files with 203 additions and 32 deletions

View File

@ -14,6 +14,7 @@ import com.chanko.yunxi.mes.module.heli.dal.dataobject.deliverorder.DeliverOrder
import com.chanko.yunxi.mes.module.heli.dal.dataobject.orderys.OrderYsDO;
import com.chanko.yunxi.mes.module.heli.dal.dataobject.projectorder.ProjectOrderDO;
import com.chanko.yunxi.mes.module.heli.dal.dataobject.projectorder.ProjectOrderSubDO;
import com.chanko.yunxi.mes.module.heli.dal.dataobject.purchaseorder.PurchaseOrderDO;
import com.chanko.yunxi.mes.module.heli.dal.dataobject.storage.StorageDO;
import com.chanko.yunxi.mes.module.heli.dal.dataobject.taskdispatch.TaskDispatchDO;
import com.chanko.yunxi.mes.module.heli.dal.mysql.orderys.OrderYsMapper;
@ -22,6 +23,7 @@ import com.chanko.yunxi.mes.module.heli.manager.CrossOrderManager;
import com.chanko.yunxi.mes.module.heli.service.deliverorder.DeliverOrderService;
import com.chanko.yunxi.mes.module.heli.service.orderys.OrderYsService;
import com.chanko.yunxi.mes.module.heli.service.projectorder.ProjectOrderService;
import com.chanko.yunxi.mes.module.heli.service.purchaseorder.PurchaseOrderService;
import com.chanko.yunxi.mes.module.heli.service.storage.StorageService;
import com.chanko.yunxi.mes.module.heli.service.taskdispatch.TaskDispatchService;
import io.swagger.v3.oas.annotations.Operation;
@ -69,6 +71,8 @@ public class ProjectOrderController {
private TaskDispatchService taskDispatchService;
@Resource
private StorageService storageService;
@Resource
private PurchaseOrderService purchaseOrderService;
@PostMapping("/create")
@Operation(summary = "创建项目订单")
@PreAuthorize("@ss.hasPermission('heli:project-order:create')")
@ -157,6 +161,8 @@ public class ProjectOrderController {
.map(deliverOrderSubDO -> deliverOrderSubDO.getYunFeiMoney() != null ? deliverOrderSubDO.getYunFeiMoney() : BigDecimal.ZERO)
.reduce(BigDecimal.ZERO, BigDecimal::add);
projectOrderDO.setYunFeiCost(totalAmount);
}else {
projectOrderDO.setYunFeiCost(BigDecimal.ZERO);
}
List<TaskDispatchDO> list= taskDispatchService.getListJg(projectOrderDO.getId(),projectOrderDO.getProjectSubId());
if (list!=null&&list.size()>0){
@ -164,6 +170,8 @@ public class ProjectOrderController {
.map(TaskDispatchDO -> TaskDispatchDO.getZanGuMoney() != null ?new BigDecimal(TaskDispatchDO.getZanGuMoney()) : BigDecimal.ZERO)
.reduce(BigDecimal.ZERO, BigDecimal::add);
projectOrderDO.setJiaGongShiCost(totalAmount);
}else {
projectOrderDO.setJiaGongShiCost(BigDecimal.ZERO);
}
List<StorageDO> list1= storageService.getList(projectOrderDO.getId(),projectOrderDO.getProjectSubId());
if (list1!=null&&list1.size()>0){
@ -171,7 +179,20 @@ public class ProjectOrderController {
.map(StorageDO -> StorageDO.getCaiGouMoney() != null ?StorageDO.getCaiGouMoney() : BigDecimal.ZERO)
.reduce(BigDecimal.ZERO, BigDecimal::add);
projectOrderDO.setBiaoZhunJianCost(totalAmount);
}else {
projectOrderDO.setBiaoZhunJianCost(BigDecimal.ZERO);
}
List<PurchaseOrderDO> list2 =purchaseOrderService.getListqt(projectOrderDO.getId(),projectOrderDO.getProjectSubId());
if (list2!=null&&list2.size()>0){
BigDecimal totalAmount = list2.stream()
.map(PurchaseOrderDO -> PurchaseOrderDO.getCaiGouMoney() != null ?PurchaseOrderDO.getCaiGouMoney() : BigDecimal.ZERO)
.reduce(BigDecimal.ZERO, BigDecimal::add);
projectOrderDO.setQitaCost(totalAmount);
}else {
projectOrderDO.setQitaCost(BigDecimal.ZERO);
}
BigDecimal sum = projectOrderDO.getYunFeiCost().add(projectOrderDO.getJiaGongShiCost()).add(projectOrderDO.getBiaoZhunJianCost()).add(projectOrderDO.getQitaCost());
projectOrderDO.setSumCost(sum);
}
return success(BeanUtils.toBean(pageResult, ProjectOrderCostRespVO.class));
}

View File

@ -68,5 +68,7 @@ public class ProjectOrderCostRespVO {
@Schema(description = "合计成本")
@ExcelProperty("合计成本")
private BigDecimal sumCost;
@ExcelProperty("其他成本")
private BigDecimal qitaCost;
}

View File

@ -2,6 +2,7 @@ package com.chanko.yunxi.mes.module.heli.controller.admin.purchaseorder;
import com.chanko.yunxi.mes.module.heli.controller.admin.plan.vo.PlanPageReqVO;
import com.chanko.yunxi.mes.module.heli.controller.admin.plan.vo.PlanRespVO;
import com.chanko.yunxi.mes.module.heli.dal.dataobject.deliverorder.DeliverOrderDO;
import com.chanko.yunxi.mes.module.heli.dal.dataobject.plan.PlanDO;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
@ -142,5 +143,12 @@ public class PurchaseOrderController {
ExcelUtils.write(response, "采购订单.xls", "数据", PurchaseOrderRespVO.class,
BeanUtils.toBean(list, PurchaseOrderRespVO.class));
}
@GetMapping("/getListqt")
@Operation(summary = "获得其他成本")
@PreAuthorize("@ss.hasPermission('heli:deliver-order:query')")
public CommonResult<List<PurchaseOrderDO>> getListqt(@RequestParam("id") Long id, @RequestParam("projectSubId") Long projectSubId ) {
List<PurchaseOrderDO> list =purchaseOrderService.getListqt(id,projectSubId);
return success(list);
}
}

View File

@ -285,6 +285,10 @@ public class ProjectOrderDO extends BaseDO {
private BigDecimal jiaGongShiCost;
@TableField(exist = false)
private BigDecimal biaoZhunJianCost;
@TableField(exist = false)
private BigDecimal qitaCost;
@TableField(exist = false)
private BigDecimal sumCost;
/**
* 变更的字段列表
* */

View File

@ -112,5 +112,24 @@ public class PurchaseOrderDO extends BaseDO {
private String supplierName;
@TableField(exist = false)
private String materialPlanNo;
@TableField(exist = false)
private String materialCode;
@TableField(exist = false)
private String materialName;
@TableField(exist = false)
private String materialType;
@TableField(exist = false)
private String materialSpec;
@TableField(exist = false)
private String unit;
@TableField(exist = false)
private String zanGuMoney;
@TableField(exist = false)
private String shiJiMoney;
@TableField(exist = false)
private BigDecimal caiGouMoney;
@TableField(exist = false)
private String amount;
@TableField(exist = false)
private String type;
}

View File

@ -15,6 +15,8 @@ import com.chanko.yunxi.mes.module.heli.enums.PurchaseStatusEnum;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import org.apache.ibatis.annotations.Mapper;
import com.chanko.yunxi.mes.module.heli.controller.admin.purchaseorder.vo.*;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.util.StringUtils;
/**
@ -88,6 +90,78 @@ public interface PurchaseOrderMapper extends BaseMapperX<PurchaseOrderDO> {
return selectPage(reqVO, query);
}
@Select("SELECT\n" +
" e.CODE AS materialCode,\n" +
" e.NAME AS materialName,\n" +
" e.material_type AS materialType,\n" +
" e.spec AS materialSpec,\n" +
" e.unit AS unit,\n" +
" ROUND( d.estimated_price,2) AS zanGuMoney,\n" +
" ROUND( COALESCE(d.actual_price, d.estimated_price),2) AS shiJiMoney,\n" +
" ROUND( COALESCE(d.purchase_amount * COALESCE(d.actual_price, d.estimated_price), 0),2) AS caiGouMoney,\n" +
" d.purchase_amount AS amount,\n" +
" 0 AS type \n" +
"FROM\n" +
" project_material_plan a\n" +
" left join project_plan_sub f on f.project_id=a.project_id\n"+
" LEFT JOIN project_material_plan_detail b ON b.project_material_plan_id = a.id and b.project_sub_id=f.id\n" +
" LEFT JOIN project_purchase_order c ON c.project_material_plan_id = a.id\n" +
" LEFT JOIN project_purchase_order_material d ON c.id = d.purchase_order_id \n" +
" AND b.material_id = d.material_id\n" +
" LEFT JOIN base_material e ON d.material_id = e.id \n" +
"WHERE\n" +
" a.tenant_id = 2 \n" +
" AND a.deleted = 0 \n" +
" AND b.tenant_id = 2 \n" +
" AND b.deleted = 0 \n" +
" AND c.tenant_id = 2 \n" +
" AND c.deleted = 0 \n" +
" AND d.tenant_id = 2 \n" +
" AND d.deleted = 0 \n" +
" AND e.tenant_id = 2 \n" +
" AND e.deleted = 0 \n" +
" AND f.tenant_id = 2 \n" +
" AND f.deleted = 0 \n" +
" AND a.project_id=#{id} \n" +
" and f.project_sub_id=#{projectSubId}\n" +
"GROUP BY\n" +
" d.id\n" +
"order by d.create_time desc")
List<PurchaseOrderDO> getMaterial(@Param("id") Long id,@Param("projectSubId") Long projectSubId);
@Select("SELECT\n" +
" d.boom_name AS materialName,\n" +
" d.boom_spec AS materialSpec,\n" +
" d.boom_unit AS unit,\n" +
" ROUND( d.estimated_price,2) AS zanGuMoney,\n" +
" ROUND( COALESCE(d.actual_price, d.estimated_price),2) AS shiJiMoney,\n" +
" ROUND( COALESCE(d.purchase_amount * COALESCE(d.actual_price, d.estimated_price), 0),2) AS caiGouMoney,\n" +
" d.purchase_amount AS amount,\n" +
" 1 AS type \n" +
"FROM\n" +
" project_material_plan a\n" +
" left join project_plan_sub e on e.project_id=a.project_id\n"+
" LEFT JOIN project_material_plan_boom b ON b.project_material_plan_id = a.id and b.project_plan_sub_id=e.id\n" +
" LEFT JOIN project_purchase_order c ON c.project_material_plan_id = a.id\n" +
" LEFT JOIN project_purchase_order_boom d ON c.id = d.purchase_order_id \n" +
" AND b.boom_detail_id = d.boom_detail_id\n" +
"WHERE\n" +
" a.tenant_id = 2 \n" +
" AND a.deleted = 0 \n" +
" AND b.tenant_id = 2 \n" +
" AND b.deleted = 0 \n" +
" AND c.tenant_id = 2 \n" +
" AND c.deleted = 0 \n" +
" AND d.tenant_id = 2 \n" +
" AND d.deleted = 0 \n" +
" AND e.tenant_id = 2 \n" +
" AND e.deleted = 0 \n" +
" AND a.project_id=#{id} \n" +
" and e.project_sub_id=#{projectSubId}\n" +
"GROUP BY\n" +
" d.id\n" +
"order by d.create_time desc")
List<PurchaseOrderDO> getBoom(@Param("id") Long id,@Param("projectSubId") Long projectSubId);
// default PageResult<PurchaseOrderDO> selectPage(PurchaseOrderPageReqVO reqVO) {
// return selectPage(reqVO, new LambdaQueryWrapperX<PurchaseOrderDO>()

View File

@ -89,7 +89,8 @@ public interface StorageMapper extends BaseMapperX<StorageDO> {
query.eq(StorageDO::getProjectNo,projectSubId)
.eq(StorageDO::getStockType,2)
.eq(StorageMatDO::getDeleted,0)
.eq(MaterialDO::getDeleted,0);
.eq(MaterialDO::getDeleted,0)
.ne(StorageDO::getStatus,3);
return selectList(query);
}
}

View File

@ -57,4 +57,10 @@ public interface PurchaseOrderService {
PageResult<PurchaseOrderDO> getPurchaseOrderPageWithTax(PurchaseOrderPageReqVO pageReqVO);
PageResult<PurchaseOrderDO> getPurchaseOrderPageByStatus(PurchaseOrderPageReqVO pageReqVO);
List<PurchaseOrderDO> getMaterial(Long id, Long projectSubId);
List<PurchaseOrderDO> getBoom(Long id, Long projectSubId);
List<PurchaseOrderDO> getListqt(Long id, Long projectSubId);
}

View File

@ -245,4 +245,22 @@ public class PurchaseOrderServiceImpl implements PurchaseOrderService {
}
return purchaseOrderMapper.selectPageByStatus(pageReqVO);
}
@Override
public List<PurchaseOrderDO> getMaterial(Long id, Long projectSubId) {
return purchaseOrderMapper.getMaterial(id,projectSubId);
}
@Override
public List<PurchaseOrderDO> getBoom(Long id, Long projectSubId) {
return purchaseOrderMapper.getBoom(id,projectSubId);
}
@Override
public List<PurchaseOrderDO> getListqt(Long id, Long projectSubId) {
List<PurchaseOrderDO> list = purchaseOrderMapper.getMaterial(id,projectSubId);
List<PurchaseOrderDO> list1 = purchaseOrderMapper.getBoom(id,projectSubId);
list.addAll(list1);
return list;
}
}

View File

@ -1,6 +1,7 @@
package com.chanko.yunxi.mes.module.system.controller.admin.user;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjectUtil;
import com.chanko.yunxi.mes.framework.common.enums.CommonStatusEnum;
import com.chanko.yunxi.mes.framework.common.pojo.CommonResult;
import com.chanko.yunxi.mes.framework.common.pojo.PageParam;
@ -121,6 +122,9 @@ public class UserController {
public CommonResult<UserRespVO> getUser(@RequestParam("id") Long id) {
AdminUserDO user = userService.getUser(id);
// 拼接数据
if (ObjectUtil.isEmpty(user)){
return success(null);
}
DeptDO dept = deptService.getDept(user.getDeptId());
return success(UserConvert.INSTANCE.convert(user, dept));
}

View File

@ -35,3 +35,7 @@ export const getListJg = async (id: number,projectSubId: number) => {
export const getList = async (id: number,projectSubId: number) => {
return await request.get({ url: `/heli/storage/getList?id=`+id+`&projectSubId=`+projectSubId })
}
//查询其他成本
export const getListqt = async (id: number,projectSubId: number) => {
return await request.get({ url: `/heli/purchase-order/getListqt?id=`+id+`&projectSubId=`+projectSubId })
}

View File

@ -602,7 +602,6 @@ const handleInitPlanSub = async () => {
})
formData.value.projectPlanSubs = (await PlanSubApi.getPlanSubPage(queryParams)).list
console.log( formData.value.projectPlanSubs)
// formData.value.projectOrderSubs.forEach((item) => {
// if (formData.value.projectPlanSubs.filter((sub) => sub.projectSubId == item.id).length > 0) {
// var subTemp = formData.value.projectPlanSubs.find((sub) => sub.projectSubId == item.id)

View File

@ -133,33 +133,34 @@
<div class="hl-card-info-icona"></div><span class="hl-card-info-text">其他材料成本</span>
</template>
<el-table v-loading="loading" :data="listqt" :stripe="true" :show-overflow-tooltip="true" border class="hl-table">
<el-table-column type="index" min-width="60" fixed label="序号" align="center" />
<el-table-column type="index" width="100" fixed label="序号" align="center" />
<el-table-column v-if="false" label="ID" align="center" prop="id" width="240px" />
<el-table-column label="物料编号" align="center" prop="materialCode" width="240px" />
<el-table-column label="物料名称" align="center" prop="materialName" width="240px"/>
<!-- <el-table-column label="物料类型" align="center" prop="materialType" width="240px">-->
<el-table-column label="物料类型" align="center" prop="materialType" width="240px">
<template #default="scope">
<dict-tag :type="DICT_TYPE.HELI_MATERIAL_TYPE" :value="scope.row.materialType" />
</template>
</el-table-column>
<el-table-column label="规格型号" align="center" prop="materialSpec" />
<el-table-column label="领料数量" align="center" prop="amount" />
<!-- <el-table-column label="系统单位" align="center" prop="unit" />-->
<el-table-column label="系统单位" align="center" prop="unit" width="240px">
<el-table-column v-if="false" label="ID" align="center" prop="id" width="240px" />
<el-table-column label="物料编号" align="center" prop="materialCode" width="200px" />
<el-table-column label="物料名称" align="center" prop="materialName" width="240px"/>
<!-- <el-table-column label="物料类型" align="center" prop="materialType" width="240px"/>-->
<el-table-column label="物料类型" align="center" prop="materialType" width="150px" >
<template #default="scope">
<dict-tag :type="DICT_TYPE.HELI_MATERIAL_TYPE" :value="scope.row.materialType" v-if="scope.row.type==0"/>
</template>
</el-table-column>
<el-table-column label="规格型号" align="center" prop="materialSpec" width="100"/>
<el-table-column label="领料数量" align="center" prop="amount" width="100"/>
<!-- <el-table-column label="系统单位" align="center" prop="unit" />-->
<el-table-column label="系统单位" align="center" prop="unit" width="100px">
<template #default="scope">
<dict-tag :type="DICT_TYPE.HELI_MATERIAL_UNIT" :value="scope.row.unit" />
</template>
</el-table-column>
<el-table-column label="平均采购价(暂估)" align="center" prop="zanGuMoney" />
<el-table-column label="平均采购价(实际)" align="center" >
<template v-slot="scope">
<el-input v-model="scope.row.shiJiMoney" />
</template>
</el-table-column>
<el-table-column label="采购金额(实际)" align="center" prop="caiGouMoney" />
<el-table-column label="平均采购价(暂估)" align="center" prop="zanGuMoney" width="200"/>
<el-table-column label="平均采购价(实际)" align="center" prop="shiJiMoney" width="200"/>
<!-- <el-table-column label="平均采购价(实际)" align="center" width="100">-->
<!-- <template v-slot="scope">-->
<!-- <el-input v-model="scope.row.shiJiMoney" />-->
<!-- </template>-->
<!-- </el-table-column>-->
<el-table-column label="采购金额(实际)" align="center" prop="caiGouMoney" width="200"/>
</el-table>
@ -332,9 +333,13 @@
listJg.value=listJgData
const listData = await SaleeOrderCost.getList(query.id,query.projectSubId)
list.value=listData
const listqtData = await SaleeOrderCost.getListqt(query.id,query.projectSubId)
listqt.value=listqtData
formData.value.yunFeiCost=0
formData.value.jiaGongShiCost=0
formData.value.biaoZhunJianCost=0
formData.value.qiTaCost=0
formData.value.yunFeiCost=0
if (listYf.value!=null){
listYf.value.map((item)=>{
formData.value.yunFeiCost+=item.yunFeiMoney
@ -350,6 +355,12 @@
formData.value.biaoZhunJianCost+=Number(item.caiGouMoney)
})
}
if (listqt.value!=null){
listqt.value.map((item)=>{
formData.value.qiTaCost+=Number(item.caiGouMoney)
})
}
formData.value.sumCost= parseFloat((formData.value.yunFeiCost+formData.value.jiaGongShiCost+ formData.value.biaoZhunJianCost+ formData.value.qiTaCost).toFixed(2))
})

View File

@ -67,22 +67,22 @@
<ContentWrap>
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true" border class="hl-table">
<el-table-column type="index" min-width="60" fixed label="序号" align="center" />
<el-table-column type="index" min-width="70" fixed label="序号" align="center" />
<el-table-column v-if="false" label="项目ID" align="center" prop="id" width="240px" />
<el-table-column label="项目编号" align="center" prop="code" width="240px" />
<el-table-column label="项目编号" align="center" prop="code" width="200px" />
<el-table-column label="项目名称" align="center" prop="projectName" width="240px"/>
<el-table-column label="客户全称" align="center" prop="customerName" width="240px"/>
<el-table-column label="子项目Id" v-if="false" align="center" prop="projectSubId" />
<el-table-column label="子项目名称" align="center" prop="projectSubName" />
<el-table-column label="标准件成本" align="center" prop="biaoZhunJianCost" />
<el-table-column label="其他成本" align="center" prop="yuanCaiLiaoCost" />
<el-table-column label="子项目名称" align="center" prop="projectSubName" width="200px"/>
<el-table-column label="标准件成本(元)" align="center" prop="biaoZhunJianCost" width="100px"/>
<el-table-column label="其他成本(元)" align="center" prop="qitaCost" width="100px"/>
<!-- <el-table-column label="副资材成本" align="center" prop="fuZiCaiCost" />-->
<!-- <el-table-column label="外协加工费用" align="center" prop="waiXieCost" />-->
<el-table-column label="加工工时换算成本" align="center" prop="jiaGongShiCost" />
<el-table-column label="运费成本" align="center" prop="yunFeiCost" />
<el-table-column label="合计成本" align="center" prop="sumCost" />
<el-table-column label="加工工时换算成本(元)" align="center" prop="jiaGongShiCost" width="100px"/>
<el-table-column label="运费成本(元)" align="center" prop="yunFeiCost" width="100px"/>
<el-table-column label="合计成本(元)" align="center" prop="sumCost" width="100px"/>
<el-table-column fixed="right" label="操作" align="center" width="150">