临时提交
This commit is contained in:
parent
65c0d94643
commit
9e18014c22
|
@ -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;
|
||||
|
||||
}
|
||||
|
|
|
@ -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
|
||||
</sql>
|
||||
|
||||
|
@ -44,6 +45,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="query.eqCustomOrderNo != null and query.eqCustomOrderNo != ''">and bo.custom_order_no = #{query.eqCustomOrderNo}</if>
|
||||
<if test="query.packageSize != null and query.packageSize != ''"> and bo.package_size like concat('%', #{query.packageSize}, '%')</if>
|
||||
<if test="query.name != null and query.name != ''"> and bo.name like concat('%', #{query.name}, '%')</if>
|
||||
<if test="query.unit != null and query.unit != ''"> and bo.unit like concat('%', #{query.unit}, '%')</if>
|
||||
<if test="query.statusList != null and query.statusList.size() > 0">
|
||||
and bo.status in
|
||||
<foreach item="item" collection="query.statusList" open="(" separator="," close=")">
|
||||
|
@ -98,6 +100,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="contentNum != null">content_num,</if>
|
||||
<if test="packageSize != null">package_size,</if>
|
||||
<if test="name != null">`name`,</if>
|
||||
<if test="unit != null">unit,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="orderNo != null and orderNo != ''">#{orderNo},</if>
|
||||
|
@ -116,6 +119,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="contentNum != null">#{contentNum},</if>
|
||||
<if test="packageSize != null">#{packageSize},</if>
|
||||
<if test="name != null">#{name},</if>
|
||||
<if test="unit != null">#{unit},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
|
@ -154,6 +158,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="data.contentNum != null">content_num = #{data.contentNum},</if>
|
||||
<if test="data.packageSize != null">package_size = #{data.packageSize},</if>
|
||||
<if test="data.name != null">`name` = #{data.name},</if>
|
||||
<if test="data.unit != null">unit = #{data.unit},</if>
|
||||
</sql>
|
||||
|
||||
<delete id="deleteOrderById" parameterType="Long">
|
||||
|
|
|
@ -14,13 +14,17 @@ public interface OrderAssembler {
|
|||
* 拼接产品列表
|
||||
*
|
||||
* @param list 订单列表
|
||||
* @param assembleProcess 是否拼接工序
|
||||
* @param assembleProgress
|
||||
*/
|
||||
void assembleProdList(List<OrderVO> list, boolean assembleProcess, boolean assembleProgress);
|
||||
void assembleProdList(List<OrderVO> list);
|
||||
|
||||
/**
|
||||
* 拼接进度
|
||||
*/
|
||||
void assembleProgress(List<OrderVO> list);
|
||||
|
||||
/**
|
||||
* 拼接工序列表
|
||||
*/
|
||||
void assembleProdProcessList(List<OrderVO> list);
|
||||
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ public class OrderAssemblerImpl implements OrderAssembler {
|
|||
private OrderProdAssembler orderProdAssembler;
|
||||
|
||||
@Override
|
||||
public void assembleProdList(List<OrderVO> list, boolean assembleProcess, boolean assembleProgress) {
|
||||
public void assembleProdList(List<OrderVO> 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<OrderVO> list) {
|
||||
if (CollectionUtils.isEmptyElement(list)) {
|
||||
return;
|
||||
}
|
||||
List<OrderProdVO> prodList = list.stream().map(OrderVO::getProdList).flatMap(List::stream).collect(Collectors.toList());
|
||||
orderProdAssembler.assembleProcessList(prodList);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
|
|
|
@ -238,7 +238,6 @@ public class OrderServiceImpl implements OrderService
|
|||
ServiceUtil.assertion(!OrderStatus.canFinished().contains(old.getStatus()), "当前订单状态不允许完工");
|
||||
|
||||
List<OrderVO> 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<OrderProdVO> util = new ExcelUtil<>(OrderProdVO.class);
|
||||
try {
|
||||
Map<String, Object> data = util.importMixedExcel(file.getInputStream(), 7, 8);
|
||||
Map<String, Object> data = util.importMixedExcel(file.getInputStream(), 8, 9);
|
||||
|
||||
List<OrderProdVO> body = (List<OrderProdVO>) data.get("body");
|
||||
|
||||
// 查询全部部门
|
||||
List<SysDeptVO> 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<String> handleWayList = Arrays.asList(handleWay.split("\\+"));
|
||||
|
||||
List<ProdProcessVO> 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<String> 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);
|
||||
|
|
|
@ -39,6 +39,7 @@ public class OrderProd extends BaseEntity
|
|||
|
||||
@Excel(name = "是否成品")
|
||||
@ApiModelProperty("是否成品")
|
||||
@NotNull(message = "是否成品不能为空", groups = {ValidGroup.Create.class})
|
||||
private Boolean isEnd;
|
||||
|
||||
@Excel(name = "物料编号")
|
||||
|
|
|
@ -13,7 +13,7 @@ public interface OrderProdAssembler {
|
|||
/**
|
||||
* 拼接工序列表
|
||||
*/
|
||||
void assembleProcessList(List<OrderProdVO> list, boolean progress);
|
||||
void assembleProcessList(List<OrderProdVO> list);
|
||||
|
||||
/**
|
||||
* 拼接进度
|
||||
|
|
|
@ -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<OrderProdVO> list, boolean progress) {
|
||||
public void assembleProcessList(List<OrderProdVO> 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<ProdProcessVO> processList = prodProcessService.selectProdProcessList(query);
|
||||
if (progress) {
|
||||
prodProcessAssembler.assembleProgress(processList);
|
||||
}
|
||||
Map<Long, List<ProdProcessVO>> group = processList.stream().collect(Collectors.groupingBy(ProdProcess::getOrderProdId));
|
||||
|
||||
for (OrderProdVO prod : list) {
|
||||
|
|
|
@ -52,8 +52,8 @@ public class OrderController extends BaseController
|
|||
startPage();
|
||||
startOrderBy();
|
||||
List<OrderVO> list = orderService.selectOrderList(query);
|
||||
|
||||
orderAssembler.assembleProdList(list, true, true);
|
||||
orderAssembler.assembleProdList(list);
|
||||
orderAssembler.assembleProdProcessList(list);
|
||||
orderAssembler.assembleProgress(list);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user