diff --git a/nflg-wms-admin/src/main/java/com/nflg/wms/admin/controller/BarcodePrintingController.java b/nflg-wms-admin/src/main/java/com/nflg/wms/admin/controller/BarcodePrintingController.java new file mode 100644 index 00000000..6b8930fb --- /dev/null +++ b/nflg-wms-admin/src/main/java/com/nflg/wms/admin/controller/BarcodePrintingController.java @@ -0,0 +1,235 @@ +package com.nflg.wms.admin.controller; + +import cn.hutool.core.collection.CollectionUtil; +import cn.hutool.core.convert.Convert; +import cn.hutool.core.util.IdUtil; +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.nflg.wms.admin.util.PdfGeneratorUtil; +import com.nflg.wms.admin.util.QRCodeUtil; +import com.nflg.wms.admin.util.ThymeleafUtil; +import com.nflg.wms.common.constant.STATE; +import com.nflg.wms.common.pojo.ApiResult; +import com.nflg.wms.common.pojo.PageData; +import com.nflg.wms.common.pojo.dto.BarcodePrintingAddDTO; +import com.nflg.wms.common.pojo.dto.DeliverNormalOrderItemDTO; +import com.nflg.wms.common.pojo.dto.GongZhuangTaiZhangExcelCheckDTO; +import com.nflg.wms.common.pojo.qo.BarcodePrintingEditQO; +import com.nflg.wms.common.pojo.qo.BarcodePrintingIdsQO; +import com.nflg.wms.common.pojo.qo.BarcodePrintingQO; +import com.nflg.wms.common.pojo.qo.SRMOrderSearchQO; +import com.nflg.wms.common.pojo.vo.BarcodePrintingVO; +import com.nflg.wms.common.pojo.vo.SrmOrderVO; +import com.nflg.wms.common.util.DateTimeUtil; +import com.nflg.wms.common.util.EecExcelUtil; +import com.nflg.wms.common.util.VUtil; +import com.nflg.wms.repository.entity.WmsInProduceOrder; +import com.nflg.wms.repository.entity.WmsInProduceOrderItem; +import com.nflg.wms.repository.entity.WmsInventoryBarcodePrinting; +import com.nflg.wms.repository.service.IWmsInventoryBarcodePrintingService; +import com.nflg.wms.starter.BaseController; +import com.nflg.wms.starter.annotation.ApiMark; +import com.nflg.wms.starter.service.FileUploadService; +import jakarta.annotation.Resource; +import jakarta.servlet.http.HttpServletResponse; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotNull; +import lombok.extern.slf4j.Slf4j; +import org.springframework.core.io.ClassPathResource; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; +import org.ttzero.excel.entity.ListSheet; +import org.ttzero.excel.entity.Workbook; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.net.URL; +import java.text.DecimalFormat; +import java.time.LocalDate; +import java.util.*; + +/** + * 库存物料条码打印 + * @author nflg + */ +@Slf4j +@RestController +@RequestMapping("/barcode") +public class BarcodePrintingController extends BaseController { + @Resource + private IWmsInventoryBarcodePrintingService printingService; + + @Resource + private FileUploadService fileUploadService; + + private static final DecimalFormat DF = new DecimalFormat("0.00"); + + /** + * 列表 + */ + @PostMapping("search") + @ApiMark(moduleName = "仓储物流打印", apiName = "打印记录") + public ApiResult> search(@Valid @RequestBody BarcodePrintingQO request) { + return ApiResult.success(printingService.search(request)); + } + + /** + * 批量获取编辑内容,可多选 + */ + @PostMapping("items") + @ApiMark(moduleName = "仓储物流打印", apiName = "获取编辑记录") + public ApiResult> getItems(@Valid @RequestBody BarcodePrintingIdsQO request) { + List items = printingService.listByIds(request.getIds()); + List vos = new ArrayList<>(); + if (CollectionUtil.isNotEmpty(items)) { + vos = Convert.toList(BarcodePrintingVO.class, items); + } + return ApiResult.success(vos); + } + + /** + * 批量删除物料 + */ + @PostMapping("delete") + @ApiMark(moduleName = "仓储物流打印", apiName = "批量删除记录") + public ApiResult deleteBarcodes(@Valid @RequestBody BarcodePrintingIdsQO request) { + if (CollectionUtil.isEmpty(request.getIds())) { + VUtil.trueThrowBusinessError(true).throwMessage("没有需要删除的数据"); + } + printingService.removeByIds(request.getIds()); + return ApiResult.success(); + } + + /** + * 保存 + */ + @PostMapping("save") + @ApiMark(moduleName = "仓储物流打印", apiName = "保存记录") + public ApiResult saveBarcodes(@Valid @RequestBody List request) { + //修改 + if (CollectionUtil.isEmpty(request)) { + VUtil.trueThrowBusinessError(true).throwMessage("没有需要保存的数据"); + } + List items = Convert.toList(WmsInventoryBarcodePrinting.class, request); + printingService.saveOrUpdateBatch(items); + return ApiResult.success(); + } + + /** + * 导入物料清单 + * @param file 文件 + */ + @Transactional + @PostMapping("import") + public ApiResult importFromExcel(@RequestParam(value = "file") MultipartFile file) throws IOException { + List data = EecExcelUtil.getExcelContext(file.getInputStream(), BarcodePrintingAddDTO.class); + VUtil.trueThrowBusinessError(CollectionUtil.isEmpty(data)).throwMessage("导入文件内容为空"); +// 检查 + List codes = new ArrayList<>(); + + for (BarcodePrintingAddDTO item : data) { + StringBuilder errorBuild = new StringBuilder(); + if (StrUtil.isBlank(item.getMaterialNo())) { + errorBuild.append("物料编号必填"); + } + if (StrUtil.isBlank(item.getMaterialDes())) { + errorBuild.append("物料描述必填"); + } + if (StrUtil.isBlank(item.getUnit())) { + errorBuild.append("单位必填"); + } + if (item.getQty() == null || item.getQty().compareTo(BigDecimal.ZERO) <= 0) { + errorBuild.append("数量必填"); + } + if (item.getPackingNum() == null || item.getPackingNum().compareTo(BigDecimal.ZERO) <= 0) { + errorBuild.append("最小包装量必填"); + } + if (errorBuild.length() > 0) { + item.setError(errorBuild.toString()); + } else { + codes.add(Convert.convert(WmsInventoryBarcodePrinting.class, item)); + } + } + if (data.stream().noneMatch(it -> StrUtil.isNotBlank(it.getError())) + && CollectionUtil.isNotEmpty(codes) + ) { + printingService.saveBatch(codes); + return ApiResult.success(); + } else { + try (ByteArrayOutputStream osOut = new ByteArrayOutputStream()) { + new Workbook() + .addSheet(new ListSheet<>(data)) + .writeTo(osOut); + try (ByteArrayInputStream isIn = new ByteArrayInputStream(osOut.toByteArray())) { + return ApiResult.error(STATE.DataNoCheckPass, "导入文件失败", fileUploadService.upload("temp/" + DateTimeUtil.format(LocalDate.now(), "yyyyMMdd") + "/" + IdUtil.fastUUID() + ".xlsx", isIn, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")); + } + } catch (Exception e) { + return ApiResult.error(STATE.BusinessError, "保存文件出错"); + } + } + } + + private String generateQRContent(DeliverNormalOrderItemDTO order, String indexNo) { + String content = StrUtil.format("{}${}${}${}${}${}${}${}" + , order.getPrintNo(), order.getExternalOrderNo(), order.getRowNo(), order.getMaterialNo(), order.getPrintNum() + , order.getMaterialDesc(), order.getBatchNo(), Optional.ofNullable(indexNo).orElse("")); + log.debug("二维码内容:" + content); + return content; + } + + /** + * 导出物料条码pdf(整张或者一张一个) + * @param request 打印IDs + * @param type 1:逐个,2:一页 + */ + @PostMapping("exportMaterialsPdf") + public void exportMaterials(HttpServletResponse response, @Valid @RequestParam @NotNull BarcodePrintingIdsQO request, @Valid @RequestParam @NotNull Integer type) throws Exception { + List codelist = printingService.listByIds(request.getIds()); + VUtil.trueThrowBusinessError(Objects.isNull(codelist)).throwMessage("订单不存在"); + List datas = new ArrayList<>(); + // Integer i = 1; + for (WmsInventoryBarcodePrinting item : codelist) { + DeliverNormalOrderItemDTO dto = new DeliverNormalOrderItemDTO(); + dto.setMaterialNo(item.getMaterialNo()); + dto.setMaterialDesc(item.getMaterialDes()); + dto.setBatchNo(StrUtil.isBlank(item.getBatchNumber()) ? "" : item.getBatchNumber()); + dto.setExternalOrderNo(""); + dto.setRowNo(""); + if (StrUtil.isNotBlank(item.getSerialNumbers())) { + List serialNumbers = StrUtil.split(item.getSerialNumbers(), ","); + for (String serialNumber : serialNumbers) { + dto.setPrintNo(IdUtil.getSnowflakeNextIdStr()); + dto.setPrintNum("1"); + String qCode = QRCodeUtil.generateQRCodeBase64(generateQRContent(dto, serialNumber), 100, 100); + dto.setQrCode(qCode); + //i += 1; + } + } else { + Integer codeNum = item.getQty().divide(item.getPackingNum(), 0, RoundingMode.UP).intValue(); + for (int j = 0; j < codeNum; j++) { + dto.setPrintNo(IdUtil.getSnowflakeNextIdStr()); + dto.setPrintNum(item.getPackingNum().toString()); + String qCode = QRCodeUtil.generateQRCodeBase64(generateQRContent(dto, ""), 100, 100); + dto.setQrCode(qCode); + } + + } + datas.add(dto); + } + Map variables = new HashMap<>(); + variables.put("list", datas); + if (Objects.equals(type, 1)) { + String html = ThymeleafUtil.generator("/template/qrcode/", "Inv-1", ".html", variables); + URL baseUrl = new ClassPathResource("template/qrcode/").getURL(); + PdfGeneratorUtil.generatePdf("库存物料条码(逐个)", html, baseUrl.toString(), response); + } else { + String html = ThymeleafUtil.generator("/template/qrcode/", "Inv-2", ".html", variables); + URL baseUrl = new ClassPathResource("template/qrcode/").getURL(); + PdfGeneratorUtil.generatePdf("库存物料条码(整张)", html, baseUrl.toString(), response); + } + } +} diff --git a/nflg-wms-admin/src/main/java/com/nflg/wms/admin/controller/InProduceOrderController.java b/nflg-wms-admin/src/main/java/com/nflg/wms/admin/controller/InProduceOrderController.java index acce04c4..2126e921 100644 --- a/nflg-wms-admin/src/main/java/com/nflg/wms/admin/controller/InProduceOrderController.java +++ b/nflg-wms-admin/src/main/java/com/nflg/wms/admin/controller/InProduceOrderController.java @@ -100,7 +100,7 @@ public class InProduceOrderController extends BaseController { * @return 订单信息 */ @GetMapping("searchFromSAP") - public ApiResult searchFromSAP(@Valid @RequestParam @NotBlank String no){ + public ApiResult searchFromSAP(@Valid @RequestParam @NotBlank String no) { return ApiResult.success(sapService.zwm00Mb007(no)); // return ApiResult.success(new ZWM00MB007DTO() // .setAufnr(RandomUtil.randomNumbers(10)) @@ -153,8 +153,8 @@ public class InProduceOrderController extends BaseController { @Transactional @PostMapping("save") public ApiResult save(@Valid @RequestBody InProduceOrderSaveQO request) { - if (Objects.isNull(request.getId())){ - WmsInProduceOrder order=new WmsInProduceOrder() + if (Objects.isNull(request.getId())) { + WmsInProduceOrder order = new WmsInProduceOrder() .setNo(serialNumberControllerService.generateSerialNumber(8)) .setOrderNo(request.getAufnr()) .setList(request.getList()) @@ -162,17 +162,17 @@ public class InProduceOrderController extends BaseController { .setCreateTime(LocalDateTime.now()); produceOrderService.save(order); request.setId(order.getId()); - }else { - WmsInProduceOrder order=produceOrderService.getById(request.getId()); + } else { + WmsInProduceOrder order = produceOrderService.getById(request.getId()); VUtil.trueThrowBusinessError(Objects.isNull(order)).throwMessage("订单不存在"); - VUtil.trueThrowBusinessError(!Objects.equals(order.getState(),(short)0)) - .throwMessage("保存失败:非待收货状态"); + VUtil.trueThrowBusinessError(!Objects.equals(order.getState(), (short) 0)) + .throwMessage("保存失败:非待收货状态"); order.setUpdateBy(UserUtil.getUserName()); order.setUpdateTime(LocalDateTime.now()); produceOrderService.updateById(order); produceOrderItemService.deleteByOrderId(order.getId()); } - WmsInProduceOrderItem parent=new WmsInProduceOrderItem() + WmsInProduceOrderItem parent = new WmsInProduceOrderItem() .setOrderId(request.getId()) .setParentId(0L) .setNum(request.getNum()) @@ -184,7 +184,7 @@ public class InProduceOrderController extends BaseController { .setOrderNum(request.getPsmng()); // .setBatchNo(NoUtil.getBatchNo("")); produceOrderItemService.save(parent); - if (request.getList()){ + if (request.getList()) { List children = bomService.getChildren(request.getMatnr()); VUtil.trueThrowBusinessError(CollectionUtil.isEmpty(children)).throwMessage("请先添加齐套信息"); produceOrderItemService.saveBatch(children.stream().map(it -> new WmsInProduceOrderItem() @@ -210,7 +210,7 @@ public class InProduceOrderController extends BaseController { * @return 搜索结果 */ @PostMapping("search") - public ApiResult> search(@Valid @RequestBody InProduceOrderSearchQO request){ + public ApiResult> search(@Valid @RequestBody InProduceOrderSearchQO request) { return ApiResult.success(produceOrderService.search(request)); } @@ -220,9 +220,9 @@ public class InProduceOrderController extends BaseController { * @return 列表 */ @GetMapping("getList") - public ApiResult getList(@Valid @RequestParam @NotNull Long id){ - List list=produceOrderItemService.getByOrderId(id); - WmsInProduceOrderItem parent=list.stream().filter(item -> Objects.equals(item.getParentId(), 0L)).findFirst().get(); + public ApiResult getList(@Valid @RequestParam @NotNull Long id) { + List list = produceOrderItemService.getByOrderId(id); + WmsInProduceOrderItem parent = list.stream().filter(item -> Objects.equals(item.getParentId(), 0L)).findFirst().get(); InProduceOrderMaterialVO vo = Convert.convert(InProduceOrderMaterialVO.class, parent); vo.setChildren(list.stream() .filter(item -> Objects.equals(item.getParentId(), parent.getId())) @@ -238,10 +238,10 @@ public class InProduceOrderController extends BaseController { */ @Transactional @GetMapping("delete") - public ApiResult delete(@Valid @RequestParam @NotNull Long id){ - WmsInProduceOrder order=produceOrderService.getById(id); + public ApiResult delete(@Valid @RequestParam @NotNull Long id) { + WmsInProduceOrder order = produceOrderService.getById(id); VUtil.trueThrowBusinessError(Objects.isNull(order)).throwMessage("订单不存在"); - VUtil.trueThrowBusinessError(!Objects.equals(order.getState(),(short)0)) + VUtil.trueThrowBusinessError(!Objects.equals(order.getState(), (short) 0)) .throwMessage("删除失败:非待收货状态"); produceOrderService.removeById(id); produceOrderItemService.deleteByOrderId(id); @@ -254,7 +254,7 @@ public class InProduceOrderController extends BaseController { * @param type 1:逐个,2:一页 */ @GetMapping("exportMaterialsPdf") - public void exportMaterials(HttpServletResponse response, @Valid @RequestParam @NotNull Long id,@Valid @RequestParam @NotNull Integer type) throws Exception { + public void exportMaterials(HttpServletResponse response, @Valid @RequestParam @NotNull Long id, @Valid @RequestParam @NotNull Integer type) throws Exception { WmsInProduceOrder order = produceOrderService.getById(id); VUtil.trueThrowBusinessError(Objects.isNull(order)).throwMessage("订单不存在"); List list = produceOrderItemService.getByOrderId(id); @@ -284,22 +284,22 @@ public class InProduceOrderController extends BaseController { } Map variables = new HashMap<>(); variables.put("list", datas); - if (Objects.equals(type,1)) { + if (Objects.equals(type, 1)) { String html = ThymeleafUtil.generator("/template/qrcode/", "dp-1", ".html", variables); URL baseUrl = new ClassPathResource("template/qrcode/").getURL(); PdfGeneratorUtil.generatePdf("普通物料条码(逐个)", html, baseUrl.toString(), response); - }else { + } else { String html = ThymeleafUtil.generator("/template/qrcode/", "dp-2", ".html", variables); URL baseUrl = new ClassPathResource("template/qrcode/").getURL(); PdfGeneratorUtil.generatePdf("普通物料条码(整张)", html, baseUrl.toString(), response); } } - private String generateQRContent(DeliverNormalOrderItemDTO order,String indexNo){ - String content= StrUtil.format("{}${}${}${}${}${}${}${}" - , order.getPrintNo(), order.getExternalOrderNo(),order.getRowNo(),order.getMaterialNo(),order.getPrintNum() - ,order.getMaterialDesc(),order.getBatchNo(),Optional.ofNullable(indexNo).orElse("")); - log.debug("二维码内容:"+ content); + private String generateQRContent(DeliverNormalOrderItemDTO order, String indexNo) { + String content = StrUtil.format("{}${}${}${}${}${}${}${}" + , order.getPrintNo(), order.getExternalOrderNo(), order.getRowNo(), order.getMaterialNo(), order.getPrintNum() + , order.getMaterialDesc(), order.getBatchNo(), Optional.ofNullable(indexNo).orElse("")); + log.debug("二维码内容:" + content); return content; } @@ -371,10 +371,10 @@ public class InProduceOrderController extends BaseController { */ @Transactional @PostMapping("receive") - public ApiResult receive(@Valid @RequestBody InProduceOrderReceiveQO request){ + public ApiResult receive(@Valid @RequestBody InProduceOrderReceiveQO request) { WmsInProduceOrder order = produceOrderService.getByNo(request.getNo()); VUtil.trueThrowBusinessError(Objects.isNull(order)).throwMessage("订单不存在"); - VUtil.trueThrowBusinessError(!Objects.equals(order.getState(), (short)0)) + VUtil.trueThrowBusinessError(!Objects.equals(order.getState(), (short) 0)) .throwMessage("该订单非待收货状态"); List list = produceOrderItemService.getVOByOrderId(order.getId()); if (order.getList()) { @@ -392,7 +392,7 @@ public class InProduceOrderController extends BaseController { List materialNos = new ArrayList<>(); List records = new ArrayList<>(); List input1 = new ArrayList<>(); - list.forEach(it->{ + list.forEach(it -> { BigDecimal num = BigDecimal.ZERO; InProduceOrderReceiveMaterialQO materialQO = request.getItems().stream().filter(q -> StrUtil.equals(q.getMaterialNo(), it.getMaterialNo())).findFirst().orElse(null); if (Objects.isNull(materialQO)) { @@ -433,11 +433,13 @@ public class InProduceOrderController extends BaseController { materialNos.add(it.getMaterialNo()); } //是否更改了储位 - syncStorage(it, StrUtil.split(materialQO.getBinNos(), "/")); + if (Objects.isNull(materialQO.getBinNos())) { + syncStorage(it, StrUtil.split(materialQO.getBinNos(), "/")); + } } }); VUtil.trueThrowBusinessError(CollectionUtil.isNotEmpty(materialNos)) - .throwMessage("以下物料的扫码数量与收货数量不一致:"+StrUtil.join(",", materialNos)); + .throwMessage("以下物料的扫码数量与收货数量不一致:" + StrUtil.join(",", materialNos)); inventoryService.in(input1.stream().map(it -> new InventoryDTO() .setMaterialNo(request.getItems().get(0).getMaterialNo()) .setNum(it.getPSMNG()) @@ -450,7 +452,7 @@ public class InProduceOrderController extends BaseController { Zwm00Mb107DTO dto = sapService.zwm00_mb107(order.getOrderNo(), UserUtil.getUserName(), input1, null); order.setMblnr(dto.getE_MBLNR()); order.setMjahr(dto.getE_MJAHR()); - order.setState((short)1); + order.setState((short) 1); order.setUpdateBy(UserUtil.getUserName()); order.setUpdateTime(LocalDateTime.now()); produceOrderService.updateById(order); @@ -458,6 +460,9 @@ public class InProduceOrderController extends BaseController { } private void syncStorage(InProduceOrderItemVO it, Collection binNos) { + if(CollectionUtil.isEmpty(binNos)) + return; + produceOrderItemService.lambdaUpdate() .set(WmsInProduceOrderItem::getBinNos, StrUtil.join(",", binNos)) .eq(WmsInProduceOrderItem::getId, it.getId()) diff --git a/nflg-wms-admin/src/main/java/com/nflg/wms/admin/controller/NormalPGIController.java b/nflg-wms-admin/src/main/java/com/nflg/wms/admin/controller/NormalPGIController.java index 78912074..2b8a2a59 100644 --- a/nflg-wms-admin/src/main/java/com/nflg/wms/admin/controller/NormalPGIController.java +++ b/nflg-wms-admin/src/main/java/com/nflg/wms/admin/controller/NormalPGIController.java @@ -942,7 +942,7 @@ public class NormalPGIController extends BaseController { */ @PostMapping("unscan/task/confirm") @ApiMark(moduleName = "送货单管理", apiName = "普通物料任务上架确认") - public ApiResult takeDeliveryConfirm(@Valid @RequestBody ReceiveQO request) { + public ApiResult takeDeliveryConfirm(@Valid @RequestBody NormalReceiveQO request) { WmsPoReceipt wmsPoReceipt = wmsPoReceiptService.getById(request.getId()); VUtil.trueThrowBusinessError(Objects.isNull(wmsPoReceipt)).throwMessage("无此任务"); VUtil.trueThrowBusinessError(!wmsPoReceipt.getSourceType().equals(1)).throwMessage("不属于无码收货的采购单"); diff --git a/nflg-wms-admin/src/main/resources/template/qrcode/Inv-1.html b/nflg-wms-admin/src/main/resources/template/qrcode/Inv-1.html new file mode 100644 index 00000000..91afae03 --- /dev/null +++ b/nflg-wms-admin/src/main/resources/template/qrcode/Inv-1.html @@ -0,0 +1,61 @@ + + + + + 普通物料标签 + + + + + + + + + +
+ +
20250227100950-0
+
+
logo
+
SAP编码:
+
名称:
+
数量:
+
批次号:
+
+ + \ No newline at end of file diff --git a/nflg-wms-admin/src/main/resources/template/qrcode/Inv-2.html b/nflg-wms-admin/src/main/resources/template/qrcode/Inv-2.html new file mode 100644 index 00000000..6822d204 --- /dev/null +++ b/nflg-wms-admin/src/main/resources/template/qrcode/Inv-2.html @@ -0,0 +1,79 @@ + + + + + 普通物料标签 + + + + +
+
+ +
+
+
+ + + + + + + + + + + + + + + + +
+ +
20250227100950-0
+
SAP编码:
名称:
数量:
批次号:
+
+
+
+ + \ No newline at end of file diff --git a/nflg-wms-admin/src/main/resources/template/库存物料打印模版.xlsx b/nflg-wms-admin/src/main/resources/template/库存物料打印模版.xlsx new file mode 100644 index 00000000..04a0051d Binary files /dev/null and b/nflg-wms-admin/src/main/resources/template/库存物料打印模版.xlsx differ diff --git a/nflg-wms-common/src/main/java/com/nflg/wms/common/pojo/dto/BarcodePrintingAddDTO.java b/nflg-wms-common/src/main/java/com/nflg/wms/common/pojo/dto/BarcodePrintingAddDTO.java new file mode 100644 index 00000000..29760b8e --- /dev/null +++ b/nflg-wms-common/src/main/java/com/nflg/wms/common/pojo/dto/BarcodePrintingAddDTO.java @@ -0,0 +1,20 @@ +package com.nflg.wms.common.pojo.dto; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.nflg.wms.common.pojo.qo.BarcodePrintingAddQO; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import lombok.Data; +import org.ttzero.excel.annotation.ExcelColumn; + +import java.math.BigDecimal; + +@Data +public class BarcodePrintingAddDTO extends BarcodePrintingAddQO { + /** + * 错误信息 + */ + @JsonIgnore + @ExcelColumn("错误信息") + private String error; +} diff --git a/nflg-wms-common/src/main/java/com/nflg/wms/common/pojo/qo/BarcodePrintingAddQO.java b/nflg-wms-common/src/main/java/com/nflg/wms/common/pojo/qo/BarcodePrintingAddQO.java new file mode 100644 index 00000000..feca6ca2 --- /dev/null +++ b/nflg-wms-common/src/main/java/com/nflg/wms/common/pojo/qo/BarcodePrintingAddQO.java @@ -0,0 +1,59 @@ +package com.nflg.wms.common.pojo.qo; + +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import lombok.Data; +import org.ttzero.excel.annotation.ExcelColumn; + +import java.math.BigDecimal; + +@Data +public class BarcodePrintingAddQO { + + /** + * 物料编号 + */ + @NotBlank + @ExcelColumn("物料编号(*)") + private String materialNo; + + /** + * 物料描述 + */ + @NotBlank + @ExcelColumn("物料描述(*)") + private String materialDes; + + /** + * 单位 + */ + @NotBlank + @ExcelColumn("单位(*)") + private String unit; + + /** + * 数量 + */ + @NotNull + @ExcelColumn("数量(*)") + private BigDecimal qty; + + /** + * 批次号 + */ + @ExcelColumn("批次号") + private String batchNumber; + + /** + * 序列号,多个使用,号隔开 + */ + @ExcelColumn("序列号") + private String serialNumbers; + + /** + * 最小包装量 + */ + @NotNull + @ExcelColumn("最小包装量(*)") + private BigDecimal packingNum; +} diff --git a/nflg-wms-common/src/main/java/com/nflg/wms/common/pojo/qo/BarcodePrintingEditQO.java b/nflg-wms-common/src/main/java/com/nflg/wms/common/pojo/qo/BarcodePrintingEditQO.java new file mode 100644 index 00000000..eb49965a --- /dev/null +++ b/nflg-wms-common/src/main/java/com/nflg/wms/common/pojo/qo/BarcodePrintingEditQO.java @@ -0,0 +1,49 @@ +package com.nflg.wms.common.pojo.qo; + +import lombok.Data; +import lombok.experimental.Accessors; + +import java.math.BigDecimal; +import java.time.LocalDateTime; + +@Data +@Accessors(chain = true) +public class BarcodePrintingEditQO { + private Long id; + + /** + * 物料编号 + */ + private String materialNo; + + /** + * 物料描述 + */ + private String materialDes; + + /** + * 单位 + */ + private String unit; + + /** + * 数量 + */ + private BigDecimal qty; + + /** + * 批次号 + */ + private String batchNumber; + + /** + * 序列号,多个使用,号隔开 + */ + private String serialNumbers; + + /** + * 最小包装量 + */ + private BigDecimal packingNum; + +} diff --git a/nflg-wms-common/src/main/java/com/nflg/wms/common/pojo/qo/BarcodePrintingIdsQO.java b/nflg-wms-common/src/main/java/com/nflg/wms/common/pojo/qo/BarcodePrintingIdsQO.java new file mode 100644 index 00000000..c6293b8f --- /dev/null +++ b/nflg-wms-common/src/main/java/com/nflg/wms/common/pojo/qo/BarcodePrintingIdsQO.java @@ -0,0 +1,12 @@ +package com.nflg.wms.common.pojo.qo; + +import lombok.Data; +import lombok.experimental.Accessors; + +import java.util.List; + +@Data +@Accessors(chain = true) +public class BarcodePrintingIdsQO { + private List ids; +} diff --git a/nflg-wms-common/src/main/java/com/nflg/wms/common/pojo/qo/BarcodePrintingQO.java b/nflg-wms-common/src/main/java/com/nflg/wms/common/pojo/qo/BarcodePrintingQO.java new file mode 100644 index 00000000..643d2a9d --- /dev/null +++ b/nflg-wms-common/src/main/java/com/nflg/wms/common/pojo/qo/BarcodePrintingQO.java @@ -0,0 +1,26 @@ +package com.nflg.wms.common.pojo.qo; + +import lombok.Data; + +@Data +public class BarcodePrintingQO extends SearchBaseQO { + /** + * 物料编号,多个用逗号隔开 + */ + private String materialNos; + + /** + * 物料描述 + */ + private String materialDes; + + /** + * 批次号 多个用逗号隔开 + */ + private String batchNumbers; + + /** + * 序列号,单个输入 + */ + private String serialNumber; +} diff --git a/nflg-wms-common/src/main/java/com/nflg/wms/common/pojo/qo/InProduceOrderReceiveMaterialQO.java b/nflg-wms-common/src/main/java/com/nflg/wms/common/pojo/qo/InProduceOrderReceiveMaterialQO.java index a2865367..372f3bdc 100644 --- a/nflg-wms-common/src/main/java/com/nflg/wms/common/pojo/qo/InProduceOrderReceiveMaterialQO.java +++ b/nflg-wms-common/src/main/java/com/nflg/wms/common/pojo/qo/InProduceOrderReceiveMaterialQO.java @@ -18,7 +18,6 @@ public class InProduceOrderReceiveMaterialQO { /** * 储位编号列表 */ - @NotBlank private String binNos; /** diff --git a/nflg-wms-common/src/main/java/com/nflg/wms/common/pojo/qo/NormalReceiveQO.java b/nflg-wms-common/src/main/java/com/nflg/wms/common/pojo/qo/NormalReceiveQO.java new file mode 100644 index 00000000..4ac43bae --- /dev/null +++ b/nflg-wms-common/src/main/java/com/nflg/wms/common/pojo/qo/NormalReceiveQO.java @@ -0,0 +1,12 @@ +package com.nflg.wms.common.pojo.qo; + +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +import java.util.List; + +@Data +public class NormalReceiveQO { + @NotNull + private Long id; +} diff --git a/nflg-wms-common/src/main/java/com/nflg/wms/common/pojo/qo/ReceiveQO.java b/nflg-wms-common/src/main/java/com/nflg/wms/common/pojo/qo/ReceiveQO.java index 636a4ffc..2ddd1a1f 100644 --- a/nflg-wms-common/src/main/java/com/nflg/wms/common/pojo/qo/ReceiveQO.java +++ b/nflg-wms-common/src/main/java/com/nflg/wms/common/pojo/qo/ReceiveQO.java @@ -10,3 +10,4 @@ public class ReceiveQO { @NotNull private List ids; } + diff --git a/nflg-wms-common/src/main/java/com/nflg/wms/common/pojo/vo/BarcodePrintingVO.java b/nflg-wms-common/src/main/java/com/nflg/wms/common/pojo/vo/BarcodePrintingVO.java new file mode 100644 index 00000000..1dd8ddc4 --- /dev/null +++ b/nflg-wms-common/src/main/java/com/nflg/wms/common/pojo/vo/BarcodePrintingVO.java @@ -0,0 +1,68 @@ +package com.nflg.wms.common.pojo.vo; + +import lombok.Data; +import lombok.experimental.Accessors; + +import java.math.BigDecimal; +import java.time.LocalDateTime; + +@Data +@Accessors(chain = true) +public class BarcodePrintingVO { + private Long id; + + /** + * 物料编号 + */ + private String materialNo; + + /** + * 物料描述 + */ + private String materialDes; + + /** + * 单位 + */ + private String unit; + + /** + * 数量 + */ + private BigDecimal qty; + + /** + * 批次号 + */ + private String batchNumber; + + /** + * 序列号,多个使用,号隔开 + */ + private String serialNumbers; + + /** + * 最小包装量 + */ + private BigDecimal packingNum; + + /** + * 创建人 + */ + private String createBy; + + /** + * 创建时间 + */ + private LocalDateTime createTime; + + /** + * 最后更新人 + */ + private String updateBy; + + /** + * 最后更新时间 + */ + private LocalDateTime updateTime; +} diff --git a/nflg-wms-repository/src/main/java/com/nflg/wms/repository/entity/WmsInventoryBarcodePrinting.java b/nflg-wms-repository/src/main/java/com/nflg/wms/repository/entity/WmsInventoryBarcodePrinting.java new file mode 100644 index 00000000..31fb84e2 --- /dev/null +++ b/nflg-wms-repository/src/main/java/com/nflg/wms/repository/entity/WmsInventoryBarcodePrinting.java @@ -0,0 +1,92 @@ +package com.nflg.wms.repository.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +/** + *

+ * + *

+ * + * @author 代码生成器生成 + * @since 2025 + */ +@Getter +@Setter +@ToString +@Accessors(chain = true) +@TableName("wms_inventory_barcode_printing") +public class WmsInventoryBarcodePrinting implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 序号 + */ + @TableId(value = "id", type = IdType.ASSIGN_ID) + private Long id; + + /** + * 物料编号 + */ + private String materialNo; + + /** + * 物料描述 + */ + private String materialDes; + + /** + * 单位 + */ + private String unit; + + /** + * 数量 + */ + private BigDecimal qty; + + /** + * 批次号 + */ + private String batchNumber; + + /** + * 序列号,多个使用,号隔开 + */ + private String serialNumbers; + + /** + * 最小包装量 + */ + private BigDecimal packingNum; + + /** + * 创建人 + */ + private String createBy; + + /** + * 创建时间 + */ + private LocalDateTime createTime; + + /** + * 最后更新人 + */ + private String updateBy; + + /** + * 最后更新时间 + */ + private LocalDateTime updateTime; +} diff --git a/nflg-wms-repository/src/main/java/com/nflg/wms/repository/mapper/WmsInventoryBarcodePrintingMapper.java b/nflg-wms-repository/src/main/java/com/nflg/wms/repository/mapper/WmsInventoryBarcodePrintingMapper.java new file mode 100644 index 00000000..28351788 --- /dev/null +++ b/nflg-wms-repository/src/main/java/com/nflg/wms/repository/mapper/WmsInventoryBarcodePrintingMapper.java @@ -0,0 +1,22 @@ +package com.nflg.wms.repository.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.nflg.wms.common.pojo.qo.BarcodePrintingQO; +import com.nflg.wms.common.pojo.qo.SRMOrderSearchQO; +import com.nflg.wms.common.pojo.vo.BarcodePrintingVO; +import com.nflg.wms.common.pojo.vo.SrmOrderVO; +import com.nflg.wms.repository.entity.WmsInventoryBarcodePrinting; + +/** + *

+ * Mapper 接口 + *

+ * + * @author 代码生成器生成 + * @since 2025 + */ +public interface WmsInventoryBarcodePrintingMapper extends BaseMapper { + IPage search(BarcodePrintingQO request, Page objectPage); +} diff --git a/nflg-wms-repository/src/main/java/com/nflg/wms/repository/service/IWmsInventoryBarcodePrintingService.java b/nflg-wms-repository/src/main/java/com/nflg/wms/repository/service/IWmsInventoryBarcodePrintingService.java new file mode 100644 index 00000000..922ba3e3 --- /dev/null +++ b/nflg-wms-repository/src/main/java/com/nflg/wms/repository/service/IWmsInventoryBarcodePrintingService.java @@ -0,0 +1,21 @@ +package com.nflg.wms.repository.service; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.nflg.wms.common.pojo.qo.BarcodePrintingQO; +import com.nflg.wms.common.pojo.vo.BarcodePrintingVO; +import com.nflg.wms.repository.entity.WmsInventoryBarcodePrinting; +import com.baomidou.mybatisplus.extension.service.IService; +import jakarta.validation.Valid; + +/** + *

+ * 服务类 + *

+ * + * @author 代码生成器生成 + * @since 2025 + */ +public interface IWmsInventoryBarcodePrintingService extends IService { + + IPage search(@Valid BarcodePrintingQO request); +} diff --git a/nflg-wms-repository/src/main/java/com/nflg/wms/repository/service/impl/WmsInventoryBarcodePrintingServiceImpl.java b/nflg-wms-repository/src/main/java/com/nflg/wms/repository/service/impl/WmsInventoryBarcodePrintingServiceImpl.java new file mode 100644 index 00000000..015b9bf9 --- /dev/null +++ b/nflg-wms-repository/src/main/java/com/nflg/wms/repository/service/impl/WmsInventoryBarcodePrintingServiceImpl.java @@ -0,0 +1,28 @@ +package com.nflg.wms.repository.service.impl; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.nflg.wms.common.pojo.qo.BarcodePrintingQO; +import com.nflg.wms.common.pojo.vo.BarcodePrintingVO; +import com.nflg.wms.repository.entity.WmsInventoryBarcodePrinting; +import com.nflg.wms.repository.mapper.WmsInventoryBarcodePrintingMapper; +import com.nflg.wms.repository.service.IWmsInventoryBarcodePrintingService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author 代码生成器生成 + * @since 2025 + */ +@Service +public class WmsInventoryBarcodePrintingServiceImpl extends ServiceImpl implements IWmsInventoryBarcodePrintingService { + + @Override + public IPage search(BarcodePrintingQO request) { + return baseMapper.search(request, new Page<>(request.getPage(), request.getPageSize())); + } +} diff --git a/nflg-wms-repository/src/main/resources/mapper/WmsInventoryBarcodePrintingMapper.xml b/nflg-wms-repository/src/main/resources/mapper/WmsInventoryBarcodePrintingMapper.xml new file mode 100644 index 00000000..75a305d7 --- /dev/null +++ b/nflg-wms-repository/src/main/resources/mapper/WmsInventoryBarcodePrintingMapper.xml @@ -0,0 +1,52 @@ + + + + + + diff --git a/nflg-wms-repository/src/test/java/com/nflg/wms/repository/CodeGeneratorTest.java b/nflg-wms-repository/src/test/java/com/nflg/wms/repository/CodeGeneratorTest.java index 2914428b..35eae3d8 100644 --- a/nflg-wms-repository/src/test/java/com/nflg/wms/repository/CodeGeneratorTest.java +++ b/nflg-wms-repository/src/test/java/com/nflg/wms/repository/CodeGeneratorTest.java @@ -33,7 +33,7 @@ public class CodeGeneratorTest { ) .strategyConfig(builder -> { builder - .addInclude("user_supplier") //只生成指定表 + .addInclude("wms_inventory_barcode_printing") //只生成指定表 .entityBuilder().idType(IdType.ASSIGN_ID) .enableLombok() .enableChainModel()