diff --git a/blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/feign/IWarehouseUpdownTypeClient.java b/blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/feign/IWarehouseUpdownTypeClient.java new file mode 100644 index 000000000..3bfd4e30b --- /dev/null +++ b/blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/feign/IWarehouseUpdownTypeClient.java @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the dreamlu.net developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: Chill 庄骞 (smallchill@163.com) + */ +package com.logpm.warehouse.feign; + +import com.alibaba.fastjson.JSONObject; +import org.springblade.common.constant.ModuleNameConstant; +import org.springblade.core.tool.api.R; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestParam; + +import java.util.List; + +/** + * 上下架 Feign接口类 + * + * @author zhy + * @since 2023-08-15 + */ +@FeignClient( + value = ModuleNameConstant.APPLICATION_WAREHOUSE_NAME +) +public interface IWarehouseUpdownTypeClient { + + String API_PREFIX = "warehouseUpdownTypeLog/client"; + String TOP = API_PREFIX + "/top"; + + @GetMapping(TOP + "/downPackage") + R downPackage(@RequestParam("orderPackageCodes") String orderPackageCodes); + + @PostMapping(TOP + "/downZeroOrder") + R downZeroOrder(@RequestBody List zeroOrders); + + @PostMapping(TOP + "/downStock") + R downStock(@RequestBody List stockLists); +} diff --git a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/feign/WarehouseUpdownTypeClient.java b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/feign/WarehouseUpdownTypeClient.java new file mode 100644 index 000000000..28438889b --- /dev/null +++ b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/feign/WarehouseUpdownTypeClient.java @@ -0,0 +1,99 @@ +/* + * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the dreamlu.net developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: Chill 庄骞 (smallchill@163.com) + */ +package com.logpm.warehouse.feign; + +import com.alibaba.fastjson.JSONObject; +import com.logpm.warehouse.dto.UpShelfPackageDTO; +import com.logpm.warehouse.dto.UpShelfStockDTO; +import com.logpm.warehouse.dto.UpShelfZeroOrderDTO; +import com.logpm.warehouse.service.IWarehouseUpdownTypeService; +import lombok.AllArgsConstructor; +import org.springblade.core.tool.api.R; +import org.springframework.web.bind.annotation.RestController; +import springfox.documentation.annotations.ApiIgnore; + +import java.util.ArrayList; +import java.util.List; + +/** + * 上下架记录表 Feign实现类 + * + * @author lmy + * @since 2023-08-15 + */ +@ApiIgnore() +@RestController +@AllArgsConstructor +public class WarehouseUpdownTypeClient implements IWarehouseUpdownTypeClient { + + private final IWarehouseUpdownTypeService warehouseUpdownTypeService; + + @Override + public R downPackage(String orderPackageCodes) { + List upShelfPackageList = new ArrayList<>(); + String[] split = orderPackageCodes.split(","); + for(String orderPackageCode:split){ + UpShelfPackageDTO dto = new UpShelfPackageDTO(); + dto.setOrderPackageCode(orderPackageCode); + upShelfPackageList.add(dto); + } + if(upShelfPackageList.size() > 0){ + return warehouseUpdownTypeService.downPackage(upShelfPackageList); + }else{ + return R.fail(403,"处理失败"); + } + } + + @Override + public R downZeroOrder(List zeroOrders) { + List ls = new ArrayList<>(); + for (JSONObject jsonObject:zeroOrders){ + UpShelfZeroOrderDTO dto = new UpShelfZeroOrderDTO(); + dto.setOrderCode(jsonObject.getString("orderCode"));//订单号 + dto.setWaybillCode(jsonObject.getString("waybillCode"));//运单号 + dto.setEnterNum(jsonObject.getInteger("enterNum"));//件数 + dto.setAllocationId(jsonObject.getLong("allocationId"));//库位id + ls.add(dto); + } + + if(ls.size() > 0){ + return warehouseUpdownTypeService.downZeroOrder(ls); + }else{ + return R.fail(403,"处理失败"); + } + } + + @Override + public R downStock(List stockLists) { + List ls = new ArrayList<>(); + for (JSONObject jsonObject:stockLists){ + UpShelfStockDTO dto = new UpShelfStockDTO(); + dto.setMarketId(jsonObject.getLong("marketId"));//商场id + dto.setMaterialCode(jsonObject.getString("materialCode"));//物料编码 + dto.setIncomingBatch(jsonObject.getString("incomingBatch"));//批次号 + dto.setEnterNum(jsonObject.getInteger("enterNum"));//件数 + dto.setAllocationId(jsonObject.getLong("allocationId"));//库位id + ls.add(dto); + } + + if(ls.size() > 0){ + return warehouseUpdownTypeService.downStock(ls); + }else{ + return R.fail(403,"处理失败"); + } + } +}