Bladeren bron

报损添加工序

yzc 1 jaar geleden
bovenliggende
commit
71b75857e8

+ 5 - 0
hx-mes/src/main/java/com/fjhx/mes/entity/report/dto/ReportLossesDetailsSelectDto.java

@@ -29,4 +29,9 @@ public class ReportLossesDetailsSelectDto extends BaseSelectDto {
      */
     private Long companyId;
 
+    /**
+     * 报损工序id
+     */
+    private Long processId;
+
 }

+ 5 - 0
hx-mes/src/main/java/com/fjhx/mes/entity/report/vo/ReportLossesDetailsVo.java

@@ -52,4 +52,9 @@ public class ReportLossesDetailsVo extends ReportLossesDetails {
      */
     private String companyName;
 
+    /**
+     * 报损工序id
+     */
+    private String processName;
+
 }

+ 14 - 1
hx-mes/src/main/java/com/fjhx/mes/service/report/impl/ReportLossesDetailsServiceImpl.java

@@ -37,6 +37,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.math.BigDecimal;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Objects;
@@ -108,6 +109,9 @@ public class ReportLossesDetailsServiceImpl extends ServiceImpl<ReportLossesDeta
         wrapper.in("rld", ReportLossesDetails::getCompanyId, SecurityUtils.getCompanyIds());
         wrapper.eq("rld", ReportLossesDetails::getCompanyId, dto.getCompanyId());
 
+        //工序id过滤
+        wrapper.eq("rld", ReportLossesDetails::getProcessId, dto.getProcessId());
+
 
         wrapper.groupBy("rld.id");
 
@@ -123,9 +127,18 @@ public class ReportLossesDetailsServiceImpl extends ServiceImpl<ReportLossesDeta
         List<Long> companyIds = records.stream().map(ReportLossesDetailsVo::getCompanyId).collect(Collectors.toList());
         Map<Long, String> companyNameMap = DeptUstil.getDeptNameMap(companyIds);
 
+        //获取工序信息
+        List<Long> ppIds = records.stream().map(ReportLossesDetails::getProcessId).collect(Collectors.toList());
+        Map<Long, String> ppMap = new HashMap<>();
+        if (ObjectUtil.isNotEmpty(ppIds)) {
+            ppMap = productionProcessesService.mapKV(ProductionProcesses::getId, ProductionProcesses::getName, q -> q.in(ProductionProcesses::getId, ppIds));
+        }
         for (ReportLossesDetailsVo record : records) {
             //赋值生产公司名称
             record.setCompanyName(companyNameMap.get(record.getCompanyId()));
+
+            //赋值工序名称
+            record.setProcessName(ppMap.get(record.getProcessId()));
         }
 
         //赋值产品信息
@@ -217,7 +230,7 @@ public class ReportLossesDetailsServiceImpl extends ServiceImpl<ReportLossesDeta
         stockWait.setBusinessId(dto.getId());
         stockWait.setStatus(0);
 
-        if (ObjectUtil.isEmpty(productionOrder)) {
+        if (ObjectUtil.isNotEmpty(productionOrder)) {
             stockWait.setBusinessCode(productionOrder.getCode());
         }
 

+ 2 - 1
hx-mes/src/main/resources/mapper/report/ReportLossesDetailsMapper.xml

@@ -15,7 +15,8 @@
                rld.update_time,
                po.`code`                  AS prodOrderCode,
                GROUP_CONCAT(su.nick_name) AS respUserName,
-               rld.repo_time
+               rld.repo_time,
+               rld.process_id
         FROM report_losses_details rld
                  LEFT JOIN production_order po ON rld.prod_order_id = po.id
                  LEFT JOIN sys_user su ON FIND_IN_SET(su.user_id, rld.resp_user_set)