生产单管理

This commit is contained in:
lym
2024-05-11 10:23:46 +08:00
parent d9735d3e49
commit 3cef4142fe
30 changed files with 499 additions and 907 deletions
@@ -1,15 +1,11 @@
package com.cf.imes.module.executor.controller.admin.order;
import com.alibaba.excel.EasyExcel;
import com.alibaba.fastjson.JSONObject;
import com.cf.imes.module.executor.controller.admin.order.vo.order.OrderModuleRespVO;
import com.cf.imes.module.executor.controller.admin.order.vo.order.OrderPageReqVO;
import com.cf.imes.module.executor.controller.admin.order.vo.order.OrderRespVO;
import com.cf.imes.module.executor.controller.admin.order.vo.order.OrderSaveReqVO;
import com.cf.imes.module.executor.controller.admin.order.vo.order.*;
import com.cf.imes.module.executor.controller.admin.order.vo.product.OrderBodyRespVO;
import com.cf.imes.module.executor.dal.dataobject.orderModuleExtra.OrderModuleExtraDO;
import com.cf.imes.module.executor.service.order.ApiOrderService;
import com.cf.imes.module.executor.util.fileConversion.admin.files.excel.PlateImportVO;
import com.cf.imes.module.executor.controller.admin.orderParts.vo.OrderPartsRespVO;
import com.cf.imes.module.executor.util.fileConversion.admin.files.excel.OrderExcelUtil;
import com.cf.imes.module.executor.util.fileConversion.admin.files.excel.OrderPlateImportExcelVO;
import io.swagger.v3.oas.annotations.Parameters;
import org.springframework.util.ResourceUtils;
import org.springframework.web.bind.annotation.*;
@@ -28,15 +24,12 @@ import java.io.*;
import java.net.URLEncoder;
import java.util.*;
import com.cf.imes.framework.common.pojo.PageParam;
import com.cf.imes.framework.common.pojo.PageResult;
import com.cf.imes.framework.common.pojo.CommonResult;
import com.cf.imes.framework.common.util.object.BeanUtils;
import static com.cf.imes.framework.common.pojo.CommonResult.success;
import com.cf.imes.framework.excel.core.util.ExcelUtils;
import com.cf.imes.framework.operatelog.core.annotations.OperateLog;
import static com.cf.imes.framework.operatelog.core.enums.OperateTypeEnum.*;
@@ -64,6 +57,9 @@ public class OrderController {
@Resource
private OrderService orderService;
@Resource
private OrderExcelUtil orderExcelUtil;
private static final Logger log = LoggerFactory.getLogger(OrderController.class);
@PostMapping("/create")
@@ -204,7 +200,7 @@ public class OrderController {
@GetMapping("/get-room")
@Operation(summary = "生产单详情-房间柜体信息")
@Operation(summary = "生产单详情-房间柜体id")
@Parameter(name = "orderId", description = "生产单编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('executor:order:query')")
public CommonResult<List<OrderBodyRespVO>> getRoom(@RequestParam("orderId") Long orderId) {
@@ -213,30 +209,43 @@ public class OrderController {
}
@GetMapping("/get-module")
@Operation(summary = "生产单详情-模块全部数量信息")
@Parameters({
@Parameter(name = "orderId", description = "生产单编号", example = "1024"),
@Parameter(name = "roomId", description = "房间编号", example = "1024"),
@Parameter(name = "bodyId", description = "柜体编号", example = "1024")
})
@Operation(summary = "生产单详情-数量信息")
@Parameter(name = "orderId", description = "生产单编号", example = "1024")
@PreAuthorize("@ss.hasPermission('executor:order:query')")
public CommonResult<List<OrderModuleRespVO>> getModule(@RequestParam("orderId") Long orderId) {
List<OrderModuleRespVO> moduleDOList = orderService.getModule(orderId);
public CommonResult<Map<String,List<?>>> getModule(@RequestParam("orderId") Long orderId) {
Map<String,List<?>> moduleDOList = orderService.getModule(orderId);
return success(moduleDOList);
}
@GetMapping("/get-moduleDetails")
@Operation(summary = "生产单详情-模块详细信息")//生产单详情-模块全部数量信息
@GetMapping("/get-platesDetails")
@Operation(summary = "生产单详情-板材详细信息")
@Parameters({
@Parameter(name = "orderId", description = "生产单编号", example = "1024"),
@Parameter(name = "roomId", description = "房间编号", example = "1024"),
@Parameter(name = "bodyId", description = "柜体编号", example = "1024"),
@Parameter(name = "groupId", description = "加工组编号", example = "1024")
})
@PreAuthorize("@ss.hasPermission('executor:order:query')")
public CommonResult<List<OrderPlatesDetailReqVO>> platesDetails(@RequestParam("orderId") Long orderId,
@RequestParam(value = "roomId", required = false) Long roomId,
@RequestParam(value = "bodyId", required = false) Long bodyId,
@RequestParam(value = "groupId", required = false) Long groupId) {
List<OrderPlatesDetailReqVO> moduleDOList = orderService.getPlatesDetail(orderId, roomId, bodyId,groupId);
return success(moduleDOList);
}
@GetMapping("/get-partsDetails")
@Operation(summary = "生产单详情-配件详细信息")
@Parameters({
@Parameter(name = "orderId", description = "生产单编号", example = "1024"),
@Parameter(name = "roomId", description = "房间编号", example = "1024"),
@Parameter(name = "bodyId", description = "柜体编号", example = "1024")
})
@PreAuthorize("@ss.hasPermission('executor:order:query')")
public CommonResult<List<OrderModuleExtraDO>> getModule(@RequestParam("orderId") Long orderId,
@RequestParam(value = "roomId", required = false) Long roomId,
@RequestParam(value = "bodyId", required = false) Long bodyId) {
List<OrderModuleExtraDO> moduleDOList = orderService.getModuleDetail(orderId, roomId, bodyId);
public CommonResult<List<OrderPartsRespVO>> partsDetails(@RequestParam("orderId") Long orderId,
@RequestParam(value = "roomId", required = false) Long roomId,
@RequestParam(value = "bodyId", required = false) Long bodyId) {
List<OrderPartsRespVO> moduleDOList = orderService.getPartsDetail(orderId, roomId, bodyId);
return success(moduleDOList);
}
@@ -264,41 +273,37 @@ public class OrderController {
@GetMapping("getApiData")
@Operation(summary = "api数据获取")
@Operation(summary = "生产单api数据导入新增")
@PreAuthorize("@ss.hasPermission('executor:order:getApiData')")
public CommonResult<Boolean> test(@RequestParam(value = "orderNo", required = false, defaultValue = "20230809027818") String orderNo) {
public CommonResult<Long> test(@RequestParam(value = "orderNo", required = false, defaultValue = "20230809027818") String orderNo) {
return success(orderService.importApiData(orderNo));
}
@PostMapping("/importFile")
@Operation(summary = "生产单导入新增")
@Operation(summary = "生产单文件导入新增")
@Parameters({
@Parameter(name = "file", description = "文件", required = true),
@Parameter(name = "type", description = "文件类型", required = true),
@Parameter(name = "isAddPlate", description = "是否为生产单新增板材", example = "false"),
@Parameter(name = "upload", description = "是 更新、否 新建", example = "false")
@Parameter(name = "type", description = "文件类型", required = true)
})
@PreAuthorize("@ss.hasPermission('executor:order:importExcel')")
@OperateLog(type = EXPORT)
public void exportTest(@RequestPart("file") MultipartFile file,
@RequestParam(value = "type", required = false, defaultValue = "true") Integer type,
@RequestParam(value = "isAddPlate", required = false, defaultValue = "false") Boolean isAddPlate,
@RequestParam(value = "upload", required = false, defaultValue = "false") Boolean upload,
HttpServletResponse response) throws IOException {
// 判断是否更新板材
List<?> list = new ArrayList<>();
if (type == 0) { //excel
// 读取文件
orderExcelUtil.read(file, OrderPlateImportExcelVO.class,0);
// List<OrderPlateImportExcelVO> orderPlateImportExcelVOS = orderExcelUtil.read(file, OrderPlateImportExcelVO.class,0);
// list = orderPlateImportExcelVOS;
} else if (type == 1) { // json
EasyExcel.read(file.getInputStream(), OrderRespVO.class, null)
.headRowNumber(2)
.autoCloseStream(false) // 不要自动关闭,交给 Servlet 自己处理
.doReadAllSync();
}else if (type == 2) { // xml
List<PlateImportVO> orderPlateImportExcelVOS = ExcelUtils.read(file, PlateImportVO.class);
System.out.println(
"orderPlateImportExcelVOS " + orderPlateImportExcelVOS
);
}
}
}
@@ -10,7 +10,7 @@ import lombok.Data;
public class OrderModuleRespVO {
@Schema(description = "生产单号", requiredMode = Schema.RequiredMode.REQUIRED, example = "20230414026120")
private Long id;
private Long orderId;
@Schema(description = "房间Id", requiredMode = Schema.RequiredMode.REQUIRED)
private Long roomId;
@@ -21,9 +21,9 @@ public class OrderModuleRespVO {
@Schema(description = "加工组Id", requiredMode = Schema.RequiredMode.REQUIRED)
private Long groupId;
@Schema(description = "柜体板块数量", requiredMode = Schema.RequiredMode.REQUIRED)
private Integer bodyNum;
@Schema(description = "加工组名", requiredMode = Schema.RequiredMode.REQUIRED)
private String groupName;
@Schema(description = "加工组板块数量", requiredMode = Schema.RequiredMode.REQUIRED)
private Integer groupNum;
@Schema(description = "柜体中的板材数量", requiredMode = Schema.RequiredMode.REQUIRED)
private Integer plateNum;
}
@@ -0,0 +1,70 @@
package com.cf.imes.module.executor.controller.admin.order.vo.order;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.math.BigDecimal;
@Schema(description = "管理后台 - 生产单板件 Response VO")
@Data
@ExcelIgnoreUnannotated
public class OrderPlatesDetailReqVO {
@Schema(description = "板件 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "32523")
private Long id;
@Schema(description = "生产单号", requiredMode = Schema.RequiredMode.REQUIRED, example = "11087")
Long orderId;
@Schema(description = "板名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "晨丰")
private String name;
@Schema(description = "自定义板名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "晨丰")
private String plateNo;
@Schema(description = "材质", requiredMode = Schema.RequiredMode.REQUIRED, example = "晨丰")
private String material;
@Schema(description = "宽度", requiredMode = Schema.RequiredMode.REQUIRED)
private BigDecimal width;
@Schema(description = "高度", requiredMode = Schema.RequiredMode.REQUIRED)
private BigDecimal height;
@Schema(description = "厚度", requiredMode = Schema.RequiredMode.REQUIRED)
private BigDecimal thickness;
@Schema(description = "面积", requiredMode = Schema.RequiredMode.REQUIRED)
private BigDecimal area;
@Schema(description = "左封边厚度", requiredMode = Schema.RequiredMode.REQUIRED)
private BigDecimal sealLeft;
@Schema(description = "右封边厚度", requiredMode = Schema.RequiredMode.REQUIRED)
private BigDecimal sealRight;
@Schema(description = "上封边厚度", requiredMode = Schema.RequiredMode.REQUIRED)
private BigDecimal sealUp;
@Schema(description = "下封边厚度", requiredMode = Schema.RequiredMode.REQUIRED)
private BigDecimal sealDown;
@Schema(description = "纹路类型,0 正纹 1 可翻转 2 反纹", requiredMode = Schema.RequiredMode.REQUIRED)
private Integer texture;
@Schema(description = "是否异形", requiredMode = Schema.RequiredMode.REQUIRED)
private Boolean isSpecialShaped;
@Schema(description = "是否造型", requiredMode = Schema.RequiredMode.REQUIRED)
private Boolean isSculpt;
@Schema(description = "是否排孔", requiredMode = Schema.RequiredMode.REQUIRED)
private Boolean isHole;
@Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED, example = "你说的对")
@ExcelProperty("备注")
private String remark;
}
@@ -0,0 +1,29 @@
package com.cf.imes.module.executor.controller.admin.order.vo.order;
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 OrderPlatesDetailRespVO {
@Schema(description = "生产单号", requiredMode = Schema.RequiredMode.REQUIRED, example = "20230414026120")
private Long orderId;
@Schema(description = "房间Id", requiredMode = Schema.RequiredMode.REQUIRED)
private Long roomId;
@Schema(description = "柜体Id", requiredMode = Schema.RequiredMode.REQUIRED)
private Long bodyId;
@Schema(description = "加工组Id", requiredMode = Schema.RequiredMode.REQUIRED)
private Long groupId;
@Schema(description = "配件名称", requiredMode = Schema.RequiredMode.REQUIRED)
private String partName;
@Schema(description = "柜体中的配件数量", requiredMode = Schema.RequiredMode.REQUIRED)
private Double plateNum;
}
@@ -28,7 +28,7 @@ public class OrderPartsPageReqVO extends PageParam {
private String material;
@Schema(description = "配件类型", example = "2")
private Integer type;
private String type;
@Schema(description = "型号")
private String model;
@@ -35,7 +35,7 @@ public class OrderPartsRespVO {
@Schema(description = "配件类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
@ExcelProperty("配件类型")
private Integer type;
private String type;
@Schema(description = "型号", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("型号")
@@ -30,7 +30,7 @@ public class OrderPartsSaveReqVO {
@Schema(description = "配件类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
@NotEmpty(message = "配件类型不能为空")
private Integer type;
private String type;
@Schema(description = "型号", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "型号不能为空")
@@ -149,6 +149,14 @@ public class PlateRespVO {
@ExcelProperty("排单过滤类型,1 有挖穿造型 2 有挖穿孔 4 有二维刀路 8 可叠")
private Integer filterType;
@Schema(description = "是否异形", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("是否异形")
private Boolean isSpecialShaped;
@Schema(description = "是否造型", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("是否造型")
private Boolean isSculpt;
@Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED, example = "你说的对")
@ExcelProperty("备注")
private String remark;
@@ -0,0 +1,83 @@
package com.cf.imes.module.executor.dal.dataobject.plate;
import com.baomidou.mybatisplus.annotation.KeySequence;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.cf.imes.framework.mybatis.core.dataobject.BaseDO;
import lombok.*;
/**
* 板材信息表 plate_N DO
*
* @author 晨丰科技
*/
@TableName("plate")
@KeySequence("plate_n_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class PlateGoodDO extends BaseDO {
/**
* 主键
*/
@TableId
private Long id;
/**
* 客户的商品编号
*/
private String goodsId;
/**
* 商品名称
*/
private String goodsName;
/**
* 材质:颗粒板、欧松板、多层板、生态板、禾香板、密度板、实木、铝蜂窝板、铝塑板
*/
private String material;
/**
* 颜色
*/
private String color;
/**
* 纹路
*/
private String texture;
/**
* 宽度
*/
private Double width;
/**
* 高度
*/
private Double height;
/**
* 厚度
*/
private Double thickness;
/**
* 价格
*/
private Double price;
/**
* 品牌
*/
private String brand;
/**
* 规格
*/
private String spec;
/**
* 备注
*/
private String remark;
/**
* 组织id
*/
private Long organId;
}
@@ -1,11 +1,13 @@
package com.cf.imes.module.executor.dal.mysql.orderBody;
import com.cf.imes.framework.mybatis.core.mapper.BaseMapperX;
import com.cf.imes.module.executor.controller.admin.order.vo.order.OrderModuleRespVO;
import com.cf.imes.module.executor.dal.dataobject.orderBody.OrderBodyDO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.io.Serializable;
import java.util.List;
/**
* 生产单柜体 Mapper
@@ -18,4 +20,6 @@ public interface OrderBodyMapper extends BaseMapperX<OrderBodyDO> {
int updatePlateNumById(@Param("orderId") Long orderId, @Param("plateNum") Double plateNum);
int deleteAllByOrderId(@Param("orderId") Long orderId, @Param("bodyId") Long bodyId);
List<OrderModuleRespVO> selectModuleByOrderId(@Param("orderId") Long orderId);
}
@@ -2,6 +2,10 @@ package com.cf.imes.module.executor.dal.mysql.orderItem;
import com.cf.imes.framework.mybatis.core.mapper.BaseMapperX;
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.cf.imes.module.executor.controller.admin.order.vo.order.OrderModuleRespVO;
import com.cf.imes.module.executor.controller.admin.order.vo.order.OrderPlatesDetailRespVO;
import com.cf.imes.module.executor.controller.admin.orderParts.vo.OrderPartsRespVO;
import com.cf.imes.module.executor.controller.admin.plate.vo.PlateRespVO;
import com.cf.imes.module.executor.dal.dataobject.orderItem.OrderItemDO;
import com.cf.imes.module.executor.dal.dataobject.orderModuleExtra.OrderModuleExtraDO;
import org.apache.ibatis.annotations.Mapper;
@@ -17,8 +21,9 @@ import java.util.List;
@Mapper
public interface OrderItemMapper extends BaseMapperX<OrderItemDO> {
List<OrderItemDO> selectExtraById(@Param("orderId")Long orderId, @Param("roomId")Long roomId , @Param("bodyId")Long bodyId);
List<PlateRespVO> selectPlatesDetailByOrderId(@Param("orderId")Long orderId, @Param("roomId")Long roomId , @Param("bodyId")Long bodyId , @Param("groupId")Long groupId);
List<OrderPartsRespVO> selectPartsDetailByOrderId(@Param("orderId")Long orderId, @Param("roomId")Long roomId , @Param("bodyId")Long bodyId );
default List<OrderItemDO> selectByOrderId(Long orderId) {
return selectList(new LambdaQueryWrapperX<OrderItemDO>()
@@ -26,4 +31,5 @@ public interface OrderItemMapper extends BaseMapperX<OrderItemDO> {
}
List<OrderPlatesDetailRespVO> selectPartsByOrderId(@Param("orderId") Long orderId);
}
@@ -14,5 +14,5 @@ public interface OrderModuleExtraMapper extends BaseMapperX<OrderModuleExtraDO>
int insertOne(@Param("orderModuleExtraDO")OrderModuleExtraDO orderModuleExtraDO);
List<OrderModuleExtraDO> selectExtraById(@Param("orderId")Long orderId, @Param("roomId")Long roomId , @Param("bodyId")Long bodyId);
}
@@ -0,0 +1,16 @@
package com.cf.imes.module.executor.dal.mysql.plate;
import com.cf.imes.framework.mybatis.core.mapper.BaseMapperX;
import com.cf.imes.module.executor.dal.dataobject.plate.PlateGoodDO;
import org.apache.ibatis.annotations.Mapper;
/**
* 板材信息 Mapper plate
*
* @author 晨丰科技
*/
@Mapper
public interface PlateGoodMapper extends BaseMapperX<PlateGoodDO> {
}
@@ -8,6 +8,7 @@ import com.cf.imes.framework.common.util.json.JsonUtils;
import com.cf.imes.framework.es.core.service.ESDocumentService;
import com.cf.imes.framework.mybatis.core.generator.SnowFlakeGenerator;
import com.cf.imes.framework.organ.core.context.OrganContextHolder;
import com.cf.imes.module.executor.dal.dataobject.goods.GoodsDO;
import com.cf.imes.module.executor.dal.dataobject.order.OrderDO;
import com.cf.imes.module.executor.dal.dataobject.orderBody.OrderBodyDO;
import com.cf.imes.module.executor.dal.dataobject.orderGroup.OrderGroupDO;
@@ -16,13 +17,16 @@ import com.cf.imes.module.executor.dal.dataobject.orderModuleExtra.OrderModuleEx
import com.cf.imes.module.executor.dal.dataobject.orderParts.OrderPartsDO;
import com.cf.imes.module.executor.dal.dataobject.ordermodel.OrderModelDO;
import com.cf.imes.module.executor.dal.dataobject.plate.PlateDO;
import com.cf.imes.module.executor.dal.dataobject.plate.PlateGoodDO;
import com.cf.imes.module.executor.dal.dataobject.rawgoods.RawGoodsDO;
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;
import com.cf.imes.module.executor.dal.mysql.orderItem.OrderItemMapper;
import com.cf.imes.module.executor.dal.mysql.orderModuleExtra.OrderModuleExtraMapper;
import com.cf.imes.module.executor.dal.mysql.orderParts.OrderPartsMapper;
import com.cf.imes.module.executor.dal.mysql.plate.PlateGoodMapper;
import com.cf.imes.module.executor.dal.mysql.plate.PlateMapper;
import com.cf.imes.module.executor.dal.mysql.rawgoods.RawGoodsMapper;
import com.cf.imes.module.executor.util.RandomUtils;
@@ -73,6 +77,12 @@ public class OrderInputProcessor {
@Resource
private OrderItemMapper orderItemMapper;
@Resource
private GoodsMapper goodsMapper;
@Resource
private PlateGoodMapper plateGoodMapper;
@Resource
private OrderModuleExtraMapper orderModuleExtraMapper;
@@ -298,10 +308,11 @@ public class OrderInputProcessor {
* @param itemDOS
*/
@Transactional
public void batchInsert(Collection<RawGoodsDO> rawGoodsDOS, Collection<OrderBodyDO> orderBodyDOS,
public Long batchInsert(Collection<RawGoodsDO> rawGoodsDOS, Collection<OrderBodyDO> orderBodyDOS,
Collection<OrderGroupDO> orderGroupDOS, Collection<OrderPartsDO> orderPartsDOS,
Collection<PlateDO> plateDOS, Collection<OrderModuleExtraDO> orderModuleExtraDOS,
Collection<OrderItemDO> itemDOS, OrderDO orderDO) {
Collection<OrderItemDO> itemDOS, OrderDO orderDO,
Collection<GoodsDO> goodsDOS, Collection<PlateGoodDO> plateGoodDOS) {
if (orderDO != null)
orderMapper.insert(orderDO);
@@ -330,11 +341,21 @@ public class OrderInputProcessor {
orderModuleExtraMapper.insertBatch(orderModuleExtraDOS.stream().skip(i).limit(1000).collect(Collectors.toList()));
}
}
if (itemDOS != null)
if (itemDOS != null) {
for (int i = 0; i < itemDOS.size(); i += 1000) {
orderItemMapper.insertBatch(itemDOS.stream().skip(i).limit(1000).collect(Collectors.toList()));
}
}
if (goodsDOS != null) {
for (int i = 0; i < itemDOS.size(); i += 1000) {
goodsMapper.insertBatch(goodsDOS.stream().skip(i).limit(1000).collect(Collectors.toList()));
}
}
if (plateGoodDOS != null) {
for (int i = 0; i < itemDOS.size(); i += 1000) {
plateGoodMapper.insertBatch(plateGoodDOS.stream().skip(i).limit(1000).collect(Collectors.toList()));
}
}
//rawGoodsMapper.insertBatch(rawGoodsDOS);
//orderBodyMapper.insertBatch(orderBodyDOS);
//orderGroupMapper.insertBatch(orderGroupDOS);
@@ -342,6 +363,7 @@ public class OrderInputProcessor {
//plateMapper.insertBatch(plateDOS);
//orderModuleExtraMapper.insertBatch(orderModuleExtraDOS);
//orderItemMapper.insertBatch(itemDOS);
return orderDO.getId();
}
/**
@@ -4,6 +4,8 @@ import javax.validation.*;
import com.cf.imes.module.executor.controller.admin.order.vo.order.*;
import com.cf.imes.module.executor.controller.admin.order.vo.product.OrderBodyRespVO;
import com.cf.imes.module.executor.controller.admin.orderParts.vo.OrderPartsRespVO;
import com.cf.imes.module.executor.controller.admin.plate.vo.PlateRespVO;
import com.cf.imes.module.executor.dal.dataobject.order.OrderDO;
import com.cf.imes.framework.common.pojo.PageResult;
import com.cf.imes.module.executor.dal.dataobject.orderBody.OrderBodyDO;
@@ -79,18 +81,27 @@ public interface OrderService {
/**
* @param orderId: 生产单Id
* @return Map<Long, List<OrderModuleRespVO>>
* @return Map<String, List<?>>
*/
List<OrderModuleRespVO> getModule(Long orderId);
Map<String,List<?>> getModule(Long orderId);
/**
* @param orderId: 生产单id
* @param roomId: 房间id
* @param bodyId: 柜体id
* @return List<ProductRespVO>
* @return List<OrderPlatesDetailReqVO>
* 需要修改返回值
*/
List<OrderModuleExtraDO> getModuleDetail(Long orderId, Long roomId , Long bodyId);
List<OrderPlatesDetailReqVO> getPlatesDetail(Long orderId, Long roomId , Long bodyId , Long groupId);
/**
* @param orderId: 生产单id
* @param roomId: 房间id
* @param bodyId: 柜体id
* @return List<OrderPartsRespVO>
* 需要修改返回值
*/
List<OrderPartsRespVO> getPartsDetail(Long orderId, Long roomId , Long bodyId);
/**
* 删除柜体
@@ -113,5 +124,5 @@ public interface OrderService {
* @author Administrator
* @date 2024/3/30
*/
Boolean importApiData(String orderNo);
Long importApiData(String orderNo);
}
@@ -1,14 +1,14 @@
package com.cf.imes.module.executor.service.order;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import cn.smallbun.screw.core.util.CollectionUtils;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.cf.imes.framework.mybatis.core.generator.SnowFlakeGenerator;
import com.baomidou.mybatisplus.core.incrementer.IdentifierGenerator;
import com.cf.imes.module.executor.controller.admin.order.vo.order.*;
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.order.vo.product.ProductRespVO;
import com.cf.imes.module.executor.controller.admin.orderParts.vo.OrderPartsRespVO;
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;
import com.cf.imes.module.executor.dal.dataobject.orderGroup.OrderGroupDO;
@@ -17,24 +17,20 @@ import com.cf.imes.module.executor.dal.dataobject.orderModuleExtra.OrderModuleEx
import com.cf.imes.module.executor.dal.dataobject.orderParts.OrderPartsDO;
import com.cf.imes.module.executor.dal.dataobject.ordermodel.OrderModelDO;
import com.cf.imes.module.executor.dal.dataobject.plate.PlateDO;
import com.cf.imes.module.executor.dal.dataobject.plate.PlateGoodDO;
import com.cf.imes.module.executor.dal.dataobject.rawgoods.RawGoodsDO;
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.orderItem.OrderItemMapper;
import com.cf.imes.module.executor.dal.mysql.orderModuleExtra.OrderModuleExtraMapper;
import com.cf.imes.module.executor.dal.mysql.orderParts.OrderPartsMapper;
import com.cf.imes.module.executor.dal.mysql.plate.PlateGoodMapper;
import com.cf.imes.module.executor.dal.mysql.plate.PlateMapper;
import com.cf.imes.module.executor.dal.mysql.rawgoods.RawGoodsMapper;
import com.cf.imes.module.executor.util.FileTypeChangeUtil;
import com.cf.imes.module.executor.util.deviseData.Detail;
import com.cf.imes.module.executor.util.deviseData.dataTwo.PlateDetail;
import com.cf.imes.module.executor.util.fileConversion.admin.api.webcad.ApiTypeChangeRealize;
import com.cf.imes.module.executor.util.fileConversion.admin.api.webcad.ApiTypeRealize;
import com.cf.imes.module.system.api.application.ApplicationApi;
import com.cf.imes.module.system.api.organ.OrganApi;
import com.cf.imes.module.system.api.user.AdminUserApi;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@@ -48,9 +44,6 @@ import com.cf.imes.framework.common.util.object.BeanUtils;
import com.cf.imes.module.executor.dal.mysql.order.OrderMapper;
import java.io.IOException;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.ZonedDateTime;
@@ -86,6 +79,9 @@ public class OrderServiceImpl implements OrderService {
@Resource
private PlateMapper plateMapper;
@Resource
private PlateGoodMapper plateGoodMapper;
@Resource
private OrderBodyMapper orderBodyMapper;
@@ -95,18 +91,12 @@ public class OrderServiceImpl implements OrderService {
@Resource
private OrderItemMapper orderItemMapper;
@Resource
private SnowFlakeGenerator snowFlakeGenerator;
@Resource
private AdminUserApi adminUserApi;
@Resource
private OrderModuleExtraMapper orderModuleExtraMapper;
@Resource
private ApiTypeChangeRealize apiTypeChangeRealize;
@Resource
private ApiTypeRealize apiTypeRealize;
@@ -119,6 +109,9 @@ public class OrderServiceImpl implements OrderService {
@Resource
private ApiOrderService apiOrderService;
@Resource
private IdentifierGenerator identifierGenerator;
private static final int DEFAULT_DAYS_TO_ADD = 30;
private static final int PARTS_PAGE_MAX = 1000;
@@ -198,20 +191,53 @@ public class OrderServiceImpl implements OrderService {
public List<OrderBodyRespVO> getOrderBody(Long orderId) {
// 校验存在
validateOrderExists(orderId);
List<OrderBodyRespVO> orderBodyRespVOList = BeanUtils.toBean(orderBodyMapper.selectList(new LambdaQueryWrapper<OrderBodyDO>().eq(OrderBodyDO::getOrderId, orderId)), OrderBodyRespVO.class);
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);
return orderBodyRespVOList;
}
@Override
public List<OrderModuleRespVO> getModule(Long orderId) {
public Map<String,List<?>> getModule(Long orderId) {
// 校验存在
validateOrderExists(orderId);
// 模块信息
List<OrderModuleRespVO> orderModuleRespVOList = orderBodyMapper.selectModuleByOrderId(orderId); // 模块信息
// 配件
List<OrderPlatesDetailRespVO> orderItemDOS = orderItemMapper.selectPartsByOrderId(orderId);
return null;
Map<String,List<?>> map = new HashMap<>();
map.put("module",orderModuleRespVOList);
map.put("parts",orderItemDOS);
return map;
}
@Override
public List<OrderModuleExtraDO> getModuleDetail(Long orderId, Long roomId, Long bodyId) {
List<OrderModuleExtraDO> orderModuleExtraDOS = orderModuleExtraMapper.selectExtraById(orderId, roomId, bodyId);
return orderModuleExtraDOS;
public List<OrderPlatesDetailReqVO> getPlatesDetail(Long orderId, Long roomId, Long bodyId, Long groupId) {
List<PlateRespVO> orderDetail = orderItemMapper.selectPlatesDetailByOrderId(orderId, roomId, bodyId, groupId);
List<OrderPlatesDetailReqVO> platesDetailReqVOS = new ArrayList<>();
orderDetail.forEach(orderPlatesDetailRespVO -> {
OrderPlatesDetailReqVO orderPlatesDetailReqVO = BeanUtils.toBean(orderPlatesDetailRespVO, OrderPlatesDetailReqVO.class)
.setIsHole(false);
if (orderPlatesDetailRespVO.getUnregularPointCount()>0 || orderPlatesDetailRespVO.getFrontHoleCount()>0
|| orderPlatesDetailRespVO.getBackHoleCount()>0 || orderPlatesDetailRespVO.getSideHoleCount()>0)
orderPlatesDetailReqVO.setIsHole(true);
platesDetailReqVOS.add(orderPlatesDetailReqVO);
});
return platesDetailReqVOS;
}
@Override
public List<OrderPartsRespVO> getPartsDetail(Long orderId, Long roomId, Long bodyId) {
List<OrderPartsRespVO> orderDetail = orderItemMapper.selectPartsDetailByOrderId(orderId, roomId, bodyId);
return orderDetail;
}
@Override
@@ -237,7 +263,7 @@ public class OrderServiceImpl implements OrderService {
}
@Override
public Boolean importApiData(String orderNo) {
public Long importApiData(String orderNo) {
// 获取token
Long organId = SecurityFrameworkUtils.getLoginUser().getOrganId();
JSONObject app = applicationApi.getApplicationByOrganId(organId);
@@ -329,7 +355,7 @@ public class OrderServiceImpl implements OrderService {
// + " dataGoods " + dataGoods+ "\n"
// + " plate " + plate+ "\n"
// + " dataModule " + dataModule);
Map<String, List<?>> listMap = apiTypeRealize.apiPlateDataChange(
Map<String, List<?>> listMap = apiTypeRealize.apiPlateDataChange(
dataPlates.getJSONObject("value"),//板件生产信息
dataParts,// 配件信息
dataBody, // 柜体信息
@@ -346,10 +372,36 @@ public class OrderServiceImpl implements OrderService {
List<PlateDetail> plateDetail = (List<PlateDetail>) listMap.get("plateDetail");
List<OrderItemDO> itemDO = (List<OrderItemDO>) listMap.get("itemDO");
orderInputProcessor.batchInsert(rawGoodsDO, bodyDO, groupDO, partsDO, plateDO, null, itemDO, order.get(0));
System.out.println(BeanUtils.toBean(plateDetail, OrderModelDO.class));
Map<String, List<?>> map = getPlateGoods(goodsDO);
goodsDO = (List<GoodsDO>) map.get("goodsDO");
List<PlateGoodDO> plateGoodDOS = (List<PlateGoodDO>) map.get("plateGoodDOLists");
orderInputProcessor.batchInsert(rawGoodsDO, bodyDO, groupDO, partsDO, plateDO, null, itemDO, order.get(0),goodsDO,plateGoodDOS);
orderInputProcessor.batchSaveModel(BeanUtils.toBean(plateDetail, OrderModelDO.class));
return null;
return order.get(0).getId();
}
private Map<String, List<?>> getPlateGoods(List<GoodsDO> goodsLists) {
Map<String, List<?>> map = new HashMap<>();
List<PlateGoodDO> plateGoodLists = new ArrayList<>();
for (GoodsDO goodsDO : goodsLists) {
if (goodsDO.getGoodsId() != null){ // 有goodsId
PlateGoodDO plateGoodDO = plateGoodMapper.selectOne(PlateGoodDO::getGoodsId, goodsDO.getGoodsId());
if (plateGoodDO != null) {//存在
goodsDO.setGoodsId(plateGoodDO.getId());
}
}
Long plateGoods = (Long) identifierGenerator.nextId(null);
PlateGoodDO plateGoodDO = BeanUtils.toBean(goodsDO, PlateGoodDO.class)
.setId(plateGoods)
.setGoodsId(String.valueOf(goodsDO.getGoodsId()));
goodsDO.setGoodsId(plateGoodDO.getId());
plateGoodLists.add(plateGoodDO);
}
map.put("goodsDO", goodsLists);
map.put("plateGoodDOLists", plateGoodLists);
return map;
}
// 合并两个 JSON 对象的方法
@@ -366,32 +418,12 @@ public class OrderServiceImpl implements OrderService {
}
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);
}
}
// 对数据进行分类
private HashMap<String, List<Detail>> classifyGoods(List<Detail> list) {
HashMap<String, List<Detail>> map = new HashMap<>();
List<Detail> plateLists = new ArrayList<>();
List<Detail> partsLists = new ArrayList<>();
for (Detail detail : list) {
//判断是板材还是配件
if (detail.getIBoardProdInfo().getGoodType() == 1) {
plateLists.add(detail);
} else {
partsLists.add(detail);
}
// detail.getIBoardProdInfo().setRemark(orderPlateImportExcelVO.remarkJSON());
}
map.put("plate", plateLists);
map.put("parts", partsLists);
return map;
}
private LocalDateTime getAfterDate(LocalDateTime date) {
// 获取当前日期类型 2024-03-06 16:50:15
// 获取当前日期,明确指定时区为业务所在时区,例如Asia/Shanghai
@@ -1,24 +0,0 @@
package com.cf.imes.module.executor.util.deviseData;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 加工组信息
*/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class group
{
private String name;
private Double width;
private Double height;
private Double depth;
}
@@ -1,664 +0,0 @@
package com.cf.imes.module.executor.util.fileConversion.admin.api.webcad;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.incrementer.IdentifierGenerator;
import com.cf.imes.module.executor.dal.dataobject.goods.GoodsDO;
import com.cf.imes.module.executor.dal.dataobject.order.OrderDO;
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.rawgoods.RawGoodsDO;
import com.cf.imes.module.executor.util.deviseData.dataTwo.*;
import com.cf.imes.module.system.api.dict.DictDataApi;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* 实现数据格式转换
*/
@Slf4j
@Component
public class ApiTypeChangeRealize {
@Resource
private IdentifierGenerator identifierGenerator;
@Resource
private DictDataApi dictDataApi;
public Map<Long, List<?>> apiPlateDataChange(JSONObject dataPlates, JSONObject dataParts
, JSONObject dataBody, JSONObject dataGoods
, JSONObject plates, JSONObject dataModule) {
// 上产单id
Long orderId = (Long) identifierGenerator.nextId(null);
Map<Long, List<?>> map = new HashMap<>();
// raw商品数据获取
Map<String, Map<Integer, ?>> rawGoodsMap = rawGoodsInfoChange(dataGoods, orderId); //数据完整
// 获取柜体数据转换
Map<Integer, OrderBodyDO> orderBodyDOMap = bodyInfoChange(dataBody, orderId); // 缺少数量
// 板材数据转换
List<PlateDetail> plateDetails = new ArrayList<>();
// 获取 Orders 字段对应的数组
JSONArray ordersArray = dataPlates.getJSONArray("Orders");
// 如果 Orders 数组不为空,则获取第一个订单对象
Map<OrderDO, Map<String, List<?>>> goodsMap = new HashMap<>();
if (ordersArray != null && !ordersArray.isEmpty()) {
for (int i = 0; i < ordersArray.size(); i++) {
// Map<String,List<?>> orderMap = new HashMap<>();
JSONObject order = ordersArray.getJSONObject(i);
// 生产单信息
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
LocalDate orderDate = LocalDate.parse(order.getString("SaleDate"), formatter);
LocalDate deliveryDate = LocalDate.parse(order.getString("DeliveryDate"), formatter);
OrderDO orderDO = OrderDO.builder()
.id(orderId)
.orderDate(orderDate.atStartOfDay())
.dataType(2)
.customOrderNo(order.getString("CustomOrderNo"))
.deliveryDate(deliveryDate.atStartOfDay())
.dealer(order.getString("CustomName"))
.salesman(order.getString("salesman"))
.customer(order.getString("Consigee"))
.phoneNumber(order.getString("ConsigeePhone"))
.address(order.getString("ConsigeeAddress"))
.remark(order.getString("Remark"))
.build();
// 获取材料信息
if (order.getJSONArray("Materials") != null && !order.getJSONArray("Materials").isEmpty()) {
List<GoodsDO> goodsDOS = new ArrayList<>();
for (int j = 0; j < order.getJSONArray("Materials").size(); j++) {
JSONObject material = order.getJSONArray("Materials").getJSONObject(j);
Long goodsId = (Long) identifierGenerator.nextId(null);
GoodsDO goodsDO = GoodsDO.builder()
.id(goodsId)
.orderId(orderId)
.goodsId(Long.valueOf(material.getString("GoodsID")))
.goodsName(material.getString("Name"))
.material(material.getString("Material"))
.color(material.getString("Color"))
.width(BigDecimal.valueOf(material.getDouble("Width")))
.height(BigDecimal.valueOf(material.getDouble("Length")))
.thickness(BigDecimal.valueOf(material.getDouble("Thickness")))
.brand(material.getString("Brand"))
.spec(material.getString("Specification"))
.build();
goodsDOS.add(goodsDO);
// 板件信息
if (material.getJSONArray("Blocks") != null && !material.getJSONArray("Blocks").isEmpty()) {
List<PlateDO> orderPartsDOS = new ArrayList<>();
for (int k = 0; k < material.getJSONArray("Blocks").size(); k++) {
JSONObject block = material.getJSONArray("Blocks").getJSONObject(k);// 每块板
Long plateId = (Long) identifierGenerator.nextId(null);
// 字典转换板类型
Integer type = Integer.valueOf(dictDataApi.parseDictData("order_plate_type",
block.getJSONObject("ExtraRemark").getJSONObject("extra").getString("boardType"))
.getData().getValue());
PlateDO orderPartsDO = PlateDO.builder()
.id(plateId)
.goodsId(Long.valueOf(goodsId))
.orderId(orderId)
.name(block.getString("BlockName"))
.plateNo(block.getString("CustomNo"))
.type(type)
.width(BigDecimal.valueOf(block.getDouble("Width")))
.height(BigDecimal.valueOf(block.getDouble("Length")))
.thickness(BigDecimal.valueOf(0))
.splitWidth(BigDecimal.valueOf(block.getDouble("CuttingWidth")))
.splitHeight(BigDecimal.valueOf(block.getDouble("CuttingLength")))
.splitThickness(BigDecimal.valueOf(0))
.sealLeft(BigDecimal.valueOf(block.getDouble("BorderLeft")))
.sealRight(BigDecimal.valueOf(block.getDouble("BorderRight")))
.sealUp(BigDecimal.valueOf(block.getDouble("BorderUpper")))
.sealDown(BigDecimal.valueOf(block.getDouble("BorderUnder")))
.area(BigDecimal.valueOf(block.getDouble("Size")))
.texture(0)
.holeFace(0)
.holeArrange(0)
.unregularPointCount(0)
.frontHoleCount(0)
.frontModelCount(0)
.backHoleCount(0)
.sideHoleCount(0)
.backModelCount(0)
.isDoor(block.getInteger("OpenDoorType") == 0 ? false : true)
.openDoorType(block.getInteger("OpenDoorType"))
.offsetX(block.getBigDecimal("OffsetX"))
.offsetY(block.getBigDecimal("OffsetY"))
.isArcAcross(false)
.moduleTypeId(0L)
.isSpecialShaped(false)
.isCancel(false)
.filterType(0)
.remark(remarkToMap(block).toString())
.isCancel(false)
.build();
PlateDetail plateDetail = PlateDetail.builder()
.bodyNo(block.getString("BoxNo"))
.plateNo(block.getString("BlockNo"))
.name(block.getString("BlockName"))
.customPlateNo(block.getString("CustomNo"))
.roomsName(block.getString("RoomName"))
.bodyName(block.getString("BoxName"))
.group(block.getString("ProcessGroupName"))
.multiNum(1)
// .groupList(getProcessGroup(block))
.plateWidth(block.getBigDecimal("Width"))
.plateLength(block.getBigDecimal("Length"))
.acreage(block.getBigDecimal("Size"))
.splitWidth(block.getBigDecimal("CuttingWidth"))
.splitLength(block.getBigDecimal("CuttingLength"))
.sealAcreage(block.getBigDecimal("CuttingSize"))
.isUnRegular(block.getBoolean("IsUnRegular"))
.sealLeft(block.getBigDecimal("BorderLeft"))
.sealRight(block.getBigDecimal("BorderRight"))
.sealUp(block.getBigDecimal("BorderUpper"))
.sealDown(block.getBigDecimal("BorderUnder"))
.texture(block.getInteger("Wave"))
.typographicFace(Integer.valueOf(block.getString("PlaceFace")))
.openDoorType(Integer.valueOf(block.getString("OpenDoorType")))
.offsetX(block.getBigDecimal("OffsetX"))
.offsetY(block.getBigDecimal("OffsetY"))
.pointDetail(getPointDetail(block, 1))
.rawPointDetail(getPointDetail(block, 3))
.holeDetail(getHoleDetail(block, 1))
.sideHoleDetail(getHoleDetail(block, 3))
.contourDetail(getModelDetail(block))
// 排钻类型
.drillsInfos(getDrillsInfo(block))
.boardType(block.getJSONObject("ExtraRemark").getJSONObject("extra").getString("boardType"))
.throughHoleCount(Double.valueOf(block.getJSONObject("ExtraRemark").getJSONObject("extra").getString("throughHoleCount")))
.throughModelCount(Double.valueOf(block.getJSONObject("ExtraRemark").getJSONObject("extra").getString("throughModelCount")))
.has2DModel(Boolean.valueOf(block.getJSONObject("ExtraRemark").getJSONObject("extra").getString("has2DModel")))
.has3DModel(Boolean.valueOf(block.getJSONObject("ExtraRemark").getJSONObject("extra").getString("has3DModel")))
.remark(remarkToMap(block))
.sideRemark(edgeRemarkToMap(block.getJSONObject("ExtraRemark").getJSONObject("extra")))
.build();
plateDetails.add(plateDetail);
System.out.println("plateDetail " + plateDetail);
}
}
}
}
System.out.println("板块 " + plateDetails.size());
}
} else {
System.out.println("JSON 数据中没有订单信息(Orders 数组为空)。");
}
return map;
}
/**
* 生产单信息转换
*
* @param dataPlates:
* @return OrderDO
* @author Administrator
* @date 2024/4/30
*/
public OrderDO orderInfoChange(JSONObject dataPlates, Long orderId) {
List<PlateDetail> plateDetails = new ArrayList<>();
// 获取 Orders 字段对应的数组
JSONObject order = dataPlates.getJSONObject("Orders");
// 如果 Orders 数组不为空,则获取第一个订单对象
if (order != null && !order.isEmpty()) {
// 获取生产单信息
// 使用 DateTimeFormatter 解析日期字符串
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
LocalDate orderDate = LocalDate.parse(order.getString("SaleDate"), formatter);
LocalDate deliveryDate = LocalDate.parse(order.getString("DeliveryDate"), formatter);
OrderDO orderDO = OrderDO.builder()
.id(orderId)
.parentNo(0L)
.orderDate(orderDate.atStartOfDay())
.deliveryDate(deliveryDate.atStartOfDay())
.orderType(1)
.orderSort(0)
.dataType(2)
.status(0)
.customOrderNo(order.getString("CustomOrderNo"))
.customer(order.getString("Consigee"))
.address(order.getString("ConsigeeAddress"))
.phoneNumber(order.getString("ConsigeePhone"))
.dealer(order.getString("CustomName"))
.dealerPhoneNumber("")
.salesman(order.getString("SalePerson"))
.splitter("")
.remark(order.getString("Remark"))
.build();
return orderDO;
}
return null;
}
/**
* raw商品信息转换 和 商品信息转换
*
* @param dataRawGoods:
* @param orderId:
* @return Map<String, Map < Integer, ?>> String 标识 Integer:商品ID标识,RawGoodsDO:商品信息
* @author Administrator
* @date 2024/4/30
*/
public Map<String, Map<Integer, ?>> rawGoodsInfoChange(JSONObject dataRawGoods, Long orderId) {
Map<String, Map<Integer, ?>> map = new HashMap<>();
Map<Integer, RawGoodsDO> rawGoodsDOS = new HashMap<>();
Map<Integer, GoodsDO> goodsDOS = new HashMap<>();
dataRawGoods.getJSONArray("List").forEach(item -> {
JSONObject parts = (JSONObject) item;
RawGoodsDO rawGoodsDO = RawGoodsDO.builder()
.id((Long) identifierGenerator.nextId(null))
.orderId(orderId)
.rawGoodsId(String.valueOf(parts.getLong("GoodsID")))
.goodsName(parts.getString("GoodsName"))
.material(parts.getString("Material"))
.color(parts.getString("Color"))
.thickness(parts.getDouble("Thickness"))
.price(parts.getDouble("Price"))
.brand(parts.getString("Brand"))
.spec(parts.getString("Spec"))
.build();
rawGoodsDOS.put(parts.getInteger("GoodsID"), rawGoodsDO);
GoodsDO goodsDO = GoodsDO.builder()
.id((Long) identifierGenerator.nextId(null))
.orderId(orderId)
.rawGoodsId(rawGoodsDO.getId())
.goodsId(parts.getLong("GoodsID"))
.goodsName(parts.getString("GoodsName"))
.material(parts.getString("Material"))
.color(parts.getString("Color"))
.width(BigDecimal.valueOf(parts.getDouble("Width")))
.height(BigDecimal.valueOf(parts.getDouble("Height")))
.thickness(BigDecimal.valueOf(parts.getDouble("Thickness")))
.price(BigDecimal.valueOf(parts.getDouble("Price")))
.brand(parts.getString("Brand"))
.spec(parts.getString("Spec"))
.build();
goodsDOS.put(parts.getInteger("GoodsID"), goodsDO);
});
map.put("rawGoodsDOS", rawGoodsDOS);
map.put("goodsDOS", goodsDOS);
return map;
}
/**
* 柜体信息转换
*
* @param dataBody:
* @return Map<Integer, OrderBodyDO> Integer:柜体ID标识,OrderBodyDO:柜体信息(差数据)
* @author Administrator
* @date 2024/4/30
*/
private Map<Integer, OrderBodyDO> bodyInfoChange(JSONObject dataBody, Long orderId) {
Map<Integer, OrderBodyDO> bodyInfos = new HashMap<>();
dataBody.getJSONArray("List").forEach(item -> {
JSONObject body = (JSONObject) item;
OrderBodyDO bodyInfo = OrderBodyDO.builder()
.id(Long.valueOf(body.getString("BoxID")))// 差一个BoxID,没有对应的
.orderId(orderId)
.roomId(Long.valueOf(body.getString("RoomID")))
.roomName(body.getString("Room"))
.name(body.getString("Name"))
.width(body.getDouble("Width"))
.height(body.getDouble("Height"))
.depth(body.getDouble("Depth"))
.multiNum(0)
.plateNum(0)
.unregularNum(0)
.filename("")
.remark("")
.build();
bodyInfos.put(body.getInteger("BoxID"), bodyInfo);
});
return bodyInfos;
}
/**
* 加工组信息转换
*
* @param dataGroup: JSON 数据
* @param orderId:
* @param body: 柜体信息
* @return Map<Integer, List < Map < OrderGroupDO, List < Integer>>>> Integer 柜体id , List<Map<OrderGroupDO,List<Integer>>> 相同柜体的加工组信息
* OrderGroupDO:加工组信息 , List<Integer>:加工组中包含的板材配件信息
* (差数据)
* @author Administrator
* @date 2024/4/30
*/
private Map<Long, List<Map<OrderGroupDO, List<Integer>>>> groupInfoChange(JSONObject dataGroup, Long orderId
, Map<Integer, OrderBodyDO> body) {
Map<Long, List<Map<OrderGroupDO, List<Integer>>>> groupInfosAndBodyId = new HashMap<>();
List<Map<OrderGroupDO, List<Integer>>> groupInfosAndItemList = new ArrayList<>();
Map<OrderGroupDO, List<Integer>> groupInfos = new HashMap<>();
dataGroup.getJSONArray("value").forEach(value -> {
JSONObject group = (JSONObject) value;
OrderGroupDO bodyInfo = OrderGroupDO.builder()
.id((Long) identifierGenerator.nextId(null))// 自动生成
.orderId(orderId)
.bodyId(0L)
.groupTypeId(Long.valueOf(group.getInteger("ModuleTypeID")))
.groupTypeName("")
.name(group.getString("ModuleTypeName"))
.width(group.getDouble("Width"))
.height(group.getDouble("Length"))
.depth(group.getDouble("Thickness"))
.multiNum(0)
.plateNum(0)
.unregularNum(0)
.filename("")
.remark("")
.build();
if (body.get(group.getInteger("BoxID")) != null) {
bodyInfo.setBodyId(body.get(group.getInteger("BoxID")).getId());
} else {
bodyInfo.setBodyId(-0L);
}
groupInfos.put(bodyInfo, jsonArrayToList(group.getJSONArray("ItemIDList")));
});
// 遍历groupInfos,以OrderGroupDO中的bodyId为key,将groupInfosAndItemList中的value添加到groupInfosAndBodyId中
// 遍历 groupInfos
groupInfos.forEach((groupInfo, itemList) -> {
// 获取当前分组信息的 bodyId
Long bodyId = groupInfo.getBodyId();
// 如果 groupInfosAndBodyId 中已经存在该 bodyId,则获取对应的项目列表,否则创建一个新的列表
List<Map<OrderGroupDO, List<Integer>>> existingItemList = groupInfosAndBodyId.getOrDefault(bodyId, new ArrayList<>());
// 创建包含当前分组信息及项目列表的 Map
Map<OrderGroupDO, List<Integer>> infoAndItemList = new HashMap<>();
infoAndItemList.put(groupInfo, itemList);
// 将当前的分组信息及项目列表添加到列表中
existingItemList.add(infoAndItemList);
// 更新 groupInfosAndBodyId 中的映射关系
groupInfosAndBodyId.put(bodyId, existingItemList);// 有问题
});
return groupInfosAndBodyId;
}
/**
* JSONArray转List<Integer>
*/
public List<Integer> jsonArrayToList(JSONArray jsonArray) {
List<Integer> list = new ArrayList<>();
for (int i = 0; i < jsonArray.size(); i++) {
list.add(jsonArray.getInteger(i));
}
return list;
}
/**
* 配件信息转存
*
* @param value: JSON数据
* @param orderId:
* @param group: 加工组信息
* @return List<PartsInfo>
* @author Administrator
* @date 2024/4/30
*/
public List<PartsInfo> partsInfoChange(JSONObject value, Long orderId, Map<OrderGroupDO, List<Integer>> group) {
List<PartsInfo> partsInfos = new ArrayList<>();
if (value != null && !value.isEmpty()) {
JSONArray partsLists = value.getJSONArray("List");
for (int i = 0; i < partsLists.size(); i++) {
JSONObject parts = partsLists.getJSONObject(i);
PartsInfo partsInfo = PartsInfo.builder()
.id(parts.getString("DataID"))
.name(parts.getString("Name"))
.roomName(parts.getString("RoomName"))
.bodyName(parts.getString("BoxName"))
.bodyNo(parts.getInteger("BoxID"))
.multiNum(Integer.valueOf(parts.getString("MultiNum")))
.goodsNo(parts.getString("GoodsNo"))
.goodId(Long.valueOf(parts.getString("GoodsID")))
.material(parts.getString("material"))
.color(parts.getString("color"))
.factory(parts.getString("Factory"))
.brand(parts.getString("Brand"))
.model(parts.getString("Model"))
.unit(parts.getString("Units"))
.price(parts.getDouble("Price"))
.isComposite(Boolean.valueOf(parts.getString("IsComposite")))
.groupName(parts.getString("GroupName"))
.objectType(parts.getString("ObjectType"))
.objectSpecExtras(parts.getString("SpecExtras"))
.goodsNumber(Double.valueOf(parts.getString("GoodsNumber")))
.doorRemark(parts.getString("DoorRemark"))
.hingeRemark(parts.getString("HingeRemark"))
.specialRemark(parts.getString("SpecialRemark"))
.remark(parts.getString("Remark"))
.processGroup(parts.getString("ProcessGroup"))
.build();
partsInfos.add(partsInfo);
}
}
// 配件信息转换成 柜体id,配件信息
Map<Integer, List<PartsInfo>> partsInfoMap = partsInfos.stream().collect(Collectors.groupingBy(PartsInfo::getBodyNo));
System.out.println(" partsInfos " + partsInfos);
return partsInfos;
}
// 异形板的开料轮廓 (type 为1,不含封边;其他为,含封边)
private List<PointDetail> getPointDetail(JSONObject block, Integer type) {
List<PointDetail> pointDetailList = new ArrayList<>();
if (type == 1) { // 不含封边
if (block.getJSONArray("Points") != null && !block.getJSONArray("Points").isEmpty()) {
for (int i = 0; i < block.getJSONArray("Points").size(); i++) {
JSONObject point = block.getJSONArray("Points").getJSONObject(i);
pointDetailList.add(PointDetail.builder()
.pointX(Double.valueOf(point.getString("X")))
.pointY(Double.valueOf(point.getString("Y")))
.curve(Double.valueOf(point.getString("Curve")))
.build());
}
}
} else { // 含封边
if (block.getJSONArray("OrgPoints") != null && !block.getJSONArray("OrgPoints").isEmpty()) {
for (int i = 0; i < block.getJSONArray("OrgPoints").size(); i++) {
JSONObject rawPoint = block.getJSONArray("OrgPoints").getJSONObject(i);
pointDetailList.add(PointDetail.builder()
.pointX(Double.valueOf(rawPoint.getString("X")))
.pointY(Double.valueOf(rawPoint.getString("Y")))
.curve(Double.valueOf(rawPoint.getString("Curve")))
.sealSize(Double.valueOf(rawPoint.getString("Edge")))
.build());
}
}
}
return pointDetailList;
}
// 孔明细板数据解析 (type 为1,正面;3,侧面)
private List<HoleDetail> getHoleDetail(JSONObject block, Integer type) {
List<HoleDetail> holeDetails = new ArrayList<>();
if (type == 1) { // 1,正面
if (block.getJSONArray("Holes") != null && !block.getJSONArray("Holes").isEmpty()) {
for (int i = 0; i < block.getJSONArray("Holes").size(); i++) {
JSONObject hole = block.getJSONArray("Holes").getJSONObject(i);
holeDetails.add(HoleDetail.builder()
.startX(Double.valueOf(hole.getString("X")))
.startY(Double.valueOf(hole.getString("Y")))
.faceType(1)
.radius(Double.valueOf(hole.getString("Diameter")) / 2)
.depth(Double.valueOf(hole.getString("Depth")))
.build());
}
}
} else {
if (block.getJSONArray("SideHoles") != null && !block.getJSONArray("SideHoles").isEmpty()) {
for (int i = 0; i < block.getJSONArray("SideHoles").size(); i++) {
JSONObject hole = block.getJSONArray("SideHoles").getJSONObject(i);
String[] startPoints = splitAndTrim(hole.getString("StartPoint"));
String[] endPoints = splitAndTrim(hole.getString("EndPoint"));
try {
holeDetails.add(HoleDetail.builder()
.startX(Double.valueOf(startPoints[0]))
.startY(Double.valueOf(startPoints[1]))
.startZ(Double.valueOf(startPoints[2]))
.endX(Double.valueOf(endPoints[0]))
.endY(Double.valueOf(endPoints[1]))
.endZ(Double.valueOf(endPoints[2]))
.faceType(3)
.radius(Double.valueOf(hole.getString("Diameter")) / 2)
.depth(Double.valueOf(hole.getString("Depth")))
.build());
} catch (Exception e) {
System.out.println("HoleDetail " + hole);
}
}
}
}
return holeDetails;
}
// 造型明细板数据解析 (type 为1,正面;3,侧面)
private List<ModelDetail> getModelDetail(JSONObject block) {
List<ModelDetail> modelDetails = new ArrayList<>();
if (block.getJSONArray("Models") != null && !block.getJSONArray("Models").isEmpty()) {
for (int i = 0; i < block.getJSONArray("Models").size(); i++) {
JSONObject model = block.getJSONArray("Models").getJSONObject(i);
List<PointList> pointLists = new ArrayList<>();
if (model.getJSONArray("Points") != null && !model.getJSONArray("Points").isEmpty()) {
for (int j = 0; j < model.getJSONArray("Points").size(); j++) {
JSONObject point = model.getJSONArray("Points").getJSONObject(j);
String[] points = splitAndTrim(point.getString("Pos"));
pointLists.add(PointList.builder()
.pointX(Double.valueOf(points[0]))
.pointY(Double.valueOf(points[1]))
.pointZ(Double.valueOf(points[2]))
.curve(Double.valueOf(point.getString("Curve")))
.build());
}
}
List<OffSetList> offSetLists = new ArrayList<>();
if (model.getJSONArray("OffsetList") != null && !model.getJSONArray("OffsetList").isEmpty()) {
for (int j = 0; j < model.getJSONArray("OffsetList").size(); j++) {
JSONObject offSet = model.getJSONArray("OffsetList").getJSONObject(j);
offSetLists.add(OffSetList.builder()
.value(Double.valueOf(offSet.getString("Value")))
.name(offSet.getString("Name"))
.radius(Double.valueOf(offSet.getString("Diameter")) / 2)
.angle(Double.valueOf(offSet.getString("Angle")))
.depth(Double.valueOf(offSet.getString("Depth")))
.build());
}
}
modelDetails.add(ModelDetail.builder()
.depth(Double.valueOf(model.getString("Depth")))
.faceType(Integer.valueOf(model.getString("Face")))
.knifeName(model.getString("TooINo"))
.knifeRadius(Double.valueOf(model.getString("Diameter")) / 2)
.pointList(pointLists)
.offSetList(offSetLists)
.build());
}
}
return modelDetails;
}
// 排钻数据
private List<DrillsInfo> getDrillsInfo(JSONObject block) {
List<DrillsInfo> drillsInfos = new ArrayList<>();
if (block.getJSONArray("drills") != null && !block.getJSONArray("drills").isEmpty()) {
for (int i = 0; i < block.getJSONArray("drills").size(); i++) {
JSONObject drill = block.getJSONArray("drills").getJSONObject(i);
drillsInfos.add(DrillsInfo.builder()
.name(drill.getString("name"))
.type(drill.getString("type"))
.face(drill.getString("face"))
.count(Double.valueOf(drill.getString("count")))
.build());
}
}
return drillsInfos;
}
// String[] 以逗号分割,去空格
public String[] splitAndTrim(String str) {
String[] strs = str.split(",");
for (int i = 0; i < strs.length; i++) {
strs[i] = strs[i].trim();
}
return strs;
}
// 将remark转为map
public Map<String, String> remarkToMap(JSONObject block) {
Map<String, String> map = new HashMap<>();
for (int i = 0; i < 4; i++) {
if (block.getString("remark" + i) != null && !block.getString("remark" + i).isEmpty()) {
map.put("remark" + i, block.getString("remark" + i));
}
}
return map;
}
// 将remark转为map
public Map<String, String> edgeRemarkToMap(JSONObject edgeRemark) {
Map<String, String> map = new HashMap<>();
if (edgeRemark.getJSONArray("edgeRemarks") != null && !edgeRemark.getJSONArray("edgeRemarks").isEmpty()) {
for (int i = 0; i < edgeRemark.getJSONArray("edgeRemarks").size(); i++) {
if (edgeRemark.getJSONArray("edgeRemarks").getString(i) != null && !edgeRemark.getJSONArray("edgeRemarks").getString(i).isEmpty()) {
map.put(String.valueOf(i), edgeRemark.getJSONArray("edgeRemarks").getString(i));
}
}
}
return map;
}
}
@@ -21,8 +21,6 @@ import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.concurrent.atomic.AtomicReference;
import java.util.function.BiConsumer;
import java.util.stream.Collectors;
/**
@@ -39,6 +37,9 @@ public class ApiTypeRealize {
@Resource
private DictDataApi dictDataApi;
private Integer num = 0;
private Integer groupNum = 0;
/**
* @param dataPlates: 板件生产信息
* @param dataParts: 配件信息
@@ -127,28 +128,20 @@ public class ApiTypeRealize {
Map<Integer, List<Integer>> groupLists, Map<Integer, OrderItemDO> partsItems) {
groupLists.forEach((k, v) -> {
AtomicReference<Integer> groupNum = new AtomicReference<>(0);
v.forEach(v1 -> {
if (partsItems.get(v1) != null) {
partsItems.get(v1).setGroupId(orderGroupDO.get(k).getId());
groupNum.getAndSet(groupNum.get() + 1);
if (partsItems.get(v1).getPlateId() != null)
groupNum++;
}
});
orderGroupDO.get(k).setPlateNum(groupNum.get());
orderGroupDO.get(k).setPlateNum(groupNum);
groupNum = 0;
});
// partsItems.forEach((k, v) -> {
// if (bodyInfoChange.get(Integer.parseInt(String.valueOf(v.getBodyId()))) != null) {
// v.setRoomId(bodyInfoChange.get(Integer.parseInt(String.valueOf(v.getBodyId()))).getRoomId());
// }
// });
return partsItems;
}
/**
* 柜体,加工组板材数量添加 !!!!!!!!!!!!!!
*/
/**
* 加工组 信息转换
*/
@@ -407,9 +400,8 @@ public class ApiTypeRealize {
return map;
}
private Integer num = 0;
/**
* 板材信息转换 写表 Integer指板材的ItemID板id 还没有存备注!!!!!!!!!!!!!!!!!!!!
* 板材信息转换 写表 Integer指板材的ItemID板id 还没有存备注!!!!!!!!!!!!!!!!!!!! 加一个板材自定义编号
*/
private Map<String, Map<Integer, ?>> platesInfoChange(JSONObject value, JSONObject dataPlates, Long orderId, Map<Integer, GoodsDO> goodsDOMap, Map<Integer, OrderBodyDO> bodyInfos) {
// 板材 写ES
@@ -509,6 +501,7 @@ public class ApiTypeRealize {
m.setPlateNum(num);
}
});
num =0;
});
System.err.println(bodyInfos);
map.put("platesInfos", platesInfos);
@@ -31,6 +31,7 @@ public final class ExcelListener<T> extends AnalysisEventListener<OrderPlateImpo
public void invoke(OrderPlateImportExcelVO data, AnalysisContext context) {
// 根据列来确定是那一条的数据,然后将错误的数据插入其中
// 这里要判断数据的合法性,不合法的数据直接插入到错误数据中
System.err.println(data);
if (data.getGoodType() == 0) {
data.setResult("商品类型未选择");
flag = false;
@@ -67,17 +68,17 @@ public final class ExcelListener<T> extends AnalysisEventListener<OrderPlateImpo
* @param context
* @throws Exception
*/
@Override
public void onException(Exception exception, AnalysisContext context) {
this.flag = false;
if (exception instanceof ExcelDataConvertException) {
ExcelDataConvertException excelDataConvertException = (ExcelDataConvertException) exception;
log.error("第{}行,第{}列解析异常,数据为:{}", excelDataConvertException.getRowIndex() + 1,
excelDataConvertException.getColumnIndex() + 1, excelDataConvertException.getCellData());
valueMap.put(excelDataConvertException.getRowIndex() + 1 , String.valueOf(new RuntimeException("" + (excelDataConvertException.getRowIndex() + 1) + "" +
",第" + (excelDataConvertException.getColumnIndex() + 1) + "列数据格式有误,读取失败")));
}
}
// @Override
// public void onException(Exception exception, AnalysisContext context) {
// this.flag = false;
// if (exception instanceof ExcelDataConvertException) {
// ExcelDataConvertException excelDataConvertException = (ExcelDataConvertException) exception;
// log.error("第{}行,第{}列解析异常,数据为:{}", excelDataConvertException.getRowIndex() + 1,
// excelDataConvertException.getColumnIndex() + 1, excelDataConvertException.getCellData());
// valueMap.put(excelDataConvertException.getRowIndex() + 1 , String.valueOf(new RuntimeException("第" + (excelDataConvertException.getRowIndex() + 1) + "行" +
// ",第" + (excelDataConvertException.getColumnIndex() + 1) + "列数据格式有误,读取失败")));
// }
// }
/**
* 返回数据
@@ -1,5 +1,6 @@
package com.cf.imes.module.executor.util.fileConversion.admin.files.excel;
import com.alibaba.excel.EasyExcel;
import com.cf.imes.framework.common.util.object.BeanUtils;
import com.cf.imes.module.executor.util.FileTypeChangeUtil;
import com.cf.imes.module.executor.util.deviseData.Detail;
@@ -20,17 +21,16 @@ import java.util.List;
*/
@Service
@Validated
public class FileTypeChangeRealize implements FileTypeChangeUtil {
public class FileTypeRealize{
@Resource
private DictDataApi dictDataApi;
private Boolean flag = true;
@Resource
private OrderExcelUtil orderExcelUtil;
@Override
private Boolean flag = true;
public List<?> fileDataChange(MultipartFile file) throws IOException {
List<OrderPlateImportExcelVO> orderPlateImportExcelVOS = orderExcelUtil.read(file, OrderPlateImportExcelVO.class,7);
@@ -62,7 +62,6 @@ public class FileTypeChangeRealize implements FileTypeChangeUtil {
return details;
}
@Override
public boolean getFlag() {
return this.flag;
}
@@ -1,11 +1,9 @@
package com.cf.imes.module.executor.util.fileConversion.admin.files.excel;
import co.elastic.clients.elasticsearch.nodes.Ingest;
import com.alibaba.excel.EasyExcel;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
@@ -13,7 +11,9 @@ import java.util.*;
@Slf4j
@Component
public class OrderExcelUtil {
public class OrderExcelUtil { // 文件读取
private String value;
private ExcelListener<OrderPlateImportExcelVO> excelListener = new ExcelListener<>();
@@ -86,7 +86,7 @@ public class OrderPlateImportExcelVO {
@JsonIgnore
private String name;
@ExcelProperty(value = "")
@ExcelProperty(value = "自定义板编")
@JsonIgnore
private String plateNo;
@@ -118,15 +118,15 @@ public class OrderPlateImportExcelVO {
@JsonIgnore
private float sealDown;
@ExcelProperty(value = "类型", converter = DictConvert.class)
@ExcelProperty(value = "加工组类型", converter = DictConvert.class)
@JsonIgnore
@DictFormat(DictTypeConstants.SYNTHESIS_TYPE)
private int synthesis;
@JsonIgnore
private String synthesisTypeName;//组类型的名称
private String synthesisTypeName;//加工组类型的名称
@ExcelProperty(value = "名称")
@ExcelProperty(value = "加工组名称")
@JsonIgnore
private String combinationName;
@@ -1,60 +0,0 @@
package com.cf.imes.module.executor.util.fileConversion.admin.files.excel;
import com.alibaba.excel.annotation.ExcelProperty;
import com.cf.imes.framework.excel.core.annotations.DictFormat;
import com.cf.imes.framework.excel.core.convert.DictConvert;
import com.cf.imes.module.system.enums.DictTypeConstants;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
/**
* 生产单 Excel 导入 VO
*/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@Accessors(chain = false) // 设置 chain = false,避免生产单导入有问
public class PlateImportVO {
@ExcelProperty(value = "自定义单号")
private String customOrderNo;
@ExcelProperty(value = "客户")
private String customer;
@ExcelProperty(value = "经销商")
private String dealer;
@ExcelProperty(value = "客户地址")
private String address;
@ExcelProperty(value = "经销商电话")
private String dealerPhoneNumber;
@ExcelProperty(value = "客户电话")
private String phoneNumber;
@ExcelProperty(value = "业务员")
private String salesman;
@ExcelProperty(value = "出货日期")
private String deliveryDate;
@ExcelProperty(value = "拆单员")
private String splitter;
@ExcelProperty(value = "备注")
private String remark;
}
@@ -16,4 +16,11 @@
LEFT JOIN order_module_extra ON order_module_extra.body_id = order_body.id
WHERE order_body.id = #{bodyId} AND order_body.order_id = #{orderId};
</delete>
<select id="selectModuleByOrderId" resultType="com.cf.imes.module.executor.controller.admin.order.vo.order.OrderModuleRespVO">
SELECT b.order_id, b.room_id,b.id AS body_id, g.id as group_id, g.name as group_name, g.group_type_id,g.group_type_name,b.plate_num
FROM `order_body` b
LEFT JOIN `order_group` g ON b.id = g.body_id
WHERE b.order_id = #{orderId}
</select>
</mapper>
@@ -2,19 +2,44 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.cf.imes.module.executor.dal.mysql.orderItem.OrderItemMapper">
<select id="selectExtraById" resultType="com.cf.imes.module.executor.dal.dataobject.orderItem.OrderItemDO">
SELECT id, order_id, organ_id, room_id, body_id, type, extra_data
FROM order_module_extra
WHERE id = #{id}
<if test="orderId != null">
AND order_id = #{orderId}
</if>
<select id="selectPlatesDetailByOrderId" resultType="com.cf.imes.module.executor.controller.admin.plate.vo.PlateRespVO">
SELECT i.order_id, p.id, p.plate_no, g.material, p.name, p.area, p.seal_left, p.seal_down,
p.seal_right, p.seal_up, p.texture, p.is_special_shaped, p.is_sculpt, p.unregular_point_count, p.front_hole_count,
p.back_hole_count, p.side_hole_count,p.width,p.height,p.thickness
FROM order_item i
RIGHT JOIN `order_plate` p ON i.plate_id = p.id
LEFT JOIN `order_goods` g ON g.id = p.goods_id
WHERE i.order_id = #{orderId}
<if test="roomId != null">
AND room_id = #{roomId}
AND i.room_id = #{roomId}
</if>
<if test="bodyId != null">
AND body_id = #{bodyId}
AND i.body_id = #{bodyId}
</if>
<if test="groupId != null">
AND i.group_id = #{groupId}
</if>
</select>
<select id="selectPartsDetailByOrderId" resultType="com.cf.imes.module.executor.controller.admin.orderParts.vo.OrderPartsRespVO">
SELECT i.order_id, p.id, p.model, p.spec, p.name,i.num, p.unit, p.brand, p.factory, p.remark,p.type,p.price,
p.is_composite,p.create_time
FROM order_item i
RIGHT JOIN `order_parts` p ON i.parts_id = p.id
WHERE i.order_id = #{orderId}
<if test="roomId != null">
AND i.room_id = #{roomId}
</if>
<if test="bodyId != null">
AND i.body_id = #{bodyId}
</if>
</select>
<select id="selectPartsByOrderId"
resultType="com.cf.imes.module.executor.controller.admin.order.vo.order.OrderPlatesDetailRespVO">
SELECT i.order_id, i.room_id, i.body_id, i.parts_id, p.`name` as part_name, i.num as plate_num
FROM `order_item` i
RIGHT JOIN `order_parts` p ON i.parts_id = p.id
WHERE i.order_id = #{orderId}
</select>
</mapper>