mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 21:02:08 +08:00
bug修改
This commit is contained in:
+86
-86
@@ -1,5 +1,6 @@
|
||||
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.OrderImportRespVO;
|
||||
import com.cf.imes.module.executor.controller.admin.order.vo.order.OrderPageReqVO;
|
||||
@@ -12,6 +13,7 @@ import com.cf.imes.module.executor.service.order.OrderInputProcessor;
|
||||
import com.cf.imes.module.executor.util.FileTypeChangeUtil;
|
||||
import com.cf.imes.module.executor.util.deviseData.Detail;
|
||||
import com.cf.imes.module.executor.util.fileConversion.admin.files.excel.OrderPlateImportExcelVO;
|
||||
import com.cf.imes.module.executor.util.fileConversion.admin.files.excel.PlateImportVO;
|
||||
import io.swagger.v3.oas.annotations.Parameters;
|
||||
import org.springframework.util.ResourceUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@@ -57,7 +59,7 @@ import org.springframework.web.multipart.MultipartFile;
|
||||
import java.io.IOException;
|
||||
|
||||
|
||||
@Tag(name = "管理后台 - 生产单表")
|
||||
@Tag(name = "管理后台 - 生产单管理")
|
||||
@RestController
|
||||
@RequestMapping("/executor/order")
|
||||
@Validated
|
||||
@@ -66,12 +68,6 @@ public class OrderController {
|
||||
@Resource
|
||||
private OrderService orderService;
|
||||
|
||||
@Resource
|
||||
private FileTypeChangeUtil fileTypeChangeUtil;
|
||||
|
||||
@Resource
|
||||
private OrderInputProcessor orderInputProcessor;
|
||||
|
||||
@Resource
|
||||
private ApiOrderService apiOrderService;
|
||||
|
||||
@@ -93,7 +89,7 @@ public class OrderController {
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除生产单")
|
||||
@Operation(summary = "删除(作废)生产单")
|
||||
@Parameter(name = "orderIds", description = "生产单id组", required = true, example = "1,2")
|
||||
@PreAuthorize("@ss.hasPermission('executor:order:delete')")
|
||||
public CommonResult<Boolean> deleteOrder(@RequestParam("orderIds") Collection<Long> orderIds) {
|
||||
@@ -102,7 +98,7 @@ public class OrderController {
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得生产单")
|
||||
@Operation(summary = "获得(单个)生产单")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('executor:order:query')")
|
||||
public CommonResult<OrderRespVO> getOrder(@RequestParam("id") Long id) {
|
||||
@@ -110,6 +106,16 @@ public class OrderController {
|
||||
return success(BeanUtils.toBean(order, OrderRespVO.class));
|
||||
}
|
||||
|
||||
// 获取当前条件下所有生产单信息
|
||||
@GetMapping("/allOrder")
|
||||
@Operation(summary = "获得所有生产单")
|
||||
@PreAuthorize("@ss.hasPermission('executor:order:query')")
|
||||
public CommonResult<PageResult<OrderRespVO>> getAllOrder(@Valid OrderPageReqVO pageReqVO) {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
PageResult<OrderDO> pageResult = orderService.getOrderPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, OrderRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得生产单分页")
|
||||
@PreAuthorize("@ss.hasPermission('executor:order:query')")
|
||||
@@ -118,22 +124,10 @@ public class OrderController {
|
||||
return success(BeanUtils.toBean(pageResult, OrderRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出生产单Excel")
|
||||
@PreAuthorize("@ss.hasPermission('executor:order:export')")
|
||||
@OperateLog(type = EXPORT)
|
||||
public void exportOrderExcel(@Valid OrderPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<OrderDO> list = orderService.getOrderPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "生产单表 order_{N}.xls", "数据", OrderRespVO.class,
|
||||
BeanUtils.toBean(list, OrderRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/get-import-template")
|
||||
@Operation(summary = "获得导入生产单模板")
|
||||
public void importTemplate(HttpServletResponse response) {
|
||||
@Parameter(name = "type", description = "文件类型", required = true, example = "0")
|
||||
public void importTemplate(HttpServletResponse response, @RequestParam("type") Integer type) {
|
||||
try {
|
||||
// path是指想要下载的文件的路径
|
||||
File file = new File(ResourceUtils.getURL("classpath:").getPath() + "\\files\\生产单上传样式.xlsx");
|
||||
@@ -227,59 +221,60 @@ public class OrderController {
|
||||
// }
|
||||
// }
|
||||
|
||||
// 导出错误的excel
|
||||
@PostMapping("/import-excel")
|
||||
@Operation(summary = "生产单导入新增")
|
||||
@Parameters({
|
||||
@Parameter(name = "file", description = "Excel 文件", required = true),
|
||||
@Parameter(name = "isAddPlate", description = "是否为生产单新增板材", example = "false"),
|
||||
@Parameter(name = "upload", description = "是 更新、否 新建", example = "false"),
|
||||
@Parameter(name = "orderSaveReqVO", description = "生产单新增参数", required = true)
|
||||
})
|
||||
@PreAuthorize("@ss.hasPermission('executor:order:importExcel')")
|
||||
@OperateLog(type = EXPORT)
|
||||
public void exportExcel(@RequestPart("file") MultipartFile file,
|
||||
@RequestParam(value = "isAddPlate", required = false, defaultValue = "false") Boolean isAddPlate,
|
||||
@RequestParam(value = "upload", required = false, defaultValue = "false") Boolean upload,
|
||||
@RequestPart("orderSaveReqVO") OrderSaveReqVO createReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
// 判断是否更新板材
|
||||
if (!isAddPlate) {//不需要添加板材
|
||||
if (upload) {
|
||||
orderService.updateOrder(createReqVO);//更新
|
||||
} else {
|
||||
Long id = orderService.createOrder(createReqVO);//新建
|
||||
}
|
||||
} else {
|
||||
Long id = 0L;
|
||||
if (upload) {
|
||||
orderService.updateOrder(createReqVO);//更新
|
||||
id = createReqVO.getId();
|
||||
} else {
|
||||
id = orderService.createOrder(createReqVO);//新建
|
||||
}
|
||||
// 解析导入文件,生成统一格式
|
||||
List<?> list = new ArrayList<>();
|
||||
if (createReqVO.getDataType() == 1) {//数据源
|
||||
|
||||
} else if (createReqVO.getDataType() == 2) {//api
|
||||
|
||||
} else if (createReqVO.getDataType() == 0) {//文件
|
||||
// 文件数据读取
|
||||
list = fileTypeChangeUtil.fileDataChange(file);
|
||||
}
|
||||
if (!fileTypeChangeUtil.getFlag()) {
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "生产单导入错误返回.xlsx", "数据", OrderPlateImportExcelVO.class,
|
||||
BeanUtils.toBean(list, OrderPlateImportExcelVO.class));
|
||||
}
|
||||
orderInputProcessor.input((List<Detail>) list, id);
|
||||
}
|
||||
|
||||
}
|
||||
// 导出错误的excel
|
||||
// @PostMapping("/import-excel")
|
||||
// @Operation(summary = "生产单导入新增")
|
||||
// @Parameters({
|
||||
// @Parameter(name = "file", description = "Excel 文件", required = true),
|
||||
// @Parameter(name = "isAddPlate", description = "是否为生产单新增板材", example = "false"),
|
||||
// @Parameter(name = "upload", description = "是 更新、否 新建", example = "false"),
|
||||
// @Parameter(name = "orderSaveReqVO", description = "生产单新增参数", required = true)
|
||||
// })
|
||||
// @PreAuthorize("@ss.hasPermission('executor:order:importExcel')")
|
||||
// @OperateLog(type = EXPORT)
|
||||
// public void exportExcel(@RequestPart("file") MultipartFile file,
|
||||
// @RequestParam(value = "isAddPlate", required = false, defaultValue = "false") Boolean isAddPlate,
|
||||
// @RequestParam(value = "upload", required = false, defaultValue = "false") Boolean upload,
|
||||
// @RequestPart("orderSaveReqVO") OrderSaveReqVO createReqVO,
|
||||
// HttpServletResponse response) throws IOException {
|
||||
//// 判断是否更新板材
|
||||
// if (!isAddPlate) {//不需要添加板材
|
||||
// if (upload) {
|
||||
// orderService.updateOrder(createReqVO);//更新
|
||||
// } else {
|
||||
// Long id = orderService.createOrder(createReqVO);//新建
|
||||
// }
|
||||
// } else {
|
||||
// Long id = 0L;
|
||||
// if (upload) {
|
||||
// orderService.updateOrder(createReqVO);//更新
|
||||
// id = createReqVO.getId();
|
||||
// } else {
|
||||
// id = orderService.createOrder(createReqVO);//新建
|
||||
// }
|
||||
//// 解析导入文件,生成统一格式
|
||||
// List<?> list = new ArrayList<>();
|
||||
// if (createReqVO.getDataType() == 1) {//数据源
|
||||
//
|
||||
// } else if (createReqVO.getDataType() == 2) {//api
|
||||
//
|
||||
// } else if (createReqVO.getDataType() == 0) {//文件
|
||||
//// 文件数据读取
|
||||
// list = fileTypeChangeUtil.fileDataChange(file);
|
||||
// }
|
||||
// if (!fileTypeChangeUtil.getFlag()) {
|
||||
// // 导出 Excel
|
||||
// ExcelUtils.write(response, "生产单导入错误返回.xlsx", "数据", OrderPlateImportExcelVO.class,
|
||||
// BeanUtils.toBean(list, OrderPlateImportExcelVO.class));
|
||||
// }
|
||||
// orderInputProcessor.input((List<Detail>) list, id);
|
||||
// }
|
||||
//
|
||||
// }
|
||||
|
||||
// 清理生产单
|
||||
@DeleteMapping("/clean")
|
||||
@GetMapping("/clean")
|
||||
@Operation(summary = "清理生产单")
|
||||
@Parameter(name = "orderId", description = "生产单编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('executor:order:delete')")
|
||||
@@ -288,14 +283,6 @@ public class OrderController {
|
||||
return success(true);
|
||||
}
|
||||
|
||||
// 获取当前条件下所有生产单信息
|
||||
@GetMapping("/allOrder")
|
||||
@Operation(summary = "获得所有生产单")
|
||||
@PreAuthorize("@ss.hasPermission('executor:order:query')")
|
||||
public CommonResult<List<OrderRespVO>> getOrderCheck(@Valid OrderPageReqVO pageReqVO) {
|
||||
List<OrderDO> pageResult = orderService.getAllOrderCheck(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, OrderRespVO.class));
|
||||
}
|
||||
|
||||
// 获得 房间和柜体 信息
|
||||
@GetMapping("/get-room")
|
||||
@@ -378,7 +365,7 @@ public class OrderController {
|
||||
|
||||
// 测试接口
|
||||
@GetMapping("getTest")
|
||||
@Operation(summary = "测试接口")
|
||||
@Operation(summary = "测试接口(忽略)")
|
||||
@PreAuthorize("@ss.hasPermission('executor:order:query')")
|
||||
public CommonResult<JSONObject> test(@RequestParam(value = "orderNo", required = false, defaultValue = "20230809027818") String orderNo) {
|
||||
// 获取token
|
||||
@@ -408,20 +395,33 @@ public class OrderController {
|
||||
|
||||
|
||||
|
||||
@PostMapping("/importTest")
|
||||
@PostMapping("/importFile")
|
||||
@Operation(summary = "生产单导入新增")
|
||||
@Parameters({
|
||||
@Parameter(name = "file", description = "Excel 文件", required = true),
|
||||
@Parameter(name = "file", description = "文件", required = true),
|
||||
@Parameter(name = "type", description = "文件类型", required = true),
|
||||
@Parameter(name = "isAddPlate", description = "是否为生产单新增板材", example = "false"),
|
||||
@Parameter(name = "upload", description = "是 更新、否 新建", example = "false")
|
||||
})
|
||||
@PreAuthorize("@ss.hasPermission('executor:order:importExcel')")
|
||||
@OperateLog(type = EXPORT)
|
||||
public void exportTest(@RequestPart("file") MultipartFile file,
|
||||
@RequestParam(value = "isAddPlate", required = false, defaultValue = "false") Boolean isAddPlate,
|
||||
@RequestParam(value = "upload", required = false, defaultValue = "false") Boolean upload,
|
||||
@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 {
|
||||
|
||||
// 判断是否更新板材
|
||||
|
||||
EasyExcel.read(file.getInputStream(), OrderRespVO.class, null)
|
||||
.headRowNumber(2)
|
||||
.autoCloseStream(false) // 不要自动关闭,交给 Servlet 自己处理
|
||||
.doReadAllSync();
|
||||
|
||||
List<PlateImportVO> orderPlateImportExcelVOS = ExcelUtils.read(file, PlateImportVO.class);
|
||||
System.out.println(
|
||||
"orderPlateImportExcelVOS " + orderPlateImportExcelVOS
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
+1
-1
@@ -8,7 +8,7 @@ import com.alibaba.excel.annotation.*;
|
||||
|
||||
@Schema(description = "管理后台 - 生产单表 order_{N} Response VO")
|
||||
@Data
|
||||
//@ExcelIgnoreUnannotated
|
||||
@ExcelIgnoreUnannotated
|
||||
public class OrderRespVO {
|
||||
|
||||
@Schema(description = "生产单号,主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "15091")
|
||||
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
package com.cf.imes.module.executor.util.deviseData.dataTwo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 排钻类型数据
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class DrillsInfo {
|
||||
|
||||
private String name; // 排钻名称
|
||||
|
||||
private String type; // 排钻类型
|
||||
|
||||
private String face; // 排钻朝向
|
||||
|
||||
private Double count; // 排钻数量
|
||||
}
|
||||
+2
-2
@@ -24,13 +24,13 @@ public class HoleDetail {
|
||||
private Double startZ;
|
||||
|
||||
// 打孔的半径
|
||||
private float radius; //孔半径
|
||||
private Double radius; //孔半径
|
||||
|
||||
// 孔的终点坐标
|
||||
private Double endX;
|
||||
private Double endY;
|
||||
private Double endZ;
|
||||
|
||||
private float angle; //角度
|
||||
private Double angle; //角度
|
||||
|
||||
}
|
||||
|
||||
+3
-3
@@ -15,15 +15,15 @@ import java.util.List;
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Accessors(chain = false) // 设置 chain = false,避免生产单导入有问
|
||||
public class ModelDetail {
|
||||
|
||||
private String typographicFace; //造型排版面 0正面, 1反面, 2侧面
|
||||
private Double depth; //造型深度
|
||||
|
||||
private Integer faceType; //使用字典进行解析 造型排版面 0正面, 1反面, 2侧面
|
||||
|
||||
private String knifeName; //造像使用刀具名称
|
||||
private float knifeRadius; //刀半径
|
||||
|
||||
private float depth; //造型深度
|
||||
|
||||
private IOriginModelingData originModeling;//造型数据
|
||||
private List<PointList> pointList; //点列表
|
||||
|
||||
+6
-7
@@ -18,15 +18,14 @@ import lombok.experimental.Accessors;
|
||||
@Accessors(chain = false) // 设置 chain = false,避免生产单导入有问
|
||||
public class OffSetList {
|
||||
|
||||
private String faceType;// 面向类型(0正面, 1反面, 2侧面)
|
||||
|
||||
// 二维刀路的属性
|
||||
private float radius;//刀的半径
|
||||
private String name; //刀的名称
|
||||
private float angle;//角度
|
||||
|
||||
// 刀路的偏移值
|
||||
private float value; // 刀路的偏倚值
|
||||
private float deep;//下刀的深度
|
||||
private float angle;//角度
|
||||
|
||||
// 二维刀路的属性
|
||||
private String name; //刀的名称
|
||||
private float radius;//刀的半径
|
||||
|
||||
private String faceType;// 面向类型(0正面, 1反面, 2侧面)
|
||||
}
|
||||
|
||||
+15
-1
@@ -13,6 +13,14 @@ import lombok.NoArgsConstructor;
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class PartsInfo {
|
||||
|
||||
// 配件所属信息
|
||||
private String roomsName; //房间名称
|
||||
private String bodyName; //柜体名
|
||||
|
||||
// 柜体成倍拆单的倍数
|
||||
private Integer multiNum;
|
||||
|
||||
// 商品信息
|
||||
private String goodsName; //商品名称
|
||||
private String goodsNo; // 商品编码
|
||||
@@ -27,6 +35,12 @@ public class PartsInfo {
|
||||
private String spec; //商品规格
|
||||
private String unit; //商品单位
|
||||
|
||||
private Boolean isComposite; // 是否为复合配件
|
||||
private String groupName; //
|
||||
private String objectType;
|
||||
|
||||
private float goodsNumber; //产品数量为特殊处理,板件和配件都有数量
|
||||
private Double goodsNumber; //产品数量为特殊处理,板件和配件都有数量
|
||||
|
||||
|
||||
private String remark;
|
||||
}
|
||||
|
||||
+11
-8
@@ -38,16 +38,16 @@ public class PlateDetail {
|
||||
|
||||
// 成品长宽、面积
|
||||
private Double width;
|
||||
private Double height;
|
||||
private Double length;
|
||||
private Double acreage;
|
||||
|
||||
// 开料长宽、面积
|
||||
private Double splitHeight;
|
||||
private Double splitLength;
|
||||
private Double splitWidth;
|
||||
private Double sealAcreage;
|
||||
|
||||
// 是否矩形
|
||||
private Boolean isRect;
|
||||
// 是否异形
|
||||
private Boolean isUnRegular;
|
||||
// 封边,用于矩形
|
||||
private Double sealLeft;
|
||||
private Double sealRight;
|
||||
@@ -65,13 +65,15 @@ public class PlateDetail {
|
||||
// 大板基本信息
|
||||
private BoardInfo boardInfo;
|
||||
// 配件基本信息
|
||||
private List<PartsInfo> partsDetail;
|
||||
private List<PartsInfo> partsInfos;
|
||||
// 排钻类型
|
||||
private List<DrillsInfo> drillsInfos;
|
||||
|
||||
// 基准位置,用于画图
|
||||
private BasePosition basePosition;
|
||||
|
||||
// 轮廓数据、造型数据
|
||||
private List<PointDetail> pointDetail ; //点明细,表示小板外围轮廓的几个转折点
|
||||
private List<PointDetail> pointDetail ; //点明细,表示小板外围轮廓的几个转折点(不含封边)
|
||||
private List<PointDetail> rawPointDetail ; //原始点明细(含封边)
|
||||
|
||||
private List<HoleDetail> holeDetail ; //孔明细,表示板上的孔
|
||||
private List<ModelDetail> contourDetail ; //造型明细
|
||||
|
||||
@@ -80,4 +82,5 @@ public class PlateDetail {
|
||||
|
||||
// 备注
|
||||
private Map<String,String> remark;// 板件备注
|
||||
private Map<String,String> sideRemark;// 封边备注
|
||||
}
|
||||
|
||||
+1
-4
@@ -16,14 +16,11 @@ import lombok.experimental.Accessors;
|
||||
@Accessors(chain = false) // 设置 chain = false,避免生产单导入有问
|
||||
public class PointDetail {
|
||||
|
||||
// 表明点的顺序,或是下一个点是哪个点
|
||||
private Integer pointId;
|
||||
|
||||
// 点的位置信息
|
||||
private Double pointX;
|
||||
private Double pointY;
|
||||
private Double curve;//曲线
|
||||
|
||||
// 点的封边尺寸
|
||||
private float SealSize;//封边尺寸,封边的厚度,长同边长
|
||||
private Double sealSize;//封边尺寸,封边的厚度,长同边长
|
||||
}
|
||||
|
||||
+113
-5
@@ -5,14 +5,15 @@ import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.cf.imes.module.executor.dal.dataobject.order.OrderDO;
|
||||
import com.cf.imes.module.executor.util.FileTypeChangeUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import com.cf.imes.module.executor.util.deviseData.dataTwo.Group;
|
||||
import com.cf.imes.module.executor.util.deviseData.dataTwo.HoleDetail;
|
||||
import com.cf.imes.module.executor.util.deviseData.dataTwo.PlateDetail;
|
||||
import com.cf.imes.module.executor.util.deviseData.dataTwo.PointDetail;
|
||||
import org.apache.poi.ss.formula.functions.T;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
@@ -22,7 +23,6 @@ import java.util.Map;
|
||||
/**
|
||||
* 实现数据格式转换
|
||||
*/
|
||||
|
||||
public class ApiTypeChangeRealize implements FileTypeChangeUtil {
|
||||
|
||||
@Override
|
||||
@@ -86,7 +86,34 @@ public class ApiTypeChangeRealize implements FileTypeChangeUtil {
|
||||
for (int k = 0; k < material.getJSONArray("Blocks").size(); k++) {
|
||||
JSONObject block = material.getJSONArray("Blocks").getJSONObject(k);// 每块板
|
||||
|
||||
|
||||
PlateDetail plateDetail = PlateDetail.builder()
|
||||
.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))
|
||||
.width(Double.valueOf(block.getString("Width")))
|
||||
.length(Double.valueOf(block.getString("Length")))
|
||||
.acreage(Double.valueOf(block.getString("Size")))
|
||||
.splitWidth(Double.valueOf(block.getString("CuttingWidth")))
|
||||
.splitLength(Double.valueOf(block.getString("CuttingLength")))
|
||||
.sealAcreage(Double.valueOf(block.getString("CuttingSize")))
|
||||
.isUnRegular(Boolean.valueOf(block.getString("IsUnRegular")))
|
||||
.sealLeft(Double.valueOf(block.getString("BorderLeft")))
|
||||
.sealRight(Double.valueOf(block.getString("BorderRight")))
|
||||
.sealUp(Double.valueOf(block.getString("BorderUpper")))
|
||||
.sealDown(Double.valueOf(block.getString("BorderUnder")))
|
||||
.texture(Integer.valueOf(block.getString("Wave")))
|
||||
.typographicFace(Integer.valueOf(block.getString("PlaceFace")))
|
||||
.openDoorType(Integer.valueOf(block.getString("OpenDoorType")))
|
||||
.offsetX(Double.valueOf(block.getString("OffsetX")))
|
||||
.offsetY(Double.valueOf(block.getString("OffsetY")))
|
||||
.pointDetail(getPointDetail(block, 2))
|
||||
.rawPointDetail(getPointDetail(block, 1))
|
||||
.build();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -100,6 +127,87 @@ public class ApiTypeChangeRealize implements FileTypeChangeUtil {
|
||||
|
||||
}
|
||||
|
||||
// 加工组信息筛选
|
||||
private static List<Group> getProcessGroup(JSONObject block) {
|
||||
List<Group> groupList = new ArrayList<>();
|
||||
if (block.getJSONArray("ExtraRemark") != null && !block.getJSONArray("ExtraRemark").isEmpty()) {
|
||||
JSONObject extraRemark = block.getJSONArray("ExtraRemark").getJSONObject(0);
|
||||
if (extraRemark.getJSONArray("extra") != null && !extraRemark.getJSONArray("extra").isEmpty()) {
|
||||
JSONObject extra = extraRemark.getJSONArray("extra").getJSONObject(0);
|
||||
if (extra.getJSONArray("processList") != null && !extra.getJSONArray("processList").isEmpty()) {
|
||||
for (int i = 0; i < extra.getJSONArray("processList").size(); i++) {
|
||||
JSONObject process = extra.getJSONArray("processList").getJSONObject(i);
|
||||
Group group = Group.builder()
|
||||
.name(process.getString("name"))
|
||||
.width(Double.valueOf(process.getJSONObject("size").getString("width")))
|
||||
.height(Double.valueOf(process.getJSONObject("size").getString("height")))
|
||||
.depth(Double.valueOf(process.getJSONObject("size").getString("depth")))
|
||||
.build();
|
||||
|
||||
groupList.add(group);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
// 异形板的开料轮廓 (type 为1,不含封边)
|
||||
private static 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 null;
|
||||
}
|
||||
|
||||
// 孔明细板数据解析 (type 为1,正面)
|
||||
private static 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(hole.getString("Face"))
|
||||
.holeType(hole.getString("Type"))
|
||||
.build());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
// 异形板的开料轮廓 (不含封边)
|
||||
|
||||
// 生产单数据分离填入
|
||||
public List<T> getDeviseData(String[] args) {
|
||||
return null;
|
||||
|
||||
+1
-1
@@ -32,7 +32,7 @@ public class FileTypeChangeRealize implements FileTypeChangeUtil {
|
||||
|
||||
@Override
|
||||
public List<?> fileDataChange(MultipartFile file) throws IOException {
|
||||
List<OrderPlateImportExcelVO> orderPlateImportExcelVOS = orderExcelUtil.read(file, OrderPlateImportExcelVO.class);
|
||||
List<OrderPlateImportExcelVO> orderPlateImportExcelVOS = orderExcelUtil.read(file, OrderPlateImportExcelVO.class,7);
|
||||
|
||||
// 判断上传数据解析是否有误
|
||||
if (!orderExcelUtil.getFlag()){
|
||||
|
||||
+4
-3
@@ -1,5 +1,6 @@
|
||||
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;
|
||||
@@ -17,7 +18,7 @@ public class OrderExcelUtil {
|
||||
|
||||
private ExcelListener<OrderPlateImportExcelVO> excelListener = new ExcelListener<>();
|
||||
|
||||
public List<OrderPlateImportExcelVO> read(MultipartFile file, Class<OrderPlateImportExcelVO> head) throws IOException {
|
||||
public List<OrderPlateImportExcelVO> read(MultipartFile file, Class<OrderPlateImportExcelVO> head, Integer index) throws IOException {
|
||||
|
||||
if (file.isEmpty()) {
|
||||
value = "文件为空";
|
||||
@@ -34,13 +35,13 @@ public class OrderExcelUtil {
|
||||
} else {
|
||||
//读取文件内容
|
||||
EasyExcel.read(file.getInputStream(), head, excelListener).
|
||||
headRowNumber(7).sheet(0).doRead();
|
||||
headRowNumber(index).sheet(0).doRead();
|
||||
//获取读取的数据
|
||||
List<OrderPlateImportExcelVO> list = excelListener.getDatas();
|
||||
|
||||
if (excelListener.getValueMap().size() > 0)
|
||||
excelListener.getValueMap().forEach((k, v) -> {
|
||||
list.get(k - 8).setResult(v);
|
||||
list.get(k - (index + 1)).setResult(v);
|
||||
});
|
||||
return list;
|
||||
}
|
||||
|
||||
-204
@@ -1,204 +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 OrderImportVO {
|
||||
|
||||
@ExcelProperty(value = "序号")
|
||||
@JsonIgnore
|
||||
private int ordinal;
|
||||
|
||||
@ExcelProperty(value = "类型", converter = DictConvert.class)
|
||||
@JsonIgnore
|
||||
@DictFormat(DictTypeConstants.PRODUCT_TYPE)
|
||||
private int goodType;
|
||||
|
||||
@ExcelProperty(value = "物料编码")
|
||||
@JsonIgnore
|
||||
private String goodsId;
|
||||
|
||||
@ExcelProperty(value = "商品名称")
|
||||
@JsonIgnore
|
||||
private String goodsName;
|
||||
|
||||
@ExcelProperty(value = "材质")
|
||||
@JsonIgnore
|
||||
private String material;
|
||||
|
||||
@ExcelProperty(value = "颜色")
|
||||
@JsonIgnore
|
||||
private String color;
|
||||
|
||||
@ExcelProperty(value = "厂家")
|
||||
@JsonIgnore
|
||||
private String factory;
|
||||
|
||||
@ExcelProperty(value = "品牌")
|
||||
@JsonIgnore
|
||||
private String brand;
|
||||
|
||||
@ExcelProperty(value = "型号")
|
||||
@JsonIgnore
|
||||
private String model;
|
||||
|
||||
@ExcelProperty(value = "规格")
|
||||
@JsonIgnore
|
||||
private String spec;
|
||||
|
||||
@ExcelProperty(value = "单位")
|
||||
@JsonIgnore
|
||||
private String unit;
|
||||
|
||||
@ExcelProperty(value = "数量")
|
||||
@JsonIgnore
|
||||
@NotNull
|
||||
private Double goodsNumber;
|
||||
|
||||
@ExcelProperty(value = "房间")
|
||||
@JsonIgnore
|
||||
private String roomsName;
|
||||
|
||||
@ExcelProperty(value = "柜体")
|
||||
@JsonIgnore
|
||||
private String cabinetsName;
|
||||
|
||||
@ExcelProperty(value = "板名称")
|
||||
@JsonIgnore
|
||||
private String name;
|
||||
|
||||
@ExcelProperty(value = "板号")
|
||||
@JsonIgnore
|
||||
private String plateNo;
|
||||
|
||||
@ExcelProperty(value = "开料长")
|
||||
@JsonIgnore
|
||||
private BigDecimal splitHeight;
|
||||
|
||||
@ExcelProperty(value = "开料宽")
|
||||
@JsonIgnore
|
||||
private BigDecimal splitWidth;
|
||||
|
||||
@ExcelProperty(value = "厚")
|
||||
@JsonIgnore
|
||||
private BigDecimal splitThickness;
|
||||
|
||||
@ExcelProperty(value = "左封边")
|
||||
@JsonIgnore
|
||||
private BigDecimal sealLeft;
|
||||
|
||||
@ExcelProperty(value = "右封边")
|
||||
@JsonIgnore
|
||||
private BigDecimal sealRight;
|
||||
|
||||
@ExcelProperty(value = "上封边")
|
||||
@JsonIgnore
|
||||
private BigDecimal sealUp;
|
||||
|
||||
@ExcelProperty(value = "下封边")
|
||||
@JsonIgnore
|
||||
private BigDecimal sealDown;
|
||||
|
||||
@ExcelProperty(value = "组合类型", converter = DictConvert.class)
|
||||
@JsonIgnore
|
||||
@DictFormat(DictTypeConstants.SYNTHESIS_TYPE)
|
||||
private int synthesis;
|
||||
|
||||
@JsonIgnore
|
||||
private String synthesisTypeName;//组合类型的名称
|
||||
|
||||
@ExcelProperty(value = "组合名称")
|
||||
@JsonIgnore
|
||||
private String combinationName;
|
||||
|
||||
@ExcelProperty(value = "排版面", converter = DictConvert.class)
|
||||
@JsonIgnore
|
||||
@DictFormat(DictTypeConstants.YPOGRAPHY_TYPE)
|
||||
private int typographicFace;
|
||||
|
||||
@ExcelProperty(value = "纹路", converter = DictConvert.class)
|
||||
@JsonIgnore
|
||||
@DictFormat(DictTypeConstants.GRAIN_TYPE)
|
||||
private int texture;
|
||||
|
||||
@ExcelProperty(value = "开门方向", converter = DictConvert.class)
|
||||
@JsonIgnore
|
||||
@DictFormat(DictTypeConstants.DOOR_OPENING_DIRECTIONS)
|
||||
private int openDoorType;
|
||||
|
||||
@ExcelProperty(value = "上传结果")
|
||||
@JsonIgnore
|
||||
private String result;
|
||||
|
||||
@ExcelProperty(value = "备注1")
|
||||
private String remark1;
|
||||
|
||||
@ExcelProperty(value = "备注2")
|
||||
private String remark2;
|
||||
|
||||
@ExcelProperty(value = "备注3")
|
||||
private String remark3;
|
||||
|
||||
@ExcelProperty(value = "备注4")
|
||||
private String remark4;
|
||||
|
||||
@ExcelProperty(value = "备注5")
|
||||
private String remark5;
|
||||
|
||||
@ExcelProperty(value = "备注6")
|
||||
private String remark6;
|
||||
|
||||
@ExcelProperty(value = "备注7")
|
||||
private String remark7;
|
||||
|
||||
@ExcelProperty(value = "备注8")
|
||||
private String remark8;
|
||||
|
||||
@ExcelProperty(value = "备注9")
|
||||
private String remark9;
|
||||
|
||||
@ExcelProperty(value = "备注10")
|
||||
private String remark10;
|
||||
|
||||
@ExcelProperty(value = "备注")
|
||||
@JsonIgnore
|
||||
private String remark;
|
||||
|
||||
|
||||
//备注转json数据
|
||||
public String remarkJSON() {
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
// 设置实体类字段的值
|
||||
try {
|
||||
String json = objectMapper.writeValueAsString(this);
|
||||
return json;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return "{}";
|
||||
}
|
||||
}
|
||||
|
||||
// 判断非空
|
||||
// 判断数据合理
|
||||
}
|
||||
+60
@@ -0,0 +1,60 @@
|
||||
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;
|
||||
|
||||
|
||||
}
|
||||
+1
@@ -34,6 +34,7 @@ public interface PlateMapper extends BaseMapperX<PlateDO> {
|
||||
.eqIfPresent(PlateDO::getSpec, reqVO.getSpec())
|
||||
.eqIfPresent(PlateDO::getRemark, reqVO.getRemark())
|
||||
.eqIfPresent(PlateDO::getPrice, reqVO.getPrice())
|
||||
.eqIfPresent(PlateDO::getOrganId, reqVO.getOrganId())
|
||||
.betweenIfPresent(PlateDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(PlateDO::getId));
|
||||
}
|
||||
|
||||
+3
@@ -94,6 +94,9 @@ public class PlateServiceImpl implements PlateService {
|
||||
|
||||
@Override
|
||||
public PageResult<PlateDO> getPlatePage(PlatePageReqVO pageReqVO) {
|
||||
if (pageReqVO.getOrganId() == null || pageReqVO.getOrganId() == 0){
|
||||
pageReqVO.setOrganId(OrganContextHolder.getOrganId());
|
||||
}
|
||||
return plateMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user