|
|
|
@ -1,14 +1,35 @@
|
|
|
|
|
package com.glxp.api.controller.inv;
|
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
|
|
import com.glxp.api.annotation.AuthRuleAnnotation;
|
|
|
|
|
import com.glxp.api.common.enums.ResultEnum;
|
|
|
|
|
import com.glxp.api.common.res.BaseResponse;
|
|
|
|
|
import com.glxp.api.common.util.ResultVOUtils;
|
|
|
|
|
import com.glxp.api.constant.FileConstant;
|
|
|
|
|
import com.glxp.api.dao.schedule.SystemParamConfigDao;
|
|
|
|
|
import com.glxp.api.entity.inv.DeviceReceiveOrderDetailEntity;
|
|
|
|
|
import com.glxp.api.entity.inv.DeviceReceiveOrderEntity;
|
|
|
|
|
import com.glxp.api.entity.purchase.SupCertEntity;
|
|
|
|
|
import com.glxp.api.entity.system.SysPdfTemplateRelevanceLabelEntity;
|
|
|
|
|
import com.glxp.api.entity.system.SysPdfTemplateRelevanceStatemenEntity;
|
|
|
|
|
import com.glxp.api.entity.system.SystemPDFTemplateEntity;
|
|
|
|
|
import com.glxp.api.req.inout.InspectionPDFTemplateRequest;
|
|
|
|
|
import com.glxp.api.req.inv.FilterDeptDeviceRequest;
|
|
|
|
|
import com.glxp.api.req.inv.FilterDeviceReceiveOrderDetailRequest;
|
|
|
|
|
import com.glxp.api.req.inv.FilterDeviceReceiveOrderRequest;
|
|
|
|
|
import com.glxp.api.res.inv.DeptDeviceDetailResponse;
|
|
|
|
|
import com.glxp.api.res.inv.DeviceReceiveOrderDetailResponse;
|
|
|
|
|
import com.glxp.api.res.inv.DeviceReceiveOrderResponse;
|
|
|
|
|
import com.glxp.api.service.inv.DeptDeviceDetailService;
|
|
|
|
|
import com.glxp.api.service.inv.DeviceReceiveOrderDetailService;
|
|
|
|
|
import com.glxp.api.service.inv.DeviceReceiveOrderService;
|
|
|
|
|
import com.glxp.api.service.system.SystemPDFModuleService;
|
|
|
|
|
import com.glxp.api.service.system.SystemPDFTemplateService;
|
|
|
|
|
import com.glxp.api.service.system.SystemParamConfigService;
|
|
|
|
|
import com.glxp.api.util.JasperUtils;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
|
import org.springframework.validation.BindingResult;
|
|
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
|
@ -16,7 +37,10 @@ import org.springframework.web.bind.annotation.RequestBody;
|
|
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 设备领用记录接口
|
|
|
|
@ -28,6 +52,19 @@ public class DeviceReceiveOrderController {
|
|
|
|
|
@Resource
|
|
|
|
|
private DeviceReceiveOrderService deviceReceiveOrderService;
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
private SystemParamConfigService systemParamConfigService;
|
|
|
|
|
@Resource
|
|
|
|
|
private SystemPDFModuleService systemPDFModuleService;
|
|
|
|
|
@Resource
|
|
|
|
|
private SystemPDFTemplateService systemPDFTemplateService;
|
|
|
|
|
@Resource
|
|
|
|
|
private DeviceReceiveOrderDetailService deviceReceiveOrderDetailService;
|
|
|
|
|
@Resource
|
|
|
|
|
private DeptDeviceDetailService deptDeviceDetailService;
|
|
|
|
|
@Value("${file_path}")
|
|
|
|
|
private String filePath;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 设备领用记录列表查询接口
|
|
|
|
|
*
|
|
|
|
@ -111,6 +148,7 @@ public class DeviceReceiveOrderController {
|
|
|
|
|
return deviceReceiveOrderService.updateStatus(filterDeviceReceiveOrderRequest.getId(), filterDeviceReceiveOrderRequest.getStatus());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 删除设备领用记录
|
|
|
|
|
*
|
|
|
|
@ -130,4 +168,83 @@ public class DeviceReceiveOrderController {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@GetMapping("/device/receive/order/getConfig")
|
|
|
|
|
public BaseResponse getConfig() {
|
|
|
|
|
return ResultVOUtils.success(systemParamConfigService.selectByParamKey("device_product"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 校验模板文件
|
|
|
|
|
*
|
|
|
|
|
* @param inspectionPDFTemplateRequest
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@AuthRuleAnnotation("")
|
|
|
|
|
@PostMapping("/device/receive/order/verifyTemplateFile")
|
|
|
|
|
public BaseResponse verifyTemplateFile(@RequestBody InspectionPDFTemplateRequest inspectionPDFTemplateRequest) {
|
|
|
|
|
if (null == inspectionPDFTemplateRequest) {
|
|
|
|
|
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, "参数不能为空!");
|
|
|
|
|
}
|
|
|
|
|
//查询模板文件是否存在
|
|
|
|
|
|
|
|
|
|
SysPdfTemplateRelevanceLabelEntity sysPdfTemplateRelevanceLabelEntity = systemPDFModuleService.selectByLabelId(inspectionPDFTemplateRequest.getId());
|
|
|
|
|
if (null == sysPdfTemplateRelevanceLabelEntity) {
|
|
|
|
|
return ResultVOUtils.error(ResultEnum.DATA_NOT, "所属模块错误");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SystemPDFTemplateEntity systemPDFTemplateEntity = systemPDFTemplateService.selectById(String.valueOf(sysPdfTemplateRelevanceLabelEntity.getTemplateId()));
|
|
|
|
|
if (null == systemPDFTemplateEntity) {
|
|
|
|
|
return ResultVOUtils.error(ResultEnum.DATA_NOT, "模板错误");
|
|
|
|
|
}
|
|
|
|
|
return ResultVOUtils.success(sysPdfTemplateRelevanceLabelEntity.getTemplateId());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 打印模板单号标签
|
|
|
|
|
*
|
|
|
|
|
* @param
|
|
|
|
|
* @param request
|
|
|
|
|
* @param response
|
|
|
|
|
* @throws Exception
|
|
|
|
|
*/
|
|
|
|
|
@AuthRuleAnnotation("")
|
|
|
|
|
@PostMapping("/device/receive/order/printOrder")
|
|
|
|
|
public void printOrder(@RequestBody FilterDeviceReceiveOrderRequest filterDeviceReceiveOrderRequest, HttpServletRequest request, HttpServletResponse response) throws Exception {
|
|
|
|
|
SystemPDFTemplateEntity systemPDFTemplateEntity = systemPDFTemplateService.selectById(filterDeviceReceiveOrderRequest.getTemplateId());
|
|
|
|
|
//打印单号标签
|
|
|
|
|
Map<String, Object> data = new HashMap<>(1);
|
|
|
|
|
List<Object> list = new ArrayList<>();
|
|
|
|
|
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");//定义新的日期格式
|
|
|
|
|
FilterDeptDeviceRequest filterDeptDeviceRequest=new FilterDeptDeviceRequest();
|
|
|
|
|
filterDeptDeviceRequest.setId(filterDeviceReceiveOrderRequest.getId());
|
|
|
|
|
List<DeptDeviceDetailResponse> deptDeviceDetailResponseList = deptDeviceDetailService.filterList(filterDeptDeviceRequest);
|
|
|
|
|
int i = 1;
|
|
|
|
|
if (deptDeviceDetailResponseList != null && deptDeviceDetailResponseList.size() > 0) {
|
|
|
|
|
for (DeptDeviceDetailResponse obj : deptDeviceDetailResponseList) {
|
|
|
|
|
Map<String, Object> supData = new HashMap<>();
|
|
|
|
|
supData.put("orderIdFk", obj.getOrderIdFk() == null ? ' ' : obj.getOrderIdFk());
|
|
|
|
|
supData.put("batchNo", obj.getBatchNo() == null ? ' ' : obj.getBatchNo());
|
|
|
|
|
supData.put("productionDate", obj.getProductionDate() == null ? ' ' : obj.getProductionDate());
|
|
|
|
|
supData.put("expireDate", obj.getExpireDate() == null ? ' ' : obj.getExpireDate());
|
|
|
|
|
supData.put("serialNo", obj.getSerialNo() == null ? ' ' : obj.getSerialNo());
|
|
|
|
|
supData.put("createTime", obj.getCreateTime() == null ? ' ' : obj.getCreateTime());
|
|
|
|
|
supData.put("invName", obj.getInvName() == null ? ' ' : obj.getInvName());
|
|
|
|
|
supData.put("zczbhhzbapzbh", obj.getZczbhhzbapzbh() == null ? ' ' : obj.getZczbhhzbapzbh());
|
|
|
|
|
supData.put("ggxh", obj.getGgxh() == null ? ' ' : obj.getGgxh());
|
|
|
|
|
supData.put("supName", obj.getSupName() == null ? ' ' : obj.getSupName());
|
|
|
|
|
supData.put("measname", obj.getMeasname() == null ? ' ' : obj.getMeasname());
|
|
|
|
|
supData.put("deviceName", obj.getDeviceName() == null ? ' ' : obj.getDeviceName());
|
|
|
|
|
supData.put("manufactory", obj.getManufactory() == null ? ' ' : obj.getManufactory());
|
|
|
|
|
supData.put("measname", obj.getMeasname() == null ? ' ' : obj.getMeasname());
|
|
|
|
|
supData.put("supName", obj.getSupName() == null ? ' ' : obj.getSupName());
|
|
|
|
|
list.add(supData);
|
|
|
|
|
i++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
String param = JSON.toJSONString(list);
|
|
|
|
|
JasperUtils.jasperReport(request, response, param, filePath + "pdf/template/" + systemPDFTemplateEntity.getPath(), "pdf");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|