Commit 3be908f0 zshaohui

Merge remote-tracking branch 'origin/master'

2 个父辈 7da80115 7083680e
package com.neotel.smfcore.core.device.rest;
import cn.hutool.core.util.ObjectUtil;
import com.neotel.smfcore.common.bean.ResultBean;
import com.neotel.smfcore.core.barcode.service.po.Barcode;
import com.neotel.smfcore.core.device.util.DataCache;
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.StoragePos;
import com.neotel.smfcore.core.system.util.TaskService;
import com.neotel.smfcore.security.annotation.AnonymousAccess;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.Map;
@Slf4j
@RestController
@Api(tags = "设备通信(SP料仓)")
public class SpDeviceController {
@Autowired
private DataCache dataCache;
@Autowired
private IStoragePosManager storagePosManager;
@Autowired
private TaskService taskService;
@ApiOperation("查询指定库位的物料信息")
@RequestMapping(value = "/service/store/posReelInfo")
@ResponseBody
@AnonymousAccess
public ResultBean posReelInfo(HttpServletRequest request) {
String cid = request.getParameter("cid");
String posName = request.getParameter("posName");
if (ObjectUtil.isEmpty(cid) || ObjectUtil.isEmpty(posName)) {
return ResultBean.newErrorResult(-1, "smfcore.reelPosMove.paramerror", "参数不完整");
}
Storage storage = dataCache.getStorage(cid);
if (storage == null) {
return ResultBean.newErrorResult(-1, "smfcore.valueNotExist", "{0}[{1}]不存在",new String[]{"Storage",cid});
}
StoragePos pos = storagePosManager.getByPosName(posName);
if(pos==null){
return ResultBean.newErrorResult(-1, "smfcore.valueNotExist", "{0}[{1}]不存在",new String[]{"posName",posName});
}
if (pos.getBarcode() != null) {
Map<String, String> data = new HashMap<>();
data.put("barcode", pos.getBarcode().getBarcode());
data.put("plateW", pos.getBarcode().getPlateSize() + "");
data.put("plateH", pos.getBarcode().getHeight() + "");
return ResultBean.newOkResult(data);
}
return ResultBean.newErrorResult(-1, "smfcore.reelPosMove.posIsNull", "库位[{1}]为空",new String[]{"posName",posName});
}
@ApiOperation("锡膏料仓,客户端自动移库功能")
@RequestMapping(value = "/service/store/reelPosMove")
@ResponseBody
@AnonymousAccess
public ResultBean reelPosMove(HttpServletRequest request) {
String cid = request.getParameter("cid");//CID
String barcode = request.getParameter("barcode");//条码
String posName = request.getParameter("posName");//原库位号
String targetPosName = request.getParameter("targetPosName");//目标库位号
if (ObjectUtil.isEmpty(cid) || ObjectUtil.isEmpty(posName)) {
return ResultBean.newErrorResult(-1, "smfcore.reelPosMove.paramerror", "参数不完整");
}
Storage storage = dataCache.getStorage(cid);
if (storage == null) {
return ResultBean.newErrorResult(-1, "smfcore.valueNotExist", "{0}[{1}]不存在", new String[]{"Storage", cid});
}
StoragePos pos = storagePosManager.getByPosName(posName);
if (pos == null) {
return ResultBean.newErrorResult(-1, "smfcore.valueNotExist", "{0}[{1}]不存在", new String[]{"posName", posName});
}
if (pos.getBarcode() == null) {
return ResultBean.newErrorResult(-1, "smfcore.reelPosMove.posIsNull", "库位[{1}]为空", new String[]{"posName", posName});
}
if (!pos.getBarcode().getBarcode().equals(barcode)) {
//原库位条码不匹配
return ResultBean.newErrorResult(-1, "smfcore.reelPosMove.barcodeError", "库位{0}条码为{1},与移库条码{1}不一致", new String[]{posName, pos.getBarcode().getBarcode(), barcode});
}
StoragePos targetPos = storagePosManager.getByPosName(targetPosName);
if (targetPos == null) {
return ResultBean.newErrorResult(-1, "smfcore.valueNotExist", "{0}[{1}]不存在", new String[]{"targetPosName", targetPosName});
}
if(targetPos.getBarcode()!=null){
return ResultBean.newErrorResult(-1, "smfcore.valueNotExist", "{0}[{1}]不存在", new String[]{"targetPosName", targetPosName});
}
Barcode posBarcode=pos.getBarcode();
taskService.addTaskToFinished(pos,pos.getBarcode(),"SpClient");
taskService.addTaskToFinished(targetPos,posBarcode,"SpClient");
return ResultBean.newOkResult("OK");
}
}
......@@ -436,4 +436,6 @@ smfcore.virtual.boxInPos=[{0}]\u5DF2\u5728\u5E93\u4F4D[{1}]\u4E2D,\u8BF7\u5148\u
smfcore.virtual.quantityError=\u53D6\u51FA\u6570\u91CF\u5E94\u4E3A[{0}]
smfcode.virtual.enter=\u8BF7\u626B\u63CF\u6216\u8F93\u5165\u6761\u7801\u540E\u6309\u56DE\u8F66\u786E\u8BA4
smfcore.auth.expire=\u6388\u6743\u5DF2\u8FC7\u671F
smfcore.order.slotNum=\u7AD9\u4F4D\u7F16\u53F7
\ No newline at end of file
smfcore.order.slotNum=\u7AD9\u4F4D\u7F16\u53F7
smfcore.reelPosMove.paramerror=\u53C2\u6570\u4E0D\u5B8C\u6574
smfcore.reelPosMove.posIsNull=\u5E93\u4F4D[{1}]\u4E3A\u7A7A
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!