Commit 4a9931d8 zshaohui

1.增加库存处理功能

2.禁用料增加model和picking参数
3.人工线入库的时候,如果有入库任务直接改成最新的
4.
1 个父辈 88645bb2
正在显示 18 个修改的文件 包含 373 行增加91 行删除
...@@ -201,9 +201,9 @@ public class DataInitManager { ...@@ -201,9 +201,9 @@ public class DataInitManager {
// 退货上架 // 退货上架
addNewFunctionMenu(8, raw, "returnInventoryAndPutShelves", "退货上架", "returnInventoryAndPutShelves", "returnInventoryAndPutShelves/index", "returnInPut", functionMenuMap); addNewFunctionMenu(8, raw, "returnInventoryAndPutShelves", "退货上架", "returnInventoryAndPutShelves", "returnInventoryAndPutShelves/index", "returnInPut", functionMenuMap);
addNewFunctionMenu(9, raw, "materialShortage", "3F缺料", "materialShortage", "materialShortage/index", "materialNull", functionMenuMap); addNewFunctionMenu(9, raw, "materialShortage", "3F缺料", "materialShortage", "materialShortage/index", "materialNull", functionMenuMap);
addNewFunctionMenu(10, raw, "inventoryHandle", "库存处理", "inventoryHandle", "inventoryHandle/index", "inventoryHandle", functionMenuMap);
Menu manual = Menu.CreatePMenu("手动出入库", 5, "manual", 2, "manual", raw); Menu manual = Menu.CreatePMenu("手动出入库", 5, "manual", 2, "manual", raw);
......
...@@ -2,6 +2,7 @@ package com.neotel.smfcore.core.device.util; ...@@ -2,6 +2,7 @@ package com.neotel.smfcore.core.device.util;
import com.google.common.base.Strings; import com.google.common.base.Strings;
import com.neotel.smfcore.common.exception.ValidateException; import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.common.utils.StringUtils;
import com.neotel.smfcore.core.equipment.service.manager.IEquipmentManager; import com.neotel.smfcore.core.equipment.service.manager.IEquipmentManager;
import com.neotel.smfcore.core.equipment.service.po.Equipment; import com.neotel.smfcore.core.equipment.service.po.Equipment;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -31,7 +32,9 @@ public class EquipmentCache { ...@@ -31,7 +32,9 @@ public class EquipmentCache {
if(all != null){ if(all != null){
Map<String, Equipment> map = new ConcurrentHashMap<>(); Map<String, Equipment> map = new ConcurrentHashMap<>();
for(Equipment equipment : all){ for(Equipment equipment : all){
map.put(equipment.getCid(), equipment); if (StringUtils.isNotEmpty(equipment.getCid())) {
map.put(equipment.getCid(), equipment);
}
} }
allEquipment = map; allEquipment = map;
log.info("加载所有料仓["+all.size()+"]信息到缓存"); log.info("加载所有料仓["+all.size()+"]信息到缓存");
......
...@@ -39,32 +39,7 @@ public class BaseEquipHandler implements IEquipmentHandler { ...@@ -39,32 +39,7 @@ public class BaseEquipHandler implements IEquipmentHandler {
DeviceMessageUtil.addOnlineMessage(statusBean.getCid(), "", statusBean.getClientIp()); DeviceMessageUtil.addOnlineMessage(statusBean.getCid(), "", statusBean.getClientIp());
// EquipStatusUtil.updateClientMsg(statusBean.getCid(), "", "", "", null); // EquipStatusUtil.updateClientMsg(statusBean.getCid(), "", "", "", null);
} }
//记录提示信息
if (statusBean.getMsgList() != null) {
for (EquipMsg msg :
statusBean.getMsgList()) {
//判断是否有内容
//判断消息是否有内容
if (ObjectUtil.isNotEmpty(msg.getMsg()) || ObjectUtil.isNotEmpty(msg.getMsgCode())) {
boolean newMsg = true;
//和上个消息是否一样
if (preBean != null) {
EquipMsg preMsg = preBean.getMsgByType(msg.getType());
if (preMsg != null) {
if (msg.getMsgCode().equals(preMsg.getMsgCode()) && msg.getMsg().equals(preMsg.getMsg())) {
newMsg = false;
}
}
}
if (newMsg) {
DeviceMessageUtil.addDeviceMessage(statusBean.getCid(), msg.getType(), msg.getModule(), msg.getMsgCode(), msg.getMsg(), msg.getMsgParams(),"");
}
}
}
}
EquipStatusUtil.updateStatusBean(statusBean); EquipStatusUtil.updateStatusBean(statusBean);
} catch (Exception e) { } catch (Exception e) {
log.error("客户端故障消息处理出错", e); log.error("客户端故障消息处理出错", e);
} }
......
...@@ -19,6 +19,7 @@ import com.neotel.smfcore.custom.luxsan.api.bean.util.LuxsanApiResult; ...@@ -19,6 +19,7 @@ import com.neotel.smfcore.custom.luxsan.api.bean.util.LuxsanApiResult;
import com.neotel.smfcore.custom.luxsan.api.enums.LuxsanApiEnum; import com.neotel.smfcore.custom.luxsan.api.enums.LuxsanApiEnum;
import com.neotel.smfcore.custom.luxsan.common.constants.BusinessConst; import com.neotel.smfcore.custom.luxsan.common.constants.BusinessConst;
import com.neotel.smfcore.custom.luxsan.common.util.RequestURLUtil; import com.neotel.smfcore.custom.luxsan.common.util.RequestURLUtil;
import com.neotel.smfcore.custom.luxsan.factory_c.common.util.CommonUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
...@@ -905,6 +906,8 @@ public class LuxsanApi extends DefaultSmfApiListener { ...@@ -905,6 +906,8 @@ public class LuxsanApi extends DefaultSmfApiListener {
paramMap.put("datecode", barcode.getDateCode()); paramMap.put("datecode", barcode.getDateCode());
paramMap.put("lot", barcode.getBatch()); paramMap.put("lot", barcode.getBatch());
paramMap.put("vendor", barcode.getProvider()); paramMap.put("vendor", barcode.getProvider());
paramMap.put("werks", CommonUtil.plantCode);
paramMap.put("model","ALL");
String param = JsonUtil.toJsonStr(paramMap); String param = JsonUtil.toJsonStr(paramMap);
log.info("禁用料接口wmsCheckReelfob入参为:" + param); log.info("禁用料接口wmsCheckReelfob入参为:" + param);
try { try {
......
...@@ -32,4 +32,7 @@ public class CacheNameUtil { ...@@ -32,4 +32,7 @@ public class CacheNameUtil {
//入料机构料串信息 //入料机构料串信息
public static final String CHCHE_RAWIN_LINE_MATERIAL_DESTINATION = "CHCHE_RAWIN_LINE_MATERIAL_DESTINATION"; public static final String CHCHE_RAWIN_LINE_MATERIAL_DESTINATION = "CHCHE_RAWIN_LINE_MATERIAL_DESTINATION";
//出库流水线缓存料箱信息
public static final String CACHE_RAWOUT_BOX = "CACHE_RAWOUT_BOX";
} }
...@@ -131,6 +131,11 @@ public class CDeviceController { ...@@ -131,6 +131,11 @@ public class CDeviceController {
resultMap.put("w", returnTower.getW()); resultMap.put("w", returnTower.getW());
resultMap.put("h", returnTower.getH()); resultMap.put("h", returnTower.getH());
} }
if (resultMap == null || resultMap.isEmpty()){
return ResultBean.newErrorResult(-1,"",codeStr+"未绑定任何信息,请确认");
}
return ResultBean.newOkResult(resultMap); return ResultBean.newOkResult(resultMap);
} }
...@@ -565,7 +570,7 @@ public class CDeviceController { ...@@ -565,7 +570,7 @@ public class CDeviceController {
//4.开始生成出库任务 //4.开始生成出库任务
log.info(barcode.getBarcode() + "从" + boxStr + "出库,序列号为:" + seq); log.info(barcode.getBarcode() + "从" + boxStr + "出库,序列号为:" + seq+".位置为:"+currentLoc);
if (!barcode.isOut()){ if (!barcode.isOut()){
return ResultBean.newErrorResult(-1,"",barcode.getPosName()+"没有要出库的料盘"); return ResultBean.newErrorResult(-1,"",barcode.getPosName()+"没有要出库的料盘");
...@@ -1081,6 +1086,16 @@ public class CDeviceController { ...@@ -1081,6 +1086,16 @@ public class CDeviceController {
} }
@ApiOperation("入料机构清空料串缓存")
@RequestMapping("/clearInLineStacker")
@AnonymousAccess
public ResultBean clearInLineStacker(String materialStr) {
log.info("入料机构清空料串缓存:" + materialStr);
RawInLineUtil.clearInLineStacker(materialStr);
return ResultBean.newOkResult("");
}
private void generatePutInTask(Barcode barcode, Barcode boxBarcode,String status,String currentLoc) { private void generatePutInTask(Barcode barcode, Barcode boxBarcode,String status,String currentLoc) {
DataLog dataLog = new DataLog(); DataLog dataLog = new DataLog();
......
...@@ -20,6 +20,7 @@ import com.neotel.smfcore.custom.luxsan.factory_c.rawstor.bean.dto.CtuTask; ...@@ -20,6 +20,7 @@ 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.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.RawOutUtil;
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;
...@@ -219,6 +220,11 @@ public class CtuDeviceController { ...@@ -219,6 +220,11 @@ public class CtuDeviceController {
return ResultBean.newErrorResult(-1, "smfcore.taskStatusHasUpdate", "任务{0}已经修改状态", new String[]{task.getBarcode()}); return ResultBean.newErrorResult(-1, "smfcore.taskStatusHasUpdate", "任务{0}已经修改状态", new String[]{task.getBarcode()});
} }
//入库,在AGV上,清空出料机构缓存
if (OP_STATUS.IN_ON_AGV.name().equals(statusStr)) {
RawOutUtil.removeRawOutBox(boxStr);
}
//3.判断是出库,还是入库任务 //3.判断是出库,还是入库任务
if (task.isPutInTask()) { if (task.isPutInTask()) {
task.setStatus(statusStr); task.setStatus(statusStr);
...@@ -331,6 +337,16 @@ public class CtuDeviceController { ...@@ -331,6 +337,16 @@ public class CtuDeviceController {
taskService.updateFinishedTask(task); taskService.updateFinishedTask(task);
} }
} }
if (TaskCurrentLoc.Out1_FeedingInlet.equals(loc)
|| TaskCurrentLoc.Out2_FeedingInlet.equals(loc)
|| TaskCurrentLoc.Out3_FeedingInlet.equals(loc)
|| TaskCurrentLoc.Out4_FeedingInlet.equals(loc)
|| TaskCurrentLoc.Out5_FeedingInlet.equals(loc)
|| TaskCurrentLoc.Out6_FeedingInlet.equals(loc)){
RawOutUtil.updateRawOutBox(boxStr,loc);
}
return ResultBean.newOkResult(""); return ResultBean.newOkResult("");
} }
...@@ -536,4 +552,46 @@ public class CtuDeviceController { ...@@ -536,4 +552,46 @@ public class CtuDeviceController {
return ResultBean.newOkResult(resultList); return ResultBean.newOkResult(resultList);
} }
@ApiOperation("获取出料机构缓存信息")
@RequestMapping("/getRawOutBoxInfo")
@AnonymousAccess
public ResultBean getRawOutBoxInfo(String loc) {
Map<String, String> rawOutBox = RawOutUtil.getRawOutBox(loc);
if (rawOutBox == null || rawOutBox.isEmpty()) {
return ResultBean.newErrorResult(-1, "", loc + "当前位置没有料箱信息");
}
List<Map<String, Object>> resultList = new ArrayList<>();
for (Map.Entry<String, String> entry : rawOutBox.entrySet()) {
String boxStr = entry.getKey();
String currentLoc = entry.getValue();
Map<String, Object> resultMap = new HashMap<>();
Map<String, Long> outMap = new HashMap<>();
Barcode barcode = codeResolve.resolveOneValideBarcode(boxStr);
List<Barcode> subCodeList = barcode.getSubCodeList();
if (subCodeList != null && !subCodeList.isEmpty()) {
outMap = subCodeList.stream().filter(Barcode::isOut).collect(Collectors.groupingBy(Barcode::getPosName, Collectors.counting()));
}
//1是入库,2是出库
int type = 1;
if (outMap != null && !outMap.isEmpty()) {
for (Long value : outMap.values()) {
if (value > 0) {
type = 2;
}
}
}
resultMap.put("boxStr", boxStr);
resultMap.put("loc", currentLoc);
resultMap.put("type", type);
resultMap.put("outMap", outMap);
}
return ResultBean.newOkResult(resultList);
}
} }
package com.neotel.smfcore.custom.luxsan.factory_c.rawstor.controller;
import com.neotel.smfcore.common.bean.ResultBean;
import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.common.utils.SecurityUtils;
import com.neotel.smfcore.common.utils.StringUtils;
import com.neotel.smfcore.core.barcode.service.manager.IBarcodeManager;
import com.neotel.smfcore.core.barcode.service.po.Barcode;
import com.neotel.smfcore.core.barcode.utils.CodeResolve;
import com.neotel.smfcore.core.storage.service.manager.IStoragePosManager;
import com.neotel.smfcore.core.storage.service.po.StoragePos;
import com.neotel.smfcore.custom.luxsan.api.LuxsanApi;
import com.neotel.smfcore.custom.luxsan.api.bean.request.PickingIssueRequest;
import com.neotel.smfcore.custom.luxsan.factory_c.common.util.CommonUtil;
import com.neotel.smfcore.security.annotation.AnonymousAccess;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Arrays;
import java.util.Map;
@Slf4j
@RestController
@RequestMapping("/inventoryExp")
public class InventoryExpController {
@Autowired
private CodeResolve codeResolve;
@Autowired
private IBarcodeManager barcodeManager;
@Autowired
private IStoragePosManager storagePosManager;
@ApiOperation("清除smf库存")
@RequestMapping("/clearSmfInventory")
@AnonymousAccess
public ResultBean clearSmfInventory(@RequestBody Map<String, String> paramMap) {
String codeStr = paramMap.get("codeStr");
log.info("清除smf库存,条码为:"+codeStr);
if (StringUtils.isEmpty(codeStr)){
return ResultBean.newErrorResult(-1,"","条码不能为空");
}
if (codeStr.startsWith("C07") || codeStr.startsWith("C13") || codeStr.startsWith("C15")){
return ResultBean.newErrorResult(-1,"","条码格式不正确");
}
Barcode barcode = codeResolve.resolveOneValideBarcode(codeStr);
if (barcode == null) {
return ResultBean.newErrorResult(-1, "", codeStr + "条码不正确");
}
log.info(SecurityUtils.getLoginUsername() + "清除smf库存,条码为:" + codeStr);
clearInventoryCommon(barcode, false);
return ResultBean.newOkResult("");
}
@ApiOperation("清除smf和wms库存")
@RequestMapping("/clearWmsInventory")
@AnonymousAccess
public ResultBean clearWmsInventory(@RequestBody Map<String, String> paramMap) {
String codeStr = paramMap.get("codeStr");
log.info("清除smf和wms库存,条码为:"+codeStr);
if (StringUtils.isEmpty(codeStr)){
return ResultBean.newErrorResult(-1,"","条码不能为空");
}
if (codeStr.startsWith("C07") || codeStr.startsWith("C13") || codeStr.startsWith("C15")){
return ResultBean.newErrorResult(-1,"","条码格式不正确");
}
Barcode barcode = codeResolve.resolveOneValideBarcode(codeStr);
if (barcode == null) {
return ResultBean.newErrorResult(-1, "", codeStr + "条码不正确");
}
log.info(SecurityUtils.getLoginUsername() + "清除wms库存,条码为:" + codeStr);
clearInventoryCommon(barcode, true);
return ResultBean.newOkResult("");
}
private synchronized void clearInventoryCommon(Barcode barcode, boolean notifyWms) {
StoragePos pos = storagePosManager.findOne(new Query(Criteria.where("barcode.subCodeList.barcode").is(barcode.getBarcode())));
if (pos != null) {
Barcode boxBarcode = pos.getBarcode();
log.info(barcode.getBarcode() + "查询的库位为:" + pos.getPosName() + "料箱号为:" + boxBarcode.getBarcode());
boxBarcode.removeFromSubCodes(barcode);
barcodeManager.save(boxBarcode);
pos.setBarcode(boxBarcode);
storagePosManager.save(pos);
} else {
Barcode boxBarcode = barcodeManager.findOne(new Query(Criteria.where("subCodeList.barcode").is(barcode.getBarcode())));
if (boxBarcode != null) {
log.info(barcode.getBarcode() + "查询的库位为空,料箱号为:" + boxBarcode.getBarcode());
boxBarcode.removeFromSubCodes(barcode);
barcodeManager.save(boxBarcode);
} else {
log.info(barcode.getBarcode() + "所属料箱为空,直接清空库位");
}
}
barcode.setPosName("");
barcode.setOut(false);
barcode.setOrderId("");
barcode.setOrderItemId("");
barcode.setBarSource("");
barcodeManager.save(barcode);
if (notifyWms) {
try {
LuxsanApi.pickingIssue(new PickingIssueRequest(CommonUtil.plantCode, "SMFW" + System.currentTimeMillis(), "0", barcode.getPartNumber(),
barcode.getWarehouseCode(), "", "", "", Arrays.asList(barcode.getBarcode())));
} catch (Exception e) {
throw new ValidateException("",barcode.getBarcode()+"SMF库存已经清空,通知WMS失败:"+e.getMessage());
}
}
}
}
...@@ -121,10 +121,11 @@ public class PkCheckOutController { ...@@ -121,10 +121,11 @@ public class PkCheckOutController {
return ResultBean.newErrorResult(-1, "", "有正在执行的工单"+resultStr+",不允许出库"); return ResultBean.newErrorResult(-1, "", "有正在执行的工单"+resultStr+",不允许出库");
} }
String line = "";
List<QueryPickingResult> resultList = LuxsanApi.queryPicking(new QueryPickingRequest(CommonUtil.plantCode)); List<QueryPickingResult> resultList = LuxsanApi.queryPicking(new QueryPickingRequest(CommonUtil.plantCode));
for (QueryPickingResult result : resultList) { for (QueryPickingResult result : resultList) {
if (result.getPICKING_ID().equals(pickingId)){ if (result.getPICKING_ID().equals(pickingId)){
line = result.getLINE();
if (result.getSTATUS() == 4) { if (result.getSTATUS() == 4) {
return ResultBean.newErrorResult(-1, "", pickingId + "已经关闭,不允许发料"); return ResultBean.newErrorResult(-1, "", pickingId + "已经关闭,不允许发料");
} }
...@@ -193,6 +194,7 @@ public class PkCheckOutController { ...@@ -193,6 +194,7 @@ public class PkCheckOutController {
newOrder.setConfirmExcess(confirmExcess); newOrder.setConfirmExcess(confirmExcess);
newOrder.setOrderItems(itemList); newOrder.setOrderItems(itemList);
newOrder.setLoc(loc); newOrder.setLoc(loc);
newOrder.setLine(line);
newOrder.setCheckType(LiteorderCheckType.PICKING_CHECKOUT); newOrder.setCheckType(LiteorderCheckType.PICKING_CHECKOUT);
newOrder = liteOrderManager.createWithItems(newOrder); newOrder = liteOrderManager.createWithItems(newOrder);
liteOrderCache.addOrderToMap(newOrder); liteOrderCache.addOrderToMap(newOrder);
......
...@@ -238,8 +238,13 @@ public class ManualGrPutInController { ...@@ -238,8 +238,13 @@ public class ManualGrPutInController {
return ResultBean.newErrorResult(-1,"","15寸的物料,请放入C15的01号料格中"); return ResultBean.newErrorResult(-1,"","15寸的物料,请放入C15的01号料格中");
} }
} else if (7 == w){ } else if (7 == w){
if (!binCode.startsWith("C07")) { if (binCode.startsWith("C15")){
return ResultBean.newErrorResult(-1, "", "7寸的物料,不可以放入C15或者C13的料格中,请放入C07的料格中"); return ResultBean.newErrorResult(-1, "", "7寸的物料,不可以放入C15中,请选择其他料格");
}
if (binCode.startsWith("C13")){
if (binCode.endsWith("01")) {
return ResultBean.newErrorResult(-1, "", "7寸的物料,不可以放入C13的料格01中,请选择其他料格");
}
} }
} }
......
...@@ -14,6 +14,8 @@ public class TaskCurrentLoc { ...@@ -14,6 +14,8 @@ public class TaskCurrentLoc {
public static final String Out2_FeedingInlet = "Out2_FeedingInlet"; public static final String Out2_FeedingInlet = "Out2_FeedingInlet";
public static final String Out3_FeedingInlet = "Out3_FeedingInlet"; public static final String Out3_FeedingInlet = "Out3_FeedingInlet";
public static final String Out4_FeedingInlet = "Out4_FeedingInlet"; public static final String Out4_FeedingInlet = "Out4_FeedingInlet";
public static final String Out5_FeedingInlet = "Out5_FeedingInlet";
public static final String Out6_FeedingInlet = "Out6_FeedingInlet";
public static final String Out_FeedingInlet = "Out_FeedingInlet"; public static final String Out_FeedingInlet = "Out_FeedingInlet";
public static final String In1_DischargeHole = "In1_DischargeHole"; public static final String In1_DischargeHole = "In1_DischargeHole";
...@@ -25,6 +27,8 @@ public class TaskCurrentLoc { ...@@ -25,6 +27,8 @@ public class TaskCurrentLoc {
public static final String Out2_DischargeHole = "Out2_DischargeHole"; public static final String Out2_DischargeHole = "Out2_DischargeHole";
public static final String Out3_DischargeHole = "Out3_DischargeHole"; public static final String Out3_DischargeHole = "Out3_DischargeHole";
public static final String Out4_DischargeHole = "Out4_DischargeHole"; public static final String Out4_DischargeHole = "Out4_DischargeHole";
public static final String Out5_DischargeHole = "Out5_DischargeHole";
public static final String Out6_DischargeHole = "Out6_DischargeHole";
//人工工位入料口 //人工工位入料口
public static final String Manual_FeedingInlet = "rawLine_in"; public static final String Manual_FeedingInlet = "rawLine_in";
......
...@@ -37,18 +37,18 @@ public class StorageNameConfig { ...@@ -37,18 +37,18 @@ public class StorageNameConfig {
public static final String rawMaterialTower = "raw-material-tower"; public static final String rawMaterialTower = "raw-material-tower";
//原材料入料机构01-06 //原材料入料机构01-06
public static final String rawMaterialIn01 = "raw-material-in-01"; public static final String rawMaterialIn01 = "rawInLine01";
public static final String rawMaterialIn02 = "raw-material-in-02"; public static final String rawMaterialIn02 = "rawInLine02";
public static final String rawMaterialIn03 = "raw-material-in-03"; public static final String rawMaterialIn03 = "rawInLine03";
public static final String rawMaterialIn04 = "raw-material-in-04"; public static final String rawMaterialIn04 = "rawInLine04";
public static final String rawMaterialIn05 = "raw-material-in-05"; public static final String rawMaterialIn05 = "rawInLine05";
public static final String rawMaterialIn06 = "raw-material-in-06"; public static final String rawMaterialIn06 = "rawInLine06";
//原材料出料机构01-06 //原材料出料机构01-06
public static final String rawMaterialOut01 = "raw-material-out-01"; public static final String rawMaterialOut01 = "rawOutLine01";
public static final String rawMaterialOut02 = "raw-material-out-02"; public static final String rawMaterialOut02 = "rawOutLine02";
public static final String rawMaterialOut03 = "raw-material-out-03"; public static final String rawMaterialOut03 = "rawOutLine03";
public static final String rawMaterialOut04 = "raw-material-out-04"; public static final String rawMaterialOut04 = "rawOutLine04";
public static final String rawMaterialOut05 = "raw-material-out-05"; public static final String rawMaterialOut05 = "rawOutLine05";
public static final String rawMaterialOut06 = "raw-material-out-06"; public static final String rawMaterialOut06 = "rawOutLine06";
} }
package com.neotel.smfcore.custom.luxsan.factory_c.rawstor.util;
import com.neotel.smfcore.common.utils.StringUtils;
import com.neotel.smfcore.core.device.util.DataCache;
import com.neotel.smfcore.custom.luxsan.factory_c.common.util.CacheNameUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
@Component
public class RawOutUtil {
private static DataCache dataCache;
@Autowired
public void setDataCache(DataCache cache) {
RawOutUtil.dataCache = cache;
}
public static Map<String, String> getRawOutBox(String currentLoc) {
Map<String, String> paramMap = new HashMap<>();
Map<String, String> cacheMap = dataCache.getCache(CacheNameUtil.CACHE_RAWOUT_BOX);
if (cacheMap == null) {
cacheMap = new ConcurrentHashMap<>();
}
for (Map.Entry<String, String> entry : cacheMap.entrySet()) {
String boxStr = entry.getKey();
String value = entry.getValue();
if (StringUtils.isNotEmpty(currentLoc)){
if (currentLoc.equals(value)){
paramMap.put(boxStr,value);
}
} else {
paramMap.put(boxStr,value);
}
}
return paramMap;
}
public static void updateRawOutBox(String boxStr, String currentLoc) {
Map<String, String> cacheMap = dataCache.getCache(CacheNameUtil.CACHE_RAWOUT_BOX);
if (cacheMap == null) {
cacheMap = new ConcurrentHashMap<>();
}
cacheMap.put(boxStr, currentLoc);
dataCache.updateCache(CacheNameUtil.CACHE_RAWOUT_BOX, cacheMap);
}
public static void removeRawOutBox(String boxStr) {
Map<String, String> cacheMap = dataCache.getCache(CacheNameUtil.CACHE_RAWOUT_BOX);
if (cacheMap == null) {
cacheMap = new ConcurrentHashMap<>();
}
cacheMap.remove(boxStr);
dataCache.updateCache(CacheNameUtil.CACHE_RAWOUT_BOX, cacheMap);
}
}
...@@ -162,7 +162,11 @@ public class ManualLineController { ...@@ -162,7 +162,11 @@ public class ManualLineController {
if (boxBarcode.getBarcode().equals(dataLog.getBarcode())){ if (boxBarcode.getBarcode().equals(dataLog.getBarcode())){
if (!dataLog.isCancel() && !dataLog.isFinished()){ if (!dataLog.isCancel() && !dataLog.isFinished()){
if (dataLog.isPutInTask()){ if (dataLog.isPutInTask()){
log.info(boxStr+"有未完成/未取消的任务,库位为:"+dataLog.getPosName()+"直接返回ok"); log.info(boxStr+"有未完成/未取消的任务,库位为:"+dataLog.getPosName()+"直接修改状态为等待中");
dataLog.setStatus(OP_STATUS.WAIT.name());
dataLog.setLoc(lineNo + "_out");
taskService.removeFinishedTask(dataLog);
taskService.updateQueueTask(dataLog);
return ResultBean.newOkResult(""); return ResultBean.newOkResult("");
} else { } else {
log.info(boxStr + "有正在执行的出库任务,服务器更改状态为完成"); log.info(boxStr + "有正在执行的出库任务,服务器更改状态为完成");
......
...@@ -38,6 +38,7 @@ public class RawInLineController { ...@@ -38,6 +38,7 @@ public class RawInLineController {
Map<String, String> resultMap = new HashMap<>(); Map<String, String> resultMap = new HashMap<>();
resultMap.put("destination", destination); resultMap.put("destination", destination);
resultMap.put("materialStr", materialStr); resultMap.put("materialStr", materialStr);
log.info(materialStr+"返回目的地为:"+destination);
return ResultBean.newOkResult(resultMap); return ResultBean.newOkResult(resultMap);
} }
......
...@@ -2,6 +2,8 @@ package com.neotel.smfcore.custom.luxsan.factory_c.third.util; ...@@ -2,6 +2,8 @@ package com.neotel.smfcore.custom.luxsan.factory_c.third.util;
import com.neotel.smfcore.common.utils.StringUtils; import com.neotel.smfcore.common.utils.StringUtils;
import com.neotel.smfcore.core.device.util.DataCache; import com.neotel.smfcore.core.device.util.DataCache;
import com.neotel.smfcore.core.equipment.bean.EquipStatusBean;
import com.neotel.smfcore.core.system.util.EquipStatusUtil;
import com.neotel.smfcore.custom.luxsan.factory_c.common.util.CacheNameUtil; import com.neotel.smfcore.custom.luxsan.factory_c.common.util.CacheNameUtil;
import com.neotel.smfcore.custom.luxsan.factory_c.rawstor.util.MaterialUtil; import com.neotel.smfcore.custom.luxsan.factory_c.rawstor.util.MaterialUtil;
import com.neotel.smfcore.custom.luxsan.factory_c.third.bean.RawInLineMaterialLoc; import com.neotel.smfcore.custom.luxsan.factory_c.third.bean.RawInLineMaterialLoc;
...@@ -22,11 +24,12 @@ public class RawInLineUtil { ...@@ -22,11 +24,12 @@ public class RawInLineUtil {
private static DataCache dataCache; private static DataCache dataCache;
@Autowired @Autowired
private void setDataCache(DataCache cache){ private void setDataCache(DataCache cache) {
RawInLineUtil.dataCache = cache; RawInLineUtil.dataCache = cache;
} }
public static final String forkLoc = "forkLoc";//料串分流位, public static final String forkLoc = "forkLoc";//料串分流位,
public static final String emptyForkLoc = "emptyForkLoc";//满料串/空料串分流位,
public static final String rawInLine01 = "rawInLine01";//1号入库分拣机, public static final String rawInLine01 = "rawInLine01";//1号入库分拣机,
public static final String rawInLine02 = "rawInLine02";//2号入库分拣机, public static final String rawInLine02 = "rawInLine02";//2号入库分拣机,
public static final String rawInLine03 = "rawInLine03";//3号入库分拣机, public static final String rawInLine03 = "rawInLine03";//3号入库分拣机,
...@@ -35,22 +38,22 @@ public class RawInLineUtil { ...@@ -35,22 +38,22 @@ public class RawInLineUtil {
public static final String rawInLine06 = "rawInLine06";//6号入库分拣机 public static final String rawInLine06 = "rawInLine06";//6号入库分拣机
public static void updateDestinationMap(String material, String loc,String destination) { public static synchronized void updateDestinationMap(String material, String loc, String destination) {
Map<String, RawInLineMaterialLoc> destinationMap = dataCache.getCache(CacheNameUtil.CHCHE_RAWIN_LINE_MATERIAL_DESTINATION); Map<String, RawInLineMaterialLoc> destinationMap = dataCache.getCache(CacheNameUtil.CHCHE_RAWIN_LINE_MATERIAL_DESTINATION);
if (destinationMap == null) { if (destinationMap == null) {
destinationMap = new ConcurrentHashMap<>(); destinationMap = new ConcurrentHashMap<>();
} }
RawInLineMaterialLoc materialLoc = destinationMap.get(material); RawInLineMaterialLoc materialLoc = destinationMap.get(material);
if (materialLoc == null){ if (materialLoc == null) {
materialLoc = new RawInLineMaterialLoc(); materialLoc = new RawInLineMaterialLoc();
} }
materialLoc.setMaterial(material); materialLoc.setMaterial(material);
if(StringUtils.isNotEmpty(loc)){ if (StringUtils.isNotEmpty(loc)) {
materialLoc.setCurrentLoc(loc); materialLoc.setCurrentLoc(loc);
//清理其他 //清理其他
materialLoc.setUpdateTime(new Date()); materialLoc.setUpdateTime(new Date());
} }
if (StringUtils.isNotEmpty(destination)){ if (StringUtils.isNotEmpty(destination)) {
materialLoc.setDestination(destination); materialLoc.setDestination(destination);
} }
destinationMap.put(material, materialLoc); destinationMap.put(material, materialLoc);
...@@ -58,9 +61,9 @@ public class RawInLineUtil { ...@@ -58,9 +61,9 @@ public class RawInLineUtil {
} }
public static String getNextDestination(String material,String loc) { public static String getNextDestination(String material, String loc) {
updateDestinationMap(material,loc,""); updateDestinationMap(material, loc, "");
return getNextLoc(material,loc); return getNextLoc(material, loc);
} }
public static String getCurrentMaterial(String loc) { public static String getCurrentMaterial(String loc) {
...@@ -71,13 +74,13 @@ public class RawInLineUtil { ...@@ -71,13 +74,13 @@ public class RawInLineUtil {
RawInLineMaterialLoc materialInfo = null; RawInLineMaterialLoc materialInfo = null;
for (RawInLineMaterialLoc materialLoc : destinationMap.values()) { for (RawInLineMaterialLoc materialLoc : destinationMap.values()) {
//找出后更新的 //找出后更新的
if (loc.equals(materialLoc.getCurrentLoc()) /*&& loc.equals(materialLoc.getDestination())*/){ if (loc.equals(materialLoc.getCurrentLoc()) /*&& loc.equals(materialLoc.getDestination())*/) {
if(materialInfo == null || materialLoc.getUpdateTime().after(materialInfo.getUpdateTime())){ if (materialInfo == null || materialLoc.getUpdateTime().after(materialInfo.getUpdateTime())) {
materialInfo = materialLoc; materialInfo = materialLoc;
} }
} }
} }
if(materialInfo != null){ if (materialInfo != null) {
return materialInfo.getMaterial(); return materialInfo.getMaterial();
} }
return ""; return "";
...@@ -87,49 +90,71 @@ public class RawInLineUtil { ...@@ -87,49 +90,71 @@ public class RawInLineUtil {
String materialSize = MaterialUtil.getMaterialSize(material); String materialSize = MaterialUtil.getMaterialSize(material);
Map<String, RawInLineMaterialLoc> destinationMap = dataCache.getCache(CacheNameUtil.CHCHE_RAWIN_LINE_MATERIAL_DESTINATION); //Map<String, RawInLineMaterialLoc> destinationMap = dataCache.getCache(CacheNameUtil.CHCHE_RAWIN_LINE_MATERIAL_DESTINATION);
if(loc.equals(forkLoc)){
String nextLoc = ""; String nextLoc = "";
if ("13".equals(materialSize) || "15".equals(materialSize)){ if ("13".equals(materialSize) || "15".equals(materialSize)) {
log.info("13或者15寸的料串,只放在1号工位:"+rawInLine01); log.info(material + "的尺寸为:" + material + "直接分配到1号工位");
//判断1号是否要料串
EquipStatusBean statusBean = EquipStatusUtil.getStatusBean(rawInLine01);
if (statusBean != null) {
int status = statusBean.getStatus();
log.info(loc + "的状态为:" + status);
if (10 == status) {
nextLoc = rawInLine01;
if (loc.equals(rawInLine01)) {
updateDestinationMap(material, loc, nextLoc);
} else {
updateDestinationMap(material, loc + "_to_" + nextLoc, nextLoc);
}
return nextLoc;
}
}
if (!loc.equals(rawInLine01)) {
nextLoc = rawInLine01; nextLoc = rawInLine01;
} else { } else {
nextLoc = rawInLine02; nextLoc = rawInLine02;
} }
updateDestinationMap(material,loc,nextLoc); updateDestinationMap(material, loc + "_to_" + nextLoc, nextLoc);
return nextLoc; } else {
}else{ if (loc.equals(forkLoc) || loc.equals(emptyForkLoc)) {
String nextLoc = loc; nextLoc = rawInLine02;
if (rawInLine02.equals(loc)) { updateDestinationMap(material, loc, nextLoc);
nextLoc = rawInLine03; } else {
} else if (rawInLine03.equals(loc)) { //7寸料串,直接到2号分拣机
nextLoc = rawInLine04; if (loc.equals(rawInLine01)){
} else if (rawInLine04.equals(loc)) { nextLoc = rawInLine02;
nextLoc = rawInLine05;
} else if (rawInLine05.equals(loc)) {
nextLoc = rawInLine06;
}
int count = 0;
for (RawInLineMaterialLoc materialLoc : destinationMap.values()) {
if (nextLoc.equals(materialLoc.getDestination())) {
count++;
}
}
if(count < 6){
if (!nextLoc.equals(loc)) {
log.info("获取满料串:" + material + ",下一个位置[" + nextLoc + "]数量为:" + count + "小于6个,料串从当前位置["+loc+"]流走");
updateDestinationMap(material, loc + "_to_" + nextLoc, nextLoc); updateDestinationMap(material, loc + "_to_" + nextLoc, nextLoc);
} else {
EquipStatusBean statusBean = EquipStatusUtil.getStatusBean(loc);
if (statusBean != null) {
int status = statusBean.getStatus();
log.info(loc + "的状态为:" + status);
if (10 == status) {
nextLoc = loc;
updateDestinationMap(material, loc, nextLoc);
return nextLoc;
}
}
if (rawInLine02.equals(loc)) {
nextLoc = rawInLine03;
} else if (rawInLine03.equals(loc)) {
nextLoc = rawInLine04;
} else if (rawInLine04.equals(loc)) {
nextLoc = rawInLine05;
} else if (rawInLine05.equals(loc)) {
nextLoc = rawInLine06;
} else if (rawInLine06.equals(loc)) {
nextLoc = rawInLine02;
}
} }
return nextLoc; updateDestinationMap(material, loc + "_to_" + nextLoc, nextLoc);
}else{
updateDestinationMap(material,loc,"");
return loc;
} }
} }
return nextLoc;
} }
public static void clearInLineStacker(String materialStr) { public static void clearInLineStacker(String materialStr) {
Map<String, RawInLineMaterialLoc> destinationMap = dataCache.getCache(CacheNameUtil.CHCHE_RAWIN_LINE_MATERIAL_DESTINATION); Map<String, RawInLineMaterialLoc> destinationMap = dataCache.getCache(CacheNameUtil.CHCHE_RAWIN_LINE_MATERIAL_DESTINATION);
if (destinationMap == null) { if (destinationMap == null) {
......
...@@ -10,7 +10,7 @@ api: ...@@ -10,7 +10,7 @@ api:
cancelOdn: http://10.68.27.86/smf-core/cancelRestock/cancelOdn cancelOdn: http://10.68.27.86/smf-core/cancelRestock/cancelOdn
#禁用料 #禁用料
inCheckUrl: http://10.68.25.40:8001/Npm/WmsCheckReelfob inCheckUrl: http://10.68.25.42:8001/Npm/WmsCheckReelfob
#储位查询 #储位查询
queryBin: http://10.68.30.22:8082/api/mlb/QueryBin queryBin: http://10.68.30.22:8082/api/mlb/QueryBin
...@@ -178,6 +178,6 @@ api: ...@@ -178,6 +178,6 @@ api:
manualPallet: http://10.68.30.22:8082/api/mlb/manualPallet manualPallet: http://10.68.30.22:8082/api/mlb/manualPallet
#批量禁用料 #批量禁用料
batchCheckReel: http://10.68.27.68:8001/Npm/CheckReelBatch batchCheckReel: http://10.68.25.42:8001/Npm/CheckReelBatch
fetchReel: http://10.68.30.22:8082/api/mlb/FetchReel fetchReel: http://10.68.30.22:8082/api/mlb/FetchReel
...@@ -112,5 +112,5 @@ app: ...@@ -112,5 +112,5 @@ app:
menu: menu:
show: materialShortage show:
hide: hide:
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!