Commit b0783a6e LN

点料完成调用API008. 解析条码失败未加入入库单NG中

1 个父辈 6972d10f
...@@ -279,11 +279,15 @@ public class CodeResolve { ...@@ -279,11 +279,15 @@ public class CodeResolve {
boolean needUpdate = false; boolean needUpdate = false;
int lastLabelAmount = barcode.getLabelAmount(); int lastLabelAmount = barcode.getLabelAmount();
int currentLabelAmount = barcodeFromRule.getAmount(); int currentLabelAmount = barcodeFromRule.getAmount();
if(currentLabelAmount != lastLabelAmount){ //如果点过料,不再更新数量
//本次解析出来的数量与上次条码解析出来的数量不一样,重新设置数量 if( currentLabelAmount != lastLabelAmount) {
log.info("重新设置"+codeBeanFromRule.getCodeStr()+"数量为:"+currentLabelAmount);
barcode.setAmount(currentLabelAmount);
barcode.setLabelAmount(currentLabelAmount); barcode.setLabelAmount(currentLabelAmount);
if (barcode.getXrayCount() > 0) {
log.info("重新设置" + codeBeanFromRule.getCodeStr() + "标签数量为:" + currentLabelAmount);
} else {
log.info("重新设置" + codeBeanFromRule.getCodeStr() + "标签数量和实时数量为:" + currentLabelAmount);
barcode.setAmount(currentLabelAmount);
}
needUpdate = true; needUpdate = true;
} }
......
...@@ -725,7 +725,7 @@ public class RobotBoxHandler extends BaseDeviceHandler { ...@@ -725,7 +725,7 @@ public class RobotBoxHandler extends BaseDeviceHandler {
} }
} catch (ValidateException ve) { } catch (ValidateException ve) {
errorMsg= MessageUtils.getText(ve.getMsgKey(),ve.getMsgParam(),new Locale("en","US"),ve.getDefaultMsg()); errorMsg= MessageUtils.getText(ve.getMsgKey(),ve.getMsgParam(),new Locale("en","US"),ve.getDefaultMsg());
if(ObjectUtil.isEmpty(apiBarcode)){ if(ObjectUtil.isNotEmpty(apiBarcode)){
log.info("Failed to find empty storage space:" + errorMsg+",update state"); log.info("Failed to find empty storage space:" + errorMsg+",update state");
loadingUtil.updateItemState(apiBarcode,"", INITEM_STATUS.NG,errorMsg); loadingUtil.updateItemState(apiBarcode,"", INITEM_STATUS.NG,errorMsg);
}else{ }else{
......
...@@ -8,6 +8,7 @@ import com.google.common.collect.Lists; ...@@ -8,6 +8,7 @@ import com.google.common.collect.Lists;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import com.neotel.smfcore.common.bean.ReelLockPosInfo; import com.neotel.smfcore.common.bean.ReelLockPosInfo;
import com.neotel.smfcore.common.bean.ResultBean; import com.neotel.smfcore.common.bean.ResultBean;
import com.neotel.smfcore.common.exception.ApiException;
import com.neotel.smfcore.common.exception.ValidateException; import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.common.utils.Constants; import com.neotel.smfcore.common.utils.Constants;
import com.neotel.smfcore.common.utils.ReelLockPosUtil; import com.neotel.smfcore.common.utils.ReelLockPosUtil;
...@@ -21,6 +22,8 @@ import com.neotel.smfcore.core.barcode.service.po.Component; ...@@ -21,6 +22,8 @@ import com.neotel.smfcore.core.barcode.service.po.Component;
import com.neotel.smfcore.core.barcode.utils.CodeResolve; import com.neotel.smfcore.core.barcode.utils.CodeResolve;
import com.neotel.smfcore.core.device.bean.PosInfo; import com.neotel.smfcore.core.device.bean.PosInfo;
import com.neotel.smfcore.core.device.enums.OP_STATUS; import com.neotel.smfcore.core.device.enums.OP_STATUS;
import com.neotel.smfcore.core.inList.enums.INITEM.INITEM_STATUS;
import com.neotel.smfcore.core.inList.service.po.InList;
import com.neotel.smfcore.core.message.util.DeviceMessageUtil; import com.neotel.smfcore.core.message.util.DeviceMessageUtil;
import com.neotel.smfcore.core.order.service.po.LiteOrder; import com.neotel.smfcore.core.order.service.po.LiteOrder;
import com.neotel.smfcore.core.storage.service.manager.IStoragePosManager; import com.neotel.smfcore.core.storage.service.manager.IStoragePosManager;
...@@ -30,6 +33,8 @@ import com.neotel.smfcore.core.system.service.po.AlarmInfo; ...@@ -30,6 +33,8 @@ import com.neotel.smfcore.core.system.service.po.AlarmInfo;
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.micron1053.api.MicronApi;
import com.neotel.smfcore.custom.micron1053.loading.util.LoadingUtil;
import com.neotel.smfcore.security.annotation.AnonymousAccess; import com.neotel.smfcore.security.annotation.AnonymousAccess;
import com.neotel.smfcore.core.storage.enums.DeviceType; import com.neotel.smfcore.core.storage.enums.DeviceType;
import com.neotel.smfcore.core.device.handler.IDeviceHandler; import com.neotel.smfcore.core.device.handler.IDeviceHandler;
...@@ -70,6 +75,8 @@ public class DeviceController { ...@@ -70,6 +75,8 @@ public class DeviceController {
@Autowired @Autowired
private IBarcodeManager barcodeManager; private IBarcodeManager barcodeManager;
@Autowired
private LoadingUtil loadingUtil;
/** /**
* 权限验证API列表 * 权限验证API列表
*/ */
...@@ -706,14 +713,42 @@ public class DeviceController { ...@@ -706,14 +713,42 @@ public class DeviceController {
if (StringUtils.isNotBlank(barcodeStr)) { if (StringUtils.isNotBlank(barcodeStr)) {
Barcode barcode = barcodeManager.findByBarcode(barcodeStr); Barcode barcode = barcodeManager.findByBarcode(barcodeStr);
if (barcode != null) { if (barcode != null) {
int amount = barcode.getAmount(); int oldQty = barcode.getAmount();
barcode.setAmount(NumberUtil.parseInt(amountStr)); int qty=NumberUtil.parseInt(amountStr);
barcode.setOriAmount(amount); barcode.setAmount(qty);
barcode.setOriAmount(oldQty);
barcode.setXrayCount(barcode.getXrayCount() + 1); barcode.setXrayCount(barcode.getXrayCount() + 1);
barcodeManager.save(barcode); barcodeManager.save(barcode);
return ResultBean.newOkResult(barcode.getOriAmount());
//处理入库单
InList inList = loadingUtil.getInlist();
if (inList == null) {
return ResultBean.newOkResult(qty);
}
try {
//上传数量
String result = MicronApi.Api008(barcode.getBarcode(), oldQty, qty);
if (ObjectUtil.isEmpty(result)) {
//点料已完成,等待获取库位号
loadingUtil.xRayEndUpdateItem(barcode.getBarcode(), qty, INITEM_STATUS.XRayEnd);
return ResultBean.newOkResult(qty);
} else {
loadingUtil.xRayEndUpdateItem(barcode.getBarcode(), qty, INITEM_STATUS.XRayFail);
return ResultBean.newErrorResult(1, "smfcore.micron.operationFailure", "操作失败");
}
} catch (ApiException api) {
loadingUtil.xRayEndUpdateItem(barcode.getBarcode(), qty, INITEM_STATUS.XRayFail);
return ResultBean.newErrorResult(1, api.getMsgKey(),api.getMessage());
}
} }
} }
return ResultBean.newErrorResult(-1, "smfcore.valueNotExist", "{0}[{1}]不存在", new String[]{"barcode", barcodeStr}); return ResultBean.newErrorResult(-1, "smfcore.valueNotExist", "{0}[{1}]不存在", new String[]{"barcode", barcodeStr});
} }
......
...@@ -613,7 +613,7 @@ public class MicronApi { ...@@ -613,7 +613,7 @@ public class MicronApi {
} }
public static boolean Api008(String serialNum, int qty, int newQty)throws ApiException { public static String Api008(String serialNum, int qty, int newQty)throws ApiException {
//点料结束通知点料结果 //点料结束通知点料结果
String url = config.getUrl(config.api_name_008); String url = config.getUrl(config.api_name_008);
//url = MessageFormat.format(url,serialNum,qty); //url = MessageFormat.format(url,serialNum,qty);
...@@ -642,7 +642,7 @@ public class MicronApi { ...@@ -642,7 +642,7 @@ public class MicronApi {
// if (micronResult.isOk()&& micronResult.statusIsSuccess()) { // if (micronResult.isOk()&& micronResult.statusIsSuccess()) {
String errMsg = getDErrorMsg(micronResult); String errMsg = getDErrorMsg(micronResult);
if (micronResult.isOk()) { if (micronResult.isOk()) {
return true; return "";
} else if (ObjectUtil.isNotEmpty(errMsg)) { } else if (ObjectUtil.isNotEmpty(errMsg)) {
log.info("API008 ,接口通信失败:"+errMsg); log.info("API008 ,接口通信失败:"+errMsg);
throw new ApiException(errMsg); throw new ApiException(errMsg);
...@@ -654,7 +654,7 @@ public class MicronApi { ...@@ -654,7 +654,7 @@ public class MicronApi {
} }
} catch (ApiException e) { } catch (ApiException e) {
log.error(url + "出错", e); log.error(url + "出错", e);
return false; return e.getMessage();
} }
} }
......
...@@ -363,22 +363,24 @@ public class MicronDeviceController { ...@@ -363,22 +363,24 @@ public class MicronDeviceController {
//TODO 更改条码数量 //TODO 更改条码数量
int oldQty = barcode.getAmount(); int oldQty = barcode.getAmount();
barcode.setAmount(qty); barcode.setAmount(qty);
barcode.setOriAmount(oldQty);
barcode.setXrayCount(barcode.getXrayCount() + 1);
barcodeManager.saveBarcode(barcode); barcodeManager.saveBarcode(barcode);
log.info("点料完成,更新条码[" + barcode.getBarcode() + "]数量=[" + qty + "],旧数量[" + oldQty + "]"); log.info("点料完成,更新条码[" + barcode.getBarcode() + "]数量=[" + qty + "],旧数量[" + oldQty + "]");
//处理入库单 //处理入库单
InList inList = loadingUtil.getInlist(); InList inList = loadingUtil.getInlist();
if (inList == null) { if (inList == null) {
return ResultBean.newOkResult("ok"); return ResultBean.newOkResult(qty);
} }
try { try {
//上传数量 //上传数量
boolean result = MicronApi.Api008(barcode.getBarcode(), oldQty, qty); String result = MicronApi.Api008(barcode.getBarcode(), oldQty, qty);
if (result) { if (ObjectUtil.isEmpty(result)) {
//点料已完成,等待获取库位号 //点料已完成,等待获取库位号
loadingUtil.xRayEndUpdateItem(barcode.getBarcode(), qty, INITEM_STATUS.XRayEnd); loadingUtil.xRayEndUpdateItem(barcode.getBarcode(), qty, INITEM_STATUS.XRayEnd);
return ResultBean.newOkResult("ok"); return ResultBean.newOkResult(qty);
} else { } else {
loadingUtil.xRayEndUpdateItem(barcode.getBarcode(), qty, INITEM_STATUS.XRayFail); loadingUtil.xRayEndUpdateItem(barcode.getBarcode(), qty, INITEM_STATUS.XRayFail);
...@@ -387,7 +389,7 @@ public class MicronDeviceController { ...@@ -387,7 +389,7 @@ public class MicronDeviceController {
} catch (ApiException api) { } catch (ApiException api) {
loadingUtil.xRayEndUpdateItem(barcode.getBarcode(), qty, INITEM_STATUS.XRayFail); loadingUtil.xRayEndUpdateItem(barcode.getBarcode(), qty, INITEM_STATUS.XRayFail);
return ResultBean.newErrorResult(1, "smfcore.micron.operationFailure", "操作失败"); return ResultBean.newErrorResult(1, api.getMsgKey(),api.getMessage());
} }
} }
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!