加工成本

This commit is contained in:
z 2025-03-04 16:06:49 +08:00
parent a4bfed1ad2
commit 5e585c5c74
14 changed files with 232 additions and 139 deletions

View File

@ -14,12 +14,14 @@ 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.taskdispatch.TaskDispatchDO;
import com.chanko.yunxi.mes.module.heli.dal.mysql.orderys.OrderYsMapper;
import com.chanko.yunxi.mes.module.heli.enums.BusinesTypeEnum;
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.taskdispatch.TaskDispatchService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
@ -61,6 +63,8 @@ public class ProjectOrderController {
private OrderYsService orderYsService;
@Resource
private DeliverOrderService deliverOrderService;
@Resource
private TaskDispatchService taskDispatchService;
@PostMapping("/create")
@Operation(summary = "创建项目订单")
@PreAuthorize("@ss.hasPermission('heli:project-order:create')")
@ -150,6 +154,13 @@ public class ProjectOrderController {
.reduce(BigDecimal.ZERO, BigDecimal::add);
projectOrderDO.setYunFeiCost(totalAmount);
}
List<TaskDispatchDO> list= taskDispatchService.getListJg(projectOrderDO.getId(),projectOrderDO.getProjectSubId());
if (list!=null&&list.size()>0){
BigDecimal totalAmount = list.stream()
.map(TaskDispatchDO -> TaskDispatchDO.getZanGuMoney() != null ?new BigDecimal(TaskDispatchDO.getZanGuMoney()) : BigDecimal.ZERO)
.reduce(BigDecimal.ZERO, BigDecimal::add);
projectOrderDO.setJiaGongShiCost(totalAmount);
}
}
return success(BeanUtils.toBean(pageResult, ProjectOrderCostRespVO.class));
}

View File

@ -12,6 +12,7 @@ import com.chanko.yunxi.mes.module.heli.controller.admin.taskdispatch.vo.*;
import com.chanko.yunxi.mes.module.heli.dal.dataobject.fpuser.FpUserDO;
import com.chanko.yunxi.mes.module.heli.dal.dataobject.taskdispatch.TaskDispatchDO;
import com.chanko.yunxi.mes.module.heli.dal.dataobject.taskdispatch.TaskDispatchDetailDO;
import com.chanko.yunxi.mes.module.heli.dal.dataobject.taskreport.TaskReportDO;
import com.chanko.yunxi.mes.module.heli.dal.mysql.fpuserdetail.FpUserDetailMapper;
import com.chanko.yunxi.mes.module.heli.enums.BusinesTypeEnum;
import com.chanko.yunxi.mes.module.heli.service.taskdispatch.TaskDispatchService;
@ -209,4 +210,11 @@ public class TaskDispatchController {
List<HashMap<String, String>> owner = taskDispatchService.getOwner(id, type);
return success(owner);
}
@GetMapping("/getListJg")
@Operation(summary = "获得加工工时成本")
@PreAuthorize("@ss.hasPermission('heli:deliver-order:query')")
public CommonResult<List<TaskDispatchDO>> getListJg(@RequestParam("id") Long id, @RequestParam("projectSubId") Long projectSubId ) {
List<TaskDispatchDO> list= taskDispatchService.getListJg(id,projectSubId);
return success( list);
}
}

View File

@ -9,6 +9,7 @@ import com.chanko.yunxi.mes.framework.operatelog.core.annotations.OperateLog;
import com.chanko.yunxi.mes.module.heli.controller.admin.taskreport.vo.TaskReportPageReqVO;
import com.chanko.yunxi.mes.module.heli.controller.admin.taskreport.vo.TaskReportRespVO;
import com.chanko.yunxi.mes.module.heli.controller.admin.taskreport.vo.TaskReportSaveReqVO;
import com.chanko.yunxi.mes.module.heli.dal.dataobject.deliverorder.DeliverOrderDO;
import com.chanko.yunxi.mes.module.heli.dal.dataobject.taskreport.TaskReportDO;
import com.chanko.yunxi.mes.module.heli.service.taskreport.TaskReportService;
import io.swagger.v3.oas.annotations.Operation;
@ -90,4 +91,5 @@ public class TaskReportController {
BeanUtils.toBean(list, TaskReportRespVO.class));
}
}

View File

@ -281,6 +281,8 @@ public class ProjectOrderDO extends BaseDO {
* */
@TableField(exist = false)
private BigDecimal yunFeiCost;
@TableField(exist = false)
private BigDecimal jiaGongShiCost;
/**
* 变更的字段列表
* */

View File

@ -9,6 +9,7 @@ import com.chanko.yunxi.mes.framework.operatelog.core.enums.OperateTypeEnum;
import com.chanko.yunxi.mes.module.heli.enums.TaskDispatchStatusEnum;
import lombok.*;
import java.math.BigDecimal;
import java.time.LocalDateTime;
/**
@ -104,6 +105,16 @@ public class TaskDispatchDO extends BaseDO {
@TableField(exist = false)
private String materialName;
@TableField(exist = false)
private String materialType;
@TableField(exist = false)
private String shiJiMoney;
@TableField(exist = false)
private String zanGuMoney;
@TableField(exist = false)
private Long compositionId;

View File

@ -49,7 +49,8 @@ public interface ProjectOrderMapper extends BaseMapperX<ProjectOrderDO> {
.like(!StringUtils.isEmpty(reqVO.getCustomerName()),"b.name",reqVO.getCustomerName())
.like(!StringUtils.isEmpty(reqVO.getProjectSubName()),"a.name",reqVO.getProjectSubName())
.eq(ProjectOrderDO::getOrderStatus,32)
.in(ProjectOrderDO::getIsSnapshot,0);
.in(ProjectOrderDO::getIsSnapshot,0)
.orderByDesc(ProjectOrderDO::getCreateTime);
;
return selectPage(reqVO, query);
}

View File

@ -8,12 +8,17 @@ import com.chanko.yunxi.mes.module.heli.dal.dataobject.customer.CustomerDO;
import com.chanko.yunxi.mes.module.heli.dal.dataobject.plan.PlanDO;
import com.chanko.yunxi.mes.module.heli.dal.dataobject.plantask.PlanTaskDO;
import com.chanko.yunxi.mes.module.heli.dal.dataobject.plantaskbom.PlanTaskBomDO;
import com.chanko.yunxi.mes.module.heli.dal.dataobject.procedure.ProcedureDO;
import com.chanko.yunxi.mes.module.heli.dal.dataobject.processbom.ProcessBomDetailDO;
import com.chanko.yunxi.mes.module.heli.dal.dataobject.processdesign.ProcessDesignDO;
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.taskdispatch.TaskDispatchDO;
import com.chanko.yunxi.mes.module.heli.dal.dataobject.taskdispatch.TaskDispatchDetailDO;
import com.chanko.yunxi.mes.module.heli.dal.dataobject.taskreport.TaskReportDO;
import com.chanko.yunxi.mes.module.heli.enums.TaskDispatchTypeEnum;
import com.chanko.yunxi.mes.module.system.dal.dataobject.dept.PostDO;
import com.chanko.yunxi.mes.module.system.dal.dataobject.dept.UserPostDO;
import com.chanko.yunxi.mes.module.system.dal.dataobject.user.AdminUserDO;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import org.apache.ibatis.annotations.Mapper;
@ -152,4 +157,24 @@ public interface TaskDispatchMapper extends BaseMapperX<TaskDispatchDO> {
return selectOne(query);
}
default List<TaskDispatchDO> getListJg(Long id, Long projectSubId){
MPJLambdaWrapper<TaskDispatchDO> query = new MPJLambdaWrapper<>();
query.selectAll(TaskDispatchDO.class)
.select("z.name as materialName", "z.procedure_type as materialType", "SUM(COALESCE(d.work_time, 0)) as amount")
.select("p.grade_cost as shiJiMoney")
.select(" ROUND(SUM(COALESCE(d.work_time, 0)) * p.grade_cost, 2) as zanGuMoney")
.leftJoin(TaskDispatchDetailDO.class, "x", TaskDispatchDetailDO::getDispatchId,TaskDispatchDO::getId)
.leftJoin(ProcedureDO.class, "z", ProcedureDO::getId, TaskDispatchDetailDO::getProcedureId)
.leftJoin(TaskReportDO.class, "d", TaskReportDO::getDispatchDetailId,TaskDispatchDetailDO::getId)
.leftJoin(UserPostDO.class, "c", UserPostDO::getUserId, TaskReportDO::getOwner)
.leftJoin(PostDO.class,"p", PostDO::getId,UserPostDO::getPostId)
.groupBy(TaskDispatchDetailDO::getId)
.orderByDesc(TaskDispatchDO::getCreateTime)
.disableSubLogicDel();
query.eq( TaskDispatchDO::getProjectId, id)
.eq(TaskDispatchDO::getProjectSubId,projectSubId)
.eq(TaskReportDO::getHasReport, 1);
return selectList(query);
}
}

View File

@ -10,6 +10,8 @@ import com.chanko.yunxi.mes.module.heli.dal.dataobject.projectorder.ProjectOrder
import com.chanko.yunxi.mes.module.heli.dal.dataobject.taskdispatch.TaskDispatchDO;
import com.chanko.yunxi.mes.module.heli.dal.dataobject.taskdispatch.TaskDispatchDetailDO;
import com.chanko.yunxi.mes.module.heli.dal.dataobject.taskreport.TaskReportDO;
import com.chanko.yunxi.mes.module.system.dal.dataobject.dept.PostDO;
import com.chanko.yunxi.mes.module.system.dal.dataobject.dept.UserPostDO;
import com.chanko.yunxi.mes.module.system.dal.dataobject.user.AdminUserDO;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import org.apache.ibatis.annotations.Mapper;
@ -27,6 +29,7 @@ import java.util.List;
@Mapper
public interface TaskReportMapper extends BaseMapperX<TaskReportDO> {
default PageResult<TaskReportDO> selectPage(TaskReportPageReqVO reqVO) {
MPJLambdaWrapper<TaskReportDO> query = new MPJLambdaWrapper<>();
query.selectAll(TaskReportDO.class)
@ -68,4 +71,6 @@ public interface TaskReportMapper extends BaseMapperX<TaskReportDO> {
query1.eq(TaskReportDO::getDispatchDetailId,dispatchDetailId);
return selectCount(query1);
}
}

View File

@ -5,6 +5,7 @@ import com.chanko.yunxi.mes.module.heli.controller.admin.taskdispatch.vo.*;
import com.chanko.yunxi.mes.module.heli.controller.admin.ygjx.vo.YgjxPageReqVO;
import com.chanko.yunxi.mes.module.heli.dal.dataobject.taskdispatch.TaskDispatchDO;
import com.chanko.yunxi.mes.module.heli.dal.dataobject.taskdispatch.TaskDispatchDetailDO;
import com.chanko.yunxi.mes.module.heli.dal.dataobject.taskreport.TaskReportDO;
import javax.validation.Valid;
import java.util.HashMap;
@ -90,4 +91,6 @@ public interface TaskDispatchService {
List<HashMap<String,String>> getOwner(Long id,Long type);
boolean judgeHasOver(Long id);
List<TaskDispatchDO> getListJg(Long id, Long projectSubId);
}

View File

@ -633,6 +633,12 @@ public class TaskDispatchServiceImpl implements TaskDispatchService {
public boolean judgeHasOver(Long id){
return taskDispatchDetailMapper.judgeHasOver(id);
}
@Override
public List<TaskDispatchDO> getListJg(Long id, Long projectSubId) {
return taskDispatchMapper.getListJg(id,projectSubId);
}
private void createTaskDispatchDetailList(Long dispatchId, List<TaskDispatchDetailDO> list) {
list.forEach(o -> o.setDispatchId(dispatchId));
// 分组更新与插入

View File

@ -1,55 +1,55 @@
package com.chanko.yunxi.mes.module.heli.service.taskreport;
import java.util.*;
import javax.validation.*;
import com.chanko.yunxi.mes.module.heli.controller.admin.taskreport.vo.*;
import com.chanko.yunxi.mes.module.heli.dal.dataobject.taskreport.TaskReportDO;
import com.chanko.yunxi.mes.framework.common.pojo.PageResult;
import com.chanko.yunxi.mes.framework.common.pojo.PageParam;
/**
* 任务报工 Service 接口
*
* @author 管理员
*/
public interface TaskReportService {
/**
* 创建任务报工
*
* @param createReqVO 创建信息
* @return 编号
*/
Long createTaskReport(@Valid TaskReportSaveReqVO createReqVO);
/**
* 更新任务报工
*
* @param updateReqVO 更新信息
*/
void updateTaskReport(@Valid TaskReportSaveReqVO updateReqVO);
/**
* 删除任务报工
*
* @param id 编号
*/
void deleteTaskReport(Long id);
/**
* 获得任务报工
*
* @param id 编号
* @return 任务报工
*/
TaskReportDO getTaskReport(Long id);
/**
* 获得任务报工分页
*
* @param pageReqVO 分页查询
* @return 任务报工分页
*/
PageResult<TaskReportDO> getTaskReportPage(TaskReportPageReqVO pageReqVO);
}
package com.chanko.yunxi.mes.module.heli.service.taskreport;
import java.util.*;
import javax.validation.*;
import com.chanko.yunxi.mes.module.heli.controller.admin.taskreport.vo.*;
import com.chanko.yunxi.mes.module.heli.dal.dataobject.taskreport.TaskReportDO;
import com.chanko.yunxi.mes.framework.common.pojo.PageResult;
import com.chanko.yunxi.mes.framework.common.pojo.PageParam;
/**
* 任务报工 Service 接口
*
* @author 管理员
*/
public interface TaskReportService {
/**
* 创建任务报工
*
* @param createReqVO 创建信息
* @return 编号
*/
Long createTaskReport(@Valid TaskReportSaveReqVO createReqVO);
/**
* 更新任务报工
*
* @param updateReqVO 更新信息
*/
void updateTaskReport(@Valid TaskReportSaveReqVO updateReqVO);
/**
* 删除任务报工
*
* @param id 编号
*/
void deleteTaskReport(Long id);
/**
* 获得任务报工
*
* @param id 编号
* @return 任务报工
*/
TaskReportDO getTaskReport(Long id);
/**
* 获得任务报工分页
*
* @param pageReqVO 分页查询
* @return 任务报工分页
*/
PageResult<TaskReportDO> getTaskReportPage(TaskReportPageReqVO pageReqVO);
}

View File

@ -1,74 +1,76 @@
package com.chanko.yunxi.mes.module.heli.service.taskreport;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
import com.chanko.yunxi.mes.module.heli.controller.admin.taskreport.vo.*;
import com.chanko.yunxi.mes.module.heli.dal.dataobject.taskreport.TaskReportDO;
import com.chanko.yunxi.mes.framework.common.pojo.PageResult;
import com.chanko.yunxi.mes.framework.common.pojo.PageParam;
import com.chanko.yunxi.mes.framework.common.util.object.BeanUtils;
import com.chanko.yunxi.mes.module.heli.dal.mysql.taskreport.TaskReportMapper;
import static com.chanko.yunxi.mes.framework.common.exception.util.ServiceExceptionUtil.exception;
import static com.chanko.yunxi.mes.module.heli.enums.ErrorCodeConstants.*;
/**
* 任务报工 Service 实现类
*
* @author 管理员
*/
@Service
@Validated
public class TaskReportServiceImpl implements TaskReportService {
@Resource
private TaskReportMapper taskReportMapper;
@Override
public Long createTaskReport(TaskReportSaveReqVO createReqVO) {
// 插入
TaskReportDO taskReport = BeanUtils.toBean(createReqVO, TaskReportDO.class);
taskReportMapper.insert(taskReport);
// 返回
return taskReport.getId();
}
@Override
public void updateTaskReport(TaskReportSaveReqVO updateReqVO) {
// 校验存在
validateTaskReportExists(updateReqVO.getId());
// 更新
TaskReportDO updateObj = BeanUtils.toBean(updateReqVO, TaskReportDO.class);
taskReportMapper.updateById(updateObj);
}
@Override
public void deleteTaskReport(Long id) {
// 校验存在
validateTaskReportExists(id);
// 删除
taskReportMapper.deleteById(id);
}
private void validateTaskReportExists(Long id) {
if (taskReportMapper.selectById(id) == null) {
throw exception(TASK_REPORT_NOT_EXISTS);
}
}
@Override
public TaskReportDO getTaskReport(Long id) {
return taskReportMapper.selectById(id);
}
@Override
public PageResult<TaskReportDO> getTaskReportPage(TaskReportPageReqVO pageReqVO) {
return taskReportMapper.selectPage(pageReqVO);
}
}
package com.chanko.yunxi.mes.module.heli.service.taskreport;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
import com.chanko.yunxi.mes.module.heli.controller.admin.taskreport.vo.*;
import com.chanko.yunxi.mes.module.heli.dal.dataobject.taskreport.TaskReportDO;
import com.chanko.yunxi.mes.framework.common.pojo.PageResult;
import com.chanko.yunxi.mes.framework.common.pojo.PageParam;
import com.chanko.yunxi.mes.framework.common.util.object.BeanUtils;
import com.chanko.yunxi.mes.module.heli.dal.mysql.taskreport.TaskReportMapper;
import static com.chanko.yunxi.mes.framework.common.exception.util.ServiceExceptionUtil.exception;
import static com.chanko.yunxi.mes.module.heli.enums.ErrorCodeConstants.*;
/**
* 任务报工 Service 实现类
*
* @author 管理员
*/
@Service
@Validated
public class TaskReportServiceImpl implements TaskReportService {
@Resource
private TaskReportMapper taskReportMapper;
@Override
public Long createTaskReport(TaskReportSaveReqVO createReqVO) {
// 插入
TaskReportDO taskReport = BeanUtils.toBean(createReqVO, TaskReportDO.class);
taskReportMapper.insert(taskReport);
// 返回
return taskReport.getId();
}
@Override
public void updateTaskReport(TaskReportSaveReqVO updateReqVO) {
// 校验存在
validateTaskReportExists(updateReqVO.getId());
// 更新
TaskReportDO updateObj = BeanUtils.toBean(updateReqVO, TaskReportDO.class);
taskReportMapper.updateById(updateObj);
}
@Override
public void deleteTaskReport(Long id) {
// 校验存在
validateTaskReportExists(id);
// 删除
taskReportMapper.deleteById(id);
}
private void validateTaskReportExists(Long id) {
if (taskReportMapper.selectById(id) == null) {
throw exception(TASK_REPORT_NOT_EXISTS);
}
}
@Override
public TaskReportDO getTaskReport(Long id) {
return taskReportMapper.selectById(id);
}
@Override
public PageResult<TaskReportDO> getTaskReportPage(TaskReportPageReqVO pageReqVO) {
return taskReportMapper.selectPage(pageReqVO);
}
}

View File

@ -27,3 +27,7 @@ export const getPlanCost = async (id: number,projectSubId: number) => {
export const getListYf = async (id: number,projectSubId: number) => {
return await request.get({ url: `/heli/deliver-order/getListYf?id=`+id+`&projectSubId=`+projectSubId })
}
//查询加工工时成本
export const getListJg = async (id: number,projectSubId: number) => {
return await request.get({ url: `/heli/task-dispatch/getListJg?id=`+id+`&projectSubId=`+projectSubId })
}

View File

@ -200,13 +200,13 @@
<el-table-column type="index" min-width="60" 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="materialName" width="240px"/>
<el-table-column label="工序类型" align="center" prop="materialType" />
<el-table-column label="工序类型" align="center" prop="materialType" >
<template #default="scope">
<dict-tag :type="DICT_TYPE.HELI_PROCEDURE_TYPE" :value="scope.row.materialType" />
</template>
</el-table-column>
<el-table-column label="总加工工时" align="center" prop="amount" />
<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="shiJiMoney"/>
<el-table-column label="加工费用" align="center" prop="zanGuMoney" />
@ -260,6 +260,8 @@
import * as SaleeOrderCost from '@/api/heli/saleordercost'
import {dateFormatter2} from "@/utils/formatTime";
import {DICT_TYPE} from "@/utils/dict";
import {number} from "vue-types";
const { t } = useI18n() //
const message = useMessage() //
const { query } = useRoute()
@ -306,13 +308,24 @@
//
const listYfData = await SaleeOrderCost.getListYf(query.id,query.projectSubId)
listYf.value=listYfData
const listJgData = await SaleeOrderCost.getListJg(query.id,query.projectSubId)
listJg.value=listJgData
formData.value.yunFeiCost=0
listYf.value.map((item)=>{
formData.value.yunFeiCost+=item.yunFeiMoney
})
formData.value.jiaGongShiCost=0
if (listYf.value!=null){
listYf.value.map((item)=>{
formData.value.yunFeiCost+=item.yunFeiMoney
})
}
if (listJg.value!=null){
listJg.value.map((item)=>{
formData.value.jiaGongShiCost+=Number(item.zanGuMoney)
})
}
})
</script>
<style>