| | |
| | | |
| | | |
| | | import com.mes.hollow.entity.dto.HollowBigStorageAndDetailsDTO; |
| | | import com.mes.hollow.entity.request.HollowTaskRequest; |
| | | import com.mes.hollow.entity.dto.LisecHollowDetails; |
| | | import com.mes.hollow.entity.vo.HollowBigStorageDetailsQueryVO; |
| | | import com.mes.hollow.service.HollowBigStorageCageService; |
| | | import com.mes.utils.Blank; |
| | |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.core.io.FileSystemResource; |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.io.IOException; |
| | | import java.io.StringWriter; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | return Result.build(200, "查询成功", hollowBigStorageCageService.queryHollowBigStorageCageDetail(query)); |
| | | } |
| | | |
| | | @GetMapping("/generate") |
| | | public ResponseEntity<FileSystemResource> generate() throws IOException, TemplateException { |
| | | @PostMapping("/generate") |
| | | public ResponseEntity<FileSystemResource> generate(@RequestBody LisecHollowDetails details) throws IOException, TemplateException { |
| | | // 创建和配置Freemarker配置实例 |
| | | Configuration cfg = new Configuration(new Version("2.3.29")); |
| | | cfg.setClassForTemplateLoading(HollowBigStorageCageController.class, "/templates/"); |
| | |
| | | // 创建数据模型 |
| | | Map<String, Object> root = new HashMap<>(); |
| | | root.put("blank", blank); |
| | | HollowTaskRequest request = new HollowTaskRequest(); |
| | | request.setCell(1); |
| | | request.setFlowCardId("1111"); |
| | | List<HollowTaskRequest> list = new ArrayList<>(); |
| | | list.add(request); |
| | | list.add(request); |
| | | list.add(request); |
| | | root.put("request", request); |
| | | root.put("list1", list); |
| | | |
| | | root.put("details", details); |
| | | |
| | | // 获取模板 |
| | | Template temp = cfg.getTemplate("hollowGlass.ftl"); |
New file |
| | |
| | | package com.mes.hollow.entity.dto; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @Author : zhoush |
| | | * @Date: 2024/12/30 17:40 |
| | | * @Description: |
| | | */ |
| | | @Data |
| | | public class LisecHollowDetails { |
| | | |
| | | private String relRecType = "<REL>"; |
| | | //版本号 03.00 |
| | | private String relNumber = "03.00"; |
| | | //其他版本信息 |
| | | private String relInfo; |
| | | |
| | | private String bthRecType = "<BTH>"; |
| | | //批次信息 |
| | | private String bathInfo; |
| | | //起始条形码(仅适用于唯一条形码) 自然数 后台:随机6位数字 |
| | | private String bcdStart; |
| | | //完整批次号(后三位与文件后缀必须相同) 自然数,后三位与文件后缀必须相同 后台:随机8位数字 |
| | | private String batchNo; |
| | | // |
| | | private String ordRecType = "<ORD>"; |
| | | //唯一订单号 自然数,建议参考ERP系统中与流程卡号相对应的订单号 后台:订单号NG24111491C002截取 24111491 |
| | | private String ord; |
| | | //客户编号 后台:sd库 order表 |
| | | private String custNum; |
| | | //客户名称 后台:sd库 order表 |
| | | private String custNam; |
| | | //订单附加信息1 |
| | | private String text1; |
| | | //订单附加信息2 |
| | | private String text2; |
| | | //订单附加信息3 |
| | | private String text3; |
| | | //订单附加信息4 |
| | | private String text4; |
| | | //订单附加信息5 |
| | | private String text5; |
| | | //生产日期 可以使用玻璃离开理片系统的日期 第一次报工时间 |
| | | private String proDate; |
| | | //交货日期 建议参考ERP系统中订单的交货日期 sd库 order表 |
| | | private String delDate; |
| | | //交货区域 |
| | | private String delArea; |
| | | //中空玻璃信息 |
| | | List<LisecHollowGlassAndFrameDetails> glassAndFrameList; |
| | | } |
New file |
| | |
| | | package com.mes.hollow.entity.dto; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @Author : zhoush |
| | | * @Date: 2024/12/30 17:40 |
| | | * @Description: |
| | | */ |
| | | @Data |
| | | public class LisecHollowFrameDetails { |
| | | |
| | | private String recType; |
| | | //项目数量指数(如果所有记录相同,则为0) 用0填充即可 |
| | | private String itemInx = "0"; |
| | | //描述 任意字符填充 |
| | | private String descript = "1"; |
| | | //框架类型(0铝 1钢 2不锈钢 3塑料 4超间隔器 5tps 6t型垫片 7duralite 8duraseal 9瑞士菜 10iet 11gss 12triseal 13舒科 14chromatech ) 间隔框类型,TPS胶为05,铝间隔条为01 |
| | | private String type; |
| | | //颜色 用0填充即可 |
| | | private String color = "0"; |
| | | //宽度 mm*10 间隔框宽度 |
| | | private String width; |
| | | //高度 mm*10 间隔框高度 |
| | | private String height; |
| | | //身份标识 |
| | | private String ident = ""; |
| | | //条形码 |
| | | private String frameBcd = ""; |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.hollow.entity.dto; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @Author : zhoush |
| | | * @Date: 2024/12/30 17:40 |
| | | * @Description: |
| | | */ |
| | | @Data |
| | | public class LisecHollowGlassAndFrameDetails { |
| | | |
| | | private String recType = "<POS>"; |
| | | //项目编号(每个订单的item_num必须是唯一的 = 记录) 可以使用00001,00002...的累加排序方式 后台:按对数依次加 |
| | | private String itemNum; |
| | | //识别号 自然数 后台:同步项目编号 |
| | | private String idNum; |
| | | //条形码编号:仅条形码编号的最后3/4位数字(总计6/7位数字),前三位数字由批号给出 自然数 后台:条形码后三位 |
| | | private String barcode; |
| | | //数量 该项目/尺寸的玻璃数量 |
| | | private String qty = "00001"; |
| | | //宽度 mm*10 |
| | | private String width; |
| | | //高度 mm*10 |
| | | private String height; |
| | | //玻璃1代码 自然数 |
| | | private String glass1; |
| | | //间隔版1代码 自然数 界面:间隔版对应编号字典 |
| | | private String frame1; |
| | | //玻璃2代码 自然数 |
| | | private String glass2; |
| | | //间隔版2代码 界面:间隔版对应编号字典 |
| | | private String frame2; |
| | | //玻璃3代码 |
| | | private String glass3; |
| | | //间隔版3代码 界面:间隔版对应编号字典 |
| | | private String frame3; |
| | | //玻璃4代码 |
| | | private String glass4; |
| | | //间隔版4代码 界面:间隔版对应编号字典 |
| | | private String frame4; |
| | | //玻璃5代码 |
| | | private String glass5; |
| | | //密封嵌入mm*10 建议与客户协商,嵌入位与玻璃厚度及胶厚度有关,不同用户对该值有不同要求 界面:密封嵌入 |
| | | private String inset; |
| | | //框架文本编号 自然数 |
| | | private String frameTxt; |
| | | //气体1类型编码 若无需充气可填000000000 界面:气体类型编号字典 |
| | | private String gasCode1; |
| | | //气体2类型编码 界面:气体类型编号字典 |
| | | private String gasCode2; |
| | | //气体3类型编码 界面:气体类型编号字典 |
| | | private String gasCode3; |
| | | //气体4类型编码 界面:气体类型编号字典 |
| | | private String gasCode4; |
| | | //密封材料代码 用0填充即可 |
| | | private String sealType = "0"; |
| | | //元件窗口类型编号(0固定 1通风口) 用0填充即可 |
| | | private String frahType = "0"; |
| | | //窗口高度mm*10 用0填充即可 |
| | | private String frahHoe = "0"; |
| | | //整个单元格窗口方向(0无图案 1水平图案 2垂直图案) 用0填充即可 |
| | | private String pattDir = "0"; |
| | | //项目使用情况(0 dgu单位 1、2、3、4 LAM DGU) 用0填充即可 |
| | | private String dguPane = "0"; |
| | | |
| | | List<LisecHollowGlassDetails> glassList; |
| | | List<LisecHollowFrameDetails> frameList; |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.hollow.entity.dto; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @Author : zhoush |
| | | * @Date: 2024/12/30 17:40 |
| | | * @Description: |
| | | */ |
| | | @Data |
| | | public class LisecHollowGlassDetails { |
| | | // |
| | | private String recType; |
| | | //项目数量指数(如果所有记录相同,则为0) 用0填充即可 |
| | | private String itemInx = "0"; |
| | | //玻璃描述 任意字符填充 |
| | | private String descript = "0"; |
| | | //玻璃表面类型(0浮动 1软涂层 2图案 3硬涂层) 与玻璃表面类型有关,填0-5之间的常数 用0填充即可 |
| | | private String surface = "0"; |
| | | //厚度 mm*10 |
| | | private String thickness; |
| | | //涂层的侧面/图案化DGU(0 无面侧 1正面侧 2背面侧) 用0填充即可 |
| | | private String faceSide = "0"; |
| | | //身份标识 用1填充即可 |
| | | private String ident = "1"; |
| | | //玻璃板X的图案方向(0无图案 1水平图案 2垂直图案) 用0填充即可 |
| | | private String pattDir = "0"; |
| | | //窗格标识(条形码) 自然数 条形码 |
| | | private String paneBcd = "0"; |
| | | //窗格编号 用0填充即可 |
| | | private String prodPane; |
| | | //组件编号 用0填充即可 |
| | | private String prodComp = "0"; |
| | | // 类别编号 材料类型(0未定义 1浮子 2层压 3防弹 4增韧 5浇祝树脂/防火装置) |
| | | private String gategory = "0"; |
| | | |
| | | |
| | | } |
| | |
| | | // 格式化字符串 |
| | | return String.format("%1$" + length + "s", tempStr).replace(' ', ' '); |
| | | } |
| | | |
| | | public String computeZero(Object original, int length) { |
| | | String tempStr = ""; |
| | | if (null != original) { |
| | | tempStr = original + ""; |
| | | } |
| | | // 格式化字符串 |
| | | return String.format("%1$" + length + "s", tempStr).replace(' ', '0'); |
| | | } |
| | | } |
| | | |
| | | |
| | |
| | | <#-- 假设你有一个变量名为"exampleText" --> |
| | | ${blank.computeBlank(request.cell,15)}| |
| | | ${blank.computeBlank(request.flowCardId,30)}| |
| | | ${blank.computeBlank(request.totalPairQuantity,15)}| |
| | | ${blank.computeBlank(request.formulaId,15)}| |
| | | |
| | | <h1>List</h1> |
| | | <ul> |
| | | <#list list1 as req> |
| | | ${blank.computeBlank(req.cell,15)}| |
| | | ${blank.computeBlank(req.flowCardId,30)}| |
| | | ${blank.computeBlank(req.totalPairQuantity,15)}| |
| | | ${blank.computeBlank(req.formulaId,15)}| |
| | | ${details.relRecType}|${details.relNumber}|${blank.computeBlank(details.relInfo,40)} |
| | | ${details.bthRecType}|${blank.computeBlank(details.bathInfo,10)}|${blank.computeBlank(details.bcdStart,6)}|${blank.computeBlank(details.batchNo,8)} |
| | | ${details.ordRecType}|${blank.computeBlank(details.ord,10)}|${blank.computeBlank(details.custNum,10)}|${blank.computeBlank(details.custNam,40)}|${blank.computeBlank(details.text1,40)}|${blank.computeBlank(details.text2,40)}|${blank.computeBlank(details.text3,40)}|${blank.computeBlank(details.text4,40)}|${blank.computeBlank(details.text5,40)}|${details.proDate}|${details.delDate}|${blank.computeBlank(details.delArea,10)} |
| | | <#list details.glassAndFrameList as item> |
| | | ${item.recType}|${blank.computeZero(item.itemNum,5)}|${blank.computeBlank(item.idNum,8)}|${blank.computeZero(item.barcode,4)}|${item.qty}|${blank.computeZero(item.width,6)}|${blank.computeZero(item.height,6)}|${blank.computeBlank(item.glass1,9)}|${blank.computeBlank(item.frame1,9)}|${blank.computeBlank(item.glass2,9)}|${blank.computeBlank(item.frame2,9)}|${blank.computeBlank(item.glass3,9)}|${blank.computeBlank(item.frame3,9)}|${blank.computeBlank(item.glass4,9)}|${blank.computeBlank(item.frame4,9)}|${blank.computeBlank(item.glass5,9)}|${blank.computeZero(item.inset,4)}|${blank.computeZero(item.frameTxt,2)}|${blank.computeZero(item.gasCode1,9)}|${blank.computeZero(item.gasCode2,9)}|${blank.computeZero(item.gasCode3,9)}|${blank.computeZero(item.gasCode4,9)}|${blank.computeZero(item.sealType,9)}|${blank.computeZero(item.frahType,1)}|${blank.computeZero(item.frahHoe,6)}|${blank.computeZero(item.pattDir,1)}|${blank.computeZero(item.dguPane,1)} |
| | | <#list item.glassList as glass> |
| | | ${glass.recType}|${blank.computeZero(glass.itemInx,5)}|${blank.computeBlank(glass.descript,40)}|${blank.computeZero(glass.surface,1)}|${blank.computeZero(glass.thickness,5)}|${blank.computeZero(glass.faceSide,1)}|${blank.computeBlank(glass.ident,10)}|${blank.computeZero(glass.pattDir,1)}|${blank.computeBlank(glass.paneBcd,10)}|${blank.computeZero(glass.prodPane,1)}|${blank.computeZero(glass.prodComp,2)}|${blank.computeZero(glass.gategory,2)} |
| | | </#list> |
| | | </ul> |
| | | <#list item.frameList as frame> |
| | | ${frame.recType}|${blank.computeZero(frame.itemInx,5)}|${blank.computeBlank(frame.descript,40)}|${blank.computeZero(frame.type,2)}|${blank.computeZero(frame.color,2)}|${blank.computeZero(frame.width,5)}|${blank.computeZero(frame.height,5)}|${blank.computeZero(frame.ident,10)}|${blank.computeZero(frame.frameBcd,10)} |
| | | </#list> |
| | | </#list> |