Commit 0f7e4b3c zshaohui

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

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