Commit 1b95f712 zshaohui

sorting提交

1 个父辈 7587335d
......@@ -150,7 +150,19 @@ public class TicketController {
liteOrder = liteOrderManager.createWithItems(liteOrder);
liteOrderCache.addOrderToMap(liteOrder);
}
String result = liteOrderCache.checkOutLiteOrderOut(ticket, false, null);
String result = "";
boolean sorting = false;
if (sorting) {
log.info(ticket + "是SortIng出库:" + sorting);
result = liteOrderCache.ticketOutBySorting(ticket);
} else {
log.info(ticket + "不是SortIng出库:" + sorting);
result = liteOrderCache.ticketOutByNoSorting(ticket);
}
if (StringUtils.isNotEmpty(result)) {
return ResultBean.newErrorResult(-1, "", MessageUtils.getText(result, new Locale(SecurityUtils.getCurrentUserLanguage()), result));
}
......
package com.neotel.smfcore.custom.luxsan.factory_c.rawstor.controller;
import com.neotel.smfcore.common.bean.ResultBean;
import com.neotel.smfcore.common.utils.StringUtils;
import com.neotel.smfcore.core.barcode.enums.BARCODE_STATUS;
import com.neotel.smfcore.core.barcode.service.manager.IBarcodeManager;
import com.neotel.smfcore.core.barcode.service.po.Barcode;
import com.neotel.smfcore.core.barcode.utils.CodeResolve;
import com.neotel.smfcore.core.storage.service.manager.IStoragePosManager;
import com.neotel.smfcore.core.storage.service.po.StoragePos;
import com.neotel.smfcore.custom.luxsan.factory_c.rawstor.util.BoxHandleUtil;
import com.neotel.smfcore.security.annotation.AnonymousAccess;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.*;
import java.util.stream.Collectors;
@Api(tags = "单据sorting")
@RestController
@RequestMapping("/ticketSortIng")
public class TicketSortingController {
@Autowired
private CodeResolve codeResolve;
@Autowired
private IStoragePosManager storagePosManager;
@Autowired
private IBarcodeManager barcodeManager;
@ApiOperation("获取料箱信息")
@RequestMapping("/boxInfo")
@AnonymousAccess
public ResultBean boxInfo(String boxStr) {
if (StringUtils.isEmpty(boxStr)) {
return ResultBean.newErrorResult(-1, "smfcore.valueCanotNull", "{0}不能为空", new String[]{"料箱信息"});
}
boxStr = boxStr.toUpperCase(Locale.ROOT);
//如果不是C07,C13,C15开头的 报错
if (!boxStr.startsWith("C07") && !boxStr.startsWith("C13") && !boxStr.startsWith("C15")) {
return ResultBean.newErrorResult(-1, "", boxStr + "不是有效的料箱条码");
}
//如果不是以A/B结尾的,则提示
if (!boxStr.endsWith("A") && !boxStr.endsWith("B")) {
return ResultBean.newErrorResult(-1, "", boxStr + "请输入完整的料箱条码");
}
Barcode barcode = codeResolve.resolveCode(boxStr);
if (barcode != null) {
StoragePos pos = storagePosManager.getByBarcode(barcode.getBarcode());
if (pos != null) {
barcode = pos.getBarcode();
barcode.setStatus(BARCODE_STATUS.OUT_NORMAL); //设置成 不在库
barcodeManager.save(barcode);
pos.setBarcode(barcode);
storagePosManager.save(pos);
}
}
Map<String, Long> allCountMap = new HashMap<>();
Map<String, Long> needOutCountMap = new HashMap<>();
Map<String, String> pnMap = new HashMap<>();
//获取料箱要出库的集合
List<Barcode> subCodeList = barcode.getSubCodeList();
if (subCodeList != null && !subCodeList.isEmpty()) {
//隔口对应的数量
allCountMap = subCodeList.stream().collect(Collectors.groupingBy(Barcode::getPosName, Collectors.counting()));
//隔口需要对应的出库数量
List<Barcode> outSubCodeList = subCodeList.stream().filter(s -> s.isOut()).collect(Collectors.toList());
if (outSubCodeList != null && !outSubCodeList.isEmpty()) {
needOutCountMap = outSubCodeList.stream().collect(Collectors.groupingBy(Barcode::getPosName, Collectors.counting()));
}
//对应的pn
for (Barcode subCode : subCodeList) {
pnMap.put(subCode.getPosName(), subCode.getPartNumber());
}
}
List<List<Object>> boxInfoList = new ArrayList<>();
String box = barcode.getBarcode();
for (int i = 1; i < 7; i++) {
List<Object> list = new ArrayList<>();
list.add(BoxHandleUtil.getCountByPartition(allCountMap, box + "-0"+i)); //隔口总的数量
list.add(BoxHandleUtil.getCountByPartition(needOutCountMap, box + "-0"+i)); //隔口出库的数量
String pn = pnMap.get(box+"-0"+i) == null ? "": pnMap.get(box+"-0"+i); //隔口pn
list.add(pn);
list.add(i); //隔口号
boxInfoList.add(list);
}
if (boxStr.startsWith("C07")) {
if (boxStr.endsWith("A")) {
boxInfoList.add(boxInfoList.get(1));
boxInfoList.add(boxInfoList.get(3));
boxInfoList.add(boxInfoList.get(5));
boxInfoList.add(boxInfoList.get(0));
boxInfoList.add(boxInfoList.get(2));
boxInfoList.add(boxInfoList.get(4));
} else {
boxInfoList.add(boxInfoList.get(4));
boxInfoList.add(boxInfoList.get(2));
boxInfoList.add(boxInfoList.get(0));
boxInfoList.add(boxInfoList.get(5));
boxInfoList.add(boxInfoList.get(3));
boxInfoList.add(boxInfoList.get(1));
}
} else if (boxStr.startsWith("C13")) {
if (boxStr.endsWith("A")) {
boxInfoList.add(boxInfoList.get(0));
boxInfoList.add(boxInfoList.get(1));
boxInfoList.add(boxInfoList.get(2));
} else {
boxInfoList.add(boxInfoList.get(2));
boxInfoList.add(boxInfoList.get(1));
boxInfoList.add(boxInfoList.get(0));
}
} else if (boxStr.startsWith("C15")) {
if (boxStr.endsWith("A")) {
boxInfoList.add(boxInfoList.get(0));
boxInfoList.add(boxInfoList.get(1));
boxInfoList.add(boxInfoList.get(2));
} else {
boxInfoList.add(boxInfoList.get(2));
boxInfoList.add(boxInfoList.get(1));
boxInfoList.add(boxInfoList.get(0));
}
}
return ResultBean.newOkResult(boxInfoList);
}
}
......@@ -520,7 +520,7 @@ public class BoxHandleUtil {
return resultMap;
}
private static int getCountByPartition(Map<String, Long> paramMap, String partition) {
public static int getCountByPartition(Map<String, Long> paramMap, String partition) {
return paramMap.get(partition) == null ? 0 : paramMap.get(partition).intValue();
}
}
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!