Browse Source

问题修改

zhs 2 years ago
parent
commit
8d8dd90ee4

+ 2 - 0
src/main/java/com/tld/mapper/DeliveryMapper.java

@@ -72,4 +72,6 @@ public interface DeliveryMapper {
     void updateEquipmentBindingSoftware(EquipmentBindingSoftware equipmentBindingSoftware);
 
     void delEquipmentBindingSoftware(String id);
+
+    void delDeliveryId(String deliveryId);
 }

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

@@ -19,7 +19,7 @@ public interface WarehouseTransferMapper {
 
     WarehouseTransfer getWarehouseTransferDetailed(@Param("askGoodsId")String askGoodsId, @Param("materialId")String materialId, @Param("entryNumber")String entryNumber);
 
-    void updateOutNum(@Param("num")String num, @Param("askGoodsId")String askGoodsId, @Param("materialId")String materialId, @Param("typeVal")String typeVal);
+    void updateOutNum(@Param("num")String num, @Param("askGoodsId")String askGoodsId, @Param("materialId")String materialId, @Param("typeVal")String typeVal, @Param("entryNumber")String entryNumber);
 
     int getReturnWarehouseTransferCount();
 

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

@@ -142,4 +142,6 @@ public interface WarehousingMapper {
     List<Map<String, Object>> exportNotice(Notice notice);
 
     String getFinishedInfo(WarehousingVirtual warehousingVirtual);
+
+    String getnumSaoMiao(Notice setEntryNumber);
 }

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

@@ -75,7 +75,7 @@ public class DeliveryServiceImpl implements DeliveryService {
                     if(occupy == 0){
                         //--------------暂时使用 后期改回逻辑
 //                        if(Double.doubleToLongBits(Double.parseDouble(inventory.getAmount())) == Double.doubleToLongBits(Double.parseDouble(delivery.getOutNum()))){
-                        if(Double.doubleToLongBits(Double.parseDouble(inventory.getAmount())) >= Double.doubleToLongBits(Double.parseDouble(delivery.getOutNum()))){
+//                        if(Double.doubleToLongBits(Double.parseDouble(inventory.getAmount())) >= Double.doubleToLongBits(Double.parseDouble(delivery.getOutNum()))){
                             for(Inventory inventorys : deliveryMapper.getInventory(storageLocationCode, delivery)){
                                 if (inventorys.getStorageLocationCode().equals(inventory.getStorageLocationCode())){
                                     list.add(inventorys);
@@ -85,7 +85,7 @@ public class DeliveryServiceImpl implements DeliveryService {
                                 }
                             }
                             return map;
-                        }
+//                        }
                     }
                 }
                 map.put("data", list);
@@ -339,18 +339,19 @@ public class DeliveryServiceImpl implements DeliveryService {
         try {
             String userId = request.getHeader("userId");
             Map<String, Object> mapVal = deliveryMapper.getDeliverys(id);
-            if(Double.parseDouble(mapVal.get("out_num").toString()) > 0){
-                map.put("msg", "500");
-                map.put("errMsg", "此单据已出库!");
-                return map;
-            }
+//            if(Double.parseDouble(mapVal.get("out_num").toString()) > 0){
+//                map.put("msg", "500");
+//                map.put("errMsg", "此单据已出库!");
+//                return map;
+//            }
             LogData logData = new LogData()
                     .setUserId(userId)
                     .setData(mapVal.toString())
                     .setType("0")
                     .setDocumentType("交货单");
             dictionaryMapper.addLogdata(logData);
-            deliveryMapper.delDelivery(id);
+            deliveryMapper.delDelivery(mapVal.get("delivery_id").toString());
+            deliveryMapper.delDeliveryId(mapVal.get("delivery_id").toString());
             map.put("msg", "200");
         } catch (Exception e) {
             e.printStackTrace();

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

@@ -139,7 +139,7 @@ public class WarehouseTransferServiceImpl implements WarehouseTransferService {
                 if(Double.doubleToLongBits(scanNum) == Double.doubleToLongBits(Double.parseDouble(warehouseTransfer.getNum()))){
                     typeVal = "1";
                 }
-                warehouseTransferMapper.updateOutNum(askGoods.getNum(), askGoodsId, materialId, typeVal);//修改出库数量
+                warehouseTransferMapper.updateOutNum(askGoods.getNum(), askGoodsId, materialId, typeVal, askGoods.getEntryNumber());//修改出库数量
                 if(askGoods.getStorageLocationCodeRk().indexOf("XNKW") != -1){
                     Inventory inventory2 = warehouseTransferMapper.getInventoryVitrual(askGoods);
                     String code = warehouseTransferMapper.getWarehouseTransferCodeType(warehouseTransfer.getAskGoodsWarehouseId());
@@ -239,7 +239,7 @@ public class WarehouseTransferServiceImpl implements WarehouseTransferService {
                 if(Double.doubleToLongBits(scanNum) == Double.doubleToLongBits(Double.parseDouble(warehouseTransfer.getNum()))){
                     typeVal = "1";
                 }
-                warehouseTransferMapper.updateOutNum(warehousingVirtual.getNum(), warehousingVirtual.getWarehouseTransferId(), materialId, typeVal);//修改出库数量
+                warehouseTransferMapper.updateOutNum(warehousingVirtual.getNum(), warehousingVirtual.getWarehouseTransferId(), materialId, typeVal, warehousingVirtual.getEntryNumber());//修改出库数量
 
                 AskGoods askGoods = new AskGoods()
                         .setStorageLocationCode(warehousingVirtual.getStorageLocationCodeCk())

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

@@ -67,6 +67,12 @@ public class WarehousingServiceImpl implements WarehousingService {
                 map.put("errMsg", "物料信息未录入,请联系管理员");
                 return map;
             }
+            Map<String, Object> mapVal = warehousingMapper.getScanIsNot(wllbCode, suppId, unique, producDate, warehouseWhere);
+            if (Integer.parseInt(mapVal.get("inventoryCount").toString()) != 0 || Integer.parseInt(mapVal.get("virtualCount").toString()) != 0) {
+                map.put("msg", "500");
+                map.put("errMsg", "已被扫描");
+                return map;
+            }
             if(materialClass.getPartType().equals("半成品")){
                 List<StorageLocation> listTwo = warehousingMapper.getRecommendTwo("1");
                 map.put("data", listTwo);
@@ -79,12 +85,6 @@ public class WarehousingServiceImpl implements WarehousingService {
                 map.put("listString", new HashMap<>());//返回库位剩余数量
                 return map;
             }
-            Map<String, Object> mapVal = warehousingMapper.getScanIsNot(wllbCode, suppId, unique, producDate, warehouseWhere);
-            if (Integer.parseInt(mapVal.get("inventoryCount").toString()) != 0 || Integer.parseInt(mapVal.get("virtualCount").toString()) != 0) {
-                map.put("msg", "500");
-                map.put("errMsg", "已被扫描");
-                return map;
-            }
             //判断如果是混合则走单独逻辑
             String isNotSisable = warehousingMapper.getIsNotSisable(wllbCode);
             if (isNotSisable.equals("1")) {
@@ -669,9 +669,10 @@ public class WarehousingServiceImpl implements WarehousingService {
                 map.put("errMsg", "库位已满");
                 return map;
             }
-            Notice notice1 = warehousingMapper.getNoticeId(new Notice().setNoticeId(notice.getNoticeId()).setMaterialId(notice.getMaterialId()));
+            Notice notice1 = warehousingMapper.getNoticeId(new Notice().setNoticeId(notice.getNoticeId()).setMaterialId(notice.getMaterialId()).setEntryNumber(notice.getEntryNumber()));
+            String numSaoMiao = warehousingMapper.getnumSaoMiao(new Notice().setNoticeId(notice.getNoticeId()).setMaterialId(notice.getMaterialId()).setEntryNumber(notice.getEntryNumber()));
             if(notice1 != null) {
-                Double contrast = Double.parseDouble(notice1.getWarehousingNum()) + Double.parseDouble(notice.getWarehousingNum());
+                Double contrast = Double.parseDouble(notice1.getWarehousingNum()) + Double.parseDouble(notice.getWarehousingNum()) + Double.parseDouble(numSaoMiao);
                 if(Double.doubleToLongBits(contrast) > Double.doubleToLongBits(Double.parseDouble(notice1.getNum()))) {
                     map.put("msg", "500");
                     map.put("errMsg", "扫描数量超出报工单数量");
@@ -772,7 +773,7 @@ public class WarehousingServiceImpl implements WarehousingService {
                 //查询物料信息
                 Notice notice = new Notice().setMaterialCode(warehousingVirtual.getWllbCode());
                 MaterialClass material = warehousingMapper.getMaterial(notice);
-                Notice notice1 = warehousingMapper.getNoticeId(new Notice().setNoticeId(noticeId).setMaterialId(material.getTldId()));
+                Notice notice1 = warehousingMapper.getNoticeId(new Notice().setNoticeId(noticeId).setMaterialId(material.getTldId()).setEntryNumber(warehousingVirtual.getEntryNumber()));
                 Notice notice2 = new Notice()
                         .setMaterialId(material.getTldId())
                         .setStorageLocationCode(warehousingVirtual.getStorageLocationCode())

+ 9 - 4
src/main/resources/mapper/DeliveryMapper.xml

@@ -12,7 +12,7 @@
             JOIN tld_delivery_f b ON a.delivery_id = b.delivery_id
             join tld_material c on a.material_id = c.tld_id
         WHERE
-            ( a.gs_delivery_num - a.gs_cancel_num ) != a.out_num
+            ( a.gs_delivery_num - a.gs_cancel_num ) <![CDATA[>]]> a.out_num
 	AND a.STATUS != '1' and c.code in (select material_id from tld_user_material where user_id = #{userId})
     <if test="projectName == ' '.toString()">
         AND b.project_name is null
@@ -33,7 +33,7 @@
             JOIN tld_delivery_f b ON a.delivery_id = b.delivery_id
             join tld_material c on a.material_id = c.tld_id
         WHERE
-            ( a.gs_delivery_num - a.gs_cancel_num ) != a.out_num
+            ( a.gs_delivery_num - a.gs_cancel_num ) <![CDATA[>]]> a.out_num
 	AND a.STATUS != '1' and c.code in (select material_id from tld_user_material where user_id = #{userId})
     </select>
     <!-- 查询销售交货单 -->
@@ -65,7 +65,7 @@
         join tld_delivery_f b on a.delivery_id = b.delivery_id
         left join tld_material c on a.material_id = c.tld_id
         left join tld_wbs d on a.wbs = d.tld_id
-        where (a.gs_delivery_num - a.gs_cancel_num) != a.out_num
+        where (a.gs_delivery_num - a.gs_cancel_num) <![CDATA[>]]> a.out_num
         and a.status != '1' and c.code in (select material_id from tld_user_material where user_id = #{userId})
         <if test="deliveryId != null and deliveryId != ''">
             and a.delivery_id = #{deliveryId}
@@ -271,7 +271,12 @@
     </select>
     <!-- 删除销售交货单原始数据 -->
     <delete id="delDelivery">
-        delete from  tld_delivery where id = #{id}
+        delete from tld_delivery where delivery_id = #{id};
+        delete from tld_delivery_f where delivery_id = #{id};
+    </delete>
+    <!-- 删除指定单据流水 -->
+    <delete id="delDeliveryId">
+        delete from tld_removal_half where delivery_id = #{deliveryId}
     </delete>
     <!-- 物料库位选择 -->
     <select id="getMaterialCk" resultType="com.tld.model.Inventory">

+ 1 - 1
src/main/resources/mapper/QueryListMappeer.xml

@@ -1325,7 +1325,7 @@
         FROM
             tld_delivery a
             JOIN tld_material b ON a.material_id = b.tld_id
-        where ( a.gs_delivery_num - a.gs_cancel_num ) != a.out_num and b.code in (select material_id from tld_user_material where user_id = #{userId}) and a.status = "0"
+        where ( a.gs_delivery_num - a.gs_cancel_num ) <![CDATA[>]]> a.out_num and b.code in (select material_id from tld_user_material where user_id = #{userId}) and a.status = "0"
     </select>
     <!-- 查询其他入库任务数量 -->
     <select id="getQiTaRu" resultType="int">

+ 1 - 1
src/main/resources/mapper/WarehouseTransferMapper.xml

@@ -115,7 +115,7 @@
     <!-- 修改出库数量 -->
     <update id="updateOutNum">
         update tld_warehouse_transfer
-        set out_num = ifnull(out_num, 0) + #{num},type = #{typeVal} where material_id = #{materialId} and warehouse_transfer_id = #{askGoodsId}
+        set out_num = ifnull(out_num, 0) + #{num},type = #{typeVal} where material_id = #{materialId} and warehouse_transfer_id = #{askGoodsId} and entry_number = #{entryNumber}
     </update>
     <!-- 查询当天移库单条数 -->
     <select id="getReturnWarehouseTransferCount" resultType="int">

+ 6 - 2
src/main/resources/mapper/WarehousingMapper.xml

@@ -592,7 +592,7 @@
         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}
+        where a.notice_id = #{noticeId} and a.material_id = #{materialId} and a.entry_number = #{entryNumber}
     </select>
     <!-- 半成品跟部分产成品入库存 -->
     <insert id="addInventoryNotice">
@@ -1036,7 +1036,7 @@
             ,type = '1'
         </if>
         where notice_id = #{noticeId}
-          and material_id = #{materialId}
+          and material_id = #{materialId} and entry_number = #{entryNumber}
     </update>
     <!-- 查询产成品是否扫描 -->
     <select id="getScanIsNotProduct" resultType="java.util.Map">
@@ -1174,4 +1174,8 @@
     <select id="getFinishedInfo" resultType="String">
         select id from tld_inventory where wllb_code = #{wllbCode} and wbs = #{wbs} and account_sleeve = #{accountSleeve} limit 1
     </select>
+    <!-- 查询产成品入库虚拟表数量 -->
+    <select id="getnumSaoMiao" resultType="java.lang.String">
+        select ifnull(max(num), 0) from tld_warehousing_virtual where notice_id = #{noticeId} and entry_number = #{entryNumber}
+    </select>
 </mapper>