zhs преди 2 години
родител
ревизия
2bcc5b3fd1

+ 2 - 2
src/main/java/com/tld/controller/WarehousingController.java

@@ -29,8 +29,8 @@ public class WarehousingController {
      * @return 返回结果
      */
     @GetMapping("getRecommend")
-    public Map<String, Object> getRecommend(String wllbCode, String suppId, String num, String unique, String producDate, String warehouseWhere){
-        return warehousingService.getRecommend(wllbCode, suppId, num, unique, producDate, warehouseWhere);
+    public Map<String, Object> getRecommend(String wllbCode, String suppId, String num, String unique, String producDate, String warehouseWhere, String wbs, String accountSleeve){
+        return warehousingService.getRecommend(wllbCode, suppId, num, unique, producDate, warehouseWhere, wbs, accountSleeve);
     }
 
     /**

+ 1 - 1
src/main/java/com/tld/mapper/AskGoodsMapper.java

@@ -146,7 +146,7 @@ public interface AskGoodsMapper {
 
     String getAmount(AskGoods goods);
 
-    void updateRemoval(String removalCode);
+    void updateRemoval(@Param("removalCode")String removalCode, @Param("material")String material);
 
     void updateRemovalHalfProduct(String wmsCode);
 

+ 1 - 1
src/main/java/com/tld/mapper/QueryListMapper.java

@@ -58,7 +58,7 @@ public interface QueryListMapper {
 
     List<Notice> getOtherReceivingGoods(Notice notice);
 
-    void updateType(@Param("wmsCode") String wmsCode, @Param("type") int type);
+    void updateType(@Param("wmsCode") String wmsCode, @Param("type") int type, @Param("code") String code);
 
     List<AskGoods> getOtherShipments(AskGoods askGoods);
 }

+ 3 - 1
src/main/java/com/tld/mapper/WarehousingMapper.java

@@ -55,7 +55,7 @@ public interface WarehousingMapper {
 
     MaterialClass getMateriaIsExist(String wllbCode);
 
-    List<String> getInventoryProduc(@Param("wllbCode")String wllbCode, @Param("producDate")String producDate, @Param("storageLocationCode")String storageLocationCode);
+    List<Map<String, Object>> getInventoryProduc(@Param("wllbCode")String wllbCode, @Param("producDate")String producDate, @Param("storageLocationCode")String storageLocationCode, @Param("wbs")String wbs, @Param("accountSleeve")String accountSleeve);
 
     List<Notice> getNotice(Notice notice);
 
@@ -126,4 +126,6 @@ public interface WarehousingMapper {
     void updateWarehousingType(@Param("storageCode")String storageCode, @Param("type")int type);
 
     Notice getNotices(Inventory inventory);
+
+    void updateNoticesWarehousingNum(Inventory inventory);
 }

+ 1 - 1
src/main/java/com/tld/service/WarehousingService.java

@@ -7,7 +7,7 @@ import javax.servlet.http.HttpServletResponse;
 import java.util.Map;
 
 public interface WarehousingService {
-    Map<String, Object> getRecommend(String wllbCode, String suppId, String num, String unique, String producDate, String warehouseWhere);
+    Map<String, Object> getRecommend(String wllbCode, String suppId, String num, String unique, String producDate, String warehouseWhere, String wbs, String accountSleeve);
 
     Map<String, Object> addWarehousingVirtual(WarehousingVirtual warehousingVirtual);
 

+ 16 - 7
src/main/java/com/tld/service/impl/AskGoodsServiceImpl.java

@@ -348,7 +348,7 @@ public class AskGoodsServiceImpl implements AskGoodsService {
                 error.setDataVal(returnData.toJSONString()).setType("出库回传");
                 //修改流水传输状态
                 for(Map<String, Object> map : askGoodsMapper.plugOutRemoval(removalCode)){
-                    askGoodsMapper.updateRemoval(map.get("removalCode").toString());
+                    askGoodsMapper.updateRemoval(map.get("removalCode").toString(), null);
                 }
                 errorMapper.addError(error);
             }else {
@@ -362,10 +362,10 @@ public class AskGoodsServiceImpl implements AskGoodsService {
                     errorMapper.addError(error);
                     //修改流水传输状态
                     for(Map<String, Object> map : askGoodsMapper.plugOutRemoval(removalCode)){
-                        askGoodsMapper.updateRemoval(map.get("removalCode").toString());
+                        askGoodsMapper.updateRemoval(map.get("removalCode").toString(), null);
                     }
                 }else {
-                    List<JSONObject>  data1 = (List<JSONObject>) JSONObject.parse(jsonObject1.get("data").toString());
+                    List<JSONObject> data1 = (List<JSONObject>) JSONObject.parse(jsonObject1.get("data").toString());
                     for (JSONObject map : data1) {
                         if (map.get("State").toString().equals("0")){
                             for(JSONObject jsonObject2 : retunList){
@@ -375,7 +375,11 @@ public class AskGoodsServiceImpl implements AskGoodsService {
                                     error.setUrl("http://42.159.85.29:52480/cwbase/sg/V1/ERP/TELD/DEVTEST/API_WMS_PurInStock/CreateProductiveOutStock");
                                     error.setDataVal(jsonObject2.toString()).setType("出库回传");
                                     errorMapper.addError(error);
-                                    askGoodsMapper.updateRemoval(jsonObject2.get("WMSCode").toString());
+                                    List<JSONObject> list = (List<JSONObject>) jsonObject2.get("BillItems");
+                                    for(JSONObject jsonObject3 : list){
+                                        MaterialClass material = warehousingMapper.getMaterial(new Notice().setMaterialId(jsonObject3.get("Material").toString()));
+                                        askGoodsMapper.updateRemoval(jsonObject2.get("WMSCode").toString(), material.getWllbCode());
+                                    }
                                 }
                             }
                         }
@@ -769,7 +773,7 @@ public class AskGoodsServiceImpl implements AskGoodsService {
                 error.setUrl("http://42.159.85.29:52480/cwbase/sg/V1/ERP/TELD/DEVTEST/API_WMS_PurInStock/CreateBOLOutStock");
                 error.setDataVal(returnData.toJSONString()).setType("销售出库");
                 errorMapper.addError(error);
-                queryListMapper.updateType(removalCode, 1);
+                queryListMapper.updateType(removalCode, 1, null);
             }else {
                 JSONObject jsonObject = (JSONObject) JSONObject.parse(result.get("data").toString());
                 JSONObject jsonObject1 = (JSONObject) JSONObject.parse(jsonObject.get("result").toString());
@@ -779,7 +783,7 @@ public class AskGoodsServiceImpl implements AskGoodsService {
                     error.setUrl("http://42.159.85.29:52480/cwbase/sg/V1/ERP/TELD/DEVTEST/API_WMS_PurInStock/CreateBOLOutStock");
                     error.setDataVal(returnData.toJSONString()).setType("销售出库");
                     errorMapper.addError(error);
-                    queryListMapper.updateType(removalCode, 1);
+                    queryListMapper.updateType(removalCode, 1, null);
                 }else {
                     List<JSONObject>  data1 = (List<JSONObject>) JSONObject.parse(jsonObject1.get("data").toString());
                     for (JSONObject map : data1) {
@@ -791,6 +795,11 @@ public class AskGoodsServiceImpl implements AskGoodsService {
                                     error.setUrl("http://42.159.85.29:52480/cwbase/sg/V1/ERP/TELD/DEVTEST/API_WMS_PurInStock/CreateProductiveOutStock");
                                     error.setDataVal(jsonObject2.toString()).setType("销售出库");
                                     errorMapper.addError(error);
+                                    List<JSONObject> list = (List<JSONObject>) jsonObject2.get("BillItems");
+                                    for(JSONObject jsonObject3 : list){
+                                        MaterialClass material = warehousingMapper.getMaterial(new Notice().setMaterialId(jsonObject3.get("Material").toString()));
+                                        queryListMapper.updateType(jsonObject2.get("WMSCode").toString(), 1, material.getWllbCode());
+                                    }
                                 }
                             }
                         }
@@ -1021,7 +1030,7 @@ public class AskGoodsServiceImpl implements AskGoodsService {
                 errorMapper.addError(error);
                 //修改流水传输状态
                 for(Map<String, Object> map : askGoodsMapper.plugOutRemoval(removalCode)){
-                    askGoodsMapper.updateRemoval(map.get("removalCode").toString());
+                    askGoodsMapper.updateRemoval(map.get("removalCode").toString(), null);
                 }
             } else {
                 JSONObject jsonObject = (JSONObject) JSONObject.parse(result.get("data").toString());

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

@@ -102,7 +102,7 @@ public class GoodsServiceImpl implements GoodsService {
             }
             //当前时间
             Date time = new Date();
-            SimpleDateFormat sdf = new SimpleDateFormat("yyyyMddHHmmss");
+            SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
             ExcelUtils.export(response, "货品数据导出" + sdf.format(time), sheetDataList);
         }catch (Exception e){
             e.printStackTrace();

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

@@ -613,7 +613,7 @@ public class QueryListServiceImpl implements QueryListService {
                                     }
                                 }
                             } else {
-                                queryListMapper.updateType(map.get("WMSCode").toString(), 0);
+                                queryListMapper.updateType(map.get("WMSCode").toString(), 0, null);
                             }
                         }
                     }

+ 10 - 3
src/main/java/com/tld/service/impl/WarehousingServiceImpl.java

@@ -54,7 +54,7 @@ public class WarehousingServiceImpl implements WarehousingService {
     private ReceiveGoodsMapper receiveGoodsMapper;
 
     @Override
-    public Map<String, Object> getRecommend(String wllbCode, String suppId, String num, String unique, String producDate, String warehouseWhere) {
+    public Map<String, Object> getRecommend(String wllbCode, String suppId, String num, String unique, String producDate, String warehouseWhere, String wbs, String accountSleeve) {
         Map<String, Object> map = new HashMap<>();
         try {
             //判断物料是否录入
@@ -98,13 +98,18 @@ public class WarehousingServiceImpl implements WarehousingService {
                 Map<String, Object> map1 = warehousingMapper.getScanNum(listMaterialClass.get(i).getStorageLocationCode(), num);
                 if ( Double.doubleToLongBits(Double.parseDouble(String.valueOf(map1.get("scanNum"))))  <= Double.doubleToLongBits(Double.parseDouble(String.valueOf(materialClass.getSize()))) ) {
                     //查询库存是否同物料同批次存在
-                    List<String> countProduc = warehousingMapper.getInventoryProduc(listMaterialClass.get(i).getWllbCode(), producDate, listMaterialClass.get(i).getStorageLocationCode());
+                    List<Map<String, Object>> countProduc = warehousingMapper.getInventoryProduc(listMaterialClass.get(i).getWllbCode(), producDate, listMaterialClass.get(i).getStorageLocationCode(), wbs, accountSleeve);
                     if (countProduc.size() == 0) {
                         stringBuffer.append(listMaterialClass.get(i).getStorageLocationCode() + ",");
                         int surplusNum = (int) (Double.parseDouble(String.valueOf(materialClass.getSize())) - Double.parseDouble(String.valueOf(map1.get("scanNum"))) + Double.parseDouble(num));
                         listMap.put(listMaterialClass.get(i).getStorageLocationCode(), surplusNum);
                     } else {
-                        if (String.valueOf(countProduc.get(0)).equals(producDate)) {
+                        Date date = new Date();
+                        SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
+                        if (String.valueOf(countProduc.get(0).get("producDate")).equals(sdf.format(date)) &&
+                                String.valueOf(countProduc.get(0).get("wbs")).equals(wbs) &&
+                                String.valueOf(countProduc.get(0).get("accountSleeve")).equals(accountSleeve) &&
+                                String.valueOf(countProduc.get(0).get("wllbCode")).equals(wllbCode)) {
                             stringBuffer.append(listMaterialClass.get(i).getStorageLocationCode() + ",");
                             int surplusNum = (int) (Double.parseDouble(String.valueOf(materialClass.getSize())) - Double.parseDouble(String.valueOf(map1.get("scanNum"))) + Double.parseDouble(num));
                             listMap.put(listMaterialClass.get(i).getStorageLocationCode(), surplusNum);
@@ -124,6 +129,7 @@ public class WarehousingServiceImpl implements WarehousingService {
         return map;
     }
 
+
     @Override
     @Transactional(rollbackFor = Exception.class)
     public Map<String, Object> addWarehousingVirtual(WarehousingVirtual warehousingVirtual) {
@@ -852,6 +858,7 @@ public class WarehousingServiceImpl implements WarehousingService {
 
             String storageCode = codeGenerateRk();//入库单
             Notice notice = warehousingMapper.getNotices(inventory); //查询其他入库返回GS信息
+            warehousingMapper.updateNoticesWarehousingNum(inventory); //增加数量
             notice.setStorageCode(storageCode)//入库单编号
                   .setCompanyNumber(inventory.getAccountSleeve())//所属公司
                   .setStorageLocationCode(inventory.getStorageLocationCode())//库位编号

+ 3 - 0
src/main/resources/mapper/AskGoodsMapper.xml

@@ -1332,6 +1332,9 @@
     <!-- 修改数据传输状态 -->
     <update id="updateRemoval">
         update tld_removal set transmission_type = "1" where storage_code = #{removalCode}
+       <if test="material != null and material != ''">
+            and wllb_code = #{material}
+       </if>
     </update>
     <!-- 修改数据传输状态 -->
     <update id="updateRemovalHalfProduct">

+ 2 - 2
src/main/resources/mapper/InventoryMapper.xml

@@ -231,8 +231,8 @@
                a.amount,
                c.amount AS gsAmount
         FROM tld_inventory a
-                 LEFT JOIN tld_material b ON a.wllb_code = b.CODE
-                 INNER JOIN tld_inventory_gs c ON a.material_id = c.material_id
+        LEFT JOIN tld_material b ON a.wllb_code = b.CODE
+        INNER JOIN tld_inventory_gs c ON a.material_id = c.material_id
     </select>
     <!--查询是否重复-->
     <select id="getInventoryPlates" resultType="com.tld.model.MakeInventory">

+ 24 - 6
src/main/resources/mapper/QueryListMappeer.xml

@@ -1023,12 +1023,30 @@
     </select>
     <!-- 移库修改状态 -->
     <update id="updateType">
-        update tld_storage set transmission_type = #{type} where storage_code = #{wmsCode};
-        update tld_removal set transmission_type = #{type} where storage_code = #{wmsCode};
-        update tld_removal_half_product set transmission_type = #{type} where storage_code = #{wmsCode};
-        update tld_removal_half set transmission_type = #{type} where storage_code = #{wmsCode};
-        update tld_half set transmission_type = #{type} where storage_code = #{wmsCode};
-        update tld_half_product set transmission_type = #{type} where storage_code = #{wmsCode};
+        update tld_storage set transmission_type = #{type} where storage_code = #{wmsCode}
+        <if test="code != null and code != ''">
+            and wllb_code = #{code}
+        </if>;
+        update tld_removal set transmission_type = #{type} where storage_code = #{wmsCode}
+        <if test="code != null and code != ''">
+            and wllb_code = #{code}
+        </if>;
+        update tld_removal_half_product set transmission_type = #{type} where storage_code = #{wmsCode}
+        <if test="code != null and code != ''">
+            and wllb_code = #{code}
+        </if>;
+        update tld_removal_half set transmission_type = #{type} where storage_code = #{wmsCode}
+        <if test="code != null and code != ''">
+            and wllb_code = #{code}
+        </if>;
+        update tld_half set transmission_type = #{type} where storage_code = #{wmsCode}
+        <if test="code != null and code != ''">
+            and wllb_code = #{code}
+        </if>;
+        update tld_half_product set transmission_type = #{type} where storage_code = #{wmsCode}
+        <if test="code != null and code != ''">
+            and wllb_code = #{code}
+        </if>;
     </update>
     <!--查询其它出库信息-->
     <select id="getOtherShipments" resultType="com.tld.model.AskGoods">

+ 13 - 12
src/main/resources/mapper/WarehousingMapper.xml

@@ -37,8 +37,8 @@
         SELECT (ifnull(sum(a.num), 0) + ${num} + ifnull(sum(c.amount), 0)) as scanNum,
                ifnull(b.storage_location_capacity, 0)                      as storageLocationCapacity
         FROM tld_warehousing_virtual a
-                 right join tld_storage_location b on a.storage_location_code = b.storage_location_code
-                 left join tld_inventory c on b.storage_location_code = c.storage_location_code
+        right join tld_storage_location b on a.storage_location_code = b.storage_location_code
+        left join tld_inventory c on b.storage_location_code = c.storage_location_code
         where b.storage_location_code = #{storageLocationCode}
     </select>
     <!-- 查询 -->
@@ -398,13 +398,11 @@
         where code = #{wllbCode}
     </select>
     <!-- 查询库存是否同物料同批次存在 -->
-    <select id="getInventoryProduc" resultType="int">
-        SELECT produc_date as producDate
+    <select id="getInventoryProduc" resultType="java.util.Map">
+        SELECT produc_batch as producDate,wbs as wbs,account_sleeve as accountSleeve,wllb_code as wllbCode
         FROM tld_inventory a
-                 JOIN tld_material b ON a.material_id = b.tld_id
-        WHERE a.produc_date = #{producDate}
-          AND b.code = #{wllbCode}
-          and a.storage_location_code = #{storageLocationCode}
+        JOIN tld_material b ON a.material_id = b.tld_id
+        WHERE a.storage_location_code = #{storageLocationCode}
           and hold = '0'
     </select>
     <!-- 查询报工单 -->
@@ -498,10 +496,9 @@
                c.notice_time as noticeTime,
                c.company_number
         from tld_notice a
-                 join tld_notice_f c on a.notice_id = c.notice_id
-                 left join tld_material b on a.material_id = b.tld_id
-        where a.notice_id = #{noticeId}
-          and a.material_id = #{materialId}
+        join tld_notice_f c on a.notice_id = c.notice_id
+        left join tld_material b on a.material_id = b.tld_id
+        where a.notice_id = #{noticeId} and a.material_id = #{materialId}
     </select>
     <!-- 半成品跟部分产成品入库存 -->
     <insert id="addInventoryNotice">
@@ -1058,4 +1055,8 @@
         left join tld_wbs c on a.wbs = c.tld_id
         where a.notice_id = #{noticeId} and a.entry_number = #{entryNumber} and a.material_id = #{materialId}
     </select>
+    <!-- 往单据上增加数量 -->
+    <update id="updateNoticesWarehousingNum">
+        update tld_notices set warehousing_num = #{amount} where notice_id = #{noticeId} and entry_number = #{entryNumber}
+    </update>
 </mapper>