|
|
|
@ -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<PurApplyResponse> 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<String, Object> data = new HashMap<>(1);
|
|
|
|
|
List<Object> list = new ArrayList<>();
|
|
|
|
|
PurApplyDetailRequest purApplyDetailRequest = new PurApplyDetailRequest();
|
|
|
|
|
purApplyDetailRequest.setOrderIdFk(purOrderPrintRequest.getBillNo());
|
|
|
|
|
List<PurOrderDetailResponse> responseList = purApplyDetailService.joinQueryList(purApplyDetailRequest);
|
|
|
|
|
int i = 1;
|
|
|
|
|
if (CollUtil.isNotEmpty(responseList)) {
|
|
|
|
|
for (PurOrderDetailResponse obj : responseList) {
|
|
|
|
|
Map<String, Object> 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<PurOrderResponse> 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<String, Object> data = new HashMap<>(1);
|
|
|
|
|
List<Object> list = new ArrayList<>();
|
|
|
|
|
PurOrderDetailRequest purOrderDetailRequest = new PurOrderDetailRequest();
|
|
|
|
|
purOrderDetailRequest.setOrderIdFk(purOrderPrintRequest.getBillNo());
|
|
|
|
|
List<PurOrderDetailResponse> responseList = purOrderDetailService.joinQueryList(purOrderDetailRequest);
|
|
|
|
|
int i = 1;
|
|
|
|
|
if (CollUtil.isNotEmpty(responseList)) {
|
|
|
|
|
for (PurOrderDetailResponse obj : responseList) {
|
|
|
|
|
Map<String, Object> 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");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|