zhs il y a 2 ans
Parent
commit
1bbc3d6575

+ 18 - 0
src/main/java/com/tld/controller/ReceiveGoodsController.java

@@ -38,6 +38,24 @@ public class ReceiveGoodsController {
         return receiveGoodsSerivce.getPastReceiveGoods(receiveGoods);
     }
 
+    /**
+     * 查询采购单
+     * @param receiveGoods 参数
+     * @return 返回结果
+     */
+    @GetMapping("getPurchase")
+    public Map<String, Object> getPurchase(ReceiveGoods receiveGoods){
+        return receiveGoodsSerivce.getPurchase(receiveGoods);
+    }
 
+    /**
+     * 查询超时采购单
+     * @param receiveGoods 参数
+     * @return 返回结果
+     */
+    @GetMapping("timeoutPurchase")
+    public Map<String, Object> timeoutPurchase(ReceiveGoods receiveGoods){
+        return receiveGoodsSerivce.timeoutPurchase(receiveGoods);
+    }
 
 }

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

@@ -25,4 +25,8 @@ public interface ReceiveGoodsMapper {
     void addPurchase(List<Map<String, Object>> jsonData);
 
     void updatePurchaseType(ReceiveGoods receiveGoods);
+
+    List<ReceiveGoods> getPurchase(ReceiveGoods receiveGoods);
+
+    List<ReceiveGoods> timeoutPurchase(ReceiveGoods receiveGoods);
 }

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

@@ -106,4 +106,6 @@ public interface WarehousingMapper {
     String getStorageLocationCode(@Param("attribute")String attribute, @Param("symbol")String symbol);
 
     int getCountStorage(@Param("attribute")String attribute, @Param("storageLocationCode")String storageLocationCode, @Param("symbol")String symbol);
+
+    void updateStorage(WarehousingVirtual warehousingVirtual1);
 }

+ 8 - 0
src/main/java/com/tld/model/AskGoods.java

@@ -188,4 +188,12 @@ public class AskGoods implements Serializable {
      * 公司名称
      */
     private String companyName;
+    /**
+     * 入库单号
+     */
+    private String storageCode;
+    /**
+     * 所属公司
+     */
+    private String accountSleeve;
 }

+ 5 - 0
src/main/java/com/tld/model/ReceiveGoods.java

@@ -115,4 +115,9 @@ public class ReceiveGoods implements Serializable {
      * 入库数量
      */
     private String warehousingNum;
+    /**
+     * 物料code
+     */
+    private String wllbCode;
+
 }

+ 1 - 0
src/main/java/com/tld/model/WarehousingVirtual.java

@@ -140,4 +140,5 @@ public class WarehousingVirtual implements Serializable {
      * 移库通知单id
      */
     private String warehouseTransferId;
+
 }

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

@@ -17,4 +17,8 @@ public interface ReceiveGoodsSerivce {
     Map<String, Object> addReceiveGoodsConfirm(ReceiveGoods receiveGoods);
 
     Map<String, Object> addPurchase(List<Map<String, Object>> jsonData);
+
+    Map<String, Object> getPurchase(ReceiveGoods receiveGoods);
+
+    Map<String, Object> timeoutPurchase(ReceiveGoods receiveGoods);
 }

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

@@ -121,6 +121,7 @@ public class AskGoodsServiceImpl implements AskGoodsService {
             for(AskGoods askGoods1 : list){
                 askGoods1.setUniqueCode(askGoods.getUniqueCode());
                 askGoods1.setAskGoodsId(askGoods.getAskGoodsId());
+                askGoods1.setWllbCode(askGoods1.getMaterialCode());
                 scanNum.add(askGoodsMapper.getScanNum(askGoods1));//扫描总数
             }
             map.put("scanNum", scanNum);
@@ -201,8 +202,11 @@ public class AskGoodsServiceImpl implements AskGoodsService {
         RLock lock = redissonClient.getLock(uniqueCode);
         lock.lock();
         try{
+            //出库流水
+            String removalCode = codeGenerateCk();
             List<AskGoods> list = askGoodsMapper.getVirtualUniqueCode(uniqueCode, type, askGoodsId);
             for(AskGoods askGoods : list){
+                askGoods.setStorageCode(removalCode);
                 Inventory inventory = askGoodsMapper.getInventory(askGoods);
                 if(inventory == null){
                     throw new Exception("库存不存在");
@@ -231,7 +235,6 @@ public class AskGoodsServiceImpl implements AskGoodsService {
             }
             //查询要货单父级信息
             AskGoods askGoods3 = askGoodsMapper.getAskDetailedF(askGoodsId);
-            String removalCode = codeGenerateCk();
             ReturRemoval returRemoval1 = new ReturRemoval()
                     .setDocumentId(askGoods3.getAskGoodsId())
                     .setRemovalCode(removalCode)

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

@@ -129,7 +129,9 @@ public class InviteServiceImpl implements InviteService {
         lock.lock();
         try{
             List<AskGoods> list = inviteMapper.getVirtualUniqueCode(uniqueCode, type, askGoodsId);
+            String removalCode = codeGenerateCk();
             for(AskGoods askGoods : list){
+                askGoods.setStorageCode(removalCode);
                 Inventory inventory = inviteMapper.getInventory(askGoods);
                 if(inventory == null){
                     throw new Exception("库存不存在");
@@ -158,7 +160,6 @@ public class InviteServiceImpl implements InviteService {
             }
             //查询要货单父级信息
             AskGoods askGoods3 = inviteMapper.getAskDetailedF(askGoodsId);
-            String removalCode = codeGenerateCk();
             ReturRemoval returRemoval1 = new ReturRemoval()
                     .setDocumentId(askGoods3.getAskGoodsId())
                     .setRemovalCode(removalCode)

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

@@ -42,11 +42,18 @@ public class QueryListServiceImpl implements QueryListService {
         try{
             List<Map<String, Object>> mapList = new LinkedList<>();
             PageHelper.startPage(page, limit);
-            PageInfo<Map<String, Object>> list = new PageInfo<>(queryListMapper.getMaterial(wllbCode));
-            for(Map<String, Object> data : list.getList()){
-                mapList.add(queryListMapper.reserveWarning(data));
+            List<Map<String, Object>> list = queryListMapper.getMaterial(wllbCode);
+            for(Map<String, Object> data : list){
+                Map<String, Object> map1 = queryListMapper.reserveWarning(data);
+                map1.put("materialName", data.get("name"));
+                map1.put("wllbCode", data.get("code"));
+                if(Double.parseDouble(map1.get("minNum").toString()) > Double.parseDouble(map1.get("amount").toString())
+                || Double.parseDouble(map1.get("maxNum").toString()) < Double.parseDouble(map1.get("amount").toString())){
+                    mapList.add(map1);
+                }
             }
-            map.put("data", mapList);
+            PageInfo<Map<String, Object>> listVal = new PageInfo<>(mapList);
+            map.put("data", listVal);
             map.put("msg", "200");
         } catch (Exception e){
             e.printStackTrace();

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

@@ -146,4 +146,36 @@ public class ReceiveGoodsSerivceImpl implements ReceiveGoodsSerivce {
         }
         return map;
     }
+
+    @Override
+    public Map<String, Object> getPurchase(ReceiveGoods receiveGoods) {
+        Map<String, Object> map = new HashMap<>();
+        try{
+            PageHelper.startPage(receiveGoods.getPage(), receiveGoods.getLimit());
+            PageInfo<ReceiveGoods> pageInfo = new PageInfo<>(receiveGoodsMapper.getPurchase(receiveGoods));
+            map.put("data", pageInfo);
+            map.put("msg","200");
+        } catch (Exception e) {
+            e.printStackTrace();
+            map.put("status", "500");
+            map.put("msg", "服务器请求异常,请稍后再试");
+        }
+        return map;
+    }
+
+    @Override
+    public Map<String, Object> timeoutPurchase(ReceiveGoods receiveGoods) {
+        Map<String, Object> map = new HashMap<>();
+        try{
+            PageHelper.startPage(receiveGoods.getPage(), receiveGoods.getLimit());
+            PageInfo<ReceiveGoods> pageInfo = new PageInfo<>(receiveGoodsMapper.timeoutPurchase(receiveGoods));
+            map.put("data", pageInfo);
+            map.put("msg","200");
+        } catch (Exception e) {
+            e.printStackTrace();
+            map.put("status", "500");
+            map.put("msg", "服务器请求异常,请稍后再试");
+        }
+        return map;
+    }
 }

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

@@ -84,7 +84,9 @@ public class WarehouseTransferServiceImpl implements WarehouseTransferService {
             List<AskGoods> list = askGoodsMapper.getVirtualUniqueCode(uniqueCode, type, askGoodsId);
             //入库信息
             List<WarehousingVirtual> warehousing = new LinkedList<>();
+            String warehouseTransferCode = codeGenerateYK(); //移库单
             for(AskGoods askGoods : list){
+                askGoods.setStorageCode(warehouseTransferCode);
                 Inventory inventory = askGoodsMapper.getInventory(askGoods);
                 if(inventory == null){
                     throw new Exception("库存不存在");
@@ -109,7 +111,8 @@ public class WarehouseTransferServiceImpl implements WarehouseTransferService {
                         .setType(askGoods.getType())//入库类型
                         .setUserId(askGoods.getUserId())//用户
                         .setDepartmentId(askGoods.getDepartmentId())//部门
-                        .setStorageLocationCode(askGoods.getStorageLocationCode());//库位编号
+                        .setStorageLocationCode(askGoods.getStorageLocationCode())//库位编号
+                        .setStorageCode(warehouseTransferCode);//移库单号
                 warehousing.add(WarehousingVirtual1);
                 askGoodsMapper.addRemoval(askGoods);//插入出库流水
                 askGoodsMapper.deleteVirtual(askGoods.getId());//删除已出虚拟表库存
@@ -123,16 +126,15 @@ public class WarehouseTransferServiceImpl implements WarehouseTransferService {
                         .setOutNum(askGoods.getNum()); //出库数量
                 warehouseTransferMapper.addReturnGsWarehouseTransfer(warehouseTransfer1);//新增返回gs数据子表信息
             }
-            String warehouseTransfer = codeGenerateYK(); //移库单
             WarehouseTransfer warehouseTransferF = warehouseTransferMapper.getWarehouseTransferDetailedF(askGoodsId);//查询父表移库单申请
             WarehouseTransfer warehouseTransfer1 = new WarehouseTransfer()
                     .setWarehouseTransferId(warehouseTransferF.getWarehouseTransferId()) //移库单id
-                    .setWarehouseTransferCode(warehouseTransfer)//移库单编号
+                    .setWarehouseTransferCode(warehouseTransferCode)//移库单编号
                     .setAskGoodsWarehouseId(warehouseTransferF.getAskGoodsWarehouseId()) //要货仓库id
                     .setWarehouseTransferType(warehouseTransferF.getWarehouseTransferType()); //移库类型
             warehouseTransferMapper.addReturnGsWarehouseTransferF(warehouseTransfer1);//新增返回gs数据子表信息
             warehousingMapper.addStorage(warehousing);//入库流水
-            map.put("data", warehouseTransfer);
+            map.put("data", warehouseTransferCode);
             map.put("msg", "200");
         }catch (Exception e){
             e.printStackTrace();

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

@@ -197,6 +197,8 @@ public class WarehousingServiceImpl implements WarehousingService {
                         receiveGoods1.setWarehousingNum(String.valueOf(surplusNum));
                         warehousingMapper.updateReceiveGood(receiveGoods1);
                         //存入给gs的返回数据
+                        String code = codeGenerateRk();
+                        warehousingVirtual1.setStorageCode(code);
                         ReturnWarehousing returnWarehousing = new ReturnWarehousing()
                                 .setWarehousingNum(receiveGoods1.getWarehousingNum())
                                 .setGsCk(warehousingVirtual1.getGsCk())
@@ -206,11 +208,12 @@ public class WarehousingServiceImpl implements WarehousingService {
                                 .setWbs(receiveGoods1.getWbs())
                                 .setId(receiveGoods1.getId())
                                 .setMaterialId(receiveGoods1.getMaterialId())
-                                .setStorageCode(codeGenerateRk())
+                                .setStorageCode(code)
                                 .setOrderNumber(receiveGoods1.getOrderNumber())
                                 .setUserName(warehousingVirtual1.getUserName())
                                 .setStorageLocationCode(warehousingVirtual1.getStorageLocationCode());
                         warehousingMapper.addReturnWarehousing(returnWarehousing);
+                        warehousingMapper.updateStorage(warehousingVirtual1);//增加入库编号
                         //判断是否有已存在的采购单号
                         if(!stringBuilder.toString().contains(receiveGoods1.getOrderNumber() + ",")){
                             stringBuilder.append(receiveGoods1.getOrderNumber() + ",");
@@ -377,17 +380,18 @@ public class WarehousingServiceImpl implements WarehousingService {
             } else {
                 warehousingMapper.addInventoryNotice(notice);
             }
+            //存入给gs的返回数据
+            String storageCode = codeGenerateRk();
             //入库流水
             WarehousingVirtual warehousingVirtual = new WarehousingVirtual()
                     .setWllbCode(notice1.getMaterialCode())
                     .setUserId(notice.getUserId())
                     .setStorageLocationCode("000000")
                     .setProducDate(notice1.getNoticeTime())
-                    .setNum(notice.getWarehousingNum());
+                    .setNum(notice.getWarehousingNum())
+                    .setStorageCode(storageCode);
             warehousingMapper.addProduct(warehousingVirtual);//入库流水 半成品
 
-            //存入给gs的返回数据
-            String storageCode = codeGenerateRk();
             ReturnWarehousing returnWarehousing = new ReturnWarehousing()
                     .setStorageCode(storageCode)//入库编号
                     .setSourceType(notice1.getSourceType())//来源类型
@@ -448,16 +452,17 @@ public class WarehousingServiceImpl implements WarehousingService {
                 warehousingMapper.updateInventoryNoticeNum(notice);
             }
             warehousingMapper.updateAskGoodsHalf(askGoods.getId(), notice.getWarehousingNum());//修改要货单出库数量
+            //新增返回gs信息
+            String removalCode = codeGenerateCk();
             //新增半成品出库流水
             AskGoods askGoods1 = new AskGoods()
                     .setWllbCode(notice.getWllbCode())
                     .setNum(notice.getWarehousingNum())
                     .setUserId(notice.getUserId())
                     .setAskGoodsId(askGoods.getAskGoodsId())
-                    .setDepartment(askGoods.getDepartment());//新增出库流水
+                    .setDepartment(askGoods.getDepartment())
+                    .setStorageCode(removalCode);//新增出库流水
             warehousingMapper.addRemovalHalfProduct(askGoods1);
-            //新增返回gs信息
-            String removalCode = codeGenerateCk();
             ReturRemoval returRemoval = new ReturRemoval()
                     .setMaterialId(notice.getMaterialId())
                     .setDocumentId(notice.getAskGoodsId())

+ 13 - 10
src/main/resources/mapper/AskGoodsMapper.xml

@@ -37,7 +37,8 @@
         select
                DISTINCT a.ask_goods_id,
                a.ask_goods_code,
-               b.name as departmentName
+               b.name as departmentName,
+               a.company_number
         from tld_ask_goods_f a
         join tld_ask_goods d on a.ask_goods_id = d.ask_goods_id
         left join tld_department b on a.department = b.tld_id
@@ -82,12 +83,12 @@
             b.storage_location_name as storageLocationName
         from tld_inventory a
         join tld_storage_location b on a.storage_location_code = b.storage_location_code
-        where a.material_id = #{materialId} and a.hold = '0' and b.warehouse_where != '5000' order by a.produc_date
+        where a.material_id = #{materialId} and a.account_sleeve = #{companyNumber} and a.hold = '0' and b.warehouse_where != '5000' order by a.produc_date
     </select>
     <!-- 新增出库虚拟表 -->
     <insert id="addAskGoodsVitrual">
-        insert into tld_ask_goods_vitrual(unique_code,supplier_id,serial,wllb_code,produc_date,ask_goods_id,type,storage_location_code,num,user_id,department,attribute)
-        values(#{uniqueCode},#{supplierId},#{serial},#{wllbCode},#{producDate},#{askGoodsId},#{type},#{storageLocationCode},#{num},#{userId},#{department},#{attribute})
+        insert into tld_ask_goods_vitrual(unique_code,supplier_id,serial,wllb_code,produc_date,ask_goods_id,type,storage_location_code,num,user_id,department,attribute,account_sleeve)
+        values(#{uniqueCode},#{supplierId},#{serial},#{wllbCode},#{producDate},#{askGoodsId},#{type},#{storageLocationCode},#{num},#{userId},#{department},#{attribute},#{companyNumber})
     </insert>
     <!-- 查询指定库存内容 -->
     <select id="getInventory" resultType="com.tld.model.Inventory">
@@ -186,8 +187,8 @@
     </delete>
     <!-- 插入出库流水 -->
     <insert id="addRemoval">
-        insert into tld_removal(wllb_code,supplier_id,serial,num,type,user_id,storage_location_code,scrq,process,ask_goods_id,produc_date,department)
-        values(#{wllbCode},#{supplierId},#{serial},#{num},#{type},#{userId},#{storageLocationCode},now(),#{process},#{askGoodsId},#{producDate},#{department})
+        insert into tld_removal(wllb_code,supplier_id,serial,num,type,user_id,storage_location_code,scrq,process,ask_goods_id,produc_date,department,storage_code)
+        values(#{wllbCode},#{supplierId},#{serial},#{num},#{type},#{userId},#{storageLocationCode},now(),#{process},#{askGoodsId},#{producDate},#{department},#{storageCode})
     </insert>
     <!-- 查询指定物料类型的id -->
     <select id="getMaterialId" resultType="String">
@@ -357,7 +358,7 @@
     <select id="getScanNum" resultType="String">
         select if(AVG(num) is null, 0, 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 wllb_code = #{wllbCode}
     </select>
     <!-- 查询半成品出库数据 -->
     <select id="getGoodsHalf" resultType="com.tld.model.AskGoods">
@@ -403,7 +404,8 @@
             a.ask_goods_id,
             c.name as department,
             b.name as materialName,
-            e.user_name as userName
+            e.user_name as userName,
+            b.code as materialCode
         from tld_removal_half_product a
         left join tld_material b on a.wllb_code = b.code
         left join tld_department c on a.department = c.tld_id
@@ -457,7 +459,8 @@
             b.name as materialName,
             c.user_name as userName,
             e.name as customerName,
-            f.name as companyName
+            f.name as companyName,
+            b.code as materialCode
         from tld_removal_half a
         left join tld_material b on a.wllb_code = b.code
         left join tld_user c on a.user_id = c.id
@@ -521,7 +524,7 @@
             scrq,
             produc_batch,
             attribute
-        from tld_inventory where storage_location_code = #{storageLocationCode} and material_id = #{materialId} and amount <![CDATA[>=]]> #{num}
+        from tld_inventory where storage_location_code = #{storageLocationCode} and material_id = #{materialId} and account_sleeve = #{accountSleeve} and amount <![CDATA[>=]]> #{num}
         <if test="wbs != '' and wbs != null">
             and wbs = #{wbs}
         </if>

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

@@ -42,7 +42,8 @@
         select
             a.ask_goods_id,
             a.ask_goods_code,
-            b.name as departmentName
+            b.name as departmentName,
+            a.company_number
         from tld_invite_f a
         left join tld_department b on a.department = b.tld_id
         order by a.sqrq desc
@@ -90,7 +91,7 @@
             b.storage_location_name as storageLocationName
         from tld_inventory a
         join tld_storage_location b on a.storage_location_code = b.storage_location_code
-        where a.material_id = #{materialId} and a.hold = '0' and b.warehouse_where != '5000' order by a.produc_date
+        where a.material_id = #{materialId} and a.account_sleeve = #{companyNumber} and a.hold = '0' and b.warehouse_where != '5000' order by a.produc_date
     </select>
     <!-- 新增出库虚拟表 -->
     <insert id="addAskGoodsVitrual">

+ 2 - 1
src/main/resources/mapper/MaterialClassMapper.xml

@@ -9,7 +9,8 @@
             a.storage_location_code,
             b.storage_location_name as storageLocationName,
             c.name as wllbName,
-            a.id
+            a.id,
+            c.code as wllbCode
        from tld_material_class a
        left join tld_storage_location b on a.storage_location_code = b.storage_location_code
        left join tld_material c on a.wllb_code = c.tld_id

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

@@ -11,7 +11,8 @@
            a.scrq as scrq,
            a.storage_location_code as storageLocationCode,
            b.name as materialName,
-           c.storage_location_name as storageLocationName
+           c.storage_location_name as storageLocationName,
+           b.code as wllbCode
        FROM tld_inventory a
        JOIN tld_material b ON a.material_id = b.tld_id
        LEFT JOIN  tld_storage_location c ON a.storage_location_code = c.storage_location_code
@@ -29,7 +30,8 @@
             tld_id as tldId,
             min_num as minNum,
             max_num as maxNum,
-            name as name
+            name as name,
+            code as code
         from tld_material
         <trim prefix="WHERE" prefixOverrides="and |or">
             <if test="wllbCode != null and wllbCode != ''">
@@ -42,7 +44,6 @@
         SELECT
             ifnull(sum( a.amount ), 0) as amount,
             ${tldId} as materialId,
-            ${name} AS materialName,
             ${minNum} as minNum,
             ${maxNum} as maxNum
         FROM tld_inventory a

+ 60 - 1
src/main/resources/mapper/ReceiveGoodsMapper.xml

@@ -14,7 +14,8 @@
             a.type,
             a.qualified_num,
             a.disqualification_num,
-            a.arrival_time
+            a.arrival_time,
+            c.code as wllbCode
         from tld_receive_goods a
         left join tld_material b on a.material_id = b.tld_id
         left join tld_customer c on a.supplier_id = c.code
@@ -135,4 +136,62 @@
     <update id="updatePurchaseType">
         update tld_purchase set type = '1' where order_code = #{orderCode}
     </update>
+    <!-- 查询采购单 -->
+    <select id="getPurchase" resultType="com.tld.model.ReceiveGoods">
+        select
+            a.id,
+            a.supplier_id,
+            a.order_code,
+            a.material_id,
+            a.purchase_num as num,
+            a.arrival_num,
+            a.arrival_time,
+            a.type,
+            b.name as materialName,
+            b.code as wllbCode,
+            c.name as supplierName
+        from tld_purchase a
+        left join tld_material b on a.material_id = b.tld_id
+        left join tld_customer c on a.supplier_id = c.tld_id
+        <trim prefix="WHERE" prefixOverrides="and |or">
+            <if test="orderCode != null and orderCode != ''">
+                and a.order_code = #{orderCode}
+            </if>
+            <if test="startTime != null and startTime != ''">
+                and a.arrival_time <![CDATA[>=]]> #{startTime}
+            </if>
+            <if test="endTime != null and endTime != ''">
+                and a.arrival_time <![CDATA[<=]]> #{endTime}
+            </if>
+        </trim>
+    </select>
+    <!-- 查询超时采购单 -->
+    <select id="timeoutPurchase" resultType="com.tld.model.ReceiveGoods">
+        select
+            a.id,
+            a.supplier_id,
+            a.order_code,
+            a.material_id,
+            a.purchase_num as num,
+            a.arrival_num,
+            a.arrival_time,
+            a.type,
+            b.name as materialName,
+            b.code as wllbCode,
+            c.name as supplierName
+        from tld_purchase a
+        left join tld_material b on a.material_id = b.tld_id
+        left join tld_customer c on a.supplier_id = c.tld_id
+        where
+            a.arrival_time <![CDATA[<]]> CURRENT_DAT() and type = '0'
+        <if test="orderCode != null and orderCode != ''">
+            and a.order_code = #{orderCode}
+        </if>
+        <if test="startTime != null and startTime != ''">
+            and a.arrival_time <![CDATA[>=]]> #{startTime}
+        </if>
+        <if test="endTime != null and endTime != ''">
+            and a.arrival_time <![CDATA[<=]]> #{endTime}
+        </if>
+    </select>
 </mapper>

+ 14 - 8
src/main/resources/mapper/WarehousingMapper.xml

@@ -367,7 +367,7 @@
     </insert>
     <!-- 查询库存里是否存在半成品虚拟库位 -->
     <select id="getInventoryNotice" resultType="int">
-        select count(0) from tld_inventory where storage_location_code = #{storageLocationCode} and material_id = #{materialId}
+        select count(0) from tld_inventory where storage_location_code = #{storageLocationCode} and material_id = #{materialId} and account_sleeve = #{companyNumber}
     </select>
     <!-- 增加半成品/产成品虚拟库位数量 -->
     <update id="updateInventoryNotice">
@@ -376,7 +376,7 @@
     </update>
     <!-- 半成品出库库存查询 -->
     <select id="getHalfInventory" resultType="com.tld.model.Inventory">
-        select storage_location_code,wllb_class,material_id,amount from tld_inventory where storage_location_code = #{storageLocationCode} and material_id = #{materialId}
+        select storage_location_code,wllb_class,material_id,amount from tld_inventory where storage_location_code = #{storageLocationCode} and material_id = #{materialId} and account_sleeve = #{accountSleeve}
     </select>
     <!-- 删除库存信息 -->
     <delete id="delInventoryNotice">
@@ -388,8 +388,8 @@
     </update>
     <!-- 新增半成品入库流水 -->
     <insert id="addProduct">
-        insert into tld_half_product(wllb_code,produc_date,produc_batch,capacity,user_id,storage_location_code,scrq)
-        value(#{wllbCode},#{producDate},#{producDate},#{num},#{userId},#{storageLocationCode},now())
+        insert into tld_half_product(wllb_code,produc_date,produc_batch,capacity,user_id,storage_location_code,scrq,storage_code)
+        value(#{wllbCode},#{producDate},#{producDate},#{num},#{userId},#{storageLocationCode},now(),#{storageCode})
     </insert>
     <!-- 查询半成品入库流水-->
     <select id="getProduct" resultType="com.tld.model.Notice">
@@ -403,7 +403,8 @@
             c.user_name,
             a.storage_location_code,
             a.scrq,
-            b.name as materialName
+            b.name as materialName,
+            b.code as materialCode
         from tld_half_product a
         left join tld_material b on a.wllb_code = b.code
         left join tld_user c on a.user_id = c.id
@@ -471,8 +472,8 @@
     </update>
     <!-- 新增半成品流水 -->
     <insert id="addRemovalHalfProduct">
-        insert into tld_removal_half_product(wllb_code,num,user_id,scrq,ask_goods_id,department)
-        value(#{wllbCode},#{num},#{userId},now(),#{askGoodsId},#{department})
+        insert into tld_removal_half_product(wllb_code,num,user_id,scrq,ask_goods_id,department,storage_code)
+        value(#{wllbCode},#{num},#{userId},now(),#{askGoodsId},#{department},#{storageCode})
     </insert>
     <!-- 查询指定物料内容 -->
     <select id="getMaterial" resultType="com.tld.model.MaterialClass">
@@ -562,7 +563,8 @@
             a.seq,
             a.attribute,
             b.name as materialName,
-            c.user_name as userName
+            c.user_name as userName,
+            b.code as materialCode
         from tld_half a
         left join tld_material b on a.wllb_code = b.code
         left join tld_user c on a.user_id = c.id
@@ -643,4 +645,8 @@
         where attribute = #{attribute} and storage_location_code = #{storageLocationCode} and scrq <![CDATA[${symbol}]]> CURDATE()
         ORDER BY scrq desc LIMIT 1
     </select>
+    <!-- 增加流水入库编号 -->
+    <update id="updateStorage">
+        update tld_storage set storage_code = #{storageCode} where wllb_code = #{wllbCode} and supplier_id = #{suppId} and serial = #{serial} and produc_batch = #{producDate}
+    </update>
 </mapper>