Commit 2046e95c LN

1. 获取库位号时若锁定库位不在请求的料仓列表中,重新查找库位。2.屏蔽空库位出库功能。

1 个父辈 3a775445
package com.neotel.smfcore.common.utils; package com.neotel.smfcore.common.utils;
import com.google.common.collect.Lists;
import com.neotel.smfcore.core.device.util.DataCache; import com.neotel.smfcore.core.device.util.DataCache;
import com.neotel.smfcore.common.bean.ReelLockPosInfo; import com.neotel.smfcore.common.bean.ReelLockPosInfo;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
...@@ -41,12 +42,18 @@ public class ReelLockPosUtil { ...@@ -41,12 +42,18 @@ public class ReelLockPosUtil {
* *
* @param reelLockPosInfo * @param reelLockPosInfo
*/ */
public static synchronized ReelLockPosInfo addReelLockPosInfo(ReelLockPosInfo reelLockPosInfo) { public static synchronized ReelLockPosInfo addReelLockPosInfo(ReelLockPosInfo reelLockPosInfo , List<String> cidList) {
log.info("为[" + reelLockPosInfo.getBarcode() + "]锁定库位[" + reelLockPosInfo.getLockPosName() + "]"); log.info("为[" + reelLockPosInfo.getBarcode() + "]锁定库位[" + reelLockPosInfo.getLockPosName() + "]");
ReelLockPosInfo oldLocInfo = reelLocKPosMap.get(reelLockPosInfo.getBarcode()); ReelLockPosInfo oldLocInfo = reelLocKPosMap.get(reelLockPosInfo.getBarcode());
if (oldLocInfo != null && oldLocInfo.getLockPosName() != null) { if (oldLocInfo != null && oldLocInfo.getLockPosName() != null) {
if(cidList.contains(oldLocInfo.getCid())){
log.info("[" + oldLocInfo.getBarcode() + "]已有锁定库位[" + oldLocInfo.getLockPosName() + "],返回之前锁定的库位"); log.info("[" + oldLocInfo.getBarcode() + "]已有锁定库位[" + oldLocInfo.getLockPosName() + "],返回之前锁定的库位");
return oldLocInfo; return oldLocInfo;
}else{
//锁定库位不在cid列表中
log.info("[" + oldLocInfo.getBarcode() + "]已有锁定库位[" + oldLocInfo.getLockPosName() + "],Cid["+oldLocInfo.getCid()+"]不在["+String.join(",",cidList)+"]中,清理原有锁定库位");
reelLocKPosMap.remove(reelLockPosInfo.getBarcode());
}
} }
for (ReelLockPosInfo locInfo : reelLocKPosMap.values()) { for (ReelLockPosInfo locInfo : reelLocKPosMap.values()) {
if (locInfo.getLockPosId().equals(reelLockPosInfo.getLockPosId()) && !locInfo.getBarcode().equals(reelLockPosInfo.getBarcode())) { if (locInfo.getLockPosId().equals(reelLockPosInfo.getLockPosId()) && !locInfo.getBarcode().equals(reelLockPosInfo.getBarcode())) {
......
...@@ -14,6 +14,7 @@ import java.util.List; ...@@ -14,6 +14,7 @@ import java.util.List;
public class UserCodeUtil { public class UserCodeUtil {
public static void main(String[] args) { public static void main(String[] args) {
// FilePro();
CreateUserCode( ); CreateUserCode( );
} }
public static void CreateUserCode( ) { public static void CreateUserCode( ) {
...@@ -114,4 +115,77 @@ public class UserCodeUtil { ...@@ -114,4 +115,77 @@ public class UserCodeUtil {
log.info("文件"+fileURL+"共解析到"+ list.size()+"个用户"); log.info("文件"+fileURL+"共解析到"+ list.size()+"个用户");
return list; return list;
} }
// @Data
// @AllArgsConstructor
// public static class ErrorPos{
// private String riqi;
// private String shijian;
// private Integer storage;
// private String pos;
// }
// public static void FilePro(){
// try {
// String filePath = "F:\\";
// String fileName="Error.csv";
// Map<Integer,Map<String,ErrorPos>> map =new HashMap<>();
//
// CsvReader csvRead = CsvReader.newReader(filePath+fileName,"Pos","Pos");
//
// int DateIndex = getCsvIndex(csvRead,"Date","Date");
// int TimeIndex = getCsvIndex(csvRead,"Time","Time");
// int StorageIndex=getCsvIndex(csvRead,"Storage","Storage");
// int PosIndex=getCsvIndex(csvRead,"Pos","Pos");
//
// int row = 1;
// int newRowCount = 0;
// int updateRowCount = 0;
// String msg="";
// while(csvRead.readRecord()){
// row++;
// String[] lineValues = csvRead.getValues();
// String date = lineValues[DateIndex];
// String time = lineValues[TimeIndex];
// Integer storage= Convert.toInt(lineValues[StorageIndex].trim()) ;
// String pos=lineValues[PosIndex];
// if( pos.isEmpty()){
// log.warn("第"+row+"行中有空白内容,此行忽略");
// continue;
// }
// Map<String,ErrorPos> sMap=map.get(storage );
// if(sMap==null){
// sMap=new HashMap<>();
// }
// sMap.put(pos,new ErrorPos(date,time,storage,pos));
// map.put(storage,sMap);
// }
// log.info("文件"+filePath+fileName+"共解析到"+ map.size()+"数据");
//
// String targetFile=filePath+"更新后_"+fileName;
// if(FileUtil.exist(targetFile)){
// FileUtil.del(targetFile);
// }
// //重新保存
// CsvWriter writer=new CsvWriter(targetFile);
//
// String[] headers=new String[]{"日期","时间", "料仓", "库位"};
// writer.writeRecord(headers);
// for (Integer key :
// map.keySet()) {
// Map<String,ErrorPos> sMap=map.get(key );
// for (ErrorPos pos :
// sMap.values()) {
// String[] userStr=new String[]{pos.getRiqi(),pos.getShijian(),pos.getStorage().toString(),pos.getPos() };
//
// writer.writeRecord(userStr);
// }
// }
//
// writer.flush();
// writer.close();
// log.info("保存新用户信息到文件:"+filePath+"更新后_"+fileName);
// } catch (Exception ex) {
// log.error("出错:" + ex.toString());
// }
// }
} }
...@@ -649,7 +649,11 @@ public class BaseDeviceHandler implements IDeviceHandler { ...@@ -649,7 +649,11 @@ public class BaseDeviceHandler implements IDeviceHandler {
Barcode barcode = storagePos.getBarcode(); Barcode barcode = storagePos.getBarcode();
if (barcode == null) { if (barcode == null) {
log.warn("任务:" + task.getId() + " 仓位:" + task.getPosId() + " 的 Barcode 为null, 之前可能处理过直接返回"); log.warn("任务:" + task.getId() + " 仓位:" + task.getPosId() + " 的 Barcode 为null, 之前可能处理过,结束任务后直接返回");
//记录日志
task.setStatus(OP_STATUS.FINISHED.name());
taskService.updateFinishedTask(task);
return; return;
} }
...@@ -771,10 +775,7 @@ public class BaseDeviceHandler implements IDeviceHandler { ...@@ -771,10 +775,7 @@ public class BaseDeviceHandler implements IDeviceHandler {
* @return * @return
*/ */
protected boolean openLightGuide(){ protected boolean openLightGuide(){
OrderSetting orderSetting=dataCache.getCache(Constants.CACHE_OrderSetting); OrderSetting orderSetting=dataCache.getOrderSetting();
if(orderSetting!=null&&orderSetting.getShelfLightType().equals(1)){
return true;
}
return false; return false;
} }
......
...@@ -127,6 +127,7 @@ public class DeviceController { ...@@ -127,6 +127,7 @@ public class DeviceController {
resultMap.put("msg","未指定料仓 cids "); resultMap.put("msg","未指定料仓 cids ");
}else{ }else{
List<Storage> storageList = Lists.newArrayList(); List<Storage> storageList = Lists.newArrayList();
List<String> cidList=Lists.newArrayList();
for (String cid: cids.split(",")) { for (String cid: cids.split(",")) {
String notIntoCids = dataCahche.getSettings().getNotIntoCids(); String notIntoCids = dataCahche.getSettings().getNotIntoCids();
if(notIntoCids != null){ if(notIntoCids != null){
...@@ -138,6 +139,7 @@ public class DeviceController { ...@@ -138,6 +139,7 @@ public class DeviceController {
Storage storage = dataCahche.getStorage(cid); Storage storage = dataCahche.getStorage(cid);
if(storage != null){ if(storage != null){
storageList.add(storage); storageList.add(storage);
cidList.add(cid);
} }
} }
if(storageList.isEmpty()){ if(storageList.isEmpty()){
...@@ -241,7 +243,7 @@ public class DeviceController { ...@@ -241,7 +243,7 @@ public class DeviceController {
reelLocInfo.setLockPosName(pos.getPosName()); reelLocInfo.setLockPosName(pos.getPosName());
reelLocInfo.setLockPosId(pos.getId()); reelLocInfo.setLockPosId(pos.getId());
reelLocInfo = ReelLockPosUtil.addReelLockPosInfo(reelLocInfo); reelLocInfo = ReelLockPosUtil.addReelLockPosInfo(reelLocInfo,cidList);
if(reelLocInfo == null){ if(reelLocInfo == null){
errorMsg = "库位已被锁定,暂停入库"; errorMsg = "库位已被锁定,暂停入库";
lineMsg = errorMsg; lineMsg = errorMsg;
......
...@@ -16,6 +16,7 @@ import com.neotel.smfcore.core.language.util.MessageUtils; ...@@ -16,6 +16,7 @@ import com.neotel.smfcore.core.language.util.MessageUtils;
import com.neotel.smfcore.core.storage.bean.InventoryItem; import com.neotel.smfcore.core.storage.bean.InventoryItem;
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.po.StoragePos; import com.neotel.smfcore.core.storage.service.po.StoragePos;
import com.neotel.smfcore.core.system.bean.OrderSetting;
import com.neotel.smfcore.core.system.service.dao.ICacheItemDao; import com.neotel.smfcore.core.system.service.dao.ICacheItemDao;
import com.neotel.smfcore.core.system.service.dao.ISettingsDao; import com.neotel.smfcore.core.system.service.dao.ISettingsDao;
import com.neotel.smfcore.core.barcode.bean.PlateSizeBean; import com.neotel.smfcore.core.barcode.bean.PlateSizeBean;
...@@ -105,6 +106,14 @@ public class DataCache { ...@@ -105,6 +106,14 @@ public class DataCache {
return null; return null;
} }
public OrderSetting getOrderSetting() {
OrderSetting orderSetting = getCache(Constants.CACHE_OrderSetting);
if (orderSetting == null) {
orderSetting = new OrderSetting();
}
return orderSetting;
}
public List<LanguageInfo> getLanguageList(){ public List<LanguageInfo> getLanguageList(){
List<LanguageInfo> lanList = getCache(Constants.CACHE_languageType); List<LanguageInfo> lanList = getCache(Constants.CACHE_languageType);
if (lanList == null || lanList.size() <= 0) { if (lanList == null || lanList.size() <= 0) {
......
...@@ -164,10 +164,7 @@ public class SettingsController { ...@@ -164,10 +164,7 @@ public class SettingsController {
@GetMapping("/order") @GetMapping("/order")
@PreAuthorize("@el.check('orderSetting')") @PreAuthorize("@el.check('orderSetting')")
public OrderSetting getOrderSetting() { public OrderSetting getOrderSetting() {
OrderSetting orderSetting = dataCache.getCache(Constants.CACHE_OrderSetting); OrderSetting orderSetting = dataCache.getOrderSetting();
if (orderSetting == null) {
orderSetting = new OrderSetting();
}
orderSetting.setShowLightType(false); orderSetting.setShowLightType(false);
//判断是否有料架 //判断是否有料架
List<Storage> storages = new ArrayList<>(dataCache.getAllStorage().values()); List<Storage> storages = new ArrayList<>(dataCache.getAllStorage().values());
...@@ -203,6 +200,23 @@ public class SettingsController { ...@@ -203,6 +200,23 @@ public class SettingsController {
throw new ValidateException("smfcore.valueCanotNull", "{0}不能为空", new String[]{"SO"}); throw new ValidateException("smfcore.valueCanotNull", "{0}不能为空", new String[]{"SO"});
} }
//判断文件夹是否正确
if(ObjectUtil.isNotEmpty(orderSetting.getOrderDir())){
File file = new File(orderSetting.getOrderDir());
if(file.exists()&& file.isDirectory()){
}else{
//判断是不是远程文件夹
if(orderSetting.getOrderDir().toLowerCase().startsWith("smb")){
}else{
throw new ValidateException("smfcore.enterCorrectFolder", "请输入正确的文件夹" );
}
}
}
dataCache.updateCache(Constants.CACHE_OrderSetting, orderSetting); dataCache.updateCache(Constants.CACHE_OrderSetting, orderSetting);
log.info("更改工单设置:"+Constants.CACHE_OrderSetting+"=" + orderSetting.toString()); log.info("更改工单设置:"+Constants.CACHE_OrderSetting+"=" + orderSetting.toString());
return ResultBean.newOkResult("保存成功"); return ResultBean.newOkResult("保存成功");
...@@ -220,10 +234,8 @@ public class SettingsController { ...@@ -220,10 +234,8 @@ public class SettingsController {
try { try {
List<Map<String, Object>> maps = new ArrayList<>(); List<Map<String, Object>> maps = new ArrayList<>();
List<String> titles = new ArrayList<>(); List<String> titles = new ArrayList<>();
OrderSetting orderSetting = dataCache.getCache(Constants.CACHE_OrderSetting); OrderSetting orderSetting = dataCache.getOrderSetting();
if (orderSetting == null) {
orderSetting = new OrderSetting();
}
titles.add(orderSetting.getPn() ); titles.add(orderSetting.getPn() );
titles.add(orderSetting.getFeeder()); titles.add(orderSetting.getFeeder());
titles.add((orderSetting.getQty())); titles.add((orderSetting.getQty()));
......
...@@ -107,6 +107,24 @@ public class TaskService { ...@@ -107,6 +107,24 @@ public class TaskService {
String msg = "库位[" + pos.getPosName() + "]中已无物料,忽略"; String msg = "库位[" + pos.getPosName() + "]中已无物料,忽略";
log.info(msg); log.info(msg);
throw new ValidateException("smfcore.allBoxView.noReel", "库位{0}中无物料",new String[]{pos.getPosName()}); throw new ValidateException("smfcore.allBoxView.noReel", "库位{0}中无物料",new String[]{pos.getPosName()});
// Barcode barcode=new Barcode();
// SimpleDateFormat formatter= new SimpleDateFormat("HHmmss");
// Date date = new Date(System.currentTimeMillis());
// barcode.setBarcode("EO-"+formatter.format(date)+pos.getId());
// log.info("库位[" + pos.getPosName() + "]中已无物料,空出,模拟条码:"+barcode.getBarcode());
// barcode.setHeight(pos.getH());
// barcode.setPlateSize(pos.getW());
// barcode.setAmount(999);
// DataLog task = new DataLog(storage, barcode, pos);
// task.setType(OP.CHECKOUT);
// task.setPutInDate(barcode.getPutInDate());
// task.setStatus(OP_STATUS.WAIT.name());
// task.setSingleOut(isSingleOut);
// task.setOperator(opUserName);
// addTaskToExecute(task);
// return "";
} }
DataLog task = new DataLog(storage, pos.getBarcode(), pos); DataLog task = new DataLog(storage, pos.getBarcode(), pos);
...@@ -541,10 +559,12 @@ public class TaskService { ...@@ -541,10 +559,12 @@ public class TaskService {
public StoragePos findEmptyPosForPutIn(List<Storage> storageList, Barcode barcode, String inRFID, String lastPosId) throws ValidateException { public StoragePos findEmptyPosForPutIn(List<Storage> storageList, Barcode barcode, String inRFID, String lastPosId) throws ValidateException {
verifyBarcodePutIn(storageList, barcode, inRFID); verifyBarcodePutIn(storageList, barcode, inRFID);
List<String> storageIds=new ArrayList<>();
//查找任务数最少的料仓 //查找任务数最少的料仓
final Map<String, Integer> storageTaskCountMap = new HashMap<>(); final Map<String, Integer> storageTaskCountMap = new HashMap<>();
for (Storage storage : storageList) { for (Storage storage : storageList) {
storageTaskCountMap.put(storage.getId(), 0); storageTaskCountMap.put(storage.getId(), 0);
storageIds.add(storage.getId());
} }
Set<String> hasOutTaskStorageIds = new HashSet<>(); Set<String> hasOutTaskStorageIds = new HashSet<>();
...@@ -578,7 +598,11 @@ public class TaskService { ...@@ -578,7 +598,11 @@ public class TaskService {
pos = storagePosManager.get(lockPosId); pos = storagePosManager.get(lockPosId);
if (pos != null) { if (pos != null) {
if (pos.getW() < barcode.getPlateSize() || pos.getH() < barcode.getHeight()) { if(!storageIds.contains(pos.getStorageId())){
log.info("条码[" + barcode.getBarcode() + "]已有锁定库位[" + pos.getPosName() + "],料仓ID["+pos.getStorageId()+"]不在请求列表["+String.join(",",storageIds)+"]中,重新查找库位");
pos = null;
}
else if (pos.getW() < barcode.getPlateSize() || pos.getH() < barcode.getHeight()) {
log.info("条码[" + barcode.getBarcode() + "]尺寸已改变,无法放入已锁定库位[" + pos.getPosName() + "],重新查找库位"); log.info("条码[" + barcode.getBarcode() + "]尺寸已改变,无法放入已锁定库位[" + pos.getPosName() + "],重新查找库位");
pos = null; pos = null;
} else { } else {
...@@ -881,7 +905,6 @@ public class TaskService { ...@@ -881,7 +905,6 @@ public class TaskService {
CHECKOUT_TYPE checkoutType = dataCache.getCheckOutType(); CHECKOUT_TYPE checkoutType = dataCache.getCheckOutType();
List<String> availableStorageIds = dataCache.getAvailableStorageIds(); List<String> availableStorageIds = dataCache.getAvailableStorageIds();
Collection<String> excludePosIds = excludePosIds();
//其他出库模式一次性全部生成任务 //其他出库模式一次性全部生成任务
for (TacticsOutDto item : tacticsOutDtos) { for (TacticsOutDto item : tacticsOutDtos) {
...@@ -890,6 +913,7 @@ public class TaskService { ...@@ -890,6 +913,7 @@ public class TaskService {
String partNumber = item.getPartNumber(); String partNumber = item.getPartNumber();
for (int i = 1; i <= item.getPlateNumber(); i++) { for (int i = 1; i <= item.getPlateNumber(); i++) {
Collection<String> excludePosIds = excludePosIds();
StoragePos pos = null; StoragePos pos = null;
if (item.getStorageId() != null) { if (item.getStorageId() != null) {
String[] storageIds = new String[]{item.getStorageId()}; String[] storageIds = new String[]{item.getStorageId()};
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!