zhs 2 年 前
コミット
bf358fcc11

+ 13 - 0
src/main/java/com/tld/controller/AskGoodsController.java

@@ -3,6 +3,7 @@ package com.tld.controller;
 import com.tld.model.AskGoods;
 import com.tld.model.ReceiveGoods;
 import com.tld.service.AskGoodsService;
+import com.tld.util.PassToken;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
@@ -197,4 +198,16 @@ public class AskGoodsController {
         return askGoodsService.delAskGoods(id, request);
     }
 
+    @GetMapping("test")
+    @PassToken
+    public void test(){
+        askGoodsService.test();
+    }
+
+
+    @GetMapping("testTwo")
+    @PassToken
+    public void testTwo(){
+        askGoodsService.testTwo();
+    }
 }

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

@@ -76,7 +76,7 @@ public interface AskGoodsMapper {
 
     void delAskGoodsVitrual(@Param("id")String id, @Param("type")String type);
 
-    void updateOutNum(@Param("num")String num, @Param("askGoodsId")String askGoodsId, @Param("materialId")String materialId);
+    void updateOutNum(@Param("num")String num, @Param("askGoodsId")String askGoodsId, @Param("materialId")String materialId, @Param("entryNumber")String entryNumber);
 
     String getScanNum(AskGoods askGoods);
 

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

@@ -22,7 +22,7 @@ public interface DeliveryMapper {
 
     int getVitrual(Inventory inventory);
 
-    void updateDelivery(@Param("materialId")String materialId, @Param("num")String num, @Param("deliveryId")String deliveryId);
+    void updateDelivery(@Param("materialId")String materialId, @Param("num")String num, @Param("deliveryId")String deliveryId, @Param("entryNumber")String entryNumber);
 
     void addRemovalHalf(Delivery delivery1);
 

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

@@ -72,7 +72,7 @@ public interface InviteMapper {
 
     String getScanNum(AskGoods askGoods1);
 
-    void updateOutNum(String num, String askGoodsId, String materialId);
+    void updateOutNum(@Param("num")String num, @Param("askGoodsId")String askGoodsId, @Param("materialId")String materialId, @Param("entryNumber")String entryNumber);
 
     void addNotice(List<Map<String, Object>> List);
 

+ 4 - 0
src/main/java/com/tld/mapper/QueryListMapper.java

@@ -86,5 +86,9 @@ public interface QueryListMapper {
 
     Integer getDeliverySum(@Param("format") String format, @Param("nameType") String nameType);
 
+    List<Map<String, Object>> storageLocationNum(Inventory inventory);
+
+    List<Map<String, Object>> getTestTwo();
+
     List<Map<String, Object>> getPdaTask(User user);
 }

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

@@ -58,5 +58,9 @@ public interface AskGoodsService {
 
     void CreateOtherDeliveryMaterial(String removalCode, String realName);
 
+    void test();
+
+    void testTwo();
+
     Map<String, Object> getRemovalHalfUpdSerial(AskGoods askGoods);
 }

+ 53 - 4
src/main/java/com/tld/service/impl/AskGoodsServiceImpl.java

@@ -143,7 +143,7 @@ public class AskGoodsServiceImpl implements AskGoodsService {
                         .setCompanyCode(askGoods1.getCompanyNumber())
                         .setGroupBy(askGoods.getGroupBy());
                 List<Map<String, Object>> inventorVal = queryListMapper.storageLocation(inventory);
-                if(inventorVal.size() != 0){
+                if(inventorVal.size() != 0) {
                     mapVal.add(inventorVal.get(0).get("sum").toString());
                 } else {
                     mapVal.add("0");
@@ -245,7 +245,9 @@ public class AskGoodsServiceImpl implements AskGoodsService {
                 askGoods.setCompanyNumber(askGoods.getAccountSleeve());
                 Inventory inventory = askGoodsMapper.getInventory(askGoods);
                 if(inventory == null){
-                    throw new Exception("库存不存在");
+//                    throw new Exception("库存不存在");
+                    System.out.println("库存不存在");
+                    continue;
                 }
                 //如果出库库存等于虚拟表库存则删除此库存
                 if(Double.parseDouble(askGoods.getNum()) == Double.parseDouble(inventory.getAmount())){
@@ -267,7 +269,7 @@ public class AskGoodsServiceImpl implements AskGoodsService {
                 askGoodsMapper.addRemoval(askGoods);//插入出库流水
                 askGoodsMapper.deleteVirtual(askGoods.getId());//删除已出虚拟表库存
                 askGoodsMapper.addReturnGsRemoval(returRemoval);//新增返回gs数据子表信息
-                askGoodsMapper.updateOutNum(askGoods.getNum(), askGoodsId, materialId);//修改出库数量
+                askGoodsMapper.updateOutNum(askGoods.getNum(), askGoodsId, materialId, askGoods.getEntryNumber());//修改出库数量
             }
             //查询要货单父级信息
             AskGoods askGoods3 = askGoodsMapper.getAskDetailedF(askGoodsId);
@@ -650,7 +652,7 @@ public class AskGoodsServiceImpl implements AskGoodsService {
                 return map;
             }
             //如果出库库存等于虚拟表库存则删除此库存
-            if(Double.parseDouble(askGoods.getNum()) == Double.parseDouble(inventory.get(0).getAmount())){
+            if(Double.doubleToLongBits(Double.parseDouble(askGoods.getNum())) == Double.doubleToLongBits(Double.parseDouble(inventory.get(0).getAmount()))){
                 askGoodsMapper.deleteInventory(inventory.get(0));
             } else {
                 inventory.get(0).setAmount(askGoods.getNum());
@@ -1535,6 +1537,53 @@ public class AskGoodsServiceImpl implements AskGoodsService {
         return map;
     }
 
+    @Override
+    public void test() {
+        AskGoods askGoods = new AskGoods();
+        List<AskGoods> list = askGoodsMapper.getAskGoodsMaterial(askGoods);
+        for(AskGoods askGoods1 : list) {
+            Inventory inventory = new Inventory()
+                    .setMaterialId(askGoods1.getMaterialId())
+                    .setCompanyCode(askGoods1.getCompanyNumber())
+                    .setAmount(askGoods1.getNum())
+                    .setWbs(askGoods1.getWbs());
+            List<Map<String, Object>> list1 = queryListMapper.storageLocationNum(inventory);
+            if(list1.size() == 0){
+                continue;
+            }
+            String aaa = "8130";
+            String bbb = "000000";
+            if(askGoods1.getCompanyNumber().equals("8400")){
+                aaa = "8400";
+                bbb = "100000";
+            }
+            AskGoods askGoods2 = new AskGoods().setUniqueCode("1111")
+                    .setSupplierId("EC13437")
+                    .setSerial(bbb)
+                    .setWllbCode(list1.get(0).get("code").toString())
+                    .setProducDate("20230425")
+                    .setAskGoodsId(askGoods1.getAskGoodsId())
+                    .setType("计划出库")
+                    .setStorageLocationCode(list1.get(0).get("storageLocationCode").toString())
+                    .setNum(askGoods1.getNum())
+                    .setUserId("27")
+                    .setDepartment("000300020001")
+                    .setCompanyNumber(askGoods1.getCompanyNumber())
+                    .setWbs(askGoods1.getWbs())
+                    .setEntryNumber(askGoods1.getEntryNumber());
+            askGoodsMapper.addAskGoodsVitrual(askGoods2);
+        }
+    }
+
+    @Override
+    public void testTwo() {
+        List<Map<String, Object>> list1 = queryListMapper.getTestTwo();
+        for(Map<String, Object> map : list1){
+            Map<String, Object> map1 = OutOfLibrary("1111", "计划出库", map.get("ask_goods_id").toString());
+            plugOutRemoval(map1.get("data").toString(), "王孝苗");
+        }
+    }
+
     /**
      * 出库单生成
      * @return

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

@@ -169,7 +169,7 @@ public class DeliveryServiceImpl implements DeliveryService {
                 Delivery delivery = new Delivery().setDeliveryId(deliveryId).setMaterialId(materialClass.getTldId())
                         .setEntryNumber(askGoods.getEntryNumber());
                 List<Delivery> list = deliveryMapper.getDelivery(delivery);
-                deliveryMapper.updateDelivery(materialClass.getTldId(), askGoods.getNum(), deliveryId); //修改销售单出库数量
+                deliveryMapper.updateDelivery(materialClass.getTldId(), askGoods.getNum(), deliveryId, askGoods.getEntryNumber()); //修改销售单出库数量
                 if(materialClass.getPartType().equals("产成品")){
                     //产成品销售流水
                     Delivery delivery1 = new Delivery()

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

@@ -175,7 +175,7 @@ public class InviteServiceImpl implements InviteService {
                 inviteMapper.addRemoval(askGoods);//插入出库流水
                 inviteMapper.deleteVirtual(askGoods.getId());//删除已出虚拟表库存
                 inviteMapper.addReturnGsRemoval(returRemoval);//新增返回gs数据子表信息
-                inviteMapper.updateOutNum(askGoods.getNum(), askGoodsId, materialId);//修改出库数量
+                inviteMapper.updateOutNum(askGoods.getNum(), askGoodsId, materialId, askGoods.getEntryNumber());//修改出库数量
             }
             //查询要货单父级信息
             AskGoods askGoods3 = inviteMapper.getAskDetailedF(askGoodsId);

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

@@ -127,10 +127,10 @@ public class ReceiveGoodsSerivceImpl implements ReceiveGoodsSerivce {
                    //采购单日志
                    receiveGoodsMapper.addReceiveGoodsLog(receiveGoods);
                }
-               //新增日志
-               Access access = new Access().setType("质检信息").setData(JSON.toJSONString(jsonData)).setAccessType("0");
-               dictionaryMapper.addAccess(access);
            }
+            //新增日志
+            Access access = new Access().setType("质检信息").setData(JSON.toJSONString(jsonData)).setAccessType("0");
+            dictionaryMapper.addAccess(access);
            map.put("status", "0000");
            map.put("msg","成功");
         } catch (Exception e) {

+ 6 - 1
src/main/resources/mapper/AskGoodsMapper.xml

@@ -85,7 +85,8 @@
                c.code,
                c.id                 AS departmentId,
                a.production_code,
-               a.wbs
+               a.wbs,
+               a.entry_number
         FROM tld_ask_goods a
         JOIN tld_ask_goods_f b ON a.ask_goods_id = b.ask_goods_id
         LEFT JOIN tld_department c ON b.department = c.code
@@ -599,6 +600,9 @@
         set out_num = ifnull(out_num, 0) + #{num}
         where material_id = #{materialId}
           and ask_goods_id = #{askGoodsId}
+        <if test="entryNumber != null and entryNumber != ''">
+            and entry_number = #{entryNumber}
+        </if>
     </update>
     <!-- 查询指定pda 指定物料扫描总数 -->
     <select id="getScanNum" resultType="String">
@@ -607,6 +611,7 @@
         where unique_code = #{uniqueCode}
           and ask_goods_id = #{askGoodsId}
           and wllb_code = #{wllbCode}
+          and entry_number = #{entryNumber}
     </select>
     <!-- 查询半成品出库数据 -->
     <select id="getGoodsHalf" resultType="com.tld.model.AskGoods">

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

@@ -150,7 +150,7 @@
     </select>
     <!-- 修改销售单出库数量 -->
     <update id="updateDelivery">
-        update tld_delivery set out_num = (out_num + 0) + #{num} where delivery_id = #{deliveryId} and material_id = #{materialId}
+        update tld_delivery set out_num = (out_num + 0) + #{num} where delivery_id = #{deliveryId} and material_id = #{materialId} and entry_number = #{entryNumber}
     </update>
     <!-- 产成品出库流水 -->
     <insert id="addRemovalHalf">

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

@@ -71,7 +71,8 @@
             c.name ,
             c.code,
             c.id AS departmentId,
-            a.wbs
+            a.wbs,
+            a.entry_number
         FROM
             tld_invite a
             JOIN tld_invite_f b ON a.ask_goods_id = b.ask_goods_id
@@ -85,7 +86,7 @@
     <select id="getScanNum" resultType="String">
         select if(sum(num) is null, 0, sum(num))
         from tld_ask_goods_vitrual
-        where unique_code = #{uniqueCode} and ask_goods_id = #{askGoodsId}
+        where unique_code = #{uniqueCode} and ask_goods_id = #{askGoodsId} and entry_number = #{entryNumber}
     </select>
     <!-- 物料库位选择 -->
     <select id="getMaterialCk" resultType="com.tld.model.Inventory">
@@ -566,6 +567,9 @@
     <update id="updateOutNum">
         update tld_invite
         set out_num = ifnull(out_num,0) + #{num} where material_id = #{materialId} and ask_goods_id = #{askGoodsId}
+        <if test="entryNumber != null and entryNumber != ''">
+            and entry_number = #{entryNumber}
+        </if>
     </update>
     <!--修改交货单状态-->
     <update id="updStatus">

+ 89 - 0
src/main/resources/mapper/QueryListMappeer.xml

@@ -152,6 +152,7 @@
     <!-- 查询库位信息 -->
     <select id="getQueryInventory" resultType="java.util.Map">
         SELECT
+            a.id,
             a.storage_location_code as storageLocationCode,
             a.material_id as materialId,
             a.amount AS sum,
@@ -181,6 +182,15 @@
             <if test="materialId != null and materialId != ''">
                 and a.material_id = #{materialId}
             </if>
+            <if test="wbs != null and wbs != ''">
+                and a.wbs = #{wbs}
+            </if>
+            <if test="companyCode != null and companyCode != ''">
+                and a.account_sleeve = #{companyCode}
+            </if>
+            <if test="amount != null and amount != ''">
+                and (a.amount + 0) <![CDATA[>]]> #{amount}
+            </if>
         </trim>
     </select>
     <!--导出-->
@@ -1251,4 +1261,83 @@
         </trim>
         ORDER BY a.id DESC
     </select>
+
+    <select id="storageLocationNum" resultType="java.util.Map">
+        SELECT
+        a.id,
+        YEAR(CURDATE()) AS year,
+        MONTH(CURDATE()) AS month,
+        f.code as warehouseCode,
+        f.name as warehouseName,
+        b.storage_location_name as storageLocationName,
+        c.code as code,
+        c.name as name,
+        m.name as unitOfMeasurement,
+        a.amount AS sum,
+        a.wbs as wbs,
+        c.max_num as maxNum,
+        DATEDIFF(now(), scrq) as day,
+        c.part_type as partType,
+        c.wllb_class as wllbClass,
+        p.code as companyCode,
+        p.name as companyName,
+        a.account_sleeve as accountSleeve,
+        a.supplier_id as supplierId,
+        e.name as supplierName,
+        a.storage_location_code as storageLocationCode
+        FROM
+        tld_inventory a
+        LEFT JOIN tld_storage_location b ON a.storage_location_code = b.storage_location_code
+        LEFT JOIN tld_material c ON a.material_id = c.tld_id
+        LEFT JOIN tld_customer e ON a.supplier_id = e.code
+        LEFT JOIN tld_warehouse f on b.warehouse_where = f.tld_id
+        LEFT JOIN tld_company p on a.account_sleeve = p.code
+        LEFT JOIN tld_measurement m on c.unit_of_measurement = m.tld_id
+        <trim prefix="WHERE" prefixOverrides="and |or">
+            <if test="storageLocationCode != null and storageLocationCode != ''">
+                and a.storage_location_code = #{storageLocationCode}
+            </if>
+            <if test="materialId != null and materialId != ''">
+                and a.material_id = #{materialId}
+            </if>
+            <if test="wllbCode != null and wllbCode != ''">
+                and c.code like CONCAT(CONCAT('%', #{wllbCode}), '%')
+            </if>
+            <if test="materialName != null and materialName != ''">
+                and c.name like CONCAT(CONCAT('%', #{materialName}), '%')
+            </if>
+            <if test="storageLocationName != null and storageLocationName != ''">
+                and b.storage_location_name like CONCAT(CONCAT('%', #{storageLocationName}), '%')
+            </if>
+            <if test="companyName != null and companyName != ''">
+                and p.name like CONCAT(CONCAT('%', #{companyName}), '%')
+            </if>
+            <if test="companyCode != null and companyCode != ''">
+                and p.code = #{companyCode}
+            </if>
+            <if test="supplierId != null and supplierId != ''">
+                and a.supplier_id like CONCAT(CONCAT('%', #{supplierId}), '%')
+            </if>
+            <if test="wbs != null and wbs != ''">
+                and a.wbs like CONCAT(CONCAT('%', #{wbs}), '%')
+            </if>
+            <if test="warehouseId != null and warehouseId != ''">
+                and f.tld_id = #{warehouseId}
+            </if>
+            <if test="partType != null and partType != ''">
+                and c.part_type = #{partType}
+            </if>
+            <if test="wllbClass != null and wllbClass != ''">
+                and c.wllb_class = #{wllbClass}
+            </if>
+            <if test="unitOfMeasurement != null and unitOfMeasurement != ''">
+                and c.unit_of_measurement = #{unitOfMeasurement}
+            </if>
+                and (a.amount + 0) <![CDATA[>]]> (#{amount} + 0)
+        </trim>
+    </select>
+
+    <select id="getTestTwo" resultType="java.util.Map">
+        select DISTINCT ask_goods_id from tld_ask_goods_vitrual
+    </select>
 </mapper>