Commit e3ed0308 hc

add:gr手动入库缓存gr已入账信息接口

1 个父辈 9e618aba
...@@ -201,9 +201,9 @@ public class DataInitManager { ...@@ -201,9 +201,9 @@ public class DataInitManager {
//手动入库 //手动入库
addNewFunctionMenu(1, manual, "manualWarehous", "手动入库", "manualWarehous", "manualWarehous/index", "manualWa", functionMenuMap); addNewFunctionMenu(1, manual, "manualWarehous", "手动入库", "manualWarehous", "manualWarehous/index", "manualWa", functionMenuMap);
// 手动GR入库虚拟仓 // 手动GR入库虚拟仓
addNewFunctionMenu(2, manual, "manualGrStorage", "虚拟仓手动GR入库", "manualGrStorage", "manualGrStorage/index", "manualGrSto", functionMenuMap); addNewFunctionMenu(2, manual, "manualGrStorage", "手动GR入库", "manualGrStorage", "manualGrStorage/index", "manualGrSto", functionMenuMap);
// 手动GR入库 // 手动GR入库
addNewFunctionMenu(3, manual, "manualGrStorageVirtual", "手动GR入库", "manualGrStorageVirtual", "manualGrStorageVirtual/index", "manualGrStoVirt", functionMenuMap); addNewFunctionMenu(3, manual, "manualGrStorageVirtual", "虚拟仓手动GR入库", "manualGrStorageVirtual", "manualGrStorageVirtual/index", "manualGrStoVirt", functionMenuMap);
Menu doc = Menu.CreatePMenu("单据操作", 5, "doc", 1, "docOp", raw); Menu doc = Menu.CreatePMenu("单据操作", 5, "doc", 1, "docOp", raw);
......
...@@ -8,7 +8,9 @@ import com.neotel.smfcore.common.utils.SecurityUtils; ...@@ -8,7 +8,9 @@ import com.neotel.smfcore.common.utils.SecurityUtils;
import com.neotel.smfcore.common.utils.StringUtils; import com.neotel.smfcore.common.utils.StringUtils;
import com.neotel.smfcore.core.api.SmfApi; import com.neotel.smfcore.core.api.SmfApi;
import com.neotel.smfcore.core.barcode.service.manager.IBarcodeManager; import com.neotel.smfcore.core.barcode.service.manager.IBarcodeManager;
import com.neotel.smfcore.core.barcode.service.manager.IComponentManager;
import com.neotel.smfcore.core.barcode.service.po.Barcode; import com.neotel.smfcore.core.barcode.service.po.Barcode;
import com.neotel.smfcore.core.barcode.service.po.Component;
import com.neotel.smfcore.core.barcode.utils.CodeResolve; import com.neotel.smfcore.core.barcode.utils.CodeResolve;
import com.neotel.smfcore.core.device.enums.OP; import com.neotel.smfcore.core.device.enums.OP;
import com.neotel.smfcore.core.device.enums.OP_STATUS; import com.neotel.smfcore.core.device.enums.OP_STATUS;
...@@ -19,15 +21,19 @@ import com.neotel.smfcore.core.storage.service.po.StoragePos; ...@@ -19,15 +21,19 @@ import com.neotel.smfcore.core.storage.service.po.StoragePos;
import com.neotel.smfcore.core.system.service.po.DataLog; import com.neotel.smfcore.core.system.service.po.DataLog;
import com.neotel.smfcore.core.system.util.TaskService; import com.neotel.smfcore.core.system.util.TaskService;
import com.neotel.smfcore.custom.luxsan.api.LuxsanApi; 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.request.NewLabelToCellRequest; import com.neotel.smfcore.custom.luxsan.api.bean.request.NewLabelToCellRequest;
import com.neotel.smfcore.custom.luxsan.api.bean.request.QueryGrStatusRequest; import com.neotel.smfcore.custom.luxsan.api.bean.request.QueryGrStatusRequest;
import com.neotel.smfcore.custom.luxsan.api.bean.result.BrandQtyResult;
import com.neotel.smfcore.custom.luxsan.api.bean.result.NewLabelToCellResult; import com.neotel.smfcore.custom.luxsan.api.bean.result.NewLabelToCellResult;
import com.neotel.smfcore.custom.luxsan.api.bean.result.QueryGrStatusResult; import com.neotel.smfcore.custom.luxsan.api.bean.result.QueryGrStatusResult;
import com.neotel.smfcore.custom.luxsan.factory_c.common.util.CommonUtil; import com.neotel.smfcore.custom.luxsan.factory_c.common.util.CommonUtil;
import com.neotel.smfcore.custom.luxsan.factory_c.rawstor.bean.GrUdNum;
import com.neotel.smfcore.custom.luxsan.factory_c.rawstor.bean.dto.QueryGrStatusDto; import com.neotel.smfcore.custom.luxsan.factory_c.rawstor.bean.dto.QueryGrStatusDto;
import com.neotel.smfcore.custom.luxsan.factory_c.rawstor.enums.TaskCurrentLoc; import com.neotel.smfcore.custom.luxsan.factory_c.rawstor.enums.TaskCurrentLoc;
import com.neotel.smfcore.custom.luxsan.factory_c.rawstor.util.BinCacheUtil; import com.neotel.smfcore.custom.luxsan.factory_c.rawstor.util.BinCacheUtil;
import com.neotel.smfcore.custom.luxsan.factory_c.rawstor.util.BoxHandleUtil; import com.neotel.smfcore.custom.luxsan.factory_c.rawstor.util.BoxHandleUtil;
import com.neotel.smfcore.custom.luxsan.factory_c.rawstor.util.GrUtil;
import com.neotel.smfcore.security.annotation.AnonymousAccess; import com.neotel.smfcore.security.annotation.AnonymousAccess;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -65,6 +71,9 @@ public class ManualGrPutInController { ...@@ -65,6 +71,9 @@ public class ManualGrPutInController {
@Autowired @Autowired
private DataCache dataCache; private DataCache dataCache;
@Autowired
private IComponentManager componentManager;
@ApiOperation("获取GR已过账的列表") @ApiOperation("获取GR已过账的列表")
@RequestMapping("/grStatus") @RequestMapping("/grStatus")
...@@ -88,6 +97,14 @@ public class ManualGrPutInController { ...@@ -88,6 +97,14 @@ public class ManualGrPutInController {
return ResultBean.newOkResult(QueryGrStatusDto.convertQueryGrStatusResultDto(queryGrStatusList)); return ResultBean.newOkResult(QueryGrStatusDto.convertQueryGrStatusResultDto(queryGrStatusList));
} }
@ApiOperation("缓存已过帐缓存信息")
@RequestMapping("/bindGrUdQty")
@AnonymousAccess
public ResultBean bindGrUdQty(@RequestBody GrUdNum grUdNum) {
GrUtil.updateGrUdQty(grUdNum.getGrCode(), grUdNum.getGrItem(), grUdNum.getUdQty(), grUdNum.getLotQty());
return ResultBean.newOkResult("");
}
@ApiOperation("获取料箱信息") @ApiOperation("获取料箱信息")
@RequestMapping("/getBoxInfo") @RequestMapping("/getBoxInfo")
@AnonymousAccess @AnonymousAccess
...@@ -104,12 +121,16 @@ public class ManualGrPutInController { ...@@ -104,12 +121,16 @@ public class ManualGrPutInController {
@AnonymousAccess @AnonymousAccess
public synchronized ResultBean reelToBox(@RequestBody Map<String, String> paramMap) { public synchronized ResultBean reelToBox(@RequestBody Map<String, String> paramMap) {
String binCode = paramMap.get("binCode"); //料格信息 String binCode = paramMap.get("binCode"); //料格信息
String udCode = paramMap.get("udCode"); //过账编码 String udCode = paramMap.get("udCode"); //过账编码
String codeStr = paramMap.get("codeStr"); //条码信息 String codeStr = paramMap.get("codeStr"); //条码信息
String warhouseCode = paramMap.get("warhouseCode"); //库别 String warhouseCode = paramMap.get("warhouseCode"); //库别
String grCode = paramMap.get("grCode"); //GrCode String grCode = paramMap.get("grCode"); //GrItem
String grItem = paramMap.get("grItem"); //GrCode
String boxStr = paramMap.get("boxStr"); //料箱信息 String boxStr = paramMap.get("boxStr"); //料箱信息
Integer udQty = Double.valueOf(paramMap.get("udQty")).intValue();
Integer lotQty = Double.valueOf(paramMap.get("lotQty")).intValue();
log.info("人工GR入库,料格信息为:" + binCode + ",过账编码为:" + udCode + "条码信息为:" + codeStr); log.info("人工GR入库,料格信息为:" + binCode + ",过账编码为:" + udCode + "条码信息为:" + codeStr);
...@@ -132,10 +153,38 @@ public class ManualGrPutInController { ...@@ -132,10 +153,38 @@ public class ManualGrPutInController {
return ResultBean.newErrorResult(-1, "smfcore.valueCanotNull", "{0}不能为空", new String[]{"料箱信息"}); return ResultBean.newErrorResult(-1, "smfcore.valueCanotNull", "{0}不能为空", new String[]{"料箱信息"});
} }
Barcode noDbBarcode = codeResolve.resolveCode(codeStr);
if (noDbBarcode == null) {
return ResultBean.newErrorResult(-1, "smfcore.error.barcode.noValidCode", "条码无效");
}
int w = 7;
int h = 8;
Component component = componentManager.findByPartNumberAndProvider(noDbBarcode.getPartNumber(), noDbBarcode.getProvider());
if (component == null) {
BrandQtyResult result = LuxsanApi.brandQtyUrl(new BrandQtyRequest(noDbBarcode.getPartNumber(), noDbBarcode.getPartNumber()));
if (result == null) {
return ResultBean.newErrorResult(-1, "", "未找到对应的尺寸信息");
}
w = result.getReel_size();
if (w == 7) {
h = 8;
} else if (w == 13) {
h = 24;
} else if (w == 15) {
h = 32;
}
} else {
w = component.getPlateSize();
h = component.getHeight();
}
//判断条码是否正常 //判断条码是否正常
Barcode barcode = null; Barcode barcode = null;
try { try {
barcode = codeResolve.resolveOneValideBarcode(codeStr); barcode = codeResolve.resolveOneValideBarcode("="+w+"x"+h+"="+codeStr);
} catch (ValidateException ve) { } catch (ValidateException ve) {
return ResultBean.newErrorResult(-1, ve.getMsgKey(), ve.getDefaultMsg()); return ResultBean.newErrorResult(-1, ve.getMsgKey(), ve.getDefaultMsg());
} }
...@@ -190,6 +239,7 @@ public class ManualGrPutInController { ...@@ -190,6 +239,7 @@ public class ManualGrPutInController {
inPos.setBarcode(boxBarcode); inPos.setBarcode(boxBarcode);
storagePosManager.save(inPos); storagePosManager.save(inPos);
} }
GrUtil.updateGrUdQty(grCode, grItem, udQty, lotQty);
return ResultBean.newOkResult(BoxHandleUtil.getBoxInfo(boxStr)); return ResultBean.newOkResult(BoxHandleUtil.getBoxInfo(boxStr));
} }
} }
...@@ -278,17 +328,15 @@ public class ManualGrPutInController { ...@@ -278,17 +328,15 @@ public class ManualGrPutInController {
} }
Barcode boxBarcode = codeResolve.resolveOneValideBarcode(boxStr); Barcode boxBarcode = codeResolve.resolveOneValideBarcode(boxStr);
//1.判断有没有正在执行的任务 if (boxBarcode == null) {
List<DataLog> taskList = taskService.getAllTasks(); return ResultBean.newErrorResult(-1, "smfcore.error.barcode.invalid", "条码无效");
}
StoragePos newPos = null;
for (DataLog dataLog : taskList) { //1.判断是否有正在入库的任务
if (boxStr.startsWith(dataLog.getBarcode())) { for (DataLog dataLog : taskService.getAllTasks()) {
if (!dataLog.isFinished() && !dataLog.isCancel()) { if (!dataLog.isCancel() && !dataLog.isFinished() && dataLog.getBarcode().equals(boxBarcode.getBarcode())) {
if (dataLog.isPutInTask()) { if (dataLog.isPutInTask()) {
//return ResultBean.newOkResult(dataLog); return ResultBean.newErrorResult(-1, "", boxStr + "有正在执行的入库任务,请确认");
return ResultBean.newErrorResult(-1,"",boxStr+"有正在执行的入库任务,请确认");
} else { } else {
log.info(boxStr + "有正在执行的出库任务,服务器更改状态为完成"); log.info(boxStr + "有正在执行的出库任务,服务器更改状态为完成");
dataLog.setStatus(OP_STATUS.FINISHED.name()); dataLog.setStatus(OP_STATUS.FINISHED.name());
...@@ -296,61 +344,47 @@ public class ManualGrPutInController { ...@@ -296,61 +344,47 @@ public class ManualGrPutInController {
} }
} }
} }
}
if (posName == null) { //2.判断传过来的库位是否为空,为空入到智能仓
//2.获取空库位 if (StringUtils.isEmpty(posName)) {
newPos = BoxHandleUtil.locOnePos(boxBarcode); StoragePos pos = BoxHandleUtil.locOnePos(boxBarcode);
if (newPos == null) { if (pos == null) {
return ResultBean.newErrorResult(-1, "", boxStr + "未找到可用库位"); return ResultBean.newErrorResult(-1, "", boxStr + "未找到可用库位");
} }
}else { Storage storage = dataCache.getStorageById(pos.getStorageId());
//2.判断库位是否存在 DataLog dataLog = taskService.addPutInTaskToExecute(storage, boxBarcode, pos, TaskCurrentLoc.Manual_DischargeHole);
newPos = storagePosManager.getByPosName(posName); return ResultBean.newOkResult("");
taskList = taskService.getAllTasks();
for (DataLog dataLog : taskList) {
if (dataLog.getPosName().equals(posName)) {
if (!dataLog.isFinished() && !dataLog.isCancel()) {
//if (dataLog.isPutInTask()) {
return ResultBean.newErrorResult(-1,"",posName+"有正在执行的任务,请确认");
//}
}
}
}
if (newPos == null) {
return ResultBean.newErrorResult(-2, "smfcore.error.pos.notExist", "[{0}]库位不存在", new String[]{posName});
}
//3.库位是否存了料箱
if (ObjectUtil.isNotNull(newPos.getBarcode())
&& !newPos.getBarcode().getBarcode().equals(boxStr)) {
return ResultBean.newErrorResult(-4, "smfcore.error.pos.hasReel", "库位[{0}]中已有物料,无法入库", new String[]{posName});
} }
// 库位置空 //如果不为空,则入到虚拟仓
if (ObjectUtil.isNotNull(newPos.getBarcode())) { else {
newPos.setBarcode(null);
newPos.setUsed(false); //判断虚拟仓库位是否存在
StoragePos pos = storagePosManager.getByPosName(posName);
if (pos == null){
return ResultBean.newErrorResult(-1,"",boxStr+"对应的虚拟仓库位"+posName+"不存在");
} }
String storageId = pos.getStorageId();
Storage storage = dataCache.getStorageById(storageId);
if (storage == null || !storage.isVirtual()){
return ResultBean.newErrorResult(-1,"",posName+"不属于虚拟仓的库位");
} }
String oldPosName = boxBarcode.getPosName();
//将料箱原来的库位置空 Barcode barcode = pos.getBarcode();
StoragePos oldPos = null; if (barcode != null){
if (oldPosName != null) { return ResultBean.newErrorResult(-1,"",posName+"已经存在料箱:"+barcode.getBarcode());
oldPos = storagePosManager.getByPosName(oldPosName);
} }
// 将原先库位清空,特别的当原先库位和当前库位相同时不清空
if (oldPos != null && !oldPos.getPosName().equals(newPos.getPosName())) { //判断当前箱子是否在其他库位中
// 原先已被存储在oldPos StoragePos oldPos = storagePosManager.getByBarcode(boxBarcode.getBarcode());
if (oldPos != null){
oldPos.setBarcode(null); oldPos.setBarcode(null);
oldPos.setUsed(false); oldPos.setUsed(false);
}
//4.生成入库任务
taskService.addTaskToFinished(newPos, boxBarcode, SecurityUtils.getLoginUsername());
// 入库成功后刷新旧的库位信息
if (oldPos != null && !oldPos.isUsed()) {
storagePosManager.save(oldPos); storagePosManager.save(oldPos);
} }
return ResultBean.newOkResult("ok"); taskService.addTaskToFinished(pos,boxBarcode,"虚拟入库");
return ResultBean.newOkResult("");
}
} }
......
...@@ -21,7 +21,7 @@ public class GrUtil { ...@@ -21,7 +21,7 @@ public class GrUtil {
GrUtil.dataCache = cache; GrUtil.dataCache = cache;
} }
private synchronized static void updateGrUdQty(String grCode, String grItem, int udQty, int lotQty) { public synchronized static void updateGrUdQty(String grCode, String grItem, int udQty, int lotQty) {
Map<String, GrUdNum> cacheMap = dataCache.getCache(CACHE_GR_UDQTY); Map<String, GrUdNum> cacheMap = dataCache.getCache(CACHE_GR_UDQTY);
if (cacheMap == null) { if (cacheMap == null) {
cacheMap = Maps.newConcurrentMap(); cacheMap = Maps.newConcurrentMap();
...@@ -31,7 +31,7 @@ public class GrUtil { ...@@ -31,7 +31,7 @@ public class GrUtil {
dataCache.updateCache(CACHE_GR_UDQTY, cacheMap); dataCache.updateCache(CACHE_GR_UDQTY, cacheMap);
} }
private static GrUdNum getGrUdQty(String grCode, String grItem){ public static GrUdNum getGrUdQty(String grCode, String grItem){
Map<String, GrUdNum> cacheMap = dataCache.getCache(CACHE_GR_UDQTY); Map<String, GrUdNum> cacheMap = dataCache.getCache(CACHE_GR_UDQTY);
if (cacheMap == null) { if (cacheMap == null) {
cacheMap = Maps.newConcurrentMap(); cacheMap = Maps.newConcurrentMap();
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!