Commit 2be0d641 zshaohui

功能提交

1 个父辈 9d8a8a35
正在显示 36 个修改的文件 包含 947 行增加40 行删除
package com.neotel.smfcore.common.utils; package com.neotel.smfcore.common.utils;
public class Constants { public class Constants {
private Constants() { private Constants() {
// hide me // hide me
} }
...@@ -213,4 +214,9 @@ public class Constants { ...@@ -213,4 +214,9 @@ public class Constants {
*/ */
public static final String Cache_AuthDate = "Cache_AuthDate"; public static final String Cache_AuthDate = "Cache_AuthDate";
/**
* 缓存料架信息
*/
public static final String Cache_ShelfInfo = "Cache_ShelfInfo";
} }
...@@ -60,6 +60,30 @@ public enum OP_STATUS { ...@@ -60,6 +60,30 @@ public enum OP_STATUS {
/** /**
* 已放到料仓门口无料盘 * 已放到料仓门口无料盘
*/ */
BOXDOOR_NOREEL BOXDOOR_NOREEL,
;
/**
* 等待取出
*/
WAITING_FOR_RETRIEVAL,
/**
* 正在出库
*/
OUTTING,
/**
* 出库完成
*/
OUTBOX,
/**
* 线体扫码位置
*/
ON_LINE,
/**
* 异常
*/
ABNORMAL;
} }
...@@ -28,6 +28,9 @@ import com.neotel.smfcore.core.storage.service.po.StoragePos; ...@@ -28,6 +28,9 @@ 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.DevicesStatusUtil; import com.neotel.smfcore.core.system.util.DevicesStatusUtil;
import com.neotel.smfcore.core.system.util.TaskService; import com.neotel.smfcore.core.system.util.TaskService;
import com.neotel.smfcore.custom.zhongche1568.bean.shelf.ShelfInfo;
import com.neotel.smfcore.custom.zhongche1568.enums.ZhongCheOrderLoc;
import com.neotel.smfcore.custom.zhongche1568.enums.ZhongCheOrderType;
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.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -475,6 +478,8 @@ public class LiteOrderCache { ...@@ -475,6 +478,8 @@ public class LiteOrderCache {
return checkOutOrder(cacheOrder).getMsgKey(); return checkOutOrder(cacheOrder).getMsgKey();
} }
//缓存料架信息
Map<Integer, ShelfInfo> cacheShelfInfoMap = new HashMap<>();
log.info("开始执行工单[" + orderNo + "] outBom=" + outBom); log.info("开始执行工单[" + orderNo + "] outBom=" + outBom);
cacheOrder.setTaskReelCount(0); cacheOrder.setTaskReelCount(0);
...@@ -494,6 +499,8 @@ public class LiteOrderCache { ...@@ -494,6 +499,8 @@ public class LiteOrderCache {
return "smfcore.order.out.noTask"; return "smfcore.order.out.noTask";
} }
String type = cacheOrder.getType();
List<String> availableStorageIds = dataCache.getAvailableStorageIds(cidList); List<String> availableStorageIds = dataCache.getAvailableStorageIds(cidList);
boolean shortage=false; boolean shortage=false;
...@@ -552,8 +559,62 @@ public class LiteOrderCache { ...@@ -552,8 +559,62 @@ public class LiteOrderCache {
assignReelCount = assignReelCount + 1; assignReelCount = assignReelCount + 1;
taskReelCount = taskReelCount + 1; taskReelCount = taskReelCount + 1;
log.info("工单[" + orderNo + "],任务数[" + taskReelCount + "]出库位置仓位【" + pos.getPosName() + "】RI=[" + pos.getBarcode().getBarcode() + "] PN=[" + partNumber + "] num:" + pos.getBarcode().getAmount()); log.info("工单[" + orderNo + "],任务数[" + taskReelCount + "]出库位置仓位【" + pos.getPosName() + "】RI=[" + pos.getBarcode().getBarcode() + "] PN=[" + partNumber + "] num:" + pos.getBarcode().getAmount());
DataLog task = newTask(pos) ;
//首套出到皮带线,补料出到对应的料架
String locInfo = "";
if (ZhongCheOrderType.FIRST.equals(type)){
locInfo = orderNo+"-"+ZhongCheOrderLoc.BELTLINE;
} else if (ZhongCheOrderType.REMAINING.equals(type)) {
//判断是大料盘还是小料盘
Barcode barcode = pos.getBarcode();
boolean bigReel = false;
if (barcode.getPlateSize() > 7) {
bigReel = true;
}
if (cacheShelfInfoMap.isEmpty()) {
cacheShelfInfoMap.put(1, new ShelfInfo());
}
//判断是否有料架信息
int hasCapacityshelf = 0;
for (int shelfNo : cacheShelfInfoMap.keySet()) {
ShelfInfo shelfInfo = cacheShelfInfoMap.get(shelfNo);
if (bigReel) {
if (shelfInfo.hasBigCapacity()) {
hasCapacityshelf = shelfNo;
break;
}
} else {
if (shelfInfo.hasSmallCapacity()) {
hasCapacityshelf = shelfNo;
break;
}
}
}
if (hasCapacityshelf > 0) {
ShelfInfo shelfInfo = cacheShelfInfoMap.get(hasCapacityshelf);
if (bigReel) {
shelfInfo.setBigReelCount(shelfInfo.getBigReelCount() + 1);
} else {
shelfInfo.setSmallReelCount(shelfInfo.getSmallReelCount() + 1);
}
locInfo = orderNo+"-"+hasCapacityshelf;
cacheShelfInfoMap.put(hasCapacityshelf,shelfInfo);
} else {
//新创建一个料架出来
int maxShelfNo = Collections.max(cacheShelfInfoMap.keySet());
maxShelfNo = maxShelfNo + 1;
ShelfInfo shelfInfo = new ShelfInfo();
if (bigReel) {
shelfInfo.setBigReelCount(shelfInfo.getBigReelCount() + 1);
} else {
shelfInfo.setSmallReelCount(shelfInfo.getSmallReelCount() + 1);
}
locInfo = orderNo+"-"+maxShelfNo;
cacheShelfInfoMap.put(maxShelfNo,shelfInfo);
}
}
DataLog task = newTask(pos) ;
task.setSourceId(cacheOrder.getId()); task.setSourceId(cacheOrder.getId());
task.setSourceName(cacheOrder.getOrderNo()); task.setSourceName(cacheOrder.getOrderNo());
task.setSubSourceId(orderItem.getId()); task.setSubSourceId(orderItem.getId());
...@@ -563,6 +624,9 @@ public class LiteOrderCache { ...@@ -563,6 +624,9 @@ public class LiteOrderCache {
task.setStatus(OP_STATUS.WAIT.name()); task.setStatus(OP_STATUS.WAIT.name());
task.setSingleOut(singleOut); task.setSingleOut(singleOut);
task.setLine(cacheOrder.getLine()); task.setLine(cacheOrder.getLine());
task.setLocInfo(locInfo);
task.setSo(cacheOrder.getSo());
task.setSoltNum(orderItem.getSlotNum());
// task = dataLogDao.save(task); // task = dataLogDao.save(task);
taskService.addTaskToExecute(task); taskService.addTaskToExecute(task);
} }
......
...@@ -65,6 +65,14 @@ public class DefaultOrderFileListener implements IOrderFileListener { ...@@ -65,6 +65,14 @@ public class DefaultOrderFileListener implements IOrderFileListener {
LiteOrder liteOrder = new LiteOrder(so, liteOrderItems); LiteOrder liteOrder = new LiteOrder(so, liteOrderItems);
liteOrder.setSource(fileName); liteOrder.setSource(fileName);
liteOrder.setSourceType(sourceType);//0=手动创建,1=共享文件夹 liteOrder.setSourceType(sourceType);//0=手动创建,1=共享文件夹
for (LiteOrderItem item : liteOrderItems) {
if (StringUtils.isNotEmpty(item.getOrderType())){
liteOrder.setType(item.getOrderType());
break;
}
}
LiteOrder dbOrder = liteOrderManager.findByOrderNo(liteOrder.getOrderNo()); LiteOrder dbOrder = liteOrderManager.findByOrderNo(liteOrder.getOrderNo());
if (dbOrder != null) { if (dbOrder != null) {
...@@ -118,6 +126,7 @@ public class DefaultOrderFileListener implements IOrderFileListener { ...@@ -118,6 +126,7 @@ public class DefaultOrderFileListener implements IOrderFileListener {
int soIndex = csvRead.getIndex("SO", orderSetting.getSo()); int soIndex = csvRead.getIndex("SO", orderSetting.getSo());
int numIndex = csvRead.getIndex("NUM", orderSetting.getNum()); int numIndex = csvRead.getIndex("NUM", orderSetting.getNum());
int mpnIndex = csvRead.getIndex("MPN", orderSetting.getMpn()); int mpnIndex = csvRead.getIndex("MPN", orderSetting.getMpn());
int orderTypeIndex = csvRead.getIndex("ORDERTYPE", orderSetting.getOrderType());
//附加字段读取 //附加字段读取
Map<String,Integer> appendIndexMap=new HashMap<>(); Map<String,Integer> appendIndexMap=new HashMap<>();
...@@ -188,6 +197,15 @@ public class DefaultOrderFileListener implements IOrderFileListener { ...@@ -188,6 +197,15 @@ public class DefaultOrderFileListener implements IOrderFileListener {
} }
} }
} }
String orderType = "";
if (orderTypeIndex != -1){
String orderTypeStr = lineValues[orderTypeIndex];
if (StringUtils.isNotEmpty(orderTypeStr)){
orderType = orderTypeStr;
}
}
LiteOrderItem item = new LiteOrderItem(); LiteOrderItem item = new LiteOrderItem();
item.setPn(partNumber); item.setPn(partNumber);
item.setNeedReelCount(count); item.setNeedReelCount(count);
...@@ -199,7 +217,7 @@ public class DefaultOrderFileListener implements IOrderFileListener { ...@@ -199,7 +217,7 @@ public class DefaultOrderFileListener implements IOrderFileListener {
item.setFeederInfo(feeder); item.setFeederInfo(feeder);
item.setRi(ri); item.setRi(ri);
item.setMpn(mpn); item.setMpn(mpn);
item.setOrderType(orderType);
Map<String,String> appendValue=new HashMap<>(); Map<String,String> appendValue=new HashMap<>();
if(appendIndexMap.size()>0){ if(appendIndexMap.size()>0){
for (String key : for (String key :
......
...@@ -22,4 +22,6 @@ public interface ILiteOrderManager extends IBaseManager<LiteOrder> { ...@@ -22,4 +22,6 @@ public interface ILiteOrderManager extends IBaseManager<LiteOrder> {
LiteOrder findBySource(String source); LiteOrder findBySource(String source);
List<String> findAllLines(); List<String> findAllLines();
LiteOrder findOneByOrderNo(String orderNo);
} }
...@@ -123,6 +123,11 @@ public class LiteOrderManagerImpl implements ILiteOrderManager { ...@@ -123,6 +123,11 @@ public class LiteOrderManagerImpl implements ILiteOrderManager {
} }
@Override @Override
public LiteOrder findOneByOrderNo(String orderNo) {
return liteOrderDao.findOne(new Query(Criteria.where("orderNo").is(orderNo)));
}
@Override
public PageData<LiteOrder> findByPage(Query query, Pageable pageable) { public PageData<LiteOrder> findByPage(Query query, Pageable pageable) {
int totalCount = liteOrderDao.countByQuery(query); int totalCount = liteOrderDao.countByQuery(query);
List<LiteOrder> list = liteOrderDao.findByQuery(query, pageable); List<LiteOrder> list = liteOrderDao.findByQuery(query, pageable);
......
...@@ -94,6 +94,11 @@ public class LiteOrder extends BasePo implements Serializable { ...@@ -94,6 +94,11 @@ public class LiteOrder extends BasePo implements Serializable {
private float orderTimes = 1f; private float orderTimes = 1f;
/** /**
* 类型
*/
private String type;
/**
* 订单的详细信息 * 订单的详细信息
*/ */
@Transient @Transient
......
...@@ -98,6 +98,8 @@ public class LiteOrderItem extends BasePo implements Serializable ,Comparable<Li ...@@ -98,6 +98,8 @@ public class LiteOrderItem extends BasePo implements Serializable ,Comparable<Li
*/ */
private String barcodeStr = ""; private String barcodeStr = "";
private String orderType = "";
/** /**
* 自定义的附加字段,key=字段名,value=值 * 自定义的附加字段,key=字段名,value=值
*/ */
......
...@@ -47,6 +47,8 @@ public interface IStoragePosManager extends IBaseManager<StoragePos> { ...@@ -47,6 +47,8 @@ public interface IStoragePosManager extends IBaseManager<StoragePos> {
StoragePos getEmptyPosByStorage(Storage storage, Barcode barcode, Collection<String> excludePosIds, String lastPosId) throws ValidateException; StoragePos getEmptyPosByStorage(Storage storage, Barcode barcode, Collection<String> excludePosIds, String lastPosId) throws ValidateException;
StoragePos getEmptyPosByStorage(Storage storage, Barcode barcode, Collection<String> excludePosIds, String lastPosId, String needMovePosName, String endStr) throws ValidateException;
StoragePos getEmptyPosByStorage(Storage storage, int size, int height, Collection<String> excludePosIds) throws ValidateException; StoragePos getEmptyPosByStorage(Storage storage, int size, int height, Collection<String> excludePosIds) throws ValidateException;
List<StoragePos> findNotEmpty(); List<StoragePos> findNotEmpty();
...@@ -96,4 +98,6 @@ public interface IStoragePosManager extends IBaseManager<StoragePos> { ...@@ -96,4 +98,6 @@ public interface IStoragePosManager extends IBaseManager<StoragePos> {
StoragePos findOne(Query query); StoragePos findOne(Query query);
Sort getSortByCheckOutType(CHECKOUT_TYPE checkoutType); Sort getSortByCheckOutType(CHECKOUT_TYPE checkoutType);
int getRemainPosCountByStorage(Storage storage, Barcode barcode, Collection<String> excludePosIds, String s, String f);
} }
...@@ -9,6 +9,7 @@ import com.neotel.smfcore.common.bean.PageData; ...@@ -9,6 +9,7 @@ import com.neotel.smfcore.common.bean.PageData;
import com.neotel.smfcore.common.exception.ValidateException; import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.common.utils.DateUtil; import com.neotel.smfcore.common.utils.DateUtil;
import com.neotel.smfcore.common.utils.PointUtil; import com.neotel.smfcore.common.utils.PointUtil;
import com.neotel.smfcore.common.utils.StringUtils;
import com.neotel.smfcore.core.barcode.bean.PlateSizeBean; import com.neotel.smfcore.core.barcode.bean.PlateSizeBean;
import com.neotel.smfcore.core.barcode.service.po.Barcode; import com.neotel.smfcore.core.barcode.service.po.Barcode;
import com.neotel.smfcore.core.storage.bean.InventoryItem; import com.neotel.smfcore.core.storage.bean.InventoryItem;
...@@ -360,6 +361,38 @@ public class StoragePosManagerImpl implements IStoragePosManager { ...@@ -360,6 +361,38 @@ public class StoragePosManagerImpl implements IStoragePosManager {
} }
@Override @Override
public int getRemainPosCountByStorage(Storage storage, Barcode barcode, Collection<String> excludePosIds, String s, String endStr) {
Criteria c = Criteria.where("storageId").is(storage.getId());
COMPATIBLE_TYPE compatibleType = storage.getCompatibleType();
if (compatibleType == COMPATIBLE_TYPE.EXACT_MATCH) {//完全匹配
c = c.and("w").is(barcode.getPlateSize()).and("h").is(barcode.getHeight());
} else if (compatibleType == COMPATIBLE_TYPE.FULLY_COMPATIBLE) {//同厚度兼容
c = c.and("w").gte(barcode.getPlateSize()).and("h").gte(barcode.getHeight());//除7寸外,完全兼容
} else if (compatibleType == COMPATIBLE_TYPE.SIZE_COMPATIBLE) {//同尺寸兼容
c = c.and("w").is(barcode.getPlateSize()).and("h").gte(barcode.getHeight());//宽度等于料盘宽度,高度大于等于料盘高度
}
c = c.and("enabled").is(true)//可用
.and("used").is(false);//未使用
//去除的仓位
if (excludePosIds != null && !excludePosIds.isEmpty()) {
c = c.and("id").nin(excludePosIds);
}
if (StringUtils.isNotEmpty(endStr)) {
String regex = "" + endStr + "$";
c.and("posName").regex(Pattern.compile(regex));
}
Query query = new Query(c);
query.with(Sort.by(Sort.Direction.ASC, "w").and(Sort.by(Sort.Direction.ASC, "h")).and(Sort.by(Sort.Direction.DESC, "priority")));
return storagePosDao.countByQuery(query);
}
@Override
public PageData<StoragePos> findByPage(Query query, Pageable pageable) { public PageData<StoragePos> findByPage(Query query, Pageable pageable) {
int totalCount = storagePosDao.countByQuery(query); int totalCount = storagePosDao.countByQuery(query);
List<StoragePos> list = storagePosDao.findByQuery(query, pageable); List<StoragePos> list = storagePosDao.findByQuery(query, pageable);
...@@ -496,6 +529,57 @@ public class StoragePosManagerImpl implements IStoragePosManager { ...@@ -496,6 +529,57 @@ public class StoragePosManagerImpl implements IStoragePosManager {
return pos; return pos;
} }
@Override
public StoragePos getEmptyPosByStorage(Storage storage, Barcode barcode, Collection<String> excludePosIds, String lastPosId, String needMovePosName, String endStr) throws ValidateException {
Criteria c = Criteria.where("storageId").is(storage.getId());
COMPATIBLE_TYPE compatibleType = storage.getCompatibleType();
if (compatibleType == COMPATIBLE_TYPE.EXACT_MATCH) {//完全匹配
c = c.and("w").is(barcode.getPlateSize()).and("h").is(barcode.getHeight());
} else if (compatibleType == COMPATIBLE_TYPE.FULLY_COMPATIBLE) {//同厚度兼容
c = c.and("w").gte(barcode.getPlateSize()).and("h").gte(barcode.getHeight());//除7寸外,完全兼容
} else if (compatibleType == COMPATIBLE_TYPE.SIZE_COMPATIBLE) {//同尺寸兼容
c = c.and("w").is(barcode.getPlateSize()).and("h").gte(barcode.getHeight());//宽度等于料盘宽度,高度大于等于料盘高度
}
c = c.and("enabled").is(true)//可用
.and("used").is(false);//未使用
//去除的仓位
if (excludePosIds != null && !excludePosIds.isEmpty()) {
c = c.and("id").nin(excludePosIds);
}
if (StringUtils.isNotEmpty(needMovePosName) && StringUtils.isNotEmpty(endStr)) {
Criteria posNameCriteria = new Criteria();
String regex = ""+endStr+"$";
posNameCriteria.andOperator(Criteria.where("posName").ne(needMovePosName), Criteria.where("posName").regex(Pattern.compile(regex)));
c.andOperator(posNameCriteria);
}
Query query = new Query(c);
String msg = "";
// if (lastPosId == null || lastPosId.equals("")) {
//优先放入最合适的位置(根据尺寸),相同尺寸按优先级排序
query.with(Sort.by(Sort.Direction.ASC, "w").and(Sort.by(Sort.Direction.ASC, "h")).and(Sort.by(Sort.Direction.DESC, "priority")));
// } else {
// Point point = PointUtil.getPosPoint(lastPosId, false);
// query.addCriteria(Criteria.where("coordinate").nearSphere(point));
// msg += "getEmptyPosByStorage 根据就近坐标查询[" + lastPosId + "][" + point.getX() + "," + point.getY() + "]";
// }
StoragePos pos = storagePosDao.findOne(query);
if ((!ObjectUtil.isNotEmpty(msg) )&& (pos != null)) {
Point targetP = PointUtil.getPosPoint(lastPosId, false);
log.debug(msg + "结果:[" + pos.getPosName() + "][" + targetP.getX() + "," + targetP.getY() + "]");
}
return pos;
}
@Override @Override
public StoragePos getEmptyPosByStorage(Storage storage, int size,int height, Collection<String> excludePosIds ) throws ValidateException { public StoragePos getEmptyPosByStorage(Storage storage, int size,int height, Collection<String> excludePosIds ) throws ValidateException {
......
...@@ -29,6 +29,8 @@ public class OrderSetting implements Serializable { ...@@ -29,6 +29,8 @@ public class OrderSetting implements Serializable {
public String mpn="MPN"; public String mpn="MPN";
public String orderType = "ORDERTYPE";
/** /**
* 自定义的附加字段,key=字段名,value=表头名称 * 自定义的附加字段,key=字段名,value=表头名称
*/ */
......
...@@ -238,6 +238,7 @@ public class SettingsController { ...@@ -238,6 +238,7 @@ public class SettingsController {
titles.add(orderSetting.getSo()); titles.add(orderSetting.getSo());
titles.add(orderSetting.getNum()); titles.add(orderSetting.getNum());
titles.add(orderSetting.getMpn()); titles.add(orderSetting.getMpn());
titles.add(orderSetting.getOrderType());
for(int i=1;i<=10;i++) { for(int i=1;i<=10;i++) {
Map<String, Object> map = new LinkedHashMap<>(); Map<String, Object> map = new LinkedHashMap<>();
...@@ -249,6 +250,7 @@ public class SettingsController { ...@@ -249,6 +250,7 @@ public class SettingsController {
map.put(orderSetting.getSo(),"WO1001" ); map.put(orderSetting.getSo(),"WO1001" );
map.put(orderSetting.getNum(),i); map.put(orderSetting.getNum(),i);
map.put(orderSetting.getMpn(),"MPN"+i); map.put(orderSetting.getMpn(),"MPN"+i);
map.put(orderSetting.getOrderType(),"First/Remaining");
} }
else{ else{
map.put(orderSetting.getPn(),"PN2"+i); map.put(orderSetting.getPn(),"PN2"+i);
...@@ -258,6 +260,7 @@ public class SettingsController { ...@@ -258,6 +260,7 @@ public class SettingsController {
map.put(orderSetting.getSo(),"WO1002" ); map.put(orderSetting.getSo(),"WO1002" );
map.put(orderSetting.getNum(),i); map.put(orderSetting.getNum(),i);
map.put(orderSetting.getMpn(),"MPN"+i); map.put(orderSetting.getMpn(),"MPN"+i);
map.put(orderSetting.getOrderType(),"First/Remaining");
} }
maps.add(map); maps.add(map);
} }
......
...@@ -10,6 +10,7 @@ import com.neotel.smfcore.core.device.enums.OP_STATUS; ...@@ -10,6 +10,7 @@ import com.neotel.smfcore.core.device.enums.OP_STATUS;
import com.neotel.smfcore.core.storage.service.po.Storage; import com.neotel.smfcore.core.storage.service.po.Storage;
import com.neotel.smfcore.core.storage.service.po.StoragePos; import com.neotel.smfcore.core.storage.service.po.StoragePos;
import com.neotel.smfcore.core.system.bean.MSDAppendInfo; import com.neotel.smfcore.core.system.bean.MSDAppendInfo;
import io.swagger.models.auth.In;
import lombok.Data; import lombok.Data;
import org.springframework.data.mongodb.core.mapping.Document; import org.springframework.data.mongodb.core.mapping.Document;
...@@ -252,6 +253,11 @@ public class DataLog extends BasePo implements Serializable ,Comparable<DataLog> ...@@ -252,6 +253,11 @@ public class DataLog extends BasePo implements Serializable ,Comparable<DataLog>
//是否关闭 //是否关闭
private boolean closed = false; private boolean closed = false;
private boolean outFromPos = false;
private Integer soltNum;
private String so;
public String getBarcode() { public String getBarcode() {
if(barcode == null){ if(barcode == null){
......
...@@ -809,7 +809,7 @@ public class TaskService { ...@@ -809,7 +809,7 @@ public class TaskService {
* @param barcode * @param barcode
* @return * @return
*/ */
public StoragePos findEmptyPosForMoveIn(List<Storage> storageList, Barcode barcode, String inRFID, String lastPosId) throws ValidateException { public StoragePos findEmptyPosForMoveIn(List<Storage> storageList, Barcode barcode, String inRFID, String lastPosId,String needMovePosName,String endStr) throws ValidateException {
Collection<DataLog> queueTasks = getQueueTasks(); Collection<DataLog> queueTasks = getQueueTasks();
List<DataLog> allTasksa = getFinishedTasks(); List<DataLog> allTasksa = getFinishedTasks();
if (!queueTasks.isEmpty()) { if (!queueTasks.isEmpty()) {
...@@ -842,11 +842,11 @@ public class TaskService { ...@@ -842,11 +842,11 @@ public class TaskService {
//如果有正在执行的任务,把库位发过去 //如果有正在执行的任务,把库位发过去
Collection<DataLog> allTasks = taskMap.values(); Collection<DataLog> allTasks = taskMap.values();
for (DataLog task : allTasks) { for (DataLog task : allTasks) {
if (barcode.getBarcode().equals(task.getBarcode())) { /*if (barcode.getBarcode().equals(task.getBarcode())) {
String posId = task.getPosId(); String posId = task.getPosId();
log.info(barcode.getBarcode() + " 已有任务,返回任务中的库位:" + task.getPosName()); log.info(barcode.getBarcode() + " 已有任务,返回任务中的库位:" + task.getPosName());
return storagePosManager.get(posId); return storagePosManager.get(posId);
} }*/
String storageId = task.getStorageId(); String storageId = task.getStorageId();
if (!Strings.isNullOrEmpty(storageId)) { if (!Strings.isNullOrEmpty(storageId)) {
...@@ -915,12 +915,15 @@ public class TaskService { ...@@ -915,12 +915,15 @@ public class TaskService {
} }
}); });
return findEmptyPosInStorages(barcode, availbleStorageList, hasOutTaskStorageIds, lastPosId); return findEmptyPosInStorages(barcode, availbleStorageList, hasOutTaskStorageIds, lastPosId,needMovePosName,endStr);
}
private synchronized StoragePos findEmptyPosInStorages(Barcode barcode, List<Storage> availbleStorageList, final Set<String> hasOutTaskStorageIds, String lastPosId){
return findEmptyPosInStorages(barcode,availbleStorageList,hasOutTaskStorageIds,lastPosId,"","");
} }
private synchronized StoragePos findEmptyPosInStorages(Barcode barcode, List<Storage> availbleStorageList, final Set<String> hasOutTaskStorageIds, String lastPosId) { private synchronized StoragePos findEmptyPosInStorages(Barcode barcode, List<Storage> availbleStorageList, final Set<String> hasOutTaskStorageIds, String lastPosId,String needMovePosName,String endStr) {
StoragePos findPos=null;
//第一遍查找,先不查找有出库任务的料仓 //第一遍查找,先不查找有出库任务的料仓
for (Storage storage : availbleStorageList) { for (Storage storage : availbleStorageList) {
if(!storage.isSmdDuo()){//DUO料仓无论是否有出库任务,都可以查找空库位 if(!storage.isSmdDuo()){//DUO料仓无论是否有出库任务,都可以查找空库位
...@@ -931,19 +934,9 @@ public class TaskService { ...@@ -931,19 +934,9 @@ public class TaskService {
try { try {
Collection<String> operatingPosIds = excludePosIds(); Collection<String> operatingPosIds = excludePosIds();
log.debug("尝试从[" + storage.getCid() + "]中为[" + barcode.getBarcode() + "]查找空位"); log.debug("尝试从[" + storage.getCid() + "]中为[" + barcode.getBarcode() + "]查找空位");
StoragePos pos = storagePosManager.getEmptyPosByStorage(storage, barcode, operatingPosIds, lastPosId); StoragePos pos = storagePosManager.getEmptyPosByStorage(storage, barcode, operatingPosIds, lastPosId,needMovePosName,endStr);
if (pos != null) { if (pos != null) {
//判断尺寸是否一致
if(isSameSize(barcode,pos)){
log.info("尝试从[" + storage.getCid() + "]中为[" + barcode.getBarcode() + "]查找到空位["+pos.getPosName()+"],尺寸与条码一致,直接返回");
return pos; return pos;
}else if(findPos==null){
log.info("尝试从[" + storage.getCid() + "]中为[" + barcode.getBarcode() + "]查找到空位["+pos.getPosName()+"],尺寸不一致,先暂存库位");
findPos=pos;
}else if(findPos.getW()> pos.getW()||findPos.getH()>pos.getH()){
log.info("尝试从[" + storage.getCid() + "]中为[" + barcode.getBarcode() + "]查找到空位["+pos.getPosName()+"],比暂存库位["+findPos.getPosName()+"]跟匹配,替换为暂存库位");
findPos=pos;
}
} }
} catch (Exception e) { } catch (Exception e) {
log.error("尝试从[" + storage.getCid() + "]中为[" + barcode.getBarcode() + "]查找空位失败:" + e.getMessage()); log.error("尝试从[" + storage.getCid() + "]中为[" + barcode.getBarcode() + "]查找空位失败:" + e.getMessage());
...@@ -954,27 +947,14 @@ public class TaskService { ...@@ -954,27 +947,14 @@ public class TaskService {
try { try {
Collection<String> operatingPosIds = excludePosIds(); Collection<String> operatingPosIds = excludePosIds();
log.debug("尝试从[" + storage.getCid() + "]中为[" + barcode.getBarcode() + "]查找空位"); log.debug("尝试从[" + storage.getCid() + "]中为[" + barcode.getBarcode() + "]查找空位");
StoragePos pos = storagePosManager.getEmptyPosByStorage(storage, barcode, operatingPosIds, lastPosId); StoragePos pos = storagePosManager.getEmptyPosByStorage(storage, barcode, operatingPosIds, lastPosId,needMovePosName,endStr);
if (pos != null) { if (pos != null) {
if(isSameSize(barcode,pos)){
log.info("尝试从[" + storage.getCid() + "]中为[" + barcode.getBarcode() + "]查找到空位["+pos.getPosName()+"],尺寸与条码一致,直接返回");
return pos; return pos;
}else if(findPos==null){
log.info("尝试从[" + storage.getCid() + "]中为[" + barcode.getBarcode() + "]查找到空位["+pos.getPosName()+"],尺寸不一致,先暂存库位");
findPos=pos;
}else if(findPos.getW()> pos.getW()||findPos.getH()>pos.getH()){
log.info("尝试从[" + storage.getCid() + "]中为[" + barcode.getBarcode() + "]查找到空位["+pos.getPosName()+"],比暂存库位["+findPos.getPosName()+"]跟匹配,替换为暂存库位");
findPos=pos;
}
} }
} catch (Exception e) { } catch (Exception e) {
log.error("尝试从[" + storage.getCid() + "]中为[" + barcode.getBarcode() + "]查找空位失败:" + e.getMessage()); log.error("尝试从[" + storage.getCid() + "]中为[" + barcode.getBarcode() + "]查找空位失败:" + e.getMessage());
} }
} }
if(findPos!=null){
log.info("为[" + barcode.getBarcode() + "]未查找到尺寸一直的库位,返回暂存的库位["+findPos.getPosName()+"]");
return findPos;
}
try { try {
String cids = ""; String cids = "";
for (Storage storage : availbleStorageList) { for (Storage storage : availbleStorageList) {
......
package com.neotel.smfcore.custom.zhongche1568;
import com.alibaba.fastjson.JSONObject;
import com.neotel.smfcore.common.exception.ApiException;
import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.common.utils.HttpHelper;
import com.neotel.smfcore.core.api.listener.BaseSmfApiListener;
import com.neotel.smfcore.core.order.service.po.LiteOrder;
import com.neotel.smfcore.core.system.service.po.DataLog;
import com.neotel.smfcore.custom.zhongche1568.bean.api.MaterialCountResult;
import com.neotel.smfcore.custom.zhongche1568.bean.shelf.ShelfInfo;
import com.neotel.smfcore.custom.zhongche1568.bean.shelf.ShelfLocInfo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Service
@Slf4j
public class ZhongcheApi extends BaseSmfApiListener {
@Value("${api.materialCountUrl}")
private String materialCountUrl;
@Value("${api.postCountDataUrl}")
private String postCountDataUrl;
@Value("${api.shelfFullNotificationUrl}")
private String shelfFullNotificationUrl;
@Override
public boolean isForThisApi(String apiName) {
return "1568".equals(apiName);
}
@Override
public LiteOrder fetchOrder(String fetchOrderUrl, String orderNumber, String username) {
return super.fetchOrder(fetchOrderUrl, orderNumber, username);
}
@Override
public void inTaskStatusChange(String inNotifyUrl, DataLog task) {
if (task.isFinished()) {
String barcode = task.getBarcode();
String posName = task.getPosName();
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("reelId", barcode);
paramMap.put("location", posName);
log.info("入库完成,reelId为:" + barcode + ",库位信息为:" + posName + ",地址为:" + inNotifyUrl);
try {
String result = HttpHelper.postJson(inNotifyUrl, paramMap);
log.info(barcode + "入完完成,返回结果为:" + result);
} catch (ApiException e) {
e.printStackTrace();
}
}
}
public MaterialCountResult materialCount(String reelId, String fullCode) {
log.info("判断是否点料,reelId为:" + reelId + ",fullCode为:" + fullCode + ",地址为:" + materialCountUrl);
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("reelId", reelId);
paramMap.put("fullCode", fullCode);
try {
String result = HttpHelper.postJson(materialCountUrl, paramMap);
JSONObject resultObj = JSONObject.parseObject(result);
Integer code = resultObj.getInteger("code");
if (code != 0) {
String msg = resultObj.getString("msg");
throw new ValidateException("smfcore.barcode.checkError", "[{0}]", new String[]{msg});
}
return resultObj.getObject("data", MaterialCountResult.class);
} catch (Exception e) {
throw new ValidateException("smfcore.barcode.checkNg", "验证失败:{0}", new String[]{e.getMessage()});
}
}
public void postCountData(String reelId, int countQty) {
log.info("判断是否点料,reelId为:" + reelId + ",数量为:" + countQty + ",地址为:" + postCountDataUrl);
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("reelId", reelId);
paramMap.put("countQty", countQty);
String result = "";
try {
result = HttpHelper.postJson(postCountDataUrl, paramMap);
JSONObject resultObj = JSONObject.parseObject(result);
Integer code = resultObj.getInteger("code");
if (code != 0) {
String msg = resultObj.getString("msg");
throw new ValidateException("smfcore.barcode.checkError", "[{0}]", new String[]{msg});
}
} catch (ApiException e) {
throw new ValidateException("smfcore.barcode.checkNg", "验证失败:{0}", new String[]{e.getMessage()});
}
}
public void shelfFullNotification(ShelfInfo shelfInfo, boolean lastShelf) {
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("hSerial", shelfInfo.getOrderNo());
paramMap.put("containerNo", shelfInfo.getShelfNo());
paramMap.put("lastContainer", lastShelf);
paramMap.put("line", shelfInfo.getLine());
paramMap.put("so", shelfInfo.getSo());
List<Map<String, String>> itemList = new ArrayList<>();
for (ShelfLocInfo info : shelfInfo.getShelfLocInfoMap().values()) {
Map<String, String> itemMap = new HashMap<>();
itemMap.put("slotNum", info.getSlotNum() + "");
itemMap.put("reelId", info.getBarcode());
itemMap.put("location", info.getLoc());
itemList.add(itemMap);
}
paramMap.put("outItems", itemList);
try {
String result = HttpHelper.postJson(shelfFullNotificationUrl, paramMap);
JSONObject resultObj = JSONObject.parseObject(result);
Integer code = resultObj.getInteger("code");
if (code != 0) {
String msg = resultObj.getString("msg");
throw new ValidateException("smfcore.barcode.checkError", "[{0}]", new String[]{msg});
}
} catch (ApiException e) {
throw new ValidateException("smfcore.barcode.checkNg", "验证失败:{0}", new String[]{e.getMessage()});
}
}
}
package com.neotel.smfcore.custom.zhongche1568.bean.api;
import lombok.Data;
@Data
public class CreateOrderItem {
private String reelId;
private int slotNum;
}
package com.neotel.smfcore.custom.zhongche1568.bean.api;
import lombok.Data;
import java.util.List;
@Data
public class CreateOrderRequest {
private String hSerial;
private String type;
private String line;
private String so;
private List<CreateOrderItem> outItems;
}
package com.neotel.smfcore.custom.zhongche1568.bean.api;
import lombok.Data;
@Data
public class MaterialCountResult {
/**
* NOT_COUNT_IN=不需要点料直接入库
* COUNT_IN=点料后入库
* COUNT_NOT_IN=点料不入库
* NOT_COUNT_NOT_IN=不点料且不入库
*/
private String materialType;
private String reelId;
}
package com.neotel.smfcore.custom.zhongche1568.bean.shelf;
import com.google.common.collect.Maps;
import lombok.Data;
import java.util.List;
import java.util.Map;
/**
* 虚拟货架信息
*/
@Data
public class ShelfInfo {
/**
* 13/15寸 容量是5
*/
public static final int Big_Reel_Capacity = 5;
/**
* 7寸 容量是20
*/
public static final int Small_Reel_Capacity = 20;
/**
* 大料盘已放入数量
*/
private int bigReelCount = 0;
/**
* 小料盘已经放入数量
*/
private int smallReelCount = 0;
/**
* 货架编号
*/
private String shelfNo;
/**
* 工单号
*/
private String orderNo;
/**
* 线体
*/
private String line;
/**
* 工单号
*/
private String so;
/**
* 工单状态
*/
private int status;
/**
* key为barcode信息,value为货架具体信息
*/
private Map<String, ShelfLocInfo> shelfLocInfoMap = Maps.newConcurrentMap();
public boolean hasBigCapacity() {
return Big_Reel_Capacity - this.bigReelCount > 0;
}
public boolean hasSmallCapacity() {
return Small_Reel_Capacity - this.smallReelCount > 0;
}
}
package com.neotel.smfcore.custom.zhongche1568.bean.shelf;
import lombok.AllArgsConstructor;
import lombok.Data;
@Data
@AllArgsConstructor
public class ShelfLocInfo {
private String orderNo;
private String barcode;
private String partNumber;
private int amount;
private String loc;
private String shelfNo;
private int slotNum;
}
package com.neotel.smfcore.custom.zhongche1568.controller;
import com.neotel.smfcore.common.bean.ResultBean;
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.storage.service.po.Storage;
import com.neotel.smfcore.core.system.service.po.DataLog;
import com.neotel.smfcore.core.system.util.TaskService;
import com.neotel.smfcore.custom.zhongche1568.ZhongcheApi;
import com.neotel.smfcore.custom.zhongche1568.bean.shelf.ShelfInfo;
import com.neotel.smfcore.custom.zhongche1568.bean.shelf.ShelfLocInfo;
import com.neotel.smfcore.custom.zhongche1568.enums.ShelfStatus;
import com.neotel.smfcore.custom.zhongche1568.util.ShelfInfoUtil;
import com.neotel.smfcore.security.annotation.AnonymousAccess;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Api(tags = "货架控制类")
@RequestMapping("/shelf")
@Slf4j
@RestController
public class ShelfController {
@Autowired
private CodeResolve codeResolve;
@Autowired
private ShelfInfoUtil shelfInfoUtil;
@Autowired
private TaskService taskService;
@Autowired
private DataCache dataCache;
@Autowired
private ZhongcheApi zhongcheApi;
@ApiOperation("物料放到货架上")
@RequestMapping("/reelToShelf")
@ResponseBody
@AnonymousAccess
public ResultBean reelToShelf(@RequestBody Map<String, String> paramMap) {
String code = paramMap.get("code");
String shelfNo = paramMap.get("shelfNo");
String shelfLoc = paramMap.get("shelfLoc");
log.info("物料:" + code + "放到对应的料架:" + shelfNo + "上,库位为:" + shelfLoc);
Barcode barcode = codeResolve.resolveOneValideBarcode(code);
if (barcode == null) {
return ResultBean.newErrorResult(-1, "smfcore.error.barcode.invalid", "未找到有效的条码");
}
//获取到当前执行的任务
DataLog opTask = null;
Collection<DataLog> allTasks = taskService.getAllTasks();
//log.info("所有任务为:"+ JSON.toJSONString(allTasks));
for (DataLog task : allTasks) {
if (task.isCheckOutTask() && task.getBarcode().startsWith(code)) {
if (!task.isCancel() && !task.isFinished()) {
opTask = task;
break;
}
}
}
if (opTask == null) {
return ResultBean.newErrorResult(303, "smfcore.task.notExist", "任务不存在");
}
//判断是否在货架上
ShelfLocInfo shelfLocInfo = shelfInfoUtil.getShelfLocByBarcode(barcode.getBarcode());
if (shelfLocInfo != null) {
log.info(barcode.getBarcode() + ",已经存在料架:" + shelfLocInfo.getShelfNo() + ",库位为:" + shelfLocInfo.getLoc());
return ResultBean.newErrorResult(-1,"smfcore.barcode.inShelf","[{0}]已在料架[{1}],库位[{2}]中",new String[]{barcode.getBarcode(),shelfLocInfo.getShelfNo(),shelfLocInfo.getLoc()});
}
//更新料架信息
shelfInfoUtil.updateShelfInfo(barcode.getPlateSize() > 7,
opTask.getLine(),
opTask.getSourceName(),
opTask.getSo(),
shelfNo,
shelfLoc,
barcode.getBarcode(),
barcode.getPartNumber(),
opTask.getSoltNum(),
opTask.getNum(),
ShelfStatus.reachOutLet
);
return ResultBean.newOkResult("");
}
@ApiOperation("货架拉走")
@RequestMapping("/shelfToLine")
@AnonymousAccess
public ResultBean shelfToLine(@RequestBody Map<String, String> paramMap) {
String shelfNo = paramMap.get("shelfNo");
String lastShelfStr = paramMap.get("lastShelf");
log.info("货架:" + shelfNo + "准备拉走,是否为最后一个货架:"+lastShelfStr);
Boolean lastShelf = Boolean.valueOf(lastShelfStr);
if (StringUtils.isEmpty(shelfNo)) {
return ResultBean.newErrorResult(-1, "smfcore.valueCanotNull", "{0}不能为空", new String[]{"shelfNo"});
}
//判断货架是否存在
boolean exist = shelfInfoUtil.isExistShelf(shelfNo);
if (!exist) {
return ResultBean.newErrorResult(-1, "smfcore.valueNotExist", "{0}[{1}]不存在", new String[]{"货架信息", shelfNo});
}
ShelfInfo shelfInfo = shelfInfoUtil.getShelfInfoByShelfNo(shelfNo);
Map<String, Object> resultMap = new HashMap<>();
resultMap.put("shelfNo", shelfInfo.getShelfNo());
resultMap.put("orderNo", shelfInfo.getOrderNo());
resultMap.put("line", shelfInfo.getLine());
//查找有没有料架任务
boolean hasShelfTask = false;
if (StringUtils.isNotEmpty(shelfInfo.getOrderNo())) {
List<DataLog> allTasks = taskService.getAllTasks();
for (DataLog dataLog : allTasks) {
if (dataLog.isCheckOutTask() && !dataLog.isCancel() && !dataLog.isFinished()) {
if (shelfInfo.getOrderNo().equals(dataLog.getSourceName())) {
Storage storage = dataCache.getStorage(dataLog.getCid());
if (storage.isNLShelf() || storage.isNLPShelf() || storage.isNLMShelf() || storage.isShelf()){
hasShelfTask = true;
}
}
}
}
}
resultMap.put("hasShelfTask", hasShelfTask);
//同时更改任务信息
shelfInfoUtil.updateShelfLoc(shelfNo, ShelfStatus.outLetToLine);
ShelfInfo info = shelfInfoUtil.getShelfInfoByShelfNo(shelfNo);
//通知wms
zhongcheApi.shelfFullNotification(info,lastShelf);
return ResultBean.newOkResult(resultMap);
}
@ApiOperation("货架到达线体")
@RequestMapping("/shelfReachLine")
@ResponseBody
@AnonymousAccess
public ResultBean shelfReachLine(@RequestBody Map<String, String> paramMap) {
String shelfNo = paramMap.get("shelfNo");
String shelfLoc = paramMap.get("shelfLoc");
log.info("货架:" + shelfNo + "到达线体位置:"+shelfLoc);
if (StringUtils.isEmpty(shelfNo)) {
return ResultBean.newErrorResult(-1, "smfcore.valueCanotNull", "{0}不能为空", new String[]{"shelfNo"});
}
//判断货架是否存在
boolean exist = shelfInfoUtil.isExistShelf(shelfNo);
if (!exist) {
return ResultBean.newErrorResult(-1, "smfcore.valueNotExist", "{0}[{1}]不存在", new String[]{"货架信息", shelfNo});
}
shelfInfoUtil.updateShelfLoc(shelfNo, ShelfStatus.reachLine);
return ResultBean.newOkResult("");
}
}
package com.neotel.smfcore.custom.zhongche1568.controller;
import com.alibaba.fastjson.JSON;
import com.neotel.smfcore.common.bean.ResultBean;
import com.neotel.smfcore.common.utils.StringUtils;
import com.neotel.smfcore.core.order.LiteOrderCache;
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.LiteOrderItem;
import com.neotel.smfcore.custom.zhongche1568.bean.api.CreateOrderItem;
import com.neotel.smfcore.custom.zhongche1568.bean.api.CreateOrderRequest;
import com.neotel.smfcore.custom.zhongche1568.enums.ZhongCheOrderType;
import com.neotel.smfcore.security.annotation.AnonymousAccess;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Api(tags = "中车项目")
@Slf4j
@RestController
public class ZhongCheController {
@Autowired
private ILiteOrderManager liteOrderManager;
@Autowired
private LiteOrderCache liteOrderCache;
@ApiOperation("创建需求单")
@AnonymousAccess
@PostMapping("/zhongChe/createOrder")
public ResultBean createOrder(@RequestBody CreateOrderRequest request) {
log.info("创建需求单,请求参数为:" + JSON.toJSONString(request));
String type = request.getType();
if (!ZhongCheOrderType.FIRST.equals(type) && !ZhongCheOrderType.REMAINING.equals(type)) {
return ResultBean.newErrorResult(-1, "smfcore.valueInvalid", "[{0}]不是有效的参数", new String[]{"type"});
}
//判断工单号是否存在
String hSerial = request.getHSerial();
LiteOrder liteOrder = liteOrderManager.findOneByOrderNo(hSerial);
if (liteOrder != null) {
return ResultBean.newErrorResult(-1, "smfcore.valueAlreadyExist", "{0}[{1}]已存在", new String[]{"hSerial", hSerial});
}
//创建工单
liteOrder = new LiteOrder();
liteOrder.setOrderNo(hSerial);
liteOrder.setType(type);
liteOrder.setSo(request.getSo());
liteOrder.setLine(request.getLine());
//开始处理工单详情信息
List<CreateOrderItem> outItems = request.getOutItems();
if (outItems == null || outItems.isEmpty()) {
return ResultBean.newErrorResult(-1, "smfcore.valueCanotNull", "{0}不能为空", new String[]{"outItems"});
}
List<LiteOrderItem> orderItemList = new ArrayList<>();
//按站位编号进行排序
outItems = outItems.stream().sorted(Comparator.comparing(CreateOrderItem::getSlotNum)).collect(Collectors.toList());
for (CreateOrderItem outItem : outItems) {
String reelId = outItem.getReelId();
if (StringUtils.isEmpty(reelId)){
return ResultBean.newErrorResult(-1, "smfcore.valueCanotNull", "{0}不能为空", new String[]{"reelId"});
}
int slotNum = outItem.getSlotNum();
LiteOrderItem orderItem = new LiteOrderItem();
orderItem.setRi(reelId);
orderItem.setSlotNum(slotNum);
orderItem.setNeedReelCount(1);
orderItemList.add(orderItem);
}
liteOrder.setOrderItems(orderItemList);
liteOrder = liteOrderManager.createWithItems(liteOrder);
liteOrderCache.addOrderToMap(liteOrder);
return ResultBean.newOkResult("");
}
@ApiOperation("亮灯接口")
@AnonymousAccess
@PostMapping("/rest/crrc/api/openLed")
public ResultBean openLed(@RequestBody Map<String, String> paramMap) {
String line = paramMap.get("line");
String partNum = paramMap.get("partNum");
log.info("收到亮灯指令,线体为:" + line + ",partNum为:" + partNum);
return ResultBean.newOkResult("");
}
@ApiOperation("灭灯接口")
@AnonymousAccess
@PostMapping("/rest/crrc/api/closeLed")
public ResultBean closeLed(@RequestBody Map<String,String> paramMap) {
String reelId = paramMap.get("reelId");
log.info("收到亮灯指令,reelId为" + reelId);
return ResultBean.newOkResult("");
}
}
package com.neotel.smfcore.custom.zhongche1568.enums;
public class ShelfStatus {
//到达出料口
public static final int reachOutLet = 0;
//从出料口到线体
public static final int outLetToLine = 1;
//到达线体位置
public static final int reachLine = 2;
}
package com.neotel.smfcore.custom.zhongche1568.enums;
public class ZhongCheOrderLoc {
public static final String BELTLINE = "Line";
}
package com.neotel.smfcore.custom.zhongche1568.enums;
public class ZhongCheOrderType {
//首套料
public static final String FIRST = "First";
//补料
public static final String REMAINING = "Remaining";
}
package com.neotel.smfcore.custom.zhongche1568.util;
import com.google.common.collect.Maps;
import com.neotel.smfcore.common.utils.Constants;
import com.neotel.smfcore.core.device.util.DataCache;
import com.neotel.smfcore.custom.zhongche1568.bean.shelf.ShelfInfo;
import com.neotel.smfcore.custom.zhongche1568.bean.shelf.ShelfLocInfo;
import com.neotel.smfcore.custom.zhongche1568.enums.ShelfStatus;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.PostConstruct;
import java.util.Map;
@Api(tags = "虚拟货架工具类")
@Slf4j
@Service
public class ShelfInfoUtil {
@Autowired
private DataCache dataCache;
Map<String, ShelfInfo> shelfInfoMap = Maps.newConcurrentMap();
@PostConstruct
private void initMap() {
Map<String, ShelfInfo> cacheMap = dataCache.getCache(Constants.Cache_ShelfInfo);
if (cacheMap == null){
cacheMap = Maps.newConcurrentMap();
}
shelfInfoMap.putAll(cacheMap);
}
public void updateShelfInfo(boolean bigReel,
String line,
String orderNo,
String so,
String shelfNo,
String shelfLoc,
String barcode,
String partNumber,
int soltNum,
int amount,
int shelfStatus) {
ShelfInfo shelfInfo = shelfInfoMap.get(shelfNo);
if (shelfInfo == null) {
shelfInfo = new ShelfInfo();
}
shelfInfo.setShelfNo(shelfNo);
shelfInfo.setOrderNo(orderNo);
if (bigReel) {
shelfInfo.setBigReelCount(shelfInfo.getBigReelCount() + 1);
} else {
shelfInfo.setSmallReelCount(shelfInfo.getSmallReelCount() + 1);
}
shelfInfo.setLine(line);
shelfInfo.setStatus(shelfStatus);
shelfInfo.setSo(so);
//更改料架信息
Map<String, ShelfLocInfo> shelfLocInfoMap = shelfInfo.getShelfLocInfoMap();
ShelfLocInfo shelfLocInfo = new ShelfLocInfo(orderNo, barcode, partNumber, amount, shelfLoc, shelfNo, soltNum);
shelfLocInfoMap.put(shelfLocInfo.getBarcode(), shelfLocInfo);
shelfInfo.setShelfLocInfoMap(shelfLocInfoMap);
//更新缓存信息
shelfInfoMap.put(shelfInfo.getShelfNo(), shelfInfo);
dataCache.updateCache(Constants.Cache_ShelfInfo, shelfInfoMap);
}
public ShelfLocInfo getShelfLocByBarcode(String barcode) {
if (shelfInfoMap != null && !shelfInfoMap.isEmpty()) {
for (ShelfInfo info : shelfInfoMap.values()) {
Map<String, ShelfLocInfo> shelfLocInfoMap = info.getShelfLocInfoMap();
if (shelfLocInfoMap != null && !shelfLocInfoMap.isEmpty()) {
ShelfLocInfo shelfLocInfo = shelfLocInfoMap.get(barcode);
if (shelfLocInfo != null){
return shelfLocInfo;
}
}
}
}
return null;
}
public boolean isExistShelf(String shelfNo) {
if (shelfInfoMap != null && !shelfInfoMap.isEmpty()){
return shelfInfoMap.containsKey(shelfNo);
}
return false;
}
public void updateShelfLoc(String shelfNo, int status) {
if (shelfInfoMap != null && !shelfInfoMap.isEmpty()) {
ShelfInfo shelfInfo = shelfInfoMap.get(shelfNo);
if (shelfInfo != null) {
shelfInfo.setStatus(status);
shelfInfoMap.put(shelfNo,shelfInfo);
dataCache.updateCache(Constants.Cache_ShelfInfo, shelfInfoMap);
}
}
}
public ShelfInfo getShelfInfoByShelfNo(String shelfNo) {
return shelfInfoMap.get(shelfNo);
}
}
...@@ -2,10 +2,15 @@ server: ...@@ -2,10 +2,15 @@ server:
port: 8800 port: 8800
api: api:
name: name: 1568
inCheckUrl: inCheckUrl: #入库验证
outNotifyUrl: outNotifyUrl: #出库通知
inNotifyUrl: inNotifyUrl: #入库通知
fetchOrderUrl: #获取工单
materialCountUrl: #是否点料
postCountDataUrl: #点料结果上传
shelfFullNotificationUrl: #货架放满通知
...@@ -47,7 +52,7 @@ app: ...@@ -47,7 +52,7 @@ app:
type: "" type: ""
menu: menu:
show: show: message
hide: hide:
smd: smd:
......
...@@ -424,3 +424,6 @@ smfcore.language.displayLanName.de-DE=Deutsch ...@@ -424,3 +424,6 @@ smfcore.language.displayLanName.de-DE=Deutsch
smfcore.logMonitor=\u65E5\u5FD7\u76D1\u63A7 smfcore.logMonitor=\u65E5\u5FD7\u76D1\u63A7
smfcore.materialTrace=\u7269\u6599\u8FFD\u6EAF smfcore.materialTrace=\u7269\u6599\u8FFD\u6EAF
smfcore.message.critical=\u4E25\u91CD\u9519\u8BEF smfcore.message.critical=\u4E25\u91CD\u9519\u8BEF
smfcore.barcode.inShelf=[{0}]\u5DF2\u5728\u6599\u67B6[{1}],\u5E93\u4F4D[{2}]\u4E2D
smfcore.barcode.checkNg=\u9A8C\u8BC1\u5931\u8D25:{0}
smfcore.barcode.checkError=[{0}]
\ No newline at end of file \ No newline at end of file
...@@ -414,3 +414,4 @@ smfcore.language.displayLanName.de-DE=Deutsch ...@@ -414,3 +414,4 @@ smfcore.language.displayLanName.de-DE=Deutsch
smfcore.logMonitor=Log-\u00DCberwachung smfcore.logMonitor=Log-\u00DCberwachung
smfcore.materialTrace=Materialverfolgung smfcore.materialTrace=Materialverfolgung
smfcore.message.critical=Kritischer Fehler smfcore.message.critical=Kritischer Fehler
smfcore.barcode.inShelf=[{0}] befindet sich bereits im Regal [{1}], Lagerplatz [{2}]
\ No newline at end of file \ No newline at end of file
...@@ -415,3 +415,4 @@ smfcore.language.displayLanName.de-DE=Deutsch ...@@ -415,3 +415,4 @@ smfcore.language.displayLanName.de-DE=Deutsch
smfcore.logMonitor=Log Monitoring smfcore.logMonitor=Log Monitoring
smfcore.materialTrace=Material Trace smfcore.materialTrace=Material Trace
smfcore.message.critical=Critical smfcore.message.critical=Critical
smfcore.barcode.inShelf=[{0}] is already on shelf [{1}], location [{2}]
\ No newline at end of file \ No newline at end of file
...@@ -414,3 +414,4 @@ smfcore.language.displayLanName.de-DE=Deutsch ...@@ -414,3 +414,4 @@ smfcore.language.displayLanName.de-DE=Deutsch
smfcore.logMonitor=Surveillance des Journaux smfcore.logMonitor=Surveillance des Journaux
smfcore.materialTrace=Tra\u00E7abilit\u00E9 des mati\u00E8res smfcore.materialTrace=Tra\u00E7abilit\u00E9 des mati\u00E8res
smfcore.message.critical=Erreur Critique smfcore.message.critical=Erreur Critique
smfcore.barcode.inShelf=[{0}] est d\u00E9j\u00E0 sur l'\u00E9tag\u00E8re [{1}], emplacement [{2}]
\ No newline at end of file \ No newline at end of file
...@@ -411,3 +411,4 @@ smfcore.language.displayLanName.de-DE=Deutsch ...@@ -411,3 +411,4 @@ smfcore.language.displayLanName.de-DE=Deutsch
smfcore.logMonitor=\u30ED\u30B0\u76E3\u8996 smfcore.logMonitor=\u30ED\u30B0\u76E3\u8996
smfcore.materialTrace=\u30DE\u30C6\u30EA\u30A2\u30EB\u30C8\u30EC\u30FC\u30B9 smfcore.materialTrace=\u30DE\u30C6\u30EA\u30A2\u30EB\u30C8\u30EC\u30FC\u30B9
smfcore.message.critical=\u91CD\u5927\u30A8\u30E9\u30FC smfcore.message.critical=\u91CD\u5927\u30A8\u30E9\u30FC
smfcore.barcode.inShelf=[{0}]\u306F\u3059\u3067\u306B\u30E9\u30C3\u30AF[{1}]\u3001\u30ED\u30B1\u30FC\u30B7\u30E7\u30F3[{2}]\u306B\u3042\u308A\u307E\u3059
\ No newline at end of file \ No newline at end of file
...@@ -411,3 +411,4 @@ smfcore.language.displayLanName.de-DE=Deutsch ...@@ -411,3 +411,4 @@ smfcore.language.displayLanName.de-DE=Deutsch
smfcore.logMonitor=\u65E5\u5FD7\u76D1\u63A7 smfcore.logMonitor=\u65E5\u5FD7\u76D1\u63A7
smfcore.materialTrace=\u7269\u6599\u8FFD\u6EAF smfcore.materialTrace=\u7269\u6599\u8FFD\u6EAF
smfcore.message.critical=\u4E25\u91CD\u9519\u8BEF smfcore.message.critical=\u4E25\u91CD\u9519\u8BEF
smfcore.barcode.inShelf=[{0}]\u5DF2\u5728\u6599\u67B6[{1}],\u5E93\u4F4D[{2}]\u4E2D
\ No newline at end of file \ No newline at end of file
...@@ -411,3 +411,4 @@ smfcore.language.displayLanName.de-DE=Deutsch ...@@ -411,3 +411,4 @@ smfcore.language.displayLanName.de-DE=Deutsch
smfcore.logMonitor=\u65E5\u8A8C\u76E3\u63A7 smfcore.logMonitor=\u65E5\u8A8C\u76E3\u63A7
smfcore.materialTrace=\u7269\u6599\u8FFD\u6EAF smfcore.materialTrace=\u7269\u6599\u8FFD\u6EAF
smfcore.message.critical=\u56B4\u91CD\u932F\u8AA4 smfcore.message.critical=\u56B4\u91CD\u932F\u8AA4
smfcore.barcode.inShelf=[{0}]\u5DF2\u5728\u6599\u67B6[{1}]\uFF0C\u5EAB\u4F4D[{2}]\u4E2D
\ No newline at end of file \ No newline at end of file
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!