Commit b0783a6e LN

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

1 个父辈 6972d10f
......@@ -279,11 +279,15 @@ public class CodeResolve {
boolean needUpdate = false;
int lastLabelAmount = barcode.getLabelAmount();
int currentLabelAmount = barcodeFromRule.getAmount();
if(currentLabelAmount != lastLabelAmount){
//本次解析出来的数量与上次条码解析出来的数量不一样,重新设置数量
log.info("重新设置"+codeBeanFromRule.getCodeStr()+"数量为:"+currentLabelAmount);
barcode.setAmount(currentLabelAmount);
//如果点过料,不再更新数量
if( currentLabelAmount != lastLabelAmount) {
barcode.setLabelAmount(currentLabelAmount);
if (barcode.getXrayCount() > 0) {
log.info("重新设置" + codeBeanFromRule.getCodeStr() + "标签数量为:" + currentLabelAmount);
} else {
log.info("重新设置" + codeBeanFromRule.getCodeStr() + "标签数量和实时数量为:" + currentLabelAmount);
barcode.setAmount(currentLabelAmount);
}
needUpdate = true;
}
......
......@@ -725,7 +725,7 @@ public class RobotBoxHandler extends BaseDeviceHandler {
}
} catch (ValidateException ve) {
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");
loadingUtil.updateItemState(apiBarcode,"", INITEM_STATUS.NG,errorMsg);
}else{
......
......@@ -8,6 +8,7 @@ import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.neotel.smfcore.common.bean.ReelLockPosInfo;
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.utils.Constants;
import com.neotel.smfcore.common.utils.ReelLockPosUtil;
......@@ -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.device.bean.PosInfo;
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.order.service.po.LiteOrder;
import com.neotel.smfcore.core.storage.service.manager.IStoragePosManager;
......@@ -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.util.DevicesStatusUtil;
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.core.storage.enums.DeviceType;
import com.neotel.smfcore.core.device.handler.IDeviceHandler;
......@@ -70,6 +75,8 @@ public class DeviceController {
@Autowired
private IBarcodeManager barcodeManager;
@Autowired
private LoadingUtil loadingUtil;
/**
* 权限验证API列表
*/
......@@ -706,14 +713,42 @@ public class DeviceController {
if (StringUtils.isNotBlank(barcodeStr)) {
Barcode barcode = barcodeManager.findByBarcode(barcodeStr);
if (barcode != null) {
int amount = barcode.getAmount();
barcode.setAmount(NumberUtil.parseInt(amountStr));
barcode.setOriAmount(amount);
int oldQty = barcode.getAmount();
int qty=NumberUtil.parseInt(amountStr);
barcode.setAmount(qty);
barcode.setOriAmount(oldQty);
barcode.setXrayCount(barcode.getXrayCount() + 1);
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});
}
......
......@@ -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);
//url = MessageFormat.format(url,serialNum,qty);
......@@ -642,7 +642,7 @@ public class MicronApi {
// if (micronResult.isOk()&& micronResult.statusIsSuccess()) {
String errMsg = getDErrorMsg(micronResult);
if (micronResult.isOk()) {
return true;
return "";
} else if (ObjectUtil.isNotEmpty(errMsg)) {
log.info("API008 ,接口通信失败:"+errMsg);
throw new ApiException(errMsg);
......@@ -654,7 +654,7 @@ public class MicronApi {
}
} catch (ApiException e) {
log.error(url + "出错", e);
return false;
return e.getMessage();
}
}
......
......@@ -363,22 +363,24 @@ public class MicronDeviceController {
//TODO 更改条码数量
int oldQty = barcode.getAmount();
barcode.setAmount(qty);
barcode.setOriAmount(oldQty);
barcode.setXrayCount(barcode.getXrayCount() + 1);
barcodeManager.saveBarcode(barcode);
log.info("点料完成,更新条码[" + barcode.getBarcode() + "]数量=[" + qty + "],旧数量[" + oldQty + "]");
//处理入库单
InList inList = loadingUtil.getInlist();
if (inList == null) {
return ResultBean.newOkResult("ok");
return ResultBean.newOkResult(qty);
}
try {
//上传数量
boolean result = MicronApi.Api008(barcode.getBarcode(), oldQty, qty);
if (result) {
String result = MicronApi.Api008(barcode.getBarcode(), oldQty, qty);
if (ObjectUtil.isEmpty(result)) {
//点料已完成,等待获取库位号
loadingUtil.xRayEndUpdateItem(barcode.getBarcode(), qty, INITEM_STATUS.XRayEnd);
return ResultBean.newOkResult("ok");
return ResultBean.newOkResult(qty);
} else {
loadingUtil.xRayEndUpdateItem(barcode.getBarcode(), qty, INITEM_STATUS.XRayFail);
......@@ -387,7 +389,7 @@ public class MicronDeviceController {
} catch (ApiException api) {
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!