Pārlūkot izejas kodu

新增盘点出入库

dfsfs 1 gadu atpakaļ
vecāks
revīzija
5156951518

+ 9 - 3
ruoyi-admin/src/main/java/com/ruoyi/web/controller/warewms/ams/QualityInspectionController.java

@@ -11,6 +11,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
 
+import javax.validation.Valid;
 import java.util.List;
 
 /**
@@ -24,18 +25,23 @@ public class QualityInspectionController extends BaseController {
     private IQualityInspectionService qualityInspectionService;
 
     /**
-     * 质检/放行(更新库存状态)--质量部
+     * 质检(更新库存质量状态)--质量部
      */
     @PreAuthorize("@ss.hasPermi('ams:qc:qualityInspection')")
     @PostMapping("/qualityInspection")
-    public AjaxResult list(@RequestBody QualityInspectionDTO qualityInspectionDTO) {
+    public AjaxResult list(@RequestBody @Valid QualityInspectionDTO qualityInspectionDTO) {
         qualityInspectionService.qualityInspection(qualityInspectionDTO);
         return AjaxResult.success();
     }
 
+    /**
+     * 放行(标记库存放行状态) --质量部
+     * @param qualityInspectionDTO
+     * @return
+     */
     @PreAuthorize("@ss.hasPermi('ams:qc:release')")
     @PostMapping("/release")
-    public AjaxResult release(@RequestBody QualityInspectionDTO qualityInspectionDTO) {
+    public AjaxResult release(@RequestBody @Valid QualityInspectionDTO qualityInspectionDTO) {
         qualityInspectionService.release(qualityInspectionDTO);
         return AjaxResult.success();
     }

+ 5 - 0
warewms-ams/src/main/java/com/ruoyi/ams/bionutrition/dto/QcIntoStorageDTO.java

@@ -37,6 +37,11 @@ public class QcIntoStorageDTO implements Serializable {
      */
     private String status;
 
+    /**
+     * 是否叫车 Y:叫车 N:不叫车
+     */
+    private String ifCallCar;
+
     private String user;
 
 }

+ 0 - 1
warewms-ams/src/main/java/com/ruoyi/ams/bionutrition/dto/QualityInspectionDTO.java

@@ -20,7 +20,6 @@ public class QualityInspectionDTO implements Serializable {
     /**
      * 起始点
      */
-    @NotBlank(message = "请选择起始点")
     private String locationFrom;
     /**
      * 物料编号

+ 1 - 0
warewms-ams/src/main/java/com/ruoyi/ams/bionutrition/pda/impl/PdaAgvCallServiceImpl.java

@@ -345,6 +345,7 @@ public class PdaAgvCallServiceImpl implements IPdaAgvCallService {
         lotattDTO.setLotatt09(docHeaderBaseDTO.getId());// 入库单头id
         lotattDTO.setLotatt10(docDetailsBaseDTO.getDocLineNo()); // 明细行号
         lotattDTO.setLotatt13(baseSku.getSkuSpecs()); // 产品规格
+        lotattDTO.setLotatt14(Constant.IS_YES.N.name()); // 库存批次放行状态,默认不放行
         return lotattDTO;
     }
 

+ 13 - 11
warewms-ams/src/main/java/com/ruoyi/ams/bionutrition/pda/impl/PdaDocQcServiceImpl.java

@@ -48,6 +48,7 @@ import java.math.BigDecimal;
 import java.util.Date;
 import java.util.List;
 import java.util.Map;
+import java.util.function.Function;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
 
@@ -175,7 +176,10 @@ public class PdaDocQcServiceImpl implements IPdaDocQcService {
         List<String> lotNumList = invLotAttList.stream().map(InvLotAtt::getLotnum).collect(Collectors.toList());
         List<InvLotLocId> invLotLocIds = invLotLocIdService.selectInvLotLocIdByLotnumList(lotNumList);
         // 5.根据lotatt02分组,计算同一批号的库存数量
-        List<String> lotNumListHasLoc = invLotLocIds.stream().map(InvLotLocId::getLotnum).distinct().collect(Collectors.toList());
+        // 过滤掉已经出库的库存
+        List<String> lotNumListHasLoc = invLotLocIds.stream()
+                .filter(invId -> !StringUtils.equals(invId.getLocationId(), Constant.LOC_SORTATION_FINISH.toString()))
+                .map(InvLotLocId::getLotnum).distinct().collect(Collectors.toList());
         // 过滤出有库存的且是合格状态的批次信息,然后按照批号分组
         Map<String, List<InvLotAtt>> invLotAttListMap = invLotAttList.stream()
                 .filter(item -> CollUtil.contains(lotNumListHasLoc, item.getLotnum()))
@@ -184,9 +188,7 @@ public class PdaDocQcServiceImpl implements IPdaDocQcService {
         // 找出分组后的每组批次对应的库存, 过滤掉所有已出库的库存
         Map<String, List<InvLotLocId>> invLotLocIdListMap = invLotAttListMap.entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey, item -> {
             List<String> lotNumGroupList = item.getValue().stream().map(InvLotAtt::getLotnum).collect(Collectors.toList());
-            return invLotLocIds.stream().filter(invId -> CollUtil.contains(lotNumGroupList, invId.getLotnum()))
-                    .filter(invId -> !StringUtils.equals(invId.getLocationId(), Constant.LOC_SORTATION_FINISH.toString()))
-                    .collect(Collectors.toList());
+            return invLotLocIds.stream().filter(invId -> CollUtil.contains(lotNumGroupList, invId.getLotnum())).collect(Collectors.toList());
         }));
         // 计算每组库存的所有数量
         Map<String, BigDecimal> lotNumQtyMap = invLotLocIdListMap.entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey, item -> {
@@ -239,12 +241,11 @@ public class PdaDocQcServiceImpl implements IPdaDocQcService {
         InvLotLocId invLotLocId = invLotLocIdService.selectInvLotLocIdByModel(invLotLocIdQuery);
         invLotLocId.setIfSample(Constant.IS_YES.Y.name());
         invLotLocIdService.updateInvLotLocId(invLotLocId);
-        // 2.生成移库任务
-        InvMoveDTO invMoveDTO = new InvMoveDTO();
-        invMoveDTO.setSourceLocationId(qcOutboundDTO.getLocationFrom());
-        invMoveDTO.setTargetLocationId(qcOutboundDTO.getLocationTo());
-        invMoveDTO.setUser(qcOutboundDTO.getUser());
-        invLotLocIdService.move(invMoveDTO, username);
+        // 2.需要叫车,生则成移库任务
+        if (StringUtils.equals(qcOutboundDTO.getIfCallCar(), Constant.IS_YES.Y.name())){
+            InvMoveDTO invMoveDTO = new InvMoveDTO(qcOutboundDTO.getLocationFrom(), qcOutboundDTO.getLocationTo(), qcOutboundDTO.getUser());
+            invLotLocIdService.move(invMoveDTO, username);
+        }
     }
 
     /**
@@ -267,7 +268,8 @@ public class PdaDocQcServiceImpl implements IPdaDocQcService {
         int updateINum = invLotLocIdService.updateInvLotLocId(invLotLocId);
         if (!(updateINum > 0)) throw new ServiceException("质检入库修改库存失败");
         log.info("质检入库修改库存完成:{}{}-------", qcIntoStorageDTO.getBatchNumber(), qcIntoStorageDTO.getStatus());
-        this.createQCIntoStorageTask(qcIntoStorageDTO, username, invLotLocId);
+        // 如果需要叫车,则创建搬运任务
+        if (StringUtils.equals(qcIntoStorageDTO.getIfCallCar(), Constant.IS_YES.Y.name())) this.createQCIntoStorageTask(qcIntoStorageDTO, username, invLotLocId);
 //        throw new ServiceException("mmm");
     }
 

+ 5 - 1
warewms-ams/src/main/java/com/ruoyi/ams/bionutrition/plc/service/impl/ProcessServiceImpl.java

@@ -64,14 +64,18 @@ public class ProcessServiceImpl implements ProcessService {
         AgvCallDTO agvCallDTO = new AgvCallDTO();
         AgvCallItemDTO agvCallItemDTO = new AgvCallItemDTO();
         agvCallItemDTO.setSku("EMPTY_TRAY"); // 空托
+        // 叠盘机放空托时,查询接驳区有空托的接驳位
         if (StringUtils.equals(taskType, "DPJ_IN")) {
             BaseLocationInfo baseLocationInfo = new BaseLocationInfo();
             baseLocationInfo.setUserdefine1("EMPTY_TRAY");
             List<BaseLocationInfo> baseLocationInfoList = baseLocationInfoService.selectBaseLocationInfoList(baseLocationInfo);
             Assert.isTrue(CollUtil.isNotEmpty(baseLocationInfoList), "未找到存在空托盘的接驳位");
-            agvCallItemDTO.setQty(8.0);// 拆盘机放整托,记录数量八个一托
             agvCallDTO.setLocationFrom(baseLocationInfoList.stream().findFirst().get().getId().toString());
+            // 将有空托标记去除
+            baseLocationInfo.setUserdefine1(null);
+            baseLocationInfoService.updateBaseLocationInfo(baseLocationInfo);
         }
+        if (StringUtils.equals(taskType, "CPJ_IN")) agvCallItemDTO.setQty(8.0);// 拆盘机放整托,记录数量八个一托
         agvCallItemDTOList.add(agvCallItemDTO);
         agvCallDTO.setLocationTo(locationTo.toString());
         agvCallDTO.setExtParam(taskType);

+ 4 - 0
warewms-ams/src/main/java/com/ruoyi/ams/bionutrition/qc/IQualityInspectionService.java

@@ -9,5 +9,9 @@ public interface IQualityInspectionService {
      */
     void qualityInspection(QualityInspectionDTO qualityInspectionDTO);
 
+    /**
+     * 标记库存放行状态
+     * @param qualityInspectionDTO
+     */
     void release(QualityInspectionDTO qualityInspectionDTO);
 }

+ 31 - 1
warewms-ams/src/main/java/com/ruoyi/ams/bionutrition/qc/QualityInspectionServiceImpl.java

@@ -79,6 +79,36 @@ public class QualityInspectionServiceImpl implements IQualityInspectionService {
      */
     @Override
     public void release(QualityInspectionDTO qualityInspectionDTO) {
-
+        // 更改批次状态
+        // 根据物料编码和批号查询批次信息
+        List<InvLotAtt> invLotAttList = invLotAttService.selectInvLotAttByBatchNum(qualityInspectionDTO.getBatchNumber(), qualityInspectionDTO.getSkuCode());
+        Assert.isTrue(CollUtil.isNotEmpty(invLotAttList), "所属批次信息未找到");
+        String lotNumNew = "";
+        for (InvLotAtt invLotAtt : invLotAttList) {
+            String lotnum = invLotAtt.getLotnum();
+            // 根据批次号查询库存信息
+            List<InvLotLocId> invLotLocIds = invLotLocIdService.selectInvLotLocIdByLotnum(lotnum);
+            // 如果没有对应的库存信息,遍历下一条批次数据 因为根据物料和批号会匹配到多条仅仅是质检状态不同批次数据
+            if (CollUtil.isEmpty(invLotLocIds)) continue;
+            invLotAtt.setLotatt14(qualityInspectionDTO.getLotatt14());// 设置是否放行标记
+            // 构建lotatt19属性
+            LotattDTO lotattDTO = new LotattDTO();
+            BeanUtils.copyProperties(invLotAtt, lotattDTO);
+            String lotatt19 = invLotLocIdService.buildLotatt19(lotattDTO);
+            // 判断是否存在相同批次的数据
+            InvLotAtt invLotAttSame = invLotAttService.selectInvLotAttByLotatt19(lotatt19);
+            lotNumNew = IdWorker.getIdStr();
+            if (ObjectUtil.isEmpty(invLotAttSame)){ // 没有相同批次的数据,就添加批次信息
+                // 更新批次号
+                invLotAtt.setLotnum(lotNumNew);
+                invLotAtt.setLotatt19(lotatt19);
+                invLotAtt.setCreateTime(DateUtils.getNowDate());
+                invLotAttService.insertInvLotAtt(invLotAtt);
+            }else {
+                lotNumNew = invLotAttSame.getLotnum();
+            }
+            // 修改库存表对应的批次号
+            invLotLocIdService.updateInvLotLocIdByLotNum(lotnum, lotNumNew);
+        }
     }
 }

+ 5 - 0
warewms-ams/src/main/java/com/ruoyi/ams/bionutrition/stock/dto/StockIntoWarehouseDTO.java

@@ -13,5 +13,10 @@ public class StockIntoWarehouseDTO implements Serializable {
 
     private String qty;
 
+    /**
+     * 是否叫车 Y:叫车 N:不叫车
+     */
+    private String ifCallCar;
+
     private String user;
 }

+ 5 - 0
warewms-ams/src/main/java/com/ruoyi/ams/bionutrition/stock/dto/StockOutOfWarehouseDTO.java

@@ -13,4 +13,9 @@ public class StockOutOfWarehouseDTO implements Serializable {
     private String user;
 
     private List<String> locationList;
+
+    /**
+     * 是否叫车 Y:叫车 N:不叫车
+     */
+    private String ifCallCar;
 }