浏览代码

问题修改

zhs 2 年之前
父节点
当前提交
22983daa9f

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

@@ -4,6 +4,7 @@ import com.tld.model.AskGoods;
 import com.tld.model.Storage;
 import com.tld.model.WarehousingVirtual;
 import com.tld.service.WarehousingService;
+import com.tld.util.DateUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 import javax.servlet.http.HttpServletResponse;

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

@@ -78,4 +78,8 @@ public interface AskGoodsMapper {
     List<AskGoods> getAskGoodsVitrual(@Param("uniqueCode")String uniqueCode, @Param("type")String type);
 
     void delAskGoodsVitrual(String id);
+
+    void updateOutNum(@Param("num")String num, @Param("askGoodsId")String askGoodsId, @Param("materialId")String materialId);
+
+    String getScanNum(AskGoods askGoods);
 }

+ 9 - 0
src/main/java/com/tld/mapper/ErrorMapper.java

@@ -0,0 +1,9 @@
+package com.tld.mapper;
+
+import com.tld.model.Error;
+import org.apache.ibatis.annotations.Mapper;
+
+@Mapper
+public interface ErrorMapper {
+    void addError(Error error);
+}

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

@@ -55,5 +55,5 @@ public interface WarehousingMapper {
 
     int getMateriaIsExist(String wllbCode);
 
-    int getInventoryProduc(@Param("wllbCode")String wllbCode, @Param("producDate")String producDate, @Param("storageLocationCode")String storageLocationCode);
+    List<String> getInventoryProduc(@Param("wllbCode")String wllbCode, @Param("producDate")String producDate, @Param("storageLocationCode")String storageLocationCode);
 }

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

@@ -136,4 +136,12 @@ public class AskGoods implements Serializable {
      * 要货申请类型
      */
     private String askGoodsType;
+    /**
+     * 开始时间
+     */
+    private String startTime;
+    /**
+     * 结束时间
+     */
+    private String endTime;
 }

+ 34 - 0
src/main/java/com/tld/model/Error.java

@@ -0,0 +1,34 @@
+package com.tld.model;
+
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+
+/**
+ * 错误信息
+ */
+@Data
+@Accessors(chain = true)
+public class Error implements Serializable {
+    /**
+     * 主键
+     */
+    private String id;
+    /**
+     * 路径
+     */
+    private String url;
+    /**
+     * 错误信息
+     */
+    private String errorInfo;
+    /**
+     * 传输数据
+     */
+    private String dataVal;
+    /**
+     * 生成日期
+     */
+    private String scrq;
+}

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

@@ -20,6 +20,10 @@ public class Inventory implements Serializable {
      * 库位编号
      */
     private String storageLocationCode;
+    /**
+     * 库位名称
+     */
+    private String storageLocationName;
     /**
      * 物料分类
      */

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

@@ -76,4 +76,12 @@ public class ReturnWarehousing implements Serializable {
      * 是否红单
      */
     private String isNotRed;
+    /**
+     * 执行人姓名
+     */
+    private String userName;
+    /**
+     * 库位编号
+     */
+    private String storageLocationCode;
 }

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

@@ -124,4 +124,8 @@ public class WarehousingVirtual implements Serializable {
      * 结束时间
      */
     private String endTime;
+    /**
+     * 姓名
+     */
+    private String userName;
 }

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

@@ -69,6 +69,13 @@ public class AskGoodsServiceImpl implements AskGoodsService {
         Map<String, Object> map = new HashMap<>();
         try{
             List<AskGoods> list = askGoodsMapper.getAskGoodsMaterial(askGoods);
+            List<String> scanNum = new LinkedList<>();
+            for(AskGoods askGoods1 : list){
+                askGoods1.setUniqueCode(askGoods.getUniqueCode());
+                askGoods1.setAskGoodsId(askGoods.getAskGoodsId());
+                scanNum.add(askGoodsMapper.getScanNum(askGoods1));//扫描总数
+            }
+            map.put("scanNum", scanNum);
             map.put("data", list);
             map.put("msg", "200");
         }catch (Exception e){
@@ -86,7 +93,11 @@ public class AskGoodsServiceImpl implements AskGoodsService {
             List<Inventory> list = new LinkedList<>();
             for(Inventory inventory : askGoodsMapper.getMaterialCk(askGoods)){
                 AskGoods askGoods1 = askGoodsMapper.getAsk(inventory);
-                if(Integer.parseInt(askGoods1.getNum()) != Integer.parseInt(inventory.getAmount())){
+                if(askGoods1 != null){
+                    if(Integer.parseInt(askGoods1.getNum()) != Integer.parseInt(inventory.getAmount())){
+                        list.add(inventory);
+                    }
+                } else {
                     list.add(inventory);
                 }
             }
@@ -163,6 +174,7 @@ public class AskGoodsServiceImpl implements AskGoodsService {
                 askGoodsMapper.addRemoval(askGoods);//插入出库流水
                 askGoodsMapper.deleteVirtual(askGoods.getId());//删除已出虚拟表库存
                 askGoodsMapper.addReturnGsRemoval(returRemoval);//新增返回gs数据子表信息
+                askGoodsMapper.updateOutNum(askGoods.getNum(), askGoodsId, materialId);//修改出库数量
             }
             //查询要货单父级信息
             AskGoods askGoods3 = askGoodsMapper.getAskDetailedF(askGoodsId);

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

@@ -1,15 +1,25 @@
 package com.tld.service.impl;
 
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
+import com.mysql.cj.xdevapi.JsonString;
 import com.tld.excel.ExcelUtils;
+import com.tld.mapper.ErrorMapper;
 import com.tld.mapper.UserMapper;
 import com.tld.mapper.WarehousingMapper;
 import com.tld.model.*;
+import com.tld.model.Error;
 import com.tld.service.WarehousingService;
+import com.tld.util.DateUtil;
+import com.tld.util.HttpClientUtil;
+import org.apache.http.ParseException;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
+
+import javax.annotation.Resource;
 import javax.servlet.http.HttpServletResponse;
 import java.text.SimpleDateFormat;
 import java.util.*;
@@ -23,6 +33,12 @@ public class WarehousingServiceImpl implements WarehousingService {
     @Autowired
     private UserMapper userMapper;
 
+    @Autowired
+    private ErrorMapper errorMapper;
+
+//    @Resource
+//    private HttpClientUtil httpClientUtil;
+
     @Override
     public Map<String, Object> getRecommend(String wllbCode, String suppId, String num, String unique, String producDate) {
         Map<String, Object> map = new HashMap<>();
@@ -53,22 +69,28 @@ public class WarehousingServiceImpl implements WarehousingService {
                 listMaterialClass = warehousingMapper.getMaterialClassType(wllbCode);
             }
             StringBuffer stringBuffer = new StringBuffer();
-            List<Integer> listString = new LinkedList<>();//库存剩余数量
+            Map<String, Object> listMap = new HashMap<>();
             for(int i = 0; i < listMaterialClass.size(); i++) {
                 Map<String, Object> map1 = warehousingMapper.getScanNum(listMaterialClass.get(i).getStorageLocationCode(), num);
                 if(Double.parseDouble(String.valueOf(map1.get("scanNum"))) < Double.parseDouble(String.valueOf(map1.get("storageLocationCapacity")))){
                     //查询库存是否同物料同批次存在
-                    int countProduc = warehousingMapper.getInventoryProduc(listMaterialClass.get(i).getWllbCode(), producDate, listMaterialClass.get(i).getStorageLocationCode());
-                    if(countProduc == 0){
+                    List<String> countProduc = warehousingMapper.getInventoryProduc(listMaterialClass.get(i).getWllbCode(), producDate, listMaterialClass.get(i).getStorageLocationCode());
+                    if(countProduc.size() == 0){
                         stringBuffer.append(listMaterialClass.get(i).getStorageLocationCode() + ",");
                         int surplusNum = (int) (Double.parseDouble(String.valueOf(map1.get("storageLocationCapacity"))) - Double.parseDouble(String.valueOf(map1.get("scanNum"))) + Double.parseDouble(num));
-                        listString.add(surplusNum);
+                        listMap.put(listMaterialClass.get(i).getStorageLocationCode(), surplusNum);
+                    } else {
+                        if(String.valueOf(countProduc.get(0)).equals(producDate)){
+                            stringBuffer.append(listMaterialClass.get(i).getStorageLocationCode() + ",");
+                            int surplusNum = (int) (Double.parseDouble(String.valueOf(map1.get("storageLocationCapacity"))) - Double.parseDouble(String.valueOf(map1.get("scanNum"))) + Double.parseDouble(num));
+                            listMap.put(listMaterialClass.get(i).getStorageLocationCode(), surplusNum);
+                        }
                     }
                 }
             }
             List<StorageLocation> list = warehousingMapper.recommend(stringBuffer.toString());
             map.put("data", list);
-            map.put("listString", listString);//返回库位剩余数量
+            map.put("listString", listMap);//返回库位剩余数量
             map.put("msg", "200");
         } catch (Exception e){
             e.printStackTrace();
@@ -159,9 +181,7 @@ public class WarehousingServiceImpl implements WarehousingService {
                         //存入给gs的返回数据
                         ReturnWarehousing returnWarehousing = new ReturnWarehousing()
                                 .setWarehousingNum(receiveGoods1.getWarehousingNum())
-
                                 .setGsCk(warehousingVirtual1.getGsCk())
-
                                 .setSourceType(receiveGoods1.getSourceType())
                                 .setMoveType(receiveGoods1.getMoveType())
                                 .setEntryNumber(receiveGoods1.getEntryNumber())
@@ -169,7 +189,9 @@ public class WarehousingServiceImpl implements WarehousingService {
                                 .setReceiveGoodsId(receiveGoods1.getId())
                                 .setMaterialId(receiveGoods1.getMaterialId())
                                 .setStorageCode(codeGenerateRk())
-                                .setOrderNumber(receiveGoods1.getOrderNumber());
+                                .setOrderNumber(receiveGoods1.getOrderNumber())
+                                .setUserName(warehousingVirtual1.getUserName())
+                                .setStorageLocationCode(warehousingVirtual1.getStorageLocationCode());
                         warehousingMapper.addReturnWarehousing(returnWarehousing);
                         //判断是否有已存在的采购单号
                         if(!stringBuilder.toString().contains(receiveGoods1.getOrderNumber() + ",")){
@@ -193,17 +215,41 @@ public class WarehousingServiceImpl implements WarehousingService {
     @Override
     public void plugOutWarehousing(String orderNumber) {
         try{
-            Calendar cal = Calendar.getInstance();
-            int year = cal.get(Calendar.YEAR);
-            int month = cal.get(Calendar.MONTH) + 1;
-            int day = cal.get(Calendar.DATE) ;
-            List<ReturnWarehousing> list = new ArrayList<>();
             for(ReturnWarehousing returnWarehousing : warehousingMapper.getPlugOutWarehousing(orderNumber)){
-                returnWarehousing.setYear(String.valueOf(year));
-                returnWarehousing.setMonth(String.valueOf(month));
-                returnWarehousing.setTime(year + "-" + month + "-" + day);
-                returnWarehousing.setIsNotRed("0");
-                list.add(returnWarehousing);
+                JSONObject returnData = new JSONObject();
+                JSONObject BillItems = new JSONObject();
+                JSONObject strJson = new JSONObject();
+                strJson.put("PurOrderID", returnWarehousing.getOrderNumber());//采购单id
+                strJson.put("WMSID", returnWarehousing.getId());//入库单id
+                strJson.put("WMSCode", returnWarehousing.getStorageCode());//入库单编号
+                strJson.put("WareHouse", "e7f6bff1-e6ab-49e7-9");//仓库id
+                strJson.put("SourceBillDate", DateUtil.dateConversion(returnWarehousing.getScrq()));//业务日期
+                strJson.put("SourceType", returnWarehousing.getSourceType());//来源类型
+                strJson.put("MoveType", returnWarehousing.getMoveType());//移动类型
+                strJson.put("Creator", "测试");//制单人姓名
+                BillItems.put("WMSItemID", returnWarehousing.getReceiveGoodsId());//利道WMS入库单分录ID
+                BillItems.put("PurOrderID", returnWarehousing.getOrderNumber());//采购单id
+                BillItems.put("PurOrderItemID", returnWarehousing.getEntryNumber());//采购订单明细ID
+                BillItems.put("Material", returnWarehousing.getMaterialId());//物料id
+                BillItems.put("Quantity", returnWarehousing.getWarehousingNum());//入库数量
+                BillItems.put("FlexField1", returnWarehousing.getWbs());//wbs
+                BillItems.put("FlexField1Code", " ");//WBS编号
+                BillItems.put("FlexField1Name", " ");//WBS名称
+                List<JSONObject> list = new LinkedList<>();
+                list.add(BillItems);
+                strJson.put("BillItems", list);
+                returnData.put("strJson", JSON.toJSONString(strJson));
+                System.out.println(returnData);
+                HttpClientUtil httpClientUtil1 = new HttpClientUtil();
+                Map<String, Object> result = httpClientUtil1.doPost("http://42.159.85.29:52480/cwbase/sg/V1/ERP/TELD/DEVTEST/API_WMS_PurInStock/CreatePurInStock", returnData);
+                if(Integer.parseInt(result.get("msg").toString()) != 200){
+                    //如果失败存入报错信息跟数据
+                    Error error = new Error()
+                            .setErrorInfo(result.get("data").toString())
+                            .setUrl("http://42.159.85.29:52480/cwbase/sg/V1/ERP/TELD/DEVTEST/API_WMS_PurInStock/CreatePurInStock")
+                            .setDataVal(strJson.toJSONString());
+                    errorMapper.addError(error);
+                }
             }
         }catch (Exception e){
             e.printStackTrace();
@@ -283,4 +329,8 @@ public class WarehousingServiceImpl implements WarehousingService {
         }
         return (stringBuilder.append(count + 1)).toString();
     }
+
+    public static void main(String[] args) {
+
+    }
 }

+ 20 - 0
src/main/java/com/tld/util/DateUtil.java

@@ -0,0 +1,20 @@
+package com.tld.util;
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+public class DateUtil {
+
+    public static String dateConversion(String dateString) {
+        Date date = null;
+        //实现将字符串转成⽇期类型
+        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
+        SimpleDateFormat dateFormat1 = new SimpleDateFormat("yyyyMMdd");
+        try {
+            date = dateFormat.parse(dateString);
+        } catch (java.text.ParseException e) {
+            e.printStackTrace();
+        }
+        return dateFormat1.format(date);
+    }
+}

+ 38 - 14
src/main/java/com/tld/util/HttpClientUtil.java

@@ -3,8 +3,15 @@ package com.tld.util;
 import java.io.IOException;
 import java.net.URI;
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.tld.mapper.ErrorMapper;
+import com.tld.model.Error;
+import org.apache.http.Header;
 import org.apache.http.NameValuePair;
 import org.apache.http.client.config.RequestConfig;
 import org.apache.http.client.entity.UrlEncodedFormEntity;
@@ -19,9 +26,16 @@ import org.apache.http.impl.client.HttpClients;
 import org.apache.http.message.BasicNameValuePair;
 import org.apache.http.util.EntityUtils;
 import org.apache.http.HttpStatus;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import javax.annotation.Resource;
+import javax.swing.text.html.parser.Entity;
 
 public class HttpClientUtil {
 
+    @Autowired
+    private ErrorMapper errorMapper;
+
     public static String doGet(String url, Map<String, String> param) {
 
         // 创建Httpclient对象
@@ -74,7 +88,7 @@ public class HttpClientUtil {
     }
 
 
-    public static String doPost(String url, Map<String, String> param) {
+    public Map<String, Object> doPost(String url, JSONObject param) {
         // 创建Httpclient对象
         CloseableHttpClient httpClient = HttpClients.createDefault();
 
@@ -87,27 +101,38 @@ public class HttpClientUtil {
                 .build();
 
         CloseableHttpResponse response = null;
-        String resultString = "";
+        Map<String, Object> map = new HashMap<>();
+        String resultString = null;
         try {
             // 创建Http Post请求
             HttpPost httpPost = new HttpPost(url);
             httpPost.setConfig(requestConfig);
+            httpPost.setHeader("AuthType", "Anonymous");
+            httpPost.setHeader("GSAppId", "BI");
+            httpPost.setHeader("Content-Type", "application/json;charset=utf-8");
             // 创建参数列表
             if (param != null) {
-                List<NameValuePair> paramList = new ArrayList<>();
-                for (String key : param.keySet()) {
-                    paramList.add(new BasicNameValuePair(key, param.get(key)));
-                }
-                // 模拟表单
-                UrlEncodedFormEntity entity = new UrlEncodedFormEntity(paramList);
+                //请求参数转JOSN字符串
+                StringEntity entity = new StringEntity(param.toString(), "UTF-8");
+                entity.setContentEncoding("UTF-8");
+                entity.setContentType("application/json");
                 httpPost.setEntity(entity);
             }
-            // 执行http请求
             response = httpClient.execute(httpPost);
-
-            if(response.getStatusLine().getStatusCode() == HttpStatus.SC_OK){
-                resultString = EntityUtils.toString(response.getEntity(), "utf-8");
+            // 执行http请求
+            String responseVal = EntityUtils.toString(response.getEntity(), "utf-8");
+            JSONObject jsonObject = JSON.parseObject(responseVal);
+            if(JSON.parseObject(jsonObject.get("result").toString()).get("State").equals("0")){
+                //如果失败存入报错信息跟数据
+                Error error = new Error()
+                        .setErrorInfo(resultString)
+                        .setUrl(url)
+                        .setDataVal(param.toString());
+                errorMapper.addError(error);
             }
+            resultString = EntityUtils.toString(response.getEntity(), "utf-8");
+            map.put("msg", response.getStatusLine().getStatusCode());
+            map.put("data", resultString);
         } catch (Exception e) {
             e.printStackTrace();
         } finally {
@@ -118,8 +143,7 @@ public class HttpClientUtil {
                 e.printStackTrace();
             }
         }
-
-        return resultString;
+        return map;
     }
 
     public static String doPostJson(String url, String json) {

+ 34 - 19
src/main/resources/mapper/AskGoodsMapper.xml

@@ -49,7 +49,8 @@
             a.material_id,
             a.num,
             b.name as materialName,
-            b.code as materialCode
+            b.code as materialCode,
+            a.out_num
         FROM
             tld_ask_goods a
             left join tld_material b on a.material_id = b.tld_id
@@ -59,23 +60,26 @@
     <!-- 物料库位选择 -->
     <select id="getMaterialCk" resultType="com.tld.model.Inventory">
         select
-            storage_location_code,
-            wllb_class,
-            library_type,
-            material_id,
-            amount,
-            total,
-            totime,
-            hold,
-            amount_lock,
-            account_sleeve,
-            wbs,
-            supplier_id,
-            serial,
-            wllb_code,
-            produc_date,
-            scrq
-        from tld_inventory where material_id = #{materialId} order by scrq
+            a.storage_location_code,
+            a.wllb_class,
+            a.library_type,
+            a.material_id,
+            a.amount,
+            a.total,
+            a.totime,
+            a.hold,
+            a.amount_lock,
+            a.account_sleeve,
+            a.wbs,
+            a.supplier_id,
+            a.serial,
+            a.wllb_code,
+            a.produc_date,
+            a.scrq,
+            b.storage_location_name as storageLocationName
+        from tld_inventory a
+        left join tld_storage_location b on a.storage_location_code = b.storage_location_code
+        where a.material_id = #{materialId} order by a.scrq
     </select>
     <!-- 新增出库虚拟表 -->
     <insert id="addAskGoodsVitrual">
@@ -179,7 +183,7 @@
     <!-- 修改库存数量 -->
     <update id="updateInventory">
         UPDATE tld_inventory
-        SET amount = amount - ${amount}
+        SET amount = amount - #{amount}
         WHERE
             id = #{id}
     </update>
@@ -349,4 +353,15 @@
     <delete id="delAskGoodsVitrual">
         delete from tld_ask_goods_vitrual where id = #{id}
     </delete>
+    <!-- 修改出库数量 -->
+    <update id="updateOutNum">
+        update tld_ask_goods
+        set out_num = out_num + #{num} where material_id = #{materialId} and ask_goods_id = #{askGoodsId}
+    </update>
+    <!-- 查询指定pda 指定物料扫描总数 -->
+    <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}
+    </select>
 </mapper>

+ 9 - 0
src/main/resources/mapper/ErrorMapper.xml

@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.tld.mapper.ErrorMapper">
+    <!-- 如果失败存入报错信息跟数据 -->
+    <insert id="addError">
+        insert into(url,error_info,data_val,scrq) value(#{url},#{errorInfo},#{dataVal},now())
+    </insert>
+</mapper>

+ 31 - 26
src/main/resources/mapper/WarehousingMapper.xml

@@ -8,10 +8,12 @@
     <!-- 查询物料库位 -->
     <select id="getMaterialClass" resultType="com.tld.model.MaterialClass">
         select
-            id,
-            storage_location_code,
-            wllb_code
-        from tld_material_class where wllb_code = #{wllbCode}
+            a.id,
+            a.storage_location_code,
+            a.wllb_code
+        from tld_material_class a
+        right join tld_material b on a.wllb_code = b.tld_id
+        where b.code = #{wllbCode}
     </select>
     <!-- 根据物料分类查询库位 -->
     <select id="getMaterialClassType" resultType="com.tld.model.MaterialClass">
@@ -31,7 +33,7 @@
     <!-- 查询总数量 -->
     <select id="getScanNum" resultType="java.util.Map">
         SELECT
-            (ifnull(sum(a.num), 0) + ${num} + ifnull(c.amount, 0)) as scanNum,
+            (ifnull(sum(a.num), 0) + ${num} + ifnull(sum(c.amount), 0)) as scanNum,
             ifnull(b.storage_location_capacity, 0) as storageLocationCapacity
         FROM
             tld_warehousing_virtual a
@@ -79,20 +81,23 @@
     <!-- 查询虚拟表数据进行入库 -->
     <select id="getVirtual" resultType="com.tld.model.WarehousingVirtual">
         select
-            id,
-            unique_code,
-            num,
-            storage_location_code,
-            wllb_code,
-            supp_id,
-            serial,
-            type,
-            produc_date,
-            capacity,
-            seq,
-            user_id,
-            storage_location_name
-        from tld_warehousing_virtual where unique_code = #{uniqueCode}
+            a.id,
+            a.unique_code,
+            a.num,
+            a.storage_location_code,
+            a.wllb_code,
+            a.supp_id,
+            a.serial,
+            a.type,
+            a.produc_date,
+            a.capacity,
+            a.seq,
+            a.user_id,
+            a.storage_location_name,
+            b.user_name
+        from tld_warehousing_virtual a
+        left join tld_user b on a.user_id = b.id
+        where a.unique_code = #{uniqueCode}
     </select>
     <!-- 查询采购单信息 -->
     <select id="getReceiveGoods" resultType="com.tld.model.ReceiveGoods">
@@ -103,7 +108,7 @@
             a.purchase_num,
             a.arrival_num,
             a.type,
-            a.qualified_num
+            a.qualified_num,
             a.disqualification_num,
             a.wbs,
             a.arrival_time,
@@ -119,10 +124,10 @@
         FROM
             tld_receive_goods a
             LEFT JOIN tld_receive_goods_f b on a.order_code = b.order_code
-            LEFT JOIN tld_material c on a.material_id = c.tld_id and c.code = #{wllbCode}
+            JOIN tld_material c on a.material_id = c.tld_id
             LEFT JOIN tld_customer f on a.supplier_id = f.tld_id
         WHERE
-            a.supplier_id = #{suppId} and IFNULL(a.warehousing_num, 0 ) <![CDATA[<]]> a.qualified_num
+            a.supplier_id = #{suppId} and IFNULL(a.warehousing_num, 0 ) <![CDATA[<]]> a.qualified_num and c.code = #{wllbCode}
         ORDER BY
             a.arrival_time DESC
     </select>
@@ -130,7 +135,7 @@
     <update id="updateReceiveGood">
         update tld_receive_goods
         set
-            warehousing_num = warehousing_num + ${warehousingNum}
+            warehousing_num = warehousing_num + #{warehousingNum}
         where id = #{id}
     </update>
     <!-- 查询物料类型 -->
@@ -163,8 +168,8 @@
     </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_return_gs_warehousing(storage_code,gs_ck,source_type,move_type,entry_number,wbs,material_id,warehousing_num,receive_goods_id,scrq,order_number,user_name,storage_location_code)
+        values(#{storageCode},#{gsCk},#{sourceType},#{moveType},#{entryNumber},#{wbs},#{materialId},#{warehousingNum},#{receiveGoodsId},now(),#{orderNumber},#{userName},#{storageLocationCode});
     </insert>
     <!-- 入库回传 -->
     <select id="getPlugOutWarehousing" resultType="com.tld.model.ReturnWarehousing">
@@ -270,7 +275,7 @@
     <!-- 查询库存是否同物料同批次存在 -->
     <select id="getInventoryProduc" resultType="int">
         SELECT
-            count(0)
+            produc_date as producDate
         FROM
             tld_inventory a
             JOIN tld_material b ON a.material_id = b.tld_id