zhs 2 éve
szülő
commit
6701bd569a

+ 17 - 3
src/main/java/com/tld/controller/GsPlugOutController.java

@@ -1,11 +1,12 @@
 package com.tld.controller;
 
+import com.tld.model.Error;
 import com.tld.service.AskGoodsService;
+import com.tld.service.QueryListService;
 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;
+import org.springframework.web.bind.annotation.*;
+import java.util.Map;
 
 /**
  * gs接出接口
@@ -19,6 +20,9 @@ public class GsPlugOutController {
     //出库
     @Autowired
     private AskGoodsService askGoodsService;
+    //查询
+    @Autowired
+    private QueryListService queryListService;
 
     /**
      * 入库回传
@@ -64,4 +68,14 @@ public class GsPlugOutController {
     public void CreateGRReqInStock(String removalCode){
         askGoodsService.CreateGRReqInStock(removalCode);
     }
+
+    /**
+     *
+     * @param error
+     * @return
+     */
+    @PostMapping("anew")
+    public Map<String, Object> anew(@RequestBody Error error){
+        return queryListService.anew(error);
+    }
 }

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

@@ -13,4 +13,7 @@ public interface ErrorMapper {
 
     List<Map<String, Object>> getErrorExcel(Error error);
 
+    void delError(String id);
+
+    void updateError(String id);
 }

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

@@ -48,4 +48,12 @@ public class Error implements Serializable {
      * 条数
      */
     private int limit;
+    /**
+     * 数据类型
+     */
+    private String type;
+    /**
+     * 传输类型
+     */
+    private String transmissionType;
 }

+ 2 - 0
src/main/java/com/tld/service/QueryListService.java

@@ -51,4 +51,6 @@ public interface QueryListService {
     void getLogDataExcel(LogData logData, HttpServletResponse response);
 
     void getErrorExcel(Error error, HttpServletResponse response);
+
+    Map<String, Object> anew(Error error);
 }

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

@@ -321,7 +321,7 @@ public class AskGoodsServiceImpl implements AskGoodsService {
                 //如果失败存入报错信息跟数据
                 error.setErrorInfo(result.get("data").toString());
                 error.setUrl("http://42.159.85.29:52480/cwbase/sg/V1/ERP/TELD/DEVTEST/API_WMS_PurInStock/CreateProductiveOutStock");
-                error.setDataVal(returnData.toJSONString());
+                error.setDataVal(returnData.toJSONString()).setType("出库回传");
                 errorMapper.addError(error);
                 type = 1;
             }else {
@@ -331,7 +331,7 @@ public class AskGoodsServiceImpl implements AskGoodsService {
                     //如果失败存入报错信息跟数据
                     error.setErrorInfo(jsonObject1.get("Msg").toString());
                     error.setUrl("http://42.159.85.29:52480/cwbase/sg/V1/ERP/TELD/DEVTEST/API_WMS_PurInStock/CreateProductiveOutStock");
-                    error.setDataVal(returnData.toJSONString());
+                    error.setDataVal(returnData.toJSONString()).setType("出库回传");
                     errorMapper.addError(error);
                     type = 1;
                 }else {
@@ -343,7 +343,7 @@ public class AskGoodsServiceImpl implements AskGoodsService {
                                     //如果失败存入报错信息跟数据
                                     error.setErrorInfo(map.get("FailReason").toString());
                                     error.setUrl("http://42.159.85.29:52480/cwbase/sg/V1/ERP/TELD/DEVTEST/API_WMS_PurInStock/CreateProductiveOutStock");
-                                    error.setDataVal(jsonObject2.toString());
+                                    error.setDataVal(jsonObject2.toString()).setType("出库回传");
                                     errorMapper.addError(error);
                                 }
                             }
@@ -733,7 +733,7 @@ public class AskGoodsServiceImpl implements AskGoodsService {
                 //如果失败存入报错信息跟数据
                 error.setErrorInfo(result.get("data").toString());
                 error.setUrl("http://42.159.85.29:52480/cwbase/sg/V1/ERP/TELD/DEVTEST/API_WMS_PurInStock/CreateBOLOutStock");
-                error.setDataVal(returnData.toJSONString());
+                error.setDataVal(returnData.toJSONString()).setType("销售出库");
                 errorMapper.addError(error);
             }else {
                 JSONObject jsonObject = (JSONObject) JSONObject.parse(result.get("data").toString());
@@ -742,7 +742,7 @@ public class AskGoodsServiceImpl implements AskGoodsService {
                     //如果失败存入报错信息跟数据
                     error.setErrorInfo(jsonObject1.get("Msg").toString());
                     error.setUrl("http://42.159.85.29:52480/cwbase/sg/V1/ERP/TELD/DEVTEST/API_WMS_PurInStock/CreateBOLOutStock");
-                    error.setDataVal(returnData.toJSONString());
+                    error.setDataVal(returnData.toJSONString()).setType("销售出库");
                     errorMapper.addError(error);
                 }else {
                     List<JSONObject>  data1 = (List<JSONObject>) JSONObject.parse(jsonObject1.get("data").toString());
@@ -753,7 +753,7 @@ public class AskGoodsServiceImpl implements AskGoodsService {
                                     //如果失败存入报错信息跟数据
                                     error.setErrorInfo(map.get("FailReason").toString());
                                     error.setUrl("http://42.159.85.29:52480/cwbase/sg/V1/ERP/TELD/DEVTEST/API_WMS_PurInStock/CreateProductiveOutStock");
-                                    error.setDataVal(jsonObject2.toString());
+                                    error.setDataVal(jsonObject2.toString()).setType("销售出库");
                                     errorMapper.addError(error);
                                 }
                             }
@@ -878,7 +878,7 @@ public class AskGoodsServiceImpl implements AskGoodsService {
                 //如果失败存入报错信息跟数据
                 error.setErrorInfo(result.get("data").toString());
                 error.setUrl("http://42.159.85.29:52480/cwbase/sg/V1/ERP/TELD/DEVTEST/API_WMS_PurInStock/CreateGMReqOutStock");
-                error.setDataVal(returnData.toJSONString());
+                error.setDataVal(returnData.toJSONString()).setType("移库");
                 errorMapper.addError(error);
             } else {
                 JSONObject jsonObject = (JSONObject) JSONObject.parse(result.get("data").toString());
@@ -887,7 +887,7 @@ public class AskGoodsServiceImpl implements AskGoodsService {
                     //如果失败存入报错信息跟数据
                     error.setErrorInfo(jsonObject1.get("Msg").toString());
                     error.setUrl("http://42.159.85.29:52480/cwbase/sg/V1/ERP/TELD/DEVTEST/API_WMS_PurInStock/CreateGMReqOutStock");
-                    error.setDataVal(returnData.toJSONString());
+                    error.setDataVal(returnData.toJSONString()).setType("移库");
                     errorMapper.addError(error);
                 } else {
                     List<JSONObject> data1 = (List<JSONObject>) JSONObject.parse(jsonObject1.get("data").toString());
@@ -898,7 +898,7 @@ public class AskGoodsServiceImpl implements AskGoodsService {
                                     //如果失败存入报错信息跟数据
                                     error.setErrorInfo(map.get("FailReason").toString());
                                     error.setUrl("http://42.159.85.29:52480/cwbase/sg/V1/ERP/TELD/DEVTEST/API_WMS_PurInStock/CreateGMReqOutStock");
-                                    error.setDataVal(jsonObject2.toString());
+                                    error.setDataVal(jsonObject2.toString()).setType("移库");
                                     errorMapper.addError(error);
                                 }
                             }
@@ -983,7 +983,7 @@ public class AskGoodsServiceImpl implements AskGoodsService {
                 //如果失败存入报错信息跟数据
                 error.setErrorInfo(result.get("data").toString());
                 error.setUrl("http://42.159.85.29:52480/cwbase/sg/V1/ERP/TELD/DEVTEST/API_WMS_PurInStock/CreateGRReqInStock");
-                error.setDataVal(returnData.toJSONString());
+                error.setDataVal(returnData.toJSONString()).setType("半成品入库");
                 errorMapper.addError(error);
             } else {
                 JSONObject jsonObject = (JSONObject) JSONObject.parse(result.get("data").toString());
@@ -992,7 +992,7 @@ public class AskGoodsServiceImpl implements AskGoodsService {
                     //如果失败存入报错信息跟数据
                     error.setErrorInfo(jsonObject1.get("Msg").toString());
                     error.setUrl("http://42.159.85.29:52480/cwbase/sg/V1/ERP/TELD/DEVTEST/API_WMS_PurInStock/CreateGRReqInStock");
-                    error.setDataVal(returnData.toJSONString());
+                    error.setDataVal(returnData.toJSONString()).setType("半成品入库");
                     errorMapper.addError(error);
                 } else {
                     List<JSONObject> data1 = (List<JSONObject>) JSONObject.parse(jsonObject1.get("data").toString());
@@ -1003,7 +1003,7 @@ public class AskGoodsServiceImpl implements AskGoodsService {
                                     //如果失败存入报错信息跟数据
                                     error.setErrorInfo(map.get("FailReason").toString());
                                     error.setUrl("http://42.159.85.29:52480/cwbase/sg/V1/ERP/TELD/DEVTEST/API_WMS_PurInStock/CreateGRReqInStock");
-                                    error.setDataVal(jsonObject2.toString());
+                                    error.setDataVal(jsonObject2.toString()).setType("半成品入库");
                                     errorMapper.addError(error);
                                 }
                             }

+ 84 - 0
src/main/java/com/tld/service/impl/QueryListServiceImpl.java

@@ -1,5 +1,7 @@
 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.tld.excel.ExcelUtils;
@@ -8,6 +10,7 @@ import com.tld.mapper.QueryListMapper;
 import com.tld.model.*;
 import com.tld.model.Error;
 import com.tld.service.QueryListService;
+import com.tld.util.HttpClientUtil;
 import lombok.RequiredArgsConstructor;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -511,4 +514,85 @@ public class QueryListServiceImpl implements QueryListService {
             e.printStackTrace();
         }
     }
+
+    @Override
+    public Map<String, Object> anew(Error errorVal) {
+        Map<String, Object> mapVal = new HashMap<>();
+        try{
+            HttpClientUtil httpClientUtil1 = new HttpClientUtil();
+            Map<String, Object> result = httpClientUtil1.doPost(errorVal.getUrl(), JSON.parseObject(errorVal.getDataVal()));
+            Error error = new Error();
+            if (Integer.parseInt(result.get("msg").toString()) != 200) {
+                //如果失败存入报错信息跟数据
+                error.setErrorInfo(result.get("data").toString());
+                error.setUrl(errorVal.getUrl());
+                error.setDataVal(errorVal.getDataVal()).setType(errorVal.getType());
+                errorMapper.addError(error);
+            } else {
+                JSONObject jsonObject = (JSONObject) JSONObject.parse(result.get("data").toString());
+                JSONObject jsonObject1 = (JSONObject) JSONObject.parse(jsonObject.get("result").toString());
+                if (jsonObject1.get("State").toString().equals("0")) {
+                    //如果失败存入报错信息跟数据
+                    error.setErrorInfo(jsonObject1.get("Msg").toString());
+                    error.setUrl(errorVal.getUrl());
+                    error.setDataVal(errorVal.getDataVal()).setType(errorVal.getType());
+                    errorMapper.addError(error);
+                } else {
+                    List<JSONObject> data1 = (List<JSONObject>) JSONObject.parse(jsonObject1.get("data").toString());
+                    for (JSONObject map : data1) {
+                        if (map.get("State").toString().equals("0")) {
+                            if (errorVal.getType().equals("入库回传")) {
+                                //如果失败存入报错信息跟数据
+                                error.setErrorInfo(jsonObject.get("Msg").toString());
+                                error.setUrl(errorVal.getUrl());
+                                error.setDataVal(errorVal.getDataVal()).setType("入库回传");
+                                errorMapper.addError(error);
+                            } else if (errorVal.getType().equals("移库") || errorVal.getType().equals("半成品入库") || errorVal.getType().equals("销售出库")) {
+                                JSONObject json = (JSONObject) JSONObject.parse(errorVal.getDataVal());
+                                List<JSONObject> data2 = (List<JSONObject>) json.get("BILLs");
+                                for (JSONObject jsonObject2 : data2) {
+                                    if(errorVal.getType().equals("移库")){
+                                        if (jsonObject2.get("WMSCode").toString().equals(map.get("WMSCode")) && jsonObject2.get("FromWareHouse").toString().equals(map.get("FromWareHouse"))) {
+                                            //如果失败存入报错信息跟数据
+                                            error.setErrorInfo(map.get("FailReason").toString());
+                                            error.setUrl(errorVal.getUrl());
+                                            error.setDataVal(jsonObject2.toString()).setType(errorVal.getType());
+                                            errorMapper.addError(error);
+                                        }
+                                    } else {
+                                        if (jsonObject2.get("WMSCode").toString().equals(map.get("WMSCode")) && jsonObject2.get("WareHouse").toString().equals(map.get("WareHouse"))) {
+                                            //如果失败存入报错信息跟数据
+                                            error.setErrorInfo(map.get("FailReason").toString());
+                                            error.setUrl(errorVal.getUrl());
+                                            error.setDataVal(jsonObject2.toString()).setType(errorVal.getType());
+                                            errorMapper.addError(error);
+                                        }
+                                    }
+                                }
+                            } else if(errorVal.getType().equals("出库回传")){
+                                JSONObject json = (JSONObject) JSONObject.parse(errorVal.getDataVal());
+                                List<JSONObject> data2 = (List<JSONObject>) json.get("ReqOutStocks");
+                                for (JSONObject jsonObject2 : data2) {
+                                    if (jsonObject2.get("WMSCode").toString().equals(map.get("WMSCode")) && jsonObject2.get("WareHouse").toString().equals(map.get("WareHouse"))) {
+                                        //如果失败存入报错信息跟数据
+                                        error.setErrorInfo(map.get("FailReason").toString());
+                                        error.setUrl(errorVal.getUrl());
+                                        error.setDataVal(jsonObject2.toString()).setType(errorVal.getType());
+                                        errorMapper.addError(error);
+                                    }
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+            errorMapper.updateError(errorVal.getId()); //修改状态
+            mapVal.put("msg", "200");
+        }catch (Exception e){
+            e.printStackTrace();
+            mapVal.put("msg", "500");
+            mapVal.put("errMsg", "服务器请求异常,请稍后再试");
+        }
+        return mapVal;
+    }
 }

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

@@ -256,7 +256,7 @@ public class WarehousingServiceImpl implements WarehousingService {
                     //如果失败存入报错信息跟数据
                     error.setErrorInfo(result.get("data").toString());
                     error.setUrl("http://42.159.85.29:52480/cwbase/sg/V1/ERP/TELD/DEVTEST/API_WMS_PurInStock/CreateProductiveOutStock");
-                    error.setDataVal(returnData.toJSONString());
+                    error.setDataVal(returnData.toJSONString()).setType("入库回传");
                     errorMapper.addError(error);
                     type = 1;
                 } else {
@@ -265,7 +265,7 @@ public class WarehousingServiceImpl implements WarehousingService {
                         //如果失败存入报错信息跟数据
                         error.setErrorInfo(jsonObject.get("Msg").toString());
                         error.setUrl("http://42.159.85.29:52480/cwbase/sg/V1/ERP/TELD/DEVTEST/API_WMS_PurInStock/CreateProductiveOutStock");
-                        error.setDataVal(returnData.toJSONString());
+                        error.setDataVal(returnData.toJSONString()).setType("入库回传");
                         errorMapper.addError(error);
                         type = 1;
                     }

+ 14 - 2
src/main/resources/mapper/ErrorMapper.xml

@@ -4,7 +4,7 @@
 <mapper namespace="com.tld.mapper.ErrorMapper">
     <!-- 如果失败存入报错信息跟数据 -->
     <insert id="addError">
-        insert into tld_error (url,error_info,data_val,scrq) value (#{url},#{errorInfo},#{dataVal},now())
+        insert into tld_error (url,error_info,data_val,scrq,type,transmission_type) value (#{url},#{errorInfo},#{dataVal},now(),#{type},'1')
     </insert>
     <!--查询error错误日志信息-->
     <select id="getErrorList" resultType="java.util.Map">
@@ -32,6 +32,12 @@
             <if test="dataVal != null and dataVal != ''">
                 and data_val like CONCAT(CONCAT('%', #{dataVal}), '%')
             </if>
+            <if test="type != null and type != ''">
+                and type like CONCAT(CONCAT('%', #{type}), '%')
+            </if>
+            <if test="transmissionType != null and transmissionType != ''">
+                and transmission_type like CONCAT(CONCAT('%', #{transmissionType}), '%')
+            </if>
         </trim>
         ORDER BY scrq DESC
     </select>
@@ -64,5 +70,11 @@
         ORDER BY scrq DESC
     </select>
 
-
+    <delete id="delError">
+        delete from tld_error where id = #{id}
+    </delete>
+    <!-- 修改日志状态 -->
+    <update id="updateError">
+        update tld_error set transmission_type = '0' where id = #{id}
+    </update>
 </mapper>