Commit 910d50a1 zshaohui

1.入库优化 2.单据修改

1 个父辈 7662f28c
正在显示 19 个修改的文件 包含 1112 行增加581 行删除
...@@ -195,17 +195,28 @@ public class DataInitManager { ...@@ -195,17 +195,28 @@ public class DataInitManager {
//储位转移 //储位转移
addNewFunctionMenu(4, raw, "storageTransfer", "储位转移", "storageTransfer", "storageTransfer/index", "transfer", functionMenuMap); addNewFunctionMenu(4, raw, "storageTransfer", "储位转移", "storageTransfer", "storageTransfer/index", "transfer", functionMenuMap);
//手动入库
addNewFunctionMenu(8, raw, "manualWarehous", "手动入库", "manualWarehous", "manualWarehous/index", "manualWa", functionMenuMap);
Menu doc = Menu.CreatePMenu("单据操作", 9, "doc", 1, "docOp", raw);
//931单据领料 //931单据领料
addNewFunctionMenu(5, raw, "docMaterialRe", "单据领料", "docMaterialRe", "receipt/docMaterialRe/index", "docMaterial", functionMenuMap); addNewFunctionMenu(1, doc, "docMaterialRe", "单据领料", "docMaterialRe", "receipt/docMaterialRe/index", "docMaterial", functionMenuMap);
//单据转库 //单据转库
addNewFunctionMenu(6, raw, "docTransferWarehous", "单据转库", "docTransferWarehous", "receipt/docTransferWarehous/index", "docTransfer", functionMenuMap); addNewFunctionMenu(2, doc, "docTransferWarehous", "单据转库", "docTransferWarehous", "receipt/docTransferWarehous/index", "docTransfer", functionMenuMap);
//单据退料 //单据退料
addNewFunctionMenu(7, raw, "docReturn", "单据退料", "docReturn", "receipt/docReturn/index", "docRe", functionMenuMap); addNewFunctionMenu(3, doc, "docReturn", "单据退料", "docReturn", "receipt/docReturn/index", "docRe", functionMenuMap);
//手动出库
addNewFunctionMenu(4, doc,"outVir","手动出库","outVir","outVir/index","docOut",functionMenuMap);
//addNewFunctionMenu(132,null,"outPage","线外入库","outPage","outers/outPage/index","index",functionMenuMap);
//手动入库
addNewFunctionMenu(8, raw, "manualWarehous", "手动入库", "manualWarehous", "manualWarehous/index", "manualWa", functionMenuMap);
Menu wip = Menu.CreatePMenu("半成品仓", 3, "wip", 2, "wip", null); Menu wip = Menu.CreatePMenu("半成品仓", 3, "wip", 2, "wip", null);
...@@ -341,12 +352,6 @@ public class DataInitManager { ...@@ -341,12 +352,6 @@ public class DataInitManager {
addNewFunctionMenu(131, s5, "outOperation/s5", "出库作业","outOperation/s5", "outers/outOperation/index","index",functionMenuMap); addNewFunctionMenu(131, s5, "outOperation/s5", "出库作业","outOperation/s5", "outers/outOperation/index","index",functionMenuMap);
addNewFunctionMenu(132, s5, "staWorkSurface/s5", "盘点作业","staWorkSurface/s5", "outers/staWorkSurface/index","index",functionMenuMap); addNewFunctionMenu(132, s5, "staWorkSurface/s5", "盘点作业","staWorkSurface/s5", "outers/staWorkSurface/index","index",functionMenuMap);
//线外入库
//Menu outPage = Menu.CreatePMenu("线外入库", 17, "", 1, "index", null);
addNewFunctionMenu(132,null,"outPage","线外入库","outPage","outers/outPage/index","index",functionMenuMap);
addNewFunctionMenu(133,null,"outVir","虚拟仓出库","outVir","outers/outVir/index","index",functionMenuMap);
//内仓线外入库 //内仓线外入库
addNewFunctionMenu(134,null,"bcVirWarehous","虚拟仓","bcVirWarehous","virWarehous/virWarehous/index","feeding",functionMenuMap); addNewFunctionMenu(134,null,"bcVirWarehous","虚拟仓","bcVirWarehous","virWarehous/virWarehous/index","feeding",functionMenuMap);
......
...@@ -901,33 +901,21 @@ public class LiteOrderCache { ...@@ -901,33 +901,21 @@ public class LiteOrderCache {
liteOrder.setStatus(LITEORDER_STATUS.TAILS); liteOrder.setStatus(LITEORDER_STATUS.TAILS);
liteOrderMap.put(liteOrder.getOrderNo(), liteOrder); liteOrderMap.put(liteOrder.getOrderNo(), liteOrder);
//4.获取partNumber所在的库位信息
//List<String> partNumberList = liteOrder.getOrderItems().stream().map(item -> item.getPn()).collect(Collectors.toList());
//List<StoragePos> allStoragePosList = storagePosManager.findStoragePosByPartNumber(partNumberList);
//5.开始处理工单详情 //5.开始处理工单详情
List<StoragePos> needOutPosList = new ArrayList<>(); List<StoragePos> needOutPosList = new ArrayList<>();
//禁用料信息
List<String> disablePosNameList = new ArrayList<>();
int orderTaskReelCount = 0; int orderTaskReelCount = 0;
for (LiteOrderItem orderItem : liteOrder.getOrderItems()){ for (LiteOrderItem orderItem : liteOrder.getOrderItems()){
//6.排除的仓位信息
Collection excludeIdList = excludeOutPosIds();
List<StoragePos> allStoragePosList = new ArrayList();
//判断有没有正在执行的料箱入库信息 //6.排除的仓位信息
/*Map<String,String> cacheMap = dataCache.getCache(CacheNameUtil.CHCHE_EXECUTINGPUTIN_BOX); Collection excludeIdList = excludeOutPosIds();
if (cacheMap == null){
cacheMap = new HashMap<>();
}
Set<String> keySet = cacheMap.keySet();
if (keySet != null && !keySet.isEmpty()){
for (String boxStr : keySet) {
log.info(boxStr+"正在执行入库任务,先不允许出库");
StoragePos pos = storagePosManager.getByBarcode(boxStr);
if (pos != null){
excludeIdList.add(pos.getId());
}
}
}*/
//7.判断是否指定的itemId //7.判断是否指定的itemId
if (orderItemIds != null && !orderItemIds.isEmpty()) { if (orderItemIds != null && !orderItemIds.isEmpty()) {
...@@ -964,7 +952,10 @@ public class LiteOrderCache { ...@@ -964,7 +952,10 @@ public class LiteOrderCache {
String pn = orderItem.getPn(); //料号 String pn = orderItem.getPn(); //料号
StoragePos pos = storagePosManager.findPartNumberInStorages(storageIdList,pn,excludeIdList,dataCache.getCheckOutType(),warehouseCode,brand,true); StoragePos pos = storagePosManager.findPartNumberInStorages(storageIdList,pn,excludeIdList,dataCache.getCheckOutType(),warehouseCode,brand,true);
if (pos == null) { if (pos == null) {
pos = storagePosManager.findPartNumberInStorages(storageIdList, pn, excludeIdList, dataCache.getCheckOutType(), warehouseCode, brand, false); if (allStoragePosList == null || allStoragePosList.isEmpty()) {
allStoragePosList = storagePosManager.findStoragePosByPartNumber(Arrays.asList(orderItem.getPn()));
}
pos = getStoragePosByPartNumberAndBrand(allStoragePosList, pn, excludeIdList);
} }
if (pos == null) { if (pos == null) {
log.info(orderItem.getOrderId() + "厂商:" + warehouseCode + ",供应商:" + brand + ",料号:" + pn + "未找到存在库位,跳过"); log.info(orderItem.getOrderId() + "厂商:" + warehouseCode + ",供应商:" + brand + ",料号:" + pn + "未找到存在库位,跳过");
...@@ -976,8 +967,30 @@ public class LiteOrderCache { ...@@ -976,8 +967,30 @@ public class LiteOrderCache {
subCodeList = subCodeList.stream().sorted(Comparator.comparing(Barcode::getCreateDate)).collect(Collectors.toList()); subCodeList = subCodeList.stream().sorted(Comparator.comparing(Barcode::getCreateDate)).collect(Collectors.toList());
subCodeList = subCodeList.stream().sorted(Comparator.comparing(Barcode::getAmount)).collect(Collectors.toList()); subCodeList = subCodeList.stream().sorted(Comparator.comparing(Barcode::getAmount)).collect(Collectors.toList());
//判断禁用料信息
for (Barcode subCode : subCodeList) {
if (disablePosNameList.contains(subCode.getPosName())) {
continue;
}
try {
smfApi.canPutInAfterResolve(subCode);
} catch (ValidateException e) {
e.printStackTrace();
log.info(subCode.getBarcode()+"为禁用料,库位为:"+subCode.getPosName());
disablePosNameList.add(subCode.getPosName());
}
}
List<String> subCodeIds = new ArrayList<>(); List<String> subCodeIds = new ArrayList<>();
for (Barcode subCode : subCodeList) { for (Barcode subCode : subCodeList) {
if (disablePosNameList.contains(subCode.getPosName())) {
continue;
}
if (outReelCount >= orderItem.getNeedReelCount() && outNumCount >= orderItem.getNeedNum()) { if (outReelCount >= orderItem.getNeedReelCount() && outNumCount >= orderItem.getNeedNum()) {
break; break;
} }
...@@ -1084,7 +1097,7 @@ public class LiteOrderCache { ...@@ -1084,7 +1097,7 @@ public class LiteOrderCache {
} }
public StoragePos getStoragePosByPartNumberAndBrand(List<StoragePos> allStoragePosList, String partNumber, List<String> excludeIdList) { public StoragePos getStoragePosByPartNumberAndBrand(List<StoragePos> allStoragePosList, String partNumber, Collection<String> excludeIdList) {
StoragePos storagePos = null; StoragePos storagePos = null;
//先找到符合partNumber数据 //先找到符合partNumber数据
...@@ -1344,7 +1357,206 @@ public class LiteOrderCache { ...@@ -1344,7 +1357,206 @@ public class LiteOrderCache {
} }
public synchronized void rawTicketOut(String orderNo) { public synchronized String rawTicketCheckOut(String orderNo, boolean outBom, List<String> orderItemIds) {
//1.判断工单是否存在
LiteOrder liteOrder = liteOrderMap.get(orderNo);
if (liteOrder == null) {
liteOrder = liteOrderManager.findByOrderNo(orderNo);
}
if (liteOrder == null) {
return "smfcore.order.out.notFound";
}
//2.判断工单状态是否正常
if (liteOrder.isClosed()) {
return "smfcore.order.hasClose";
}
if (!liteOrder.isTaskFinished() && !liteOrder.isNew()) {
return "smfcore.order.out.executing";
}
List<String> storageIdList = new ArrayList<>();
for (Storage storage : dataCache.getAllStorage().values()) {
storageIdList.add(storage.getId());
}
//3.设置工单其他信息
liteOrder.setStartDate(new Date());
liteOrder.setTaskReelCount(0);
liteOrder.setTaskFinishedTime(-1);
liteOrder.setFinishedReelCount(0);
liteOrder.setStatus(LITEORDER_STATUS.TAILS);
liteOrderMap.put(liteOrder.getOrderNo(), liteOrder);
//4.获取partNumber所在的库位信息
//List<String> partNumberList = liteOrder.getOrderItems().stream().map(item -> item.getPn()).collect(Collectors.toList());
//5.开始处理工单详情
List<StoragePos> needOutPosList = new ArrayList<>();
int orderTaskReelCount = 0;
for (LiteOrderItem orderItem : liteOrder.getOrderItems()) {
List<StoragePos> allStoragePosList = new ArrayList<>();
//6.排除的仓位信息
Collection excludeIdList = excludeOutPosIds();
//7.判断是否指定的itemId
if (orderItemIds != null && !orderItemIds.isEmpty()) {
if (!orderItemIds.contains(orderItem.getId())) {
continue;
}
}
//8.设置出库数量和出库盘数(超发和不超发)
int outReelCount = 0;
int outNumCount = 0;
if (liteOrder.isExcess()) {
if (orderItem.getOutNum() >= orderItem.getNeedNum() && orderItem.getOutReelCount() >= orderItem.getNeedReelCount()) {
continue;
}
outNumCount = orderItem.getOutNum();
outReelCount = orderItem.getOutReelCount();
}
//如果不是超发,则满足其中一个即可
else {
if (orderItem.getTotalOutNum() >= orderItem.getNeedNum() && orderItem.getTotalOutReelCount() >= orderItem.getNeedReelCount()) {
continue;
}
outNumCount = orderItem.getTotalOutNum();
outReelCount = orderItem.getTotalOutReelCount();
}
//9.开始挑料
while (outReelCount < orderItem.getNeedReelCount() || outNumCount < orderItem.getNeedNum()) {
//根据查询条件,查找新的库位
boolean hasOutReel = false;
String warehouseCode = orderItem.getWarehouseCode(); //厂别
String brand = orderItem.getBrand(); //供应商
String pn = orderItem.getPn(); //料号
StoragePos pos = storagePosManager.findPartNumberInStorages(storageIdList, pn, excludeIdList, dataCache.getCheckOutType(), warehouseCode, brand, true);
if (pos == null) {
if (allStoragePosList == null || allStoragePosList.isEmpty()) {
allStoragePosList = storagePosManager.findStoragePosByPartNumber(Arrays.asList(orderItem.getPn()));
}
pos = getStoragePosByPartNumberAndBrand(allStoragePosList, pn, excludeIdList);
}
if (pos == null) {
log.info(orderItem.getOrderId() + "厂商:" + warehouseCode + ",供应商:" + brand + ",料号:" + pn + "未找到存在库位,跳过");
break;
}
Barcode barcode = pos.getBarcode();
List<Barcode> subCodeList = barcode.getSubCodeList();
//进行排序
subCodeList = subCodeList.stream().sorted(Comparator.comparing(Barcode::getCreateDate)).collect(Collectors.toList());
subCodeList = subCodeList.stream().sorted(Comparator.comparing(Barcode::getAmount)).collect(Collectors.toList());
List<String> subCodeIds = new ArrayList<>();
for (Barcode subCode : subCodeList) {
if (outReelCount >= orderItem.getNeedReelCount() && outNumCount >= orderItem.getNeedNum()) {
break;
}
if (subCode.isOut()) {
continue;
}
//判断厂别
if (StringUtils.isNotBlank(warehouseCode)) {
if (!warehouseCode.equals(subCode.getWarehouseCode())) {
continue;
}
}
//判断供应商
if (StringUtils.isNotBlank(brand)) {
if (!brand.equals(subCode.getProvider())) {
continue;
}
}
//判断料号
if (StringUtils.isNotBlank(pn)) {
if (!pn.equals(subCode.getPartNumber())) {
continue;
}
}
subCode.setOut(true);
subCode.setOrderItemId(orderItem.getId());
barcode.UpdateSubCode(subCode);
subCodeIds.add(subCode.getId());
orderTaskReelCount++;
hasOutReel = true;
//判断是否超发,如果超发,先判断是否满足数量.再判断是否满足卷数
if (liteOrder.isExcess()) {
if (outNumCount >= orderItem.getNeedNum()) {
outReelCount++;
} else {
outNumCount = outNumCount + subCode.getAmount();
}
}
//如果不是超发订单,
else {
outReelCount++;
outNumCount = outNumCount + subCode.getAmount();
}
}
if (subCodeIds != null && !subCodeIds.isEmpty()) {
Query query = new Query(Criteria.where("id").in(subCodeIds));
Update update = new Update().set("isOut", true).set("orderItemId", orderItem.getId());
barcodeManager.updateBarcode(query, update);
}
barcodeManager.save(barcode);
log.info("保存barcode时间结束");
excludeIdList.add(pos.getId());
if (hasOutReel) {
needOutPosList.add(pos);
pos.setBarcode(barcode);
storagePosManager.save(pos);
}
}
}
if (needOutPosList != null && !needOutPosList.isEmpty()) {
log.info("开始生成料箱出库任务");
for (StoragePos pos : needOutPosList) {
Barcode barcode = pos.getBarcode();
log.info("barcode:" + barcode.getBarcode() + ",状态为:" + barcode.getStatus());
if (barcode.getStatus() == BARCODE_STATUS.IN_STORE) {
Storage storage = dataCache.getStorageById(pos.getStorageId());
log.info(pos.getPosName() + "出库,料箱号为:" + barcode.getBarcode());
DataLog task = new DataLog(storage, barcode, pos);
task.setSourceId(liteOrder.getId());
task.setSourceName(liteOrder.getOrderNo());
task.setSubSourceId(barcode.getLockName());
task.setSubSourceInfo(barcode.getLockName());
task.setType(OP.CHECKOUT);
task.setCreator(SecurityUtils.getCurrentUsername());
task.setStatus(OP_STATUS.WAIT.name());
try {
taskService.addTaskToExecute(task);
} catch (Exception e) {
e.getMessage();
}
}
}
}
liteOrder.setTaskReelCount(orderTaskReelCount);
liteOrder.setTotalTaskReelCount(liteOrder.getTotalTaskReelCount() + orderTaskReelCount);
liteOrder.setEndDate(new Date());
log.info("工单[" + orderNo + "]任务分配结束,任务数[" + orderTaskReelCount + "]");
smfApi.onOrderStatusChange(liteOrder);
if (orderTaskReelCount <= 0) {
finishedOrderTasks(liteOrder);
}
liteOrderManager.save(liteOrder);
liteOrderMap.put(liteOrder.getOrderNo(), liteOrder);
if (orderTaskReelCount <= 0) {
return "smfcore.order.out.noTask";
}
return "";
} }
} }
...@@ -419,7 +419,7 @@ public class StoragePosManagerImpl implements IStoragePosManager { ...@@ -419,7 +419,7 @@ public class StoragePosManagerImpl implements IStoragePosManager {
c.and("barcode.subCodeList.isOut").is(isOut); c.and("barcode.subCodeList.isOut").is(isOut);
} }
//Sort sort = getSortByCheckOutType(checkOutType); //Sort sort = getSortByCheckOutType(checkOutType);
Sort sort = Sort.by(Sort.Direction.ASC, "barcode.subCodeList.createDate","barcode.subCodeList.amount"/*,"canCheckOutTime", "barcode.usedCount"*/); Sort sort = Sort.by(Sort.Direction.ASC, "barcode.subCodeList.produceDate","barcode.subCodeList.createDate","barcode.subCodeList.amount"/*,"canCheckOutTime", "barcode.usedCount"*/);
Query q = new Query(c); Query q = new Query(c);
q.with(sort); q.with(sort);
StoragePos pos = storagePosDao.findOne(q); StoragePos pos = storagePosDao.findOne(q);
......
...@@ -373,6 +373,13 @@ public class DataLog extends BasePo implements Serializable { ...@@ -373,6 +373,13 @@ public class DataLog extends BasePo implements Serializable {
//任务是否正常 //任务是否正常
private boolean normal = true; private boolean normal = true;
private String currentLoc = "";
private boolean callEmptyBox = false;
public String getBarcode() { public String getBarcode() {
if(barcode == null){ if(barcode == null){
return ""; return "";
......
...@@ -28,6 +28,8 @@ import com.neotel.smfcore.custom.lizhen.LizhenApi; ...@@ -28,6 +28,8 @@ import com.neotel.smfcore.custom.lizhen.LizhenApi;
import com.neotel.smfcore.custom.lizhen.agvBox.enums.INOUT_TYPE; import com.neotel.smfcore.custom.lizhen.agvBox.enums.INOUT_TYPE;
import com.neotel.smfcore.custom.lizhen.agvBox.util.BoxUtil; import com.neotel.smfcore.custom.lizhen.agvBox.util.BoxUtil;
import com.neotel.smfcore.custom.lizhen.innerBox.enums.ExtendType; import com.neotel.smfcore.custom.lizhen.innerBox.enums.ExtendType;
import com.neotel.smfcore.custom.luxsan.factory_c.rawstor.enums.TaskCurrentLoc;
import com.neotel.smfcore.custom.luxsan.factory_c.rawstor.util.BoxHandleUtil;
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;
...@@ -290,112 +292,48 @@ public class OutLineController { ...@@ -290,112 +292,48 @@ public class OutLineController {
String code = paramMap.get("barcode"); //料箱条码 String code = paramMap.get("barcode"); //料箱条码
String name = paramMap.get("name"); //工位名称 String name = paramMap.get("name"); //工位名称
String cids = paramMap.get("cids"); String cids = paramMap.get("cids");
boolean isVirtual = StringUtils.isNotBlank(paramMap.get("isVirtual")) ? Boolean.valueOf(paramMap.get("isVirtual")) : false;
String posName = paramMap.get("posName"); //库位
for (Storage storage : dataCache.getAllStorage().values()) {
if (storage.isType(new DeviceType[]{DeviceType.AGV_BOX})) {
cids = storage.getCid();
break;
}
}
log.info("线外入库完成装箱并入库,条码为:{},工位为:{}", code, name); log.info("线外入库完成装箱并入库,条码为:{},工位为:{}", code, name);
//得到箱子号 //得到箱子号
String boxStr = getBoxStrbyBoxPartition(code); String boxStr = getBoxStrbyBoxPartition(code);
List<Storage> storageList = Lists.newArrayList();
List<String> cidList = Lists.newArrayList(); //1.判断有没有正在执行的任务
for (String cid : cids.split(",")) { List<DataLog> taskList = taskService.getAllTasks();
String notIntoCids = dataCache.getSettings().getNotIntoCids(); for (DataLog dataLog : taskList) {
if (notIntoCids != null) { if (boxStr.startsWith(dataLog.getBarcode())) {
if (notIntoCids.contains(cid)) { if (!dataLog.isFinished() && !dataLog.isCancel()) {
log.info("料仓[" + cid + "]已被屏蔽入库"); if (dataLog.isPutInTask()) {
continue; return ResultBean.newOkResult(dataLog);
} } else {
} log.info(boxStr + "有正在执行的出库任务,服务器更改状态为完成");
Storage storage = dataCache.getStorage(cid); dataLog.setStatus(OP_STATUS.FINISHED.name());
if (storage != null) { taskService.updateFinishedTask(dataLog);
if (!storage.isVirtual()) { }
storageList.add(storage);
cidList.add(cid);
} }
} }
} }
if (storageList.isEmpty()) {
return ResultBean.newErrorResult(-1, "", "没有可以入库的料仓", new String[]{});
}
DataLog dataLog = getExecutingTaskByBarcode(boxStr);
if (dataLog != null) {
if (dataLog.isPutInTask()) {
//已有入库任务
return ResultBean.newErrorResult(-1, "", "物料[" + dataLog.getBarcode() + "]已有入库任务,需继续执行入库动作", new String[]{});
} else if (dataLog.isCheckOutTask()) {
//已有出库任务
return ResultBean.newErrorResult(-1, "", "物料[" + dataLog.getBarcode() + "]已有出库任务,需继续执行出库动作", new String[]{});
}
}
Barcode boxBarcode = barcodeManager.findByBarcode(boxStr); //2.获取空库位
//校验是否已经存在库位 Barcode boxBarcode = codeResolve.resolveOneValideBarcode(boxStr);
/*if (StringUtils.isNotBlank(boxBarcode.getPosName())) {
return ResultBean.newErrorResult(-1, "smfcore.storagePos.existBarcode", "{}已存在库位{}中", new String[]{boxBarcode.getBarcode(), boxBarcode.getPosName()});
}*/
StoragePos storagePos = storagePosManager.getByBarcode(boxBarcode.getBarcode());
if (storagePos != null){
return ResultBean.newErrorResult(-1, "smfcore.storagePos.existBarcode", "{}已存在库位{}中", new String[]{boxBarcode.getBarcode(), storagePos.getPosName()});
}
//判断是否盘点完成 StoragePos pos = BoxHandleUtil.locOnePos(boxBarcode);
boolean finished = BoxUtil.isInventoryFinished(boxStr); if (pos == null) {
if (!finished) { return ResultBean.newErrorResult(-1, "", boxStr + "未找到可用库位");
return ResultBean.newErrorResult(-1, "", boxStr + "盘点未完成,请继续盘点");
} }
boxBarcode.setInventory(false);
boxBarcode.setCreator(SecurityUtils.getCurrentUsername()); //4.生成入库任务
boxBarcode = barcodeManager.save(boxBarcode); Storage storage = dataCache.getStorageById(pos.getStorageId());
//如果不是虚拟仓的 DataLog dataLog = taskService.addPutInTaskToExecute(storage, boxBarcode, pos, TaskCurrentLoc.Manual_DischargeHole);
if (!isVirtual) {
StoragePos pos = taskService.findEmptyPosForPutIn(storageList, boxBarcode, "", ""); //生成任务
if (pos == null) { finishTask(boxStr, OP.CHECKOUT, null, OP_STATUS.CANCEL.name(), INOUT_TYPE.CANCEL_ONE.name());
throw new ValidateException("", "[" + boxBarcode.getBarcode() + "]未找到可用的[" + boxBarcode.getPlateSize() + "x" + boxBarcode.getHeight() + "]仓位", null);
} boxAllCountMap.remove(boxStr);
if (pos != null) { taskService.removePosName(boxStr);
Storage theStorage = dataCache.getStorageById(pos.getStorageId());
ReelLockPosInfo oldLockInfo = ReelLockPosUtil.getLockPosInfoByCode(boxBarcode.getBarcode()); return ResultBean.newOkResult(dataLog);
if (oldLockInfo != null) {
if (!oldLockInfo.getBarcode().equals(boxBarcode.getBarcode())) {
ReelLockPosUtil.removeReelLockPosInfo(oldLockInfo.getBarcode());
log.info("清理锁定库位:库位号[" + oldLockInfo.getLockPosName() + "]上物料[" + oldLockInfo.getBarcode() + "]锁定的库位");
}
}
ReelLockPosInfo reelLocInfo = new ReelLockPosInfo();
reelLocInfo.setBarcode(boxBarcode.getBarcode());
reelLocInfo.setCid(theStorage.getCid());
reelLocInfo.setLockPosName(pos.getPosName());
reelLocInfo.setLockPosId(pos.getId());
reelLocInfo = ReelLockPosUtil.addReelLockPosInfo(reelLocInfo, cidList);
if (reelLocInfo == null) {
return ResultBean.newErrorResult(-1, "", "[" + boxBarcode.getBarcode() + "]库位[" + reelLocInfo.getLockPosName() + "]已被锁定,暂停入库", new String[]{});
}
}
//生成任务
finishTask(boxStr, OP.CHECKOUT, null, OP_STATUS.CANCEL.name(), INOUT_TYPE.CANCEL_ONE.name());
boxAllCountMap.remove(boxStr);
generateTask(dataCache.getStorageById(pos.getStorageId()), boxBarcode, pos, OP.PUT_IN, OP_STATUS.WAIT.name(), null,ExtendType.STORAGE_PUTIN);
taskService.removePosName(boxStr);
} else { //入虚拟仓
finishTask(boxStr, OP.CHECKOUT, null, OP_STATUS.CANCEL.name(), INOUT_TYPE.CANCEL_ONE.name());
boxAllCountMap.remove(boxStr);
boxSideMap.remove(boxStr);
boxBarcode = barcodeManager.findByBarcode(boxStr);
StoragePos pos = intoVirtualPos(boxBarcode,posName);
DataLog task = generateTask(dataCache.getStorageById(pos.getStorageId()), boxBarcode, pos, OP.PUT_IN, OP_STATUS.FINISHED.name(), null,ExtendType.VIRTUAL_PUTIN);
taskService.moveTaskToFinished(task);
taskService.updateFinishedTask(task);
taskService.removeFinishedTask(task);
taskService.removePosName(boxStr);
}
return ResultBean.newOkResult("");
} }
...@@ -429,8 +367,7 @@ public class OutLineController { ...@@ -429,8 +367,7 @@ public class OutLineController {
//根据箱子号 找到barcode //根据箱子号 找到barcode
boxStr = getBoxStrbyBoxPartition(boxStr); boxStr = getBoxStrbyBoxPartition(boxStr);
Barcode pidBarcode = barcodeManager.findByBarcode(boxStr); Barcode pidBarcode = barcodeManager.findByBarcode(boxStr);
boolean hasBrand = false;
String orderItemIdStr = "";
//根据料箱获取到全部的物料 //根据料箱获取到全部的物料
List<Barcode> subCodes = pidBarcode.getSubCodeList(); List<Barcode> subCodes = pidBarcode.getSubCodeList();
if (subCodes == null || subCodes.isEmpty()) { if (subCodes == null || subCodes.isEmpty()) {
...@@ -442,36 +379,18 @@ public class OutLineController { ...@@ -442,36 +379,18 @@ public class OutLineController {
return ResultBean.newErrorResult(-1, "", pidBarcode.getBarcode() + "不允许全部取出,请核实"); return ResultBean.newErrorResult(-1, "", pidBarcode.getBarcode() + "不允许全部取出,请核实");
} }
} }
finishVirtualTask(boxStr);
List<DataLog> dataLogList = new ArrayList<>(); for (int index = 0; index < subCodes.size(); ) {
//开始循环,生成任务
for (int index = 0; index < subCodes.size();/*; index++*/) {
Barcode subCode = subCodes.get(index); Barcode subCode = subCodes.get(index);
String orderItemId = subCode.getOrderItemId();
//判断是否管控厂商
if (StringUtils.isNotBlank(orderItemId)) {
LiteOrderItem orderItem = liteOrderItemManager.get(orderItemId);
if (orderItem != null) {
if (StringUtils.isNotBlank(orderItem.getBrand())) {
hasBrand = true;
}
if (StringUtils.isNotBlank(orderItem.getOrderNo())) {
if (!orderItem.getOrderNo().equals(orderItemIdStr)) {
orderItemIdStr = orderItem.getOrderNo();
}
}
}
}
//生成任务 //生成任务
String orderItemId = subCode.getOrderItemId();
int amount = subCode.getAmount(); int amount = subCode.getAmount();
subCode.setAmount(0); subCode.setAmount(0);
pidBarcode.UpdateSubCode(subCode); pidBarcode.UpdateSubCode(subCode);
pidBarcode.setReelAmount(pidBarcode.getReelAmount() - 1); pidBarcode.setReelAmount(pidBarcode.getReelAmount() - 1);
pidBarcode.setAmount(pidBarcode.getAmount() - amount); pidBarcode.setAmount(pidBarcode.getAmount() - amount);
pidBarcode = barcodeManager.save(pidBarcode);
int extendType = StringUtils.isNotBlank(subCode.getOrderItemId()) ? ExtendType.VIRTUAL_PICKING_DETAIL : ExtendType.VIRTUAL_CHECKOUT; int extendType = StringUtils.isNotBlank(subCode.getOrderItemId()) ? ExtendType.VIRTUAL_PICKING_DETAIL : ExtendType.VIRTUAL_CHECKOUT;
DataLog dataLog = generateTask(subCode, opStatus, amount, opType, orderItemId, extendType, true); DataLog dataLog = generateTask(subCode, opStatus, amount, opType, orderItemId, extendType, true);
dataLogList.add(dataLog);
log.info("整箱出库,生成出库任务,barcode:" + subCode.getBarcode() + ",料箱号为:" + pidBarcode.getBarcode()); log.info("整箱出库,生成出库任务,barcode:" + subCode.getBarcode() + ",料箱号为:" + pidBarcode.getBarcode());
if (subCode.getAmount() <= 0) { if (subCode.getAmount() <= 0) {
subCode.setAmount(amount); subCode.setAmount(amount);
...@@ -484,26 +403,23 @@ public class OutLineController { ...@@ -484,26 +403,23 @@ public class OutLineController {
barcodeManager.save(subCode); barcodeManager.save(subCode);
} }
} }
if (dataLogList != null && !dataLogList.isEmpty()) { barcodeManager.save(pidBarcode);
taskService.outTaskStatusChange(dataLogList); StoragePos pos = BoxHandleUtil.locOnePos(pidBarcode);
if (pos != null){
pos.setBarcode(pidBarcode);
storagePosManager.save(pos);
} }
resultBean.setData(getBoxInfo(boxStr)); resultBean.setData(getBoxInfo(boxStr));
if (hasBrand) {
resultBean.setCode(3);
return resultBean;
}
if (StringUtils.isNotBlank(orderItemIdStr)) {
resultBean.setMsg("工单号为:" + orderItemIdStr);
}
} }
//判断是否隔口出库 //判断是否隔口出库
else if (INOUT_TYPE.OUT_PARTITION.name().equals(inoutType)) { else if (INOUT_TYPE.OUT_PARTITION.name().equals(inoutType)) {
//根据箱子号 找到barcode String newboxStr = getBoxStrbyBoxPartition(boxStr);
String newboxStr = boxStr.substring(0, boxStr.indexOf("-"));
Barcode pidBarcode = barcodeManager.findByBarcode(newboxStr);
boolean hasBrand = false;
String orderItemIdStr = ""; String orderItemIdStr = "";
Barcode pidBarcode = barcodeManager.findByBarcode(newboxStr);
//获取到需要出库的隔口信息
List<Barcode> needOutBarcodes = new ArrayList<>(); List<Barcode> needOutBarcodes = new ArrayList<>();
List<Barcode> subCodes = pidBarcode.getSubCodeList(); List<Barcode> subCodes = pidBarcode.getSubCodeList();
if (subCodes != null && !subCodes.isEmpty()) { if (subCodes != null && !subCodes.isEmpty()) {
...@@ -522,33 +438,16 @@ public class OutLineController { ...@@ -522,33 +438,16 @@ public class OutLineController {
return ResultBean.newErrorResult(-1, "", boxStr + "不允许全部出库,请核实"); return ResultBean.newErrorResult(-1, "", boxStr + "不允许全部出库,请核实");
} }
} }
finishVirtualTask(boxStr);
List<DataLog> dataLogList = new ArrayList<>();
for (int index = 0; index < needOutBarcodes.size(); index++) { for (int index = 0; index < needOutBarcodes.size(); index++) {
Barcode subCode = needOutBarcodes.get(index); Barcode subCode = needOutBarcodes.get(index);
String orderItemId = subCode.getOrderItemId(); String orderItemId = subCode.getOrderItemId();
if (StringUtils.isNotBlank(orderItemId)) {
LiteOrderItem orderItem = liteOrderItemManager.get(orderItemId);
if (orderItem != null) {
if (StringUtils.isNotBlank(orderItem.getBrand())) {
hasBrand = true;
}
if (StringUtils.isNotBlank(orderItem.getOrderNo())) {
if (!orderItem.getOrderNo().equals(orderItemIdStr)) {
orderItemIdStr = orderItem.getOrderNo();
}
}
}
}
int amount = subCode.getAmount(); int amount = subCode.getAmount();
subCode.setAmount(0); subCode.setAmount(0);
pidBarcode.UpdateSubCode(subCode); pidBarcode.UpdateSubCode(subCode);
pidBarcode.setReelAmount(pidBarcode.getReelAmount() - 1); pidBarcode.setReelAmount(pidBarcode.getReelAmount() - 1);
pidBarcode.setAmount(pidBarcode.getAmount() - amount); pidBarcode.setAmount(pidBarcode.getAmount() - amount);
pidBarcode = barcodeManager.save(pidBarcode); generateTask(subCode, opStatus, amount, opType, orderItemId, 0, true);
int extendType = StringUtils.isNotBlank(subCode.getOrderItemId()) ? ExtendType.VIRTUAL_PICKING_DETAIL : ExtendType.VIRTUAL_CHECKOUT;
DataLog dataLog = generateTask(subCode, opStatus, amount, opType, orderItemId, extendType, true);
dataLogList.add(dataLog);
log.info("隔口出库,生成出库任务,barcode:" + subCode.getBarcode() + ",料箱号为:" + subCode.getPosName()); log.info("隔口出库,生成出库任务,barcode:" + subCode.getBarcode() + ",料箱号为:" + subCode.getPosName());
log.info("箱子数量为:" + pidBarcode.getAmount() + ",物料数量为:" + pidBarcode.getReelAmount() + "箱号为:" + pidBarcode.getBarcode()); log.info("箱子数量为:" + pidBarcode.getAmount() + ",物料数量为:" + pidBarcode.getReelAmount() + "箱号为:" + pidBarcode.getBarcode());
if (subCode.getAmount() <= 0) { if (subCode.getAmount() <= 0) {
...@@ -561,19 +460,15 @@ public class OutLineController { ...@@ -561,19 +460,15 @@ public class OutLineController {
subCode.setStorageId(null); subCode.setStorageId(null);
barcodeManager.save(subCode); barcodeManager.save(subCode);
} }
//}
}
if (dataLogList != null && !dataLogList.isEmpty()){
taskService.outTaskStatusChange(dataLogList);
}
resultBean.setData(getBoxInfo(newboxStr));
if (hasBrand) {
resultBean.setCode(3);
return resultBean;
} }
if (StringUtils.isNotBlank(orderItemIdStr)) {
resultBean.setMsg("工单号为:" + orderItemIdStr); barcodeManager.save(pidBarcode);
StoragePos pos = BoxHandleUtil.locOnePos(pidBarcode);
if (pos != null){
pos.setBarcode(pidBarcode);
storagePosManager.save(pos);
} }
resultBean.setData(getBoxInfo(boxStr));
} }
//判断是否为单盘出库 //判断是否为单盘出库
...@@ -582,77 +477,51 @@ public class OutLineController { ...@@ -582,77 +477,51 @@ public class OutLineController {
if (!code.isValid()) { if (!code.isValid()) {
return ResultBean.newErrorResult(-1, "smfcore.error.barcode.noValidCode", "条码无效"); return ResultBean.newErrorResult(-1, "smfcore.error.barcode.noValidCode", "条码无效");
} }
barcode = code.getBarcode(); barcode = code.getBarcode();
boxStr = barcode.getPosName(); boxStr = barcode.getPosName();
if (StringUtils.isBlank(boxStr)) { if (StringUtils.isBlank(boxStr)) {
return ResultBean.newErrorResult(-1, "", barcode.getBarcode() + "不存在此料箱中"); return ResultBean.newErrorResult(-1, "", barcode.getBarcode() + "不存在此料箱中");
} }
boxStr = boxStr.substring(0, boxStr.indexOf("-")); boxStr = getBoxStrbyBoxPartition(boxStr);
//根据箱子号 找到barcode
Barcode pidBarcode = barcodeManager.findByBarcode(boxStr); Barcode pidBarcode = barcodeManager.findByBarcode(boxStr);
boolean hasBrand = false; //是否提示管控厂商
/*try {
smfApi.canPutInAfterResolve(barcode);
} catch (ValidateException e) {
e.printStackTrace();
return ResultBean.newErrorResult(-1, "", e.getMessage());
}*/
List<Barcode> subCodes = pidBarcode.getSubCodeList(); List<Barcode> subCodes = pidBarcode.getSubCodeList();
if (subCodes == null || subCodes.isEmpty()) { if (subCodes == null || subCodes.isEmpty()) {
return ResultBean.newErrorResult(-1, "", "料箱:" + boxStr + ",没有可出库的物料"); return ResultBean.newErrorResult(-1, "", "料箱:" + boxStr + ",没有可出库的物料");
} }
//判断当前料箱是否包含此物料 //判断当前料箱是否包含此物料
boolean hasBarcode = false; boolean hasBarcode = false;
String orderItemIdStr = "";
String selectMsg = "";
String barcodeStr = barcode.getBarcode(); String barcodeStr = barcode.getBarcode();
for (Barcode subCode : subCodes) { for (Barcode subCode : subCodes) {
if (barcodeStr.equals(subCode.getBarcode())) { if (barcodeStr.equals(subCode.getBarcode())) {
hasBarcode = true; hasBarcode = true;
}
if (StringUtils.isNotBlank(barcode.getSelectMsg())) {
selectMsg = barcode.getSelectMsg();
}
if (barcode.getBarcode().equals(subCode.getBarcode())) {
barcode = subCode; barcode = subCode;
break;
} }
} }
if (!hasBarcode) { if (!hasBarcode) {
return ResultBean.newErrorResult(-1, "", barcodeStr + "不在料箱:" + boxStr + "请核实是否已经出库"); return ResultBean.newErrorResult(-1, "", barcodeStr + "不在料箱:" + boxStr + "请核实是否已经出库");
} }
//判断查询条件是否一致
if (StringUtils.isNotBlank(selectMsg)) {
if (StringUtils.isBlank(barcode.getSelectMsg())) {
return ResultBean.newErrorResult(-1, "", "请核实与查询条件:" + selectMsg + "是否一致");
}
}
finishVirtualTask(boxStr);
//判断当前隔口是否有要出的任务 //判断当前隔口是否有要出的任务
boolean isOut = false; boolean isOut = false;
if (barcode.isOut()) { if (barcode.isOut()) {
isOut = true; isOut = true;
String orderItemId = barcode.getOrderItemId(); String orderItemId = barcode.getOrderItemId();
if (StringUtils.isNotBlank(orderItemId)) {
LiteOrderItem orderItem = liteOrderItemManager.get(orderItemId);
if (orderItem != null) {
if (StringUtils.isNotBlank(orderItem.getBrand())) {
hasBrand = true;
}
if (StringUtils.isNotBlank(orderItem.getOrderNo())) {
if (!orderItem.getOrderNo().equals(orderItemIdStr)) {
orderItemIdStr = orderItem.getOrderNo();
}
}
}
}
int amount = barcode.getAmount(); int amount = barcode.getAmount();
barcode.setAmount(0); barcode.setAmount(0);
pidBarcode.UpdateSubCode(barcode); pidBarcode.UpdateSubCode(barcode);
pidBarcode.setReelAmount(pidBarcode.getReelAmount() - 1); pidBarcode.setReelAmount(pidBarcode.getReelAmount() - 1);
pidBarcode.setAmount(pidBarcode.getAmount() - amount); pidBarcode.setAmount(pidBarcode.getAmount() - amount);
pidBarcode = barcodeManager.save(pidBarcode); barcodeManager.save(pidBarcode);
int extendType = StringUtils.isNotBlank(barcode.getOrderItemId()) ? ExtendType.VIRTUAL_PICKING_DETAIL : ExtendType.VIRTUAL_CHECKOUT; int extendType = StringUtils.isNotBlank(barcode.getOrderItemId()) ? ExtendType.VIRTUAL_PICKING_DETAIL : ExtendType.VIRTUAL_CHECKOUT;
generateTask(barcode, opStatus, amount, opType, orderItemId,extendType,false); generateTask(barcode, opStatus, amount, opType, orderItemId, extendType, false);
log.info("物料出库,生成出库任务,barcode:" + barcode.getBarcode() + ",隔口号为:" + barcode.getPosName()); log.info("物料出库,生成出库任务,barcode:" + barcode.getBarcode() + ",隔口号为:" + barcode.getPosName());
if (barcode.getAmount() <= 0) { if (barcode.getAmount() <= 0) {
barcode.setAmount(amount); barcode.setAmount(amount);
...@@ -664,6 +533,13 @@ public class OutLineController { ...@@ -664,6 +533,13 @@ public class OutLineController {
barcode.setStorageId(null); barcode.setStorageId(null);
barcodeManager.save(barcode); barcodeManager.save(barcode);
} }
StoragePos pos = BoxHandleUtil.locOnePos(pidBarcode);
if (pos != null) {
pos.setBarcode(pidBarcode);
storagePosManager.save(pos);
}
} else { } else {
if (subCodes != null && !subCodes.isEmpty()) { if (subCodes != null && !subCodes.isEmpty()) {
//获取到需要出库的物料,进行更改 //获取到需要出库的物料,进行更改
...@@ -684,7 +560,6 @@ public class OutLineController { ...@@ -684,7 +560,6 @@ public class OutLineController {
barcodeByOut.setSelectMsg(null); barcodeByOut.setSelectMsg(null);
barcodeByOut = barcodeManager.save(barcodeByOut); barcodeByOut = barcodeManager.save(barcodeByOut);
pidBarcode.UpdateSubCode(barcodeByOut); pidBarcode.UpdateSubCode(barcodeByOut);
pidBarcode = barcodeManager.save(pidBarcode);
//互换,要出的和隔口中的数据 //互换,要出的和隔口中的数据
int amount = barcode.getAmount(); int amount = barcode.getAmount();
...@@ -693,9 +568,9 @@ public class OutLineController { ...@@ -693,9 +568,9 @@ public class OutLineController {
pidBarcode.setReelAmount(pidBarcode.getReelAmount() - 1); pidBarcode.setReelAmount(pidBarcode.getReelAmount() - 1);
pidBarcode.setAmount(pidBarcode.getAmount() - amount); pidBarcode.setAmount(pidBarcode.getAmount() - amount);
pidBarcode.UpdateSubCode(barcode); pidBarcode.UpdateSubCode(barcode);
pidBarcode = barcodeManager.save(pidBarcode);
int extendType = StringUtils.isNotBlank(barcode.getOrderItemId()) ? ExtendType.VIRTUAL_PICKING_DETAIL : ExtendType.VIRTUAL_CHECKOUT; int extendType = StringUtils.isNotBlank(barcode.getOrderItemId()) ? ExtendType.VIRTUAL_PICKING_DETAIL : ExtendType.VIRTUAL_CHECKOUT;
generateTask(barcode, opStatus, amount, opType, orderItemId,extendType,false); generateTask(barcode, opStatus, amount, opType, orderItemId, extendType, false);
log.info(barcode.getBarcode() + "不是出库任务," + barcodeByOut.getBarcode() + "需更改out为false"); log.info(barcode.getBarcode() + "不是出库任务," + barcodeByOut.getBarcode() + "需更改out为false");
log.info("物料出库,生成出库任务,barcode:" + barcode.getBarcode() + ",隔口号为:" + barcode.getPosName()); log.info("物料出库,生成出库任务,barcode:" + barcode.getBarcode() + ",隔口号为:" + barcode.getPosName());
if (barcode.getAmount() <= 0) { if (barcode.getAmount() <= 0) {
...@@ -709,20 +584,6 @@ public class OutLineController { ...@@ -709,20 +584,6 @@ public class OutLineController {
barcodeManager.save(barcode); barcodeManager.save(barcode);
} }
isOut = true; isOut = true;
if (StringUtils.isNotBlank(orderItemId)) {
LiteOrderItem orderItem = liteOrderItemManager.get(orderItemId);
if (orderItem != null) {
if (StringUtils.isNotBlank(orderItem.getBrand())) {
hasBrand = true;
}
if (StringUtils.isNotBlank(orderItem.getOrderNo())) {
if (!orderItem.getOrderNo().equals(orderItemIdStr)) {
orderItemIdStr = orderItem.getOrderNo();
}
}
}
}
} }
} }
} }
...@@ -730,20 +591,10 @@ public class OutLineController { ...@@ -730,20 +591,10 @@ public class OutLineController {
return ResultBean.newErrorResult(-1, "", barcode.getBarcode() + "不需要出库"); return ResultBean.newErrorResult(-1, "", barcode.getBarcode() + "不需要出库");
} }
resultBean.setData(getBoxInfo(boxStr)); resultBean.setData(getBoxInfo(boxStr));
if (hasBrand) {
log.info("hasBrand--" + hasBrand);
resultBean.setCode(3);
return resultBean;
}
if (StringUtils.isNotBlank(orderItemIdStr)) {
resultBean.setMsgKey(null);
resultBean.setMsg("工单号为:" + orderItemIdStr);
}
} }
//任务取消 //任务取消
else if (INOUT_TYPE.CANCEL_ONE.name().equals(inoutType)) { else if (INOUT_TYPE.CANCEL_ONE.name().equals(inoutType)) {
finishVirtualTask(boxStr);
//根据箱子号 找到barcode //根据箱子号 找到barcode
Barcode pidBarcode = barcodeManager.findByBarcode(boxStr); Barcode pidBarcode = barcodeManager.findByBarcode(boxStr);
//判断是否有要出库的任务,给取消掉 //判断是否有要出库的任务,给取消掉
...@@ -757,12 +608,17 @@ public class OutLineController { ...@@ -757,12 +608,17 @@ public class OutLineController {
subCode.setOrderItemId(null); subCode.setOrderItemId(null);
subCode = barcodeManager.save(subCode); subCode = barcodeManager.save(subCode);
pidBarcode.UpdateSubCode(subCode); pidBarcode.UpdateSubCode(subCode);
pidBarcode = barcodeManager.save(pidBarcode); generateTask(subCode, opStatus, subCode.getAmount(), opType, orderItemId, ExtendType.TASK_CANNEL, false);
generateTask(subCode, opStatus, subCode.getAmount(), opType, orderItemId,ExtendType.TASK_CANNEL,false);
log.info("点击完成扫码并入库,任务取消,barcode:" + subCode.getBarcode() + ",OrderItemId为:" + orderItemId); log.info("点击完成扫码并入库,任务取消,barcode:" + subCode.getBarcode() + ",OrderItemId为:" + orderItemId);
} }
} }
} }
barcodeManager.save(pidBarcode);
StoragePos pos = BoxHandleUtil.locOnePos(pidBarcode);
if (pos != null){
pos.setBarcode(pidBarcode);
storagePosManager.save(pos);
}
} }
return resultBean; return resultBean;
} }
...@@ -935,13 +791,13 @@ public class OutLineController { ...@@ -935,13 +791,13 @@ public class OutLineController {
String msg = ""; String msg = "";
List<List<Integer>> boxPartitionCounts = new ArrayList<>(); List<List<Integer>> boxPartitionCounts = new ArrayList<>();
if (StringUtils.isNotBlank(code)) { if (StringUtils.isNotBlank(code)) {
if (code.startsWith("CS") || code.startsWith("CM") || code.startsWith("CB")) { if (code.startsWith("C07") || code.startsWith("C13") || code.startsWith("C15")) {
String endStr = code.substring(code.length() - 1); //得到是A、B面 String endStr = code.substring(code.length() - 1); //得到是A、B面
boxStr = getBoxStrbyBoxPartition(code); boxStr = getBoxStrbyBoxPartition(code);
if (boxSideMap.get(boxStr) != null) { if (boxSideMap.get(boxStr) != null) {
endStr = boxSideMap.get(boxStr); endStr = boxSideMap.get(boxStr);
} else { } else {
boxSideMap.put(boxStr,endStr); boxSideMap.put(boxStr, endStr);
} }
//1、获取料箱的 //1、获取料箱的
Barcode barcode = barcodeManager.findByBarcode(boxStr); Barcode barcode = barcodeManager.findByBarcode(boxStr);
...@@ -962,32 +818,32 @@ public class OutLineController { ...@@ -962,32 +818,32 @@ public class OutLineController {
} }
List<Integer> partition1 = new ArrayList<>(); List<Integer> partition1 = new ArrayList<>();
partition1.add(getCountByPartition(needOutCountMap, boxStr + "-1")); partition1.add(getCountByPartition(needOutCountMap, boxStr + "-01"));
partition1.add(getCountByPartition(allCountMap, boxStr + "-1")); partition1.add(getCountByPartition(allCountMap, boxStr + "-01"));
List<Integer> partition2 = new ArrayList<>(); List<Integer> partition2 = new ArrayList<>();
partition2.add(getCountByPartition(needOutCountMap, boxStr + "-2")); partition2.add(getCountByPartition(needOutCountMap, boxStr + "-02"));
partition2.add(getCountByPartition(allCountMap, boxStr + "-2")); partition2.add(getCountByPartition(allCountMap, boxStr + "-02"));
List<Integer> partition3 = new ArrayList<>(); List<Integer> partition3 = new ArrayList<>();
partition3.add(getCountByPartition(needOutCountMap, boxStr + "-3")); partition3.add(getCountByPartition(needOutCountMap, boxStr + "-03"));
partition3.add(getCountByPartition(allCountMap, boxStr + "-3")); partition3.add(getCountByPartition(allCountMap, boxStr + "-03"));
List<Integer> partition4 = new ArrayList<>(); List<Integer> partition4 = new ArrayList<>();
partition4.add(getCountByPartition(needOutCountMap, boxStr + "-4")); partition4.add(getCountByPartition(needOutCountMap, boxStr + "-04"));
partition4.add(getCountByPartition(allCountMap, boxStr + "-4")); partition4.add(getCountByPartition(allCountMap, boxStr + "-04"));
List<Integer> partition5 = new ArrayList<>(); List<Integer> partition5 = new ArrayList<>();
partition5.add(getCountByPartition(needOutCountMap, boxStr + "-5")); partition5.add(getCountByPartition(needOutCountMap, boxStr + "-05"));
partition5.add(getCountByPartition(allCountMap, boxStr + "-5")); partition5.add(getCountByPartition(allCountMap, boxStr + "-05"));
List<Integer> partition6 = new ArrayList<>(); List<Integer> partition6 = new ArrayList<>();
partition6.add(getCountByPartition(needOutCountMap, boxStr + "-6")); partition6.add(getCountByPartition(needOutCountMap, boxStr + "-06"));
partition6.add(getCountByPartition(allCountMap, boxStr + "-6")); partition6.add(getCountByPartition(allCountMap, boxStr + "-06"));
List<Integer> partition7 = new ArrayList<>(); List<Integer> partition7 = new ArrayList<>();
partition7.add(getCountByPartition(needOutCountMap, boxStr + "-7")); partition7.add(getCountByPartition(needOutCountMap, boxStr + "-07"));
partition7.add(getCountByPartition(allCountMap, boxStr + "-7")); partition7.add(getCountByPartition(allCountMap, boxStr + "-07"));
List<Integer> partition8 = new ArrayList<>(); List<Integer> partition8 = new ArrayList<>();
partition8.add(getCountByPartition(needOutCountMap, boxStr + "-8")); partition8.add(getCountByPartition(needOutCountMap, boxStr + "-08"));
partition8.add(getCountByPartition(allCountMap, boxStr + "-8")); partition8.add(getCountByPartition(allCountMap, boxStr + "-08"));
//根据箱子面展示不同的隔扣 //根据箱子面展示不同的隔扣
if (boxStr.startsWith("CS") || boxStr.startsWith("CB")) { if (boxStr.startsWith("C07")) {
platsize = "7"; platsize = "7";
if ("A".equals(endStr)) { if ("A".equals(endStr)) {
boxPartitionCounts.add(partition8); boxPartitionCounts.add(partition8);
...@@ -1008,14 +864,27 @@ public class OutLineController { ...@@ -1008,14 +864,27 @@ public class OutLineController {
boxPartitionCounts.add(partition7); boxPartitionCounts.add(partition7);
boxPartitionCounts.add(partition8); boxPartitionCounts.add(partition8);
} }
} else if (boxStr.startsWith("CM")) { } else if (boxStr.startsWith("C13")) {
platsize = "13";
if ("A".equals(endStr)) {
boxPartitionCounts.add(partition3);
boxPartitionCounts.add(partition2);
boxPartitionCounts.add(partition1);
} else {
boxPartitionCounts.add(partition1);
boxPartitionCounts.add(partition2);
boxPartitionCounts.add(partition3);
}
} else if (boxStr.startsWith("C15")) {
platsize = "15"; platsize = "15";
if ("A".equals(endStr)) { if ("A".equals(endStr)) {
boxPartitionCounts.add(partition3);
boxPartitionCounts.add(partition2); boxPartitionCounts.add(partition2);
boxPartitionCounts.add(partition1); boxPartitionCounts.add(partition1);
} else { } else {
boxPartitionCounts.add(partition1); boxPartitionCounts.add(partition1);
boxPartitionCounts.add(partition2); boxPartitionCounts.add(partition2);
boxPartitionCounts.add(partition3);
} }
} }
boxAllCount = boxAllCountMap.get(boxStr) == null ? 0 : boxAllCountMap.get(boxStr); boxAllCount = boxAllCountMap.get(boxStr) == null ? 0 : boxAllCountMap.get(boxStr);
...@@ -1261,7 +1130,7 @@ public class OutLineController { ...@@ -1261,7 +1130,7 @@ public class OutLineController {
private boolean isBoxPartition(String code) { private boolean isBoxPartition(String code) {
boolean flag = false; boolean flag = false;
if (code.startsWith("CS") || code.startsWith("CM") || code.startsWith("CB")) { if (code.startsWith("C07") || code.startsWith("C13") || code.startsWith("C15")) {
flag = true; flag = true;
} }
return flag; return flag;
......
...@@ -479,7 +479,7 @@ public class OuterReportController { ...@@ -479,7 +479,7 @@ public class OuterReportController {
} }
if (queryCondition != null) { if (queryCondition != null) {
query = QueryHelp.getQuery(queryCondition); query = QueryHelp.getQuery(queryCondition);
query.addCriteria(Criteria.where("posName").exists(true).ne("").and("partNumber").nin(Arrays.asList("CS", "CM", "CB"))); query.addCriteria(Criteria.where("posName").exists(true).ne("").and("partNumber").nin(Arrays.asList("C07", "C13", "C15")));
} }
PageData<InventoryDto> resultData = new PageData<>(); PageData<InventoryDto> resultData = new PageData<>();
PageData<Barcode> data = barcodeManager.findByPage(query, pageable); PageData<Barcode> data = barcodeManager.findByPage(query, pageable);
......
...@@ -41,9 +41,9 @@ public class LuxsanApi extends DefaultSmfApiListener { ...@@ -41,9 +41,9 @@ public class LuxsanApi extends DefaultSmfApiListener {
*/ */
public static List<QueryBinResult> queryBin(QueryBinRequest request) { public static List<QueryBinResult> queryBin(QueryBinRequest request) {
try { try {
log.info("queryBin接口请求参数为:" + JSONObject.toJSONString(request)); //log.info("queryBin接口请求参数为:" + JSONObject.toJSONString(request));
String resultStr = HttpHelper.postJson(queryBinUrl, request); String resultStr = HttpHelper.postJson(queryBinUrl, request);
log.info("queryBin接口返回结果为:" + resultStr); //log.info("queryBin接口返回结果为:" + resultStr);
LuxsanApiResult apiResult = JSONObject.parseObject(resultStr, LuxsanApiResult.class); LuxsanApiResult apiResult = JSONObject.parseObject(resultStr, LuxsanApiResult.class);
if (LuxsanApiEnum.ERROR.equals(apiResult.getMSGTY())) { if (LuxsanApiEnum.ERROR.equals(apiResult.getMSGTY())) {
......
package com.neotel.smfcore.custom.luxsan.factory_c.rawstor.bean;
import lombok.Data;
import java.util.Map;
@Data
public class CtuStatus {
//ctu Id
private String ctuId;
//key为抽屉号, value为
private Map<String,String> usageMap;
}
package com.neotel.smfcore.custom.luxsan.factory_c.rawstor.bean.dto;
import lombok.AllArgsConstructor;
import lombok.Data;
import java.util.List;
@Data
@AllArgsConstructor
public class ValidBin {
private String boxCode;
private String boxLoc;
private String stackerLoc;
private List<String> validBinList;
}
...@@ -30,7 +30,9 @@ import com.neotel.smfcore.custom.luxsan.api.bean.request.NewLabelToCellRequest; ...@@ -30,7 +30,9 @@ import com.neotel.smfcore.custom.luxsan.api.bean.request.NewLabelToCellRequest;
import com.neotel.smfcore.custom.luxsan.api.bean.request.PickingIssueRequest; import com.neotel.smfcore.custom.luxsan.api.bean.request.PickingIssueRequest;
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.dto.CtuTask; import com.neotel.smfcore.custom.luxsan.factory_c.rawstor.bean.dto.CtuTask;
import com.neotel.smfcore.custom.luxsan.factory_c.rawstor.bean.dto.ValidBin;
import com.neotel.smfcore.custom.luxsan.factory_c.rawstor.enums.LiteorderCheckType; import com.neotel.smfcore.custom.luxsan.factory_c.rawstor.enums.LiteorderCheckType;
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.MaterialUtil; import com.neotel.smfcore.custom.luxsan.factory_c.rawstor.util.MaterialUtil;
...@@ -169,7 +171,7 @@ public class CDeviceController { ...@@ -169,7 +171,7 @@ public class CDeviceController {
Barcode boxBarcode = null; Barcode boxBarcode = null;
StoragePos inPos = null; StoragePos inPos = null;
try{ try{
String boxStr = BoxHandleUtil.getBoxStr(binCodeStr); String boxStr = BoxHandleUtil.getBoxStr(binCodeStr,true);
boxBarcode = codeResolve.resolveOneValideBarcode(boxStr); boxBarcode = codeResolve.resolveOneValideBarcode(boxStr);
inPos = storagePosManager.getByBarcode(boxBarcode.getBarcode()); inPos = storagePosManager.getByBarcode(boxBarcode.getBarcode());
if(inPos != null){ if(inPos != null){
...@@ -211,15 +213,6 @@ public class CDeviceController { ...@@ -211,15 +213,6 @@ public class CDeviceController {
inPos.setBarcode(boxBarcode); inPos.setBarcode(boxBarcode);
storagePosManager.save(inPos); storagePosManager.save(inPos);
} }
//把当前料箱设置成正在入库的料箱
Map<String,String> cacheMap = dataCache.getCache(CacheNameUtil.CHCHE_EXECUTINGPUTIN_BOX);
if (cacheMap == null){
cacheMap = new HashMap<>();
}
cacheMap.put(boxBarcode.getBarcode(),boxBarcode.getBarcode());
dataCache.updateCache(CacheNameUtil.CHCHE_EXECUTINGPUTIN_BOX,cacheMap);
return ResultBean.newOkResult(""); return ResultBean.newOkResult("");
} }
} }
...@@ -237,7 +230,7 @@ public class CDeviceController { ...@@ -237,7 +230,7 @@ public class CDeviceController {
log.info("料格已经放满,收到料格信息为" + binCodeStr + ",料串信息为:" + materialStr); log.info("料格已经放满,收到料格信息为" + binCodeStr + ",料串信息为:" + materialStr);
String boxStr = BoxHandleUtil.getBoxStr(binCodeStr); String boxStr = BoxHandleUtil.getBoxStr(binCodeStr,true);
Barcode boxBarcode = codeResolve.resolveOneValideBarcode(boxStr); Barcode boxBarcode = codeResolve.resolveOneValideBarcode(boxStr);
//该料格有出库时, 需要清理此字段 //该料格有出库时, 需要清理此字段
boxBarcode.updateExtraData(binCodeStr,"FULL"); boxBarcode.updateExtraData(binCodeStr,"FULL");
...@@ -269,7 +262,7 @@ public class CDeviceController { ...@@ -269,7 +262,7 @@ public class CDeviceController {
@RequestMapping("/boxIntoPos") @RequestMapping("/boxIntoPos")
@AnonymousAccess @AnonymousAccess
public synchronized ResultBean boxIntoPos(String boxStr, String boxLoc) { public synchronized ResultBean boxIntoPos(String boxStr, String boxLoc) {
log.info("["+boxLoc + "]位置的料箱入库开始生成任务:"+boxStr); log.info("[" + boxLoc + "]位置的料箱入库开始生成任务:" + boxStr);
if (StringUtils.isEmpty(boxStr)) { if (StringUtils.isEmpty(boxStr)) {
return ResultBean.newErrorResult(-1, "smfcore.valueCanotNull", "{0}不能为空", new String[]{"料箱信息"}); return ResultBean.newErrorResult(-1, "smfcore.valueCanotNull", "{0}不能为空", new String[]{"料箱信息"});
} }
...@@ -286,7 +279,9 @@ public class CDeviceController { ...@@ -286,7 +279,9 @@ public class CDeviceController {
if (dataLog.isPutInTask()) { if (dataLog.isPutInTask()) {
return ResultBean.newOkResult(dataLog); return ResultBean.newOkResult(dataLog);
} else { } else {
return ResultBean.newErrorResult(-1, "", boxStr + "已经有出库任务,请先完成出库任务"); log.info(boxStr + "有正在执行的出库任务,服务器更改状态为完成");
dataLog.setStatus(OP_STATUS.FINISHED.name());
taskService.updateFinishedTask(dataLog);
} }
} }
} }
...@@ -294,68 +289,55 @@ public class CDeviceController { ...@@ -294,68 +289,55 @@ public class CDeviceController {
//2.获取空库位 //2.获取空库位
Barcode boxBarcode = codeResolve.resolveOneValideBarcode(boxStr); Barcode boxBarcode = codeResolve.resolveOneValideBarcode(boxStr);
StoragePos pos = locOnePos(boxBarcode); //判断当前有没有缓存的 未完成的箱子
if(pos == null){ /*if (TaskCurrentLoc.In1_DischargeHole.equals(boxLoc) || TaskCurrentLoc.In2_DischargeHole.equals(boxLoc)) {
return ResultBean.newErrorResult(-1, "", boxStr + "未找到可用库位"); String loc = TaskCurrentLoc.In1_FeedingInlet;
} if (TaskCurrentLoc.In2_DischargeHole.equals(boxLoc)) {
loc = TaskCurrentLoc.In2_FeedingInlet;
//4.生成入库任务 }
Storage storage = dataCache.getStorageById(pos.getStorageId());
DataLog dataLog = taskService.addPutInTaskToExecute(storage, boxBarcode, pos, boxLoc);
int cacheBoxNum = 0;
List<DataLog> allTasks = taskService.getAllTasks();
for (DataLog dataLog : allTasks) {
if (dataLog.isCheckOutTask() && (loc.equals(dataLog.getCurrentLoc()) || loc.equals(dataLog.getLoc()))) {
cacheBoxNum = cacheBoxNum + 1;
}
}
Map<String,String> cacheMap = dataCache.getCache(CacheNameUtil.CHCHE_EXECUTINGPUTIN_BOX); //判断箱子满没满
if (cacheMap == null){ boolean full = true;
cacheMap = new HashMap<>(); List<Barcode> subCodeList = boxBarcode.getSubCodeList();
} Map<String, Long> countAllMap = subCodeList.stream().collect(Collectors.groupingBy(t -> t.getPosName(), Collectors.counting()));
cacheMap.remove(boxBarcode.getBarcode());
dataCache.updateCache(CacheNameUtil.CHCHE_EXECUTINGPUTIN_BOX,cacheMap);
return ResultBean.newOkResult(dataLog); int par = boxStr.startsWith("C07") ? 6 : 3;
} for (int i = 1; i <= par; i++) {
Long binPutNum = countAllMap.get(boxBarcode.getBarcode() + "-0" + i);
if (binPutNum == null || binPutNum == 0) {
full = false;
break;
}
}
private StoragePos locOnePos(Barcode boxBarcode){ if (cacheBoxNum < 3) {
//判断信息是否在已经在库位中(出入库只改变料箱位置状态,不从StoragePos表中清除) if (!full) {
StoragePos pos = storagePosManager.getByBarcode(boxBarcode.getBarcode()); return ResultBean.newErrorResult(-1, "", boxStr + "料箱未满,入料机构缓存不达到3个箱子");
if (pos != null){ }
return pos; }
} }*/
List<String> cidList = new ArrayList<>();
List<Storage> storageList = new ArrayList<>();
for (Storage storage : dataCache.getAllStorage().values()) {
storageList.add(storage);
cidList.add(storage.getCid());
}
pos = taskService.findEmptyPosForPutIn(storageList, boxBarcode, "", ""); StoragePos pos = BoxHandleUtil.locOnePos(boxBarcode);
if (pos == null) { if (pos == null) {
log.info(boxBarcode.getBarcode() + "未找到可用库位"); return ResultBean.newErrorResult(-1, "", boxStr + "未找到可用库位");
return null;
}else{
log.info("料箱["+boxBarcode.getBarcode()+"]信息加入库位["+pos.getPosName()+"]中");
pos.setBarcode(boxBarcode);
pos.setUsed(true);
storagePosManager.save(pos);
//3.锁定库位
Storage storage = dataCache.getStorageById(pos.getStorageId());
ReelLockPosInfo reelLocInfo = new ReelLockPosInfo();
reelLocInfo.setBarcode(boxBarcode.getBarcode());
reelLocInfo.setCid(storage.getCid());
reelLocInfo.setLockPosName(pos.getPosName());
reelLocInfo.setLockPosId(pos.getId());
reelLocInfo = ReelLockPosUtil.addReelLockPosInfo(reelLocInfo, cidList);
if (reelLocInfo == null) {
log.info("[" + boxBarcode.getBarcode() + "]库位锁定失败,暂停入库");
return null;
}
} }
return pos; //4.生成入库任务
Storage storage = dataCache.getStorageById(pos.getStorageId());
DataLog dataLog = taskService.addPutInTaskToExecute(storage, boxBarcode, pos, boxLoc);
return ResultBean.newOkResult(dataLog);
} }
...@@ -400,7 +382,7 @@ public class CDeviceController { ...@@ -400,7 +382,7 @@ public class CDeviceController {
//Barcode binCode = codeResolve.resolveOneValideBarcode(boxStr); //Barcode binCode = codeResolve.resolveOneValideBarcode(boxStr);
//解析料箱信息 //解析料箱信息
String box = BoxHandleUtil.getBoxStr(boxStr); String box = BoxHandleUtil.getBoxStr(boxStr,true);
Barcode boxBarcode = codeResolve.resolveOneValideBarcode(box); Barcode boxBarcode = codeResolve.resolveOneValideBarcode(box);
...@@ -526,64 +508,6 @@ public class CDeviceController { ...@@ -526,64 +508,6 @@ public class CDeviceController {
} }
return ResultBean.newOkResult(""); return ResultBean.newOkResult("");
} }
//
@ApiOperation("修改任务状态")
@RequestMapping("/updateTaskStatus")
@AnonymousAccess
public ResultBean updateTaskStatus(@RequestBody Map<String, String> paramMap) {
String boxStr = paramMap.get("boxStr");
String statusStr = paramMap.get("statusStr");
//1.判断任务是否存在
DataLog task = null;
List<DataLog> allTasks = taskService.getAllTasks();
for (DataLog dataLog : allTasks) {
if (boxStr.startsWith(dataLog.getBarcode())) {
if (!dataLog.isCancel() && !dataLog.isFinished()) {
task = dataLog;
break;
}
}
}
if (task == null) {
return ResultBean.newErrorResult(-1, "smfcore.task.notExist", "任务不存在");
}
statusStr = statusStr.toUpperCase();
String taskType = "入库";
if(task.isCheckOutTask()){
taskType = "出库";
}
log.info("更新料箱[" + boxStr + "]的"+taskType+"任务["+task.getId()+"]状态为:" + statusStr);
//2.判断更新状态和当前状态任务是否相同
if (task.getStatus().equals(statusStr)) {
return ResultBean.newErrorResult(-1, "smfcore.taskStatusHasUpdate", "任务{0}已经修改状态", new String[]{task.getBarcode()});
}
task.setStatus(statusStr);
//3.判断是出库,还是入库任务
if (task.isPutInTask()) {
if (OP_STATUS.FINISHED.name().equals(statusStr)) {
BoxHandleUtil.intoPos(task);
ReelLockPosUtil.removeReelLockPosInfo(task.getBarcode());
} else {
taskService.updateQueueTask(task);
}
} else {
//4.如果是出库任务
if (OP_STATUS.EXECUTING.name().equals(statusStr)) {
taskService.updateQueueTask(task);
} else {
if (!task.isOutFromPos()) {
BoxHandleUtil.outFromPos(task);
task.setOutFromPos(true);
}
taskService.updateFinishedTask(task);
}
}
return ResultBean.newOkResult("");
}
@ApiOperation("根据料箱获取目的地") @ApiOperation("根据料箱获取目的地")
...@@ -608,15 +532,17 @@ public class CDeviceController { ...@@ -608,15 +532,17 @@ public class CDeviceController {
@ApiOperation("入料机构获取可用料格") @ApiOperation("入料机构获取可用料格")
@RequestMapping("/validBin") @RequestMapping("/validBin")
@AnonymousAccess @AnonymousAccess
public ResultBean validBin(@RequestBody Map<String,String> paramMap){ public synchronized ResultBean validBin(@RequestBody Map<String,String> paramMap) {
String stackerId = paramMap.get("stackerId"); String stackerId = paramMap.get("stackerId");
String binListStr = paramMap.get("binList"); String binListStr = paramMap.get("binList");
String source = paramMap.get("source");
List<String> validBinList = new ArrayList<String>(); List<String> validBinList = new ArrayList<String>();
log.info("入料机构获取料串["+stackerId+"]的可用料格["+binListStr+"]"); log.info("入料机构获取料串[" + stackerId + "]的可用料格[" + binListStr + "],入料机构为[" + source + "]");
BindGrInfo bindGrInfo = MaterialUtil.getBindGrInfo(stackerId); BindGrInfo bindGrInfo = MaterialUtil.getBindGrInfo(stackerId);
if(bindGrInfo == null){ if (bindGrInfo == null) {
return ResultBean.newErrorResult(-1,"error.nobind","料串["+stackerId+"]未绑定GR"); return ResultBean.newErrorResult(-1, "error.nobind", "料串[" + stackerId + "]未绑定GR");
} }
Barcode stackerBarcode = new Barcode(); Barcode stackerBarcode = new Barcode();
stackerBarcode.setBarcode(stackerId); stackerBarcode.setBarcode(stackerId);
...@@ -628,15 +554,15 @@ public class CDeviceController { ...@@ -628,15 +554,15 @@ public class CDeviceController {
String warhouseCode = MaterialUtil.getWarhouseCode(stackerId); String warhouseCode = MaterialUtil.getWarhouseCode(stackerId);
stackerBarcode.setWarehouseCode(warhouseCode); stackerBarcode.setWarehouseCode(warhouseCode);
String[] binList = binListStr.split(","); /*String[] binList = binListStr.split(",");
for (String binId : binList) { for (String binId : binList) {
String boxStr = BoxHandleUtil.getBoxStr(binId); String boxStr = BoxHandleUtil.getBoxStr(binId);
Barcode boxBarcode = codeResolve.resolveOneValideBarcode(boxStr); Barcode boxBarcode = codeResolve.resolveOneValideBarcode(boxStr);
//为料箱分配一个库位,直接放到库位中, 如果没有库位, 那么这个料箱不允许使用 //为料箱分配一个库位,直接放到库位中, 如果没有库位, 那么这个料箱不允许使用
StoragePos pos = locOnePos(boxBarcode); StoragePos pos = BoxHandleUtil.locOnePos(boxBarcode);
if(pos != null){ if(pos != null){
String canPutIn = canMaterialPutInBin(stackerBarcode,boxBarcode,binId); String canPutIn = BinCacheUtil.canMaterialPutInBin(stackerBarcode,boxBarcode,binId);
if(canPutIn.isEmpty()){ if(canPutIn.isEmpty()){
validBinList.add(binId); validBinList.add(binId);
}else{ }else{
...@@ -646,23 +572,28 @@ public class CDeviceController { ...@@ -646,23 +572,28 @@ public class CDeviceController {
} }
Map<String,Object> dataMap = new HashMap<>(); Map<String,Object> dataMap = new HashMap<>();
dataMap.put("validBinList",validBinList); dataMap.put("validBinList",validBinList);*/
return ResultBean.newOkResult(dataMap);
ValidBin validBin = BinCacheUtil.validBin(stackerBarcode, source, binListStr);
if (validBin == null){
return ResultBean.newErrorResult(-1,"",stackerId+"未找到可用料箱");
}
return ResultBean.newOkResult(validBin);
} }
@ApiOperation("呼叫空箱") @ApiOperation("呼叫空箱")
@RequestMapping("/callEmptyBox") @RequestMapping("/callEmptyBox")
@AnonymousAccess @AnonymousAccess
public ResultBean callEmptyBox(String size,String outLet){ public ResultBean callEmptyBox(String size, String outLet, String wareHouseCode) {
log.info("开始呼叫空箱,尺寸为:"+size+",出口位置为:"+outLet); log.info("开始呼叫空箱,尺寸为:" + size + ",出口位置为:" + outLet);
String resultStr = BoxHandleUtil.callEmptyBox(size,outLet); StoragePos storagePos = BoxHandleUtil.callEmptyBox(size, outLet, wareHouseCode);
if (StringUtils.isEmpty(resultStr)){ if (storagePos == null) {
return ResultBean.newErrorResult(-1,"","未找到可用料箱"); return ResultBean.newErrorResult(-1, "", "未找到可用料箱");
} }
return ResultBean.newOkResult(resultStr); return ResultBean.newOkResult(storagePos.getPosName());
} }
...@@ -711,6 +642,19 @@ public class CDeviceController { ...@@ -711,6 +642,19 @@ public class CDeviceController {
return ResultBean.newErrorResult(-1, "", materialStr + "没有任何绑定信息"); return ResultBean.newErrorResult(-1, "", materialStr + "没有任何绑定信息");
} }
//判断绑定的gr信息,是否和入库的一样
BindGrInfo bindGrInfo = MaterialUtil.getBindGrInfo(materialStr);
if (bindGrInfo != null) {
if (barcode.getPartNumber().equals(bindGrInfo.getMaterialCode())
&& barcode.getProvider().equals(bindGrInfo.getBrand())) {
} else {
return ResultBean.newErrorResult(-1, "", "当前入库的物料[" + barcode.getBarcode() + "]的料号[" + barcode.getPartNumber() +
"],供应商["+barcode.getProvider()+"]与绑定的Gr中的料号["+bindGrInfo.getMaterialCode()+"]供应商["+bindGrInfo.getBrand()+"]不一致");
}
}
//调用禁用料信息 //调用禁用料信息
barcode = smfApi.canPutInAfterResolve(barcode); barcode = smfApi.canPutInAfterResolve(barcode);
...@@ -720,7 +664,7 @@ public class CDeviceController { ...@@ -720,7 +664,7 @@ public class CDeviceController {
//判断料格是否正常 //判断料格是否正常
Barcode boxBarcode = null; Barcode boxBarcode = null;
try { try {
String boxStr = BoxHandleUtil.getBoxStr(binCodeStr); String boxStr = BoxHandleUtil.getBoxStr(binCodeStr,true);
boxBarcode = codeResolve.resolveOneValideBarcode(boxStr); boxBarcode = codeResolve.resolveOneValideBarcode(boxStr);
} catch (ValidateException ve) { } catch (ValidateException ve) {
return ResultBean.newErrorResult(-1, ve.getMsgKey(), "料格条码不正确:" + binCodeStr); return ResultBean.newErrorResult(-1, ve.getMsgKey(), "料格条码不正确:" + binCodeStr);
...@@ -729,14 +673,6 @@ public class CDeviceController { ...@@ -729,14 +673,6 @@ public class CDeviceController {
if (boxBarcode != null) { if (boxBarcode != null) {
//判断隔口是否可以放入 //判断隔口是否可以放入
if (BinCacheUtil.canPutInBinCode(binCodeStr, warhouseCode)) { if (BinCacheUtil.canPutInBinCode(binCodeStr, warhouseCode)) {
//把当前料箱设置成正在入库的料箱
Map<String, String> cacheMap = dataCache.getCache(CacheNameUtil.CHCHE_EXECUTINGPUTIN_BOX);
if (cacheMap == null) {
cacheMap = new HashMap<>();
}
cacheMap.put(boxBarcode.getBarcode(), boxBarcode.getBarcode());
dataCache.updateCache(CacheNameUtil.CHCHE_EXECUTINGPUTIN_BOX, cacheMap);
return ResultBean.newOkResult(""); return ResultBean.newOkResult("");
} }
} }
...@@ -781,7 +717,7 @@ public class CDeviceController { ...@@ -781,7 +717,7 @@ public class CDeviceController {
Barcode boxBarcode = null; Barcode boxBarcode = null;
StoragePos inPos = null; StoragePos inPos = null;
try { try {
String boxStr = BoxHandleUtil.getBoxStr(binCodeStr); String boxStr = BoxHandleUtil.getBoxStr(binCodeStr,true);
boxBarcode = codeResolve.resolveOneValideBarcode(boxStr); boxBarcode = codeResolve.resolveOneValideBarcode(boxStr);
inPos = storagePosManager.getByBarcode(boxBarcode.getBarcode()); inPos = storagePosManager.getByBarcode(boxBarcode.getBarcode());
if (inPos != null) { if (inPos != null) {
...@@ -838,7 +774,7 @@ public class CDeviceController { ...@@ -838,7 +774,7 @@ public class CDeviceController {
Barcode boxBarcode = null; Barcode boxBarcode = null;
for (String binCode : paramMap.keySet()) { for (String binCode : paramMap.keySet()) {
if (boxBarcode == null) { if (boxBarcode == null) {
String boxStr = BoxHandleUtil.getBoxStr(binCode); String boxStr = BoxHandleUtil.getBoxStr(binCode,true);
boxBarcode = codeResolve.resolveOneValideBarcode(boxStr); boxBarcode = codeResolve.resolveOneValideBarcode(boxStr);
} }
boxBarcode.updateHeightMap(binCode, paramMap.get(binCode)); boxBarcode.updateHeightMap(binCode, paramMap.get(binCode));
...@@ -862,87 +798,6 @@ public class CDeviceController { ...@@ -862,87 +798,6 @@ public class CDeviceController {
} }
@ApiOperation("更新入料机构缓存")
@RequestMapping("updateMaterPutInCache")
@AnonymousAccess
public ResultBean updateMaterPutInCache(@RequestParam("number") String number,
@RequestParam("boxStr") String boxStr,
@RequestParam("loc") String loc) {
Map<String, Map<String, String>> cacheMap = dataCache.getCache(CacheNameUtil.CHCHE_MATERIAL_PUTIN_CACHE);
if (cacheMap == null) {
cacheMap = new ConcurrentHashMap<>();
}
Map<String, String> usageMap = cacheMap.get(number);
if (usageMap == null) {
usageMap = new ConcurrentHashMap<>();
}
usageMap.put(boxStr, loc);
cacheMap.put(number, usageMap);
dataCache.updateCache(CacheNameUtil.CHCHE_MATERIAL_PUTIN_CACHE, cacheMap);
return ResultBean.newOkResult("");
}
@ApiOperation("移除入料机构缓存")
@RequestMapping("removeMaterPutInCache")
@AnonymousAccess
public ResultBean removeMaterPutInCache(@RequestParam("number") String number,
@RequestParam("boxStr") String boxStr) {
Map<String, Map<String, String>> cacheMap = dataCache.getCache(CacheNameUtil.CHCHE_MATERIAL_PUTIN_CACHE);
if (cacheMap == null) {
cacheMap = new ConcurrentHashMap<>();
}
Map<String, String> usageMap = cacheMap.get(number);
if (usageMap == null) {
usageMap = new ConcurrentHashMap<>();
}
usageMap.remove(boxStr);
cacheMap.put(number, usageMap);
dataCache.updateCache(CacheNameUtil.CHCHE_MATERIAL_PUTIN_CACHE, cacheMap);
return ResultBean.newOkResult("");
}
/**
* 验证物料是否可以放入料格:
* 1 料格未满 2 料格中若有物料,必须料号,供应商,库别,过账日期一致才可放入
* @return
*/
public String canMaterialPutInBin(Barcode reelBarcode, Barcode boxBarcode, String binId){
String isBinFull = boxBarcode.getExtraData(binId);
if(isBinFull != null){
//该料格已放满, 不可以再放料
log.info("料格["+binId+"]已满,不可放入物料["+reelBarcode.getBarcode()+"]");
return "料格["+binId+"]已满,不可放入物料["+reelBarcode.getBarcode()+"]";
}
if (!BinCacheUtil.canPutInBinCode(binId, reelBarcode.getWarehouseCode())) {
return "库别["+reelBarcode.getWarehouseCode()+"]不可放入料格["+binId+"]";
}
List<Barcode> subCodeList = boxBarcode.getSubCodeList();
if(subCodeList != null){
for (Barcode barcode : subCodeList) {
if(barcode.getPosName().equals(binId)){
//因为bin中的物料都是一样的料号,供应商,库别,过账日期,所以只需要找到Bin中的第一个物料进行比对就可以了
if(!barcode.getPartNumber().equals(reelBarcode.getPartNumber())){
return "料格中["+binId+"]物料的料号["+barcode.getPartNumber()+"]与["+reelBarcode.getBarcode()+"]的料号["+reelBarcode.getPartNumber()+"]不一致";
}
if(!barcode.getProvider().equals(reelBarcode.getProvider())){
return "料格中["+binId+"]物料的供应商["+barcode.getProvider()+"]与["+reelBarcode.getBarcode()+"]的供应商["+reelBarcode.getProvider()+"]不一致";
}
if(!barcode.getWarehouseCode().equals(reelBarcode.getWarehouseCode())){
return "料格中["+binId+"]物料的库别["+barcode.getWarehouseCode()+"]与["+reelBarcode.getBarcode()+"]的库别["+reelBarcode.getWarehouseCode()+"]不一致";
}
if(!barcode.getProduceDate().equals(reelBarcode.getProduceDate())){
return "料格中["+binId+"]物料的供应商["+barcode.getProvider()+"]与["+reelBarcode.getBarcode()+"]的供应商["+reelBarcode.getPartNumber()+"]不一致";
}
}
}
}
return "";
}
private void generatePutInTask(Barcode barcode, Barcode boxBarcode,String status) { private void generatePutInTask(Barcode barcode, Barcode boxBarcode,String status) {
......
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.ReelLockPosUtil;
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.enums.OP;
import com.neotel.smfcore.core.device.enums.OP_STATUS;
import com.neotel.smfcore.core.device.util.DataCache; import com.neotel.smfcore.core.device.util.DataCache;
import com.neotel.smfcore.core.storage.service.po.Storage;
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.factory_c.rawstor.bean.CtuStatus;
import com.neotel.smfcore.custom.luxsan.factory_c.rawstor.bean.dto.CtuTask; import com.neotel.smfcore.custom.luxsan.factory_c.rawstor.bean.dto.CtuTask;
import com.neotel.smfcore.custom.luxsan.factory_c.rawstor.enums.TaskCurrentLoc;
import com.neotel.smfcore.custom.luxsan.factory_c.rawstor.util.BoxHandleUtil;
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;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.logging.log4j.util.Strings; import org.apache.logging.log4j.util.Strings;
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.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -36,6 +46,9 @@ public class CtuDeviceController { ...@@ -36,6 +46,9 @@ public class CtuDeviceController {
@Autowired @Autowired
private DataCache dataCache; private DataCache dataCache;
@Autowired
private CodeResolve codeResolve;
@ApiOperation("原材料CTU获取线体到架子的入库任务(入满箱或出库后回库)") @ApiOperation("原材料CTU获取线体到架子的入库任务(入满箱或出库后回库)")
@RequestMapping("/lineToShelfTasks") @RequestMapping("/lineToShelfTasks")
...@@ -93,4 +106,130 @@ public class CtuDeviceController { ...@@ -93,4 +106,130 @@ public class CtuDeviceController {
} }
return ResultBean.newOkResult(shelfToLineTaskList); return ResultBean.newOkResult(shelfToLineTaskList);
} }
@ApiOperation("修改任务状态")
@RequestMapping("/updateTaskStatus")
@AnonymousAccess
public ResultBean updateTaskStatus(@RequestBody Map<String, String> paramMap) {
String boxStr = paramMap.get("boxStr");
String statusStr = paramMap.get("statusStr");
//1.判断任务是否存在
DataLog task = null;
List<DataLog> allTasks = taskService.getAllTasks();
for (DataLog dataLog : allTasks) {
if (boxStr.startsWith(dataLog.getBarcode())) {
if (!dataLog.isCancel() && !dataLog.isFinished()) {
task = dataLog;
break;
}
}
}
if (task == null) {
return ResultBean.newErrorResult(-1, "smfcore.task.notExist", "任务不存在");
}
statusStr = statusStr.toUpperCase();
String taskType = "入库";
if (task.isCheckOutTask()) {
taskType = "出库";
}
log.info("更新料箱[" + boxStr + "]的" + taskType + "任务[" + task.getId() + "]状态为:" + statusStr);
//2.判断更新状态和当前状态任务是否相同
if (task.getStatus().equals(statusStr)) {
return ResultBean.newErrorResult(-1, "smfcore.taskStatusHasUpdate", "任务{0}已经修改状态", new String[]{task.getBarcode()});
}
task.setStatus(statusStr);
//3.判断是出库,还是入库任务
if (task.isPutInTask()) {
if (OP_STATUS.FINISHED.name().equals(statusStr)) {
BoxHandleUtil.intoPos(task);
ReelLockPosUtil.removeReelLockPosInfo(task.getBarcode());
} else {
taskService.updateQueueTask(task);
}
} else {
//4.如果是出库任务
if (OP_STATUS.EXECUTING.name().equals(statusStr)) {
taskService.updateQueueTask(task);
}
//出库任务不让完成,等待入库的时候,再完成
else if (!OP_STATUS.FINISHED.name().equals(statusStr)) {
if (!task.isOutFromPos()) {
BoxHandleUtil.outFromPos(task);
task.setOutFromPos(true);
}
taskService.updateFinishedTask(task);
}
}
return ResultBean.newOkResult("");
}
@ApiOperation("根据料箱获取目的地")
@RequestMapping("/getOutTargetByBox")
@AnonymousAccess
public ResultBean getTargetByBox(String boxStr) {
if (StringUtils.isEmpty(boxStr)) {
return ResultBean.newErrorResult(-1, "smfcore.valueCanotNull", "{0}不能为空", new String[]{"料箱信息"});
}
List<DataLog> allTasks = taskService.getAllTasks();
for (DataLog dataLog : allTasks) {
if (dataLog.isCheckOutTask() && !dataLog.isFinished() && !dataLog.isCancel()) {
if (boxStr.startsWith(dataLog.getBarcode())) {
return ResultBean.newOkResult(dataLog.getPosName());
}
}
}
return ResultBean.newErrorResult(-1, "", "未找到" + boxStr + "的入库库位");
}
@ApiOperation("更新入料机构缓存")
@RequestMapping("/updateBoxLoc")
@AnonymousAccess
public ResultBean updateMaterPutInCache(@RequestParam("boxStr") String boxStr,
@RequestParam("loc") String loc) {
DataLog dataLog = null;
List<DataLog> allTasks = taskService.getAllTasks();
for (DataLog task : allTasks) {
if (task.isCheckOutTask()) {
if (boxStr.startsWith(task.getBarcode())) {
dataLog = task;
break;
}
}
}
if (dataLog != null) {
dataLog.setCurrentLoc(loc);
if (TaskCurrentLoc.In1_FeedingInlet.equals(loc) || TaskCurrentLoc.In2_FeedingInlet.equals(loc)) {
dataLog.setStatus(loc);
}
if (dataLog.isExecuting() || dataLog.isWait()){
taskService.updateQueueTask(dataLog);
} else {
taskService.updateFinishedTask(dataLog);
}
} else {
Barcode barcode = codeResolve.resolveOneValideBarcode(boxStr);
StoragePos storagePos = BoxHandleUtil.locOnePos(barcode);
if (storagePos != null) {
Storage storage = dataCache.getStorageById(storagePos.getStorageId());
DataLog task = new DataLog(storage, storagePos.getBarcode(), storagePos);
task.setCallEmptyBox(true);
//task.setLoc(loc);
task.setCurrentLoc(loc);
task.setType(OP.CHECKOUT);
task.setStatus(loc);
taskService.updateFinishedTask(task);
}
}
return ResultBean.newOkResult("");
}
} }
...@@ -18,6 +18,8 @@ import com.neotel.smfcore.custom.luxsan.api.enums.QueryGrStatusEnum; ...@@ -18,6 +18,8 @@ import com.neotel.smfcore.custom.luxsan.api.enums.QueryGrStatusEnum;
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.dto.QueryGrDto; import com.neotel.smfcore.custom.luxsan.factory_c.rawstor.bean.dto.QueryGrDto;
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.util.BinCacheUtil;
import com.neotel.smfcore.custom.luxsan.factory_c.rawstor.util.BoxHandleUtil;
import com.neotel.smfcore.custom.luxsan.factory_c.util.CacheNameUtil; import com.neotel.smfcore.custom.luxsan.factory_c.util.CacheNameUtil;
import com.neotel.smfcore.custom.luxsan.factory_c.util.CommonUtil; import com.neotel.smfcore.custom.luxsan.factory_c.util.CommonUtil;
import com.neotel.smfcore.security.annotation.AnonymousAccess; import com.neotel.smfcore.security.annotation.AnonymousAccess;
......
...@@ -17,6 +17,7 @@ import com.neotel.smfcore.custom.luxsan.api.bean.request.FetchMoveTicketRequest; ...@@ -17,6 +17,7 @@ import com.neotel.smfcore.custom.luxsan.api.bean.request.FetchMoveTicketRequest;
import com.neotel.smfcore.custom.luxsan.api.bean.result.FetchMoveTicketResult; import com.neotel.smfcore.custom.luxsan.api.bean.result.FetchMoveTicketResult;
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.dto.FetchMoveTicketDto; import com.neotel.smfcore.custom.luxsan.factory_c.rawstor.bean.dto.FetchMoveTicketDto;
import com.neotel.smfcore.custom.luxsan.factory_c.rawstor.enums.LiteorderCheckType;
import com.neotel.smfcore.custom.luxsan.factory_c.util.CacheNameUtil; import com.neotel.smfcore.custom.luxsan.factory_c.util.CacheNameUtil;
import com.neotel.smfcore.custom.luxsan.factory_c.util.CommonUtil; import com.neotel.smfcore.custom.luxsan.factory_c.util.CommonUtil;
import com.neotel.smfcore.security.annotation.AnonymousAccess; import com.neotel.smfcore.security.annotation.AnonymousAccess;
...@@ -51,6 +52,11 @@ public class TicketController { ...@@ -51,6 +52,11 @@ public class TicketController {
@RequestMapping("/fetchTicket") @RequestMapping("/fetchTicket")
@AnonymousAccess @AnonymousAccess
public ResultBean fetchTicket(String ticket) { public ResultBean fetchTicket(String ticket) {
if (StringUtils.isEmpty(ticket)) {
return ResultBean.newErrorResult(-1, "smfcore.valueCanotNull", "{0}不能为空", new String[]{"单据号"});
}
List<FetchMoveTicketResult> ticketList = LuxsanApi.fetchMoveTicket(new FetchMoveTicketRequest(CommonUtil.plantCode, ticket)); List<FetchMoveTicketResult> ticketList = LuxsanApi.fetchMoveTicket(new FetchMoveTicketRequest(CommonUtil.plantCode, ticket));
return ResultBean.newOkResult(FetchMoveTicketDto.convertFetchMoveTicketDto(ticketList)); return ResultBean.newOkResult(FetchMoveTicketDto.convertFetchMoveTicketDto(ticketList));
} }
...@@ -64,7 +70,7 @@ public class TicketController { ...@@ -64,7 +70,7 @@ public class TicketController {
String resultStr = liteOrderCache.hasExecutingOrder(); String resultStr = liteOrderCache.hasExecutingOrder();
if (StringUtils.isNotEmpty(resultStr)) { if (StringUtils.isNotEmpty(resultStr)) {
//throw new ValidateException("","有正在执行的工单,不允许恢复"); //throw new ValidateException("","有正在执行的工单,不允许恢复");
return ResultBean.newErrorResult(-1, "", "有正在执行的工单"+resultStr+",不允许出库"); return ResultBean.newErrorResult(-1, "", "有正在执行的工单" + resultStr + ",不允许出库");
} }
if (StringUtils.isEmpty(ticket)) { if (StringUtils.isEmpty(ticket)) {
...@@ -95,12 +101,13 @@ public class TicketController { ...@@ -95,12 +101,13 @@ public class TicketController {
} }
liteOrder.setOrderItems(itemList); liteOrder.setOrderItems(itemList);
liteOrder.setCheckType(LiteorderCheckType.TICKET_CHECKOUT);
liteOrder = liteOrderManager.createWithItems(liteOrder); liteOrder = liteOrderManager.createWithItems(liteOrder);
liteOrderCache.addOrderToMap(liteOrder); liteOrderCache.addOrderToMap(liteOrder);
} }
String result = liteOrderCache.checkOutLiteOrderOut(ticket, false, null); String result = liteOrderCache.rawTicketCheckOut(ticket, false, null);
if (StringUtils.isNotEmpty(result)){ if (StringUtils.isNotEmpty(result)) {
return ResultBean.newErrorResult(-1,"", MessageUtils.getText(result,new Locale(SecurityUtils.getCurrentUserLanguage()),result)); return ResultBean.newErrorResult(-1, "", MessageUtils.getText(result, new Locale(SecurityUtils.getCurrentUserLanguage()), result));
} }
return ResultBean.newOkResult(""); return ResultBean.newOkResult("");
} }
......
...@@ -3,4 +3,6 @@ package com.neotel.smfcore.custom.luxsan.factory_c.rawstor.enums; ...@@ -3,4 +3,6 @@ package com.neotel.smfcore.custom.luxsan.factory_c.rawstor.enums;
public class LiteorderCheckType { public class LiteorderCheckType {
public static final int PICKING_CHECKOUT = 1; public static final int PICKING_CHECKOUT = 1;
public static final int TICKET_CHECKOUT = 2;
} }
package com.neotel.smfcore.custom.luxsan.factory_c.rawstor.enums;
import lombok.Data;
@Data
public class TaskCurrentLoc {
public static final String In1_FeedingInlet = "In1_FeedingInlet";
public static final String In2_FeedingInlet = "In2_FeedingInlet";
public static final String In_FeedingInlet = "In_FeedingInlet";
public static final String Out1_FeedingInlet = "Out1_FeedingInlet";
public static final String Out2_FeedingInlet = "Out2_FeedingInlet";
public static final String Out_FeedingInlet = "Out_FeedingInlet";
public static final String In1_DischargeHole = "In1_DischargeHole";
public static final String In2_DischargeHole = "In2_DischargeHole";
public static final String Out1_DischargeHole = "Out1_DischargeHole";
public static final String Out2_DischargeHole = "Out2_DischargeHole";
//人工工位入料口
public static final String Manual_FeedingInlet = "Manual_FeedingInlet";
//人工工位出料口
public static final String Manual_DischargeHole = "Manual_DischargeHole";
}
package com.neotel.smfcore.custom.luxsan.factory_c.rawstor.util; package com.neotel.smfcore.custom.luxsan.factory_c.rawstor.util;
import com.alibaba.fastjson.JSON;
import com.neotel.smfcore.common.utils.DateUtil;
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.core.storage.service.po.StoragePos;
import com.neotel.smfcore.core.system.service.po.DataLog;
import com.neotel.smfcore.core.system.util.TaskService;
import com.neotel.smfcore.custom.lizhen.agvBox.util.BoxUtil;
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.QueryBinRequest; import com.neotel.smfcore.custom.luxsan.api.bean.request.QueryBinRequest;
import com.neotel.smfcore.custom.luxsan.api.bean.request.UpdateBinRequest; import com.neotel.smfcore.custom.luxsan.api.bean.request.UpdateBinRequest;
import com.neotel.smfcore.custom.luxsan.api.bean.result.QueryBinResult; import com.neotel.smfcore.custom.luxsan.api.bean.result.QueryBinResult;
import com.neotel.smfcore.custom.luxsan.api.enums.BinEnum; import com.neotel.smfcore.custom.luxsan.api.enums.BinEnum;
import com.neotel.smfcore.custom.luxsan.factory_c.rawstor.bean.dto.ValidBin;
import com.neotel.smfcore.custom.luxsan.factory_c.rawstor.enums.TaskCurrentLoc;
import com.neotel.smfcore.custom.luxsan.factory_c.util.CacheNameUtil; import com.neotel.smfcore.custom.luxsan.factory_c.util.CacheNameUtil;
import com.neotel.smfcore.custom.luxsan.factory_c.util.CommonUtil; import com.neotel.smfcore.custom.luxsan.factory_c.util.CommonUtil;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.HashMap; import java.util.*;
import java.util.List;
import java.util.Map;
@Slf4j
@Service @Service
public class BinCacheUtil { public class BinCacheUtil {
private static DataCache dataCache; private static CodeResolve codeResolve;
private static long binCodeUpdateTime = 0L;
@Autowired @Autowired
private void setDataCache(DataCache cache){ public void setCodeResolve(CodeResolve resolve) {
BinCacheUtil.dataCache = cache; BinCacheUtil.codeResolve = resolve;
} }
public static boolean canPutInBinCode(String binCode, String warehouseCode) { private static TaskService taskService;
Map<String, String> cacheMap = new HashMap<>();
if (binCodeUpdateTime == 0L || (System.currentTimeMillis() - binCodeUpdateTime >= 1000 * 60 * 60)) {
List<QueryBinResult> resultList = LuxsanApi.queryBin(new QueryBinRequest(CommonUtil.plantCode, BinEnum.STORAGE_TYPE_C, BinEnum.BIN_STATUS_0, warehouseCode));
for (QueryBinResult result : resultList) {
cacheMap.put(result.getBIN_CODE(), result.getWAREHOUSE_CODE());
}
List<QueryBinResult> useBinResultList = LuxsanApi.queryBin(new QueryBinRequest(CommonUtil.plantCode, BinEnum.STORAGE_TYPE_C, BinEnum.BIN_STATUS_1, warehouseCode)); @Autowired
for (QueryBinResult result : useBinResultList) { public void setTaskService(TaskService service) {
cacheMap.put(result.getBIN_CODE(), result.getWAREHOUSE_CODE()); BinCacheUtil.taskService = service;
} }
binCodeUpdateTime = System.currentTimeMillis();
dataCache.updateCache(CacheNameUtil.CHCHE_QUERY_BIN, cacheMap); public static boolean canPutInBinCode(String binCode, String warehouseCode) {
} else {
cacheMap = dataCache.getCache(CacheNameUtil.CHCHE_QUERY_BIN);
}
Map<String, String> cacheMap = binCodeCacheMap(warehouseCode);
//判断code是否相同 //判断code是否相同
String code = cacheMap.get(binCode); String code = cacheMap.get(binCode);
if (StringUtils.isNotEmpty(code)) { if (StringUtils.isNotEmpty(code)) {
...@@ -64,5 +65,352 @@ public class BinCacheUtil { ...@@ -64,5 +65,352 @@ public class BinCacheUtil {
} }
public static List<String> getBoxList(String wareHouseCode) {
List<String> boxList = new ArrayList<>();
Map<String, String> cacheMap = binCodeCacheMap(wareHouseCode);
for (String bincode : cacheMap.keySet()) {
String cacheWH = cacheMap.get(bincode);
if (StringUtils.isNotEmpty(cacheWH) && cacheWH.equals(wareHouseCode)) {
String boxStr = BoxHandleUtil.getBoxStr(bincode, false);
if (!boxList.contains(boxStr)) {
boxList.add(boxStr);
}
}
}
return boxList;
}
public static Map<String, String> binCodeCacheMap(String warehouseCode) {
Map<String, String> cacheMap = new HashMap<>();
List<QueryBinResult> resultList = LuxsanApi.queryBin(new QueryBinRequest(CommonUtil.plantCode, BinEnum.STORAGE_TYPE_C, BinEnum.BIN_STATUS_0, warehouseCode));
for (QueryBinResult result : resultList) {
cacheMap.put(result.getBIN_CODE(), result.getWAREHOUSE_CODE());
}
List<QueryBinResult> useBinResultList = LuxsanApi.queryBin(new QueryBinRequest(CommonUtil.plantCode, BinEnum.STORAGE_TYPE_C, BinEnum.BIN_STATUS_1, warehouseCode));
for (QueryBinResult result : useBinResultList) {
cacheMap.put(result.getBIN_CODE(), result.getWAREHOUSE_CODE());
}
return cacheMap;
}
public static ValidBin validBin(Barcode stackerBarcode, String source, String binListStr) {
String boxCode = "";
String boxLoc = "";
String stackerLoc = "";
List<String> validBinList = new ArrayList<>();
//获取料串尺寸
String barcode = stackerBarcode.getBarcode();
String materialSize = MaterialUtil.getMaterialSize(barcode);
log.info("收到料串信息为:" + barcode + "尺寸为:" + materialSize);
//判断当前工作的料箱能不能放入
if (StringUtils.isNotEmpty(binListStr)) {
log.info("正在工作的料格为:" + binListStr);
String[] binStr = binListStr.split(",");
List<String> binCodeList = getValidBinList(stackerBarcode, Arrays.asList(binStr));
if (binCodeList != null && !binCodeList.isEmpty()) {
for (String binCode : binCodeList) {
if ("7".equals(materialSize)) {
if (binCode.startsWith("C07")) {
validBinList.add(binCode);
} else {
if (binCode.endsWith("02") || binCode.endsWith("03")) {
validBinList.add(binCode);
}
}
} else {
if (binCode.startsWith("C13") || binCode.startsWith("C15")) {
if (binCode.endsWith("01")) {
validBinList.add(binCode);
}
}
}
}
}
//如果不为空,返回
if (validBinList != null && !validBinList.isEmpty()) {
log.info("获取到可用料格为:" + JSON.toJSONString(validBinList));
String resultStr = validBinList.get(0);
boxCode = BoxHandleUtil.getBoxStr(resultStr, false);
boxLoc = source;
stackerLoc = source;
return new ValidBin(boxCode, boxLoc, stackerLoc, validBinList);
}
}
//如果呼叫的空箱没有可用的,查找出库任务,在流水线上的
if (validBinList == null || validBinList.isEmpty()) {
log.info("未找到当前工作的料格,开始寻找正在当前工位上的料箱");
List<String> emptyBoxList = new ArrayList<>();
List<DataLog> allTasks = taskService.getAllTasks();
for (DataLog dataLog : allTasks) {
if (dataLog.isCheckOutTask() && !dataLog.isCancel()) {
if (source.equals(dataLog.getCurrentLoc())) {
log.info("找到当前工位上的料箱为:" + dataLog.getBarcode() + ",位置为:" + dataLog.getCurrentLoc());
emptyBoxList.add(dataLog.getBarcode());
}
}
}
if (emptyBoxList != null && !emptyBoxList.isEmpty()) {
for (String boxStr : emptyBoxList) {
List<String> binList = new ArrayList<>();
int par = boxStr.startsWith("C07") ? 6 : 3;
for (int i = 1; i <= par; i++) {
binList.add(boxStr + "-0" + i);
}
List<String> binCodeList = getValidBinList(stackerBarcode, binList);
if (binCodeList != null && !binCodeList.isEmpty()) {
for (String binCode : binCodeList) {
if ("7".equals(materialSize)) {
if (binCode.startsWith("C07")) {
validBinList.add(binCode);
} else {
if (binCode.endsWith("02") || binCode.endsWith("03")) {
validBinList.add(binCode);
}
}
} else {
if (binCode.startsWith("C13") || binCode.startsWith("C15")) {
if (binCode.endsWith("01")) {
validBinList.add(binCode);
}
}
}
}
//如果不为空,返回
if (validBinList != null && !validBinList.isEmpty()) {
log.info("获取到可用料格为:" + JSON.toJSONString(validBinList));
String resultStr = validBinList.get(0);
boxCode = BoxHandleUtil.getBoxStr(resultStr, false);
boxLoc = source;
stackerLoc = source;
return new ValidBin(boxCode, boxLoc, stackerLoc, validBinList);
}
}
}
}
}
//如果不可以放入,则判断当前呼叫空箱物料是否可以放入
if (validBinList == null || validBinList.isEmpty()) {
log.info("未找到当前工位上的料箱,开始寻找呼叫空箱");
List<String> callEmptyBoxList = new ArrayList<>();
List<DataLog> allTasks = taskService.getAllTasks();
for (DataLog dataLog : allTasks) {
if (dataLog.isCheckOutTask() && !dataLog.isCancel()) {
if (dataLog.isCallEmptyBox() && !TaskCurrentLoc.In1_FeedingInlet.equals(dataLog.getCurrentLoc()) && !TaskCurrentLoc.In2_FeedingInlet.equals(dataLog.getCurrentLoc())) {
log.info("查找出来呼叫空箱的箱子为:" + dataLog.getBarcode());
callEmptyBoxList.add(dataLog.getBarcode());
}
}
}
if (callEmptyBoxList != null && !callEmptyBoxList.isEmpty()) {
for (String boxStr : callEmptyBoxList) {
List<String> binList = new ArrayList<>();
int par = boxStr.startsWith("C07") ? 6 : 3;
for (int i = 1; i <= par; i++) {
binList.add(boxStr + "-0" + i);
}
List<String> binCodeList = getValidBinList(stackerBarcode, binList);
if (binCodeList != null && !binCodeList.isEmpty()) {
for (String binCode : binCodeList) {
if ("7".equals(materialSize)) {
if (binCode.startsWith("C07")) {
validBinList.add(binCode);
} else {
if (binCode.endsWith("02") || binCode.endsWith("03")) {
validBinList.add(binCode);
}
}
} else {
if (binCode.startsWith("C13") || binCode.startsWith("C15")) {
if (binCode.endsWith("01")) {
validBinList.add(binCode);
}
}
}
}
}
//如果不为空,返回
if (validBinList != null && !validBinList.isEmpty()) {
List<DataLog> taskList = taskService.getAllTasks();
for (DataLog dataLog : taskList) {
if (dataLog.getBarcode().equals(boxStr) && dataLog.isCheckOutTask() && !dataLog.isCancel()) {
log.info("获取到可用料格为:" + JSON.toJSONString(validBinList));
String loc = "";
if (StringUtils.isEmpty(dataLog.getLoc())) {
loc = source;
} else {
if (TaskCurrentLoc.In_FeedingInlet.equals(dataLog.getLoc())) {
loc = source;
} else {
if (!TaskCurrentLoc.In1_FeedingInlet.equals(dataLog.getLoc()) && !TaskCurrentLoc.In2_FeedingInlet.equals(dataLog.getLoc())) {
loc = source;
} else {
loc = dataLog.getLoc();
}
}
}
dataLog.setLoc(loc);
if (dataLog.isExecuting() || dataLog.isWait()) {
taskService.updateQueueTask(dataLog);
} else {
taskService.updateFinishedTask(dataLog);
}
boxCode = boxStr;
boxLoc = loc;
stackerLoc = loc;
return new ValidBin(boxCode, boxLoc, stackerLoc, validBinList);
}
}
}
}
}
}
if (validBinList == null || validBinList.isEmpty()) {
log.info("都未找到,开始寻找空箱");
String outLet = "0";
if (TaskCurrentLoc.In2_FeedingInlet.equals(source)) {
outLet = "2";
} else if (TaskCurrentLoc.In1_FeedingInlet.equals(source)) {
outLet = "1";
}
StoragePos storagePos = BoxHandleUtil.callEmptyBox(materialSize, outLet, stackerBarcode.getWarehouseCode());
if (storagePos != null) {
Barcode posBarcode = storagePos.getBarcode();
String boxStr = posBarcode.getBarcode();
List<String> binList = new ArrayList<>();
int par = boxStr.startsWith("C07") ? 6 : 3;
for (int i = 1; i <= par; i++) {
binList.add(boxStr + "-0" + i);
}
List<String> binCodeList = getValidBinList(stackerBarcode, binList);
if (binCodeList != null && !binCodeList.isEmpty()) {
log.info("寻找到空箱为:" + boxStr);
for (String binCode : binCodeList) {
if ("7".equals(materialSize)) {
if (binCode.startsWith("C07")) {
validBinList.add(binCode);
} else {
if (binCode.endsWith("02") || binCode.endsWith("03")) {
validBinList.add(binCode);
}
}
} else {
if (binCode.startsWith("C13") || binCode.startsWith("C15")) {
if (binCode.endsWith("01")) {
validBinList.add(binCode);
}
}
}
}
}
//如果不为空,返回
if (validBinList != null && !validBinList.isEmpty()) {
boxCode = boxStr;
boxLoc = source;
stackerLoc = source;
return new ValidBin(boxCode, boxLoc, stackerLoc, validBinList);
}
}
}
return null;
}
private static List<String> getValidBinList(Barcode stackerBarcode, List<String> binList) {
List<String> validBinList = new ArrayList<>();
for (String binId : binList) {
String boxStr = BoxHandleUtil.getBoxStr(binId, true);
Barcode boxBarcode = codeResolve.resolveOneValideBarcode(boxStr);
//为料箱分配一个库位,直接放到库位中, 如果没有库位, 那么这个料箱不允许使用
StoragePos pos = BoxHandleUtil.locOnePos(boxBarcode);
if (pos != null) {
String canPutIn = BinCacheUtil.canMaterialPutInBin(stackerBarcode, boxBarcode, binId);
if (canPutIn.isEmpty()) {
validBinList.add(binId);
} else {
log.info(canPutIn);
}
}
}
return validBinList;
}
/**
* 验证物料是否可以放入料格:
* 1 料格未满 2 料格中若有物料,必须料号,供应商,库别,过账日期一致才可放入
*
* @return
*/
public static String canMaterialPutInBin(Barcode reelBarcode, Barcode boxBarcode, String binId) {
String isBinFull = boxBarcode.getExtraData(binId);
if (isBinFull != null) {
//该料格已放满, 不可以再放料
log.info("料格[" + binId + "]已满,不可放入物料[" + reelBarcode.getBarcode() + "]");
return "料格[" + binId + "]已满,不可放入物料[" + reelBarcode.getBarcode() + "]";
}
if (!BinCacheUtil.canPutInBinCode(binId, reelBarcode.getWarehouseCode())) {
return "库别[" + reelBarcode.getWarehouseCode() + "]不可放入料格[" + binId + "]";
}
List<Barcode> subCodeList = boxBarcode.getSubCodeList();
if (subCodeList != null) {
for (Barcode barcode : subCodeList) {
if (barcode.getPosName().equals(binId)) {
//因为bin中的物料都是一样的料号,供应商,库别,过账日期,所以只需要找到Bin中的第一个物料进行比对就可以了
if (!barcode.getPartNumber().equals(reelBarcode.getPartNumber())) {
return "料格中[" + binId + "]物料的料号[" + barcode.getPartNumber() + "]与[" + reelBarcode.getBarcode() + "]的料号[" + reelBarcode.getPartNumber() + "]不一致";
}
if (!barcode.getProvider().equals(reelBarcode.getProvider())) {
return "料格中[" + binId + "]物料的供应商[" + barcode.getProvider() + "]与[" + reelBarcode.getBarcode() + "]的供应商[" + reelBarcode.getProvider() + "]不一致";
}
if (!barcode.getWarehouseCode().equals(reelBarcode.getWarehouseCode())) {
return "料格中[" + binId + "]物料的库别[" + barcode.getWarehouseCode() + "]与[" + reelBarcode.getBarcode() + "]的库别[" + reelBarcode.getWarehouseCode() + "]不一致";
}
if (!barcode.getProduceDate().equals(reelBarcode.getProduceDate())) {
return "料格中[" + binId + "]物料的供应商[" + barcode.getProvider() + "]与[" + reelBarcode.getBarcode() + "]的供应商[" + reelBarcode.getPartNumber() + "]不一致";
}
}
}
}
return "";
}
} }
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.ReelLockPosInfo;
import com.neotel.smfcore.common.utils.QueryHelp; import com.neotel.smfcore.common.utils.QueryHelp;
import com.neotel.smfcore.common.utils.ReelLockPosUtil;
import com.neotel.smfcore.common.utils.SecurityUtils; 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.barcode.enums.BARCODE_STATUS; import com.neotel.smfcore.core.barcode.enums.BARCODE_STATUS;
...@@ -22,10 +24,7 @@ import org.springframework.data.mongodb.core.query.Criteria; ...@@ -22,10 +24,7 @@ import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query; import org.springframework.data.mongodb.core.query.Query;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.Collection; import java.util.*;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -134,12 +133,12 @@ public class BoxHandleUtil { ...@@ -134,12 +133,12 @@ public class BoxHandleUtil {
//storagePos.setUsed(false); //storagePos.setUsed(false);
storagePosManager.save(storagePos); storagePosManager.save(storagePos);
log.info("出库完成,清空仓位: " + storagePos.getId() + "[" + storagePos.getPosName() + "]"); log.info(opTask.getBarcode() + "出库完成,清空仓位: " + storagePos.getId() + "[" + storagePos.getPosName() + "]");
taskService.moveTaskToFinished(opTask); taskService.moveTaskToFinished(opTask);
} }
public static String callEmptyBox(String size,String outLet) { public static StoragePos callEmptyBox(String size,String outLet,String wareHouseCode) {
String box = ""; String box = "";
if ("7".equals(size)) { if ("7".equals(size)) {
box = "C07"; box = "C07";
...@@ -149,6 +148,14 @@ public class BoxHandleUtil { ...@@ -149,6 +148,14 @@ public class BoxHandleUtil {
box = "C15"; box = "C15";
} }
//判断有没有可用的料箱
List<String> boxList = BinCacheUtil.getBoxList(wareHouseCode);
if (boxList == null || boxList.isEmpty()){
log.info(wareHouseCode+"未找到可用料箱");
return null;
}
//排除掉正在使用的仓位 //排除掉正在使用的仓位
Criteria c = Criteria.where("barcode").exists(true).and("enabled").is(true);//可用 Criteria c = Criteria.where("barcode").exists(true).and("enabled").is(true);//可用
Collection<String> excludePosIds = taskService.excludePosIds(); Collection<String> excludePosIds = taskService.excludePosIds();
...@@ -157,6 +164,7 @@ public class BoxHandleUtil { ...@@ -157,6 +164,7 @@ public class BoxHandleUtil {
} }
c.and("barcode.partNumber").regex(Pattern.compile(QueryHelp.escapeExprSpecialWord(box), Pattern.CASE_INSENSITIVE)); c.and("barcode.partNumber").regex(Pattern.compile(QueryHelp.escapeExprSpecialWord(box), Pattern.CASE_INSENSITIVE));
c.and("barcode.status").is(BARCODE_STATUS.IN_STORE); c.and("barcode.status").is(BARCODE_STATUS.IN_STORE);
c.and("barcode.barcode").in(boxList);
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;
...@@ -212,10 +220,10 @@ public class BoxHandleUtil { ...@@ -212,10 +220,10 @@ public class BoxHandleUtil {
} }
} }
generateTask(storage, storagePos.getBarcode(), storagePos, OP.CHECKOUT, OP_STATUS.WAIT.name(), toLoc, ExtendType.STORAGE_CHECKOUT); generateTask(storage, storagePos.getBarcode(), storagePos, OP.CHECKOUT, OP_STATUS.WAIT.name(), toLoc, ExtendType.STORAGE_CHECKOUT);
return storagePos.getPosName(); return storagePos;
} }
return ""; return null;
} }
...@@ -228,6 +236,7 @@ public class BoxHandleUtil { ...@@ -228,6 +236,7 @@ public class BoxHandleUtil {
task.setOperator(SecurityUtils.getLoginUsername()); task.setOperator(SecurityUtils.getLoginUsername());
task.setBoxPosName(pos.getPosName()); task.setBoxPosName(pos.getPosName());
task.setExtendType(extendType); task.setExtendType(extendType);
task.setCallEmptyBox(true);
if (barcode.getPutInTime() != -1) { if (barcode.getPutInTime() != -1) {
task.setFristPutInDate(new Date(barcode.getPutInTime())); task.setFristPutInDate(new Date(barcode.getPutInTime()));
} else { } else {
...@@ -239,14 +248,18 @@ public class BoxHandleUtil { ...@@ -239,14 +248,18 @@ public class BoxHandleUtil {
} }
public static String getBoxStr(String code) { public static String getBoxStr(String code,boolean suffix) {
if (code.endsWith("A") || code.endsWith("B")) { if (code.endsWith("A") || code.endsWith("B")) {
code = code.substring(0, code.length() - 1); code = code.substring(0, code.length() - 1);
code = code + "A"; if (suffix) {
code = code + "A";
}
} }
if (code.contains("-")) { if (code.contains("-")) {
code = code.substring(0, code.indexOf("-")); code = code.substring(0, code.indexOf("-"));
code = code + "A"; if (suffix) {
code = code + "A";
}
} }
return code; return code;
} }
...@@ -272,4 +285,45 @@ public class BoxHandleUtil { ...@@ -272,4 +285,45 @@ public class BoxHandleUtil {
} }
return seq; return seq;
} }
public static StoragePos locOnePos(Barcode boxBarcode){
//判断信息是否在已经在库位中(出入库只改变料箱位置状态,不从StoragePos表中清除)
StoragePos pos = storagePosManager.getByBarcode(boxBarcode.getBarcode());
if (pos != null){
return pos;
}
List<String> cidList = new ArrayList<>();
List<Storage> storageList = new ArrayList<>();
for (Storage storage : dataCache.getAllStorage().values()) {
storageList.add(storage);
cidList.add(storage.getCid());
}
pos = taskService.findEmptyPosForPutIn(storageList, boxBarcode, "", "");
if (pos == null) {
log.info(boxBarcode.getBarcode() + "未找到可用库位");
return null;
}else{
log.info("料箱["+boxBarcode.getBarcode()+"]信息加入库位["+pos.getPosName()+"]中");
pos.setBarcode(boxBarcode);
pos.setUsed(true);
storagePosManager.save(pos);
//3.锁定库位
Storage storage = dataCache.getStorageById(pos.getStorageId());
ReelLockPosInfo reelLocInfo = new ReelLockPosInfo();
reelLocInfo.setBarcode(boxBarcode.getBarcode());
reelLocInfo.setCid(storage.getCid());
reelLocInfo.setLockPosName(pos.getPosName());
reelLocInfo.setLockPosId(pos.getId());
reelLocInfo = ReelLockPosUtil.addReelLockPosInfo(reelLocInfo, cidList);
if (reelLocInfo == null) {
log.info("[" + boxBarcode.getBarcode() + "]库位锁定失败,暂停入库");
return null;
}
}
return pos;
}
} }
...@@ -128,4 +128,14 @@ public class MaterialUtil { ...@@ -128,4 +128,14 @@ public class MaterialUtil {
} }
return null; return null;
} }
public static String getMaterialSize(String materialStr) {
String size = "7";
if (materialStr.startsWith("B13")) {
size = "13";
} else if (materialStr.startsWith("B15")) {
size = "15";
}
return size;
}
} }
...@@ -16,15 +16,7 @@ public class CacheNameUtil { ...@@ -16,15 +16,7 @@ public class CacheNameUtil {
public static final String CHCHE_MANUALWORK_PUTIN = "CHCHE_MANUALWORK_PUTIN"; public static final String CHCHE_MANUALWORK_PUTIN = "CHCHE_MANUALWORK_PUTIN";
public static final String CHCHE_EXECUTINGPUTIN_BOX = "CHCHE_EXECUTINGPUTIN_BOX";
public static final String CHCHE_SHIPCANCELUPSHELF = "CHCHE_SHIPCANCELUPSHELF"; public static final String CHCHE_SHIPCANCELUPSHELF = "CHCHE_SHIPCANCELUPSHELF";
public static final String CHCHE_RESTOREREPLACE = "CHCHE_RESTOREREPLACE"; public static final String CHCHE_RESTOREREPLACE = "CHCHE_RESTOREREPLACE";
//CTU使用信息
public static final String CHCHE_CTUUSEINFO = "CHCHE_CTUUSEINFO";
//入料机构缓存
public static final String CHCHE_MATERIAL_PUTIN_CACHE = "CHCHE_MATERIAL_PUTIN_CACHE";
} }
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!