Browse Source

问题修改

zhs 2 years ago
parent
commit
6d30229bed

+ 2 - 2
src/main/java/com/tld/controller/GsController.java

@@ -13,11 +13,11 @@ import org.springframework.web.bind.annotation.RestController;
 import java.util.Map;
 
 /**
- * gs接口
+ * gs接入接
  */
 @RestController
 @RequestMapping("gsPlugOut")
-public class GsController {
+public class GsAccessController {
     //收入货
     @Autowired
     private ReceiveGoodsSerivce receiveGoodsSerivce;

+ 27 - 0
src/main/java/com/tld/controller/GsPlugOutController.java

@@ -0,0 +1,27 @@
+package com.tld.controller;
+
+import com.tld.service.WarehousingService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * gs接出接口
+ */
+@RestController
+@RequestMapping("gsPlugOut")
+public class GsPlugOutController {
+    //入库
+    @Autowired
+    private WarehousingService warehousingService;
+
+    /**
+     * 入库回传
+     * @param orderNumber 参数
+     */
+    @GetMapping("plugOutWarehousing")
+    public void plugOutWarehousing(String orderNumber){
+        warehousingService.plugOutWarehousing(orderNumber);
+    }
+}

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

@@ -37,4 +37,7 @@ public class ReceiveGoodsController {
     public Map<String, Object> getPastReceiveGoods(ReceiveGoods receiveGoods){
         return receiveGoodsSerivce.getPastReceiveGoods(receiveGoods);
     }
+
+
+
 }

+ 31 - 2
src/main/java/com/tld/controller/WarehousingController.java

@@ -1,10 +1,11 @@
 package com.tld.controller;
 
+import com.tld.model.Storage;
 import com.tld.model.WarehousingVirtual;
 import com.tld.service.WarehousingService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
-
+import javax.servlet.http.HttpServletResponse;
 import java.util.Map;
 
 /**
@@ -40,6 +41,16 @@ public class WarehousingController {
         return warehousingService.addWarehousingVirtual(warehousingVirtual);
     }
 
+    /**
+     * 查询虚拟入库
+     * @param uniqueCode 参数
+     * @return 返回接结果
+     */
+    @PostMapping("getWarehousingVirtual")
+    public Map<String, Object> addWarehousingVirtual(String uniqueCode){
+        return warehousingService.getWarehousingVirtual(uniqueCode);
+    }
+
     /**
      * 删除虚拟数据
      * @param wllbCode 物料编号
@@ -56,9 +67,27 @@ public class WarehousingController {
      * @param uniqueCode 参数
      * @return 返回结果
      */
-    @PostMapping("warehousing")
+    @GetMapping("warehousing")
     public Map<String, Object> warehousing(String uniqueCode){
         return warehousingService.warehousing(uniqueCode);
     }
 
+    /**
+     * 查询入库流水
+     */
+    @GetMapping("warehousingFlowing")
+    public Map<String, Object> warehousingFlowing(Storage storage){
+        return warehousingService.warehousingFlowing(storage);
+    }
+
+    /**
+     * 导出流水
+     * @param storage
+     * @param response
+     */
+    @GetMapping("export")
+    public void userExport(Storage storage, HttpServletResponse response){
+        warehousingService.export(storage, response);
+    }
+
 }

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

@@ -16,4 +16,9 @@ public interface ReceiveGoodsMapper {
     void updateReceiveGoods(ReceiveGoods receiveGoods);
 
     void addReceiveGoodsLog(ReceiveGoods receiveGoods);
+
+    int getReceiveGoodsf(ReceiveGoods receiveGoods1);
+
+    void addReceiveGoodsf(ReceiveGoods receiveGoods);
+
 }

+ 23 - 4
src/main/java/com/tld/mapper/WarehousingMapper.java

@@ -1,9 +1,6 @@
 package com.tld.mapper;
 
-import com.tld.model.MaterialClass;
-import com.tld.model.ReceiveGoods;
-import com.tld.model.StorageLocation;
-import com.tld.model.WarehousingVirtual;
+import com.tld.model.*;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 
@@ -31,4 +28,26 @@ public interface WarehousingMapper {
     List<WarehousingVirtual> getVirtual(String uniqueCode);
 
     List<ReceiveGoods> getReceiveGoods(WarehousingVirtual warehousingVirtual);
+
+    void updateReceiveGood(ReceiveGoods receiveGoods1);
+
+    WarehousingVirtual getWlClass(WarehousingVirtual warehousingVirtual);
+
+    void addStorage(List<WarehousingVirtual> list);
+
+    void addInventory(List<WarehousingVirtual> list);
+
+    void delVirtual(String uniqueCode);
+
+    int getWarehousingCount();
+
+    void addReturnWarehousing(ReturnWarehousing returnWarehousing);
+
+    List<ReturnWarehousing> getPlugOutWarehousing(String orderNumber);
+
+    List<Storage> warehousingFlowing(Storage storage);
+
+    List<WarehousingVirtual> getWarehousingVirtual(String uniqueCode);
+
+    List<Map<String, Object>> export(Storage storage);
 }

+ 3 - 0
src/main/java/com/tld/model/Inventory.java

@@ -56,6 +56,9 @@ public class Inventory implements Serializable {
      * 所属公司
      */
     private String accountSleeve;
+    /**
+     * wbs
+     */
     private String wbs;
     /**
      * 供应商

+ 1 - 1
src/main/java/com/tld/model/ReceiveGoods.java

@@ -28,7 +28,7 @@ public class ReceiveGoods implements Serializable {
      */
     private String orderId;
     /**
-     * 訂單編號
+     * 訂單id
      */
     private String orderNumber;
     /**

+ 63 - 0
src/main/java/com/tld/model/ReturnWarehousing.java

@@ -0,0 +1,63 @@
+package com.tld.model;
+
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+
+/**
+ * 返回gs数据入库
+ */
+@Data
+@Accessors(chain = true)
+@SuppressWarnings("serial")
+public class ReturnWarehousing implements Serializable {
+    /**
+     * 主键
+     */
+    private String id;
+    /**
+     * 入库单编号
+     */
+    private String storageCode;
+    /**
+     * 仓库iid
+     */
+    private String gsCk;
+    /**
+     * 来源类型
+     */
+    private String sourceType;
+    /**
+     * 移动类型
+     */
+    private String moveType;
+    /**
+     * gs分录号
+     */
+    private String entryNumber;
+    /**
+     * wbs
+     */
+    private String wbs;
+    /**
+     * 物料id
+     */
+    private String materialId;
+    /**
+     * 入库数量
+     */
+    private String warehousingNum;
+    /**
+     * 分录单id
+     */
+    private String receiveGoodsId;
+    /**
+     * 生成日期
+     */
+    private String scrq;
+    /**
+     * 采购单id
+     */
+    private String orderNumber;
+}

+ 95 - 0
src/main/java/com/tld/model/Storage.java

@@ -0,0 +1,95 @@
+package com.tld.model;
+
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+
+/**
+ * 库位流水
+ */
+@Data
+@Accessors(chain = true)
+@SuppressWarnings("serial")
+public class Storage implements Serializable {
+    /**
+     * 主键
+     */
+    private String id;
+    /**
+     * 物料编号
+     */
+    private String wllbCode;
+    /**
+     * 供应商id
+     */
+    private String supplierId;
+    /**
+     * 供应商名称
+     */
+    private String supplierName;
+    /**
+     * 连翻号
+     */
+    private String serial;
+    /**
+     * 生产日期
+     */
+    private String producDate;
+    /**
+     * 生产批次
+     */
+    private String producBatch;
+    /**
+     * 容量
+     */
+    private String capacity;
+    /**
+     * 工序
+     */
+    private String process;
+    /**
+     * 序列号
+     */
+    private String seq;
+    /**
+     * 类型
+     */
+    private String type;
+    /**
+     * 用户id
+     */
+    private String userId;
+    /**
+     * 部门
+     */
+    private String departmentId;
+    /**
+     * 库位编号
+     */
+    private String storageLocationCode;
+    /**
+     * 入库日期
+     */
+    private String scrq;
+    /**
+     * 用户名称
+     */
+    private String userName;
+    /**
+     * 部门名称
+     */
+    private String departmentName;
+    /**
+     * 库位名称
+     */
+    private String storageLocationName;
+    /**
+     * 页数
+     */
+    private int page;
+    /**
+     * 条数
+     */
+    private int limit;
+}

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

@@ -76,4 +76,48 @@ public class WarehousingVirtual implements Serializable {
      * 所属账套
      */
     private String accountSleeve;
+    /**
+     * wbs
+     */
+    private String wbs;
+    /**
+     * 入库单号
+     */
+    private String storageCode;
+    /**
+     * 采购订单id
+     */
+    private String orderNumber;
+    /**
+     * 来源类型
+     */
+    private String sourceType;
+    /**
+     * 移动类型
+     */
+    private String moveType;
+    /**
+     * 仓库id
+     */
+    private String gsCk;
+    /**
+     * 库位名称
+     */
+    private String storageLocationName;
+    /**
+     * 页数
+     */
+    private int page;
+    /**
+     * 条数
+     */
+    private int limit;
+    /**
+     * 开始时间
+     */
+    private String startTime;
+    /**
+     * 结束时间
+     */
+    private String endTime;
 }

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

@@ -1,7 +1,9 @@
 package com.tld.service;
 
+import com.tld.model.Storage;
 import com.tld.model.WarehousingVirtual;
 
+import javax.servlet.http.HttpServletResponse;
 import java.util.Map;
 
 public interface WarehousingService {
@@ -12,4 +14,12 @@ public interface WarehousingService {
     Map<String, Object> delWarehousingVirtual(String wllbCode, String serial);
 
     Map<String, Object> warehousing(String uniqueCode);
+
+    void plugOutWarehousing(String orderNumber);
+
+    Map<String, Object> warehousingFlowing(Storage storage);
+
+    Map<String, Object> getWarehousingVirtual(String uniqueCode);
+
+    void export(Storage storage, HttpServletResponse response);
 }

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

@@ -57,13 +57,17 @@ public class ReceiveGoodsSerivceImpl implements ReceiveGoodsSerivce {
     public Map<String, Object> addReceiveGoods(ReceiveGoods receiveGoods) {
         Map<String, Object> map = new HashMap<>();
         try{
+            receiveGoods.setType("0");
             //存在一个采购单发送多次的情况  如果是一个采购单多次传输 则改变原数据的数量
-            ReceiveGoods receiveGoods1 = new ReceiveGoods().setOrderCode(receiveGoods.getOrderCode());
+            ReceiveGoods receiveGoods1 = new ReceiveGoods().setOrderCode(receiveGoods.getOrderCode()).setMaterialId(receiveGoods.getMaterialId());
             List<ReceiveGoods> list = receiveGoodsMapper.getReceiveGoods(receiveGoods1);
             if(list.size() != 0){
                 receiveGoods.setArrivalNum(String.valueOf(Integer.parseInt(list.get(0).getArrivalNum()) + Integer.parseInt(receiveGoods.getArrivalNum())));
                 receiveGoodsMapper.updateReceiveGoods(receiveGoods);
             } else {
+                if(receiveGoodsMapper.getReceiveGoodsf(receiveGoods1) == 0){
+                    receiveGoodsMapper.addReceiveGoodsf(receiveGoods);
+                }
                 receiveGoodsMapper.addReceiveGoods(receiveGoods);
             }
             //采购单日志

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

@@ -1,5 +1,8 @@
 package com.tld.service.impl;
 
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import com.tld.excel.ExcelUtils;
 import com.tld.mapper.UserMapper;
 import com.tld.mapper.WarehousingMapper;
 import com.tld.model.*;
@@ -7,10 +10,10 @@ import com.tld.service.WarehousingService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
+
+import javax.servlet.http.HttpServletResponse;
+import java.text.SimpleDateFormat;
+import java.util.*;
 
 @Service
 public class WarehousingServiceImpl implements WarehousingService {
@@ -89,23 +92,71 @@ public class WarehousingServiceImpl implements WarehousingService {
     public Map<String, Object> warehousing(String uniqueCode) {
         Map<String, Object> map = new HashMap<>();
         try{
+            //入库信息
             List<WarehousingVirtual> list = new LinkedList<>();
+            //查询入库所需要的信息
             for(WarehousingVirtual warehousingVirtual : warehousingMapper.getVirtual(uniqueCode)){
                 //查询采购单信息
                 List<ReceiveGoods> receiveGoods = warehousingMapper.getReceiveGoods(warehousingVirtual);
-                for(ReceiveGoods receiveGoods1 : receiveGoods){
-                    //采购单剩余入库数量
-                    int surplusNum = Integer.parseInt(receiveGoods1.getQualifiedNum()) - Integer.parseInt(receiveGoods1.getWarehousingNum());
-                    if(Integer.parseInt(warehousingVirtual.getNum()) >= surplusNum) {
-                        int numInto = Integer.parseInt(warehousingVirtual.getNum()) - surplusNum;
-                    }
-                }
+                //所属账套
+                warehousingVirtual.setAccountSleeve(receiveGoods.get(0).getCompanyNumber());
+                //WBS
+                warehousingVirtual.setWbs(receiveGoods.get(0).getWbs());
                 //查询部门编号
                 List<User> listUser = userMapper.getAllUser(new User().setId(Integer.parseInt(warehousingVirtual.getUserId())));
                 warehousingVirtual.setDepartmentId(listUser.get(0).getDepartmentId());
-                //查询所属账套
+                //查询物料分类
+                WarehousingVirtual warehousingVirtual1 = warehousingMapper.getWlClass(warehousingVirtual);
+                warehousingVirtual.setWllbClass(warehousingVirtual1.getWllbClass());
+                warehousingVirtual.setPart(warehousingVirtual1.getPart());
                 list.add(warehousingVirtual);
             }
+            //入库
+            warehousingMapper.addStorage(list);//入库流水
+            warehousingMapper.addInventory(list);//库存
+            //返回采购单id
+            StringBuilder stringBuilder = new StringBuilder();
+            //入质检入库数量
+            for(WarehousingVirtual warehousingVirtual1 : warehousingMapper.getVirtual(uniqueCode)){
+                //查询采购单信息
+                List<ReceiveGoods> receiveGoods = warehousingMapper.getReceiveGoods(warehousingVirtual1);
+                for(ReceiveGoods receiveGoods1 : receiveGoods) {
+                    if(Integer.parseInt(warehousingVirtual1.getNum()) <= 0){
+                        break;
+                    }
+                    //采购单剩余入库数量
+                    int surplusNum = Integer.parseInt(receiveGoods1.getQualifiedNum()) - Integer.parseInt(receiveGoods1.getWarehousingNum());
+                    //剩余入库数量
+                    int numInto = Integer.parseInt(warehousingVirtual1.getNum()) - surplusNum;
+                    if(numInto < 0){
+                        receiveGoods1.setWarehousingNum(warehousingVirtual1.getNum());
+                        warehousingMapper.updateReceiveGood(receiveGoods1);
+                    } else {
+                        receiveGoods1.setWarehousingNum(String.valueOf(surplusNum));
+                        warehousingMapper.updateReceiveGood(receiveGoods1);
+                        //存入给gs的返回数据
+                        ReturnWarehousing returnWarehousing = new ReturnWarehousing()
+                                .setWarehousingNum(receiveGoods1.getWarehousingNum())
+                                .setGsCk(warehousingVirtual1.getGsCk())
+                                .setSourceType(receiveGoods1.getSourceType())
+                                .setMoveType(receiveGoods1.getMoveType())
+                                .setEntryNumber(receiveGoods1.getEntryNumber())
+                                .setWbs(receiveGoods1.getWbs())
+                                .setReceiveGoodsId(receiveGoods1.getId())
+                                .setMaterialId(receiveGoods1.getMaterialId())
+                                .setStorageCode(codeGenerate())
+                                .setOrderNumber(receiveGoods1.getOrderNumber());
+                        warehousingMapper.addReturnWarehousing(returnWarehousing);
+                        //判断是否有已存在的采购单号
+                        if(!stringBuilder.toString().contains(receiveGoods1.getOrderNumber() + ",")){
+                            stringBuilder.append(receiveGoods1.getOrderNumber() + ",");
+                        }
+                    }
+                    warehousingVirtual1.setNum(String.valueOf(numInto));
+                }
+            }
+            warehousingMapper.delVirtual(uniqueCode);//删除临时表数据
+            map.put("data", stringBuilder.toString());
             map.put("msg", "200");
         } catch (Exception e){
             e.printStackTrace();
@@ -114,4 +165,87 @@ public class WarehousingServiceImpl implements WarehousingService {
         }
         return map;
     }
+
+    @Override
+    public void plugOutWarehousing(String orderNumber) {
+        try{
+            List<ReturnWarehousing> list = warehousingMapper.getPlugOutWarehousing(orderNumber);
+        }catch (Exception e){
+            e.printStackTrace();
+        }
+    }
+
+    @Override
+    public Map<String, Object> warehousingFlowing(Storage storage) {
+        Map<String, Object> map = new HashMap<>();
+        try{
+            PageHelper.startPage(storage.getPage(), storage.getLimit());
+            PageInfo<Storage> list = new PageInfo<>(warehousingMapper.warehousingFlowing(storage));
+            map.put("data", list);
+            map.put("msg", "200");
+        } catch (Exception e){
+            e.printStackTrace();
+            map.put("msg", "500");
+            map.put("errMsg", "服务器请求异常,请稍后再试");
+        }
+        return map;
+    }
+
+    @Override
+    public Map<String, Object> getWarehousingVirtual(String uniqueCode) {
+        Map<String, Object> map = new HashMap<>();
+        try{
+            List<WarehousingVirtual> list = warehousingMapper.getWarehousingVirtual(uniqueCode);
+            map.put("data", list);
+            map.put("msg", "200");
+        } catch (Exception e){
+            e.printStackTrace();
+            map.put("msg", "500");
+            map.put("errMsg", "服务器请求异常,请稍后再试");
+        }
+        return map;
+    }
+
+    @Override
+    public void export(Storage storage, HttpServletResponse response) {
+        try{
+            //导出数据汇总
+            List<List<Object>> sheetDataList = new ArrayList<>();
+            //表头数据
+            List<Object> head = Arrays.asList("物料编号", "供应商名称", "连翻号", "生产日期", "生产批次", "容量", "序列号", "类型", "用户名称", "部门", "库位名称", "入库日期");
+            //查询数据
+            PageHelper.startPage(storage.getPage(), storage.getLimit());
+            PageInfo<Map<String, Object>> list = new PageInfo<>(warehousingMapper.export(storage));
+            sheetDataList.add(head);
+            for(Map<String, Object> userMap : list.getList()){
+                List<Object> listSheet = new ArrayList<>();
+                for(String key: userMap.keySet()){
+                    listSheet.add(userMap.get(key));
+                }
+                sheetDataList.add(listSheet);
+            }
+            //当前时间
+            Date time = new Date();
+            SimpleDateFormat sdf = new SimpleDateFormat("yyyyMddHHmmss");
+            ExcelUtils.export(response, "入库流水数据导出" + sdf.format(time), sheetDataList);
+        }catch (Exception e){
+            e.printStackTrace();
+        }
+    }
+
+    /**
+     * 入库单生成
+     * @return
+     */
+    public String codeGenerate(){
+        StringBuilder stringBuilder = new StringBuilder("RK");
+        Date date = new Date();
+        SimpleDateFormat sdf = new SimpleDateFormat("yyMMdd");
+        stringBuilder.append(sdf.format(date));
+        int count = warehousingMapper.getWarehousingCount();
+        for(int i = 0; i < 4 - (count + "").length(); i++){
+            stringBuilder.append("0");
+        }
+        return (stringBuilder.append(count)).toString();
+    }
 }

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

@@ -29,7 +29,7 @@
                 and a.type = #{type}
             </if>
             <if test="containerName != null and containerName != ''">
-                and a.container_name like like CONCAT(CONCAT('%', #{containerName}), '%')
+                and a.container_name like CONCAT(CONCAT('%', #{containerName}), '%')
             </if>
         </trim>
     </select>

+ 16 - 6
src/main/resources/mapper/ReceiveGoodsMapper.xml

@@ -18,9 +18,9 @@
         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="materialName != null and materialName != ''">
-                and a.material_name = #{materialName}
-            </if>
+<!--            <if test="materialId != null and materialId != ''">-->
+<!--                and a.material_id = #{materialId}-->
+<!--            </if>-->
             <if test="type != null and type != ''">
                 and a.type = #{type}
             </if>
@@ -28,15 +28,15 @@
                 and a.arrival_time <![CDATA[>=]]> #{startTime}
             </if>
             <if test="endTime != null and endTime != ''">
-                and a.arrival_time  #{endTime}
+                and a.arrival_time <![CDATA[<=]]> #{endTime}
             </if>
             <if test="orderCode != null and orderCode != ''">
-                and a.order_code  #{orderCode}
+                and a.order_code = #{orderCode}
             </if>
         </trim>
     </select>
     <!-- 查询超时采购单 -->
-    <select id="getReceiveGoods" resultType="com.tld.model.ReceiveGoods">
+    <select id="getPastReceiveGoods" resultType="com.tld.model.ReceiveGoods">
         select
             a.order_code,
             b.name as materialName,
@@ -51,11 +51,21 @@
         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.type = "0" and a.arrival_time <![CDATA[<]]> CURDATE()
+        <if test="orderCode != null and orderCode != ''">
+            and a.order_code = #{orderCode}
+        </if>
+    </select>
+    <!-- 查询采购父表是否有次采购单的数据 -->
+    <select id="getReceiveGoodsf" resultType="int">
+        select count(*) from tld_receive_goods_f where order_code = #{orderCode}
     </select>
     <!-- 新增采购单信息 -->
     <insert id="addReceiveGoods">
         insert into tld_receive_goods(order_code,material_id,purchase_num,arrival_num,type,qualified_num,disqualification_num,wbs,arrival_time,measurement_id,supplier_id,entry_number)
         values(#{orderCode},#{materialId},#{purchaseNum},#{arrivalNum},#{type},#{qualifiedNum},#{disqualificationNum},#{wbs},#{arrivalTime},#{measurementId},#{supplierId},#{entryNumber});
+    </insert>
+    <!-- 新增采购单信息 -->
+    <insert id="addReceiveGoodsf">
         insert into tld_receive_goods_f(order_number,order_code,company_number,supplier_id,arrival_time,order_type,source_type,move_type)
         values(#{orderNumber},#{orderCode},#{companyNumber},#{supplierId},#{arrivalTime},#{orderType},#{sourceType},#{moveType})
     </insert>

+ 124 - 5
src/main/resources/mapper/WarehousingMapper.xml

@@ -2,6 +2,9 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.tld.mapper.WarehousingMapper">
+    <sql id="field">
+        order_code,material_id,purchase_num,arrival_num,type,qualified_num,disqualification_num,wbs,arrival_time,measurement_id,supplier_id,entry_number,warehousing_num
+    </sql>
     <!-- 查询物料库位 -->
     <select id="getMaterialClass" resultType="com.tld.model.MaterialClass">
         select * from tld_material_class where wllb_code = #{wllbCode}
@@ -18,13 +21,13 @@
     </select>
     <!-- 新增库位信息虚拟表 -->
     <insert id="addWarehousingVirtual">
-        insert into tld_warehousing_virtual(unique_code,num,storage_location_code,wllb_code,supp_id,serial,type,produc_date,capacity,seq,user_id)
-        values(#{uniqueCode},#{num},#{storageLocationCode},#{wllbCode},#{suppId},#{serial},#{type},#{producDate},#{capacity},#{seq},#{userId})
+        insert into tld_warehousing_virtual(unique_code,num,storage_location_code,wllb_code,supp_id,serial,type,produc_date,capacity,seq,user_id,storage_location_name)
+        values(#{uniqueCode},#{num},#{storageLocationCode},#{wllbCode},#{suppId},#{serial},#{type},#{producDate},#{capacity},#{seq},#{userId},#{storageLocationName})
     </insert>
     <!-- 查询总数量 -->
     <select id="getScanNum" resultType="java.util.Map">
         SELECT
-            sum(a.num) + #{num} + c.amount as scanNum,
+            sum(a.num) + ${num} + c.amount as scanNum,
             b.storage_location_capacity as storageLocationCapacity
         FROM
             tld_warehousing_virtual a
@@ -60,7 +63,7 @@
     <!-- 查询采购单信息 -->
     <select id="getReceiveGoods" resultType="com.tld.model.WarehousingVirtual">
         SELECT
-            a.*,b.company_number
+            a.*,b.company_number,b.order_number,b.source_type,b.move_type
         FROM
             tld_receive_goods a
             JOIN tld_receive_goods_f b on a.order_code = b.order_code
@@ -69,6 +72,122 @@
             a.supplier_id = #{suppId} and a.warehousing_num <![CDATA[<]]> a.qualified_num
         ORDER BY
             a.arrival_time DESC
-        limit 2
+    </select>
+    <!-- 修改采购单入库数量 -->
+    <update id="updateReceiveGood">
+        update tld_receive_goods
+        set
+            warehousing_num = (select warehousing_num + ${warehousingNum} from tld_receive_goods where id = #{id})
+        where id = #{id}
+    </update>
+    <!-- 查询物料类型 -->
+    <select id="getWlClass" resultType="com.tld.model.WarehousingVirtual">
+        select wllb_class,name as part from tld_material where code = #{wllbCode}
+    </select>
+    <!-- 插入入库流水 -->
+    <insert id="addStorage">
+        insert into tld_storage(wllb_code,supplier_id,serial,produc_date,produc_batch,capacity,seq,type,user_id,department_id,storage_location_code,scrq,storage_code)
+        values
+        <foreach collection="list" index="index" item="item" separator=",">
+            (#{wllbCode},#{suppId},#{serial},#{producDate},#{producDate},#{capacity},#{seq},#{type},#{userId},#{departmentId},#{storageLocationCode},now(),#{storageCode})
+        </foreach>
+    </insert>
+    <!-- 插入库存 -->
+    <insert id="addInventory">
+        insert into tld_inventory(storage_location_code,wllb_class,part,amount,totime,hold,amount_lock,account_sleeve,wbs,supplier_id,serial)
+        values
+        <foreach collection="list" index="index" item="item" separator=",">
+            (#{storageLocationCode},#{wllbClass},#{part},#{num},now(),'0','0',#{accountSleeve},#{wbs},#{suppId},#{serial})
+        </foreach>
+    </insert>
+    <!-- 删除临时表数据 -->
+    <delete id="delVirtual">
+        delete from tld_warehousing_virtual where unique_code = #{uniqueCode}
+    </delete>
+    <!-- 查询当天质检数量 -->
+    <select id="getWarehousingCount" resultType="int">
+        select count(*) from tld_return_gs_warehousing where scrq BETWEEN CONCAT(CURDATE(),' 00:00:00') AND CONCAT(CURDATE(),' 23:59:59');
+    </select>
+    <!-- 存入为gs穿的信息 -->
+    <insert id="addReturnWarehousing">
+        insert into tld_return_gs_warehousing(storage_code,gs_ck,source_type,move_type,entry_number,wbs,material_id,warehousing_num,receive_goods_id,scrq,order_number)
+        values(#{storageCode},#{gsCk},#{sourceType},#{moveType},#{entryNumber},#{wbs},#{materialId},#{warehousingNum},#{receiveGoodsId},now(),#{orderNumber});
+
+        insert into tld_receive_good_transmission_log(storage_code,gs_ck,source_type,move_type,entry_number,wbs,material_id,warehousing_num,receive_goods_id,scrq,order_number)
+        values(#{storageCode},#{gsCk},#{sourceType},#{moveType},#{entryNumber},#{wbs},#{materialId},#{warehousingNum},#{receiveGoodsId},now(),#{orderNumber});
+    </insert>
+    <!-- 入库回传 -->
+    <select id="getPlugOutWarehousing" resultType="com.tld.model.ReturnWarehousing">
+        select <include refid="field"/> from tld_receive_good_transmission where #{orderNumber} LIKE CONCAT('%', CONCAT(order_number, ','), '%')
+    </select>
+    <!-- 查询入库流水 -->
+    <select id="warehousingFlowing" resultType="com.tld.model.Storage">
+        select
+            a.wllb_code,
+            h.name as supplierName,
+            a.serial,
+            a.produc_date,
+            a.produc_batch,
+            a.capacity,
+            a.seq,
+            a.type,
+            c.user_name as userName,
+            e.name as departmentName,
+            g.storage_location_name as storageLocationName,
+            a.scrq
+        from tld_storage a
+        left join tld_material b on a.wllb_code = b.code
+        left join tld_user c on a.user_id = c.id
+        left join tld_department e on a.department_id = e.tld_id
+        left join tld_storage_location g on a.storage_location_code = g.storage_location_code
+        left join tld_customer h on a.supplier_id = h.tld_id
+        <trim prefix="WHERE" prefixOverrides="and |or">
+            <if test="wllbCode != null and wllbCode != ''">
+                and a.wllb_code = #{wllbCode}
+            </if>
+            <if test="startTime != null and startTime != ''">
+                and a.scrq <![CDATA[>=]]> #{startTime}
+            </if>
+            <if test="endTime != null and endTime != ''">
+                and a.scrq <![CDATA[<=]]> #{endTime}
+            </if>
+        </trim>
+    </select>
+    <!-- 查询虚拟入库 -->
+    <select id="getWarehousingVirtual" resultType="com.tld.model.WarehousingVirtual">
+        select * from tld_warehousing_virtual where unique_code = #{uniqueCode}
+    </select>
+    <!-- 查询导出内容 -->
+    <select id="export" resultType="java.util.LinkedHashMap">
+        select
+            a.wllb_code,
+            h.name as supplierName,
+            a.serial,
+            a.produc_date,
+            a.produc_batch,
+            a.capacity,
+            a.seq,
+            a.type,
+            c.user_name as userName,
+            e.name as departmentName,
+            g.storage_location_name as storageLocationName,
+            a.scrq
+        from tld_storage a
+        left join tld_material b on a.wllb_code = b.code
+        left join tld_user c on a.user_id = c.id
+        left join tld_department e on a.department_id = e.tld_id
+        left join tld_storage_location g on a.storage_location_code = g.storage_location_code
+        left join tld_customer h on a.supplier_id = h.tld_id
+        <trim prefix="WHERE" prefixOverrides="and |or">
+            <if test="wllbCode != null and wllbCode != ''">
+                and a.wllb_code = #{wllbCode}
+            </if>
+            <if test="startTime != null and startTime != ''">
+                and a.scrq <![CDATA[>=]]> #{startTime}
+            </if>
+            <if test="endTime != null and endTime != ''">
+                and a.scrq <![CDATA[<=]]> #{endTime}
+            </if>
+        </trim>
     </select>
 </mapper>