Browse Source

1.提供对外下架包件,零担,库存品接口

training
zhenghaoyu 1 year ago
parent
commit
f668bed73d
  1. 52
      blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/feign/IWarehouseUpdownTypeClient.java
  2. 99
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/feign/WarehouseUpdownTypeClient.java

52
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<JSONObject> zeroOrders);
@PostMapping(TOP + "/downStock")
R downStock(@RequestBody List<JSONObject> stockLists);
}

99
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<UpShelfPackageDTO> 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<JSONObject> zeroOrders) {
List<UpShelfZeroOrderDTO> 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<JSONObject> stockLists) {
List<UpShelfStockDTO> 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,"处理失败");
}
}
}
Loading…
Cancel
Save