瀏覽代碼

问题修改

zhs 2 年之前
父節點
當前提交
3d332ae273

+ 2 - 2
src/main/java/com/tld/mapper/WarehousingMapper.java

@@ -103,9 +103,9 @@ public interface WarehousingMapper {
 
     Map<String, Object> getScanIsNotProduct(Notice notice);
 
-    String getStorageLocationCode(@Param("attribute")String attribute, @Param("symbol")String symbol, @Param("producBatch")String producBatch);
+    String getStorageLocationCode(@Param("attribute")String attribute, @Param("symbol")String symbol, @Param("producBatch")String producBatch, @Param("materialId")String materialId);
 
-    int getCountStorage(@Param("attribute")String attribute, @Param("storageLocationCode")String storageLocationCode, @Param("symbol")String symbol, @Param("producBatch")String producBatch);
+    int getCountStorage(@Param("attribute")String attribute, @Param("storageLocationCode")String storageLocationCode, @Param("symbol")String symbol, @Param("producBatch")String producBatch, @Param("materialId")String materialId);
 
     void updateStorage(WarehousingVirtual warehousingVirtual1);
 

+ 4 - 0
src/main/java/com/tld/model/Delivery.java

@@ -119,4 +119,8 @@ public class Delivery implements Serializable {
      * 条数
      */
     private int limit;
+    /**
+     * 属性
+     */
+    private String attribute;
 }

+ 1 - 1
src/main/java/com/tld/service/impl/DeliveryServiceImpl.java

@@ -61,7 +61,7 @@ public class DeliveryServiceImpl implements DeliveryService {
                 for(Inventory inventory : deliveryMapper.getInventory(storageLocationCode, delivery)){
                     int occupy = deliveryMapper.getVitrual(inventory);
                     if(occupy == 0){
-                        if(Integer.parseInt(inventory.getAmount()) == Integer.getInteger(delivery.getOutNum())){
+                        if(inventory.getAmount().equals(delivery.getOutNum())){
                             list.add(inventory);
                             map.put("data", list);
                             map.put("msg", "200");

+ 23 - 8
src/main/java/com/tld/service/impl/WarehousingServiceImpl.java

@@ -379,6 +379,8 @@ public class WarehousingServiceImpl implements WarehousingService {
             } else {
                 warehousingMapper.addInventoryNotice(notice);
             }
+            notice.setType("1");
+            warehousingMapper.updateNotice(notice);//修改报工单数量
             //存入给gs的返回数据
             String storageCode = codeGenerateRk();
             //入库流水
@@ -551,6 +553,25 @@ public class WarehousingServiceImpl implements WarehousingService {
                 map.put("errMsg", "已被扫描");
                 return map;
             }
+            int num = 0;
+            if (notice.getType().equals("0")) {
+                num = warehousingMapper.getNumUtil("产成品库位托盘定义");
+            } else {
+                num = Integer.parseInt(material.getSize());
+            }
+            int scanNum = Integer.parseInt(mapVal.get("inventoryCount").toString()) + Integer.parseInt(mapVal.get("virtualCount").toString());
+            if(scanNum == num){
+                map.put("msg", "500");
+                map.put("errMsg", "库位已满");
+                return map;
+            }
+            Notice notice1 = warehousingMapper.getNoticeId(new Notice().setNoticeId(notice.getNoticeId()).setMaterialId(notice.getMaterialId()));
+            Double contrast = Double.parseDouble(notice1.getWarehousingNum()) + Double.parseDouble(notice.getNum());
+            if(Double.doubleToLongBits(contrast) > Double.doubleToLongBits(Double.parseDouble(notice1.getNum()))){
+                map.put("msg", "500");
+                map.put("errMsg", "扫描数量超出报工单数量");
+                return map;
+            }
             notice.setWllbClass(material.getWllbClass());
             StringBuffer stringBuffer = new StringBuffer();//库位编号
             if (material.getPartType().equals("产成品")) {
@@ -562,15 +583,9 @@ public class WarehousingServiceImpl implements WarehousingService {
                         if(symbol[i].equals("=")){
                             producBatch = notice.getProducBatch();
                         }
-                        String storageLocationCode = warehousingMapper.getStorageLocationCode(notice.getAttribute(), symbol[i], producBatch); //查询昨天没满的库位
+                        String storageLocationCode = warehousingMapper.getStorageLocationCode(notice.getAttribute(), symbol[i], producBatch, material.getTldId()); //查询昨天没满的库位
                         if(!storageLocationCode.equals("0")) {
-                            int countStorage = warehousingMapper.getCountStorage(notice.getAttribute(), storageLocationCode, symbol[i], producBatch);
-                            int num = 0;
-                            if (notice.getType().equals("0")) {
-                                num = warehousingMapper.getNumUtil("产成品库位托盘定义");
-                            } else {
-                                num = Integer.parseInt(material.getSize());
-                            }
+                            int countStorage = warehousingMapper.getCountStorage(notice.getAttribute(), storageLocationCode, symbol[i], producBatch, material.getTldId());
                             if (countStorage < num) {
                                 stringBuffer.append(storageLocationCode + ",");
                                 List<StorageLocation> list = warehousingMapper.recommend(stringBuffer.toString());

+ 7 - 15
src/main/resources/mapper/WarehousingMapper.xml

@@ -479,13 +479,6 @@
                                   produc_date, scrq, wllb_class, produc_batch, attribute, serial, supplier_id,
                                   wllb_code, totime)
             value (#{storageLocationCode},#{materialId},#{warehousingNum},'0','0',#{companyNumber},#{wbs},#{producBatch},now(),#{wllbClass},#{producBatch},#{attribute},#{serial},#{supplierId},#{wllbCode},now());
-        update tld_notice
-        set warehousing_num = #{warehousingNum}
-        <if test="type != null and type != ''">
-            ,type = '1'
-        </if>
-        where notice_id = #{noticeId}
-          and material_id = #{materialId}
     </insert>
     <!-- 查询库存里是否存在半成品虚拟库位 -->
     <select id="getInventoryNotice" resultType="int">
@@ -504,11 +497,6 @@
         where storage_location_code = #{storageLocationCode}
           and material_id = #{materialId}
           and wbs = #{wbs};
-        update tld_notice
-        set warehousing_num = #{warehousingNum},
-            type            = '1'
-        where notice_id = #{noticeId}
-          and material_id = #{materialId}
     </update>
     <!-- 半成品出库库存查询 -->
     <select id="getHalfInventory" resultType="com.tld.model.Inventory">
@@ -856,6 +844,9 @@
     <update id="updateNotice">
         update tld_notice
         set warehousing_num = (warehousing_num + 0) + #{warehousingNum}
+        <if test="type != null and type != ''">
+            ,type = '1'
+        </if>
         where notice_id = #{noticeId}
           and material_id = #{materialId}
     </update>
@@ -879,7 +870,7 @@
     <select id="getStorageLocationCode" resultType="String">
         SELECT ifnull(max(storage_location_code), "0")
         FROM tld_inventory
-        WHERE attribute = #{attribute} and scrq <![CDATA[${symbol}]]> CURDATE()
+        WHERE attribute = #{attribute} and DATE_FORMAT(scrq,'%Y-%m-%d') <![CDATA[${symbol}]]> CURDATE() and material_id = #{materialId}
         <if test="producBatch != null">
             and produc_batch = #{producBatch}
         </if>
@@ -890,9 +881,10 @@
         FROM tld_inventory
         where attribute = #{attribute}
           and storage_location_code = #{storageLocationCode}
-          and scrq <![CDATA[${symbol}]]> CURDATE()
+          and DATE_FORMAT(scrq,'%Y-%m-%d') <![CDATA[${symbol}]]> CURDATE()
+          and material_id = #{materialId}
         <if test="producBatch != null">
-            produc_batch = #{producBatch}
+            and produc_batch = #{producBatch}
         </if>
         ORDER BY scrq desc LIMIT 1
     </select>