Commit d9427967 LN

API-003 接口修改

1 个父辈 89a087b4
package com.neotel.smfcore.custom.neotel;
import cn.hutool.core.util.ObjectUtil;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.neotel.smfcore.common.bean.ResultBean;
......@@ -18,6 +19,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.StoragePos;
import com.neotel.smfcore.core.system.util.DevicesStatusUtil;
import com.neotel.smfcore.custom.micron1053.util.MicronDataCache;
import com.neotel.smfcore.security.annotation.AnonymousAccess;
import com.neotel.smfcore.security.annotation.AnonymousPostMapping;
import io.swagger.annotations.ApiOperation;
......@@ -141,45 +143,92 @@ public class NeotelController {
@ApiOperation("6.3 获取实时库存")
@RequestMapping("/inventory")
@AnonymousAccess
public ResultBean inventory(@RequestBody Map<String, List<String>> paramMap) {
List<String> partNums = paramMap.get("partNums");
List<String> reelIds = paramMap.get("reelIds");
List<String> cids = paramMap.get("towerIds");
List<String> storageIds = new ArrayList<>();
if(cids != null){
for (String cid : cids) {
Storage storage = dataCache.getStorage(cid);
if(storage != null){
storageIds.add(storage.getId());
}
public ResultBean inventory(@RequestBody Map<String, Object> paramMap) {
//
// "Body=
// {
// ""material"":
// {
// ""serialNumList"": [<SerialNum>, <SerialNum>]|null,
// ""partNumberList"": [<PartNum>, <PartNum>] | null,
// }
// }"
// "Http Status code:
// 200 - Success
// ""{
// ""code"": 0,
// ""data"": [
// {
// ""towerId"": <TowerId>, 料仓名
// ""slot"": <slot>, 库位号
// ""materialStatus"": <MaterialStatus>,Available
// ""material"":
// {
// ""serialNum"": <SerialNum>,
// ""partNumber"": <PartNumber>,
// ""sapItem"": True|False, True
// ""mfgPartNum"": <MfgPartNum>,1P MPN
// ""mfgLotNum"": <MfgLotNum>,1T batch
// ""mfgName"": <MfgName>,21P provider
// ""qty"": <Qty>,
// ""expirationDateStr"": <ExpirationDateStr>,
// ""msLevel"": <MsLevel>,
// ""containerType"": <ContainerType>,
// ""arraySize"": <ArraySize>,
// ""panelNum"": <PanelNum>
// }
// }
// ]
// }"""
//mfg :生产商.
Map<String,Object> material=(Map<String,Object>)paramMap.get("material");
Object serialNumListStr=material.get("serialNumList");
List<String> serialNumList = new ArrayList<>();
if(ObjectUtil.isNotEmpty(serialNumListStr)){
serialNumList = (List<String>)serialNumListStr;
}
Object partNumberListStr=material.get("partNumberList");
List<String> partNumberList = new ArrayList<>();
if(ObjectUtil.isNotEmpty(partNumberListStr)){
partNumberList = (List<String>)partNumberListStr;
}
List<StoragePos> storagePosList = storagePosManager.findByBarcodesAndPartNums(storageIds, partNums, reelIds);
List<String> storageIds = new ArrayList<>();
List<StoragePos> storagePosList = storagePosManager.findByBarcodesAndPartNums(storageIds, partNumberList, serialNumList);
if (storagePosList != null) {
List<Map<String, Object>> resultMapList = new ArrayList<>();
for (StoragePos storagePos : storagePosList) {
Map<String, Object> objMap = new HashMap<>();
Storage storage = dataCache.getStorageById(storagePos.getStorageId());
objMap.put("towerId", storage.getName());
objMap.put("slot", storagePos.getPosName());
objMap.put("materialStatus", "Available");
Barcode barcode = storagePos.getBarcode();
if (barcode != null) {
if (barcode.getSubCodeList() != null && !barcode.getSubCodeList().isEmpty()) {
for (Barcode subBarcode : barcode.getSubCodeList()) {
Map<String, Object> resultMap = new HashMap<>();
resultMap.put("uid", subBarcode.getBarcode());
resultMap.put("qty", subBarcode.getAmount());
resultMap.put("towerId", storagePos.getStorageId());
resultMap.put("location", storagePos.getPosName());
resultMap.put("partNum", subBarcode.getPartNumber());
resultMapList.add(resultMap);
}
} else {
Map<String, Object> resultMap = new HashMap<>();
resultMap.put("uid", barcode.getBarcode());
if (barcode != null) {
resultMap.put("serialNum", barcode.getBarcode());
resultMap.put("partNumber", barcode.getPartNumber());
resultMap.put("sapItem", "True");
resultMap.put("mfgPartNum", barcode.getMpn());
resultMap.put("mfgLotNum", barcode.getBatch());
resultMap.put("mfgName", barcode.getProvider());
resultMap.put("qty", barcode.getAmount());
resultMap.put("towerId", storagePos.getStorageId());
resultMap.put("location", storagePos.getPosName());
resultMap.put("partNum", barcode.getPartNumber());
resultMapList.add(resultMap);
}
resultMap.put("expirationDateStr", barcode.getExpireDateStr());
resultMap.put("msLevel", barcode.getMsl());
String reelType= MicronDataCache.GetReelType(barcode.getPlateSize(),barcode.getHeight());
resultMap.put("containerType", reelType);//类型
resultMap.put("arraySize", barcode.getQ1Item());//1Q
resultMap.put("panelNum", barcode.getQItem());//Q
objMap.put("material", resultMap);
}
resultMapList.add(objMap);
}
return ResultBean.newOkResult(resultMapList);
}
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!