Commit fe67051e LN

上传ng料时更新inlist对应的取消任务ngMSg. 点料接口返回点料次数。

1 个父辈 9b7c304a
......@@ -733,16 +733,20 @@ public class DeviceController {
if (ObjectUtil.isEmpty(result)) {
//点料已完成,等待获取库位号
loadingUtil.xRayEndUpdateItem(barcode.getBarcode(), qty, INITEM_STATUS.XRayEnd);
return ResultBean.newOkResult(qty);
return ResultBean.newOkResult(barcode.getXrayCount());
} else {
loadingUtil.xRayEndUpdateItem(barcode.getBarcode(), qty, INITEM_STATUS.XRayFail);
return ResultBean.newErrorResult(1, "smfcore.micron.operationFailure", "操作失败");
ResultBean<Object> resultBean= ResultBean.newErrorResult(1, "smfcore.micron.operationFailure", "操作失败");
resultBean.setData(barcode.getXrayCount());
return resultBean;
}
} catch (ApiException api) {
loadingUtil.xRayEndUpdateItem(barcode.getBarcode(), qty, INITEM_STATUS.XRayFail);
return ResultBean.newErrorResult(1, api.getMsgKey(),api.getMessage());
ResultBean<Object> resultBean= ResultBean.newErrorResult(1, api.getMsgKey(),api.getMessage());
resultBean.setData(barcode.getXrayCount());
return resultBean;
}
......
......@@ -103,6 +103,9 @@ public class InListItem extends BasePo implements Serializable {
|| state.equalsIgnoreCase(INITEM_STATUS.API001NG) ||state.equalsIgnoreCase(INITEM_STATUS.NG);
}
public boolean isCancel() {
return state.equalsIgnoreCase(INITEM_STATUS.Cancel);
}
public boolean isSuccess(){
return state.equalsIgnoreCase(INITEM_STATUS.Success)||state.equalsIgnoreCase(INITEM_STATUS.PutIn)||
......
......@@ -147,6 +147,9 @@ public class MicronDeviceController {
log.info("uploadNgReel : [" + info.getNgPos() + "],barcode:[" + info.getBarcode() + "],posName:[" + info.getPosName() + "]type:[" + info.getMType() + "]inout:[" + info.getType() + "],msg[" + info.getNgMsg() + "]");
MicronDataCache.uploadNgReel(info);
loadingUtil.updateNgReel(info);
return ResultBean.newOkResult("ok");
}
......@@ -334,65 +337,65 @@ public class MicronDeviceController {
// return ResultBean.newOkResult("");
// }
@ApiOperation("X-Ray点料完成,更新数量 ")
@PostMapping(value = "/updateReelQty")
@ResponseBody
@AnonymousAccess
public ResultBean updateReelQty(HttpServletRequest request) {
String barcodeStr = request.getParameter("barcode").toString();
Integer qty = Integer.parseInt(request.getParameter("qty").toString());
log.info("X-Ray点料完成:barcode=" + barcodeStr + ",qty=" + qty);
Collection<CodeBean> codeBeans = codeResolve.resolveCodeStr(barcodeStr, COMPONENT_TYPE.COMPONENT);
Barcode barcode = null;
for (CodeBean codeBean : codeBeans) {
if (codeBean.isValid()) {
if (barcode != null) {
String msg = "获取尺寸时找到多个有效条码";
return ResultBean.newErrorResult(105, "smfcore.getSize.error", "获取" + barcodeStr + "尺寸失败:有多个条码");
} else {
barcode = codeBean.getBarcode();
}
}
}
if (barcode == null) {
return ResultBean.newErrorResult(105, "smfcore.getSize.error", "获取" + barcodeStr + "尺寸失败:未找到有效条码");
}
//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(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());
}
}
//
// @ApiOperation("X-Ray点料完成,更新数量 ")
// @PostMapping(value = "/updateReelQty")
// @ResponseBody
// @AnonymousAccess
// public ResultBean updateReelQty(HttpServletRequest request) {
// String barcodeStr = request.getParameter("barcode").toString();
// Integer qty = Integer.parseInt(request.getParameter("qty").toString());
// log.info("X-Ray点料完成:barcode=" + barcodeStr + ",qty=" + qty);
// Collection<CodeBean> codeBeans = codeResolve.resolveCodeStr(barcodeStr, COMPONENT_TYPE.COMPONENT);
// Barcode barcode = null;
// for (CodeBean codeBean : codeBeans) {
// if (codeBean.isValid()) {
// if (barcode != null) {
// String msg = "获取尺寸时找到多个有效条码";
//
// return ResultBean.newErrorResult(105, "smfcore.getSize.error", "获取" + barcodeStr + "尺寸失败:有多个条码");
// } else {
// barcode = codeBean.getBarcode();
// }
//
// }
// }
// if (barcode == null) {
// return ResultBean.newErrorResult(105, "smfcore.getSize.error", "获取" + barcodeStr + "尺寸失败:未找到有效条码");
// }
// //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(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());
// }
//
// }
@ApiOperation("RFID入库完成")
@PostMapping(value = "/rfidPutInEnd")
......
......@@ -4,6 +4,7 @@ import cn.hutool.core.util.ObjectUtil;
import com.neotel.smfcore.common.utils.Constants;
import com.neotel.smfcore.common.utils.StringUtils;
import com.neotel.smfcore.core.barcode.service.po.Barcode;
import com.neotel.smfcore.core.barcode.utils.CodeResolve;
import com.neotel.smfcore.core.device.util.DataCache;
import com.neotel.smfcore.core.inList.enums.INITEM.INITEM_STATUS;
import com.neotel.smfcore.core.inList.enums.INLIST_STATUS;
......@@ -16,6 +17,7 @@ import com.neotel.smfcore.core.storage.service.manager.IStoragePosManager;
import com.neotel.smfcore.core.storage.service.po.StoragePos;
import com.neotel.smfcore.core.system.service.po.DataLog;
import com.neotel.smfcore.custom.micron1053.api.MicronApi;
import com.neotel.smfcore.custom.micron1053.bean.ML5NgReelInfo;
import com.neotel.smfcore.custom.micron1053.loading.Bean.LoadingInfo;
import com.neotel.smfcore.custom.micron1053.util.MicronDataCache;
import lombok.extern.slf4j.Slf4j;
......@@ -165,6 +167,51 @@ public class LoadingUtil {
}
protected CodeResolve codeResolve;
public Boolean updateNgReel(ML5NgReelInfo reelInfo){
try{
InList inList = getInlist();
if (inList == null) {
return false;
}
if(ObjectUtil.isEmpty(reelInfo.getBarcode())||ObjectUtil.isEmpty(reelInfo.getNgMsg())){
return false;}
//如果条形码可以找到就更新
Barcode barcode = codeResolve.resolveOneValideBarcode(reelInfo.getBarcode());
if(barcode!=null){
boolean update = false;
List<InListItem> inListItems = new ArrayList<>();
for (InListItem item :
inList.getInListItems()) {
if (item.getRi().equals(barcode)&&item.isCancel()) {
if (ObjectUtil.isEmpty(item.getNgMsg()) || item.getNgMsg().contains("canceled")) {
update=true;
item.setNgMsg(reelInfo.getNgMsg());
item = inListItemManager.save(item);
log.info(" 更新入库单[" + inList.getName() + "]:条码 [" + item.getRi() + "]库位[" + item.getPosName() + "]的 ngmsg=" + reelInfo.getNgMsg());
}
}
inListItems.add(item);
}
if (update) {
inList.setInListItems(inListItems);
inList = inListManager.save(inList);
inListCache.addInListToMap(inList);
}
return true;
}
}
catch (Exception exception){
log.error("updateNgReel "+reelInfo.getBarcode()+", "+reelInfo.getNgMsg()+" error :" ,exception);
}
return false;
}
public void xRayEndUpdateItem(String barcode,int count,String s) {
updateItemState(barcode, "", s);
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!