Bladeren bron

问题修改

zhs 2 jaren geleden
bovenliggende
commit
66eb2198ed

+ 1 - 1
src/main/java/com/tld/config/SaticScheduleTask.java

@@ -58,7 +58,7 @@ public class SaticScheduleTask {
     /**
      * 批量回调 生产收货接口文档/报工单 w
      */
-    @Scheduled(cron = "0 */30 * * * ?")
+    @Scheduled(cron = "0 */10 * * * ?")
     public void callWorkOrder(){
         askGoodsService.getCallWorkOrder();
     }

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

@@ -208,6 +208,7 @@ public class AskGoodsServiceImpl implements AskGoodsService {
                 map.put("errMsg", "已全部出库");
                 return map;
             }
+            askGoods.setAccountSleeve(askGoods.getCompanyNumber());
             Inventory inventory = askGoodsMapper.getInventory(askGoods); //库存数量
             AskGoods askGoods1 = askGoodsMapper.getAsknInfo(askGoods); //要货单数量
             int alreadyNum =  askGoodsMapper.getAskInfoNumVitrual(askGoods);//已扫描总数
@@ -267,7 +268,7 @@ public class AskGoodsServiceImpl implements AskGoodsService {
                 askGoods.setCompanyNumber(askGoods.getAccountSleeve());
                 String materialId = askGoodsMapper.getMaterialId(askGoods.getWllbCode());//查询物料id
                 Inventory inventory = askGoodsMapper.getInventory(askGoods);//查询库存数量
-                if(inventory == null){
+                if(inventory == null) {
 //                    throw new Exception("库存不存在");
 //                    System.out.println("库存不存在");
                     //查询物料信息

+ 12 - 7
src/main/java/com/tld/service/impl/WarehouseTransferServiceImpl.java

@@ -85,8 +85,9 @@ public class WarehouseTransferServiceImpl implements WarehouseTransferService {
                 askGoods.setCompanyNumber(askGoods.getAccountSleeve());
                 askGoods.setMaterialId(material.getTldId());
                 //判断是否是三大仓库(半成品、产成品、原材料)之外的仓库 如果是则不需要查询库存
-                String warehouseType = warehouseTransferMapper.getStorageLocationWarehouse(askGoods.getStorageLocationCode());
-                if(!warehouseType.equals("10")) {
+                String warehouseTypeCK = warehouseTransferMapper.getStorageLocationWarehouse(askGoods.getStorageLocationCode());
+                String warehouseTypeRK = warehouseTransferMapper.getStorageLocationWarehouse(askGoods.getStorageLocationCodeRk());
+                if(!warehouseTypeCK.equals("10")) {
                     if(material.getPartType().equals("原材料")) {
                         inventory = askGoodsMapper.getInventory(askGoods);
                     } else if(material.getPartType().equals("产成品")) {
@@ -144,7 +145,7 @@ public class WarehouseTransferServiceImpl implements WarehouseTransferService {
                 }
                 warehouseTransferMapper.updateOutNum(askGoods.getNum(), askGoodsId, materialId, typeVal, askGoods.getEntryNumber());//修改出库数量
                 if(askGoods.getStorageLocationCodeRk().indexOf("XNKW") != -1){
-                    if(!warehouseType.equals("10")) {
+                    if(!warehouseTypeRK.equals("10")) {
                         Inventory inventory2 = warehouseTransferMapper.getInventoryVitrual(askGoods);
                         String code = warehouseTransferMapper.getWarehouseTransferCodeType(warehouseTransfer.getAskGoodsWarehouseId());
                         if(material.getPartType().equals("产成品") && code.equals("2")){
@@ -189,8 +190,11 @@ public class WarehouseTransferServiceImpl implements WarehouseTransferService {
                     .setWarehouseTransferType(warehouseTransferF.getWarehouseTransferType()); //移库类型
             warehouseTransferMapper.addReturnGsWarehouseTransferF(warehouseTransfer1);//新增返回gs数据父表信息
             warehousingMapper.addStorage(warehousing);//入库流水
+            String warehouseTypeRK = warehouseTransferMapper.getStorageLocationWarehouse(list.get(0).getStorageLocationCodeRk());
             if(list.get(0).getStorageLocationCodeRk().indexOf("XNKW") > 0){
-                warehousingMapper.addInventory(warehousing);//库存
+                if(!warehouseTypeRK.equals("10")) {
+                    warehousingMapper.addInventory(warehousing);//库存
+                }
             }
             map.put("data", warehouseTransferCode);
             map.put("msg", "200");
@@ -266,8 +270,9 @@ public class WarehouseTransferServiceImpl implements WarehouseTransferService {
                 Inventory inventory = new Inventory();
                 String code = warehouseTransferMapper.getWarehouseTransferCodeType(warehouseTransfer.getAskGoodsWarehouseId());
                 //判断是否是三大仓库(半成品、产成品、原材料)之外的仓库 如果是则不需要查询库存
-                String warehouseType = warehouseTransferMapper.getStorageLocationWarehouse(askGoods.getStorageLocationCode());
-                if(!warehouseType.equals("10")) {
+                String warehouseTypeCK = warehouseTransferMapper.getStorageLocationWarehouse(askGoods.getStorageLocationCode());
+                String warehouseTypeRK = warehouseTransferMapper.getStorageLocationWarehouse(warehousingVirtual.getStorageLocationCode());
+                if(!warehouseTypeCK.equals("10")) {
                     if(material.getPartType().equals("原材料")){
                         inventory = askGoodsMapper.getInventoryWarehousing(askGoods);
                     } else if(material.getPartType().equals("产成品")){
@@ -297,7 +302,7 @@ public class WarehouseTransferServiceImpl implements WarehouseTransferService {
                         .setWbs(warehouseTransfer.getWbs())//wbs
                         .setOutNum(warehousingVirtual.getNum()); //出库数量
                 warehouseTransferMapper.addReturnGsWarehouseTransfer(warehouseTransfer1);//新增返回gs数据子表信息
-                if(!warehouseType.equals("10")) {
+                if(!warehouseTypeRK.equals("10")){
                     //新入库逻辑
                     if(material.getPartType().equals("半成品") || material.getPartType().equals("低值易耗品")) {
                         Notice notice1 = new Notice()

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

@@ -621,9 +621,35 @@ public class WarehousingServiceImpl implements WarehousingService {
                 return map;
             }
             if (inventory == null) {
-                map.put("msg", "500");
-                map.put("errMsg", "没有查询到此半成品物料的库存");
-                return map;
+                if(notice.getWarehousingNum().indexOf("-") != -1){
+                    MaterialClass material = warehousingMapper.getMaterial(new Notice().setMaterialCode(askGoods.getWllbCode()));
+                    inventory = new Inventory()
+                            .setStorageLocationCode(notice.getStorageLocationCode())
+                            .setAmount("0")
+                            .setWllbClass(material.getWllbClass())
+                            .setMaterialId(material.getTldId())
+                            .setWllbCode(material.getWllbCode())
+                            .setAccountSleeve(askGoods.getCompanyNumber())
+                            .setWbs(askGoods.getWbs())
+                            .setProducDate("19700101")
+                            .setProducBatch("19700101")
+                            .setSupplierId(notice.getSupplierId())
+                            .setSerial(notice.getSerial());
+                    if(material.getPartType().equals("半成品") || material.getPartType().equals("产成品")) {
+                        inventory.setSupplierId("EC13437");
+                        if(askGoods.getCompanyNumber().equals("8130")){
+                            inventory.setSerial("000000");
+                        } else if(askGoods.getCompanyNumber().equals("8400")){
+                            inventory.setSerial("100000");
+                        }
+                    }
+                    askGoodsMapper.addInventory(inventory);
+                    inventory.setId(inventory.getId());
+                } else {
+                    map.put("msg", "500");
+                    map.put("errMsg", "没有查询到此半成品物料的库存");
+                    return map;
+                }
             }
             if (Double.doubleToLongBits(Double.parseDouble(notice.getWarehousingNum())) > Double.doubleToLongBits(Double.parseDouble(inventory.getAmount()))) {
                 map.put("msg", "500");

+ 5 - 2
src/main/resources/mapper/AskGoodsMapper.xml

@@ -199,6 +199,9 @@
         <if test="wbs != null">
             and wbs = #{wbs}
         </if>
+        <if test="storageLocationCode != null and storageLocationCode != ''">
+            and storage_location_code = #{storageLocationCode}
+        </if>
     </select>
     <!-- 查询指定库存内容 -->
     <select id="getInventoryWarehousing" resultType="com.tld.model.Inventory">
@@ -735,8 +738,8 @@
             left join tld_company g on c.company_number = g.code
             left join tld_wbs f on a.wbs = f.tld_id
         WHERE
-        (a.num + 0) <![CDATA[>]]> (a.out_num + 0) and
-          b.part_type = #{partType}
+        ((a.num + 0) <![CDATA[>]]> (IFNULL(a.out_num, 0) + 0) or ((a.num like '-%') and ((a.num + 0) != (a.out_num + 0))))
+        and b.part_type = #{partType}
         <if test="userId != null and userId != ''">
             and b.code in (select material_id from tld_user_material where user_id = #{userId})
         </if>

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

@@ -1432,7 +1432,7 @@
         where (out_num + 0) <![CDATA[<]]> (
         num + 0) and material_code in (select material_id from tld_user_material where user_id = #{userId})
     </select>
-    <!-- 查询发货追溯任务数量 -->
+    <!-- 查询半成品出 -->
     <select id="getBanChenPinChu" resultType="int">
         SELECT
             count(*)
@@ -1440,14 +1440,11 @@
             tld_ask_goods a
             JOIN tld_material b on a.material_id = b.tld_id
         WHERE
-            ( a.out_num + 0 ) <![CDATA[<]]> (
-            a.num + 0) and b.code in (select material_id from tld_user_material where user_id = #{userId})
+            ((a.num + 0) <![CDATA[>]]> (IFNULL(a.out_num, 0) + 0) or ((a.num like '-%') and ((a.num + 0) != (a.out_num + 0))))
+            and b.code in (select material_id from tld_user_material where user_id = #{userId})
             and b.part_type = '半成品'
     </select>
 
-
-
-
     <select id="storageLocationNum" resultType="java.util.Map">
         SELECT
         a.id,

+ 4 - 3
src/main/resources/mapper/WarehousingMapper.xml

@@ -805,10 +805,11 @@
                c.code as wllbCode,
                a.type,
                b.department,
-               b.request_type_name
+               b.request_type_name,
+               b.company_number
         from tld_ask_goods a
-                 join tld_ask_goods_f b on a.ask_goods_id = b.ask_goods_id
-                 left join tld_material c on a.material_id = c.tld_id
+        join tld_ask_goods_f b on a.ask_goods_id = b.ask_goods_id
+        left join tld_material c on a.material_id = c.tld_id
         where a.ask_goods_id = #{askGoodsId}
           and a.material_id = #{materialId} and a.entry_number = #{entryNumber}
     </select>