diff --git a/src/main/java/com/glxp/api/controller/basic/BasicOrderPrintController.java b/src/main/java/com/glxp/api/controller/basic/BasicOrderPrintController.java index 75ae9c7b..d570debd 100644 --- a/src/main/java/com/glxp/api/controller/basic/BasicOrderPrintController.java +++ b/src/main/java/com/glxp/api/controller/basic/BasicOrderPrintController.java @@ -15,6 +15,7 @@ import com.glxp.api.entity.system.SystemPDFTemplateEntity; import com.glxp.api.req.basic.FilterOrderPrintRequest; import com.glxp.api.req.inout.FilterOrderRequest; import com.glxp.api.res.basic.UdiRelevanceResponse; +import com.glxp.api.res.inout.IoOrderDetailCodeResponse; import com.glxp.api.res.inout.IoOrderResponse; import com.glxp.api.service.basic.IBasicBussinessTypeService; import com.glxp.api.service.basic.UdiProductService; @@ -22,10 +23,8 @@ import com.glxp.api.service.basic.UdiRelevanceService; import com.glxp.api.service.inout.IoOrderDetailBizService; import com.glxp.api.service.inout.IoOrderService; import com.glxp.api.service.inout.impl.IoCodeService; -import com.glxp.api.service.system.SystemPDFModuleService; -import com.glxp.api.service.system.SystemPDFTemplateRelevanceCodeService; -import com.glxp.api.service.system.SystemPDFTemplateRelevanceService; -import com.glxp.api.service.system.SystemPDFTemplateService; +import com.glxp.api.service.system.*; +import com.glxp.api.util.IntUtil; import com.glxp.api.util.JasperUtils; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Value; @@ -38,6 +37,7 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.text.SimpleDateFormat; import java.util.*; +import java.util.stream.Collectors; @Slf4j @RestController @@ -65,6 +65,8 @@ public class BasicOrderPrintController { UdiRelevanceService udiRelevanceService; @Resource SystemPDFTemplateRelevanceCodeService systemPDFTemplateRelevanceCodeService; + @Resource + SystemParamConfigService systemParamConfigService; //校验模板是否正确 @AuthRuleAnnotation("") @@ -98,7 +100,7 @@ public class BasicOrderPrintController { Map data = new HashMap<>(1); List list = new ArrayList<>(); SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");//定义新的日期格式 - + String value = systemParamConfigService.selectValueByParamKey("order_detail_visible"); //查询打印格式 BasicBussinessTypeEntity basicBussinessTypeEntity = basicBussinessTypeService.findByAction(filterOrderPrintRequest.getAction()); //根据批次号打印 @@ -109,6 +111,11 @@ public class BasicOrderPrintController { IoOrderResponse ioOrderResponse = ioOrderService.filterList(filterOrderRequest).get(0); //查询业务单详情 List ioOrderDetailBizEntityList = ioOrderDetailBizService.findByOrderId(filterOrderPrintRequest.getOrderIdFk()); + if (IntUtil.value(value) == 1) { + ioOrderDetailBizEntityList = ioOrderDetailBizEntityList.stream() + .sorted(Comparator.comparing(IoOrderDetailBizEntity::getNameCode)) + .collect(Collectors.toList()); + } int i = 1; if (ioOrderDetailBizEntityList != null && ioOrderDetailBizEntityList.size() > 0) { for (IoOrderDetailBizEntity obj : ioOrderDetailBizEntityList) { @@ -162,6 +169,12 @@ public class BasicOrderPrintController { IoOrderResponse ioOrderResponse = ioOrderService.filterList(filterOrderRequest).get(0); //查询扫码单详情 List ioCodeEntityList = ioCodeService.findByOrderId(filterOrderPrintRequest.getOrderIdFk()); + + if (IntUtil.value(value) == 1) { + ioCodeEntityList = ioCodeEntityList.stream() + .sorted(Comparator.comparing(IoCodeEntity::getNameCode)) + .collect(Collectors.toList()); + } //查询业务单据表 List ioOrderDetailBizEntityList = ioOrderDetailBizService.findByOrderId(filterOrderPrintRequest.getOrderIdFk()); int i = 1; @@ -221,8 +234,6 @@ public class BasicOrderPrintController { } } } - - data.put("data", list); String param = JSON.toJSONString(data); JasperUtils.jasperReport(request, response, param, filePath + "/pdf/template/" + systemPDFTemplateEntity.getPath(), "pdf"); diff --git a/src/main/java/com/glxp/api/controller/inout/IoOrderDetailBizController.java b/src/main/java/com/glxp/api/controller/inout/IoOrderDetailBizController.java index 99161ff9..4c38c28e 100644 --- a/src/main/java/com/glxp/api/controller/inout/IoOrderDetailBizController.java +++ b/src/main/java/com/glxp/api/controller/inout/IoOrderDetailBizController.java @@ -67,6 +67,7 @@ import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; import java.math.BigDecimal; import java.util.*; +import java.util.stream.Collectors; /** * 单据业务详情 @@ -551,6 +552,12 @@ public class IoOrderDetailBizController extends BaseController { @GetMapping("/udiwms/inout/bizDetail/filterList") public BaseResponse filterList(FilterOrderDetailBizRequest orderDetailBizRequest) { List list = orderDetailBizService.filterList(orderDetailBizRequest); + String value = systemParamConfigService.selectValueByParamKey("order_detail_visible"); + if (IntUtil.value(value) == 1) { + list = list.stream() + .sorted(Comparator.comparing(IoOrderDetailBizResponse::getNameCode)) + .collect(Collectors.toList()); + } List orderDetailCodeEntities = orderDetailCodeService.findByOrderId(orderDetailBizRequest.getOrderIdFk()); ioCheckInoutService.bizOrderCheck2(list, orderDetailCodeEntities); PageInfo pageInfo = new PageInfo<>(list); diff --git a/src/main/java/com/glxp/api/controller/inout/IoOrderDetailCodeController.java b/src/main/java/com/glxp/api/controller/inout/IoOrderDetailCodeController.java index 766a0110..844f3492 100644 --- a/src/main/java/com/glxp/api/controller/inout/IoOrderDetailCodeController.java +++ b/src/main/java/com/glxp/api/controller/inout/IoOrderDetailCodeController.java @@ -10,17 +10,22 @@ import com.glxp.api.entity.inout.IoOrderDetailBizEntity; import com.glxp.api.entity.inout.IoOrderDetailCodeEntity; import com.glxp.api.req.inout.FilterOrderDetailCodeRequest; import com.glxp.api.res.PageSimpleResponse; +import com.glxp.api.res.inout.IoOrderDetailBizResponse; import com.glxp.api.res.inout.IoOrderDetailCodeResponse; import com.glxp.api.service.inout.IoCheckInoutService; import com.glxp.api.service.inout.IoOrderDetailBizService; import com.glxp.api.service.inout.IoOrderDetailCodeService; +import com.glxp.api.service.system.SystemParamConfigService; +import com.glxp.api.util.IntUtil; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; +import java.util.Comparator; import java.util.List; +import java.util.stream.Collectors; /** * 单据扫码详情接口 @@ -34,7 +39,8 @@ public class IoOrderDetailCodeController { private IoCheckInoutService ioCheckInoutService; @Resource private IoOrderDetailBizService orderDetailBizService; - + @Resource + SystemParamConfigService systemParamConfigService; //获取新增扫码单据详情---临时接口查询 @AuthRuleAnnotation("") @@ -58,6 +64,12 @@ public class IoOrderDetailCodeController { @GetMapping("udiwms/inout/codeDetail/filterList") public BaseResponse filterList(FilterOrderDetailCodeRequest detailCodeRequest) { List list = ioOrderDetailCodeService.filterList(detailCodeRequest); + String value = systemParamConfigService.selectValueByParamKey("order_detail_visible"); + if (IntUtil.value(value) == 1) { + list = list.stream() + .sorted(Comparator.comparing(IoOrderDetailCodeResponse::getNameCode)) + .collect(Collectors.toList()); + } List orderDetailBizEntities = orderDetailBizService.findByOrderId(detailCodeRequest.getOrderIdFk()); ioCheckInoutService.codeOrderCheck2(list, orderDetailBizEntities); PageInfo pageInfo = new PageInfo<>(list); diff --git a/src/main/java/com/glxp/api/controller/inout/IoOrderDetailResultController.java b/src/main/java/com/glxp/api/controller/inout/IoOrderDetailResultController.java index 2def07c6..99f7973a 100644 --- a/src/main/java/com/glxp/api/controller/inout/IoOrderDetailResultController.java +++ b/src/main/java/com/glxp/api/controller/inout/IoOrderDetailResultController.java @@ -1,5 +1,6 @@ package com.glxp.api.controller.inout; +import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.StrUtil; @@ -23,6 +24,7 @@ import com.glxp.api.req.inout.*; import com.glxp.api.res.inout.CptTraceOrderResponse; import com.glxp.api.res.inout.CptTraceResultResponse; import com.glxp.api.res.inout.IoOrderDetailResultResponse; +import com.glxp.api.res.inout.IoOrderDetailVo; import com.glxp.api.service.auth.CustomerService; import com.glxp.api.service.basic.IBasicBussinessTypeService; import com.glxp.api.service.inout.*; @@ -32,6 +34,7 @@ import com.glxp.api.service.system.CompanyService; import com.glxp.api.service.system.SystemPDFModuleService; import com.glxp.api.service.system.SystemPDFTemplateService; import com.glxp.api.service.thrsys.ThrProductsService; +import com.glxp.api.util.BeanCopyUtils; import com.glxp.api.util.JasperUtils; import com.glxp.api.util.MsDateUtil; import net.sf.jasperreports.engine.JRException; @@ -142,13 +145,13 @@ public class IoOrderDetailResultController extends BaseController { public void exportTemplate(FilterOrderDetailResultRequest orderDetailResultRequest, HttpServletResponse response) throws IOException { // 模拟数据库获取数据 List list = getOrderResult(orderDetailResultRequest); - + List orderDetailVos = BeanUtil.copyToList(list, IoOrderDetailVo.class); response.setCharacterEncoding(StandardCharsets.UTF_8.name()); response.setHeader("content-Type", "application/vnd.ms-excel"); response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("出入库明细" + DateUtil.format(new Date(), "yyyy-MM-dd") + ".xlsx", StandardCharsets.UTF_8.name())); - EasyExcel.write(response.getOutputStream(), IoOrderDetailResultResponse.class).sheet().doWrite(list); + EasyExcel.write(response.getOutputStream(), IoOrderDetailResultResponse.class).sheet().doWrite(orderDetailVos); } @@ -156,13 +159,13 @@ public class IoOrderDetailResultController extends BaseController { public void selectExportExcel(@RequestBody FilterOrderDetailResultRequest orderDetailResultRequest, HttpServletResponse response) throws IOException { // 模拟数据库获取数据 List list = getOrderResult(orderDetailResultRequest); - + List orderDetailVos = BeanUtil.copyToList(list, IoOrderDetailVo.class); response.setCharacterEncoding(StandardCharsets.UTF_8.name()); response.setHeader("content-Type", "application/vnd.ms-excel"); response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("出入库明细" + DateUtil.format(new Date(), "yyyy-MM-dd") + ".xlsx", StandardCharsets.UTF_8.name())); - EasyExcel.write(response.getOutputStream(), IoOrderDetailResultResponse.class).sheet().doWrite(list); + EasyExcel.write(response.getOutputStream(), IoOrderDetailResultResponse.class).sheet().doWrite(orderDetailVos); } diff --git a/src/main/java/com/glxp/api/res/inout/IoOrderDetailVo.java b/src/main/java/com/glxp/api/res/inout/IoOrderDetailVo.java new file mode 100644 index 00000000..91470516 --- /dev/null +++ b/src/main/java/com/glxp/api/res/inout/IoOrderDetailVo.java @@ -0,0 +1,81 @@ +package com.glxp.api.res.inout; + +import com.alibaba.excel.annotation.ExcelProperty; +import lombok.Data; + +import java.util.Date; + +@Data +public class IoOrderDetailVo { + + @ExcelProperty(value = "出入库单号", index = 1) + private String orderIdFk; + + /** + * DI + */ + @ExcelProperty(value = "DI/物资编码", index = 2) + private String nameCode; + + /** + * 批次号 + */ + @ExcelProperty(value = "批次号", index = 5) + private String batchNo; + + /** + * 生产日期 + */ + @ExcelProperty(value = "生产日期", index = 10) + private String productDate; + + /** + * 失效日期 + */ + @ExcelProperty(value = "失效日期", index = 11) + private String expireDate; + + /** + * 产品通用名称 + */ + @ExcelProperty(value = "物资名称", index = 3) + private String coName; + + /** + * 注册证号 + */ + @ExcelProperty(value = "注册/备案号", index = 14) + private String certCode; + + /** + * 生产企业 + */ + @ExcelProperty(value = "生产企业", index = 13) + private String manufacturer; + + /** + * 计量单位 + */ + @ExcelProperty(value = "计量单位", index = 8) + private String measname; + + /** + * 规格型号 + */ + @ExcelProperty(value = "规格型号", index = 4) + private String spec; + + @ExcelProperty(value = "入库数量", index = 6) + private Integer inCount; + @ExcelProperty(value = "出库数量", index = 7) + private Integer outCount; + + @ExcelProperty(value = "单据类型", index = 9) + private String billTypeName; + @ExcelProperty(value = "出入库时间", index = 12) + private Date auditTime; + @ExcelProperty(value = "往来单位", index = 0) + private String fromName; + + +} diff --git a/src/main/resources/mybatis/mapper/inv/invProductDao.xml b/src/main/resources/mybatis/mapper/inv/invProductDao.xml index 98ae6bb0..755be476 100644 --- a/src/main/resources/mybatis/mapper/inv/invProductDao.xml +++ b/src/main/resources/mybatis/mapper/inv/invProductDao.xml @@ -41,7 +41,7 @@ AND bp.cpmctymc like concat('%', #{cpmctymc}, '%') - AND ip.nameCode like concat('%', #{nameCode}, '%') + AND bp.nameCode like concat('%', #{nameCode}, '%') AND ip.relIdFk = #{relIdFk}