mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 21:02:08 +08:00
造型数据修改
This commit is contained in:
+1
-1
@@ -59,5 +59,5 @@ public interface ErrorCodeConstants {
|
||||
ErrorCode FILE_READ_SUCCESS = new ErrorCode(1_002_029_012, "文件读取成功");
|
||||
ErrorCode FILE_READ_ERR = new ErrorCode(1_002_029_012, "文件读取错误");
|
||||
ErrorCode FILE_ADD_ERR = new ErrorCode(1_002_029_012, "文件已经存在是否强制保存");
|
||||
ErrorCode FILE_UPLOAD_ERR = new ErrorCode(1_002_029_012, "文件为空");
|
||||
ErrorCode FILE_UPLOAD_ERR = new ErrorCode(1_002_029_012, "文件内容为空");
|
||||
}
|
||||
|
||||
+1
-1
@@ -295,7 +295,7 @@ public class OrderController {
|
||||
@Parameter(name = "type", description = "是否强制上传", required = false)
|
||||
})
|
||||
@PreAuthorize("@ss.hasPermission('executor:order:upload')")
|
||||
public CommonResult<String> getOrderBody(@RequestPart("file") MultipartFile file,
|
||||
public CommonResult<String> uploadOrderType(@RequestPart("file") MultipartFile file,
|
||||
@RequestParam(value = "type", required = false, defaultValue = "false") Boolean type) {
|
||||
return success(orderService.importTemplate(file,type));
|
||||
}
|
||||
|
||||
+77
@@ -0,0 +1,77 @@
|
||||
package com.cf.imes.module.executor.controller.admin.orderParts.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Schema(description = "管理后台 - 配件对应板材信息")
|
||||
public class PartGoodsRespVO {
|
||||
|
||||
@Schema(description = "柜体号", example = "11087")
|
||||
private Long bodyId;
|
||||
|
||||
@Schema(description = "柜体名称", example = "11087")
|
||||
private String bodyName;
|
||||
|
||||
@Schema(description = "房间号", example = "11087")
|
||||
private Long roomId;
|
||||
|
||||
@Schema(description = "房间名称", example = "11087")
|
||||
private String roomName;
|
||||
|
||||
@Schema(description = "配件 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "29347")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "生产单号", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Long orderId;
|
||||
|
||||
@Schema(description = "商品ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1195")
|
||||
private String goodsId;
|
||||
|
||||
@Schema(description = "配件名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "晨丰")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "材质", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String material;
|
||||
|
||||
@Schema(description = "配件类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||
private String type;
|
||||
|
||||
@Schema(description = "型号", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String model;
|
||||
|
||||
@Schema(description = "规格", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String spec;
|
||||
|
||||
@Schema(description = "品牌", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String brand;
|
||||
|
||||
@Schema(description = "厂家", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String factory;
|
||||
|
||||
@Schema(description = "单位", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String unit;
|
||||
|
||||
@Schema(description = "价格", requiredMode = Schema.RequiredMode.REQUIRED, example = "29507")
|
||||
private Double price;
|
||||
|
||||
@Schema(description = "是否复合部件:0 否 1 是", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Boolean isComposite;
|
||||
|
||||
@Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED, example = "你猜")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@Schema(description = "数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "29507")
|
||||
private Double num;
|
||||
}
|
||||
+15
@@ -19,6 +19,21 @@ import static com.cf.imes.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH
|
||||
@Schema(description = "管理后台 - 板件对应板材信息")
|
||||
public class PlateGoodsRespVO {
|
||||
|
||||
@Schema(description = "柜体号", example = "11087")
|
||||
private Long bodyId;
|
||||
|
||||
@Schema(description = "柜体名称", example = "11087")
|
||||
private String bodyName;
|
||||
|
||||
@Schema(description = "房间号", example = "11087")
|
||||
private Long roomId;
|
||||
|
||||
@Schema(description = "房间名称", example = "11087")
|
||||
private String roomName;
|
||||
|
||||
@Schema(description = "板id", example = "11087")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "生产单号", example = "11087")
|
||||
private Long orderId;
|
||||
|
||||
|
||||
+2
-3
@@ -16,7 +16,7 @@ public class OrderProcessSaveReqVO {
|
||||
private Long orderId;
|
||||
|
||||
@Schema(description = "工序名", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三")
|
||||
@NotEmpty(message = "工序名不能为空")
|
||||
@NotEmpty(message = "工序组名不能为空")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "工序组 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "4356")
|
||||
@@ -28,11 +28,10 @@ public class OrderProcessSaveReqVO {
|
||||
private Boolean status;
|
||||
|
||||
@Schema(description = "板材大小", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "板材大小不能为空")
|
||||
private Double size;
|
||||
|
||||
@Schema(description = "下一工序 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "24046")
|
||||
@NotNull(message = "下一工序 ID不能为空")
|
||||
private Long nextStepId;
|
||||
|
||||
private Long organId;
|
||||
}
|
||||
+1
-1
@@ -13,7 +13,7 @@ import com.cf.imes.framework.mybatis.core.dataobject.BaseDO;
|
||||
*
|
||||
* @author 晨丰科技
|
||||
*/
|
||||
@TableName("imes_prod.order_process")
|
||||
@TableName("order_process")
|
||||
@KeySequence("order_process_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
|
||||
+1
@@ -47,6 +47,7 @@ public class OrderProcessStepItemDO {
|
||||
// 加工组 ID
|
||||
private Long groupId;
|
||||
|
||||
private Long dataId;
|
||||
|
||||
|
||||
}
|
||||
|
||||
+19
-2
@@ -2,6 +2,7 @@ package com.cf.imes.module.executor.dal.mysql.order;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
@@ -44,7 +45,7 @@ public interface OrderMapper extends BaseMapperX<OrderDO> {
|
||||
.eqIfPresent(OrderDO::getSalesman, reqVO.getSalesman())
|
||||
.eqIfPresent(OrderDO::getSplitter, reqVO.getSplitter())
|
||||
.eqIfPresent(OrderDO::getRemark, reqVO.getRemark())
|
||||
.eqIfPresent(OrderDO::getDeleted, reqVO.getDeleted())
|
||||
.eqIfPresent(OrderDO::getDeleted, 0)
|
||||
.eqIfPresent(OrderDO::getOrganId, reqVO.getOrganId())
|
||||
.betweenIfPresent(OrderDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(OrderDO::getId));
|
||||
@@ -92,8 +93,24 @@ public interface OrderMapper extends BaseMapperX<OrderDO> {
|
||||
|
||||
Map<String, Object> selectDynamicSqlString(@Param("sqlStr") String sqlStr);
|
||||
|
||||
default Long selectCountByOrderNo(@Param("CustomOrderNo") String CustomOrderNo){
|
||||
default Long selectCountByOrderNo(@Param("CustomOrderNo") String CustomOrderNo) {
|
||||
return selectCount(new LambdaQueryWrapper<OrderDO>().eq(OrderDO::getCustomOrderNo, CustomOrderNo));
|
||||
}
|
||||
|
||||
// 条件查找生产单
|
||||
default List<OrderDO> selectOrder(Long id,Long organId) {
|
||||
return selectList(new LambdaQueryWrapperX<OrderDO>()
|
||||
.eqIfPresent(OrderDO::getId, id)
|
||||
.eqIfPresent(OrderDO::getOrganId, organId)
|
||||
.eq(OrderDO::getDeleted, 0));
|
||||
}
|
||||
|
||||
// 修改生产单状态
|
||||
default int updateOrderStatus(Long id, Integer status,Long organId) {
|
||||
return update(new LambdaUpdateWrapper<OrderDO>()
|
||||
.set(OrderDO::getStatus, status)
|
||||
.eq(OrderDO::getId, id)
|
||||
.eq(OrderDO::getDeleted, 0)
|
||||
.eq(OrderDO::getOrganId, organId));
|
||||
}
|
||||
}
|
||||
|
||||
+2
@@ -22,4 +22,6 @@ public interface OrderBodyMapper extends BaseMapperX<OrderBodyDO> {
|
||||
int deleteAllByOrderId(@Param("orderId") Long orderId, @Param("bodyId") Long bodyId);
|
||||
|
||||
List<OrderModuleRespVO> selectModuleByOrderId(@Param("orderId") Long orderId);
|
||||
|
||||
List<OrderBodyDO> getOrderBodyByOrderId(@Param("orderId") Long orderId, @Param("organId") Long organId);
|
||||
}
|
||||
+5
@@ -6,6 +6,8 @@ import com.cf.imes.module.executor.dal.dataobject.orderGroup.OrderGroupDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 生产单加工组 Mapper
|
||||
*
|
||||
@@ -16,4 +18,7 @@ public interface OrderGroupMapper extends BaseMapperX<OrderGroupDO> {
|
||||
|
||||
int updatePlateNumById(@Param("orderId") Long orderId, @Param("plateNum") Double plateNum);
|
||||
|
||||
// 生产单中包含的加工组
|
||||
List<OrderGroupDO> getOrderGroupByOrderId(@Param("orderId") Long orderId, @Param("organId") Long organId);
|
||||
|
||||
}
|
||||
+2
@@ -8,6 +8,7 @@ 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.plate.vo.PlateGoodsRespVO;
|
||||
import com.cf.imes.module.executor.controller.admin.plate.vo.PlateRespVO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.orderParts.OrderPartsDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
@@ -61,4 +62,5 @@ public interface OrderPartsMapper extends BaseMapperX<OrderPartsDO> {
|
||||
|
||||
IPage<OrderPartsRespVO> selectProductList(@Param("page") IPage<OrderPartsRespVO> page , @Param("orderId")Long orderId, @Param("roomId")Long roomId , @Param("bodyId")Long bodyId);
|
||||
|
||||
List<PartGoodsRespVO> selectPartGoodsList(@Param("orderId") Long orderId, @Param("organId") Long organId);
|
||||
}
|
||||
+9
@@ -1,6 +1,8 @@
|
||||
package com.cf.imes.module.executor.dal.mysql.process;
|
||||
|
||||
import com.cf.imes.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.cf.imes.module.executor.dal.dataobject.order.OrderDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.process.OrderProcessDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@@ -12,4 +14,11 @@ import org.apache.ibatis.annotations.Mapper;
|
||||
@Mapper
|
||||
public interface OrderProcessMapper extends BaseMapperX<OrderProcessDO> {
|
||||
|
||||
// 校验是否已经存在该生产单对应工序组
|
||||
default Boolean getOrderProcess(Long orderId,Long organId) {
|
||||
return selectCount(new LambdaQueryWrapperX<OrderProcessDO>()
|
||||
.eq(OrderProcessDO::getOrderId, orderId)
|
||||
.eq(OrderProcessDO::getOrganId, organId)
|
||||
.eq(OrderProcessDO::getDeleted, 0)) > 0;
|
||||
}
|
||||
}
|
||||
+4
-51
@@ -197,7 +197,7 @@ public class OrderServiceImpl implements OrderService {
|
||||
|
||||
@Override
|
||||
public PageResult<OrderDO> getOrderPage(OrderPageReqVO pageReqVO) {
|
||||
return orderMapper.selectPage(pageReqVO);
|
||||
return orderMapper.selectPage(pageReqVO.setOrganId(SecurityFrameworkUtils.getLoginUser().getOrganId()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -225,15 +225,8 @@ public class OrderServiceImpl implements OrderService {
|
||||
// 校验存在
|
||||
validateOrderExists(orderId);
|
||||
List<OrderBodyRespVO> orderBodyRespVOList = BeanUtils.toBean(orderBodyMapper.selectList(new LambdaQueryWrapper<OrderBodyDO>()
|
||||
.eq(OrderBodyDO::getOrderId, orderId)), OrderBodyRespVO.class);
|
||||
// Map<Long, List<OrderBodyRespVO>> map = orderBodyRespVOList.stream().collect(Collectors.groupingBy(OrderBodyRespVO::getRoomId));
|
||||
// Map<Long, String> roomMap = map.entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey, entry -> {
|
||||
// List<OrderBodyRespVO> orderBodyRespVOS = entry.getValue();
|
||||
// return orderBodyRespVOS.get(0).getRoomName();
|
||||
// }));
|
||||
// Map<String,Map<Long,?>> mapLists = new HashMap<>();
|
||||
// mapLists.put("room",roomMap);
|
||||
// mapLists.put("body",map);
|
||||
.eq(OrderBodyDO::getOrderId, orderId)
|
||||
.eq(OrderBodyDO::getOrganId, OrganContextHolder.getOrganId())), OrderBodyRespVO.class);
|
||||
return orderBodyRespVOList;
|
||||
}
|
||||
|
||||
@@ -425,7 +418,6 @@ public class OrderServiceImpl implements OrderService {
|
||||
orderModelDOs.forEach(orderModelDO -> orderModelDO.setOrderId(order.get(0).getId()));
|
||||
orderInputProcessor.batchSaveModel(orderModelDOs);
|
||||
return order.get(0).getId();
|
||||
// return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -459,43 +451,6 @@ public class OrderServiceImpl implements OrderService {
|
||||
return map;
|
||||
}
|
||||
|
||||
public JSONObject mergeJSONObjects(JSONObject object1, JSONObject object2) {
|
||||
|
||||
// 创建新对象
|
||||
JSONObject mergedObj = new JSONObject();
|
||||
// 合并 List 属性
|
||||
JSONArray mergedList = new JSONArray();
|
||||
JSONArray list1 = null;
|
||||
if (object1.getJSONObject("value") != null) {
|
||||
list1 = object1.getJSONObject("value").getJSONArray("List");
|
||||
if (list1 != null) {
|
||||
for (int i = 0; i < list1.size(); i++) {
|
||||
mergedList.add(list1.getJSONObject(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (object1.getJSONArray("List") != null) {
|
||||
list1 = object1.getJSONArray("List");
|
||||
if (list1 != null) {
|
||||
for (int i = 0; i < list1.size(); i++) {
|
||||
mergedList.add(list1.getJSONObject(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
JSONArray list2 = object2.getJSONObject("value").getJSONArray("List");
|
||||
if (list2 != null) {
|
||||
for (int i = 0; i < list2.size(); i++) {
|
||||
mergedList.add(list2.getJSONObject(i));
|
||||
}
|
||||
}
|
||||
|
||||
mergedObj.put("List", mergedList);
|
||||
// System.out.println(mergedObj);
|
||||
return mergedObj;
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void validateOrderBodyExists(Long orderId, Long bodyId) {
|
||||
if (orderBodyMapper.selectCount(new LambdaQueryWrapper<OrderBodyDO>().eq(OrderBodyDO::getOrderId, orderId).eq(OrderBodyDO::getId, bodyId)) == 0) {
|
||||
throw exception(ORDER_BODY_NOT_EXISTS);
|
||||
@@ -598,7 +553,6 @@ public class OrderServiceImpl implements OrderService {
|
||||
validateCustomOrderNoExists(orderDO.getCustomOrderNo());
|
||||
orderInputProcessor.batchInsert(rawGoodsDO, bodyDO, groupDO, partsDO, plateDO, null, itemDO, orderDO, goodsDO, plateGoodDOS);
|
||||
orderInputProcessor.batchSaveModel(orderModelDOS);
|
||||
// System.out.println("plateDO = " + plateDO+ " BeanUtils.toBean(plateDetail, OrderModelDO.class) = " + orderModelDOS);
|
||||
|
||||
}
|
||||
|
||||
@@ -689,11 +643,10 @@ public class OrderServiceImpl implements OrderService {
|
||||
map.put("order", orderDO);
|
||||
switch (type) {
|
||||
case "001":// 板材明细
|
||||
System.err.println(orderDO.getId());
|
||||
map.put("plateGoods", plateMapper.selectPlateGoodsList(orderDO.getId(),SecurityFrameworkUtils.getLoginUser().getOrganId()));
|
||||
break;
|
||||
case "002":// 配件明细
|
||||
|
||||
map.put("partGoods", orderPartsMapper.selectPartGoodsList(orderDO.getId(),SecurityFrameworkUtils.getLoginUser().getOrganId()));
|
||||
break;
|
||||
default:
|
||||
// 处理默认情况,可以选择忽略或者做其他处理
|
||||
|
||||
+65
-17
@@ -1,16 +1,24 @@
|
||||
package com.cf.imes.module.executor.service.process;
|
||||
|
||||
import com.baomidou.mybatisplus.core.incrementer.IdentifierGenerator;
|
||||
import com.cf.imes.framework.security.core.util.SecurityFrameworkUtils;
|
||||
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.processStep.ProcessStepDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.processStepItem.OrderProcessStepItemDO;
|
||||
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;
|
||||
import com.cf.imes.module.executor.dal.mysql.processStep.ProcessStepMapper;
|
||||
import com.cf.imes.module.executor.dal.mysql.processStepItem.ProcessStepItemMapper;
|
||||
import com.cf.imes.module.system.api.process.ProcessGroupApi;
|
||||
import com.cf.imes.module.system.api.process.dto.ProcessListReqDTO;
|
||||
import com.cf.imes.module.system.api.process.dto.ProcessRespDTO;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import com.cf.imes.module.executor.controller.admin.process.vo.*;
|
||||
@@ -20,6 +28,7 @@ import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||
|
||||
import com.cf.imes.module.executor.dal.mysql.process.OrderProcessMapper;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -53,22 +62,30 @@ public class OrderProcessServiceImpl implements OrderProcessService {
|
||||
@Resource
|
||||
private ProcessStepItemMapper processStepItemMapper;
|
||||
|
||||
@Resource
|
||||
private OrderGroupMapper orderGroupMapper;
|
||||
|
||||
@Resource
|
||||
private OrderBodyMapper orderBodyMapper;
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public Long createOrderProcess(OrderProcessSaveReqVO createReqVO) {
|
||||
// 校验生产单存在
|
||||
if (orderMapper.selectById(createReqVO.getOrderId()) == null) {
|
||||
// 当生产不为删除时,校验生产单存在
|
||||
if (orderMapper.selectOrder(createReqVO.getOrderId(), SecurityFrameworkUtils.getLoginUser().getOrganId()).isEmpty()) {
|
||||
throw exception(ORDER_NOT_EXISTS);
|
||||
}
|
||||
// 校验工序组存在
|
||||
if (!processGroupApi.getProcessGroup(createReqVO.getGroupId())){
|
||||
if (!processGroupApi.getProcessGroup(createReqVO.getGroupId())) {
|
||||
throw exception(PROCESS_GROUP_NOT_EXISTS);
|
||||
}
|
||||
// 校验是否已经存在该生产单对应的工序组
|
||||
if (orderProcessMapper.selectOne(OrderProcessDO::getOrderId, createReqVO.getOrderId()) != null) {
|
||||
if (orderProcessMapper.getOrderProcess(createReqVO.getOrderId(), SecurityFrameworkUtils.getLoginUser().getOrganId())) {
|
||||
throw exception(ORDER_PROCESS_EXISTS);
|
||||
}
|
||||
// 插入
|
||||
OrderProcessDO orderProcess = BeanUtils.toBean(createReqVO, OrderProcessDO.class).setId((Long) identifierGenerator.nextId(null));
|
||||
Long orderProcessId = (Long) identifierGenerator.nextId(null);
|
||||
OrderProcessDO orderProcess = BeanUtils.toBean(createReqVO, OrderProcessDO.class).setId(orderProcessId);
|
||||
|
||||
|
||||
List<ProcessStepDO> processStepDOS = new ArrayList<>();
|
||||
@@ -77,21 +94,52 @@ public class OrderProcessServiceImpl implements OrderProcessService {
|
||||
ProcessListReqDTO processListReqDTO = processGroupApi.getProcessGroupDetail(createReqVO.getGroupId());
|
||||
|
||||
processListReqDTO.getLists().forEach(processRespDTO -> {
|
||||
ProcessStepDO processStepDO = BeanUtils.toBean(processRespDTO, ProcessStepDO.class).setOrderId(createReqVO.getOrderId())
|
||||
Long processStepDOId = (Long) identifierGenerator.nextId(null);
|
||||
ProcessStepDO processStepDO = BeanUtils.toBean(processRespDTO, ProcessStepDO.class).setId(processStepDOId).setOrderId(createReqVO.getOrderId())
|
||||
.setStatus(false).setProcessinfoId(processRespDTO.getId()).setOrderProcessId(orderProcess.getId())
|
||||
.setId((Long) identifierGenerator.nextId(null));// 计划日期没有填写
|
||||
// .setId((Long) identifierGenerator.nextId(null)).setScheduleDate(LocalDateTime.now()).setProcessDate(LocalDateTime.now()).setFinishTime(LocalDateTime.now())
|
||||
;// 计划日期没有填写
|
||||
processStepDOS.add(processStepDO);
|
||||
OrderProcessStepItemDO orderProcessStepItemDO = OrderProcessStepItemDO.builder()
|
||||
.name(processRespDTO.getName())
|
||||
.processStepId(processRespDTO.getId())
|
||||
.orderProcessId(orderProcess.getId())
|
||||
.status(false)
|
||||
.groupName(processListReqDTO.getName())
|
||||
.build();// 查模块id,柜体id,加工组id
|
||||
orderProcessStepItemDOS.add(orderProcessStepItemDO);
|
||||
// 生产单中是否存在加工组,若存在加工组,需要逐条加工组信息写入到生产单工序步骤表
|
||||
if (processRespDTO.getType() == 7) {
|
||||
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())
|
||||
.processStepId(processStepDOId)
|
||||
.orderProcessId(orderProcessId)
|
||||
.status(false)
|
||||
.groupName(processListReqDTO.getName())
|
||||
.bodyId(orderGroupDOS.get(i).getBodyId())
|
||||
.groupId(orderGroupDOS.get(i).getId())
|
||||
// .dataId(0L)
|
||||
.build();// 查模块id,柜体id,加工组id
|
||||
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()
|
||||
.name(processRespDTO.getName())
|
||||
.processStepId(processStepDOId)
|
||||
.orderProcessId(orderProcessId)
|
||||
.status(false)
|
||||
.groupName(processListReqDTO.getName())
|
||||
.bodyId(orderBodyDOS.get(i).getId())
|
||||
.groupId(0L)
|
||||
// .dataId(0L)
|
||||
.build();// 查模块id,柜体id,加工组id
|
||||
orderProcessStepItemDOS.add(orderProcessStepItemDO);
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
// 修改生产单的状态
|
||||
orderMapper.updateOrderStatus(createReqVO.getOrderId(), 2, SecurityFrameworkUtils.getLoginUser().getOrganId());
|
||||
// 批量插入
|
||||
orderProcessMapper.insert(orderProcess);
|
||||
orderProcessMapper.insert(orderProcess.setNextStepId(processListReqDTO.getLists().get(0).getId()).setStatus(false));
|
||||
processStepMapper.insertBatch(processStepDOS);
|
||||
processStepItemMapper.insertBatch(orderProcessStepItemDOS);
|
||||
// 返回
|
||||
@@ -121,7 +169,7 @@ public class OrderProcessServiceImpl implements OrderProcessService {
|
||||
}
|
||||
}
|
||||
|
||||
// 通过生产单Id和工序id查询是否存在
|
||||
// 通过生产单Id和工序id查询是否存在
|
||||
private OrderProcessDO validateOrderProcessExists(Long orderId, Long groupId) {
|
||||
return orderProcessMapper.selectOne("order_id", orderId, "group_id", groupId);
|
||||
}
|
||||
|
||||
+2
@@ -20,6 +20,8 @@ public class HoleDetail {
|
||||
|
||||
@Schema(description = "打孔面(0正面, 1反面, 2侧面)")
|
||||
private Integer faceType;
|
||||
@Schema(description = "方向 0:其他(斜方向),1:上方向,2:右方向,3:下方向,4:左方向")
|
||||
private Integer direction;
|
||||
@Schema(description = "孔类型(0大孔, 10小孔, 20木削, 21木削大孔, 30层板钉, 40通孔, 50连接杆, -10造型孔)")
|
||||
private Integer holeType;
|
||||
|
||||
|
||||
+15
-12
@@ -37,9 +37,10 @@ public class ApiTypeRealize {
|
||||
@Resource
|
||||
private DictDataApi dictDataApi;
|
||||
|
||||
private Integer num = 0;
|
||||
private Integer num = 0;
|
||||
|
||||
private Integer groupNum = 0;
|
||||
|
||||
private Integer groupNum = 0;
|
||||
/**
|
||||
* @param dataPlates: 板件生产信息
|
||||
* @param dataParts: 配件信息
|
||||
@@ -94,12 +95,12 @@ public class ApiTypeRealize {
|
||||
itemsList.addAll(partsItems.values());
|
||||
// 板材 写库
|
||||
Map<String, Map<Integer, ?>> platesDO = platesInfoChange(dataPlates, plates, orderId,
|
||||
(Map<Integer, GoodsDO>) goodsInfoChange.get("goodsDOS"), bodyInfoChange, dataBlocks);
|
||||
(Map<Integer, GoodsDO>) goodsInfoChange.get("goodsDOS"), bodyInfoChange, dataBlocks);
|
||||
Map<Integer, PlateDO> orderPlatesDO = (Map<Integer, PlateDO>) platesDO.get("platesInfos");
|
||||
map.put("platesDO", orderPlatesDO.values().stream().collect(Collectors.toList()));
|
||||
map.put("plateDetail", platesDO.get("plateDetail").values().stream().collect(Collectors.toList()));
|
||||
Map<Integer, OrderItemDO> platesItems = (Map<Integer, OrderItemDO>) platesDO.get("platesItems");
|
||||
Map<Integer, OrderBodyDO> bodyItemsPlates= (Map<Integer, OrderBodyDO>) platesDO.get("bodyInfos");
|
||||
Map<Integer, OrderBodyDO> bodyItemsPlates = (Map<Integer, OrderBodyDO>) platesDO.get("bodyInfos");
|
||||
platesItems = orderPartsChange(bodyInfoChange, orderGroupDO, groupLists, platesItems);// item补充
|
||||
itemsList.addAll(platesItems.values());
|
||||
// System.out.println("生产单数据 " + orderDO+ " 商品信息1 " + goodsDO + " 商品信息2 "
|
||||
@@ -411,7 +412,7 @@ public class ApiTypeRealize {
|
||||
Map<Integer, PlateDetail> plateDetail = platesDetailChange(value);
|
||||
|
||||
// 板材数据
|
||||
Map<Integer,JSONObject> plateMap = getBlocksData(dataBlocks);
|
||||
Map<Integer, JSONObject> plateMap = getBlocksData(dataBlocks);
|
||||
|
||||
Map<String, Map<Integer, ?>> map = new HashMap<>();
|
||||
Map<Integer, PlateDO> platesInfos = new HashMap<>();
|
||||
@@ -520,11 +521,11 @@ public class ApiTypeRealize {
|
||||
num++;
|
||||
});
|
||||
bodyInfos.forEach((n, m) -> {
|
||||
if (k==m.getId()){
|
||||
if (k == m.getId()) {
|
||||
m.setPlateNum(num);
|
||||
}
|
||||
});
|
||||
num =0;
|
||||
num = 0;
|
||||
});
|
||||
// System.err.println(bodyInfos);
|
||||
map.put("platesInfos", platesInfos);
|
||||
@@ -548,6 +549,7 @@ public class ApiTypeRealize {
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* 板材设计数据转换成PlateDetail Integer指BlockID板id
|
||||
*/
|
||||
@@ -595,9 +597,9 @@ public class ApiTypeRealize {
|
||||
.offsetX(block.getBigDecimal("OffsetX"))
|
||||
.offsetY(block.getBigDecimal("OffsetY"))
|
||||
.pointDetail(getPointDetail(block, 1))
|
||||
.rawPointDetail(getPointDetail(block, 3))
|
||||
.rawPointDetail(getPointDetail(block, 2))
|
||||
.holeDetail(getHoleDetail(block, 1))
|
||||
.sideHoleDetail(getHoleDetail(block, 3))
|
||||
.sideHoleDetail(getHoleDetail(block, 2))
|
||||
.contourDetail(getModelDetail(block))
|
||||
// 排钻类型
|
||||
.drillsInfos(getDrillsInfo(block))
|
||||
@@ -662,7 +664,7 @@ public class ApiTypeRealize {
|
||||
return pointDetailList;
|
||||
}
|
||||
|
||||
// 孔明细板数据解析 (type 为1,正面;3,侧面)
|
||||
// 孔明细板数据解析 (type 为1,正面;2,侧面)
|
||||
private List<HoleDetail> getHoleDetail(JSONObject block, Integer type) {
|
||||
List<HoleDetail> holeDetails = new ArrayList<>();
|
||||
if (type == 1) { // 1,正面
|
||||
@@ -672,7 +674,7 @@ public class ApiTypeRealize {
|
||||
holeDetails.add(HoleDetail.builder()
|
||||
.startX(Double.valueOf(hole.getString("X")))
|
||||
.startY(Double.valueOf(hole.getString("Y")))
|
||||
.faceType(1)
|
||||
.faceType(hole.getInteger("Face"))
|
||||
.radius(Double.valueOf(hole.getString("Diameter")) / 2)
|
||||
.depth(Double.valueOf(hole.getString("Depth")))
|
||||
.build());
|
||||
@@ -692,7 +694,8 @@ public class ApiTypeRealize {
|
||||
.endX(Double.valueOf(endPoints[0]))
|
||||
.endY(Double.valueOf(endPoints[1]))
|
||||
.endZ(Double.valueOf(endPoints[2]))
|
||||
.faceType(3)
|
||||
.faceType(2)
|
||||
.direction(hole.getInteger("Direction"))
|
||||
.radius(Double.valueOf(hole.getString("Diameter")) / 2)
|
||||
.depth(Double.valueOf(hole.getString("Depth")))
|
||||
.build());
|
||||
|
||||
+36
-40
@@ -36,6 +36,9 @@ import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.ORDER_NOT_EXISTS;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
public class ExcelReadUtil { // 文件读取
|
||||
@@ -54,52 +57,43 @@ public class ExcelReadUtil { // 文件读取
|
||||
public Map<String, Object> read(MultipartFile file) throws IOException {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
ExcelListener excelListener = new ExcelListener();
|
||||
if (file.isEmpty()) {
|
||||
value = "文件为空";
|
||||
throw new IOException("文件为空");
|
||||
} else if (!file.getOriginalFilename().endsWith(".xlsx")) {
|
||||
value = "文件格式不正确";
|
||||
throw new IOException("文件格式不正确");
|
||||
} else if (file.getSize() > 1024 * 1024 * 10) {
|
||||
value = "文件大小超过 10M";
|
||||
throw new IOException("文件大小超过 10M");
|
||||
} else if (file.getSize() == 0) {
|
||||
value = "文件大小为 0";
|
||||
throw new IOException("文件大小为 0");
|
||||
} else {
|
||||
// 读文件
|
||||
EasyExcel.read(file.getInputStream(), excelListener).headRowNumber(-1).sheet().doRead();
|
||||
|
||||
Map<Object, Object> orderMap = new HashMap<>();// order
|
||||
List<Map<Integer, String>> dataLists = excelListener.getDataLists();// 读取的内容
|
||||
List<OrderPlateImportExcelVO> list = new ArrayList<>();// plate
|
||||
// 读文件
|
||||
EasyExcel.read(file.getInputStream(), excelListener).headRowNumber(-1).sheet().doRead();
|
||||
|
||||
dataLists.forEach(
|
||||
item -> {
|
||||
if (item.get(0).equals("###")) {
|
||||
index = false;
|
||||
}
|
||||
if (index) {
|
||||
System.out.println(item);
|
||||
orderMap.put(item.get(0), item.get(1));
|
||||
orderMap.put(item.get(12), item.get(13));
|
||||
} else {
|
||||
if (!(item.get(0).equals("序号") || item.get(0).equals("###"))) {
|
||||
list.add(changeValue(item));
|
||||
}
|
||||
Map<Object, Object> orderMap = new HashMap<>();// order
|
||||
List<Map<Integer, String>> dataLists = excelListener.getDataLists();// 读取的内容
|
||||
List<OrderPlateImportExcelVO> list = new ArrayList<>();// plate
|
||||
|
||||
}
|
||||
dataLists.forEach(
|
||||
item -> {
|
||||
if (item.get(0).equals("###")) {
|
||||
index = false;
|
||||
}
|
||||
);
|
||||
index = true;
|
||||
map.put("order", orderMap);
|
||||
System.err.println(map.get("order"));
|
||||
map.put("plate", list);
|
||||
return map;
|
||||
}
|
||||
if (index) {
|
||||
System.out.println(item);
|
||||
orderMap.put(item.get(0), item.get(1));
|
||||
orderMap.put(item.get(12), item.get(13));
|
||||
} else {
|
||||
if (!(item.get(0).equals("序号") || item.get(0).equals("###"))) {
|
||||
list.add(changeValue(item));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
);
|
||||
index = true;
|
||||
map.put("order", orderMap);
|
||||
System.err.println(map.get("order"));
|
||||
if (orderMap.size() == 0)
|
||||
throw exception(ORDER_NOT_EXISTS);
|
||||
map.put("plate", list);
|
||||
return map;
|
||||
|
||||
}
|
||||
|
||||
// order 数据转换
|
||||
public OrderDO changeOrderDO(Map<Object, Object> orderMap){
|
||||
public OrderDO changeOrderDO(Map<Object, Object> orderMap) {
|
||||
String s = (String) orderMap.get("出货日期");
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||
LocalDate orderDate = LocalDate.parse(s, formatter);
|
||||
@@ -131,6 +125,7 @@ public class ExcelReadUtil { // 文件读取
|
||||
System.out.println("Parsed LocalDateTime: " + dateTime);
|
||||
return dateTime;
|
||||
}
|
||||
|
||||
// 写excel
|
||||
public void write(HttpServletResponse response,
|
||||
Map<Object, Object> orderMap,
|
||||
@@ -496,6 +491,7 @@ public class ExcelReadUtil { // 文件读取
|
||||
public int isErr() {
|
||||
return isErr;
|
||||
}
|
||||
|
||||
public void setErr(int isErr) {
|
||||
this.isErr = isErr;
|
||||
}
|
||||
|
||||
+9
-3
@@ -21,6 +21,9 @@ import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
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.FILE_UPLOAD_ERR;
|
||||
|
||||
/**
|
||||
* 实现数据格式转换
|
||||
* 使用自带id
|
||||
@@ -37,6 +40,9 @@ public class ExcelTypeRealize {
|
||||
|
||||
// 数据转换 + 错误验证
|
||||
public Map<String, List<?>> changeDate(List<?> list, Long orderId) {
|
||||
if (list.isEmpty()){
|
||||
throw exception(FILE_UPLOAD_ERR);
|
||||
}
|
||||
|
||||
List<OrderPlateImportExcelVO> excelVOS = (List<OrderPlateImportExcelVO>) list;
|
||||
Map<String, List<?>> map = new HashMap<>();
|
||||
@@ -137,9 +143,9 @@ public class ExcelTypeRealize {
|
||||
bodyCollect.forEach((bodyName, listBody) -> {
|
||||
Long bodyId = (Long) snowFlakeGenerator.nextId(null);
|
||||
final Double[] plateCountByCabinetName = {0.0};
|
||||
OrderBodyDO orderBodyDO = OrderBodyDO.builder().id(bodyId).orderId(orderId).orderId(organId)
|
||||
OrderBodyDO orderBodyDO = OrderBodyDO.builder().id(bodyId).orderId(orderId).organId(organId)
|
||||
.roomId(roomId).roomName(roomName).name(bodyName).width(0.0).height(0.0)
|
||||
.depth(0.0).multiNum(0).plateNum(0).unregularNum(0).filename("").remark("").build(); //没有获取柜体的长宽高
|
||||
.depth(0.0).multiNum(0).plateNum(0).unregularNum(0).filename("无").remark("无").build(); //没有获取柜体的长宽高
|
||||
|
||||
|
||||
// 加工组类型为条件进行分组
|
||||
@@ -163,7 +169,7 @@ public class ExcelTypeRealize {
|
||||
final Double[] plateCountByCombination = {0.0};
|
||||
OrderGroupDO orderGroupDO = OrderGroupDO.builder().id(groupId).orderId(orderId).orderId(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();
|
||||
.depth(0.0).multiNum(0).plateNum(0).unregularNum(0).filename("无").remark("无").build();
|
||||
|
||||
listCombinationName.forEach(combination -> {
|
||||
|
||||
|
||||
+6
@@ -24,4 +24,10 @@
|
||||
LEFT JOIN `order_group` g ON b.id = g.body_id
|
||||
WHERE b.order_id = #{orderId}
|
||||
</select>
|
||||
|
||||
<select id="getOrderBodyByOrderId" resultType="com.cf.imes.module.executor.dal.dataobject.orderBody.OrderBodyDO">
|
||||
SELECT b.id, b.order_id, b.room_id, b.name, b.width, b.height, b.depth, b.filename, b.remark, b.creator, b.create_time, b.updater, b.update_time, b.deleted, b.plate_num
|
||||
FROM `order_body` b
|
||||
WHERE b.order_id = #{orderId} and b.organ_id = #{organId} and b.deleted = 0
|
||||
</select>
|
||||
</mapper>
|
||||
+6
@@ -5,4 +5,10 @@
|
||||
<update id="updatePlateNumById" >
|
||||
update `order_group` set plate_num = #{plateNum} where id = #{orderId}
|
||||
</update>
|
||||
|
||||
<select id="getOrderGroupByOrderId" resultType="com.cf.imes.module.executor.dal.dataobject.orderGroup.OrderGroupDO">
|
||||
select gp.id, gp.order_id, gp.name, gp.body_id
|
||||
from `order_group` as gp
|
||||
where gp.order_id = #{orderId} and gp.organ_id = #{organId} and gp.deleted = 0
|
||||
</select>
|
||||
</mapper>
|
||||
+11
@@ -14,4 +14,15 @@
|
||||
|
||||
</select>
|
||||
|
||||
<select id="selectPartGoodsList"
|
||||
resultType="com.cf.imes.module.executor.controller.admin.orderParts.vo.PartGoodsRespVO">
|
||||
SELECT a.id, a.goods_id, a.name, a.material, a.type, a.model, a.spec, a.brand, a.factory,
|
||||
a.unit, a.price, a.is_composite, a.remark, b.num, c.name as body_name, c.id as body_id,
|
||||
c.room_id, c.room_name
|
||||
FROM order_parts a
|
||||
LEFT JOIN order_item b ON a.id = b.parts_id
|
||||
LEFT JOIN order_body c on c.id = b.body_id
|
||||
WHERE b.order_id = #{orderId}
|
||||
and b.organ_id = #{organId}
|
||||
</select>
|
||||
</mapper>
|
||||
+8
-1
@@ -257,6 +257,7 @@
|
||||
<select id="selectPlateGoodsList" resultType="com.cf.imes.module.executor.controller.admin.plate.vo.PlateGoodsRespVO">
|
||||
|
||||
select op.id,
|
||||
op.name,
|
||||
op.goods_id,
|
||||
ogs.goods_name,
|
||||
op.front_hole_count,
|
||||
@@ -297,9 +298,15 @@
|
||||
ogs.thickness as goods_thickness,
|
||||
ogs.color,
|
||||
ogs.material,
|
||||
ogs.spec
|
||||
ogs.spec,
|
||||
bdy.id as body_id,
|
||||
bdy.`name` as body_name,
|
||||
bdy.room_id,
|
||||
bdy.room_name
|
||||
from order_plate op
|
||||
left join order_goods ogs on op.goods_id = ogs.id
|
||||
left join order_item its on op.id = its.plate_id
|
||||
left join order_body bdy on bdy.id = its.body_id
|
||||
where op.order_id = #{orderId}
|
||||
and op.organ_id = #{organId}
|
||||
</select>
|
||||
|
||||
Reference in New Issue
Block a user