xiaochen 2 anni fa
parent
commit
bf892f2ef2

+ 10 - 1
src/main/java/com/tld/controller/GsPlugOutController.java

@@ -61,7 +61,7 @@ public class GsPlugOutController {
     }
 
     /**
-     * 生产收货接口文档
+     * 生产收货接口文档/报工单
      * @param removalCode 入库单编号
      */
     @GetMapping("CreateGRReqInStock")
@@ -78,6 +78,15 @@ public class GsPlugOutController {
         askGoodsService.CreateOtherInStock(removalCode);
     }
 
+    /**
+     * 其他发货补领料/其他出货接口文档/其它出库
+     * @param removalCode 入库单编号
+     */
+    @GetMapping("CreateOtherDeliveryMaterials")
+    public void CreateOtherDeliveryMaterials(String removalCode){
+        askGoodsService.CreateOtherDeliveryMaterials(removalCode);
+    }
+
     /**
      * 失败重传
      * @param error 参数

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

@@ -165,4 +165,8 @@ public interface AskGoodsMapper {
     List<Map<String,Object>> getCreateOtherInStockWarehouseWhere(@Param("removalCode") String removalCode);
 
     void delReturnGsWarehousing(@Param("orderNumber") String orderNumber);
+
+    List<Map<String, Object>> getCreateOtherDeliveryMaterialsWarehouseWhere(@Param("removalCode") String removalCode);
+
+    List<Map<String, Object>> getCreateOtherDeliveryMaterialsParent(@Param("documentId") String documentId);
 }

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

@@ -196,6 +196,10 @@ public class AskGoods implements Serializable {
      * 销售单id
      */
     private String deliveryId;
+    /**
+     * 销售单编号
+     */
+    private String deliveryCode;
     /**
      * 客户名称
      */

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

@@ -53,4 +53,6 @@ public interface AskGoodsService {
     void CreateGRReqInStock(String removalCode);
 
     void CreateOtherInStock(String removalCode);
+
+    void CreateOtherDeliveryMaterials(String removalCode);
 }

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

@@ -418,7 +418,7 @@ public class AskGoodsServiceImpl implements AskGoodsService {
             //导出数据汇总
             List<List<Object>> sheetDataList = new ArrayList<>();
             //表头数据
-            List<Object> head = Arrays.asList("物料名称", "供应商名称", "连番号", "类型", "出库用户", "领用部门", "库位名称", "出库日期", "出库数量","要货单ID","真实姓名","公司名称");
+            List<Object> head = Arrays.asList("物料名称", "供应商名称", "连番号", "类型", "出库用户", "领用部门", "库位名称", "出库日期", "出库数量","要货单编号","真实姓名","公司名称");
             //查询数据
             List<Map<String, Object>> list = askGoodsMapper.export(askGoods);
             sheetDataList.add(head);
@@ -555,7 +555,7 @@ public class AskGoodsServiceImpl implements AskGoodsService {
             //导出数据汇总
             List<List<Object>> sheetDataList = new ArrayList<>();
             //表头数据
-            List<Object> head = Arrays.asList("物料名称", "出库数量", "用户名称", "出库时间", "公司名称", "客户名称", "出库单编号", "WBS","真实姓名");
+            List<Object> head = Arrays.asList("交货单编号","物料名称", "出库数量", "用户名称", "出库时间", "公司名称", "客户名称", "出库单编号", "WBS","真实姓名");
             //查询数据
             List<Map<String, Object>> list = askGoodsMapper.getRemovalHalfExcel(askGoods);
             sheetDataList.add(head);
@@ -1175,6 +1175,109 @@ public class AskGoodsServiceImpl implements AskGoodsService {
         }
     }
 
+    /**
+    * @Description: 其他发货补领料/其他出货接口文档/其它出库
+    * @Param: removalCode 单据id
+    * @return: void
+    * @Author: XiaoChen
+    * @Date: 2023/4/13
+    */
+    @Override
+    public void CreateOtherDeliveryMaterials(String removalCode) {
+        try {
+            JSONObject returnData = new JSONObject();
+            List<JSONObject> retunList = new LinkedList<>();
+            LinkedList<String> noticeIds = new LinkedList<>();
+            //通过出库单编号查询单据ID
+            List<Map<String,Object>> lists = askGoodsMapper.getCreateOtherDeliveryMaterialsWarehouseWhere(removalCode);
+            //根据id查询子表的供货仓库
+            //根据仓库循环
+            for (Map<String, Object> maps : lists) {
+                List<Map<String, Object>> mapList = askGoodsMapper.getGsRemoval(removalCode);
+                if(mapList.size() >0 ) {
+                    JSONObject strJson = new JSONObject();
+                    //父表
+                    strJson.put("GIReqBillID", mapList.get(0).get("askGoodsId").toString());//要货单id
+                    strJson.put("WMSID", mapList.get(0).get("id").toString());//出库单id
+                    strJson.put("WMSCode", mapList.get(0).get("removalCode").toString());//出库单编号
+                    strJson.put("WareHouse", maps.get("warehouseWhere"));//仓库ID
+                    strJson.put("SourceBillDate",DateUtil.dateConversion(mapList.get(0).get("scrq").toString()));//业务日期
+                    strJson.put("SourceType", mapList.get(0).get("sourceType").toString());//来源类型
+                    strJson.put("MoveType", mapList.get(0).get("moveType").toString());//移动类型
+                    strJson.put("IsRed", 0);//是否红单1
+                    strJson.put("Creator", "测试");//制单人姓名1
+                    //子表
+                    List<JSONObject> list = new LinkedList<>();
+                    for (Map<String, Object> map : askGoodsMapper.getRemovalz(mapList.get(0).get("askGoodsId").toString(),maps.get("warehouseWhere").toString())) {
+                        JSONObject BillItems = new JSONObject();
+                        BillItems.put("WMSItemID", map.get("id"));//分录ID
+                        BillItems.put("GIReqBillID", map.get("askGoodsId"));//要货申请单ID
+                        BillItems.put("GIReqBillItemID", map.get("entryNumber"));//要货申请明细ID
+                        BillItems.put("Material", map.get("materialId"));//物料id
+                        BillItems.put("Quantity", map.get("num"));//数量
+                        BillItems.put("FlexField1", map.get("wbsId"));//wbs
+                        BillItems.put("FlexField1Code", map.get("wbsCode"));//WBS编号
+                        BillItems.put("FlexField1Name", map.get("wbsName"));//WBS名称
+                        list.add(BillItems);
+                    }
+                    strJson.put("BillItems", list);
+                    retunList.add(strJson);
+                }
+            }
+            JSONObject ReqOutStocks = new JSONObject();
+            ReqOutStocks.put("ReqOutStocks", retunList);
+            List<JSONObject> retunList1 = new LinkedList<>();
+            returnData.put("strJson", JSON.toJSONString(ReqOutStocks));
+            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/CreateMakeUpOtherOutStock", returnData);
+            System.out.println("result:" + result);
+            Error error = new Error();
+            if (Integer.parseInt(result.get("msg").toString()) != 200) {
+                //如果失败存入报错信息跟数据
+                error.setErrorInfo(result.get("data").toString());
+                error.setUrl("http://42.159.85.29:52480/cwbase/sg/V1/ERP/TELD/DEVTEST/API_WMS_PurInStock/CreateMakeUpOtherOutStock");
+                error.setDataVal(returnData.toJSONString()).setType("其它入库");
+                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("http://42.159.85.29:52480/cwbase/sg/V1/ERP/TELD/DEVTEST/API_WMS_PurInStock/CreateMakeUpOtherOutStock");
+                    error.setDataVal(returnData.toJSONString()).setType("其它入库");
+                    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")) {
+                            for (JSONObject jsonObject2 : retunList) {
+                                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("http://42.159.85.29:52480/cwbase/sg/V1/ERP/TELD/DEVTEST/API_WMS_PurInStock/CreateMakeUpOtherOutStock");
+                                    error.setDataVal(jsonObject2.toString()).setType("其它入库");
+                                    errorMapper.addError(error);
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+            //删除父子表信息
+//            askGoodsMapper.delPlugOutRemoval(removalCode);
+//            askGoodsMapper.delRemovalz(removalCode);
+            //添加记录到tld_access
+            String names = "其它出库";
+            String accessType = "1";
+            String returnGsRemoval = returnData.toString();
+            askGoodsMapper.addAccess(names, returnGsRemoval, accessType);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
     /**
      * 出库单生成
      * @return

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

@@ -258,7 +258,7 @@ public class QueryListServiceImpl implements QueryListService {
             //导出数据汇总
             List<List<Object>> sheetDataList = new ArrayList<>();
             //表头数据
-            List<Object> head = Arrays.asList("销售单ID", "物料ID", "WBS", "交货数量", "取消数量", "出库数量", "公司名称", "销售日期", "物料名称", "物料编号","客户名称","来源类型","移动类型","交货类型","分录号");
+            List<Object> head = Arrays.asList("销售单编号", "物料ID", "WBS", "交货数量", "取消数量", "出库数量", "公司名称", "销售日期", "物料名称", "物料编号","客户名称","来源类型","移动类型","交货类型","分录号");
             //查询数据
             List<Map<String, Object>> list = queryListMapper.getDeliveryExcel(delivery);
             sheetDataList.add(head);

+ 62 - 6
src/main/resources/mapper/AskGoodsMapper.xml

@@ -409,7 +409,8 @@
             a.ask_goods_id,
             c.real_name as realName,
             a.account_sleeve,
-            f.name as accountName
+            f.name as accountName,
+            p.ask_goods_code as askGoodsCode
         from tld_removal a
         left join tld_material b on a.wllb_code = b.code
         left join tld_user c on a.user_id = c.id
@@ -417,6 +418,7 @@
         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.code
         left join tld_company f on a.account_sleeve = f.code
+        left join tld_ask_goods_f p on a.ask_goods_id = p.ask_goods_id
         <trim prefix="WHERE" prefixOverrides="and |or">
             <if test="startTime != null and startTime != ''">
                 and a.scrq <![CDATA[>=]]> #{startTime}
@@ -454,6 +456,9 @@
             <if test="askGoodsId != null and askGoodsId != ''">
                 and a.ask_goods_id like CONCAT(CONCAT('%', #{askGoodsId}), '%')
             </if>
+            <if test="askGoodsCode != null and askGoodsCode != ''">
+                and p.ask_goods_code like CONCAT(CONCAT('%', #{askGoodsCode}), '%')
+            </if>
             <if test="accountSleeve != null and accountSleeve != ''">
                 and a.account_sleeve = #{accountSleeve}
             </if>
@@ -472,7 +477,7 @@
             g.storage_location_name as storageLocationName,
             a.scrq,
             a.num,
-            a.ask_goods_id,
+            p.ask_goods_code,
             c.real_name,
             a.account_sleeve,
             f.name as accountName
@@ -483,6 +488,7 @@
         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.code
         left join tld_company f on a.account_sleeve = f.code
+        left join tld_ask_goods_f p on a.ask_goods_id = p.ask_goods_id
         <trim prefix="WHERE" prefixOverrides="and |or">
             <if test="startTime != null and startTime != ''">
                 and a.scrq <![CDATA[>=]]> #{startTime}
@@ -520,6 +526,9 @@
             <if test="askGoodsId != null and askGoodsId != ''">
                 and a.ask_goods_id like CONCAT(CONCAT('%', #{askGoodsId}), '%')
             </if>
+            <if test="askGoodsCode != null and askGoodsCode != ''">
+                and p.ask_goods_code like CONCAT(CONCAT('%', #{askGoodsCode}), '%')
+            </if>
             <if test="accountSleeve != null and accountSleeve != ''">
                 and a.account_sleeve = #{accountSleeve}
             </if>
@@ -606,7 +615,8 @@
             g.name as companyName,
             c.source_type,
             c.move_type,
-            c.sqrq
+            c.sqrq,
+            c.ask_goods_code
         FROM
             tld_ask_goods a
             join tld_material b on a.material_id = b.tld_id
@@ -622,6 +632,9 @@
         <if test="askGoodsId != null and askGoodsId != ''">
             and a.ask_goods_id like CONCAT(CONCAT('%', #{askGoodsId}), '%')
         </if>
+        <if test="askGoodsCode != null and askGoodsCode != ''">
+            and c.ask_goods_code like CONCAT(CONCAT('%', #{askGoodsCode}), '%')
+        </if>
         <if test="id != null and id != ''">
             and a.id = #{id}
         </if>
@@ -674,12 +687,14 @@
             a.wbs,
             e.real_name as realName,
             a.account_sleeve,
-            f.name as accountName
+            f.name as accountName,
+            p.ask_goods_code as askGoodsCode
         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.code
         left join tld_user e on a.user_id = e.id
         left join tld_company f on a.account_sleeve = f.code
+        left join tld_ask_goods_f p on a.ask_goods_id = p.ask_goods_id
         <trim prefix="WHERE" prefixOverrides="and |or">
             <if test="wllbCode != null and wllbCode != ''">
                 and a.wllb_code like CONCAT(CONCAT('%', #{wllbCode}), '%')
@@ -705,6 +720,9 @@
             <if test="askGoodsId != null and askGoodsId != ''">
                 and a.ask_goods_id like CONCAT(CONCAT('%', #{askGoodsId}), '%')
             </if>
+            <if test="askGoodsCode != null and askGoodsCode != ''">
+                and p.ask_goods_code like CONCAT(CONCAT('%', #{askGoodsCode}), '%')
+            </if>
             <if test="storageCode != null and storageCode != ''">
                 and a.storage_code like CONCAT(CONCAT('%', #{storageCode}), '%')
             </if>
@@ -720,7 +738,7 @@
     <!-- 查询半成品出库流水导出 -->
     <select id="getRemovalHalfProductExcel" resultType="java.util.LinkedHashMap">
         select
-            if(a.ask_goods_id = '' , null , a.ask_goods_id ) as askGoodsId,
+            if(p.ask_goods_code = '' , null , p.ask_goods_code ) as askGoodsCode,
             a.storage_code as storageCode,
             a.wllb_code as wllbCode,
             b.name as materialName,
@@ -736,6 +754,7 @@
         left join tld_department c on a.department = c.code
         left join tld_user e on a.user_id = e.id
         left join tld_company f on a.account_sleeve = f.code
+        left join tld_ask_goods_f p on a.ask_goods_id = p.ask_goods_id
         <trim prefix="WHERE" prefixOverrides="and |or">
             <if test="wllbCode != null and wllbCode != ''">
                 and a.wllb_code like CONCAT(CONCAT('%', #{wllbCode}), '%')
@@ -761,6 +780,9 @@
             <if test="askGoodsId != null and askGoodsId != ''">
                 and a.ask_goods_id like CONCAT(CONCAT('%', #{askGoodsId}), '%')
             </if>
+            <if test="askGoodsCode != null and askGoodsCode != ''">
+                and p.ask_goods_code like CONCAT(CONCAT('%', #{askGoodsCode}), '%')
+            </if>
             <if test="storageCode != null and storageCode != ''">
                 and a.storage_code like CONCAT(CONCAT('%', #{storageCode}), '%')
             </if>
@@ -791,12 +813,14 @@
             b.code as materialCode,
             a.storage_code,
             a.wbs,
-            c.real_name as realName
+            c.real_name as realName,
+            p.delivery_code as deliveryCode
         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
         left join tld_customer e on a.customer_code = e.code
         left join tld_company f on a.company_number = f.code
+        left join tld_delivery_f p on a.delivery_id = p.delivery_id
         <trim prefix="WHERE" prefixOverrides="and |or">
             <if test="wllbCode != null and wllbCode != ''">
                 and a.wllb_code like CONCAT(CONCAT('%', #{wllbCode}), '%')
@@ -813,6 +837,9 @@
             <if test="deliveryId != null and deliveryId != ''">
                 and a.delivery_id like CONCAT(CONCAT('%', #{deliveryId}), '%')
             </if>
+            <if test="deliveryCode != null and deliveryCode != ''">
+                and p.delivery_code like CONCAT(CONCAT('%', #{deliveryCode}), '%')
+            </if>
             <if test="companyCode != null and companyCode != ''">
                 and a.company_number = #{companyCode}
             </if>
@@ -837,6 +864,7 @@
     <!-- 产成品导出出库流水 -->
     <select id="getRemovalHalfExcel" resultType="java.util.LinkedHashMap">
         select
+            p.delivery_code as deliveryCode,
             b.name as materialName,
             a.num,
             c.user_name as userName,
@@ -851,6 +879,7 @@
         left join tld_user c on a.user_id = c.id
         left join tld_customer e on a.customer_code = e.code
         left join tld_company f on a.company_number = f.tld_id
+        left join tld_delivery_f p on a.delivery_id = p.delivery_id
         <trim prefix="WHERE" prefixOverrides="and |or">
             <if test="wllbCode != null and wllbCode != ''">
                 and a.wllb_code like CONCAT(CONCAT('%', #{wllbCode}), '%')
@@ -867,6 +896,9 @@
             <if test="deliveryId != null and deliveryId != ''">
                 and a.delivery_id like CONCAT(CONCAT('%', #{deliveryId}), '%')
             </if>
+            <if test="deliveryCode != null and deliveryCode != ''">
+                and p.delivery_code like CONCAT(CONCAT('%', #{deliveryCode}), '%')
+            </if>
             <if test="companyCode != null and companyCode != ''">
                 and a.company_number = #{companyCode}
             </if>
@@ -1273,6 +1305,30 @@
         WHERE a.storage_code = #{removalCode}
         group by b.warehouse_where
     </select>
+    <!--查询其他发货补领料仓库-->
+    <select id="getCreateOtherDeliveryMaterialsWarehouseWhere" resultType="java.util.Map">
+        SELECT DISTINCT b.warehouse_where as warehouseWhere
+        FROM tld_return_gs_removal_z a
+                 JOIN tld_storage_location b ON a.storage_location_code = b.storage_location_code
+        WHERE a.document_id = #{removalCode}
+    </select>
+    <!--查询其他发货父表信息-->
+    <select id="getCreateOtherDeliveryMaterialsParent" resultType="java.util.Map">
+        select
+            id as id,
+            ask_goods_id as askGoodsId,
+            ask_goods_code as askGoodsCode,
+            company_number as companyNumber,
+            sqrq as sqrq,
+            department as department,
+            request_type_number as requestTypeNumber,
+            request_type_name as requestType_name,
+            source_type as sourceType,
+            move_type as moveType,
+            if_commodity as ifCommodity,
+            ifnull(product_code, '')      as productCode,
+        from tld_enquiry_f where ask_goods_id = #{documentId}
+    </select>
     <!-- 修改数据传输状态 -->
     <update id="updateRemoval">
         update tld_removal set transmission_type = "1" where storage_code = #{removalCode}

+ 8 - 1
src/main/resources/mapper/QueryListMappeer.xml

@@ -536,6 +536,7 @@
         b.delivery_type,
         b.source_type,
         b.move_type,
+        b.delivery_code,
         a.entry_number
         from tld_delivery a
         join tld_delivery_f b on a.delivery_id = b.delivery_id
@@ -546,6 +547,9 @@
             <if test="deliveryId != null and deliveryId != ''">
                 and a.delivery_id like CONCAT(CONCAT('%', #{deliveryId}), '%')
             </if>
+            <if test="deliveryCode != null and deliveryCode != ''">
+                and b.delivery_code like CONCAT(CONCAT('%', #{deliveryCode}), '%')
+            </if>
             <if test="materialCode != null and materialCode != ''">
                 and c.code like CONCAT(CONCAT('%', #{materialCode}), '%')
             </if>
@@ -585,7 +589,7 @@
     <!-- 导出销售单 -->
     <select id="getDeliveryExcel" resultType="java.util.LinkedHashMap">
         select
-        a.delivery_id,
+        b.delivery_code,
         a.material_id,
         a.wbs,
         a.gs_delivery_num,
@@ -609,6 +613,9 @@
             <if test="deliveryId != null and deliveryId != ''">
                 and a.delivery_id like CONCAT(CONCAT('%', #{deliveryId}), '%')
             </if>
+            <if test="deliveryCode != null and deliveryCode != ''">
+                and b.delivery_code like CONCAT(CONCAT('%', #{deliveryCode}), '%')
+            </if>
             <if test="materialCode != null and materialCode != ''">
                 and c.code like CONCAT(CONCAT('%', #{materialCode}), '%')
             </if>