Commit 4aba1dfc LN

获取库位号接口修改

1 个父辈 d94616f8
package com.neotel.smfcore.common.service;
import com.neotel.smfcore.common.bean.ResultBean;
import com.neotel.smfcore.core.language.util.MessageUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.core.MethodParameter;
import org.springframework.http.HttpHeaders;
......@@ -44,6 +45,11 @@ public class CommonResponseAdvice implements ResponseBodyAdvice<Object> {
List<Locale> locales = headers.getAcceptLanguageAsLocales();
if (locales != null && locales.size() > 0) {
resultBean.updateLocal(locales.get(0));
}else {
Locale defaultLocal= MessageUtils.getDefaultLocal();
if(defaultLocal!=null){
resultBean.updateLocal(defaultLocal);
}
}
return resultBean;
// resultBean.updateLocal(request.getLocale());
......
......@@ -17,6 +17,7 @@ import com.neotel.smfcore.core.barcode.service.po.Barcode;
import com.neotel.smfcore.core.barcode.utils.CodeResolve;
import com.neotel.smfcore.core.device.bean.PosInfo;
import com.neotel.smfcore.core.device.enums.OP_STATUS;
import com.neotel.smfcore.core.language.util.MessageUtils;
import com.neotel.smfcore.core.message.util.DeviceMessageUtil;
import com.neotel.smfcore.core.order.service.po.LiteOrder;
import com.neotel.smfcore.core.storage.service.manager.IStoragePosManager;
......@@ -186,7 +187,15 @@ public class DeviceController {
if(barcode==null) {
throw new ValidateException("smfcore.error.barcode.invalid", "未找到有效的条码");
}
if (barcode.getExpireDate() != null && System.currentTimeMillis() > barcode.getExpireDate().getTime()) {
// throw new ValidateException("smfcore.error.barcode.expired", "物料已过期,无法入库.");
resultMap.put("result", "107");
errorMsg = "["+barcode.getBarcode()+"]"+ MessageUtils.getText("smfcore.error.barcode.expired",new Locale("en","US"),"物料已过期,无法入库");
resultMap.put("msg", errorMsg);
log.error("物料["+barcode.getBarcode()+"]已过期,无法入库");
return resultMap;
}
for (DataLog dataLog : taskService.getQueueTasks()) {
// if(!dataLog.isPackageReel()){
//已经在任务当中,返回对应的信息
......@@ -230,70 +239,34 @@ public class DeviceController {
StoragePos pos = taskService.findEmptyPosForPutIn(storageList, barcode, rfid, lastPosId);
if (pos != null) {
// Storage storage = dataCache.getStorageById(pos.getStorageId());
// if(!storage.isPackage()){
// //不是包装仓,如果所在料仓有出库任务,暂停入库
// Collection<DataLog> tasks = taskService.getQueueTasks();
Storage storage = dataCache.getStorageById(pos.getStorageId());
// //如果所在料仓有出库任务未完成,暂停入库
// Collection<DataLog> tasks = taskService.getAllTasks();
// for (DataLog task : tasks) {
// if(task.isCheckOutTask() && task.getStorageId().equals(pos.getStorageId())){
// errorMsg = "库位["+ pos.getPosName() + "]所在料仓有出库任务,暂停入库";
// if (task.isCheckOutTask() && task.getStorageId().equals(pos.getStorageId())) {
// if ((!task.isFinished()) && (!task.isInRobot())&&(!task.isInLine()) ) {
//// errorMsg = "库位[" + pos.getPosName() + "]所在料仓有出库任务,暂停入库";
// errorMsg = "PosName[" + pos.getPosName() + "]There are outgoing tasks in the silo, suspend storage";
// lineMsg = errorMsg;
// resultMap.put("result","99");
// resultMap.put("msg",errorMsg);
// resultMap.put("result", "99");
// resultMap.put("msg", errorMsg);
// log.info("[" + barcode.getBarcode() + "]分到库位[" + pos.getPosName() + "]所在料仓有出库任务,暂停入库");
// return resultMap;
// }
// }
// }
Storage theStorage = dataCache.getStorageById(pos.getStorageId());
resultMap.put("result", "0");
resultMap.put("msg", "");
resultMap.put("msg", "ok");
DataLog newTask = taskService.addPutInTaskToExecute(storage, barcode, pos);
okMsg = "[" + barcode.getBarcode() + "]锁定库位[" + pos.getPosName() + "]优先级[" + pos.getPriority() + "] 上个库位号[" + lastPosId + "]";
okMsg = "[" + rfid + "][" + barcode.getBarcode() + "]锁定库位[" + pos.getPosName() + "]优先级[" + pos.getPriority() + "] 上个库位号[" + lastPosId + "]";
ReelLockPosInfo oldLockInfo = ReelLockPosUtil.getLockPosInfoByCode(barcode.getBarcode());
if (oldLockInfo != null) {
if (!oldLockInfo.getBarcode().equals(barcode.getBarcode())) {
String result = "-1";
okMsg = rfid + "[" + rfidLoc + "][" + barcode.getBarcode() + "]锁定库位[" + pos.getPosName() + "],清理旧有锁定信息";
resultMap.put("result", result);
resultMap.put("msg", okMsg);
//已经锁定过库位,但不是同一个条码,需要把对应位置的锁定信息清理掉
ReelLockPosUtil.removeReelLockPosInfo(oldLockInfo.getBarcode());
log.info("清理锁定库位:库位号[" + oldLockInfo.getLockPosName() + "]上物料[" + oldLockInfo.getBarcode() + "]锁定的库位");
}
}
log.info(okMsg + oldLockInfo);
ReelLockPosInfo reelLocInfo = new ReelLockPosInfo();
reelLocInfo.setBarcode(barcode.getBarcode());
reelLocInfo.setCid(theStorage.getCid());
reelLocInfo.setLockPosName(pos.getPosName());
reelLocInfo.setLockPosId(pos.getId());
reelLocInfo = ReelLockPosUtil.addReelLockPosInfo(reelLocInfo, cidList);
if (reelLocInfo == null) {
errorMsg = "[" + barcode.getBarcode() + "]库位["+reelLocInfo.getLockPosName()+"]已被锁定,暂停入库";
lineMsg = errorMsg;
DeviceMessageUtil.updateLineMsg(lineMsg,code,cids, reelLocInfo.getLockPosName(),"smfcore.linemsg.posLock",new String[]{barcode.getBarcode(),reelLocInfo.getLockPosName()});
resultMap.put("result", "99");
resultMap.put("msg", errorMsg);
return resultMap;
} else {
log.info(okMsg);
resultMap.put("pos", pos.getPosName());
resultMap.put("barcode", barcode.getBarcode());
resultMap.put("cid", theStorage.getCid());
}
resultMap.put("cid", storage.getCid());
resultMap.put("taskId", newTask.getId());
} else {
resultMap.put("result", "104");
errorMsg = "[" + barcode.getBarcode() + "]未找到可用的[" + barcode.getPlateSize() + "x" + barcode.getHeight() + "]仓位";
......@@ -611,6 +584,7 @@ public class DeviceController {
pos = storagePosManager.getByPosName(posName);
if (pos == null) {
return ResultBean.newErrorResult(101, "smfcore.queryPos.cannotFind", "cannot find posName ["+posName+"]", new String[]{posName});
} else if (pos.getBarcode() == null) {
return ResultBean.newErrorResult(100, "smfcore.queryPos.posIsEmpty", "["+posName+"] is empty", new String[]{posName});
}
......
......@@ -8,6 +8,7 @@ import com.neotel.smfcore.core.language.service.nanager.ILanguageMsgManager;
import com.neotel.smfcore.core.language.service.po.LanguageMsg;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
......@@ -86,7 +87,12 @@ public class MessageUtils {
log.error("语言信息导入出错",e);
}
}
private static String defLanguage = "";
@Value("${app.defLanguage: zh-CN}")
public void setDefLanguage(String defLanguage) {
MessageUtils.defLanguage = defLanguage;
}
private void initLanguageMsgList() {
......@@ -104,6 +110,9 @@ public class MessageUtils {
//-----------------以下为从缓存读取资源-------------------------------------
public static Locale getDefaultLocal(){
if(ObjectUtil.isNotEmpty(defLanguage)){
return new Locale(defLanguage);
}
return new Locale("zh-CH");
}
......
......@@ -327,9 +327,9 @@ smfcore.errorLog=ErrorLog
smfcore.errorReport=ErrorReport
smfcore.eventLog=EventLog
smfcore.reports=Report
smfcore.queryPos.cannotFind=cannot find posName [{0}]
smfcore.queryPos.posIsEmpty=[{0}] is empty
smfcore.queryPos.cannotFindBarcode=cannot find barcode [{0}] In storage
smfcore.queryPos.cannotFind=\u627E\u4E0D\u5230\u5E93\u4F4D [{0}]
smfcore.queryPos.posIsEmpty=[{0}] \u4E3A\u7A7A
smfcore.queryPos.cannotFindBarcode=\u672A\u5728\u5E93\u5B58\u4E2D\u627E\u5230\u6761\u7801 [{0}]
smfcore.storage.notAvailable=\u6599\u4ED3{0}\u4E0D\u53EF\u7528\uFF0C\u65E0\u6CD5\u51FA\u5E93
smfcore.selfAuditManagerment=\u76D8\u70B9
smfcore.selfAudit=\u76D8\u70B9
......@@ -343,7 +343,7 @@ smfcore.selfAudit.pause=\u76D8\u70B9{0}\u5DF2\u6682\u505C
smfcore.shelf.error.orderError=\u4EFB\u52A1\u4E0E\u6307\u5B9A\u5DE5\u5355[{0}]\u4E0D\u4E00\u81F4
smfcore.shelf.error.storageError=\u4EFB\u52A1\u4E0E\u6307\u5B9A\u6599\u67B6[{0}]\u4E0D\u4E00\u81F4
order.error.executing={0}\u5DF2\u5728\u4EFB\u52A1\u5217\u8868\u4E2D
smfcore.queryPos.solderOutFail=[{0}]checkOut fail,currStatus[{1}]
smfcore.queryPos.solderOutFail=[{0}]\u51FA\u5E93\u5931\u8D25,\u5F53\u524D\u72B6\u6001[{1}]
smfcore.operationFailure=\u64CD\u4F5C\u5931\u8D25
smfcore.hotayi.machineID.error=machineID inconsistency [{0}] [{1}]
smfcore.selfAudit.noPos=\u76D8\u70B9{0}\u672A\u627E\u5230\u5E93\u4F4D\u53F7
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!