Commit 0f7e4b3c zshaohui

1.NLP直接调用是否点料接口

2.使用确认尺寸中的高度
1 个父辈 fbee3383
......@@ -249,6 +249,14 @@ public class CodeResolve {
log.info("重新设置:"+barcode.getBarcode()+"的尺寸为:"+barcodeFromRule.getPlateSize()+"x"+barcodeFromRule.getHeight());
}
Component com = componentManager.findByPartNumberAndProvider(barcode.getPartNumber(), barcode.getProvider());
if (com != null){
if (com.isSizeConfirmed()){
barcode.setHeight(com.getHeight());
needUpdate = true;
}
}
if(needUpdate){
try {
......@@ -356,6 +364,13 @@ public class CodeResolve {
log.error("设置mixingSpeed出错", ex);
}
Component com = componentManager.findByPartNumberAndProvider(barcodeFromRule.getPartNumber(), barcodeFromRule.getProvider());
if (com != null){
if (com.isSizeConfirmed()){
barcodeFromRule.setHeight(com.getHeight());
}
}
barcode = barcodeManager.save(barcodeFromRule);
codeBeanFromRule.setCodeStr(barcode.getBarcode());
......
......@@ -70,6 +70,8 @@ public class NLPShelfHandler extends BaseDeviceHandler {
throw new ValidateException("smfcore.valueCanotNull", "{0}不能为空", new String[]{"code"});
}
String fullCode = code;
code = replaceSpecial(code);
if (groupId == null && storageId == null) {
......@@ -117,6 +119,9 @@ public class NLPShelfHandler extends BaseDeviceHandler {
if (verResult != null) {
barcodeSave = verResult;
}
barcodeSave.setFullCode(fullCode);
barcodeManager.save(barcodeSave);
return putIn(loginUser, groupId, storageId, barcodeSave, token);
}catch (ValidateException ve){
return ResultBean.newErrorResult(-1,ve.getMsgKey(),ve.getDefaultMsg(),ve.getMsgParam());
......@@ -148,13 +153,29 @@ public class NLPShelfHandler extends BaseDeviceHandler {
}
}
String countType = barcode.getCountType();
log.info(barcode.getBarcode()+"对应的类型为:"+countType);
if (StringUtils.isEmpty(countType)){
throw new ValidateException("smfcore.nlp.materialCountNull", "请先点料再进行入库");
}else if (!"NOT_COUNT_IN".equals(countType)){
throw new ValidateException("smfcore.nlp.materialCountTypeErroe", "点料类型为[{0}],不允许入库",new String[]{countType});
try {
MaterialCountResult count = zhongcheApi.materialCount(barcode.getBarcode(), barcode.getFullCode());
int qty = count.getQty();
if (qty != 0) {
barcode.setAmount(qty);
}
barcode.setCountType(count.getMaterialType());
barcodeManager.save(barcode);
} catch (ValidateException e) {
return ResultBean.newErrorResult(-1, e.getMsgKey(), e.getDefaultMsg(), e.getMsgParam());
}
String barcodeStr = barcode.getBarcode();
if ("NOT_COUNT_IN".equals(barcode.getCountType())){
} else if ("COUNT_IN".equals(barcode.getCountType())){
return ResultBean.newErrorResult(-1,"",barcodeStr+"点料后入库");
} else if ("COUNT_NOT_IN".equals(barcode.getCountType())){
return ResultBean.newErrorResult(-1,"","barcodeStr+点料不入库");
} else if ("NOT_COUNT_NOT_IN".equals(barcode.getCountType())){
return ResultBean.newErrorResult(-1,"",barcodeStr+"不点料且不入库");
}
String pn = barcode.getPartNumber();
String reelId = barcode.getBarcode();
String num = barcode.getAmount() + "";
......
......@@ -886,6 +886,11 @@ public class DeviceController {
posName = "";
}
}
if (StringUtils.isEmpty(posName)){
ReelLockPosUtil.removeReelLockPosInfo(getLockPosSKey(needMovePos.getStorageId()));
}
//不从外侧库位进行查找
/*if (StringUtils.isEmpty(posName)) {
lockPosInfo = ReelLockPosUtil.getLockPosInfoByCode(getLockPosKey(needMovePos.getStorageId()));
......@@ -913,6 +918,7 @@ public class DeviceController {
storageList.add(storage);
List<String> cidList = new ArrayList<>();
cidList.add(storage.getCid());
List<String> needRemoveLockPosId = new ArrayList<>();
while (pos == null) {
loopCount++;
if (loopCount >= 10) {
......@@ -948,6 +954,7 @@ public class DeviceController {
reelLocInfo.setLockPosName(pos.getPosName());
reelLocInfo.setLockPosId(pos.getId());
ReelLockPosUtil.addReelLockPosInfo(reelLocInfo, cidList);
needRemoveLockPosId.add(pos.getId());
pos = null;
posName = "";
} else {
......@@ -984,29 +991,60 @@ public class DeviceController {
//是外侧库位,直接锁定外侧库位
log.info("查找到外侧库位作为目标库位,锁定库位 :" + pos.getPosName() + "=" + getLockPosKey(needMovePos.getStorageId()));
AddLock(pos, getLockPosKey(needMovePos.getStorageId()), cidList);
//判断里侧库位是否锁定
log.info(posName + "以F结尾,需要判断里侧有没有锁定");
String newPosName = posName.substring(0, posName.length() - 1);
newPosName = newPosName + "B";
StoragePos storagePos = storagePosManager.getByPosName(newPosName);
if (storagePos != null) {
Set<String> allLockPosIds = ReelLockPosUtil.getAllLockPosIds();
if (allLockPosIds.contains(storagePos.getId())) {
log.info(posName + "里侧有锁定的库位,清除条码[" + barcode.getBarcode() + "]锁定库位");
ReelLockPosUtil.removeReelLockPosInfo(barcode.getBarcode());
//如果外侧有任务,则改成新库位一样的
DataLog dataLog = null;
for (DataLog queueTask : taskService.getQueueTasks()) {
if (barcode.getBarcode().equals(queueTask)) {
dataLog = queueTask;
break;
ReelLockPosInfo reelLocInfo = new ReelLockPosInfo();
reelLocInfo.setBarcode(pos.getId());
reelLocInfo.setCid(dataCache.getStorageById(pos.getStorageId()).getCid());
reelLocInfo.setLockPosName(pos.getPosName());
reelLocInfo.setLockPosId(pos.getId());
ReelLockPosUtil.addReelLockPosInfo(reelLocInfo, cidList);
needRemoveLockPosId.add(pos.getId());
// needRemoveReelLockPosIdList.add(pos.getId());
pos = null;
}
}
if (dataLog != null) {
log.info("posName:[{}],barcode为[{}]有任务,需要重新设置任务库位:[{}]", dataLog.getPosName(), barcode.getBarcode(), pos.getPosName());
dataLog.setPosName(pos.getPosName());
dataLog.setPosId(pos.getId());
if (dataLog.isExecuting() || dataLog.isWait()) {
dataLog.setStatus(OP_STATUS.WAIT.name());
taskService.updateQueueTask(dataLog);
} else {
taskService.updateFinishedTask(dataLog);
if (pos != null) {
AddLock(pos, getLockPosKey(needMovePos.getStorageId()), cidList);
//如果外侧有任务,则改成新库位一样的
DataLog dataLog = null;
for (DataLog queueTask : taskService.getQueueTasks()) {
if (barcode.getBarcode().equals(queueTask)) {
dataLog = queueTask;
break;
}
}
if (dataLog != null) {
log.info("posName:[{}],barcode为[{}]有任务,需要重新设置任务库位:[{}]", dataLog.getPosName(), barcode.getBarcode(), pos.getPosName());
dataLog.setPosName(pos.getPosName());
dataLog.setPosId(pos.getId());
if (dataLog.isExecuting() || dataLog.isWait()) {
dataLog.setStatus(OP_STATUS.WAIT.name());
taskService.updateQueueTask(dataLog);
} else {
taskService.updateFinishedTask(dataLog);
}
}
}
}
}
//判断有没有锁定的异常库位
if (needRemoveLockPosId != null && !needRemoveLockPosId.isEmpty()){
for (String posId : needRemoveLockPosId) {
ReelLockPosUtil.removeReelLockPosInfo(posId);
}
}
}
}
//然后找lock库位,有的话返回
......@@ -1032,6 +1070,12 @@ public class DeviceController {
}
private void AddLock(StoragePos pos,String key,List<String> cidList) {
String reelLockPosId = ReelLockPosUtil.getReelLockPosId(key);
if (StringUtils.isNotEmpty(reelLockPosId)){
if (!reelLockPosId.equals(pos.getId())){
ReelLockPosUtil.removeReelLockPosInfo(key);
}
}
ReelLockPosInfo lockS = new ReelLockPosInfo();
lockS.setBarcode(key);
lockS.setCid(dataCache.getStorageById(pos.getStorageId()).getCid());
......
......@@ -77,6 +77,7 @@ public class ZhongcheApi extends BaseSmfApiListener {
paramMap.put("fullCode", fullCode);
try {
String result = HttpHelper.postJson(materialCountUrl, paramMap);
log.info(reelId+"收到点料结果为:"+result);
JSONObject resultObj = JSONObject.parseObject(result);
Integer code = resultObj.getInteger("code");
if (code != 0) {
......@@ -91,7 +92,7 @@ public class ZhongcheApi extends BaseSmfApiListener {
public void postCountData(String reelId, int countQty) {
log.info("判断是否点料,reelId为:" + reelId + ",数量为:" + countQty + ",地址为:" + postCountDataUrl);
log.info("点料结果上传,reelId为:" + reelId + ",数量为:" + countQty + ",地址为:" + postCountDataUrl);
if (StringUtils.isEmpty(postCountDataUrl)){
return;
}
......@@ -101,6 +102,7 @@ public class ZhongcheApi extends BaseSmfApiListener {
String result = "";
try {
result = HttpHelper.postJson(postCountDataUrl, paramMap);
log.info(reelId+"点料上传结果为:"+result);
JSONObject resultObj = JSONObject.parseObject(result);
Integer code = resultObj.getInteger("code");
if (code != 0) {
......@@ -143,6 +145,7 @@ public class ZhongcheApi extends BaseSmfApiListener {
throw new ValidateException("smfcore.barcode.checkError", "[{0}]", new String[]{msg});
}
} catch (ApiException e) {
log.info("S0005出到货架上,请求接口异常:",e);
throw new ValidateException("smfcore.barcode.checkNg", "验证失败:{0}", new String[]{e.getMessage()});
}
}
......
......@@ -130,6 +130,19 @@ public class ZhongCheDeviceController {
return ResultBean.newErrorResult(-1, "smfcore.materialBox.inPos", "物料已在库位{0}中", new String[]{posName});
}
int countQty = Integer.parseInt(countQtyStr);
if (barcode.getAmount() != 1){
if (barcode.getAmount() < countQty){
return ResultBean.newErrorResult(-1,"","点料结果:"+countQty+",大于wms返回结果:"+barcode.getAmount());
}
int difference = countQty * 100 / barcode.getAmount();
if (difference < 99){
log.info("差异数为:"+difference);
return ResultBean.newErrorResult(-1,"","点料结果:"+countQty+",wms返回结果:"+barcode.getAmount()+"相差超过99%");
}
}
try {
zhongcheApi.postCountData(barcode.getBarcode(), countQty);
} catch (ValidateException e) {
......@@ -275,6 +288,8 @@ public class ZhongCheDeviceController {
StoragePos pos = null;
int loopCount = 0;
List<String> needRemoveLockPosId = new ArrayList<>();
while (pos == null) {
loopCount++;
if (loopCount >= 10) {
......@@ -294,7 +309,9 @@ public class ZhongCheDeviceController {
StoragePos storagePos = storagePosManager.getByPosName(posName);
if (storagePos != null) {
if (storagePos.getBarcode() != null) {
Set<String> allLockPosIds = ReelLockPosUtil.getAllLockPosIds();
boolean contains = allLockPosIds.contains(storagePos.getId());
if (storagePos.getBarcode() != null || contains) {
log.info(posName + "有物料信息,重新查找库位,清除条码[" + barcode.getBarcode() + "]锁定库位");
ReelLockPosUtil.removeReelLockPosInfo(barcode.getBarcode());
......@@ -304,11 +321,43 @@ public class ZhongCheDeviceController {
reelLocInfo.setLockPosName(pos.getPosName());
reelLocInfo.setLockPosId(pos.getId());
ReelLockPosUtil.addReelLockPosInfo(reelLocInfo, findCidList);
needRemoveLockPosId.add(pos.getId());
// needRemoveReelLockPosIdList.add(pos.getId());
pos = null;
}
}
} else {
//判断里侧库位是否锁定
log.info(posName + "以F结尾,需要判断里侧有没有锁定");
posName = posName.substring(0, posName.length() - 1);
posName = posName + "B";
StoragePos storagePos = storagePosManager.getByPosName(posName);
if (storagePos != null) {
Set<String> allLockPosIds = ReelLockPosUtil.getAllLockPosIds();
if (allLockPosIds.contains(storagePos.getId())) {
log.info(posName + "里侧有锁定的库位,清除条码[" + barcode.getBarcode() + "]锁定库位");
ReelLockPosUtil.removeReelLockPosInfo(barcode.getBarcode());
ReelLockPosInfo reelLocInfo = new ReelLockPosInfo();
reelLocInfo.setBarcode(pos.getId());
reelLocInfo.setCid(dataCache.getStorageById(pos.getStorageId()).getCid());
reelLocInfo.setLockPosName(pos.getPosName());
reelLocInfo.setLockPosId(pos.getId());
ReelLockPosUtil.addReelLockPosInfo(reelLocInfo, findCidList);
needRemoveLockPosId.add(pos.getId());
// needRemoveReelLockPosIdList.add(pos.getId());
pos = null;
}
}
}
}
//判断有没有锁定的异常库位
if (needRemoveLockPosId != null && !needRemoveLockPosId.isEmpty()){
for (String posId : needRemoveLockPosId) {
ReelLockPosUtil.removeReelLockPosInfo(posId);
}
}
......
......@@ -5,11 +5,12 @@ api:
name: 1568
inCheckUrl: #入库验证
outNotifyUrl: #出库通知
inNotifyUrl: #入库通知
inNotifyUrl: http://10.96.31.231:8082/smfApi/pushWarehouseCompleteNoticeInfo #入库通知
fetchOrderUrl: #获取工单
materialCountUrl: #是否点料
postCountDataUrl: #点料结果上传
shelfFullNotificationUrl: #货架放满通知
materialCountUrl: http://10.96.31.231:8082/smfApi/pushInvVerificationInfo #是否点料
postCountDataUrl: http://10.96.31.231:8082/smfApi/pushOrderResultUploadInfo #点料结果上传
shelfFullNotificationUrl: http://10.96.31.231:8082/smfApi/pushPickInstNoticeInfo #货架放满通知
orderNotifyUrl: 1
......@@ -52,7 +53,7 @@ app:
type: ""
menu:
show: message
show:
hide:
smd:
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!