Commit 0f12aa05 张少辉

1.点料结果上传对接

1 个父辈 20017caf
package com.neotel.smfcore.custom.neotel; package com.neotel.smfcore.custom.neotel;
import com.alibaba.fastjson.JSON;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import com.neotel.smfcore.common.bean.ResultBean; import com.neotel.smfcore.common.bean.ResultBean;
import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.common.utils.JsonUtil; import com.neotel.smfcore.common.utils.JsonUtil;
import com.neotel.smfcore.common.utils.StorageConstants; import com.neotel.smfcore.common.utils.StorageConstants;
import com.neotel.smfcore.core.barcode.service.manager.IBarcodeManager;
import com.neotel.smfcore.core.barcode.service.po.Barcode; import com.neotel.smfcore.core.barcode.service.po.Barcode;
import com.neotel.smfcore.core.barcode.utils.CodeResolve;
import com.neotel.smfcore.core.device.bean.BoxStatusBean; import com.neotel.smfcore.core.device.bean.BoxStatusBean;
import com.neotel.smfcore.core.device.bean.StatusBean; import com.neotel.smfcore.core.device.bean.StatusBean;
import com.neotel.smfcore.core.device.util.DataCache; import com.neotel.smfcore.core.device.util.DataCache;
...@@ -18,6 +22,7 @@ import com.neotel.smfcore.core.storage.service.manager.IStoragePosManager; ...@@ -18,6 +22,7 @@ import com.neotel.smfcore.core.storage.service.manager.IStoragePosManager;
import com.neotel.smfcore.core.storage.service.po.Storage; import com.neotel.smfcore.core.storage.service.po.Storage;
import com.neotel.smfcore.core.storage.service.po.StoragePos; import com.neotel.smfcore.core.storage.service.po.StoragePos;
import com.neotel.smfcore.core.system.util.DevicesStatusUtil; import com.neotel.smfcore.core.system.util.DevicesStatusUtil;
import com.neotel.smfcore.custom.neotel.bean.XrayUploadResult;
import com.neotel.smfcore.security.annotation.AnonymousAccess; import com.neotel.smfcore.security.annotation.AnonymousAccess;
import com.neotel.smfcore.security.annotation.AnonymousPostMapping; import com.neotel.smfcore.security.annotation.AnonymousPostMapping;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
...@@ -47,6 +52,11 @@ public class NeotelController { ...@@ -47,6 +52,11 @@ public class NeotelController {
@Autowired @Autowired
private IStoragePosManager storagePosManager; private IStoragePosManager storagePosManager;
@Autowired
private CodeResolve codeResolve;
@Autowired
private IBarcodeManager barcodeManager;
@ApiOperation("6.1创建需求单") @ApiOperation("6.1创建需求单")
@RequestMapping("/outInfo") @RequestMapping("/outInfo")
...@@ -258,4 +268,30 @@ public class NeotelController { ...@@ -258,4 +268,30 @@ public class NeotelController {
return ResultBean.newOkResult(results); return ResultBean.newOkResult(results);
} }
@ApiOperation("6.5 点料结果上传")
@RequestMapping("/xrayUploadResult")
@AnonymousAccess
public ResultBean xrayUploadResult(@RequestBody XrayUploadResult xrayUploadResult) {
log.info("收到点料信息上传:" + JSON.toJSONString(xrayUploadResult));
String reelId = xrayUploadResult.getReelId();
int qty = xrayUploadResult.getQty();
//解析条码是否存在
Barcode barcode = codeResolve.resolveOneValideBarcode(reelId);
if (barcode == null) {
return ResultBean.newErrorResult(-1, "smfcore.error.barcode.invalid", "{0}不是有效的条码", new String[]{reelId});
}
//判断数量是否为0
if (qty <= 0) {
throw new ValidateException("smfcore.error.barcode.wrongQty", "条码[{0}]对应的数量<=0为: {1}", new String[]{reelId, qty + ""});
}
//判断是否在库存中
StoragePos pos = storagePosManager.getByBarcode(reelId);
if (pos != null) {
//smfcore.materialBox.inPos=物料已在库位{0}中
return ResultBean.newErrorResult(-1, "smfcore.materialBox.inPos", "物料已在库位{0}中", new String[]{pos.getPosName()});
}
barcode.setAmount(qty);
barcodeManager.save(barcode);
return ResultBean.newOkResult("");
}
} }
package com.neotel.smfcore.custom.neotel.bean;
import lombok.Data;
@Data
public class XrayUploadResult {
private String reelId;
private int qty;
}
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!