Commit 68d880f7 zshaohui

功能提交

1 个父辈 79066491
package com.neotel.smfcore.custom.luxsan.factory_c.rawstor.bean;
import lombok.AllArgsConstructor;
import lombok.Data;
@Data
@AllArgsConstructor
public class StorTransfer {
private String materialStr;
private String warehouseCode;
private String provider;
private int w;
private int h;
}
...@@ -7,12 +7,21 @@ import lombok.Data; ...@@ -7,12 +7,21 @@ import lombok.Data;
@AllArgsConstructor @AllArgsConstructor
public class TicketReturn { public class TicketReturn {
private String material; private String materialStr;
private String ticketCode; private String ticket;
private String pn;
private String ticketItem; private String ticketItem;
private String warehouseCode; private String srcWarehouseCode;
private String dstWarehouseCode;
private String provider;
private int w;
private int h;
} }
package com.neotel.smfcore.custom.luxsan.factory_c.rawstor.bean;
import lombok.AllArgsConstructor;
import lombok.Data;
@Data
@AllArgsConstructor
public class TicketTransfer {
private String materialStr;
private String ticket;
private String pn;
private String ticketItem;
private String srcWarehouseCode;
private String dstWarehouseCode;
private String provider;
private int w;
private int h;
}
...@@ -38,4 +38,6 @@ public class CtuTask { ...@@ -38,4 +38,6 @@ public class CtuTask {
private Date createDate; private Date createDate;
//任务优先级
private int priority = 0;
} }
...@@ -100,6 +100,7 @@ public class CtuDeviceController { ...@@ -100,6 +100,7 @@ public class CtuDeviceController {
} }
ctuTask.setToLoc(toLoc); ctuTask.setToLoc(toLoc);
ctuTask.setCreateDate(dataLog.getCreateDate()); ctuTask.setCreateDate(dataLog.getCreateDate());
ctuTask.setPriority(dataLog.getPriority());
shelfToLineTaskList.add(ctuTask); shelfToLineTaskList.add(ctuTask);
} }
} }
...@@ -141,9 +142,9 @@ public class CtuDeviceController { ...@@ -141,9 +142,9 @@ public class CtuDeviceController {
return ResultBean.newErrorResult(-1, "smfcore.taskStatusHasUpdate", "任务{0}已经修改状态", new String[]{task.getBarcode()}); return ResultBean.newErrorResult(-1, "smfcore.taskStatusHasUpdate", "任务{0}已经修改状态", new String[]{task.getBarcode()});
} }
task.setStatus(statusStr);
//3.判断是出库,还是入库任务 //3.判断是出库,还是入库任务
if (task.isPutInTask()) { if (task.isPutInTask()) {
task.setStatus(statusStr);
if (OP_STATUS.FINISHED.name().equals(statusStr)) { if (OP_STATUS.FINISHED.name().equals(statusStr)) {
BoxHandleUtil.intoPos(task); BoxHandleUtil.intoPos(task);
ReelLockPosUtil.removeReelLockPosInfo(task.getBarcode()); ReelLockPosUtil.removeReelLockPosInfo(task.getBarcode());
...@@ -151,6 +152,9 @@ public class CtuDeviceController { ...@@ -151,6 +152,9 @@ public class CtuDeviceController {
taskService.updateQueueTask(task); taskService.updateQueueTask(task);
} }
} else { } else {
if (!OP_STATUS.FINISHED.name().equals(statusStr)) {
task.setStatus(statusStr);
}
//4.如果是出库任务 //4.如果是出库任务
if (OP_STATUS.EXECUTING.name().equals(statusStr)) { if (OP_STATUS.EXECUTING.name().equals(statusStr)) {
taskService.updateQueueTask(task); taskService.updateQueueTask(task);
...@@ -195,19 +199,26 @@ public class CtuDeviceController { ...@@ -195,19 +199,26 @@ public class CtuDeviceController {
@AnonymousAccess @AnonymousAccess
public ResultBean updateMaterPutInCache(@RequestParam("boxStr") String boxStr, public ResultBean updateMaterPutInCache(@RequestParam("boxStr") String boxStr,
@RequestParam("loc") String loc) { @RequestParam("loc") String loc) {
log.info("更新料箱位置信息,料箱号为:"+boxStr+"当前位置为:"+loc);
DataLog dataLog = null; DataLog dataLog = null;
List<DataLog> allTasks = taskService.getAllTasks(); List<DataLog> allTasks = taskService.getAllTasks();
for (DataLog task : allTasks) { for (DataLog task : allTasks) {
if (task.isCheckOutTask()) { //if (task.isCheckOutTask()) {
if (boxStr.startsWith(task.getBarcode())) { if (boxStr.startsWith(task.getBarcode()) && !task.isCancel() && !task.isFinished()) {
dataLog = task; dataLog = task;
break; break;
}
} }
//}
} }
if (dataLog != null) { if (dataLog != null) {
dataLog.setCurrentLoc(loc); dataLog.setCurrentLoc(loc);
if (TaskCurrentLoc.In1_FeedingInlet.equals(loc) || TaskCurrentLoc.In2_FeedingInlet.equals(loc)) { if (TaskCurrentLoc.In1_FeedingInlet.equals(loc)
|| TaskCurrentLoc.In2_FeedingInlet.equals(loc)
|| TaskCurrentLoc.Out1_FeedingInlet.equals(loc)
|| TaskCurrentLoc.Out2_FeedingInlet.equals(loc)
) {
dataLog.setStatus(loc); dataLog.setStatus(loc);
} }
if (dataLog.isExecuting() || dataLog.isWait()){ if (dataLog.isExecuting() || dataLog.isWait()){
...@@ -232,4 +243,21 @@ public class CtuDeviceController { ...@@ -232,4 +243,21 @@ public class CtuDeviceController {
} }
return ResultBean.newOkResult(""); return ResultBean.newOkResult("");
} }
@ApiOperation("人工工位是否可以放入")
@RequestMapping("/manualCanPut")
@AnonymousAccess
public ResultBean manualCanPut() {
List<DataLog> allTasks = taskService.getAllTasks();
for (DataLog dataLog : allTasks) {
if (dataLog.isCheckOutTask() && !dataLog.isFinished() && !dataLog.isCancel()){
if (TaskCurrentLoc.Manual_FeedingInlet.equals(dataLog.getCurrentLoc())){
return ResultBean.newErrorResult(-1,"",dataLog.getBarcode()+"正在操作工位上,请核实");
}
}
}
return ResultBean.newOkResult("");
}
} }
package com.neotel.smfcore.custom.luxsan.factory_c.rawstor.controller; 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.bean.ResultBean;
import com.neotel.smfcore.common.utils.StringUtils; 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.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.request.BrandQtyResult;
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.custom.luxsan.factory_c.util.CacheNameUtil; import com.neotel.smfcore.custom.luxsan.factory_c.util.CacheNameUtil;
import com.neotel.smfcore.security.annotation.AnonymousAccess; import com.neotel.smfcore.security.annotation.AnonymousAccess;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
...@@ -10,6 +18,7 @@ import io.swagger.annotations.ApiOperation; ...@@ -10,6 +18,7 @@ import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.ehcache.impl.internal.concurrent.ConcurrentHashMap; import org.ehcache.impl.internal.concurrent.ConcurrentHashMap;
import org.springframework.beans.factory.annotation.Autowired; 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.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
...@@ -27,10 +36,19 @@ public class StorTransferController { ...@@ -27,10 +36,19 @@ public class StorTransferController {
@Autowired @Autowired
private DataCache dataCache; private DataCache dataCache;
@Autowired
private CodeResolve codeResolve;
@ApiOperation("刷料串,进行转移") @ApiOperation("刷料串,进行转移")
@RequestMapping("/inputMaterial") @RequestMapping("/inputMaterial")
@AnonymousAccess @AnonymousAccess
public ResultBean inputMaterial(String materialStr, String warehouseCode) { public ResultBean inputMaterial(@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)) { if (StringUtils.isEmpty(materialStr)) {
return ResultBean.newErrorResult(-1, "smfcore.valueCanotNull", "{0}不能为空", new String[]{"料串信息"}); return ResultBean.newErrorResult(-1, "smfcore.valueCanotNull", "{0}不能为空", new String[]{"料串信息"});
...@@ -40,16 +58,49 @@ public class StorTransferController { ...@@ -40,16 +58,49 @@ public class StorTransferController {
return ResultBean.newErrorResult(-1, "smfcore.valueCanotNull", "{0}不能为空", new String[]{"库别信息"}); return ResultBean.newErrorResult(-1, "smfcore.valueCanotNull", "{0}不能为空", new String[]{"库别信息"});
} }
log.info(materialStr + "进行储位转移,库别为:" + warehouseCode); //判断料串信息是否正确
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.resolveCode(codeStr);
if (barcode == null) {
return ResultBean.newErrorResult(-1, "smfcore.error.barcode.noValidCode", "条码无效");
}
//获取尺寸信息
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;
}
StorTransfer storTransfer = new StorTransfer(materialStr,warehouseCode,barcode.getProvider(),reelSize,h);
//1.判断料仓信息是否在储位转移中 //1.判断料仓信息是否在储位转移中
Map<String, String> cacheMap = dataCache.getCache(CacheNameUtil.CHCHE_STOR_TRANSFER); Map<String, StorTransfer> cacheMap = dataCache.getCache(CacheNameUtil.CHCHE_STOR_TRANSFER);
if (cacheMap == null) { if (cacheMap == null) {
cacheMap = new ConcurrentHashMap<>(); cacheMap = new ConcurrentHashMap<>();
} }
if (cacheMap.get(materialStr) != null) { if (cacheMap.get(materialStr) != null) {
return ResultBean.newErrorResult(-1, "", materialStr + "已经在储位转移列表中"); return ResultBean.newErrorResult(-1, "", materialStr + "已经在储位转移列表中");
} }
cacheMap.put(materialStr, warehouseCode); cacheMap.put(materialStr, storTransfer);
dataCache.updateCache(CacheNameUtil.CHCHE_STOR_TRANSFER, cacheMap); dataCache.updateCache(CacheNameUtil.CHCHE_STOR_TRANSFER, cacheMap);
return ResultBean.newOkResult(""); return ResultBean.newOkResult("");
} }
...@@ -61,13 +112,13 @@ public class StorTransferController { ...@@ -61,13 +112,13 @@ public class StorTransferController {
public ResultBean transferInfo() { public ResultBean transferInfo() {
//1.判断料仓信息是否在储位转移中 //1.判断料仓信息是否在储位转移中
Map<String, String> cacheMap = dataCache.getCache(CacheNameUtil.CHCHE_STOR_TRANSFER); Map<String, StorTransfer> cacheMap = dataCache.getCache(CacheNameUtil.CHCHE_STOR_TRANSFER);
if (cacheMap == null){ if (cacheMap == null){
cacheMap = new ConcurrentHashMap<>(); cacheMap = new ConcurrentHashMap<>();
} }
return ResultBean.newOkResult(cacheMap); return ResultBean.newOkResult(cacheMap.values());
} }
...@@ -77,7 +128,7 @@ public class StorTransferController { ...@@ -77,7 +128,7 @@ public class StorTransferController {
public ResultBean removeMaterial(String materialStr) { public ResultBean removeMaterial(String materialStr) {
//1.判断料仓信息是否在储位转移中 //1.判断料仓信息是否在储位转移中
Map<String, String> cacheMap = dataCache.getCache(CacheNameUtil.CHCHE_STOR_TRANSFER); Map<String, StorTransfer> cacheMap = dataCache.getCache(CacheNameUtil.CHCHE_STOR_TRANSFER);
if (cacheMap == null){ if (cacheMap == null){
cacheMap = new ConcurrentHashMap<>(); cacheMap = new ConcurrentHashMap<>();
......
...@@ -96,12 +96,19 @@ public class BinCacheUtil { ...@@ -96,12 +96,19 @@ public class BinCacheUtil {
} }
public static ValidBin validBin(Barcode stackerBarcode, String source, String binListStr) { public static ValidBin validBin(Barcode stackerBarcode, String source, String binListStr,String needBinCodeStr) {
String boxCode = ""; String boxCode = "";
String boxLoc = ""; String boxLoc = "";
String stackerLoc = ""; String stackerLoc = "";
List<String> needBinCodeList = new ArrayList<>();
if (StringUtils.isNotBlank(needBinCodeStr)){
needBinCodeList = Arrays.asList(needBinCodeStr.split(","));
}
List<String> validBinList = new ArrayList<>(); List<String> validBinList = new ArrayList<>();
//获取料串尺寸 //获取料串尺寸
...@@ -120,6 +127,11 @@ public class BinCacheUtil { ...@@ -120,6 +127,11 @@ public class BinCacheUtil {
if (binCodeList != null && !binCodeList.isEmpty()) { if (binCodeList != null && !binCodeList.isEmpty()) {
for (String binCode : binCodeList) { for (String binCode : binCodeList) {
if (!hasNeedBinCode(binCode, needBinCodeList)) {
continue;
}
if ("7".equals(materialSize)) { if ("7".equals(materialSize)) {
if (binCode.startsWith("C07")) { if (binCode.startsWith("C07")) {
validBinList.add(binCode); validBinList.add(binCode);
...@@ -177,6 +189,9 @@ public class BinCacheUtil { ...@@ -177,6 +189,9 @@ public class BinCacheUtil {
List<String> binCodeList = getValidBinList(stackerBarcode, binList); List<String> binCodeList = getValidBinList(stackerBarcode, binList);
if (binCodeList != null && !binCodeList.isEmpty()) { if (binCodeList != null && !binCodeList.isEmpty()) {
for (String binCode : binCodeList) { for (String binCode : binCodeList) {
if (!hasNeedBinCode(binCode, needBinCodeList)) {
continue;
}
if ("7".equals(materialSize)) { if ("7".equals(materialSize)) {
if (binCode.startsWith("C07")) { if (binCode.startsWith("C07")) {
validBinList.add(binCode); validBinList.add(binCode);
...@@ -217,10 +232,15 @@ public class BinCacheUtil { ...@@ -217,10 +232,15 @@ public class BinCacheUtil {
List<String> callEmptyBoxList = new ArrayList<>(); List<String> callEmptyBoxList = new ArrayList<>();
List<DataLog> allTasks = taskService.getAllTasks(); List<DataLog> allTasks = taskService.getAllTasks();
for (DataLog dataLog : allTasks) { for (DataLog dataLog : allTasks) {
if (dataLog.isCheckOutTask() && !dataLog.isCancel()) { if (dataLog.isCheckOutTask() && !dataLog.isCancel() && !dataLog.isFinished()) {
if (dataLog.isCallEmptyBox() && !TaskCurrentLoc.In1_FeedingInlet.equals(dataLog.getCurrentLoc()) && !TaskCurrentLoc.In2_FeedingInlet.equals(dataLog.getCurrentLoc())) { if (dataLog.isCallEmptyBox()
log.info("查找出来呼叫空箱的箱子为:" + dataLog.getBarcode()); && !TaskCurrentLoc.In1_FeedingInlet.equals(dataLog.getCurrentLoc())
callEmptyBoxList.add(dataLog.getBarcode()); && !TaskCurrentLoc.In2_FeedingInlet.equals(dataLog.getCurrentLoc())
) {
if (TaskCurrentLoc.In_FeedingInlet.equals(dataLog.getLoc()) || source.equals(dataLog.getLoc()) ) {
log.info("查找出来呼叫空箱的箱子为:" + dataLog.getBarcode());
callEmptyBoxList.add(dataLog.getBarcode());
}
} }
} }
} }
...@@ -238,6 +258,11 @@ public class BinCacheUtil { ...@@ -238,6 +258,11 @@ public class BinCacheUtil {
List<String> binCodeList = getValidBinList(stackerBarcode, binList); List<String> binCodeList = getValidBinList(stackerBarcode, binList);
if (binCodeList != null && !binCodeList.isEmpty()) { if (binCodeList != null && !binCodeList.isEmpty()) {
for (String binCode : binCodeList) { for (String binCode : binCodeList) {
if (!hasNeedBinCode(binCode, needBinCodeList)) {
continue;
}
if ("7".equals(materialSize)) { if ("7".equals(materialSize)) {
if (binCode.startsWith("C07")) { if (binCode.startsWith("C07")) {
validBinList.add(binCode); validBinList.add(binCode);
...@@ -306,7 +331,7 @@ public class BinCacheUtil { ...@@ -306,7 +331,7 @@ public class BinCacheUtil {
outLet = "1"; outLet = "1";
} }
StoragePos storagePos = BoxHandleUtil.callEmptyBox(materialSize, outLet, stackerBarcode.getWarehouseCode()); StoragePos storagePos = BoxHandleUtil.callEmptyBox(materialSize, outLet, stackerBarcode.getWarehouseCode(),needBinCodeList);
if (storagePos != null) { if (storagePos != null) {
Barcode posBarcode = storagePos.getBarcode(); Barcode posBarcode = storagePos.getBarcode();
...@@ -404,13 +429,28 @@ public class BinCacheUtil { ...@@ -404,13 +429,28 @@ public class BinCacheUtil {
if (!barcode.getWarehouseCode().equals(reelBarcode.getWarehouseCode())) { if (!barcode.getWarehouseCode().equals(reelBarcode.getWarehouseCode())) {
return "料格中[" + binId + "]物料的库别[" + barcode.getWarehouseCode() + "]与[" + reelBarcode.getBarcode() + "]的库别[" + reelBarcode.getWarehouseCode() + "]不一致"; return "料格中[" + binId + "]物料的库别[" + barcode.getWarehouseCode() + "]与[" + reelBarcode.getBarcode() + "]的库别[" + reelBarcode.getWarehouseCode() + "]不一致";
} }
if (!barcode.getProduceDate().equals(reelBarcode.getProduceDate())) { /*if (!barcode.getProduceDate().equals(reelBarcode.getProduceDate())) {
return "料格中[" + binId + "]物料的供应商[" + barcode.getProvider() + "]与[" + reelBarcode.getBarcode() + "]的供应商[" + reelBarcode.getPartNumber() + "]不一致"; return "料格中[" + binId + "]物料的供应商[" + barcode.getProvider() + "]与[" + reelBarcode.getBarcode() + "]的供应商[" + reelBarcode.getPartNumber() + "]不一致";
} }*/
} }
} }
} }
return ""; return "";
} }
private static boolean hasNeedBinCode(String binCode, List<String> needBinCodeList) {
if (needBinCodeList == null || needBinCodeList.isEmpty()) {
return true;
}
for (String needBinCodeStr : needBinCodeList) {
if (binCode.endsWith(needBinCodeStr)) {
return true;
}
}
return false;
}
} }
...@@ -138,7 +138,7 @@ public class BoxHandleUtil { ...@@ -138,7 +138,7 @@ public class BoxHandleUtil {
} }
public static StoragePos callEmptyBox(String size,String outLet,String wareHouseCode) { public static StoragePos callEmptyBox(String size,String outLet,String wareHouseCode,List<String> needBinCodeList) {
String box = ""; String box = "";
if ("7".equals(size)) { if ("7".equals(size)) {
box = "C07"; box = "C07";
...@@ -166,6 +166,18 @@ public class BoxHandleUtil { ...@@ -166,6 +166,18 @@ public class BoxHandleUtil {
c.and("barcode.status").is(BARCODE_STATUS.IN_STORE); c.and("barcode.status").is(BARCODE_STATUS.IN_STORE);
c.and("barcode.barcode").in(boxList); c.and("barcode.barcode").in(boxList);
if (needBinCodeList != null && !needBinCodeList.isEmpty()){
List<Criteria> criteriaList = new ArrayList<>();
for (String needBinCodeStr : needBinCodeList) {
Criteria criteria = Criteria.where("barcode.subCodeList.posName").regex(Pattern.compile(QueryHelp.escapeExprSpecialWord("-" + needBinCodeStr), Pattern.CASE_INSENSITIVE));
criteriaList.add(criteria);
}
c.orOperator(criteriaList);
}
List<StoragePos> storagePosList = storagePosManager.findByQuery(new Query(c).with(Sort.by(Sort.Direction.ASC, "barcode.amount"))); List<StoragePos> storagePosList = storagePosManager.findByQuery(new Query(c).with(Sort.by(Sort.Direction.ASC, "barcode.amount")));
StoragePos storagePos = null; StoragePos storagePos = null;
...@@ -219,7 +231,12 @@ public class BoxHandleUtil { ...@@ -219,7 +231,12 @@ public class BoxHandleUtil {
toLoc = "In2_FeedingInlet"; toLoc = "In2_FeedingInlet";
} }
} }
generateTask(storage, storagePos.getBarcode(), storagePos, OP.CHECKOUT, OP_STATUS.WAIT.name(), toLoc, ExtendType.STORAGE_CHECKOUT);
int priority = 0;
if (needBinCodeList != null && !needBinCodeList.isEmpty()){
priority = 999;
}
generateTask(storage, storagePos.getBarcode(), storagePos, OP.CHECKOUT, OP_STATUS.WAIT.name(), toLoc, ExtendType.STORAGE_CHECKOUT,priority);
return storagePos; return storagePos;
} }
...@@ -227,7 +244,7 @@ public class BoxHandleUtil { ...@@ -227,7 +244,7 @@ public class BoxHandleUtil {
} }
private static DataLog generateTask(Storage storage, Barcode barcode, StoragePos pos, int type, String status, String loc, int extendType) { private static DataLog generateTask(Storage storage, Barcode barcode, StoragePos pos, int type, String status, String loc, int extendType,int priority) {
//开始入库任务 //开始入库任务
DataLog task = new DataLog(storage, barcode, pos); DataLog task = new DataLog(storage, barcode, pos);
task.setType(type); task.setType(type);
...@@ -243,6 +260,7 @@ public class BoxHandleUtil { ...@@ -243,6 +260,7 @@ public class BoxHandleUtil {
task.setFristPutInDate(barcode.getPutInDate()); task.setFristPutInDate(barcode.getPutInDate());
} }
task.setDescribe(barcode.getDescribe()); task.setDescribe(barcode.getDescribe());
task.setPriority(priority);
taskService.addTaskToExecute(task); taskService.addTaskToExecute(task);
return task; return task;
} }
......
package com.neotel.smfcore.custom.luxsan.factory_c.rawstor.util; package com.neotel.smfcore.custom.luxsan.factory_c.rawstor.util;
import com.neotel.smfcore.common.bean.ResultBean; import com.neotel.smfcore.common.bean.ResultBean;
import com.neotel.smfcore.common.utils.StringUtils;
import com.neotel.smfcore.core.device.util.DataCache; 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.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.TicketReturn;
import com.neotel.smfcore.custom.luxsan.factory_c.rawstor.bean.TicketTransfer;
import com.neotel.smfcore.custom.luxsan.factory_c.util.CacheNameUtil; import com.neotel.smfcore.custom.luxsan.factory_c.util.CacheNameUtil;
import org.ehcache.impl.internal.concurrent.ConcurrentHashMap; import org.ehcache.impl.internal.concurrent.ConcurrentHashMap;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -23,20 +26,22 @@ public class MaterialUtil { ...@@ -23,20 +26,22 @@ public class MaterialUtil {
public static boolean bindInfo(String materialStr) { public static boolean bindInfo(String materialStr) {
return bindGr(materialStr) || storTransfer(materialStr) || ticketReturn(materialStr) || manualPutIn(materialStr); return bindGr(materialStr) || storTransfer(materialStr) || ticketReturn(materialStr) || ticketTransfer(materialStr);
} }
public static String getWarhouseCode(String materialStr) { public static String getWarhouseCode(String materialStr) {
if (bindGr(materialStr)){ if (bindGr(materialStr)){ //GR入库
BindGrInfo bindGrInfo = getBindGrInfo(materialStr); BindGrInfo bindGrInfo = getBindGrInfo(materialStr);
return bindGrInfo.getWarehouseCode(); return bindGrInfo.getWarehouseCode();
} else if (storTransfer(materialStr)){ } else if (storTransfer(materialStr)){ //储位移转
return getStorTransferInfo(materialStr); StorTransfer storTransfer = getStorTransferInfo(materialStr);
} else if (ticketReturn(materialStr)){ return storTransfer.getWarehouseCode();
} else if (ticketReturn(materialStr)){ //单据退料
TicketReturn returnInfo = getTicketReturnInfo(materialStr); TicketReturn returnInfo = getTicketReturnInfo(materialStr);
return returnInfo.getWarehouseCode(); return StringUtils.isNotEmpty(returnInfo.getDstWarehouseCode()) ? returnInfo.getDstWarehouseCode() : returnInfo.getSrcWarehouseCode();
} else if (manualPutIn(materialStr)){ } else if (ticketTransfer(materialStr)){
return getManualPutInInfo(materialStr); TicketTransfer ticketTransfer = getTicketTransferInfo(materialStr);
return StringUtils.isNotEmpty(ticketTransfer.getDstWarehouseCode()) ? ticketTransfer.getDstWarehouseCode() : ticketTransfer.getSrcWarehouseCode();
} }
return ""; return "";
} }
...@@ -65,7 +70,7 @@ public class MaterialUtil { ...@@ -65,7 +70,7 @@ public class MaterialUtil {
//是否储位转移 //是否储位转移
public static boolean storTransfer(String materialStr) { public static boolean storTransfer(String materialStr) {
//1.判断料仓信息是否在储位转移中 //1.判断料仓信息是否在储位转移中
Map<String, String> cacheMap = dataCache.getCache(CacheNameUtil.CHCHE_STOR_TRANSFER); Map<String, StorTransfer> cacheMap = dataCache.getCache(CacheNameUtil.CHCHE_STOR_TRANSFER);
if (cacheMap == null) { if (cacheMap == null) {
cacheMap = new ConcurrentHashMap<>(); cacheMap = new ConcurrentHashMap<>();
} }
...@@ -75,8 +80,8 @@ public class MaterialUtil { ...@@ -75,8 +80,8 @@ public class MaterialUtil {
return false; return false;
} }
public static String getStorTransferInfo(String materialStr) { public static StorTransfer getStorTransferInfo(String materialStr) {
Map<String, String> cacheMap = dataCache.getCache(CacheNameUtil.CHCHE_STOR_TRANSFER); Map<String, StorTransfer> cacheMap = dataCache.getCache(CacheNameUtil.CHCHE_STOR_TRANSFER);
if (cacheMap != null) { if (cacheMap != null) {
if (cacheMap.get(materialStr) != null) { if (cacheMap.get(materialStr) != null) {
return cacheMap.get(materialStr); return cacheMap.get(materialStr);
...@@ -108,9 +113,9 @@ public class MaterialUtil { ...@@ -108,9 +113,9 @@ public class MaterialUtil {
return null; return null;
} }
//是否手动入库 //是否单据转库 CHCHE_TICKET_TRANSFER
public static boolean manualPutIn(String materialStr) { public static boolean ticketTransfer(String materialStr) {
Map<String, String> cacheMap = dataCache.getCache(CacheNameUtil.CHCHE_MANUAL_PUTIN); Map<String, TicketTransfer> cacheMap = dataCache.getCache(CacheNameUtil.CHCHE_TICKET_TRANSFER);
if (cacheMap != null) { if (cacheMap != null) {
if (cacheMap.containsKey(materialStr)) { if (cacheMap.containsKey(materialStr)) {
return true; return true;
...@@ -119,8 +124,8 @@ public class MaterialUtil { ...@@ -119,8 +124,8 @@ public class MaterialUtil {
return false; return false;
} }
public static String getManualPutInInfo(String materialStr) { public static TicketTransfer getTicketTransferInfo(String materialStr) {
Map<String, String> cacheMap = dataCache.getCache(CacheNameUtil.CHCHE_MANUAL_PUTIN); Map<String, TicketTransfer> cacheMap = dataCache.getCache(CacheNameUtil.CHCHE_TICKET_TRANSFER);
if (cacheMap != null) { if (cacheMap != null) {
if (cacheMap.get(materialStr) != null) { if (cacheMap.get(materialStr) != null) {
return cacheMap.get(materialStr); return cacheMap.get(materialStr);
...@@ -131,10 +136,18 @@ public class MaterialUtil { ...@@ -131,10 +136,18 @@ public class MaterialUtil {
public static String getMaterialSize(String materialStr) { public static String getMaterialSize(String materialStr) {
String size = "7"; String size = "7";
if (materialStr.startsWith("B13")) { if (bindGr(materialStr)){
size = "13"; BindGrInfo bindGrInfo = getBindGrInfo(materialStr);
} else if (materialStr.startsWith("B15")) { size = bindGrInfo.getW()+"";
size = "15"; } else if (storTransfer(materialStr)){
StorTransfer storTransfer = getStorTransferInfo(materialStr);
size = storTransfer.getW()+"";
} else if (ticketReturn(materialStr)){
TicketReturn ticketReturn = getTicketReturnInfo(materialStr);
size = ticketReturn.getW()+"";
} else if (ticketTransfer(materialStr)){
TicketTransfer ticketTransfer = getTicketTransferInfo(materialStr);
size = ticketTransfer.getW() + "";
} }
return size; return size;
} }
......
...@@ -10,6 +10,8 @@ public class CacheNameUtil { ...@@ -10,6 +10,8 @@ public class CacheNameUtil {
public static final String CHCHE_TICKET_RETURN = "CHCHE_TICKET_RETURN"; public static final String CHCHE_TICKET_RETURN = "CHCHE_TICKET_RETURN";
public static final String CHCHE_TICKET_TRANSFER = "CHCHE_TICKET_TRANSFER";
public static final String CHCHE_MANUAL_PUTIN = "CHCHE_MANUAL_PUTIN"; public static final String CHCHE_MANUAL_PUTIN = "CHCHE_MANUAL_PUTIN";
public static final String CHCHE_UPLOAD_CARPALLINFO = "CHCHE_UPLOAD_CARPALLINFO"; public static final String CHCHE_UPLOAD_CARPALLINFO = "CHCHE_UPLOAD_CARPALLINFO";
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!