mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-13 21:32:07 +08:00
Merge remote-tracking branch 'origin/main'
This commit is contained in:
+1
-1
@@ -55,7 +55,7 @@ public interface ErrorCodeConstants {
|
||||
ErrorCode RAW_GOODS_NOT_EXISTS = new ErrorCode(1_002_029_005, "生产单中未用到此板材");
|
||||
ErrorCode ORDER_STATUS_ERROR = new ErrorCode(1_002_029_006, "生产单不允许删除");
|
||||
ErrorCode APP_TOKEN_ERROR = new ErrorCode(1_002_029_007, "token获取失败");
|
||||
ErrorCode PLATE_PLAN_DATA_ERROR = new ErrorCode(1_002_029_008, "板材生产数据获取错误或此单为空单");
|
||||
ErrorCode PLATE_PLAN_DATA_ERROR = new ErrorCode(1_002_029_008, "板材生产数据获取错误或此单不存在");
|
||||
ErrorCode PARTS_DATA_ERROR = new ErrorCode(1_002_029_009, "配件数据获取错误");
|
||||
ErrorCode BODY_DATA_ERROR = new ErrorCode(1_002_029_010, "柜体数据获取错误");
|
||||
ErrorCode GOODS_DATA_ERROR = new ErrorCode(1_002_029_011, "商品信息获取错误");
|
||||
|
||||
+3
-3
@@ -237,7 +237,7 @@ public class OrderController {
|
||||
@Parameter(name = "type", description = "文件类型", required = true)
|
||||
})
|
||||
@PreAuthorize("@ss.hasPermission('production:manager-list:create')")
|
||||
@OperateLog(type = EXPORT)
|
||||
@OperateLog(type = IMPORT)
|
||||
public void exportTest(@RequestPart("file") MultipartFile file,
|
||||
@RequestParam(value = "type", required = false, defaultValue = "true") Integer type,
|
||||
HttpServletResponse response) throws IOException {
|
||||
@@ -248,7 +248,7 @@ public class OrderController {
|
||||
// 读取文件
|
||||
excelReadUtil.setErr(0);
|
||||
Map<String, Object> map = excelReadUtil.read(file);
|
||||
System.out.println(" map " + map);
|
||||
// System.out.println(" map " + map);
|
||||
System.err.println(excelReadUtil.isErr());
|
||||
// 判断是否读取有误
|
||||
if (excelReadUtil.isErr() == -1) { // 文件为空
|
||||
@@ -256,7 +256,7 @@ public class OrderController {
|
||||
return;
|
||||
}else if (excelReadUtil.isErr() > 0) {
|
||||
// 返回文件
|
||||
System.out.println("(Map<Object, Object>) " + (Map<Object, Object>) map.get("order")+ " , (List<OrderPlateImportExcelVO>)" +(List<OrderPlateImportExcelVO>) map.get("plate"));
|
||||
// System.out.println("(Map<Object, Object>) " + (Map<Object, Object>) map.get("order")+ " , (List<OrderPlateImportExcelVO>)" +(List<OrderPlateImportExcelVO>) map.get("plate"));
|
||||
ExcelWriterUtil.write(response, (Map<Object, Object>) map.get("order"), (List<OrderPlateImportExcelVO>) map.get("plate"), orderService.getSavePath() + File.separator + "生产单Excel导入错误导出模板.xlsx");
|
||||
return;
|
||||
} else {
|
||||
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
package com.cf.imes.module.executor.controller.admin.plate.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Schema(description = "管理后台 - 生产单表 order Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class PlateGoodsIdVO {
|
||||
|
||||
@Schema(description = "板件 ID", example = "32523")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "生产单号", example = "11087")
|
||||
private Long orderId;
|
||||
|
||||
@Schema(description = "商品 ID", example = "14195")
|
||||
private Long goodsId;
|
||||
|
||||
@Schema(description = "是否删除", example = "1")
|
||||
private Integer deleted;
|
||||
}
|
||||
+13
-1
@@ -60,4 +60,16 @@ public interface GoodsMapper extends BaseMapperX<GoodsDO> {
|
||||
wrapper.eq(GoodsDO::getDeleted, 1);
|
||||
return update(wrapper);
|
||||
}
|
||||
}
|
||||
|
||||
// 通过orderId查找板材
|
||||
default List<GoodsDO> selectGoodsByOrderId(Long orderId, Long organId) {
|
||||
return selectList(new LambdaQueryWrapperX<GoodsDO>()
|
||||
.eq(GoodsDO::getOrderId, orderId)
|
||||
.eq(GoodsDO::getDeleted, 0)
|
||||
.eq(GoodsDO::getOrganId, organId));
|
||||
}
|
||||
|
||||
// 删板材,批量
|
||||
void updateDeletedById(@Param("ids") List<Long> ids, @Param("deleted") Integer deleted, @Param("organId") Long organId);
|
||||
|
||||
}
|
||||
+1
-2
@@ -29,10 +29,9 @@ public interface OrderMapper extends BaseMapperX<OrderDO> {
|
||||
default PageResult<OrderDO> selectPage(OrderPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<OrderDO>()
|
||||
.eqIfPresent(OrderDO::getParentNo, reqVO.getParentNo())
|
||||
.likeIfPresent(OrderDO::getId, String.valueOf(reqVO.getId()) != null ? "" : String.valueOf(reqVO.getId()))
|
||||
.likeIfPresent(OrderDO::getId, reqVO.getId() == null ? null : String.valueOf(reqVO.getId()))
|
||||
.betweenIfPresent(OrderDO::getDeliveryDate, reqVO.getDeliveryDate())
|
||||
.betweenIfPresent(OrderDO::getOrderDate, reqVO.getOrderDate())
|
||||
.eqIfPresent(OrderDO::getId, reqVO.getId())
|
||||
.eqIfPresent(OrderDO::getOrderType, reqVO.getOrderType())
|
||||
.eqIfPresent(OrderDO::getOrderSort, reqVO.getOrderSort())
|
||||
.eqIfPresent(OrderDO::getDataType, reqVO.getDataType())
|
||||
|
||||
+1
-22
@@ -4,20 +4,15 @@ import java.util.*;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.cf.imes.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import com.cf.imes.module.executor.controller.admin.plan.saveOptimize.PrintOrderPartsRespVO;
|
||||
import com.cf.imes.module.executor.controller.admin.plate.vo.PlateGoodsRespVO;
|
||||
import com.cf.imes.module.executor.controller.admin.plate.vo.PlateRespVO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.goods.GoodsDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.orderParts.OrderPartsDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import com.cf.imes.module.executor.controller.admin.orderParts.vo.*;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.poi.ss.formula.functions.T;
|
||||
|
||||
|
||||
import static com.cf.imes.framework.security.core.util.SecurityFrameworkUtils.getUserOrganId;
|
||||
|
||||
@@ -49,22 +44,6 @@ public interface OrderPartsMapper extends BaseMapperX<OrderPartsDO> {
|
||||
.orderByDesc(OrderPartsDO::getId));
|
||||
}
|
||||
|
||||
default OrderPartsImportRespVO importOrderPartsList(List<OrderPartsSaveReqVO> importOrderParts) {
|
||||
OrderPartsImportRespVO respVO = OrderPartsImportRespVO.builder().createOrderParts(new ArrayList<OrderPartsSaveReqVO>())
|
||||
.updateOrderParts(new ArrayList<>()).failureOrderParts(new LinkedHashMap<>()).build();
|
||||
importOrderParts.forEach(orderParts -> {
|
||||
try{
|
||||
OrderPartsDO orderPartsDO = BeanUtils.toBean(orderParts, OrderPartsDO.class);
|
||||
insert(orderPartsDO);
|
||||
orderParts.setId(orderPartsDO.getId());
|
||||
respVO.getCreateOrderParts().add(orderParts);
|
||||
}catch (ServiceException ex){
|
||||
respVO.getFailureOrderParts().put(orderParts.getName(), ex.getMessage());
|
||||
}
|
||||
});
|
||||
System.err.println("OrderPartsImportRespVO " + respVO);
|
||||
return respVO;
|
||||
}
|
||||
|
||||
IPage<OrderPartsRespVO> selectProductList(@Param("page") IPage<OrderPartsRespVO> page , @Param("orderId")Long orderId, @Param("roomId")Long roomId , @Param("bodyId")Long bodyId,@Param("organId")Long organId);
|
||||
|
||||
|
||||
+3
@@ -117,4 +117,7 @@ public interface PlateMapper extends BaseMapperX<PlateDO> {
|
||||
List<Long> selectPlateIdListByBodyId(@Param("bodyId") Long bodyId, @Param("organId") Long organId);
|
||||
|
||||
List<PlateResList> selectPlateListByPlanId(@Param("planId") Long planId, @Param("organId") Long organId);
|
||||
|
||||
// 根据需要删除的小板id查找具体信息
|
||||
List<PlateGoodsIdVO> selectPlateGoodsListByList(@Param("plates") List<Long> goodsIdList, @Param("orderId") Long orderId, @Param("organId") Long organId);
|
||||
}
|
||||
+24
-12
@@ -11,6 +11,7 @@ import com.cf.imes.framework.datapermission.core.util.DataPermissionUtils;
|
||||
import com.cf.imes.module.executor.controller.admin.order.vo.product.OrderBodyRespVO;
|
||||
import com.cf.imes.module.executor.controller.admin.orderParts.vo.OrderPartsRemark;
|
||||
import com.cf.imes.module.executor.controller.admin.orderParts.vo.OrderPartsRespVO;
|
||||
import com.cf.imes.module.executor.controller.admin.plate.vo.PlateGoodsIdVO;
|
||||
import com.cf.imes.module.executor.controller.admin.plate.vo.PlateRespVO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.goods.GoodsDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.orderBody.OrderBodyDO;
|
||||
@@ -65,6 +66,7 @@ import java.time.format.DateTimeParseException;
|
||||
import java.util.*;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.*;
|
||||
@@ -211,7 +213,7 @@ public class OrderServiceImpl implements OrderService {
|
||||
rawGoodsMapper.updateOrderDeleted(orderId, OrderDeletedEnum.NOT_DELETED.getStatus(), SecurityFrameworkUtils.getLoginUser().getOrganId());
|
||||
orderProcessMapper.updateOrderDeleted(orderId, OrderDeletedEnum.NOT_DELETED.getStatus(), SecurityFrameworkUtils.getLoginUser().getOrganId());
|
||||
processStepMapper.updateOrderDeleted(orderId, OrderDeletedEnum.NOT_DELETED.getStatus(), SecurityFrameworkUtils.getLoginUser().getOrganId());
|
||||
;
|
||||
|
||||
}
|
||||
|
||||
private void validateOrderExists(Long id, Long organId) {
|
||||
@@ -227,6 +229,7 @@ public class OrderServiceImpl implements OrderService {
|
||||
|
||||
@Override
|
||||
public PageResult<OrderDO> getOrderPage(OrderPageReqVO pageReqVO) {
|
||||
|
||||
return orderMapper.selectPage(pageReqVO.setOrganId(SecurityFrameworkUtils.getLoginUser().getOrganId()));
|
||||
}
|
||||
|
||||
@@ -247,7 +250,7 @@ public class OrderServiceImpl implements OrderService {
|
||||
index = OrderDeletedEnum.NOT_DELETED.getStatus();
|
||||
else
|
||||
index = OrderDeletedEnum.DELETED.getStatus();
|
||||
System.out.println(" deleted " + deleted);
|
||||
|
||||
return index;
|
||||
}
|
||||
@Override
|
||||
@@ -319,16 +322,29 @@ public class OrderServiceImpl implements OrderService {
|
||||
// 校验存在
|
||||
validateOrderBodyExists(orderId, bodyId, SecurityFrameworkUtils.getLoginUser().getOrganId());
|
||||
// 删除
|
||||
// orderBodyMapper.deleteAllByOrderId(orderId, bodyId);
|
||||
// orderBodyMapper.deleteAllByOrderId(orderId, bodyId); 物理删除
|
||||
orderBodyMapper.updateDeletedById(bodyId, OrderDeletedEnum.DELETED.getStatus(), SecurityFrameworkUtils.getLoginUser().getOrganId());
|
||||
orderGroupMapper.updateDeletedById(bodyId, OrderDeletedEnum.DELETED.getStatus(), SecurityFrameworkUtils.getLoginUser().getOrganId());
|
||||
|
||||
// 先查再改
|
||||
List<Long> plateDOList = plateMapper.selectPlateIdListByBodyId(bodyId, SecurityFrameworkUtils.getLoginUser().getOrganId());
|
||||
System.out.println(" plateDOList " + plateDOList);
|
||||
// 删除小板
|
||||
plateMapper.updateDeletedById(plateDOList, OrderDeletedEnum.DELETED.getStatus(), SecurityFrameworkUtils.getLoginUser().getOrganId());
|
||||
// 删除大板
|
||||
List<PlateGoodsIdVO> goodsIdList = plateMapper.selectPlateGoodsListByList(plateDOList, orderId, SecurityFrameworkUtils.getLoginUser().getOrganId());
|
||||
Map<Long,List<PlateGoodsIdVO>> goodsIdMap = goodsIdList.stream().collect(Collectors.groupingBy(PlateGoodsIdVO::getGoodsId));
|
||||
List<Long> goodsIdDeleted = new ArrayList<>();
|
||||
goodsIdMap.forEach((k,v)->{
|
||||
for(int i=0;i<v.size();i++){
|
||||
if (v.get(i).getDeleted() == OrderDeletedEnum.NOT_DELETED.getStatus()){
|
||||
break;
|
||||
}
|
||||
}
|
||||
goodsIdDeleted.add(k);
|
||||
});
|
||||
goodsMapper.updateDeletedById(goodsIdDeleted, OrderDeletedEnum.DELETED.getStatus(), SecurityFrameworkUtils.getLoginUser().getOrganId());
|
||||
|
||||
List<Long> partsList = orderPartsMapper.selectPartsIdListByBodyId(bodyId, SecurityFrameworkUtils.getLoginUser().getOrganId());
|
||||
System.out.println(" partsList " + partsList);
|
||||
orderPartsMapper.updateDeletedById(partsList, OrderDeletedEnum.DELETED.getStatus(), SecurityFrameworkUtils.getLoginUser().getOrganId());
|
||||
});
|
||||
}
|
||||
@@ -401,7 +417,6 @@ public class OrderServiceImpl implements OrderService {
|
||||
.setId(plateGoods)
|
||||
.setGoodsId(String.valueOf(goodsId));
|
||||
// 判断是否存在raw_goods_id
|
||||
System.out.println("goodsDO.getGoodsId() " + goodsDO.getGoodsId());
|
||||
if (goodsDO.getGoodsId() != null) {
|
||||
plateGoodDO.setGoodsId(goodsDO.getGoodsId());
|
||||
}else {
|
||||
@@ -413,7 +428,7 @@ public class OrderServiceImpl implements OrderService {
|
||||
}
|
||||
map.put("goodsDO", goodsLists);
|
||||
map.put("plateGoodDOLists", plateGoodLists);
|
||||
System.err.println(" map " + map);
|
||||
// System.err.println(" map " + map);
|
||||
return map;
|
||||
}
|
||||
|
||||
@@ -437,7 +452,7 @@ public class OrderServiceImpl implements OrderService {
|
||||
return futureDate;
|
||||
} catch (DateTimeParseException e) {
|
||||
// 在实际应用中应该有更详细的错误处理逻辑
|
||||
System.err.println("Error parsing future date: " + e.getMessage());
|
||||
// System.err.println("Error parsing future date: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
return date;
|
||||
@@ -497,9 +512,7 @@ public class OrderServiceImpl implements OrderService {
|
||||
Matcher matcher = pattern.matcher(phoneNumber);
|
||||
|
||||
// 判断手机号是否匹配正则表达式
|
||||
if (matcher.matches()) {
|
||||
System.out.println("手机号合法");
|
||||
} else {
|
||||
if (!matcher.matches()) {
|
||||
throw exception(PHONE_NOT_LAWFUL);
|
||||
}
|
||||
}
|
||||
@@ -517,7 +530,6 @@ public class OrderServiceImpl implements OrderService {
|
||||
@Override
|
||||
public void importExcelData(OrderDO orderDO, List<?> list) {
|
||||
orderDO.setId((Long) snowFlakeGenerator.nextId(null));
|
||||
System.out.println(excelTypeRealize.changeDate(list, orderDO.getId()));
|
||||
|
||||
Map<String, List<?>> listMap = excelTypeRealize.changeDate(list, orderDO.getId());
|
||||
List<RawGoodsDO> rawGoodsDO = (List<RawGoodsDO>) listMap.get("rawGoodsDOS");
|
||||
|
||||
+25
-5
@@ -4,11 +4,13 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.incrementer.IdentifierGenerator;
|
||||
import com.cf.imes.framework.common.enums.ProcessProcessingTypeEnum;
|
||||
import com.cf.imes.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import com.cf.imes.module.executor.dal.dataobject.goods.GoodsDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.orderBody.OrderBodyDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.orderGroup.OrderGroupDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.plate.PlateDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.processStep.ProcessStepDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.processStepItem.OrderProcessStepItemDO;
|
||||
import com.cf.imes.module.executor.dal.mysql.goods.GoodsMapper;
|
||||
import com.cf.imes.module.executor.dal.mysql.order.OrderMapper;
|
||||
import com.cf.imes.module.executor.dal.mysql.orderBody.OrderBodyMapper;
|
||||
import com.cf.imes.module.executor.dal.mysql.orderGroup.OrderGroupMapper;
|
||||
@@ -79,6 +81,9 @@ public class OrderProcessServiceImpl implements OrderProcessService {
|
||||
@Resource
|
||||
private PlateMapper plateMapper;
|
||||
|
||||
@Resource
|
||||
private GoodsMapper goodsMapper;
|
||||
|
||||
private static Integer INDEX = 0;
|
||||
|
||||
@Override
|
||||
@@ -116,15 +121,14 @@ public class OrderProcessServiceImpl implements OrderProcessService {
|
||||
ProcessStepDO processStepDO = BeanUtils.toBean(processRespDTO, ProcessStepDO.class).setId(processStepDOId).setOrderId(createReqVO.getOrderId())
|
||||
.setStatus(false).setProcessinfoId(processRespDTO.getId()).setOrderProcessId(orderProcess.getId()).setFinishTime(null).setSort(INDEX++);// 计划日期没有填写
|
||||
processStepDOS.add(processStepDO);
|
||||
|
||||
// 生产单中是否存在加工组,若存在加工组,需要逐条加工组信息写入到生产单工序步骤表
|
||||
|
||||
if (processRespDTO.getType() == ProcessTypeEnum.TYPE_SEVEN.getStatus()) {
|
||||
|
||||
List<OrderGroupDO> orderGroupDOS = orderGroupMapper.getOrderGroupByOrderId(createReqVO.getOrderId(), SecurityFrameworkUtils.getLoginUser().getOrganId());
|
||||
if (orderGroupDOS.size() != 0) { // 有加工组
|
||||
for (int i = 0; i < orderGroupDOS.size(); i++) {
|
||||
OrderProcessStepItemDO orderProcessStepItemDO = OrderProcessStepItemDO.builder()
|
||||
.name(orderGroupDOS.get(i).getName())
|
||||
.name(orderGroupDOS.get(i).getName()) // 加工组的名称
|
||||
.processStepId(processStepDOId)
|
||||
.orderProcessId(orderProcessId)
|
||||
.status(false)
|
||||
@@ -135,7 +139,23 @@ public class OrderProcessServiceImpl implements OrderProcessService {
|
||||
orderProcessStepItemDOS.add(orderProcessStepItemDO);
|
||||
}
|
||||
}
|
||||
}else {
|
||||
} else if (processRespDTO.getType() == ProcessTypeEnum.TYPE_EIGHT.getStatus()) { // 若工序类型为板材
|
||||
List<GoodsDO> goodsDOS = goodsMapper.selectGoodsByOrderId(createReqVO.getOrderId(), SecurityFrameworkUtils.getLoginUser().getOrganId());
|
||||
if (goodsDOS.size() != 0) { // 有板材
|
||||
for (int i = 0; i < goodsDOS.size(); i++) {
|
||||
OrderProcessStepItemDO orderProcessStepItemDO = OrderProcessStepItemDO.builder()
|
||||
.name(goodsDOS.get(i).getGoodsName()) // 板块的名称
|
||||
.processStepId(processStepDOId)
|
||||
.orderProcessId(orderProcessId)
|
||||
.status(false)
|
||||
.groupName(processListReqDTO.getName())
|
||||
.bodyId(goodsDOS.get(i).getId())
|
||||
.groupId(0L)
|
||||
.build();
|
||||
orderProcessStepItemDOS.add(orderProcessStepItemDO);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
List<OrderBodyDO> orderBodyDOS = orderBodyMapper.getOrderBodyByOrderId(createReqVO.getOrderId(), SecurityFrameworkUtils.getLoginUser().getOrganId());
|
||||
for (int i = 0; i < orderBodyDOS.size(); i++) {
|
||||
OrderProcessStepItemDO orderProcessStepItemDO = OrderProcessStepItemDO.builder()
|
||||
@@ -194,7 +214,7 @@ public class OrderProcessServiceImpl implements OrderProcessService {
|
||||
|
||||
@Override
|
||||
public OrderProcessDO getOrderProcess(Long orderId) {
|
||||
return orderProcessMapper.selectOne("order_id", orderId ,"organ_id",getUserOrganId());
|
||||
return orderProcessMapper.selectOne("order_id", orderId, "organ_id", getUserOrganId());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
-1
@@ -53,7 +53,6 @@ public class ApiDataAchieve {
|
||||
jsonPlatesData.put("order_no", orderNo);//生产单号需要传入赋值
|
||||
jsonPlatesData.put("format", "json");
|
||||
JSONObject dataPlates = apiDataProduction.getApiOrderMessage(token, jsonPlatesData);
|
||||
System.out.println(" dataPlates " + dataPlates);
|
||||
if (!dataPlates.getString("err_code").equals("0")) {
|
||||
throw exception(PLATE_PLAN_DATA_ERROR);
|
||||
}
|
||||
|
||||
+72
-28
@@ -46,6 +46,8 @@ public class ApiTypeRealize {
|
||||
|
||||
private Integer num = 0;
|
||||
|
||||
private Integer specialShapedNum = 0;
|
||||
|
||||
private Integer groupNum = 0;
|
||||
|
||||
private final static Integer X = 0;
|
||||
@@ -77,23 +79,21 @@ public class ApiTypeRealize {
|
||||
OrderDO orderDO = orderInfoChange(dataPlates, orderId, orderNo);
|
||||
List<OrderDO> order = new ArrayList<>();
|
||||
order.add(orderDO);
|
||||
|
||||
// 商品信息数据 信息以全
|
||||
Map<String, Map<Long, ?>> goodsInfoChange = rawGoodsInfoChange(dataGoods, orderId, dataBlocks);
|
||||
// System.out.println(" goodsInfoChange " + goodsInfoChange);
|
||||
List<GoodsDO> goodsDO = (List<GoodsDO>) goodsInfoChange.get("goodsDOS").values().stream()
|
||||
.collect(Collectors.toList());
|
||||
List<GoodsDO> goodsDO = (List<GoodsDO>) goodsInfoChange.get("goodsDOS").values().stream().collect(Collectors.toList());
|
||||
map.put("goodsDO", goodsDO);
|
||||
List<RawGoodsDO> rawGoodsDO = (List<RawGoodsDO>) goodsInfoChange.get("rawGoodsDOS").values().stream()
|
||||
.collect(Collectors.toList());
|
||||
List<RawGoodsDO> rawGoodsDO = (List<RawGoodsDO>) goodsInfoChange.get("rawGoodsDOS").values().stream().collect(Collectors.toList());
|
||||
map.put("rawGoodsDO", rawGoodsDO);
|
||||
|
||||
// 柜体信息 少异形数量、板材数量
|
||||
Map<Long, OrderBodyDO> bodyInfoChange = bodyInfoChange(dataBody, orderId);
|
||||
// System.out.println(" bodyInfoChange " + bodyInfoChange);
|
||||
|
||||
// 加工组 少异形数量、板材数量
|
||||
Map<String, Map<Long, ?>> group =
|
||||
groupInfoChange(dataModule, orderId, bodyInfoChange);
|
||||
Map<Long, OrderGroupDO> orderGroupDO = (Map<Long, OrderGroupDO>) group.get("orderGroup");
|
||||
map.put("groupDO", orderGroupDO.values().stream().collect(Collectors.toList()));
|
||||
Map<Long, List<Long>> groupLists = (Map<Long, List<Long>>) group.get("lists"); // 加工组中包含的板件、配件id
|
||||
// 配件
|
||||
Map<String, Map<Long, ?>> partsDO = partsInfoChange(dataParts, orderId,
|
||||
@@ -120,6 +120,7 @@ public class ApiTypeRealize {
|
||||
Map<Long, OrderBodyDO> bodyItemsPlates = (Map<Long, OrderBodyDO>) platesDO.get("bodyInfos");
|
||||
platesItems = orderPartsChange(orderGroupDO, groupLists, platesItems);// item补充
|
||||
itemsList.addAll(platesItems.values());
|
||||
map.put("groupDO", groupAddUnregularNum(itemsList, orderPlatesDO, orderGroupDO).values().stream().collect(Collectors.toList()));
|
||||
// System.out.println("生产单数据 " + orderDO+ " 商品信息1 " + goodsDO + " 商品信息2 "
|
||||
// + rawGoodsDO + " 板材信息 " + new ArrayList<>(orderPlatesDO.values())
|
||||
// + " 配件信息 " + new ArrayList<>(orderPartsDO.values())
|
||||
@@ -128,7 +129,6 @@ public class ApiTypeRealize {
|
||||
// + " 配件Item " + partsItems + " 板材Item " + platesItems);
|
||||
map.put("orderDO", order);
|
||||
map.put("itemDO", itemsList);
|
||||
// System.out.println(" bodyItemsPlates " + bodyItemsPlates);
|
||||
map.put("bodyDO", bodyItemsPlates.values().stream().collect(Collectors.toList()));
|
||||
return map;
|
||||
}
|
||||
@@ -136,21 +136,22 @@ public class ApiTypeRealize {
|
||||
|
||||
/**
|
||||
* bodyInfoChange: BoxId body 暂时未用
|
||||
* @param orderGroupDO: ModuleID group
|
||||
* @param groupLists: ModuleID 板材、配件id
|
||||
* @param items: ItemID item
|
||||
*
|
||||
* @param orderGroupDO: ModuleID group
|
||||
* @param groupLists: ModuleID 板材、配件id
|
||||
* @param items: ItemID item
|
||||
* @return Map<Integer, OrderItemDO>
|
||||
* @author Administrator
|
||||
* @date 2024/5/8
|
||||
*/
|
||||
public Map<Long, OrderItemDO> orderPartsChange(Map<Long, OrderGroupDO> orderGroupDO,
|
||||
Map<Long, List<Long>> groupLists, Map<Long, OrderItemDO> items) {
|
||||
Map<Long, List<Long>> groupLists, Map<Long, OrderItemDO> items) {
|
||||
|
||||
groupLists.forEach((k, v) -> {
|
||||
v.forEach(v1 -> {
|
||||
if (items.get(v1) != null) {
|
||||
|
||||
if (items.containsKey(v1) && (items.get(v1).getGroupId() == null || items.get(v1).getGroupId() == 0)) {
|
||||
if (items.get(v1).getGroupId() == null || items.get(v1).getGroupId() == 0) {
|
||||
items.get(v1).setGroupId(orderGroupDO.get(k).getId());
|
||||
} else { // 如果groupId已存在值(即不为null),则创建一个新的OrderItemDO对象
|
||||
OrderItemDO item = OrderItemDO.builder()
|
||||
@@ -166,7 +167,7 @@ public class ApiTypeRealize {
|
||||
.plateId(items.get(v1).getPlateId())
|
||||
.num(items.get(v1).getNum())
|
||||
.build();
|
||||
items.put(orderGroupDO.get(k).getId(), item); //再复查
|
||||
items.put(item.getId(), item); //再复查
|
||||
}
|
||||
|
||||
if (items.get(v1).getPlateId() != null)
|
||||
@@ -177,10 +178,39 @@ public class ApiTypeRealize {
|
||||
groupNum = 0;
|
||||
});
|
||||
|
||||
System.err.println(" item " + items);
|
||||
return items;
|
||||
}
|
||||
|
||||
/**
|
||||
* 加工组异形板赋值
|
||||
*/
|
||||
public Map<Long, OrderGroupDO> groupAddUnregularNum(List<OrderItemDO> itemsList, Map<Long, PlateDO> orderPlatesDO, Map<Long, OrderGroupDO> orderGroupDO) {
|
||||
|
||||
Map<Long, List<OrderItemDO>> groupPlate = itemsList.stream().collect(Collectors.groupingBy(OrderItemDO::getGroupId));
|
||||
List<PlateDO> orderItemDOList = orderPlatesDO.values().stream().collect(Collectors.toList());
|
||||
Map<Long, PlateDO> plateDOMap = orderItemDOList.stream().collect(Collectors.toMap(PlateDO::getId, plate -> plate));
|
||||
List<OrderGroupDO> orderGroupDOList = orderGroupDO.values().stream().collect(Collectors.toList());
|
||||
Map<Long, OrderGroupDO> orderGroupDOMap = orderGroupDOList.stream().collect(Collectors.toMap(OrderGroupDO::getId, v -> v));
|
||||
|
||||
groupPlate.forEach((k, v) -> { // k 加工组id
|
||||
|
||||
v.forEach(item -> {
|
||||
if (plateDOMap.get(item.getPlateId()) != null) {
|
||||
if (plateDOMap.get(item.getPlateId()).getIsSpecialShaped()) { // 异形相加
|
||||
specialShapedNum++;
|
||||
// System.out.println(k + " 对应 " + specialShapedNum);
|
||||
}
|
||||
}
|
||||
});
|
||||
if (orderGroupDOMap.get(k) != null) {// m 加工组
|
||||
orderGroupDOMap.get(k).setUnregularNum(specialShapedNum);
|
||||
}
|
||||
;
|
||||
specialShapedNum = 0;
|
||||
});
|
||||
return orderGroupDO;
|
||||
}
|
||||
|
||||
/**
|
||||
* 加工组 信息转换
|
||||
*/
|
||||
@@ -293,7 +323,7 @@ public class ApiTypeRealize {
|
||||
* @author Administrator
|
||||
* @date 2024/4/30
|
||||
*/
|
||||
public Map<String, Map<Long, ?>> rawGoodsInfoChange(JSONObject dataRawGoods, Long orderId , JSONObject dataBlocks) {
|
||||
public Map<String, Map<Long, ?>> rawGoodsInfoChange(JSONObject dataRawGoods, Long orderId, JSONObject dataBlocks) {
|
||||
Map<String, Map<Long, ?>> map = new HashMap<>();
|
||||
Map<Long, RawGoodsDO> rawGoodsDOS = new HashMap<>();
|
||||
Map<Long, GoodsDO> goodsDOS = new HashMap<>();
|
||||
@@ -380,7 +410,6 @@ public class ApiTypeRealize {
|
||||
|
||||
}
|
||||
}
|
||||
// System.out.println(" bodyInfos " + bodyInfos);
|
||||
return bodyInfos;
|
||||
}
|
||||
|
||||
@@ -410,7 +439,7 @@ public class ApiTypeRealize {
|
||||
Map<String, Map<Long, ?>> map = new HashMap<>();
|
||||
Map<Long, OrderPartsDO> partsInfos = new HashMap<>();
|
||||
Map<Long, OrderItemDO> partsItem = new HashMap<>();
|
||||
Map<Long, OrderPartsRemark> remarks =new HashMap<>();
|
||||
Map<Long, OrderPartsRemark> remarks = new HashMap<>();
|
||||
|
||||
if (value != null && !value.isEmpty()) {
|
||||
JSONArray partsLists = value.getJSONArray("List");
|
||||
@@ -435,7 +464,7 @@ public class ApiTypeRealize {
|
||||
.isComposite(parts.getBoolean("IsComposite"))
|
||||
.remark(parts.getString("Remark"))
|
||||
.build();
|
||||
remarks.put(parts.getLong("ItemID"),partsRemarkChange(parts, orderId, partsId));
|
||||
remarks.put(parts.getLong("ItemID"), partsRemarkChange(parts, orderId, partsId));
|
||||
partsInfos.put(parts.getLong("ItemID"), partsInfo);
|
||||
|
||||
// item 明细
|
||||
@@ -480,8 +509,8 @@ public class ApiTypeRealize {
|
||||
* 板材信息转换 写表 Integer指板材的ItemID板id 加一个板材自定义编号
|
||||
*/
|
||||
private Map<String, Map<Long, ?>> platesInfoChange(JSONObject value, JSONObject dataPlates, Long orderId,
|
||||
Map<Long, GoodsDO> goodsDOMap, Map<Long, OrderBodyDO> bodyInfos,
|
||||
JSONObject dataBlocks) {
|
||||
Map<Long, GoodsDO> goodsDOMap, Map<Long, OrderBodyDO> bodyInfos,
|
||||
JSONObject dataBlocks) {
|
||||
// 板材 写ES
|
||||
Map<Long, PlateDetail> plateDetail = platesDetailChange(value);
|
||||
|
||||
@@ -504,12 +533,16 @@ public class ApiTypeRealize {
|
||||
plate.getString("BoardType"))
|
||||
.getData().getValue());
|
||||
Long plateId = (Long) identifierGenerator.nextId(null);
|
||||
|
||||
String remarkJson = plate.getString("RemarkJson").replace("[", "").replace("]", "");
|
||||
String remark = remarkJson != null && !remarkJson.trim().isEmpty() ? remarkJson : "";
|
||||
|
||||
PlateDO plateInfo = PlateDO.builder()
|
||||
.id(plateId)
|
||||
.orderId(orderId)
|
||||
.name(plate.getString("BoardName"))
|
||||
// .plateNo(plate.getString("CustBlockNo"))
|
||||
.plateNo((obtainingTime)+ Long.toString(plateNo).substring(2))
|
||||
.plateNo((obtainingTime) + Long.toString(plateNo).substring(2))
|
||||
.type(type)
|
||||
|
||||
.goodsId(goodsDOMap.get(plate.getLong("GoodsID")) != null
|
||||
@@ -546,7 +579,7 @@ public class ApiTypeRealize {
|
||||
.isSculpt(plate.getBoolean("IsModel"))
|
||||
.isSpecialShaped(plate.getBoolean("UnRegular"))
|
||||
.isCancel(false)
|
||||
.remark(plate.getString("RemarkJson"))
|
||||
.remark(remark)
|
||||
.build();
|
||||
|
||||
// item 明细
|
||||
@@ -591,23 +624,34 @@ public class ApiTypeRealize {
|
||||
}
|
||||
|
||||
List<OrderItemDO> platesList = platesItem.values().stream().collect(Collectors.toList());
|
||||
List<PlateDO> plateDOList = platesInfos.values().stream().collect(Collectors.toList());
|
||||
|
||||
Map<Long, List<OrderItemDO>> platesDetail = platesList.stream()
|
||||
.collect(Collectors.groupingBy(OrderItemDO::getBodyId));
|
||||
.collect(Collectors.groupingBy(OrderItemDO::getBodyId)); // 根据柜体分组
|
||||
|
||||
Map<Long, PlateDO> plateDOMap = plateDOList.stream()
|
||||
.collect(Collectors.toMap(PlateDO::getId, plate -> plate)); // 板件id为key
|
||||
|
||||
// 遍历platesDetail
|
||||
|
||||
platesDetail.forEach((k, v) -> {
|
||||
Integer specialShapedNum = 0;
|
||||
|
||||
v.forEach(item -> {
|
||||
num++;
|
||||
|
||||
if (plateDOMap.get(item.getPlateId()).getIsSpecialShaped()) { // 异形相加
|
||||
specialShapedNum++;
|
||||
}
|
||||
});
|
||||
bodyInfos.forEach((n, m) -> {
|
||||
if (k == m.getId()) {
|
||||
m.setPlateNum(num);
|
||||
m.setUnregularNum(specialShapedNum);
|
||||
}
|
||||
});
|
||||
num = 0;
|
||||
specialShapedNum = 0;
|
||||
});
|
||||
// System.err.println(bodyInfos);
|
||||
map.put("platesInfos", platesInfos);
|
||||
map.put("platesItems", platesItem);
|
||||
map.put("plateDetail", plateDetail);
|
||||
@@ -705,7 +749,7 @@ public class ApiTypeRealize {
|
||||
}
|
||||
|
||||
} else {
|
||||
System.out.println("JSON 数据中没有订单信息(Orders 数组为空)。");
|
||||
// System.out.println("JSON 数据中没有订单信息(Orders 数组为空)。");
|
||||
}
|
||||
|
||||
return plateDetails;
|
||||
@@ -780,7 +824,7 @@ public class ApiTypeRealize {
|
||||
.depth(Double.valueOf(hole.getString("Depth")))
|
||||
.build());
|
||||
} catch (Exception e) {
|
||||
System.out.println("HoleDetail " + hole);
|
||||
// System.out.println("HoleDetail " + hole);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+8
-3
@@ -166,7 +166,7 @@ public class ExcelTypeRealize {
|
||||
Long groupId = (Long) snowFlakeGenerator.nextId(null);
|
||||
// 板数量
|
||||
final Double[] plateCountByCombination = {0.0};
|
||||
OrderGroupDO orderGroupDO = OrderGroupDO.builder().id(groupId).orderId(orderId).orderId(organId).bodyId(bodyId)
|
||||
OrderGroupDO orderGroupDO = OrderGroupDO.builder().id(groupId).orderId(orderId).organId(organId).bodyId(bodyId)
|
||||
.groupTypeId(groupTypeId).groupTypeName(synthesis).name(combinationName).width(0.0).height(0.0)
|
||||
.depth(0.0).multiNum(0).plateNum(0).unregularNum(0).filename("无").remark("无").build();
|
||||
|
||||
@@ -232,11 +232,15 @@ public class ExcelTypeRealize {
|
||||
|
||||
});
|
||||
orderGroupDO.setPlateNum(plateCountByCombination[0].intValue());
|
||||
orderGroupDOS.add(orderGroupDO);
|
||||
if (orderGroupDO.getName() != null && !orderGroupDO.getName().trim().isEmpty()) {
|
||||
orderGroupDOS.add(orderGroupDO);
|
||||
}
|
||||
});
|
||||
});
|
||||
orderBodyDO.setPlateNum(Integer.valueOf(plateCountByCabinetName[0].intValue()));
|
||||
orderBodyDOS.add(orderBodyDO);
|
||||
if (orderBodyDO.getName() != null && !orderBodyDO.getName().trim().isEmpty()) {
|
||||
orderBodyDOS.add(orderBodyDO);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -251,6 +255,7 @@ public class ExcelTypeRealize {
|
||||
map.put("orderModuleExtraDOS", orderModuleExtraDOS);
|
||||
map.put("orderModelDOS", orderModelDOS);
|
||||
map.put("orderPartsRemarks", orderPartsRemarks);
|
||||
System.out.println(" orderGroupDOS " + orderGroupDOS);
|
||||
return map;
|
||||
}
|
||||
|
||||
|
||||
+10
@@ -41,4 +41,14 @@
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
<update id="updateDeletedById">
|
||||
UPDATE order_goods
|
||||
SET deleted = #{deleted}
|
||||
WHERE id IN
|
||||
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>AND organ_id = #{organId}
|
||||
</update>
|
||||
</mapper>
|
||||
+1
@@ -46,6 +46,7 @@
|
||||
<select id="selectPartAll"
|
||||
resultType="com.cf.imes.module.executor.controller.admin.orderParts.vo.PartGoodsRespVO">
|
||||
SELECT DISTINCT
|
||||
a.id,
|
||||
a.name,
|
||||
a.brand,
|
||||
a.model,
|
||||
|
||||
+13
@@ -244,6 +244,7 @@
|
||||
<select id="selectPlateGoodsListSummary" resultType="com.cf.imes.module.executor.controller.admin.plate.vo.PlateGoodsRespVO">
|
||||
|
||||
select distinct
|
||||
op.id,
|
||||
op.name,
|
||||
op.open_door_type,
|
||||
op.height,
|
||||
@@ -311,4 +312,16 @@
|
||||
SELECT plate_id FROM order_item
|
||||
WHERE body_id = #{bodyId} AND organ_id = #{organId}
|
||||
</select>
|
||||
|
||||
<select id="selectPlateGoodsListByList" resultType="com.cf.imes.module.executor.controller.admin.plate.vo.PlateGoodsIdVO">
|
||||
SELECT order_id, id, goods_id, deleted
|
||||
FROM order_plate op
|
||||
WHERE op.organ_id = #{organId} AND op.order_id = #{orderId} AND op.id in
|
||||
|
||||
<foreach collection="plates" item="plate" open="(" close=")" separator=",">
|
||||
|
||||
#{plate}
|
||||
|
||||
</foreach>
|
||||
</select>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user