Jelajahi Sumber

问题修改

xiaochen 2 tahun lalu
induk
melakukan
9e5a0a0f64

+ 17 - 2
src/main/java/com/tld/controller/AskGoodsController.java

@@ -3,10 +3,8 @@ package com.tld.controller;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.tld.excel.ExcelUtils;
-import com.tld.mapper.WarehousingMapper;
 import com.tld.model.*;
 import com.tld.service.AskGoodsService;
-import com.tld.service.QueryListService;
 import com.tld.util.PassToken;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
@@ -279,6 +277,15 @@ public class AskGoodsController {
         askGoodsService.merge();
     }
 
+    /**
+     * 从父子表存入GS返回数据/出库回传
+     * */
+    @GetMapping("mergeGs")
+    @PassToken
+    public void mergeGs(){
+        askGoodsService.mergeGs();
+    }
+
     /**
      * 出库回传跑数据
      * */
@@ -424,4 +431,12 @@ public class AskGoodsController {
         askGoodsService.ProductionReturnError();
     }
 
+    /**
+     * 移库获取单据物料code分录号数量
+     * */
+    @GetMapping("jsonErrorParking")
+    @PassToken
+    public void jsonErrorParking(){
+        askGoodsService.jsonErrorParking();
+    }
 }

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

@@ -231,4 +231,14 @@ public interface AskGoodsMapper {
     void updJSONError(Error error);
 
     List<Error> getProductionReturnError();
+
+    List<ReturRemoval> getMergeGsF();
+
+    List<ReturRemoval> getMergeGsZ(ReturRemoval returRemoval);
+
+    List<Error> getjsonErrorParking();
+
+    String getMaterialCode(@Param("material") String material);
+
+    void updErrorParking(Error error);
 }

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

@@ -44,4 +44,6 @@ public interface ReceiveGoodsMapper {
     List<ReceiveGoods> getPdaReceiveGoods(ReceiveGoods receiveGoods);
 
     ReceiveGoods getReceiveGoodsCode(@Param("receiveGoodsId") String receiveGoodsId);
+
+    ReceiveGoods getReceiveGoodsZ(ReceiveGoods receiveGoods);
 }

+ 45 - 1
src/main/java/com/tld/model/ReturRemoval.java

@@ -20,6 +20,10 @@ public class ReturRemoval implements Serializable {
      * 要货单id
      */
     private String askGoodsId;
+    /**
+     * 要货申请单编号
+     */
+    private String askGoodsCode;
     /**
      * 出库单编号
      */
@@ -49,9 +53,13 @@ public class ReturRemoval implements Serializable {
      */
     private String wbs;
     /**
-     * 出库数量
+     * 生产单数量
      */
     private String num;
+    /**
+     * 出库数量
+     */
+    private String outNum;
     /**
      * gs分录单id
      */
@@ -88,4 +96,40 @@ public class ReturRemoval implements Serializable {
      * 分录单id
      */
     private String documentPointsId;
+    /**
+     * 退换货(0正常1退货2换货)
+     */
+    private String ifCommodity;
+    /**
+     * 要货申请类型名称
+     */
+    private String requestTypeName;
+    /**
+     * 要货申请类型编号
+     */
+    private String requestTypeNumber;
+    /**
+     * 领用部门
+     */
+    private String department;
+    /**
+     * 申请日期
+     */
+    private String sqrq;
+    /**
+     * 公司编号
+     */
+    private String companyNumber;
+    /**
+     * 生产订单号
+     */
+    private String productionCode;
+    /**
+     * 计量单位
+     */
+    private String measurementId;
+    /**
+     * 状态是否出库
+     */
+    private String type;
 }

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

@@ -100,4 +100,7 @@ public interface AskGoodsService {
 
     void ProductionReturnError();
 
+    void mergeGs();
+
+    void jsonErrorParking();
 }

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

@@ -959,7 +959,7 @@ public class AskGoodsServiceImpl implements AskGoodsService {
                     strJson.put("TOWareHouse", mapList.get(0).get("askGoodsWarehouseId").toString());//要货仓库ID
                     strJson.put("FromWareHouse", warehouseWhere);//供货仓库ID
                     strJson.put("SourceBillDate", DateUtil.dateConversion(mapList.get(0).get("scrq").toString()));//业务日期
-                    strJson.put("MoveType", mapList.get(0).get("warehouseTransferType").toString());//移动类型
+                    strJson.put("MoveType", mapList.get(0).get("warehouseTransferType").toString());//移动类型345
                     strJson.put("IsRed", 0);//是否红单1
                     if (realName == null || realName == ""){
                         realName = "李兆峰" ;
@@ -1685,9 +1685,9 @@ public class AskGoodsServiceImpl implements AskGoodsService {
                         .setStorageLocationCode(LocationCode);
                 System.out.println("封装的数据:"+returnWarehousing.toString());
                 System.out.println("入库数量:"+goods.getWarehousingNum());
-                if (goods.getWarehousingNum().equals("0")){
+//                if (goods.getWarehousingNum().equals("0")){
                     askGoodsMapper.addReturnWarehousing(returnWarehousing);//添加GS返回数据
-                }
+//                }
             }
         }
     }
@@ -1852,7 +1852,8 @@ public class AskGoodsServiceImpl implements AskGoodsService {
     public void jsonError() {
         List<Error> errorList = askGoodsMapper.getJsonError();
         for (Error error : errorList) {
-            System.out.println("字符串为:"+error.getDataVal());
+            System.out.println("字符串为:");
+            System.out.println(error.getDataVal());
             JSONObject jsonObject = JSONObject.parseObject(error.getDataVal());
 
             JSONObject jsonObject1 = JSONObject.parseObject(jsonObject.get("strJson").toString());
@@ -1860,7 +1861,13 @@ public class AskGoodsServiceImpl implements AskGoodsService {
             JSONObject jsonObject2 = new JSONObject();
             jsonObject2.put("strJson",jsonObject1.toJSONString());
 
-            System.out.println("toJsonString字符串为:"+ jsonObject2.toJSONString());
+            System.out.println("toJsonString字符串为:");
+            System.out.println(jsonObject2.toJSONString());
+
+            error.setDataVal(jsonObject2.toJSONString());
+
+            //修改
+            askGoodsMapper.updJSONError(error);
         }
     }
 
@@ -1869,6 +1876,74 @@ public class AskGoodsServiceImpl implements AskGoodsService {
 
     }
 
+    /**
+     * 从父子表存入GS返回数据/出库回传
+     * */
+    @Override
+    public void mergeGs() {
+        //查询父表信息
+        List<ReturRemoval> list = askGoodsMapper.getMergeGsF();
+        for (ReturRemoval returRemoval : list) {
+            //存入父表信息
+            ReturRemoval returRemoval1 = new ReturRemoval()
+                    .setDocumentId(returRemoval.getAskGoodsId())//单据id1
+                    .setRemovalCode(codeGenerateCk())//出库单编号1
+                    .setSourceType(returRemoval.getSourceType())//来源类型1
+                    .setMoveType(returRemoval.getMoveType())//移动类型1
+                    .setDeliveryType(returRemoval.getDeliveryType());//交货类型(DE交货,RD退货)1
+            //查询子表信息
+            List<ReturRemoval> list1 = askGoodsMapper.getMergeGsZ(returRemoval);
+            for (ReturRemoval removal : list1) {
+                //存入子表信息
+                ReturRemoval returRemoval2 = new ReturRemoval()
+                        .setDocumentId(returRemoval.getAskGoodsId())//要货申请单id
+                        .setMaterialId(removal.getMaterialId())//物料id
+                        .setWbs(removal.getWbs())//wbs
+                        .setNum(removal.getNum())//出库数量
+                        .setEntryNumber(removal.getEntryNumber())//分录号
+                        .setDocumentPointsId("   ")//分录单id
+                        .setStorageLocationCode("D2-3-2");//库存编号
+                //添加子表信息
+                askGoodsMapper.addReturnGsRemoval(returRemoval2);
+            }
+            //添加父表信息
+            askGoodsMapper.addReturnGsRemovalF(returRemoval1);
+        }
+    }
+
+    /**
+     * 移库获取单据物料code分录号数量
+     * */
+    @Override
+    public void jsonErrorParking() {
+        //获取数据
+        List<Error> errorList = askGoodsMapper.getjsonErrorParking();
+        for (Error error : errorList) {
+            System.out.println("字符串为:");
+            System.out.println(error.getDataVal());
+            JSONObject jsonObject = JSONObject.parseObject(error.getDataVal());
+
+            JSONObject jsonObject1 = JSONObject.parseObject(jsonObject.get("strJson").toString());
+            List<JSONObject> bilLs = (List<JSONObject>) jsonObject1.get("BILLs");
+            for (JSONObject bilL : bilLs) {
+                List<JSONObject> billItems = (List<JSONObject>) bilL.get("BillItems");
+                for (JSONObject billItem : billItems) {
+                    String WMSCode = bilL.get("WMSCode").toString();
+                    String Quantity = billItem.get("Quantity").toString();
+                    String Material = billItem.get("Material").toString();
+                    String GMReqBillItemID = billItem.get("GMReqBillItemID").toString();
+                    //查询物料code
+                    String code = askGoodsMapper.getMaterialCode(Material);
+                    error.setOrderNumber(WMSCode);//单号
+                    error.setMaterialCode(code);//物料code
+                    error.setNum(Quantity);//数量
+                    error.setClassify(GMReqBillItemID);//分录号
+                    askGoodsMapper.updErrorParking(error);//修改error
+                }
+            }
+        }
+    }
+
     @Override
     public void test() {
         AskGoods askGoods = new AskGoods();

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

@@ -539,6 +539,10 @@ public class QueryListServiceImpl implements QueryListService {
         }
     }
 
+    /**
+     * 失败重传
+     * @return 返回结果
+     */
     @Override
     public Map<String, Object> anew(Error errorVal) {
         Map<String, Object> mapVal = new HashMap<>();

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

@@ -127,7 +127,10 @@ public class ReceiveGoodsSerivceImpl implements ReceiveGoodsSerivce {
                     receiveGoodsMapper.addReceiveGoodsf(receiveGoods);//添加父表
                 }
                 //判断是否重复
-                receiveGoodsMapper.addReceiveGoods(receiveGoods);//添加子表
+                ReceiveGoods receiveGoods2 = receiveGoodsMapper.getReceiveGoodsZ(receiveGoods);
+                if (receiveGoods2 == null){
+                    receiveGoodsMapper.addReceiveGoods(receiveGoods);//添加子表
+                }
 //                   }
                 receiveGoodsMapper.updatePurchaseType(receiveGoods);
                 //采购单日志

+ 61 - 8
src/main/resources/mapper/AskGoodsMapper.xml

@@ -1479,11 +1479,9 @@
     </select>
     <!--出库错误信息回调-->
     <select id="getOutgoingReturnError" resultType="com.tld.model.Error">
-        select id,url,error_info,data_val,scrq,type,transmission_type from tld_error_error
-        where transmission_type = '1'
+        select id,url,error_info,data_val,scrq,type,transmission_type from tld_error
+        where transmission_type = '3'
         and type = '出库回传'
-        and scrq <![CDATA[>=]]> '2023-05-13'
-        and error_info like '%message%'
     </select>
     <!--查询销售出库导入数据-->
     <select id="getMarketList" resultType="com.tld.model.MarketReturn">
@@ -1590,15 +1588,65 @@
     </select>
     <!--转JSON-->
     <select id="getJsonError" resultType="com.tld.model.Error">
-        select id,url,error_info,data_val,scrq,type,transmission_type from tld_error_error
-        where type = '出库回传'
-        and scrq <![CDATA[>=]]> '2023-05-13'
+        select id,url,error_info,data_val,scrq,type,transmission_type from tld_error
+        where transmission_type = '1'
+        and type = '移库'
     </select>
     <select id="getProductionReturnError" resultType="com.tld.model.Error">
         select id,url,error_info,data_val,scrq,type,transmission_type from tld_error
         where transmission_type = '3'
         and type = '生产收货'
     </select>
+    <!--查询父表信息-->
+    <select id="getMergeGsF" resultType="com.tld.model.ReturRemoval">
+        select
+            id,
+            ask_goods_id,
+            ask_goods_code,
+            company_number,
+            sqrq,
+            department,
+            source_type,
+            move_type,
+            request_type_number,
+            request_type_name,
+            if_commodity
+        from tld_ask_goods_f
+    </select>
+    <!--查询子表信息-->
+    <select id="getMergeGsZ" resultType="com.tld.model.ReturRemoval">
+        select
+            ask_goods_id,
+            entry_number,
+            production_code,
+            material_id,
+            wbs,
+            measurement_id,
+            num,
+            out_num,
+            type
+        from tld_ask_goods where ask_goods_id = #{askGoodsId}
+    </select>
+    <!--移库获取单据物料code分录号数量-->
+    <select id="getjsonErrorParking" resultType="com.tld.model.Error">
+        select
+            id,
+            url,
+            error_info,
+            data_val,
+            scrq,
+            type,
+            transmission_type,
+            order_number,
+            material_code,
+            num,
+            classify
+        from tld_error_excel_parking
+    </select>
+    <!--查询物料code-->
+    <select id="getMaterialCode" resultType="java.lang.String">
+        select code from tld_material where tld_id = #{material}
+    </select>
     <!-- 修改数据传输状态 -->
     <update id="updateRemoval">
         update tld_removal set transmission_type = "1" where storage_code = #{removalCode}
@@ -1624,6 +1672,11 @@
     </update>
     <!--修改-->
     <update id="updJSONError">
-        update tld_error_error set data_val = #{dataVal} where id = #{id}
+        update tld_error set data_val = #{dataVal} where id = #{id}
+    </update>
+    <!--修改error-->
+    <update id="updErrorParking">
+        update tld_error_excel_parking set order_number = #{orderNumber} , material_code = #{materialCode} , num = #{num} , classify = #{classify}
+        where id = #{id}
     </update>
 </mapper>

+ 23 - 0
src/main/resources/mapper/ReceiveGoodsMapper.xml

@@ -461,4 +461,27 @@
         LEFT JOIN tld_customer f on a.supplier_id = f.code
         WHERE a.id = #{receiveGoodsId}
     </select>
+    <!--判断是否重复-->
+    <select id="getReceiveGoodsZ" resultType="com.tld.model.ReceiveGoods">
+        select
+            id,
+            order_code,
+            source_id,
+            material_id,
+            purchase_num,
+            arrival_num,
+            type,
+            qualified_num,
+            disqualification_num,
+            wbs,
+            arrival_time,
+            measurement_id,
+            supplier_id,
+            entry_number_id,
+            entry_number,
+            warehousing_num
+        from tld_receive_goods
+        where source_id = #{sourceId}
+        and entry_number_id = #{entryNumberId}
+    </select>
 </mapper>