Bläddra i källkod

pda测试修改

k 2 år sedan
förälder
incheckning
f70ba6c7cc

+ 5 - 10
ruoyi-admin/src/main/java/com/ruoyi/web/controller/warewms/pda/PdaDocQcController.java

@@ -8,12 +8,10 @@ import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.enums.BusinessType;
 import com.ruoyi.common.utils.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 import java.util.List;
+import java.util.Map;
 
 /**
  * @author JWK
@@ -49,16 +47,13 @@ public class PdaDocQcController {
     /**
      * 质检提交
      *
-     * @param sku     产品代码
-     * @param batchNo 批号
-     * @param status  质量状态
+     * @param map
      * @return
      */
     @Log(title = "PDA质检提交(根据库存质检)", businessType = BusinessType.UPDATE)
     @PostMapping("/submit")
-    public AjaxResult qcSubmit(String sku, String batchNo, String status) {
-
-        return iDocQcHeaderService.qcSubmit(sku, batchNo, status);
+    public AjaxResult qcSubmit(@RequestBody Map<String, String> map) {
+        return iDocQcHeaderService.qcSubmit(map.get("sku"), map.get("batchNo"), map.get("status"));
     }
 
     /**

+ 10 - 5
warewms-ams/src/main/java/com/ruoyi/ams/business/BusinessServiceImpl.java

@@ -304,7 +304,7 @@ public class BusinessServiceImpl implements IBusinessService {
                     break;
                 }
                 if (locationInfo == null) {
-                    throw new ServiceException("没有可以分配的库位", token);
+                    throw new ServiceException("目标点没有可以分配的库位", token);
                 }
             }
         } else if (type.equals("SO")) {
@@ -317,11 +317,16 @@ public class BusinessServiceImpl implements IBusinessService {
                     if (!redisCache.lockCacheObject(RedisKey.LOCK_LOCATION + b.getId(), b.getId().toString(), token)) {
                         continue;
                     }
+                    // 判断起始库位上的库存质检状态是否可以出库
+                    boolean con = invLotLocIdService.verifyInventoryCanOutbound(b.getId().toString());
+                    if (!con) {
+                        continue;
+                    }
                     locationInfo = b;
                     break;
                 }
                 if (locationInfo == null) {
-                    throw new ServiceException("没有可以分配的库位", token);
+                    throw new ServiceException("起始点没有可以分配的库存!", token);
                 }
 
             } else { //目标库位
@@ -336,7 +341,7 @@ public class BusinessServiceImpl implements IBusinessService {
                     break;
                 }
                 if (locationInfo == null) {
-                    throw new ServiceException("没有可以分配的库位", token);
+                    throw new ServiceException("目标点没有可以分配的库位", token);
                 }
             }
         } else { //移库
@@ -355,7 +360,7 @@ public class BusinessServiceImpl implements IBusinessService {
 
                 //进行判断
                 if (locationInfo == null) {
-                    throw new ServiceException("没有可以分配的库位", token);
+                    throw new ServiceException("起始点没有可以分配的库位", token);
                 }
 
             } else {
@@ -372,7 +377,7 @@ public class BusinessServiceImpl implements IBusinessService {
 
                 //进行判断
                 if (locationInfo == null) {
-                    throw new ServiceException("没有可以分配的库位", token);
+                    throw new ServiceException("目标点没有可以分配的库位", token);
                 }
             }
         }

+ 7 - 0
warewms-ams/src/main/java/com/ruoyi/ams/inv/service/IInvLotLocIdService.java

@@ -275,4 +275,11 @@ public interface IInvLotLocIdService {
      * @return
      */
     AjaxResult saveOrUpdate(InvLotLocId invLotLocId);
+
+    /**
+     * 验证库存质检状态是否可出库
+     * @param locationId
+     * @return true 代表质检没有问题,可以出库
+     */
+    boolean verifyInventoryCanOutbound(String locationId);
 }

+ 8 - 0
warewms-ams/src/main/java/com/ruoyi/ams/inv/service/impl/InvLotLocIdServiceImpl.java

@@ -651,4 +651,12 @@ public class InvLotLocIdServiceImpl implements IInvLotLocIdService {
             throw new ServiceException("查询不到库存信息");
         }
     }
+
+    @Override
+    public boolean verifyInventoryCanOutbound(String locationNo) {
+        InvLocIdSearchFrom invLocIdSearchFrom = new InvLocIdSearchFrom();
+        invLocIdSearchFrom.setLocationNo(locationNo);
+        List<InvLotLocIdLotattVO> lotattVOList = selectInvLocIdLotattList(invLocIdSearchFrom);
+        return lotattVOList.stream().allMatch(v -> !v.getLotatt05().equals("DJ"));
+    }
 }

+ 4 - 6
warewms-ams/src/main/java/com/ruoyi/ams/qc/service/impl/DocQcHeaderServiceImpl.java

@@ -153,7 +153,7 @@ public class DocQcHeaderServiceImpl implements IDocQcHeaderService {
         List<InvLotLocIdLotattVO> qualityInspectionList = invLotLocIdMapper.getQualityInspectionList(sku);
         List<DocQcListVo> docQcListVoList = new ArrayList<>();
         qualityInspectionList.forEach(t -> {
-            docQcListVoList.add(new DocQcListVo(null,t.getSku(), t.getLotatt01()));
+            docQcListVoList.add(new DocQcListVo(null, t.getSku(), t.getLotatt01()));
         });
         return docQcListVoList;
     }
@@ -163,7 +163,7 @@ public class DocQcHeaderServiceImpl implements IDocQcHeaderService {
         List<InvLotLocIdLotattVO> invLotLocIdLotattVOList = invLotLocIdMapper.getQualityLocationListByLotNumber(lotNumber);
         List<DocQcListVo> docQcListVoList = new ArrayList<>();
         invLotLocIdLotattVOList.forEach(t -> {
-            docQcListVoList.add(new DocQcListVo(t.getLocationNo(), null,null));
+            docQcListVoList.add(new DocQcListVo(t.getLocationNo(), null, null));
         });
         return docQcListVoList;
     }
@@ -177,11 +177,9 @@ public class DocQcHeaderServiceImpl implements IDocQcHeaderService {
         }
 
         // 修改批号对应的库存质量状态
-        int i = invLotLocIdMapper.updateQualityStatusByLotNumber(sku, batchNo,status);
+        int i = invLotLocIdMapper.updateQualityStatusByLotNumber(sku, batchNo, status);
         successQuantity = i;
 
-        // todo 事务
-
-        return AjaxResult.success("操作成功!", successQuantity);
+        return AjaxResult.success(String.format("操作成功!修改了%d条!",successQuantity));
     }
 }

+ 4 - 9
warewms-ams/src/main/resources/mapper/ams/InvLotLocIdMapper.xml

@@ -334,24 +334,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="selectInvLocIdLotattList" resultMap="InvLotLocIdLotattResult">
         select
-        inv.location_id,sk.sku,sk.desc1 sku_name,skt.item_name sku_type_name,b.location_no,inv.qty,inv.qtyallocated
-        ,att.lotnum, att.customer_id,w.box_no,w.is_full,z.zone_name
-        ,lotatt01, lotatt02, lotatt03, lotatt04,lot05_dict.dict_label lotatt05, supp.supplier_name lotatt06
+        inv.*,
+        att.lotnum, att.customer_id,z.zone_name
+        ,lotatt01, lotatt02, lotatt03, lotatt04,lotatt05, lotatt06
         ,lotatt07, lotatt08, lotatt09, lotatt10, lotatt11, lotatt12, lotatt13, lotatt14, lotatt15, lotatt16, lotatt17
         ,lotatt18
         from inv_lot_loc_id inv
         left join inv_lot_att att on inv.lotnum = att.lotnum
         left join base_location_info b on inv.location_id = b.id
         left join base_location_zone z on b.zone_id = z.zone_id
-        left join base_sku sk on inv.sku = sk.sku
-        left join base_sku_type skt on sk.sku_type = skt.item_code
-        left join (select dict_label,dict_value from sys_dict_data where dict_type = 'ams_inv_quality') lot05_dict on att.lotatt05 = lot05_dict.dict_value
-        left join (select * from base_supplier) supp on att.lotatt06 = supp.supplier_id
-        left join wms_box_info w on inv.location_id = w.location_id
         <where>
             <if test="zoneId != null  and zoneId != ''"> and b.zone_id = #{zoneId}</if>
             <if test="sku != null  and sku != ''"> and (sk.sku like concat('%', #{sku}, '%') or sk.desc1 like concat('%', #{sku}, '%'))</if>
-            <if test="locationNo != null  and locationNo != ''"> and b.location_no like concat('%', #{locationNo}, '%')</if>
+            <if test="locationNo != null  and locationNo != ''"> and b.id = #{locationNo}</if>
             <if test="isFull != null  and isFull != ''"> and w.is_full = #{isFull}</if>
             <if test="lotattDTO != null">
                 <if test="lotattDTO.lotatt01 != null  and lotattDTO.lotatt01 != ''"> and att.lotatt01 = #{lotattDTO.lotatt01}</if>