瀏覽代碼

问题修改

xiaochen 2 年之前
父節點
當前提交
288ebddca3

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

@@ -69,6 +69,15 @@ public class GsPlugOutController {
         askGoodsService.CreateGRReqInStock(removalCode);
     }
 
+    /**
+     * 其他收货接口文档/其它入库
+     * @param removalCode 入库单编号
+     */
+    @GetMapping("CreateOtherInStock")
+    public void CreateOtherInStock(String removalCode){
+        askGoodsService.CreateOtherInStock(removalCode);
+    }
+
     /**
      * 失败重传
      * @param error 参数

+ 10 - 0
src/main/java/com/tld/controller/QueryListController.java

@@ -247,5 +247,15 @@ public class QueryListController {
         return queryListService.getOtherReceivingGoods(notice);
     }
 
+    /**
+     * 查询其它出库
+     * @param askGoods 参数
+     * @return 返回结果
+     */
+    @GetMapping("getOtherShipments")
+    public Map<String, Object> getOtherShipments(AskGoods askGoods){
+        return queryListService.getOtherShipments(askGoods);
+    }
+
 }
 

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

@@ -151,4 +151,16 @@ public interface AskGoodsMapper {
     void updateRemovalHalfProduct(String wmsCode);
 
     void updateRemovalHalf(String wmsCode);
+
+    List<ReturnWarehousing> getReturnGsOtherWarehousing(@Param("removalCode") String removalCode);
+
+    List<Map<String, Object>> getNoticesParent(@Param("noticeId") String noticeId , @Param("storageLocationCode") String storageLocationCode);
+
+    List<Map<String, Object>> getNoticesSubtabulation(@Param("noticeId") String noticeId,@Param("warehouseWhere") String warehouseWhere);
+
+    void delNoticesParent(@Param("noticeId") String noticeId);
+
+    void delNoticesSubtabulation(@Param("noticeId") String noticeId);
+
+    List<Map<String,Object>> getCreateOtherInStockWarehouseWhere(@Param("removalCode") String removalCode);
 }

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

@@ -59,4 +59,6 @@ public interface QueryListMapper {
     List<Notice> getOtherReceivingGoods(Notice notice);
 
     void updateType(String wmsCode);
+
+    List<AskGoods> getOtherShipments(AskGoods askGoods);
 }

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

@@ -16,6 +16,10 @@ public class Inventory implements Serializable {
      * 主键
      */
     private String id;
+    /**
+     * 通知单id
+     */
+    private String noticeId;
     /**
      * 库位编号
      */

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

@@ -52,6 +52,10 @@ public class ReturnWarehousing implements Serializable {
      * wbsName
      */
     private String wbsName;
+    /**
+     * 所属公司
+     */
+    private String accountSleeve;
     /**
      * 物料id
      */
@@ -60,6 +64,10 @@ public class ReturnWarehousing implements Serializable {
      * 入库数量
      */
     private String warehousingNum;
+    /**
+     * 实际数量
+     */
+    private String amount;
     /**
      * 分录单id
      */

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

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

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

@@ -55,4 +55,6 @@ public interface QueryListService {
     Map<String, Object> anew(Error error);
 
     Map<String, Object> getOtherReceivingGoods(Notice notice);
+
+    Map<String, Object> getOtherShipments(AskGoods askGoods);
 }

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

@@ -1051,6 +1051,9 @@ public class AskGoodsServiceImpl implements AskGoodsService {
             askGoodsMapper.delNoticeParent(returnWarehousing.getOrderNumber());
             //根据id
             askGoodsMapper.delNoticeSubtabulation(returnWarehousing.getOrderNumber());
+            askGoodsMapper.delNoticeParent(returnWarehousing.getOrderNumber());
+            //根据id
+            askGoodsMapper.delNoticeSubtabulation(returnWarehousing.getOrderNumber());
             //添加记录到tld_access
             String names = "报工单";
             String accessType = "1";
@@ -1061,6 +1064,111 @@ public class AskGoodsServiceImpl implements AskGoodsService {
         }
     }
 
+    /**
+    * @Description: 其他收货接口文档/其它入库
+    * @Param: removalCode
+    * @return: void
+    * @Author: XiaoChen
+    * @Date: 2023/4/12
+    */
+    @Override
+    public void CreateOtherInStock(String removalCode) {
+        try {
+            JSONObject returnData = new JSONObject();
+            List<JSONObject> retunList = new LinkedList<>();
+            //通过入库单编号查询通知单ID
+//            List<ReturnWarehousing>  returnWarehousing = askGoodsMapper.getReturnGsOtherWarehousing(removalCode);
+                //根据id查询子表的供货仓库
+                for (Map<String,Object> returnWarehousing1 : askGoodsMapper.getCreateOtherInStockWarehouseWhere(removalCode)) {
+                    JSONObject strJson = new JSONObject();
+                    //父表
+                    strJson.put("GRReqBillID", returnWarehousing1.get("noticeId").toString());//入库通知单ID
+                    strJson.put("WMSID", returnWarehousing1.get("wmsId").toString());//利道WMS出库单id
+                    strJson.put("WMSCode", returnWarehousing1.get("noticeCode").toString());//利道WMS出库单编号
+                    strJson.put("WareHouse", returnWarehousing1.get("warehouseWhere"));//仓库ID
+                    strJson.put("SourceBillDate", DateUtil.dateConversion(returnWarehousing1.get("noticeTime").toString()));//业务日期
+                    strJson.put("SourceType", returnWarehousing1.get("sourceType").toString());//来源类型
+                    strJson.put("MoveType", returnWarehousing1.get("moveType").toString());//移动类型
+                    strJson.put("IsRed", 0);//是否红单1
+                    strJson.put("Creator", "测试");//制单人姓名1
+                    //查询信息
+                    List<JSONObject> list = new LinkedList<>();
+                    List<Map<String, Object>> mapList = askGoodsMapper.getNoticesParent(removalCode,returnWarehousing1.get("storageLocationCode").toString());
+                    if (mapList.size() > 0) {
+                        for (Map<String, Object> map : mapList) {
+                            //子表
+                            JSONObject BillItems = new JSONObject();
+                            BillItems.put("WMSItemID", map.get("wmsItemId"));//分录ID
+                            BillItems.put("GRReqBillID", map.get("noticeId"));//入库通知单ID
+                            BillItems.put("GRReqBillItemID", map.get("entryNumber"));//入库通知单明细ID
+                            BillItems.put("Material", map.get("materialId"));//物料id
+                            BillItems.put("Quantity", map.get("amount"));//数量
+                            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("BILLs", 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/CreateOtherInStock", 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/CreateOtherInStock");
+                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/CreateOtherInStock");
+                    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/CreateOtherInStock");
+                                    error.setDataVal(jsonObject2.toString()).setType("其它入库");
+                                    errorMapper.addError(error);
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+
+            //删除父子表信息
+            //根据code
+//            askGoodsMapper.delNoticesParent(returnWarehousing.getNoticeId());
+//            //根据id
+//            askGoodsMapper.delNoticesSubtabulation(returnWarehousing.getNoticeId());
+            //添加记录到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/InviteServiceImpl.java

@@ -348,7 +348,7 @@ public class InviteServiceImpl implements InviteService {
         try {
             inviteMapper.otherShipments(mapList);
             //新增日志
-            Access access = new Access().setType("其出库").setData(JSON.toJSONString(mapList)).setAccessType("0");
+            Access access = new Access().setType("其出库").setData(JSON.toJSONString(mapList)).setAccessType("0");
             dictionaryMapper.addAccess(access);
             map.put("status", "0000");
             map.put("msg","成功");

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

@@ -669,4 +669,28 @@ public class QueryListServiceImpl implements QueryListService {
         }
         return map;
     }
+
+    /** 
+    * @Description: 查询其它出库
+    * @Param: AskGoods askGoods
+    * @return: Map<String, Object> map
+    * @Author: XiaoChen
+    * @Date: 2023/4/12
+    */
+    
+    @Override
+    public Map<String, Object> getOtherShipments(AskGoods askGoods) {
+        Map<String, Object> map = new HashMap<>();
+        try {
+            PageHelper.startPage(askGoods.getPage(),askGoods.getLimit());
+            PageInfo<AskGoods> list = new PageInfo<>(queryListMapper.getOtherShipments(askGoods));
+            map.put("data",list);
+            map.put("msg","200");
+        }catch (Exception e){
+            e.printStackTrace();
+            map.put("msg","500");
+            map.put("errMsg","服务器请求异常,请稍后再试");
+        }
+        return map;
+    }
 }

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

@@ -850,6 +850,7 @@ public class WarehousingServiceImpl implements WarehousingService {
             List<WarehousingVirtual> list = new LinkedList<>();
             String storageCode = codeGenerateRk();//入库单
             WarehousingVirtual warehousingVirtual = new WarehousingVirtual()
+                    .setNoticeId(inventory.getNoticeId())//通知单id
                     .setStorageCode(storageCode)
                     .setWllbCode(materialClass.getCode())
                     .setSuppId(inventory.getSupplierId())

+ 97 - 0
src/main/resources/mapper/AskGoodsMapper.xml

@@ -1088,6 +1088,18 @@
         from tld_notice
         where notice_id = #{orderNumber}
     </delete>
+    <!--删除其它入库父表信息-->
+    <delete id="delNoticesParent">
+        delete
+        from tld_notices_f
+        where notice_id = #{noticeId}
+    </delete>
+    <!--删除其它入库子表信息-->
+    <delete id="delNoticesSubtabulation">
+        delete
+        from tld_notices
+        where notice_id = #{noticeId}
+    </delete>
     <!-- 查询名牌物料CODE -->
     <select id="getMing" resultType="String">
         select wllb_code from tld_mingpai where code = #{code}
@@ -1150,6 +1162,91 @@
     <select id="getAmount" resultType="java.lang.String">
         select ifnull(sum(amount),'0') as amount from tld_inventory where wbs = #{wbs} and account_sleeve = #{companyNumber} and wllb_code = #{materialCode}
     </select>
+    <!--根据入库单编号查询入库单信息-->
+    <select id="getReturnGsOtherWarehousing" resultType="com.tld.model.ReturnWarehousing">
+        select
+        distinct
+            id,
+            storage_code,
+            account_sleeve,
+            storage_location_code,
+            wbs,
+            amount,
+            material_id,
+            notice_id
+        from tld_return_gs_other_warehousing where storage_code = #{removalCode}
+        group by notice_id
+    </select>
+    <!--查询其他入库表信息-->
+    <select id="getNoticesParent" resultType="java.util.Map">
+        SELECT
+            a.id as id,
+            a.storage_code as storageCde,
+            a.account_sleeve as accountSleeve,
+            a.storage_location_code as storageLocationCode,
+            a.notice_id as noticeId,
+            a.notice_code as noticeCode,
+            a.amount as amount,
+            ifnull(a.wbs, '')      as wbsId,
+            ifnull(a.wbs_code, '')      as wbsCode,
+            ifnull(a.wbs_name, '')      as wbsName,
+            a.notice_time as noticeTime,
+            a.source_type as sourceType,
+            a.move_type as moveType,
+            a.entry_number as entryNumber,
+            a.wms_item_id as wmsItemId,
+            a.material_id as materialId,
+            a.wms_id as wmsId,
+            b.warehouse_where as warehouseWhere
+        FROM tld_return_gs_other_warehousing a
+                 JOIN tld_storage_location b ON a.storage_location_code = b.storage_location_code
+        WHERE a.storage_code = #{noticeId} and a.storage_location_code = #{storageLocationCode}
+    </select>
+    <!--查询其他入库子表信息-->
+    <select id="getNoticesSubtabulation" resultType="java.util.Map">
+        select
+            a.id as id,
+            a.notice_id as noticeId,
+            a.entry_number as entryNumber,
+            a.material_id as materialId,
+            ifnull(a.wbs, '')       as wbsId,
+            a.measurement_id as measurementId,
+            a.num as num,
+            a.type as type,
+            a.warehousing_num as warehousingNum,
+            ifnull(b.code, '')      as wbsCode,
+            ifnull(b.name, '')      as wbsName
+        from tld_notices a
+                 left join tld_wbs b on a.wbs = b.tld_id
+                 join tld_storage_location c on a.storage_location_code = c.storage_location_code
+        where a.notice_id = #{noticeId}
+    </select>
+    <!--查询仓库信息-->
+    <select id="getCreateOtherInStockWarehouseWhere" resultType="java.util.Map">
+        SELECT
+            a.id as id,
+            a.storage_code as storageCde,
+            a.account_sleeve as accountSleeve,
+            a.storage_location_code as storageLocationCode,
+            a.notice_id as noticeId,
+            a.notice_code as noticeCode,
+            a.amount as amount,
+            ifnull(a.wbs, '')      as wbsId,
+            ifnull(a.wbs_code, '')      as wbsCode,
+            ifnull(a.wbs_name, '')      as wbsName,
+            a.notice_time as noticeTime,
+            a.source_type as sourceType,
+            a.move_type as moveType,
+            a.entry_number as entryNumber,
+            a.wms_item_id as wmsItemId,
+            a.material_id as materialId,
+            a.wms_id as wmsId,
+            b.warehouse_where as warehouseWhere
+        FROM tld_return_gs_other_warehousing a
+        JOIN tld_storage_location b ON a.storage_location_code = b.storage_location_code
+        WHERE a.storage_code = #{removalCode}
+        group by b.warehouse_where
+    </select>
     <!-- 修改数据传输状态 -->
     <update id="updateRemoval">
         update tld_removal set transmission_type = "1" where storage_code = #{removalCode}

+ 54 - 0
src/main/resources/mapper/QueryListMappeer.xml

@@ -1014,4 +1014,58 @@
         update tld_storage set transmission_type = 0 where storage_code = #{wmsCode};
         update tld_removal set transmission_type = 0 where storage_code = #{wmsCode};
     </update>
+    <!--查询其它出库信息-->
+    <select id="getOtherShipments" resultType="com.tld.model.AskGoods">
+        select
+            a.id,
+            a.ask_goods_id,
+            a.entry_number,
+            a.material_id,
+            a.wbs,
+            a.measurement_id,
+            a.num,
+            b.ask_goods_code,
+            b.company_number,
+            b.sqrq,
+            b.department,
+            b.source_type,
+            b.move_type,
+            b.request_type_number,
+            b.request_type_name,
+            b.if_commodity,
+            c.name as materialName,
+            c.code as materialCode,
+            k.name as companyName
+        from tld_enquiry a
+        join tld_enquiry_f b on a.ask_goods_id = b.ask_goods_id
+        join tld_material c on a.material_id = c.tld_id
+        join tld_company k on b.company_number = k.code
+        <trim prefix="WHERE" prefixOverrides="and |or">
+            <if test="askGoodsType != null and askGoodsType != ''">
+                and a.ask_goods_type = #{askGoodsType}
+            </if>
+            <if test="materialCode != null and materialCode != ''">
+                and c.code like CONCAT(CONCAT('%', #{materialCode}), '%')
+            </if>
+            <if test="materialName != null and materialName != ''">
+                and c.name like CONCAT(CONCAT('%', #{materialName}), '%')
+            </if>
+            <if test="startTime != null and startTime != ''">
+                and b.sqrq <![CDATA[>=]]> #{startTime}
+            </if>
+            <if test="endTime != null and endTime != ''">
+                and b.sqrq <![CDATA[<=]]> #{endTime}
+            </if>
+            <if test="companyNumber != null and companyNumber != ''">
+                and b.company_number = #{companyNumber}
+            </if>
+            <if test="entryNumber != null and entryNumber != ''">
+                and a.entry_number like CONCAT(CONCAT('%', #{entryNumber}), '%')
+            </if>
+            <if test="wbs != null and wbs != ''">
+                and a.wbs like CONCAT(CONCAT('%', #{wbs}), '%')
+            </if>
+        </trim>
+        order by a.id desc
+    </select>
 </mapper>

+ 2 - 2
src/main/resources/mapper/WarehousingMapper.xml

@@ -1007,8 +1007,8 @@
     <!-- 其他入库返回gs -->
     <insert id="addReturnWarehousingOther">
         insert into tld_return_gs_other_warehousing(storage_code, account_sleeve, storage_location_code, wbs, amount,
-                                                    material_id)
-            value (#{storageCode},#{accountSleeve},#{storageLocationCode},#{wbs},#{num},#{materialId})
+                                                    material_id,notice_id)
+            value (#{storageCode},#{accountSleeve},#{storageLocationCode},#{wbs},#{num},#{materialId},#{noticeId})
     </insert>
     <!-- 其他入库 -->
     <insert id="addInventoryOther">