|
|
|
@ -2,6 +2,7 @@ package com.glxp.api.controller.inout;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
|
|
import com.glxp.api.annotation.AuthRuleAnnotation;
|
|
|
|
|
import com.glxp.api.common.enums.ResultEnum;
|
|
|
|
@ -13,19 +14,36 @@ import com.glxp.api.entity.basic.BasicBussinessTypeEntity;
|
|
|
|
|
import com.glxp.api.entity.inout.IoOrderDetailBizEntity;
|
|
|
|
|
import com.glxp.api.entity.inout.IoOrderDetailCodeEntity;
|
|
|
|
|
import com.glxp.api.entity.inout.IoOrderEntity;
|
|
|
|
|
import com.glxp.api.entity.system.SysPdfTemplateRelevanceStatemenEntity;
|
|
|
|
|
import com.glxp.api.entity.system.SystemPDFTemplateEntity;
|
|
|
|
|
import com.glxp.api.req.inout.FilterCodeRequest;
|
|
|
|
|
import com.glxp.api.req.inout.FilterOrderDetailResultRequest;
|
|
|
|
|
import com.glxp.api.req.inout.FilterOrderRequest;
|
|
|
|
|
import com.glxp.api.req.inout.InspectionPDFTemplateRequest;
|
|
|
|
|
import com.glxp.api.res.inout.IoCodeResponse;
|
|
|
|
|
import com.glxp.api.res.inout.IoOrderDetailResultResponse;
|
|
|
|
|
import com.glxp.api.service.basic.IBasicBussinessTypeService;
|
|
|
|
|
import com.glxp.api.service.inout.*;
|
|
|
|
|
import com.glxp.api.service.system.SystemPDFModuleService;
|
|
|
|
|
import com.glxp.api.service.system.SystemPDFTemplateService;
|
|
|
|
|
import com.glxp.api.util.JasperUtils;
|
|
|
|
|
import net.sf.jasperreports.engine.JRException;
|
|
|
|
|
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;
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 单据扫码明细查询接口
|
|
|
|
@ -40,6 +58,12 @@ public class IoOrderDetailResultController extends BaseController {
|
|
|
|
|
IBasicBussinessTypeService basicBussinessTypeService;
|
|
|
|
|
@Resource
|
|
|
|
|
IoCodeService codeService;
|
|
|
|
|
@Resource
|
|
|
|
|
private SystemPDFTemplateService systemPDFTemplateService;
|
|
|
|
|
@Resource
|
|
|
|
|
private SystemPDFModuleService systemPDFModuleService;
|
|
|
|
|
@Value("${file_path}")
|
|
|
|
|
private String filePath;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 查询单据扫码明细列表
|
|
|
|
@ -140,4 +164,96 @@ public class IoOrderDetailResultController extends BaseController {
|
|
|
|
|
return ResultVOUtils.success(orderDetailBizEntities);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//校验模板是否正确
|
|
|
|
|
@AuthRuleAnnotation("")
|
|
|
|
|
@PostMapping("/udiwms/pdf/template/order/result/file")
|
|
|
|
|
public BaseResponse inspectionStockOrderPDFFromTemplateFile(@RequestBody InspectionPDFTemplateRequest inspectionPDFTemplateRequest) {
|
|
|
|
|
|
|
|
|
|
//查询模板文件是否存在
|
|
|
|
|
SysPdfTemplateRelevanceStatemenEntity sysPdfTemplateRelevanceStatemenEntity = systemPDFModuleService.selectByStatemenId(inspectionPDFTemplateRequest.getId());
|
|
|
|
|
if (null == sysPdfTemplateRelevanceStatemenEntity) {
|
|
|
|
|
return ResultVOUtils.error(ResultEnum.DATA_NOT, "所属模块错误");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SystemPDFTemplateEntity systemPDFTemplateEntity = systemPDFTemplateService.selectById(String.valueOf(sysPdfTemplateRelevanceStatemenEntity.getTemplateId()));
|
|
|
|
|
if (null == systemPDFTemplateEntity) {
|
|
|
|
|
return ResultVOUtils.error(ResultEnum.DATA_NOT, "模板错误");
|
|
|
|
|
}
|
|
|
|
|
return ResultVOUtils.success(sysPdfTemplateRelevanceStatemenEntity.getTemplateId());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 出入库明细打印
|
|
|
|
|
*
|
|
|
|
|
* @param filterOrderDetailResultRequest
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@AuthRuleAnnotation("")
|
|
|
|
|
@PostMapping("/udiwms/inout/resultDetail/filterOrderPrint")
|
|
|
|
|
public BaseResponse filterOrderPrint(@RequestBody FilterOrderDetailResultRequest filterOrderDetailResultRequest, HttpServletRequest request, HttpServletResponse response) throws JRException, IOException {
|
|
|
|
|
List<IoOrderDetailResultResponse> ioOrderDetailResultResponseList=new ArrayList<>();
|
|
|
|
|
SystemPDFTemplateEntity systemPDFTemplateEntity = systemPDFTemplateService.selectById(filterOrderDetailResultRequest.getTemplateId());
|
|
|
|
|
//打印单号标签
|
|
|
|
|
Map<String, Object> data = new HashMap<>(1);
|
|
|
|
|
List<Object> list = new ArrayList<>();
|
|
|
|
|
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");//定义新的日期格式
|
|
|
|
|
|
|
|
|
|
//按选入打印
|
|
|
|
|
if(filterOrderDetailResultRequest.getList() != null && filterOrderDetailResultRequest.getList().size()>0){
|
|
|
|
|
ioOrderDetailResultResponseList =filterOrderDetailResultRequest.getList();
|
|
|
|
|
}else{
|
|
|
|
|
//按查询打印
|
|
|
|
|
FilterOrderRequest filterOrderRequest = new FilterOrderRequest();
|
|
|
|
|
filterOrderRequest.setVueType(filterOrderDetailResultRequest.getActionType());
|
|
|
|
|
List<String> actions = orderService.setActions(filterOrderRequest);
|
|
|
|
|
if (CollUtil.isEmpty(actions)) {
|
|
|
|
|
return ResultVOUtils.success("");
|
|
|
|
|
}
|
|
|
|
|
filterOrderDetailResultRequest.setActions(actions);
|
|
|
|
|
ioOrderDetailResultResponseList = orderDetailResultService.filterOrderList(filterOrderDetailResultRequest);
|
|
|
|
|
for (IoOrderDetailResultResponse orderDetailResultResponse : ioOrderDetailResultResponseList) {
|
|
|
|
|
if (orderDetailResultResponse.getMainAction().equals(ConstantType.TYPE_OUT)) {
|
|
|
|
|
orderDetailResultResponse.setOutCount(orderDetailResultResponse.getReCount());
|
|
|
|
|
orderDetailResultResponse.setInCount(0);
|
|
|
|
|
} else {
|
|
|
|
|
orderDetailResultResponse.setOutCount(0);
|
|
|
|
|
orderDetailResultResponse.setInCount(orderDetailResultResponse.getReCount());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
int i=1;
|
|
|
|
|
for (IoOrderDetailResultResponse ioOrderDetailResultResponse : ioOrderDetailResultResponseList) {
|
|
|
|
|
//组装数据
|
|
|
|
|
Map<String, Object> ioOrderDetailResultData = new HashMap<>();
|
|
|
|
|
ioOrderDetailResultData.put("index", String.valueOf(i));
|
|
|
|
|
ioOrderDetailResultData.put("nameCode", ioOrderDetailResultResponse.getNameCode() == null ? ' ' : ioOrderDetailResultResponse.getNameCode());
|
|
|
|
|
ioOrderDetailResultData.put("batchNo", ioOrderDetailResultResponse.getBatchNo() == null ? ' ' : ioOrderDetailResultResponse.getBatchNo());
|
|
|
|
|
ioOrderDetailResultData.put("productDate", ioOrderDetailResultResponse.getProductDate() == null ? ' ' : ioOrderDetailResultResponse.getProductDate());
|
|
|
|
|
ioOrderDetailResultData.put("expireDate", ioOrderDetailResultResponse.getExpireDate() == null ? ' ' : ioOrderDetailResultResponse.getExpireDate());
|
|
|
|
|
ioOrderDetailResultData.put("coName", ioOrderDetailResultResponse.getCoName() == null ? ' ' : ioOrderDetailResultResponse.getCoName());
|
|
|
|
|
ioOrderDetailResultData.put("certCode", ioOrderDetailResultResponse.getCertCode() == null ? ' ' : ioOrderDetailResultResponse.getCertCode());
|
|
|
|
|
ioOrderDetailResultData.put("ylqxzcrbarmc", ioOrderDetailResultResponse.getYlqxzcrbarmc() == null ? ' ' : ioOrderDetailResultResponse.getYlqxzcrbarmc());
|
|
|
|
|
ioOrderDetailResultData.put("manufacturer", ioOrderDetailResultResponse.getManufacturer() == null ? ' ' : ioOrderDetailResultResponse.getManufacturer());
|
|
|
|
|
ioOrderDetailResultData.put("measname", ioOrderDetailResultResponse.getMeasname() == null ? ' ' : ioOrderDetailResultResponse.getMeasname());
|
|
|
|
|
ioOrderDetailResultData.put("spec", ioOrderDetailResultResponse.getSpec() == null ? ' ' : ioOrderDetailResultResponse.getSpec());
|
|
|
|
|
ioOrderDetailResultData.put("price", ioOrderDetailResultResponse.getPrice() == null ? ' ' : ioOrderDetailResultResponse.getPrice());
|
|
|
|
|
ioOrderDetailResultData.put("count", ioOrderDetailResultResponse.getCount());
|
|
|
|
|
ioOrderDetailResultData.put("reCount",ioOrderDetailResultResponse.getReCount());
|
|
|
|
|
ioOrderDetailResultData.put("inCount", ioOrderDetailResultResponse.getInCount());
|
|
|
|
|
ioOrderDetailResultData.put("acceptCount", ioOrderDetailResultResponse.getAcceptCount());
|
|
|
|
|
ioOrderDetailResultData.put("fromCorpName", ioOrderDetailResultResponse.getFromCorpName() == null ? ' ' : ioOrderDetailResultResponse.getFromCorpName());
|
|
|
|
|
ioOrderDetailResultData.put("billTypeName", ioOrderDetailResultResponse.getBillTypeName() == null ? ' ' : ioOrderDetailResultResponse.getBillTypeName());
|
|
|
|
|
ioOrderDetailResultData.put("mainAction", ioOrderDetailResultResponse.getMainAction() == null ? ' ' : ioOrderDetailResultResponse.getMainAction());
|
|
|
|
|
ioOrderDetailResultData.put("auditTime", ioOrderDetailResultResponse.getAuditTime() == null ? ' ' : formatter.format(ioOrderDetailResultResponse.getAuditTime()));
|
|
|
|
|
list.add(ioOrderDetailResultData);
|
|
|
|
|
i++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
String param = JSON.toJSONString(list);
|
|
|
|
|
JasperUtils.jasperReport(request, response, param, filePath+"pdf/template/"+systemPDFTemplateEntity.getPath(), "pdf");
|
|
|
|
|
return ResultVOUtils.success();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|