diff --git a/src/main/java/com/glxp/api/controller/purchase/PurOrderPrintController.java b/src/main/java/com/glxp/api/controller/purchase/PurOrderPrintController.java index 13825326..f5ff1ca6 100644 --- a/src/main/java/com/glxp/api/controller/purchase/PurOrderPrintController.java +++ b/src/main/java/com/glxp/api/controller/purchase/PurOrderPrintController.java @@ -9,16 +9,29 @@ import com.alibaba.fastjson.serializer.SerializerFeature; import com.glxp.api.annotation.AuthRuleAnnotation; import com.glxp.api.common.enums.ResultEnum; import com.glxp.api.common.util.ResultVOUtils; +import com.glxp.api.constant.Constant; +import com.glxp.api.constant.ConstantStatus; import com.glxp.api.entity.system.SysPdfTemplateRelevanceBizEntity; import com.glxp.api.entity.system.SystemPDFTemplateEntity; import com.glxp.api.exception.JsonException; import com.glxp.api.req.inout.FilterReceiveDetailRequest; import com.glxp.api.req.inout.FilterReceiveRequest; import com.glxp.api.req.inout.PurOrderPrintRequest; +import com.glxp.api.req.purchase.PurApplyDetailRequest; +import com.glxp.api.req.purchase.PurApplyRequest; +import com.glxp.api.req.purchase.PurOrderDetailRequest; +import com.glxp.api.req.purchase.PurOrderRequest; import com.glxp.api.res.inout.ReceiveDetailResponse; import com.glxp.api.res.inout.ReceiveResponse; +import com.glxp.api.res.purchase.PurApplyResponse; +import com.glxp.api.res.purchase.PurOrderDetailResponse; +import com.glxp.api.res.purchase.PurOrderResponse; import com.glxp.api.service.inout.impl.ReceiveDetailService; import com.glxp.api.service.inout.impl.ReceiveService; +import com.glxp.api.service.purchase.PurOrderService; +import com.glxp.api.service.purchase.impl.PurApplyDetailService; +import com.glxp.api.service.purchase.impl.PurApplyService; +import com.glxp.api.service.purchase.impl.PurOrderDetailService; import com.glxp.api.service.system.SystemPDFTemplateRelevanceBizService; import com.glxp.api.service.system.SystemPDFTemplateService; import com.glxp.api.util.IntUtil; @@ -56,6 +69,15 @@ public class PurOrderPrintController { @Resource ReceiveDetailService receivedetailService; + @Resource + PurApplyService purApplyService; + @Resource + PurApplyDetailService purApplyDetailService; + @Resource + PurOrderService purOrderService; + @Resource + PurOrderDetailService purOrderDetailService; + /** * 领用单单据打印 * @@ -126,4 +148,150 @@ public class PurOrderPrintController { } + /** + * 申购单打印 + * + * @param request + * @param response + * @throws Exception + */ + @AuthRuleAnnotation("") + @PostMapping("/pur/apply/order/printOrder") + public void printApplyOrder(@RequestBody PurOrderPrintRequest purOrderPrintRequest, HttpServletRequest request, HttpServletResponse response) throws Exception { + PurApplyRequest purApplyRequest = new PurApplyRequest(); + purApplyRequest.setBillNo(purOrderPrintRequest.getBillNo()); + List purApplyResponses = purApplyService.queryPageList(purApplyRequest); + PurApplyResponse purApplyResponse = purApplyResponses.get(0); + if (purApplyResponse == null) { + throw new JsonException(500, "单据未找到!"); + } + SysPdfTemplateRelevanceBizEntity sysPdfTemplateRelevanceBizEntity; + if (IntUtil.value(purApplyResponse.getStatus()) == 3) { + sysPdfTemplateRelevanceBizEntity = systemPDFTemplateRelevanceBizService.findByModuleKey("bizAlready", ConstantStatus.BUS_ORDER_CPSG); + } else { + sysPdfTemplateRelevanceBizEntity = systemPDFTemplateRelevanceBizService.findByModuleKey("bizlWait", ConstantStatus.BUS_ORDER_CPSG); + } + SystemPDFTemplateEntity systemPDFTemplateEntity = systemPDFTemplateService.selectById(sysPdfTemplateRelevanceBizEntity.getTemplateId() + ""); + if (systemPDFTemplateEntity == null) + throw new JsonException(500, "未设置模板!"); + //打印单号标签 + Map data = new HashMap<>(1); + List list = new ArrayList<>(); + PurApplyDetailRequest purApplyDetailRequest = new PurApplyDetailRequest(); + purApplyDetailRequest.setOrderIdFk(purOrderPrintRequest.getBillNo()); + List responseList = purApplyDetailService.joinQueryList(purApplyDetailRequest); + int i = 1; + if (CollUtil.isNotEmpty(responseList)) { + for (PurOrderDetailResponse obj : responseList) { + Map supData = new HashMap<>(); + supData.put("billNo", purApplyResponse.getBillNo()); + supData.put("deptName", purApplyResponse.getDeptName()); + supData.put("deptCode", purApplyResponse.getDeptCode()); + supData.put("invName", purApplyResponse.getInvName()); + supData.put("invCode", purApplyResponse.getInvCode()); + supData.put("targetDeptName", purApplyResponse.getTargetDeptName()); + supData.put("targetDeptCode", purApplyResponse.getTargetInvCode()); + supData.put("targetInvName", purApplyResponse.getTargetInvName()); + supData.put("targetInvCode", purApplyResponse.getTargetInvCode()); + supData.put("createUserName", purApplyResponse.getCreateByName()); + supData.put("auditUserName", purApplyResponse.getAuditByName()); + supData.put("billDate", MsDateUtil.formatDate(purApplyResponse.getBillDate(), "yyyy-MM-dd")); + supData.put("auditTime", MsDateUtil.formatDate(purApplyResponse.getAuditTime(), "yyyy-MM-dd")); + + supData.put("count", obj.getCount()); + supData.put("cpmctymc", obj.getProductName()); + supData.put("ggxh", obj.getSpec()); + supData.put("manufactory", obj.getManufactory()); + supData.put("measname", obj.getMeasname() == null ? "" : obj.getMeasname()); + supData.put("nameCode", obj.getNameCode()); + supData.put("price", obj.getPrice() == null ? "" : obj.getPrice()); + supData.put("supName", obj.getSupName()); + supData.put("ylqxzcrbarmc", obj.getYlqxzcrbarmc()); + supData.put("zczbhhzbapzbh", obj.getZczbhhzbapzbh()); + list.add(supData); + i++; + } + } + data.put("data", list); + String param = JSONObject.toJSONString(data, SerializerFeature.WriteMapNullValue); + JasperUtils.jasperReport(request, response, param, filePath + "pdf/template/" + systemPDFTemplateEntity.getPath(), "pdf"); + } + + + /** + * 采购订单打印 + * + * @param request + * @param response + * @throws Exception + */ + @AuthRuleAnnotation("") + @PostMapping("/pur/purchase/order/printOrder") + public void printPurchaseOrder(@RequestBody PurOrderPrintRequest purOrderPrintRequest, HttpServletRequest request, HttpServletResponse response) throws Exception { + PurOrderRequest purOrderRequest = new PurOrderRequest(); + purOrderRequest.setBillNo(purOrderPrintRequest.getBillNo()); + List purOrderResponses = purOrderService.queryPageList(purOrderRequest); + PurOrderResponse purOrderResponse = purOrderResponses.get(0); + if (purOrderResponse == null) { + throw new JsonException(500, "单据未找到!"); + } + SysPdfTemplateRelevanceBizEntity sysPdfTemplateRelevanceBizEntity; + if (IntUtil.value(purOrderResponse.getStatus()) == 3) { + sysPdfTemplateRelevanceBizEntity = systemPDFTemplateRelevanceBizService.findByModuleKey("bizAlready", ConstantStatus.BUS_ORDER_CGDD); + } else { + sysPdfTemplateRelevanceBizEntity = systemPDFTemplateRelevanceBizService.findByModuleKey("bizlWait", ConstantStatus.BUS_ORDER_CGDD); + } + SystemPDFTemplateEntity systemPDFTemplateEntity = systemPDFTemplateService.selectById(sysPdfTemplateRelevanceBizEntity.getTemplateId() + ""); + if (systemPDFTemplateEntity == null) + throw new JsonException(500, "未设置模板!"); + //打印单号标签 + Map data = new HashMap<>(1); + List list = new ArrayList<>(); + PurOrderDetailRequest purOrderDetailRequest = new PurOrderDetailRequest(); + purOrderDetailRequest.setOrderIdFk(purOrderPrintRequest.getBillNo()); + List responseList = purOrderDetailService.joinQueryList(purOrderDetailRequest); + int i = 1; + if (CollUtil.isNotEmpty(responseList)) { + for (PurOrderDetailResponse obj : responseList) { + Map supData = new HashMap<>(); + supData.put("billNo", purOrderResponse.getBillNo()); + supData.put("deptName", purOrderResponse.getDeptName()); + supData.put("deptCode", purOrderResponse.getDeptCode()); + supData.put("invName", purOrderResponse.getInvName()); + supData.put("invCode", purOrderResponse.getInvCode()); + supData.put("supName", purOrderResponse.getSupName()); + supData.put("applyInvName", purOrderResponse.getApplyInvName()); + supData.put("applyCreateBy", purOrderResponse.getApplyCreateBy()); + supData.put("auditUserName", purOrderResponse.getAuditUserName()); + supData.put("billDate", MsDateUtil.formatDate(purOrderResponse.getBillDate(), "yyyy-MM-dd")); + supData.put("auditTime", MsDateUtil.formatDate(purOrderResponse.getAuditTime(), "yyyy-MM-dd")); + supData.put("arrivalTime", MsDateUtil.formatDate(purOrderResponse.getArrivalTime(), "yyyy-MM-dd")); + if (IntUtil.value(purOrderResponse.getEmergency()) == 2) { + supData.put("emergency", "较急"); + } else if (IntUtil.value(purOrderResponse.getEmergency()) == 3) { + supData.put("emergency", "特急"); + } else { + supData.put("emergency", "正常"); + } + supData.put("emergency", MsDateUtil.formatDate(purOrderResponse.getArrivalTime(), "yyyy-MM-dd")); + supData.put("count", obj.getCount()); + supData.put("cpmctymc", obj.getProductName()); + supData.put("ggxh", obj.getSpec()); + supData.put("manufactory", obj.getManufactory()); + supData.put("measname", obj.getMeasname() == null ? "" : obj.getMeasname()); + supData.put("nameCode", obj.getNameCode()); + supData.put("price", obj.getPrice() == null ? "" : obj.getPrice()); + supData.put("supName", obj.getSupName()); + supData.put("ylqxzcrbarmc", obj.getYlqxzcrbarmc()); + supData.put("zczbhhzbapzbh", obj.getZczbhhzbapzbh()); + list.add(supData); + i++; + } + } + data.put("data", list); + String param = JSONObject.toJSONString(data, SerializerFeature.WriteMapNullValue); + JasperUtils.jasperReport(request, response, param, filePath + "pdf/template/" + systemPDFTemplateEntity.getPath(), "pdf"); + } + + } diff --git a/src/main/resources/mybatis/mapper/inv/InvPreProductDao.xml b/src/main/resources/mybatis/mapper/inv/InvPreProductDao.xml index e3b8d08c..a9298f6f 100644 --- a/src/main/resources/mybatis/mapper/inv/InvPreProductDao.xml +++ b/src/main/resources/mybatis/mapper/inv/InvPreProductDao.xml @@ -31,7 +31,6 @@ left join auth_dept on auth_dept.code = ipp.deptCode left join auth_warehouse on auth_warehouse.code = ipp.invCode - bp.diType = 1 AND bp.cpmctymc like concat('%', #{cpmctymc}, '%') diff --git a/src/main/resources/mybatis/mapper/inv/invProductDao.xml b/src/main/resources/mybatis/mapper/inv/invProductDao.xml index 755be476..b62a043a 100644 --- a/src/main/resources/mybatis/mapper/inv/invProductDao.xml +++ b/src/main/resources/mybatis/mapper/inv/invProductDao.xml @@ -36,7 +36,6 @@ left join auth_warehouse on auth_warehouse.code = ip.invCode left join auth_space `as` on ip.invSpaceCode = `as`.code - bp.diType = 1 AND bp.cpmctymc like concat('%', #{cpmctymc}, '%')