|
|
|
|
@ -1,6 +1,8 @@ |
|
|
|
|
package org.springblade.desk.produce.service.impl; |
|
|
|
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil; |
|
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
|
import com.alibaba.nacos.common.utils.CollectionUtils; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
|
import jakarta.servlet.http.HttpServletRequest; |
|
|
|
|
@ -35,10 +37,19 @@ import org.springblade.desk.produce.pojo.vo.BindModelVO; |
|
|
|
|
import org.springblade.desk.produce.pojo.vo.LoadSubOrderVO; |
|
|
|
|
import org.springblade.desk.produce.pojo.vo.PdaProRelevantVO; |
|
|
|
|
import org.springblade.desk.produce.service.*; |
|
|
|
|
import org.springblade.desk.quality.pojo.entity.InspectionItem; |
|
|
|
|
import org.springblade.desk.quality.pojo.entity.InspectionTask; |
|
|
|
|
import org.springblade.desk.quality.pojo.entity.WorkPlanItem; |
|
|
|
|
import org.springblade.desk.quality.pojo.entity.WorkPlanItemDetail; |
|
|
|
|
import org.springblade.desk.quality.pojo.vo.InspectionTaskDetailVO; |
|
|
|
|
import org.springblade.desk.quality.pojo.vo.WorkPlanItemDetailVO; |
|
|
|
|
import org.springblade.desk.quality.pojo.vo.WorkPlanItemVO; |
|
|
|
|
import org.springblade.desk.quality.service.IInspectionItemService; |
|
|
|
|
import org.springblade.desk.quality.service.IInspectionTaskService; |
|
|
|
|
import org.springblade.desk.quality.service.IWorkPlanItemDetailService; |
|
|
|
|
import org.springblade.desk.quality.service.IWorkPlanItemService; |
|
|
|
|
import org.springblade.scheduling.pojo.entity.CraftAbilityEntity; |
|
|
|
|
import org.springframework.beans.BeanUtils; |
|
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
|
|
@ -97,6 +108,10 @@ public class PdaLoadServiceImpl extends BaseServiceImpl<WorkPlanMapper, WorkPlan |
|
|
|
|
|
|
|
|
|
private final IWorkPlanItemService workPlanItemService; |
|
|
|
|
|
|
|
|
|
private final IInspectionItemService inspectionItemService; |
|
|
|
|
|
|
|
|
|
private final IWorkPlanItemDetailService workPlanItemDetailService; |
|
|
|
|
|
|
|
|
|
// @Value("${request.device.prefixId}")
|
|
|
|
|
private String prefixId; |
|
|
|
|
|
|
|
|
|
@ -210,6 +225,7 @@ public class PdaLoadServiceImpl extends BaseServiceImpl<WorkPlanMapper, WorkPlan |
|
|
|
|
@Override |
|
|
|
|
public PdaProRelevantVO loadProTestWorkPlan(String cardNo) { |
|
|
|
|
WorkOrder prWorkOrder = this.checkPrWorkOrder(cardNo); |
|
|
|
|
YieldOrder yieldOrder = yieldOrderService.getById(prWorkOrder.getYoId()); |
|
|
|
|
WorkPlan prWorkPlan = this.getOne(Wrappers.lambdaQuery(WorkPlan.class).eq(WorkPlan::getId, prWorkOrder.getWpId())); |
|
|
|
|
List<Long> ppsId = new ArrayList<>(List.of(prWorkPlan.getPpsId())); |
|
|
|
|
WorkPlan frontWorkPlan = this.getById(prWorkPlan.getFrontWpId()); |
|
|
|
|
@ -221,6 +237,7 @@ public class PdaLoadServiceImpl extends BaseServiceImpl<WorkPlanMapper, WorkPlan |
|
|
|
|
// 将processSets根据主键ID转换为Map
|
|
|
|
|
Map<Long, BsProcessSetEntity> processSetMap = processSets.stream().collect(Collectors.toMap(BsProcessSetEntity::getId, processSet -> processSet)); |
|
|
|
|
BsTeamSetEntity teamSet = bsTeamSetService.getById(prWorkPlan.getSubsidiaryTeam() != null ? prWorkPlan.getSubsidiaryTeam() : prWorkPlan.getMakeTeam()); |
|
|
|
|
List<WorkPlanItemVO> wpItemList = workPlanItemService.listVOByWpIdAndItemName(prWorkPlan.getId(), "厚度检测"); |
|
|
|
|
PdaProRelevantVO jsonObj = PdaProRelevantVO.builder() |
|
|
|
|
.cardNo(cardNo) |
|
|
|
|
.woCode(prWorkOrder.getWoCode()) |
|
|
|
|
@ -233,7 +250,20 @@ public class PdaLoadServiceImpl extends BaseServiceImpl<WorkPlanMapper, WorkPlan |
|
|
|
|
.makeQty(prWorkOrder.getMakeQty()) |
|
|
|
|
.orders(prWorkPlan.getOrders()) |
|
|
|
|
.ppsName(processSetMap.get(prWorkPlan.getPpsId()).getName()) |
|
|
|
|
.makeTeam(teamSet.getTsName()).build(); |
|
|
|
|
.makeTeam(teamSet.getTsName()) |
|
|
|
|
.wpItemList(wpItemList) |
|
|
|
|
.material(part.getMaterial()) |
|
|
|
|
.prodIdent(yieldOrder.getProductIdent()) |
|
|
|
|
.platingInfo(part.getPlate()) |
|
|
|
|
.plateCode(part.getPlateCode()) |
|
|
|
|
.configCode(part.getConfigCode()) |
|
|
|
|
.build(); |
|
|
|
|
|
|
|
|
|
// orderInfo.material
|
|
|
|
|
// orderInfo.prodIdent
|
|
|
|
|
// orderInfo.platingInfo
|
|
|
|
|
// orderInfo.plateCode
|
|
|
|
|
// orderInfo.configCode
|
|
|
|
|
return jsonObj; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -367,14 +397,52 @@ public class PdaLoadServiceImpl extends BaseServiceImpl<WorkPlanMapper, WorkPlan |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
|
public boolean saveProCheck(InspectionTask inspectionTask) { |
|
|
|
|
public boolean saveProCheck(InspectionTaskDetailVO inspectionTask) { |
|
|
|
|
// InspectionTask inspectionTask = saveProCheckDTO.getInspectionTask();
|
|
|
|
|
inspectionTask.setReviewStatus((short) 0); |
|
|
|
|
if (inspectionTask.getId() == null) { |
|
|
|
|
inspectionTask.setCheckUserId(AuthUtil.getUserId()); |
|
|
|
|
inspectionTask.setCheckDate(LocalDateTime.now()); |
|
|
|
|
} |
|
|
|
|
if(inspectionTask.getWpId() != null){ |
|
|
|
|
WorkPlan workPlan = workPlanService.getById(inspectionTask.getWpId()); |
|
|
|
|
if(workPlan != null){ |
|
|
|
|
WorkOrder workOrder = workOrderService.getById(workPlan.getWoId()); |
|
|
|
|
if(workOrder != null){ |
|
|
|
|
inspectionTask.setWoId(workOrder.getId()); |
|
|
|
|
inspectionTask.setWoCode(workOrder.getWoCode()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
boolean save = inspectionTaskService.save(inspectionTask); |
|
|
|
|
if (CollectionUtils.isNotEmpty(inspectionTask.getWpItemList())) { |
|
|
|
|
List<InspectionItem> inspectionItems = inspectionItemService.list(); |
|
|
|
|
for (WorkPlanItemVO workPlanItemVO : inspectionTask.getWpItemList()) { |
|
|
|
|
WorkPlanItem workPlanItem = new WorkPlanItem(); |
|
|
|
|
BeanUtils.copyProperties(workPlanItemVO, workPlanItem); |
|
|
|
|
workPlanItem.setTaskId(inspectionTask.getId()); |
|
|
|
|
// 检验项目基础数据中项目名称匹配
|
|
|
|
|
for (InspectionItem inspectionItem : inspectionItems) { |
|
|
|
|
if (inspectionItem.getName().equals(workPlanItem.getItemName())) { |
|
|
|
|
workPlanItem.setItemId(inspectionItem.getId()); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
workPlanItemService.save(workPlanItem); |
|
|
|
|
if (CollectionUtils.isNotEmpty(workPlanItemVO.getWpItemDetailList())) { |
|
|
|
|
for (WorkPlanItemDetailVO wpItemDetailVO : workPlanItemVO.getWpItemDetailList()) { |
|
|
|
|
WorkPlanItemDetail wpItemDetail = new WorkPlanItemDetail(); |
|
|
|
|
BeanUtil.copyProperties(wpItemDetailVO, wpItemDetail); |
|
|
|
|
wpItemDetail.setWorkPlanItemId(workPlanItem.getId()); |
|
|
|
|
workPlanItemDetailService.save(wpItemDetail); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
// 不合格生成生产处置单
|
|
|
|
|
if (InspectionTask.CHECK_RESULT_NO.equals(inspectionTask.getCheckResult())) { |
|
|
|
|
inspectionTaskService.addRsSheet(inspectionTask.getId()); |
|
|
|
|
} |
|
|
|
|
// 保存镀后检验数据
|
|
|
|
|
// if (save) {
|
|
|
|
|
// WorkPlanItemVO workPlanItemVO = saveProCheckDTO.getWorkPlanItemVO();
|
|
|
|
|
@ -450,7 +518,7 @@ public class PdaLoadServiceImpl extends BaseServiceImpl<WorkPlanMapper, WorkPlan |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public Object getInspectionByEcCode(String code,Boolean flag, HttpServletRequest request) { |
|
|
|
|
public Object getInspectionByEcCode(String code, Boolean flag, HttpServletRequest request) { |
|
|
|
|
Long userId = AuthUtil.getUserId(); |
|
|
|
|
if (StringUtils.isBlank(code) || flag == null) { |
|
|
|
|
throw new RuntimeException("pda.dataFormat.incorrect", null); |
|
|
|
|
|