xiaochen il y a 2 ans
Parent
commit
f7cffc5058

+ 21 - 0
src/main/java/com/tld/controller/WarehousingController.java

@@ -236,4 +236,25 @@ public class WarehousingController {
     public Map<String, Object> getMing(String code){
         return warehousingService.getMing(code);
     }
+
+    /**
+     * 删除其它入库
+     * @param id 参数
+     * @return 返回结果
+     */
+    @DeleteMapping("delOtherReceivingGoods")
+    public Map<String, Object> delOtherReceivingGoods(String id , HttpServletRequest request){
+        return warehousingService.delOtherReceivingGoods(id,request);
+    }
+
+    /**
+     * 删除其它出库
+     * @param id 参数
+     * @return 返回结果
+     */
+    @DeleteMapping("delOtherShipments")
+    public Map<String, Object> delOtherShipments(String id , HttpServletRequest request){
+        return warehousingService.delOtherShipments(id,request);
+    }
+
 }

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

@@ -128,4 +128,12 @@ public interface WarehousingMapper {
     Notice getNotices(Inventory inventory);
 
     void updateNoticesWarehousingNum(Inventory inventory);
+
+    Map<String, Object> getOtherReceivingGoods(@Param("id") String id);
+
+    void delOtherReceivingGoods(@Param("id") String id);
+
+    Map<String, Object> getOtherShipments(@Param("id") String id);
+
+    void delOtherShipments(@Param("id") String id);
 }

+ 4 - 0
src/main/java/com/tld/service/WarehousingService.java

@@ -52,4 +52,8 @@ public interface WarehousingService {
     Map<String, Object> addWarehousingVirtualTwo(WarehousingVirtual warehousingVirtual);
 
     Map<String, Object> addWarehouseTransferVirtual(WarehousingVirtual warehousingVirtual);
+
+    Map<String, Object> delOtherReceivingGoods(String id, HttpServletRequest request);
+
+    Map<String, Object> delOtherShipments(String id, HttpServletRequest request);
 }

+ 68 - 0
src/main/java/com/tld/service/impl/WarehousingServiceImpl.java

@@ -973,6 +973,74 @@ public class WarehousingServiceImpl implements WarehousingService {
         return map;
     }
 
+    /**
+    * @Description: 删除其它入库
+    * @Param: id userId 用户id
+    * @return: Map<String, Object> map
+    * @Author: XiaoChen
+    * @Date: 2023/4/14
+    */
+    @Override
+    public Map<String, Object> delOtherReceivingGoods(String id, HttpServletRequest request) {
+        Map<String, Object> map = new HashMap<>();
+        try {
+            String userId = request.getHeader("userId");
+            Map<String, Object> mapVal = warehousingMapper.getOtherReceivingGoods(id);
+            if(Double.parseDouble(mapVal.get("warehousing_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);
+            warehousingMapper.delOtherReceivingGoods(id);
+            map.put("msg", "200");
+        } catch (Exception e) {
+            e.printStackTrace();
+            map.put("msg", "500");
+            map.put("errMsg", "服务器请求异常,请稍后再试");
+        }
+        return map;
+    }
+
+    /**
+    * @Description: 删除其它出库
+    * @Param: id   userId
+    * @return: Map<String, Object> map
+    * @Author: XiaoChen
+    * @Date: 2023/4/14
+    */
+    @Override
+    public Map<String, Object> delOtherShipments(String id, HttpServletRequest request) {
+        Map<String, Object> map = new HashMap<>();
+        try {
+            String userId = request.getHeader("userId");
+            Map<String, Object> mapVal = warehousingMapper.getOtherShipments(id);
+            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);
+            warehousingMapper.delOtherShipments(id);
+            map.put("msg", "200");
+        } catch (Exception e) {
+            e.printStackTrace();
+            map.put("msg", "500");
+            map.put("errMsg", "服务器请求异常,请稍后再试");
+        }
+        return map;
+    }
+
 
     /**
      * 入库单生成

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

@@ -993,13 +993,21 @@
         join tld_material c on a.material_id = c.tld_id
         join tld_company k on b.company_number = k.code
         <trim prefix="WHERE" prefixOverrides="and |or">
-            IFNULL(a.warehousing_num, 0) <![CDATA[<]]> (a.num + 0)
+            <if test="type == '0'.toString() ">
+                IFNULL(a.warehousing_num, 0) <![CDATA[<]]> (a.num + 0)
+            </if>
+            <if test="type == '1'.toString() ">
+                IFNULL(a.warehousing_num, 0) <![CDATA[=]]> (a.num + 0)
+            </if>
             <if test="materialCode != null and materialCode != ''">
                 and c.code like CONCAT(CONCAT('%', #{materialCode}), '%')
             </if>
             <if test="materialName != null and materialName != ''">
                 and c.name like CONCAT(CONCAT('%', #{materialName}), '%')
             </if>
+            <if test="noticeCode != null and noticeCode != ''">
+                and b.notice_code like CONCAT(CONCAT('%', #{noticeCode}), '%')
+            </if>
             <if test="materialId != null and materialId != ''">
                 and c.tld_id like CONCAT(CONCAT('%', #{materialId}), '%')
             </if>
@@ -1061,7 +1069,7 @@
             b.ask_goods_code,
             b.company_number,
             b.sqrq,
-            b.department,
+            p.name as department,
             b.source_type,
             b.move_type,
             b.request_type_number,
@@ -1075,14 +1083,26 @@
         join tld_enquiry_f b on a.ask_goods_id = b.ask_goods_id
         join tld_material c on a.material_id = c.tld_id
         join tld_company k on b.company_number = k.code
+        join tld_department p on b.department = p.code
         <trim prefix="WHERE" prefixOverrides="and |or">
-            IFNULL(a.out_num, 0) <![CDATA[<]]> (a.num + 0)
+            <if test="type == '0'.toString() ">
+                IFNULL(a.out_num, 0) <![CDATA[<]]> (a.num + 0)
+            </if>
+            <if test="type == '1'.toString() ">
+                IFNULL(a.out_num, 0) <![CDATA[=]]> (a.num + 0)
+            </if>
             <if test="materialCode != null and materialCode != ''">
                 and c.code like CONCAT(CONCAT('%', #{materialCode}), '%')
             </if>
             <if test="materialName != null and materialName != ''">
                 and c.name like CONCAT(CONCAT('%', #{materialName}), '%')
             </if>
+            <if test="askGoodsCode != null and askGoodsCode != ''">
+                and b.ask_goods_code like CONCAT(CONCAT('%', #{askGoodsCode}), '%')
+            </if>
+            <if test="departmentCode != null and departmentCode != ''">
+                and b.department = #{departmentCode}
+            </if>
             <if test="materialId != null and materialId != ''">
                 and c.tld_id like CONCAT(CONCAT('%', #{materialId}), '%')
             </if>

+ 16 - 0
src/main/resources/mapper/WarehousingMapper.xml

@@ -543,6 +543,14 @@
         where storage_location_code = #{storageLocationCode}
           and material_id = #{materialId}
     </delete>
+    <!--删除其它入库信息-->
+    <delete id="delOtherReceivingGoods">
+        delete from tld_notices where id = #{id}
+    </delete>
+    <!--删除其它出库信息-->
+    <delete id="delOtherShipments">
+        delete from tld_enquiry where id = #{id}
+    </delete>
     <!-- 删减库存 -->
     <update id="updateInventoryNoticeNum">
         update tld_inventory
@@ -1055,6 +1063,14 @@
         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>
+    <!--查询删除信息-->
+    <select id="getOtherReceivingGoods" resultType="java.util.Map">
+        select * from tld_notices where id = #{id}
+    </select>
+    <!--查询删除信息-->
+    <select id="getOtherShipments" resultType="java.util.Map">
+        select * from tld_enquiry where id = #{id}
+    </select>
     <!-- 往单据上增加数量 -->
     <update id="updateNoticesWarehousingNum">
         update tld_notices set warehousing_num = #{amount} where notice_id = #{noticeId} and entry_number = #{entryNumber}