Commit 5cf67429 LN

20031料仓修改。

1 个父辈 71ec535e
......@@ -271,6 +271,13 @@ public class CsvReader {
}
return index;
}
public int getHasCsvIndex(String titleName,String titleNameEn){
int index = getIndex(titleName,titleNameEn);
if(index == -1){
log.info("未包含【"+titleName+"】或【"+titleNameEn+"】列");
}
return index;
}
/**
* Gets whether leading and trailing whitespace characters are being trimmed
* from non-textqualified column data. Default is true.
......
......@@ -159,7 +159,7 @@ public class SpBoxController {
/**
* 取消锡膏定时出库
*/
@RequestMapping("/service/store/solder/clearOutDate")
@RequestMapping("/clearOutDate")
@ResponseBody
public ResultBean clearOutDate(HttpServletRequest request){
String pid = request.getParameter("pid");
......@@ -174,6 +174,7 @@ public class SpBoxController {
try {
Barcode barcode = pos.getBarcode();
barcode.setSolderStatus(SOLDER_STATUS.UNDER_REFRIGERATION.name());
barcode.setNeedOutDate(null);
barcodeManager.save(barcode);
pos.setBarcode(barcode);
......
......@@ -393,7 +393,8 @@ public class StorageController {
int priIndex = csvRead.getCsvIndex("优先级","pri");
int hIndex = csvRead.getCsvIndex("高度","h");
int wIndex = csvRead.getCsvIndex("宽度","w");
int warmPosIndex = csvRead.getCsvIndex("回温库位","warmPos");
int warmPosIndex = csvRead.getHasCsvIndex("回温库位","warmPos");
int areaIndex = csvRead.getHasCsvIndex("区域","area");
int row = 1;
......@@ -410,6 +411,7 @@ public class StorageController {
Integer priority =0;
Integer height =0;
Integer width =0;
String labelName="";
try {
priority =Integer.parseInt(lineValues[priIndex]) ;
height = Integer.parseInt(lineValues[hIndex]);
......@@ -418,6 +420,10 @@ public class StorageController {
String warmPosStr = lineValues[warmPosIndex];
isWarmPos = Boolean.valueOf(warmPosStr);
}
if(areaIndex>=0){
String areaStr=lineValues[areaIndex];
labelName=areaStr.trim();
}
}catch (Exception ex){
log.warn("第"+row+"行中有空白内容,此行忽略");
continue;
......@@ -429,9 +435,11 @@ public class StorageController {
}
// StoragePos posInfo = storagePosManager.getByPosName(posName);
StoragePos posInfo =findFormList(storagePosList,posName);
if(posInfo == null){
posInfo=new StoragePos(storageId,posName,height,width,priority);
posInfo.setWarmPos(isWarmPos);
posInfo.setLabelName(labelName);
newRowCount++;
newList.add(posInfo);
}else{
......@@ -446,6 +454,10 @@ public class StorageController {
needUpdate = true;
}
}
if(!posInfo.getLabelName().equals(labelName)){
posInfo.setLabelName(labelName);
needUpdate=true;
}
if(needUpdate){
updateRowCount++;
storagePosManager.save(posInfo);
......
package com.neotel.smfcore.custom.micron20031;
import cn.hutool.core.convert.Convert;
import cn.hutool.core.util.ObjectUtil;
import com.neotel.smfcore.core.storage.service.manager.IStoragePosManager;
import com.neotel.smfcore.core.storage.service.po.StoragePos;
import com.neotel.smfcore.custom.micron20031.bean.PosRowDto;
import com.neotel.smfcore.security.annotation.AnonymousAccess;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Sort;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Slf4j
@RestController
@RequestMapping("/rest/micron")
public class MicronController {
@Autowired
private IStoragePosManager storagePosManager;
@ApiOperation("获取库位使用列表")
@GetMapping("/posUsedData")
@AnonymousAccess
public Map<String,List<PosRowDto>> posUsedData(String storageId ) {
if(ObjectUtil.isEmpty(storageId)){
return new HashMap<>();
}
Query query = new Query(Criteria.where("storageId").is(storageId));
Map<String, List<PosRowDto>> resultMap = new HashMap<>();
List<StoragePos> posList = storagePosManager.findByQuery(query);
Sort sort = Sort.by(Sort.Direction.ASC, "labelName", "posName");
String currPos = "";
Map<Integer, Integer> currMap = new HashMap<>();
Map<String,Map< String,Map<Integer,Integer>>> allMap =new HashMap<>();
for (StoragePos pos :
posList) {
String posName = pos.getPosName();
String posN = posName.substring(0, 2);
Integer num = Convert.toInt(posName.substring(2, posName.length() ));
Integer used = 0;
if (pos.isUsed()) {
used = 1;
}
// used=1;
if (currPos.equals(posN)) {
currMap.put(num, used);
} else {
if(ObjectUtil.isNotEmpty(currPos)){
String labelName=pos.getLabelName();
if(!allMap.containsKey(labelName)){
allMap.put(labelName,new HashMap<>());
}
if(allMap.get(labelName).containsKey(currPos)){
allMap.get(labelName).get(currPos).putAll(currMap);
}
else{
allMap.get(labelName).put(currPos,currMap);
}
}
//开始新的
currPos = posN;
currMap = new HashMap<>();
currMap.put(num, used);
}
}
for (String lableName :
allMap.keySet()) {
Map<String, Map<Integer, Integer>> labelMap =allMap.get(lableName);
List<PosRowDto> posRowDtos = new ArrayList<>();
for (String name : labelMap.keySet()) {
//记录此列
currMap = labelMap.get(name);
Integer[] currA = new Integer[currMap.size()];
for (int index = 0; index < currMap.size(); index++) {
int v = currMap.getOrDefault(index + 1, 0);
currA[index] = v;
}
PosRowDto rowDto = new PosRowDto(name, currA);
posRowDtos.add(rowDto);
}
resultMap.put(lableName, posRowDtos);
}
return resultMap;
}
}
package com.neotel.smfcore.custom.micron20031.bean;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class PosRowDto implements Serializable {
private String name;
private Integer[] value;
}
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!