Commit db6846a3 zshaohui

原材料仓 退库上架提交

1 个父辈 136800e6
......@@ -8,6 +8,8 @@ public class CacheNameUtil {
public static final String CHCHE_STOR_TRANSFER = "CHCHE_STOR_TRANSFER";
public static final String CHCHE_RETURN_TOWER = "CHCHE_RETURN_TOWER";
public static final String CHCHE_TICKET_RETURN = "CHCHE_TICKET_RETURN";
public static final String CHCHE_TICKET_TRANSFER = "CHCHE_TICKET_TRANSFER";
......
package com.neotel.smfcore.custom.luxsan.factory_c.rawstor.bean;
import lombok.AllArgsConstructor;
import lombok.Data;
@Data
@AllArgsConstructor
public class ReturnTower {
private String materialStr;
private String warehouseCode;
private String provider;
private int w;
private int h;
}
package com.neotel.smfcore.custom.luxsan.factory_c.rawstor.controller;
import com.alibaba.fastjson.JSON;
import com.neotel.smfcore.common.bean.ResultBean;
import com.neotel.smfcore.common.utils.StringUtils;
import com.neotel.smfcore.core.barcode.service.po.Barcode;
import com.neotel.smfcore.core.barcode.utils.CodeResolve;
import com.neotel.smfcore.core.device.util.DataCache;
import com.neotel.smfcore.custom.luxsan.api.LuxsanApi;
import com.neotel.smfcore.custom.luxsan.api.bean.request.BrandQtyRequest;
import com.neotel.smfcore.custom.luxsan.api.bean.result.BrandQtyResult;
import com.neotel.smfcore.custom.luxsan.factory_c.common.util.CacheNameUtil;
import com.neotel.smfcore.custom.luxsan.factory_c.rawstor.bean.ReturnTower;
import com.neotel.smfcore.custom.luxsan.factory_c.rawstor.bean.StorTransfer;
import com.neotel.smfcore.custom.luxsan.factory_c.rawstor.util.MaterialUtil;
import com.neotel.smfcore.security.annotation.AnonymousAccess;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.ehcache.impl.internal.concurrent.ConcurrentHashMap;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Map;
@Slf4j
@ApiOperation("从3F转到W2 1F")
@RequestMapping("/returnTower")
@RestController
public class ReturnTowerController {
@Autowired
private DataCache dataCache;
@Autowired
private CodeResolve codeResolve;
@ApiOperation("刷料串,进行绑定")
@RequestMapping("/bindReturnTower")
@AnonymousAccess
public ResultBean bindReturnTower(@RequestBody Map<String,String> paramMap) {
log.info("退回大库为:" + JSON.toJSONString(paramMap));
String materialStr = paramMap.get("materialStr");
//String warehouseCode = paramMap.get("warehouseCode");
String codeStr = paramMap.get("codeStr");
if (StringUtils.isEmpty(materialStr)) {
return ResultBean.newErrorResult(-1, "smfcore.valueCanotNull", "{0}不能为空", new String[]{"料串信息"});
}
/*if (StringUtils.isEmpty(warehouseCode)) {
return ResultBean.newErrorResult(-1, "smfcore.valueCanotNull", "{0}不能为空", new String[]{"库别信息"});
}*/
//判断料串信息是否正确
if (StringUtils.isEmpty(materialStr) || !materialStr.startsWith("B00")) {
return ResultBean.newErrorResult(-1, "", "料串:" + materialStr + "不是有效的");
}
//判断是否已经绑定过其他信息
if (MaterialUtil.bindInfo(materialStr)) {
return ResultBean.newErrorResult(-1, "", "料串:" + materialStr + "已经进行绑定,请核实");
}
//解析条码为barcode
Barcode barcode = codeResolve.resolveOneValideBarcode(codeStr);
if (barcode == null) {
return ResultBean.newErrorResult(-1, "smfcore.error.barcode.noValidCode", "条码无效");
}
String warehouseCode = barcode.getWarehouseCode();
if (StringUtils.isEmpty(warehouseCode)) {
return ResultBean.newErrorResult(-1, "", "未找到"+barcode.getBarcode()+"的库别信息");
}
//获取尺寸信息
BrandQtyResult result = LuxsanApi.brandQtyUrl(new BrandQtyRequest(barcode.getPartNumber(), barcode.getProvider()));
if (result == null) {
return ResultBean.newErrorResult(-1, "", "未找到维护的尺寸信息");
}
int reelSize = result.getReel_size();
int h = 0;
if (reelSize == 7) {
h = 8;
} else if (reelSize == 13) {
h = 24;
} else if (reelSize == 15) {
h = 32;
}
ReturnTower returnTower = new ReturnTower(materialStr,warehouseCode,barcode.getProvider(),reelSize,h);
//1.判断料仓信息是否在储位转移中
Map<String, ReturnTower> cacheMap = dataCache.getCache(CacheNameUtil.CHCHE_RETURN_TOWER);
if (cacheMap == null) {
cacheMap = new ConcurrentHashMap<>();
}
if (cacheMap.get(materialStr) != null) {
return ResultBean.newErrorResult(-1, "", materialStr + "已经在退库列表中");
}
cacheMap.put(materialStr, returnTower);
dataCache.updateCache(CacheNameUtil.CHCHE_RETURN_TOWER, cacheMap);
return ResultBean.newOkResult("");
}
@ApiOperation("退库信息")
@RequestMapping("/returnTowerInfo")
@AnonymousAccess
public ResultBean returnTowerInfo() {
//1.判断料仓信息是否在储位转移中
Map<String, ReturnTower> cacheMap = dataCache.getCache(CacheNameUtil.CHCHE_RETURN_TOWER);
if (cacheMap == null){
cacheMap = new ConcurrentHashMap<>();
}
return ResultBean.newOkResult(cacheMap.values());
}
@ApiOperation("移除退库信息")
@RequestMapping("/removeReturnTower")
@AnonymousAccess
public ResultBean removeReturnTower(String materialStr) {
//1.判断料仓信息是否在储位转移中
Map<String, ReturnTower> cacheMap = dataCache.getCache(CacheNameUtil.CHCHE_RETURN_TOWER);
if (cacheMap == null){
cacheMap = new ConcurrentHashMap<>();
}
cacheMap.remove(materialStr);
dataCache.updateCache(CacheNameUtil.CHCHE_RETURN_TOWER,cacheMap);
return ResultBean.newOkResult(cacheMap);
}
}
......@@ -137,6 +137,7 @@ public class StorTransferController {
}
cacheMap.remove(materialStr);
dataCache.updateCache(CacheNameUtil.CHCHE_STOR_TRANSFER,cacheMap);
return ResultBean.newOkResult(cacheMap);
}
......
......@@ -2,10 +2,7 @@ package com.neotel.smfcore.custom.luxsan.factory_c.rawstor.util;
import com.neotel.smfcore.common.utils.StringUtils;
import com.neotel.smfcore.core.device.util.DataCache;
import com.neotel.smfcore.custom.luxsan.factory_c.rawstor.bean.BindGrInfo;
import com.neotel.smfcore.custom.luxsan.factory_c.rawstor.bean.StorTransfer;
import com.neotel.smfcore.custom.luxsan.factory_c.rawstor.bean.TicketReturn;
import com.neotel.smfcore.custom.luxsan.factory_c.rawstor.bean.TicketTransfer;
import com.neotel.smfcore.custom.luxsan.factory_c.rawstor.bean.*;
import com.neotel.smfcore.custom.luxsan.factory_c.common.util.CacheNameUtil;
import org.ehcache.impl.internal.concurrent.ConcurrentHashMap;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -24,7 +21,7 @@ public class MaterialUtil {
public static boolean bindInfo(String materialStr) {
return bindGr(materialStr) || storTransfer(materialStr) || ticketReturn(materialStr) || ticketTransfer(materialStr);
return bindGr(materialStr) || storTransfer(materialStr) || ticketReturn(materialStr) || ticketTransfer(materialStr) || returnTower(materialStr);
}
public static String getWarhouseCode(String materialStr) {
......@@ -132,6 +129,18 @@ public class MaterialUtil {
return null;
}
//是否退回大库
public static boolean returnTower(String materialStr) {
Map<String, ReturnTower> cacheMap = dataCache.getCache(CacheNameUtil.CHCHE_RETURN_TOWER);
if (cacheMap != null) {
if (cacheMap.get(materialStr) != null) {
return true;
}
}
return false;
}
public static String getMaterialSize(String materialStr) {
String size = "7";
if (bindGr(materialStr)){
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!