diff --git a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/order/domain/Order.java b/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/order/domain/Order.java index 0901952..1289612 100644 --- a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/order/domain/Order.java +++ b/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/order/domain/Order.java @@ -2,11 +2,13 @@ package com.ruoyi.bst.order.domain; import com.ruoyi.common.annotation.Excel; import com.ruoyi.common.core.domain.BaseEntity; +import com.ruoyi.common.core.validate.ValidGroup; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import org.springframework.format.annotation.DateTimeFormat; import javax.validation.constraints.Min; +import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; import java.math.BigDecimal; @@ -81,4 +83,9 @@ public class Order extends BaseEntity @ApiModelProperty("名称") private String name; + @Excel(name = "单位") + @ApiModelProperty("单位") + @NotBlank(message = "单位不允许为空", groups = {ValidGroup.Create.class}) + private String unit; + } diff --git a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/order/mapper/OrderMapper.xml b/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/order/mapper/OrderMapper.xml index 1b853bf..9864ca8 100644 --- a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/order/mapper/OrderMapper.xml +++ b/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/order/mapper/OrderMapper.xml @@ -24,7 +24,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" bo.material, bo.content_num, bo.package_size, - bo.name + bo.name, + bo.unit from bst_order bo @@ -44,6 +45,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and bo.custom_order_no = #{query.eqCustomOrderNo} and bo.package_size like concat('%', #{query.packageSize}, '%') and bo.name like concat('%', #{query.name}, '%') + and bo.unit like concat('%', #{query.unit}, '%') and bo.status in @@ -98,6 +100,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" content_num, package_size, `name`, + unit, #{orderNo}, @@ -116,6 +119,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{contentNum}, #{packageSize}, #{name}, + #{unit}, @@ -154,6 +158,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" content_num = #{data.contentNum}, package_size = #{data.packageSize}, `name` = #{data.name}, + unit = #{data.unit}, diff --git a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/order/service/OrderAssembler.java b/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/order/service/OrderAssembler.java index 4876130..22613e2 100644 --- a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/order/service/OrderAssembler.java +++ b/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/order/service/OrderAssembler.java @@ -14,13 +14,17 @@ public interface OrderAssembler { * 拼接产品列表 * * @param list 订单列表 - * @param assembleProcess 是否拼接工序 - * @param assembleProgress */ - void assembleProdList(List list, boolean assembleProcess, boolean assembleProgress); + void assembleProdList(List list); /** * 拼接进度 */ void assembleProgress(List list); + + /** + * 拼接工序列表 + */ + void assembleProdProcessList(List list); + } diff --git a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/order/service/impl/OrderAssemblerImpl.java b/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/order/service/impl/OrderAssemblerImpl.java index 684602d..b34027e 100644 --- a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/order/service/impl/OrderAssemblerImpl.java +++ b/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/order/service/impl/OrderAssemblerImpl.java @@ -29,7 +29,7 @@ public class OrderAssemblerImpl implements OrderAssembler { private OrderProdAssembler orderProdAssembler; @Override - public void assembleProdList(List list, boolean assembleProcess, boolean assembleProgress) { + public void assembleProdList(List list) { if (CollectionUtils.isEmptyElement(list)) { return; } @@ -46,7 +46,6 @@ public class OrderAssemblerImpl implements OrderAssembler { // 拼接明细 if (assembleProcess) { - orderProdAssembler.assembleProcessList(prodList, true); } // 分组 @@ -70,10 +69,21 @@ public class OrderAssemblerImpl implements OrderAssembler { return; } + this.assembleProdList(list); + for (OrderVO order : list) { order.setTotalNum(CollectionUtils.sumDecimal(order.getProdList(), OrderProdVO::getNum)); order.setReportNum(CollectionUtils.sumDecimal(order.getProdList(), OrderProdVO::getReportNum)); order.setStoreNum(CollectionUtils.sumDecimal(order.getProdList(), OrderProdVO::getStoreNum)); } } + + @Override + public void assembleProdProcessList(List list) { + if (CollectionUtils.isEmptyElement(list)) { + return; + } + List prodList = list.stream().map(OrderVO::getProdList).flatMap(List::stream).collect(Collectors.toList()); + orderProdAssembler.assembleProcessList(prodList); + } } diff --git a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/order/service/impl/OrderConverterImpl.java b/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/order/service/impl/OrderConverterImpl.java index 3314d8e..77c1fb0 100644 --- a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/order/service/impl/OrderConverterImpl.java +++ b/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/order/service/impl/OrderConverterImpl.java @@ -51,6 +51,7 @@ public class OrderConverterImpl implements OrderConverter { bo.setContentNum(data.getContentNum()); bo.setPackageSize(data.getPackageSize()); bo.setName(data.getName()); + bo.setUnit(data.getUnit()); if (submit) { bo.setStatus(OrderStatus.RELEASED.getStatus()); } else { @@ -81,6 +82,7 @@ public class OrderConverterImpl implements OrderConverter { bo.setContentNum(data.getContentNum()); bo.setPackageSize(data.getPackageSize()); bo.setName(data.getName()); + bo.setUnit(data.getUnit()); if (submit) { bo.setStatus(OrderStatus.RELEASED.getStatus()); } diff --git a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/order/service/impl/OrderServiceImpl.java b/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/order/service/impl/OrderServiceImpl.java index 0122b91..5134e9b 100644 --- a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/order/service/impl/OrderServiceImpl.java +++ b/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/order/service/impl/OrderServiceImpl.java @@ -238,7 +238,6 @@ public class OrderServiceImpl implements OrderService ServiceUtil.assertion(!OrderStatus.canFinished().contains(old.getStatus()), "当前订单状态不允许完工"); List list = Collections.singletonList(old); - orderAssembler.assembleProdList(list, false, true); orderAssembler.assembleProgress(list); ServiceUtil.assertion(old.getProgress().compareTo(new BigDecimal("100")) < 0, "当前订单进度:%s%%,暂不满足完工条件:100%%", old.getProgress()); @@ -261,26 +260,27 @@ public class OrderServiceImpl implements OrderService ServiceUtil.assertion(file == null, "请选择需要解析的数据"); ExcelUtil util = new ExcelUtil<>(OrderProdVO.class); try { - Map data = util.importMixedExcel(file.getInputStream(), 7, 8); + Map data = util.importMixedExcel(file.getInputStream(), 8, 9); List body = (List) data.get("body"); // 查询全部部门 List depts = deptService.selectDeptList(new SysDeptQuery()); - // 将处理方式转为部门数据 - for (OrderProdVO item : body) { + for (int i = 0; i < body.size(); i++) { + OrderProdVO item = body.get(i); + String handleWay = item.getHandleWay(); if (StringUtils.isBlank(handleWay)) { continue; } - + // 将处理方式转为部门数据 // 通过部门名称或者工序简称来匹配部门 List handleWayList = Arrays.asList(handleWay.split("\\+")); List processList = new ArrayList<>(); - for (int i = 0; i < handleWayList.size(); i++) { - String way = handleWayList.get(i).trim(); + for (int j = 0; j < handleWayList.size(); j++) { + String way = handleWayList.get(j).trim(); SysDeptVO dept = depts.stream() .filter(deptItem -> { List deptProcess = new ArrayList<>(); @@ -295,7 +295,7 @@ public class OrderServiceImpl implements OrderService process.setDeptId(dept.getDeptId()); process.setDeptName(dept.getDeptName()); process.setNum(item.getNum()); - if (i == handleWayList.size() - 1) { + if (j == handleWayList.size() - 1) { process.setIsEnd(true); } else { process.setIsEnd(false); diff --git a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/orderProd/domain/OrderProd.java b/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/orderProd/domain/OrderProd.java index d380d72..1a0ea4c 100644 --- a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/orderProd/domain/OrderProd.java +++ b/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/orderProd/domain/OrderProd.java @@ -39,6 +39,7 @@ public class OrderProd extends BaseEntity @Excel(name = "是否成品") @ApiModelProperty("是否成品") + @NotNull(message = "是否成品不能为空", groups = {ValidGroup.Create.class}) private Boolean isEnd; @Excel(name = "物料编号") diff --git a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/orderProd/service/OrderProdAssembler.java b/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/orderProd/service/OrderProdAssembler.java index f1bab33..f099c5a 100644 --- a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/orderProd/service/OrderProdAssembler.java +++ b/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/orderProd/service/OrderProdAssembler.java @@ -13,7 +13,7 @@ public interface OrderProdAssembler { /** * 拼接工序列表 */ - void assembleProcessList(List list, boolean progress); + void assembleProcessList(List list); /** * 拼接进度 diff --git a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/orderProd/service/impl/OrderProdAssemblerImpl.java b/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/orderProd/service/impl/OrderProdAssemblerImpl.java index 27e0609..22f25e8 100644 --- a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/orderProd/service/impl/OrderProdAssemblerImpl.java +++ b/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/orderProd/service/impl/OrderProdAssemblerImpl.java @@ -8,7 +8,6 @@ import com.ruoyi.bst.prodProcess.domain.ProdProcessQuery; import com.ruoyi.bst.prodProcess.domain.ProdProcessVO; import com.ruoyi.bst.prodProcess.service.IProdProcessService; import com.ruoyi.bst.prodProcess.service.ProdProcessAssembler; -import com.ruoyi.bst.store.service.IStoreService; import com.ruoyi.common.utils.collection.CollectionUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -33,11 +32,8 @@ public class OrderProdAssemblerImpl implements OrderProdAssembler { @Autowired private ProdProcessAssembler prodProcessAssembler; - @Autowired - private IStoreService storeService; - @Override - public void assembleProcessList(List list, boolean progress) { + public void assembleProcessList(List list) { if (CollectionUtils.isEmptyElement(list)) { return; } @@ -45,9 +41,6 @@ public class OrderProdAssemblerImpl implements OrderProdAssembler { ProdProcessQuery query = new ProdProcessQuery(); query.setOrderProdIds(CollectionUtils.map(list, OrderProdVO::getId)); List processList = prodProcessService.selectProdProcessList(query); - if (progress) { - prodProcessAssembler.assembleProgress(processList); - } Map> group = processList.stream().collect(Collectors.groupingBy(ProdProcess::getOrderProdId)); for (OrderProdVO prod : list) { diff --git a/ruoyi-web/src/main/java/com/ruoyi/web/bst/OrderController.java b/ruoyi-web/src/main/java/com/ruoyi/web/bst/OrderController.java index 8849bcb..0117a66 100644 --- a/ruoyi-web/src/main/java/com/ruoyi/web/bst/OrderController.java +++ b/ruoyi-web/src/main/java/com/ruoyi/web/bst/OrderController.java @@ -52,8 +52,8 @@ public class OrderController extends BaseController startPage(); startOrderBy(); List list = orderService.selectOrderList(query); - - orderAssembler.assembleProdList(list, true, true); + orderAssembler.assembleProdList(list); + orderAssembler.assembleProdProcessList(list); orderAssembler.assembleProgress(list); return getDataTable(list); }