Commit beeed935 LN

1

1 个父辈 4aba1dfc
package com.neotel.smfcore.common.init; package com.neotel.smfcore.common.init;
import com.google.common.collect.Lists;
import com.neotel.smfcore.common.utils.PermissionInitUtil; import com.neotel.smfcore.common.utils.PermissionInitUtil;
import com.neotel.smfcore.common.utils.Constants; import com.neotel.smfcore.common.utils.Constants;
import com.neotel.smfcore.core.api.SmfApi;
import com.neotel.smfcore.core.device.util.DataCache; import com.neotel.smfcore.core.device.util.DataCache;
import com.neotel.smfcore.core.inList.util.InListCache; import com.neotel.smfcore.core.inList.util.InListCache;
import com.neotel.smfcore.core.message.enums.MessageType; import com.neotel.smfcore.core.message.enums.MessageType;
import com.neotel.smfcore.core.message.service.manager.IMessageManager; import com.neotel.smfcore.core.message.service.manager.IMessageManager;
import com.neotel.smfcore.core.message.service.po.Message; import com.neotel.smfcore.core.message.service.po.Message;
import com.neotel.smfcore.core.order.util.OrderFileWatch; import com.neotel.smfcore.core.order.util.OrderFileWatch;
import com.neotel.smfcore.core.shelf.TaskShelfUtil; import com.neotel.smfcore.core.shelf.util.TaskShelfUtil;
import com.neotel.smfcore.security.service.manager.IMenuManager;
import com.neotel.smfcore.security.service.manager.IRoleManager; import com.neotel.smfcore.security.service.manager.IRoleManager;
import com.neotel.smfcore.security.service.manager.IUserManager; import com.neotel.smfcore.security.service.manager.IUserManager;
import com.neotel.smfcore.security.service.po.Menu;
import com.neotel.smfcore.security.service.po.Role; import com.neotel.smfcore.security.service.po.Role;
import com.neotel.smfcore.security.service.po.User; import com.neotel.smfcore.security.service.po.User;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.logging.log4j.util.Strings;
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;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct; import javax.annotation.PostConstruct;
......
...@@ -141,6 +141,15 @@ public class DeviceController { ...@@ -141,6 +141,15 @@ public class DeviceController {
String rfidLoc = request.getParameter("rfidLoc"); String rfidLoc = request.getParameter("rfidLoc");
String lastPosId = request.getParameter("lastPosId"); String lastPosId = request.getParameter("lastPosId");
//返回值:
//100=系统更新中,暂停出入库
//101=未指定料仓 cids
//99=无可用的料仓
//107=物料已过期
//98=有出库任务
//104=未找到可用仓位
//105=查找空库位失败
lineMsg = ""; lineMsg = "";
log.info("流水线[" + cids + "]获取[" + rfid + "][" + code + "]的入库库位"); log.info("流水线[" + cids + "]获取[" + rfid + "][" + code + "]的入库库位");
Map<String, Object> resultMap = Maps.newHashMap(); Map<String, Object> resultMap = Maps.newHashMap();
......
...@@ -21,7 +21,7 @@ import com.neotel.smfcore.core.order.service.manager.ILiteOrderItemManager; ...@@ -21,7 +21,7 @@ import com.neotel.smfcore.core.order.service.manager.ILiteOrderItemManager;
import com.neotel.smfcore.core.order.service.manager.ILiteOrderManager; import com.neotel.smfcore.core.order.service.manager.ILiteOrderManager;
import com.neotel.smfcore.core.order.service.po.LiteOrder; import com.neotel.smfcore.core.order.service.po.LiteOrder;
import com.neotel.smfcore.core.order.service.po.LiteOrderItem; import com.neotel.smfcore.core.order.service.po.LiteOrderItem;
import com.neotel.smfcore.core.shelf.TaskShelfUtil; import com.neotel.smfcore.core.shelf.util.TaskShelfUtil;
import com.neotel.smfcore.core.storage.enums.CHECKOUT_TYPE; import com.neotel.smfcore.core.storage.enums.CHECKOUT_TYPE;
import com.neotel.smfcore.core.storage.service.manager.IStoragePosManager; import com.neotel.smfcore.core.storage.service.manager.IStoragePosManager;
import com.neotel.smfcore.core.storage.service.po.Storage; import com.neotel.smfcore.core.storage.service.po.Storage;
......
...@@ -16,17 +16,17 @@ import java.util.concurrent.ConcurrentHashMap; ...@@ -16,17 +16,17 @@ import java.util.concurrent.ConcurrentHashMap;
@Slf4j @Slf4j
public class ShelfInfo { public class ShelfInfo {
public ShelfInfo(String type,int maxNum){ public ShelfInfo(String type, int maxNum) {
shelfType=type ; shelfType = type;
maxLocCount=maxNum; maxLocCount = maxNum;
} }
/** /**
* F料架位置数量,1-26是小料,27=31是大料 * F料架位置数量,1-26是小料,27=31是大料
*/ */
private static int F_POS_COUNT=31; private static int F_POS_COUNT = 31;
private static int MAX_F_SMALL_NUM=26;//F料架小料位置最大编号 private static int MAX_F_SMALL_NUM = 26;//F料架小料位置最大编号
/** /**
...@@ -60,15 +60,15 @@ public class ShelfInfo { ...@@ -60,15 +60,15 @@ public class ShelfInfo {
*/ */
private int maxLocCount = 0; private int maxLocCount = 0;
public static ShelfInfo newFShelf(){ public static ShelfInfo newFShelf() {
return new ShelfInfo(SHELF_TYPE.F,31); return new ShelfInfo(SHELF_TYPE.F, 31);
} }
/** /**
* 架位放置情况, key小于0表示已经放过,key>0为空的库位 * 架位放置情况, key小于0表示已经放过,key>0为空的库位
*/ */
private Map<Integer, ShelfLoc> locMap = new ConcurrentHashMap<>(); private Map<Integer, ShelfLoc> locMap = new ConcurrentHashMap<>();
public String tempRfid(){ public String tempRfid() {
return getOrderNo() + "-" + rfidIndex + shelfType; return getOrderNo() + "-" + rfidIndex + shelfType;
} }
...@@ -105,18 +105,18 @@ public class ShelfInfo { ...@@ -105,18 +105,18 @@ public class ShelfInfo {
/** /**
* 为不需要按顺序摆放的料盘锁定一个架位,如果已经锁定过,返回对应的架位 * 为不需要按顺序摆放的料盘锁定一个架位,如果已经锁定过,返回对应的架位
*/ */
public ShelfLoc lockOneEmptyLoc(DataLog task){ public ShelfLoc lockOneEmptyLoc(DataLog task) {
//先看看此条码是否已经锁定过 //先看看此条码是否已经锁定过
for (ShelfLoc shelfLoc : locMap.values()) { for (ShelfLoc shelfLoc : locMap.values()) {
if(shelfLoc.isLock() && shelfLoc.getBarcode().equals(task.getBarcode())){ if (shelfLoc.isLock() && shelfLoc.getBarcode().equals(task.getBarcode())) {
log.info("找到条码["+task.getBarcode()+"]锁定的架位["+shelfLoc.getLoc()+"]"); log.info("找到条码[" + task.getBarcode() + "]锁定的架位[" + shelfLoc.getLoc() + "]");
return shelfLoc; return shelfLoc;
} }
} }
for(int i=1; i<= maxLocCount; i++){ for (int i = 1; i <= maxLocCount; i++) {
ShelfLoc shelfLoc = lockLocation(i,task); ShelfLoc shelfLoc = lockLocation(i, task);
if(shelfLoc != null){ if (shelfLoc != null) {
return shelfLoc; return shelfLoc;
} }
} }
...@@ -126,13 +126,14 @@ public class ShelfInfo { ...@@ -126,13 +126,14 @@ public class ShelfInfo {
/** /**
* 锁定库位,如果成功返回库位,如果失败返回null * 锁定库位,如果成功返回库位,如果失败返回null
*/ */
private ShelfLoc lockLocation(int loc, DataLog task){ private ShelfLoc lockLocation(int loc, DataLog task) {
ShelfLoc shelfLoc = locMap.get(loc); ShelfLoc shelfLoc = locMap.get(loc);
if(shelfLoc != null && shelfLoc.isEmpty() && !shelfLoc.isLock() && getReelType(task) == shelfLoc.getReelType()){ if (shelfLoc != null && shelfLoc.isEmpty() && !shelfLoc.isLock() && getReelType(task) == shelfLoc.getReelType()) {
log.info("为[" + task.getBarcode() + "]锁定架位"+tempRfid() + "["+loc+"]"); log.info("为[" + task.getBarcode() + "]锁定架位" + tempRfid() + "[" + loc + "]");
//未放过料,且未锁定 //未放过料,且未锁定
shelfLoc.setBarcode(task.getBarcode()); shelfLoc.setBarcode(task.getBarcode());
shelfLoc.setReelType(getReelType(task)); shelfLoc.setReelType(getReelType(task));
shelfLoc.setLock(true);
locMap.put(loc, shelfLoc); locMap.put(loc, shelfLoc);
return shelfLoc; return shelfLoc;
} }
...@@ -141,29 +142,29 @@ public class ShelfInfo { ...@@ -141,29 +142,29 @@ public class ShelfInfo {
/** /**
* 添加一个库位 * 新建任务时添加库位
*/ */
public int addUnLimitLoc(DataLog task){ public int addUnLimitLoc(DataLog task) {
for(int i=1; i<= maxLocCount; i++){ for (int i = 1; i <= maxLocCount; i++) {
ShelfLoc shelfLoc = locMap.get(i); ShelfLoc shelfLoc = locMap.get(i);
if(shelfLoc == null){ if (shelfLoc == null) {
boolean addThis = false; boolean addThis = false;
if(isSmallReel(task)){ if (isSmallReel(task)) {
if(i<= MAX_F_SMALL_NUM){ if (i <= MAX_F_SMALL_NUM) {
addThis = true; addThis = true;
} }
}else{ } else {
if(i> MAX_F_SMALL_NUM){ if (i > MAX_F_SMALL_NUM) {
addThis = true; addThis = true;
} }
} }
if(addThis){ if (addThis) {
shelfLoc = new ShelfLoc(); shelfLoc = new ShelfLoc();
shelfLoc.setLoc(i); shelfLoc.setLoc(i);
shelfLoc.setBarcode(""); shelfLoc.setBarcode("");
shelfLoc.setReelType(getReelType(task)); shelfLoc.setReelType(getReelType(task));
shelfLoc.setTempRfid(tempRfid()); shelfLoc.setTempRfid(tempRfid());
if(ObjectUtil.isNotEmpty(realRfid)){ if (ObjectUtil.isNotEmpty(realRfid)) {
shelfLoc.setRealRfid(realRfid); shelfLoc.setRealRfid(realRfid);
} }
locMap.put(i, shelfLoc); locMap.put(i, shelfLoc);
...@@ -179,15 +180,15 @@ public class ShelfInfo { ...@@ -179,15 +180,15 @@ public class ShelfInfo {
* @param loc * @param loc
* @param barcode * @param barcode
*/ */
public boolean putInLoc(String rfid, int loc, String barcode){ public boolean putInLoc(String rfid, int loc, String barcode) {
if(ObjectUtil.isNotEmpty(realRfid)){ if (ObjectUtil.isNotEmpty(realRfid)) {
//已绑定过真实料架,必须一致才能放入 //已绑定过真实料架,必须一致才能放入
if(!this.realRfid.equals(rfid)){ if (!this.realRfid.equals(rfid)) {
return false; return false;
} }
} }
if(!rfid.contains(shelfType)){ if (!rfid.contains(shelfType)) {
//未绑定过料架的,需要判断类型是否一致 //未绑定过料架的,需要判断类型是否一致
return false; return false;
} }
...@@ -195,53 +196,55 @@ public class ShelfInfo { ...@@ -195,53 +196,55 @@ public class ShelfInfo {
int lockLocation = -1; int lockLocation = -1;
for (ShelfLoc shelfLoc : locMap.values()) { for (ShelfLoc shelfLoc : locMap.values()) {
if(shelfLoc.isLock() && shelfLoc.getBarcode().equals(barcode)){ if (shelfLoc.isLock() && shelfLoc.getBarcode().equals(barcode)) {
log.info("找到条码["+barcode+"]锁定的架位["+shelfLoc.getLoc()+"]"); log.info("找到条码[" + barcode + "]锁定的架位[" + shelfLoc.getLoc() + "]");
lockLocation = shelfLoc.getLoc(); lockLocation = shelfLoc.getLoc();
} }
} }
if(lockLocation == -1){ if (lockLocation == -1) {
log.error("["+tempRfid()+"]未找到["+barcode+"]锁定的位置信息"); log.error("[" + tempRfid() + "]未找到[" + barcode + "]锁定的位置信息");
return false; return false;
} }
if(lockLocation != loc){ if (lockLocation != loc) {
log.error(barcode + "放置位置["+loc+"]与锁定位置["+lockLocation+"]不一致"); log.error(barcode + "放置位置[" + loc + "]与锁定位置[" + lockLocation + "]不一致");
return false; return false;
} }
this.setRealRfid(rfid); this.setRealRfid(rfid);
ShelfLoc shelfLoc = locMap.get(loc); ShelfLoc shelfLoc = locMap.get(loc);
if(shelfLoc == null){ if (shelfLoc == null) {
log.error("未找到["+loc+"]的位置信息,当前料架位置信息:"+ locMap); log.error("未找到[" + loc + "]的位置信息,当前料架位置信息:" + locMap);
return false; return false;
} }
if(shelfLoc.isEmpty()){ if (shelfLoc.isEmpty()) {
boolean putInResult = shelfLoc.putIn(barcode); boolean putInResult = shelfLoc.putIn(barcode);
locMap.put(loc, shelfLoc); locMap.put(loc, shelfLoc);
return putInResult; return putInResult;
}else{ } else {
log.error("料盘["+barcode+"]放入位置"+rfid+"["+loc+"]失败,此位置料盘已放入"); log.error("料盘[" + barcode + "]放入位置" + rfid + "[" + loc + "]失败,此位置料盘已放入");
return false; return false;
} }
} }
public boolean isFull(){
public boolean isFull() {
for (ShelfLoc loc : locMap.values()) { for (ShelfLoc loc : locMap.values()) {
if(loc.isEmpty()){ if (loc.isEmpty()) {
return false; return false;
} }
} }
return true; return true;
} }
/** /**
* 为 取消一个库位 * 为 取消一个库位
*/ */
public boolean cancelLoc(String rfidType, DataLog task){ public boolean cancelLoc(String rfidType, DataLog task) {
if(rfidType.equals(this.getShelfType())){ if (rfidType.equals(this.getShelfType())) {
for(int i=maxLocCount; i> 0; i--){ for (int i = maxLocCount; i > 0; i--) {
ShelfLoc shelfLoc = locMap.get(i); ShelfLoc shelfLoc = locMap.get(i);
if(shelfLoc != null && shelfLoc.isEmpty() && !shelfLoc.isLock() && shelfLoc.getReelType() == getReelType(task)){ if (shelfLoc != null && shelfLoc.isEmpty() && !shelfLoc.isLock() && shelfLoc.getReelType() == getReelType(task)) {
//未放过料,且未锁定 //未放过料,且未锁定
shelfLoc.putIn(task.getBarcode()); shelfLoc.putIn(task.getBarcode());
return true; return true;
...@@ -250,10 +253,19 @@ public class ShelfInfo { ...@@ -250,10 +253,19 @@ public class ShelfInfo {
} }
return false; return false;
} }
public int getReelType(DataLog task){
return 0; public int getReelType(DataLog task) {
// 物料类型:1=小料,2=大料
if (isSmallReel(task)) {
return 1;
}
return 2;
} }
public boolean isSmallReel(DataLog task){
public boolean isSmallReel(DataLog task) {
if (task.getW() <= 7) {
return true; return true;
} }
return false;
}
} }
...@@ -4,7 +4,7 @@ import com.neotel.smfcore.common.bean.ResultBean; ...@@ -4,7 +4,7 @@ import com.neotel.smfcore.common.bean.ResultBean;
import com.neotel.smfcore.core.api.SmfApi; import com.neotel.smfcore.core.api.SmfApi;
import com.neotel.smfcore.core.order.LiteOrderCache; import com.neotel.smfcore.core.order.LiteOrderCache;
import com.neotel.smfcore.core.order.service.po.LiteOrder; import com.neotel.smfcore.core.order.service.po.LiteOrder;
import com.neotel.smfcore.core.shelf.TaskShelfUtil; import com.neotel.smfcore.core.shelf.util.TaskShelfUtil;
import com.neotel.smfcore.core.shelf.bean.ShelfInfo; import com.neotel.smfcore.core.shelf.bean.ShelfInfo;
import com.neotel.smfcore.security.annotation.AnonymousAccess; import com.neotel.smfcore.security.annotation.AnonymousAccess;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
......
...@@ -7,7 +7,7 @@ import com.neotel.smfcore.core.barcode.service.po.Barcode; ...@@ -7,7 +7,7 @@ import com.neotel.smfcore.core.barcode.service.po.Barcode;
import com.neotel.smfcore.core.barcode.utils.CodeResolve; import com.neotel.smfcore.core.barcode.utils.CodeResolve;
import com.neotel.smfcore.core.device.enums.OP_STATUS; 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.shelf.TaskShelfUtil; import com.neotel.smfcore.core.shelf.util.TaskShelfUtil;
import com.neotel.smfcore.core.shelf.bean.ShelfInfo; import com.neotel.smfcore.core.shelf.bean.ShelfInfo;
import com.neotel.smfcore.core.shelf.bean.ShelfLoc; import com.neotel.smfcore.core.shelf.bean.ShelfLoc;
import com.neotel.smfcore.core.system.service.manager.IDataLogManager; import com.neotel.smfcore.core.system.service.manager.IDataLogManager;
...@@ -220,7 +220,12 @@ public class TaskShelfController { ...@@ -220,7 +220,12 @@ public class TaskShelfController {
// resultMap.put("smallTask", smallTask + ""); // resultMap.put("smallTask", smallTask + "");
// resultMap.put("bigTask", bigTask + ""); // resultMap.put("bigTask", bigTask + "");
return ResultBean.newOkResult(resultMap); if(result) {
ResultBean.newOkResult(resultMap);
}else{
log.info(" getLocation barcode[" + barcode + "],rfid[" + rfid + "],loc["+rfidLoc+"] 放料到料架失败,未找到锁定位置");
return ResultBean.newErrorResult(304, "smfcore.task.locNotFind", "{0}放料到料架{0}的位置{0}失败,未找到锁定位置", new String[]{opTask.getBarcode(), rfid,rfidLoc+""});
}
} catch (Exception e) { } catch (Exception e) {
log.error("putShelfFinished 出错 rfid=" + rfid + ";rfidLoc=" + rfidLoc + ";barcode=" + barcode, e); log.error("putShelfFinished 出错 rfid=" + rfid + ";rfidLoc=" + rfidLoc + ";barcode=" + barcode, e);
} }
......
package com.neotel.smfcore.core.shelf; package com.neotel.smfcore.core.shelf.util;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
...@@ -28,7 +28,7 @@ public class TaskShelfUtil { ...@@ -28,7 +28,7 @@ public class TaskShelfUtil {
public static Map<String, Map<String, ShelfInfo>> taskShelfMap =null; public static Map<String, Map<String, ShelfInfo>> taskShelfMap =null;
/**料架所在的产线位置 /**料架所在的产线位置
* *key=rfid,value=位置
*/ */
public static Map<String,String> shelfLocMap=null; public static Map<String,String> shelfLocMap=null;
......
...@@ -34,6 +34,8 @@ public class DataLog extends BasePo implements Serializable ,Comparable<DataLog> ...@@ -34,6 +34,8 @@ public class DataLog extends BasePo implements Serializable ,Comparable<DataLog>
setNum(barcode.getAmount()); setNum(barcode.getAmount());
setMemo(barcode.getMemo()); setMemo(barcode.getMemo());
setW(barcode.getPlateSize());
setH(barcode.getHeight());
setProviderNumber(barcode.getProviderNumber()); setProviderNumber(barcode.getProviderNumber());
setBatchInfo(barcode.getBatch()); setBatchInfo(barcode.getBatch());
setPutInDate(barcode.getPutInDate()); setPutInDate(barcode.getPutInDate());
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
<PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss.SSS} %-5level [%file:%line] - %msg%n"/> <PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss.SSS} %-5level [%file:%line] - %msg%n"/>
</Console> </Console>
<RollingFile name="log" fileName="${LOG_HOME}/${LOG_NAME}.txt" filePattern="${LOG_HOME}/${LOG_NAME}.%d{yyyy-MM-dd}.txt" append="true"> <RollingFile name="log" fileName="${LOG_HOME}/${LOG_NAME}.txt" filePattern="${LOG_HOME}/${LOG_NAME}.%d{yyyy-MM-dd}.txt" append="true">
<PatternLayout charset="GB18030" pattern="%d{yyyy-MM-dd HH:mm:ss.SSS} %-5level [%file:%line] - %msg%n" /> <PatternLayout charset="UTF-8" pattern="%d{yyyy-MM-dd HH:mm:ss.SSS} %-5level [%file:%line] - %msg%n" />
<Policies> <Policies>
<TimeBasedTriggeringPolicy modulate="true" interval="1" /> <TimeBasedTriggeringPolicy modulate="true" interval="1" />
</Policies> </Policies>
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
</logger> </logger>
<logger name="ro" level="WARN"> <logger name="ro" level="WARN">
</logger> </logger>
<logger name="org.apache.kafka.clients.NetworkClient" level="ERROR" />
<root level="INFO"> <root level="INFO">
<appender-ref ref="Console"/> <appender-ref ref="Console"/>
<appender-ref ref="log"/> <appender-ref ref="log"/>
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!