rev:任务号重复、包衣下料卡控、导出PDF

This commit is contained in:
2026-08-03 14:28:31 +08:00
parent 3020b7ada2
commit d00908c6cc
14 changed files with 404 additions and 62 deletions

View File

@@ -481,6 +481,30 @@
<version>3.16.4</version>
</dependency>
<!-- itext7 pdf核心 -->
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>kernel</artifactId>
<version>7.2.5</version>
</dependency>
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>layout</artifactId>
<version>7.2.5</version>
</dependency>
<!-- 解决中文!必须引入中文字体 -->
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>font-asian</artifactId>
<version>7.2.5</version>
</dependency>
<!-- hutool继续保留 -->
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.8.22</version>
</dependency>
</dependencies>

View File

@@ -64,9 +64,14 @@ public class SysCodeRuleServiceImpl extends ServiceImpl<SysCodeRuleMapper, SysCo
String id = codeRuleMapper.selectOne(new LambdaQueryWrapper<SysCodeRule>().eq(SysCodeRule::getCode, code)).getId();
// 如果flag = 1就执行更新数据库的操作
String flag = (String) form.get("flag");
List<SysCodeRuleDetail> ruleDetails = codeRuleDetailMapper.selectList(new LambdaQueryWrapper<SysCodeRuleDetail>()
LambdaQueryWrapper<SysCodeRuleDetail> wrapper = new LambdaQueryWrapper<SysCodeRuleDetail>()
.eq(SysCodeRuleDetail::getCode_rule_id, id)
.orderByAsc(SysCodeRuleDetail::getSort_num));
.orderByAsc(SysCodeRuleDetail::getSort_num);
// 仅在真正生成编码时加行级锁,防止并发场景下编码重复;预览模式不加锁,避免不必要的阻塞
if ("1".equals(flag)) {
wrapper.last("FOR UPDATE");
}
List<SysCodeRuleDetail> ruleDetails = codeRuleDetailMapper.selectList(wrapper);
String demo = "";
boolean isSame = true;
for(SysCodeRuleDetail detail : ruleDetails) {

View File

@@ -57,5 +57,5 @@ public interface ISysLogService extends IService<SysLog> {
@Async
void save(String username, String browser, String ip, ProceedingJoinPoint joinPoint, SysLog log);
void download(Map map, HttpServletResponse response, String[] product_area) throws IOException;
void download(Map<String, Object> map, HttpServletResponse response, String[] product_area) throws IOException;
}

View File

@@ -6,6 +6,17 @@ import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
import com.itextpdf.kernel.geom.PageSize;
import com.itextpdf.kernel.pdf.PdfDocument;
import com.itextpdf.kernel.pdf.PdfWriter;
import com.itextpdf.layout.Document;
import com.itextpdf.layout.element.Paragraph;
import com.itextpdf.layout.element.Table;
import com.itextpdf.layout.element.Cell;
import com.itextpdf.layout.properties.TextAlignment;
import com.itextpdf.layout.properties.UnitValue;
import com.itextpdf.kernel.font.PdfFont;
import com.itextpdf.kernel.font.PdfFontFactory;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -15,8 +26,6 @@ import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.reflect.MethodSignature;
import org.nl.common.domain.query.PageQuery;
import org.nl.common.logging.annotation.Log;
import org.nl.common.utils.FileUtil;
import org.nl.common.utils.SecurityUtils;
import org.nl.common.utils.StringUtils;
import org.nl.common.utils.ValidationUtil;
import org.nl.system.service.logging.ISysLogService;
@@ -31,7 +40,10 @@ import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.lang.reflect.Method;
import java.lang.reflect.Parameter;
import java.nio.charset.StandardCharsets;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* <p>
@@ -45,6 +57,9 @@ import java.util.*;
@Service
public class SysLogServiceImpl extends ServiceImpl<SysLogMapper, SysLog> implements ISysLogService {
private static final Pattern BAD_REQUEST_EX_PATTERN = Pattern.compile("org\\.nl\\.common\\.exception\\.BadRequestException:\\s*(.+?)(?:\\r?\\n|\\s+at\\s+|$)");
private static final Pattern GENERAL_EX_PATTERN = Pattern.compile("Exception:\\s*(.+?)(?:\\r?\\n|\\s+at\\s+|$)");
@Autowired
private SysLogMapper logMapper;
@@ -114,7 +129,7 @@ public class SysLogServiceImpl extends ServiceImpl<SysLogMapper, SysLog> impleme
logMapper.insert(logDto);
}
@Override
/* @Override
public void download(Map map, HttpServletResponse response, String[] product_area) throws IOException {
String blurry = ObjectUtil.isNotEmpty(map.get("blurry"))?map.get("blurry").toString():null;
String log_type = ObjectUtil.isNotEmpty(map.get("log_type"))?map.get("log_type").toString():null;
@@ -143,6 +158,87 @@ public class SysLogServiceImpl extends ServiceImpl<SysLogMapper, SysLog> impleme
list.add(mp);
}
FileUtil.downloadExcel(list, response);
}*/
@Override
public void download(Map<String, Object> map, HttpServletResponse response, String[] product_area) throws IOException {
// pdf导出
// 1.提取查询参数
String blurry = ObjectUtil.isNotEmpty(map.get("blurry")) ? map.get("blurry").toString() : null;
String log_type = ObjectUtil.isNotEmpty(map.get("log_type")) ? map.get("log_type").toString() : null;
String username = ObjectUtil.isNotEmpty(map.get("username")) ? map.get("username").toString() : null;
String begin_time = ObjectUtil.isNotEmpty(map.get("begin_time")) ? map.get("begin_time").toString() : null;
String end_time = ObjectUtil.isNotEmpty(map.get("end_time")) ? map.get("end_time").toString() : null;
// 2.查询数据库
LambdaQueryWrapper<SysLog> lam = new LambdaQueryWrapper<>();
lam.eq(ObjectUtil.isNotEmpty(log_type), SysLog::getLog_type, log_type)
.eq(ObjectUtil.isNotEmpty(username), SysLog::getUsername, username)
.like(ObjectUtil.isNotEmpty(blurry), SysLog::getDescription, blurry)
.le(ObjectUtil.isNotEmpty(end_time), SysLog::getCreate_time, end_time)
.ge(ObjectUtil.isNotEmpty(begin_time), SysLog::getCreate_time, begin_time)
.orderByDesc(SysLog::getCreate_time);
List<SysLog> dataList = this.list(lam);
// 3.设置响应头【前端文件下载】
response.reset();
response.setContentType("application/pdf");
String fileName = "系统异常日志.pdf";
fileName = new String(fileName.getBytes("GBK"), "ISO-8859-1");
response.setHeader("Content-Disposition", "attachment;filename=" + fileName);
response.setHeader("Cache-Control", "no-cache");
// 4.构建PDF设置【A4横向】核心改动
PdfWriter writer = new PdfWriter(response.getOutputStream());
PdfDocument pdfDoc = new PdfDocument(writer);
// A4横向旋转
pdfDoc.setDefaultPageSize(PageSize.A4.rotate());
Document document = new Document(pdfDoc);
// 中文字体
PdfFont font = PdfFontFactory.createFont("STSong-Light", "UniGB-UCS2-H", PdfFontFactory.EmbeddingStrategy.PREFER_EMBEDDED);
// 标题
Paragraph title = new Paragraph("系统异常日志列表")
.setFont(font)
.setFontSize(14)
.setTextAlignment(TextAlignment.CENTER);
document.add(title);
document.add(new Paragraph("\n"));
// 表头
String[] headers = {"用户名", "IP", "IP来源", "描述", "浏览器", "请求耗时", "创建日期","错误信息"};
// 等分列宽,不再使用固定宽度
float[] columnWidths = new float[headers.length];
Arrays.fill(columnWidths, 1);
Table table = new Table(UnitValue.createPercentArray(columnWidths))
.useAllAvailableWidth();
// 渲染表头
for (String header : headers) {
Cell cell = new Cell()
.add(new Paragraph(header)
.setFont(font)
.setFontSize(9)
.setTextAlignment(TextAlignment.CENTER));
table.addCell(cell);
}
// 渲染数据(空值兜底 + 字体9号
for (SysLog sysLog : dataList) {
table.addCell(new Cell().add(new Paragraph(sysLog.getUsername()).setFont(font)));
table.addCell(new Cell().add(new Paragraph(sysLog.getRequest_ip()).setFont(font)));
table.addCell(new Cell().add(new Paragraph(sysLog.getAddress()).setFont(font)));
table.addCell(new Cell().add(new Paragraph(sysLog.getDescription()).setFont(font)));
table.addCell(new Cell().add(new Paragraph(sysLog.getBrowser()).setFont(font)));
table.addCell(new Cell().add(new Paragraph(sysLog.getTime() +"ms").setFont(font)));
table.addCell(new Cell().add(new Paragraph(sysLog.getCreate_time()).setFont(font)));
// 错误信息
table.addCell(new Cell().add(new Paragraph(extractExceptionMsg(sysLog.getException_detail())).setFont(font)));
}
document.add(table);
document.close();
}
/**
@@ -175,4 +271,51 @@ public class SysLogServiceImpl extends ServiceImpl<SysLogMapper, SysLog> impleme
return argList.size() == 1 ? JSONUtil.toJsonStr(argList.get(0)) : JSONUtil.toJsonStr(argList);
}
/**
* 错误信息过滤
* @param exceptionDetail 报错字节数字
* @return 具体报错信息
*/
public static String extractExceptionMsg(Object exceptionDetail) {
if (exceptionDetail == null) {
return "-";
}
String exceptionStr = "";
try {
if (exceptionDetail instanceof String) {
String rawStr = (String) exceptionDetail;
try {
// Base64解码
byte[] decodeBytes = Base64.getDecoder().decode(rawStr);
exceptionStr = new String(decodeBytes, StandardCharsets.UTF_8);
} catch (Exception e) {
// 不是合法base64直接使用原字符串
exceptionStr = rawStr;
}
} else if (exceptionDetail instanceof byte[]) {
byte[] bytes = (byte[]) exceptionDetail;
exceptionStr = new String(bytes, StandardCharsets.UTF_8);
} else {
// 不支持的类型直接返回-
return "-";
}
// 优先匹配 BadRequestException
Matcher badMatcher = BAD_REQUEST_EX_PATTERN.matcher(exceptionStr);
if (badMatcher.find() && badMatcher.group(1) != null) {
return badMatcher.group(1).trim();
}
// 通用Exception匹配兜底
Matcher generalMatcher = GENERAL_EX_PATTERN.matcher(exceptionStr);
if (generalMatcher.find() && generalMatcher.group(1) != null) {
return generalMatcher.group(1).trim();
}
return "-";
} catch (Exception e) {
// 任何解析异常全部兜底返回"-"
return "-";
}
}
}

View File

@@ -15,6 +15,8 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Map;
@@ -40,4 +42,10 @@ public class ReviewSignController {
public ResponseEntity<Object> query(@RequestParam Map whereJson, PageQuery page) {
return new ResponseEntity<>(TableDataInfo.build(iMdPdReviewsignService.queryAll(whereJson, page)), HttpStatus.OK);
}
@Log("导出数据")
@GetMapping(value = "/download")
public void download(@RequestParam Map map, HttpServletResponse response) throws IOException {
iMdPdReviewsignService.download(map, response);
}
}

View File

@@ -6,6 +6,8 @@ import com.baomidou.mybatisplus.extension.service.IService;
import org.nl.common.domain.query.PageQuery;
import org.nl.wms.basedata_manage.service.dao.MdPdReviewsign;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Map;
/**
@@ -32,4 +34,7 @@ public interface IMdPdReviewsignService extends IService<MdPdReviewsign> {
* @param dto 实体类
*/
void insert(MdPdReviewsign dto);
void download(Map<String, Object> map, HttpServletResponse response) throws IOException;
}

View File

@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import org.nl.wms.basedata_manage.service.dao.MdPdReviewsign;
import java.util.List;
import java.util.Map;
/**
@@ -27,4 +28,12 @@ public interface MdPdReviewsignMapper extends BaseMapper<MdPdReviewsign> {
* @return IPage<JSONObject>
*/
IPage<JSONObject> queryAllByPage(Page<JSONObject> page, @Param("param") Map whereJson);
/**
* 导出查询
*
* @param whereJson 查询条件
* @return List<JSONObject>
*/
List<JSONObject> downloadQuery( @Param("param") Map whereJson);
}

View File

@@ -43,4 +43,45 @@
ORDER BY review.create_time Desc
</select>
<select id="downloadQuery" resultType="com.alibaba.fastjson.JSONObject">
SELECT
review.*,
mater.material_code,
mater.material_name,
mater.quality_code,
supp.supp_code,
supp.supp_name
FROM
md_pd_reviewsign review
INNER JOIN md_me_materialbase mater ON mater.material_id = review.material_id
LEFT JOIN md_cs_supplierbase supp ON mater.supp_code = supp.supp_code
where
1 = 1
<if test="param.material_code != null and param.material_code != ''">
AND
(mater.material_code LIKE #{param.material_code} or
mater.material_name LIKE #{param.material_code} )
</if>
<if test="param.pcsn != null and param.pcsn != ''">
AND
review.pcsn LIKE #{param.pcsn}
</if>
<if test="param.create_name != null and param.create_name != ''">
AND
review.create_name LIKE #{param.create_name}
</if>
<if test="param.begin_time != null">
AND
review.create_time >= #{param.begin_time}
</if>
<if test="param.end_time != null">
AND
review.create_time &lt;= #{param.end_time}
</if>
ORDER BY review.create_time Desc
</select>
</mapper>

View File

@@ -1,19 +1,37 @@
package org.nl.wms.basedata_manage.service.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.itextpdf.kernel.font.PdfFont;
import com.itextpdf.kernel.font.PdfFontFactory;
import com.itextpdf.kernel.geom.PageSize;
import com.itextpdf.kernel.pdf.PdfDocument;
import com.itextpdf.kernel.pdf.PdfWriter;
import com.itextpdf.layout.Document;
import com.itextpdf.layout.element.Cell;
import com.itextpdf.layout.element.Paragraph;
import com.itextpdf.layout.element.Table;
import com.itextpdf.layout.properties.TextAlignment;
import com.itextpdf.layout.properties.UnitValue;
import org.nl.common.domain.query.PageQuery;
import org.nl.common.utils.IdUtil;
import org.nl.common.utils.SecurityUtils;
import org.nl.system.service.logging.dao.SysLog;
import org.nl.wms.basedata_manage.service.IMdPdReviewsignService;
import org.nl.wms.basedata_manage.service.dao.MdPdReviewsign;
import org.nl.wms.basedata_manage.service.dao.mapper.MdPdReviewsignMapper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
@@ -43,4 +61,93 @@ public class MdPdReviewsignServiceImpl extends ServiceImpl<MdPdReviewsignMapper,
this.save(dto);
}
@Override
public void download(Map<String, Object> map, HttpServletResponse response) throws IOException {
// 导出PDF
// 查询数据
List<JSONObject> dataList = this.baseMapper.downloadQuery(map);
// 设置响应头【前端文件下载】
response.reset();
response.setContentType("application/pdf");
String fileName = "复核记录.pdf";
fileName = new String(fileName.getBytes("GBK"), "ISO-8859-1");
response.setHeader("Content-Disposition", "attachment;filename=" + fileName);
response.setHeader("Cache-Control", "no-cache");
// 构建PDF设置【A4横向】核心改动
PdfWriter writer = new PdfWriter(response.getOutputStream());
PdfDocument pdfDoc = new PdfDocument(writer);
// A4横向旋转
pdfDoc.setDefaultPageSize(PageSize.A4.rotate());
Document document = new Document(pdfDoc);
// 中文字体
PdfFont font = PdfFontFactory.createFont("STSong-Light", "UniGB-UCS2-H", PdfFontFactory.EmbeddingStrategy.PREFER_EMBEDDED);
// 标题
Paragraph title = new Paragraph("复核记录列表")
.setFont(font)
.setFontSize(14)
.setTextAlignment(TextAlignment.CENTER);
document.add(title);
document.add(new Paragraph("\n"));
// 表头
String[] headers = {"袋码/桶号", "物料编码", "物料名称", "批次号", "重量", "质量代码", "载具编码","操作人编码",
"操作人名称","操作时间","复核人编码","复核人名称","复核时间","动作"
};
// 等分列宽,不再使用固定宽度
float[] columnWidths = new float[headers.length];
Arrays.fill(columnWidths, 1);
Table table = new Table(UnitValue.createPercentArray(columnWidths))
.useAllAvailableWidth();
// 渲染表头
for (String header : headers) {
Cell cell = new Cell()
.add(new Paragraph(header)
.setFont(font)
.setFontSize(9)
.setTextAlignment(TextAlignment.CENTER));
table.addCell(cell);
}
// 渲染数据(空值兜底 + 字体9号
for (JSONObject json : dataList) {
// 袋码
table.addCell(new Cell().add(new Paragraph(json.getString("bag_code")).setFont(font)));
// 物料编码
table.addCell(new Cell().add(new Paragraph(json.getString("material_code")).setFont(font)));
// 物料名称
table.addCell(new Cell().add(new Paragraph(json.getString("material_name")).setFont(font)));
// 批次号
table.addCell(new Cell().add(new Paragraph(json.getString("pcsn")).setFont(font)));
// 重量(保留三位小数)
table.addCell(new Cell().add(new Paragraph(NumberUtil.round(json.getDouble("qty"),3).toString()).setFont(font)));
// 质量代码
table.addCell(new Cell().add(new Paragraph(json.getString("quality_code")).setFont(font)));
// 载具编码
String vehicleCode = json.getString("vehicle_code");
table.addCell(new Cell().add(new Paragraph(ObjectUtil.isNotEmpty(vehicleCode) ? vehicleCode : "-").setFont(font)));
// 操作人编码
table.addCell(new Cell().add(new Paragraph(json.getString("create_code")).setFont(font)));
// 操作人名称
table.addCell(new Cell().add(new Paragraph(json.getString("create_name")).setFont(font)));
// 操作时间
table.addCell(new Cell().add(new Paragraph(json.getString("create_time")).setFont(font)));
// 复核人编码
table.addCell(new Cell().add(new Paragraph(json.getString("review_code")).setFont(font)));
// 复核人名称
table.addCell(new Cell().add(new Paragraph(json.getString("review_name")).setFont(font)));
// 复核时间
table.addCell(new Cell().add(new Paragraph(json.getString("create_time")).setFont(font)));
// 动作
table.addCell(new Cell().add(new Paragraph(json.getString("action")).setFont(font)));
}
document.add(table);
document.close();
}
}

View File

@@ -53,7 +53,7 @@ public class EmptyDiskConveyTask extends AbstractTask {
}
SchBaseTask task = new SchBaseTask();
task.setTask_id(IdUtil.getStringId());
task.setTask_code(CodeUtil.getNewCode("TASK_CODE"));
task.setTask_code(IdUtil.getStringId());
task.setTask_status(TaskStatus.CREATE.getCode());
task.setConfig_code(EmptyDiskConveyTask.class.getSimpleName());
task.setPoint_code1(json.getString("point_code1"));

View File

@@ -72,7 +72,7 @@ public class PalletizingDownTask extends AbstractTask {
SchBasePoint point = list.get(0);
SchBaseTask task = new SchBaseTask();
task.setTask_id(IdUtil.getStringId());
task.setTask_code(CodeUtil.getNewCode("TASK_CODE"));
task.setTask_code(IdUtil.getStringId());
task.setTask_status(TaskStatus.CREATE.getCode());
task.setConfig_code(PalletizingDownTask.class.getSimpleName());
task.setPoint_code1(json.getString("device_code"));

View File

@@ -190,65 +190,20 @@ public class TabletingInTask extends AbstractTask {
} else if (czjt02) {
czws = CZJT02;
}
// 校验
checkAttr(czws,attrEmpList.get(0));
} else {
// 判断对应的称重位是否启用
pointList.stream()
.filter(row -> row.getPoint_code().equals(attr.getExt_id()))
.findFirst().orElseThrow(()-> new BadRequestException("需从称重位【"+attr.getExt_id()+"】进行入库,但有任务正在执行,请等待任务取货完成后下发!"));
czws = attr.getExt_id();
checkAttr(czws,attr);
}
if (ObjectUtil.isEmpty(czws)) {
throw new BadRequestException("称重位不存在或未启用!");
}
/*JSONObject jsonObject = bucket.get(0);
json.put("pcsn", jsonObject.getString("pcsn"));
json.put("material_id", jsonObject.getString("material_id"));
List<SchBasePoint> czws = new ArrayList<>();
// 查询中间站是否有相同物料、批次仓位
JSONObject jsonObject1 = new JSONObject();
jsonObject1.put("material_id", jsonObject.getString("material_id"));
jsonObject1.put("pcsn", jsonObject.getString("pcsn"));
// 调用分配规则
MiddleRuleHandler bean = SpringContextHolder.getBean(MiddleRuleHandler.class);
Structattr attr = bean.isLikeMaterial(jsonObject1);
if (ObjectUtil.isEmpty(attr)) {
// 判断
boolean czjt01 = attrList.stream()
.anyMatch(row -> row.getExt_id().equals("CZJT01"));
boolean czjt02 = attrList.stream()
.anyMatch(row -> row.getExt_id().equals("CZJT02"));
if (czjt01 && czjt02) {
// 找一个没任务的称重位
czws = pointService.getCanUsePointByRegion("ZJZ01");
// 判断称重位到中间站的任务是否已经取货完成
if (ObjectUtil.isNotEmpty(czws)) {
for (SchBasePoint point : czws) {
List<SchBasePoint> list = schBasePointMapper.getCanUsePointByCode(point.getPoint_code());
if (ObjectUtil.isNotEmpty(list)) {
czws = list;
break;
} else {
czws = new ArrayList<>();
}
}
}
} else if (czjt01) {
czws = schBasePointMapper.getCanUsePointByCode("CZJT01");
} else if (czjt02) {
czws = schBasePointMapper.getCanUsePointByCode("CZJT02");
}
} else {
czws = schBasePointMapper.getCanUsePointByCode(attr.getExt_id());
if (czws.size() == 0) {
throw new BadRequestException("需从称重位【"+attr.getExt_id()+"】进行入库,但有任务正在执行,请等待任务取货完成后下发!");
}
}
if (czws.size() == 0) {
throw new BadRequestException("找不到中间站的称重位或正在进行任务!");
}*/
// SchBasePoint point = czws.get(0);
SchBaseTask task = new SchBaseTask();
task.setTask_id(IdUtil.getStringId());
task.setTask_code(CodeUtil.getNewCode("TASK_CODE"));
@@ -421,4 +376,31 @@ public class TabletingInTask extends AbstractTask {
public void taskConfirm(String task_code) {
}
private void checkAttr(String czws, Structattr attrEmpList ) {
// 校验排队中的任务和空仓位是否够用,防止创建超出仓位容量的任务
long emptyCount = iStructattrService.count(
new QueryWrapper<Structattr>().lambda()
.eq(Structattr::getSect_id, IOSEnum.SECT_ID.code("中间站库区"))
.eq(Structattr::getIs_delete, IOSConstant.ZERO)
.eq(Structattr::getIs_used, IOSConstant.ONE)
.eq(Structattr::getLock_type, IOSConstant.ZERO)
.eq(Structattr::getExt_id, czws)
.eq(Structattr::getBlock_num, attrEmpList.getBlock_num())
.and(row -> row.isNull(Structattr::getStoragevehicle_code)
.or().eq(Structattr::getStoragevehicle_code, ""))
);
long pendingCount = taskService.count(
new QueryWrapper<SchBaseTask>().lambda()
.eq(SchBaseTask::getConfig_code, TabletingInTask.class.getSimpleName())
.in(SchBaseTask::getTask_status,
TaskStatus.CREATE.getCode(),
TaskStatus.EXECUTING.getCode(),
TaskStatus.ISSUED.getCode()
)
);
if (emptyCount <= pendingCount) {
throw new BadRequestException("中间站仓位不足,当前组:"+attrEmpList.getBlock_num()+",空位为:" + emptyCount + ",当前排队任务:" + pendingCount + "条,请等待任务完成后再创建!");
}
}
}

View File

@@ -12,7 +12,7 @@
:loading="showDtlLoading"
@click="down"
>
导出
导出PDF
</el-button>
</crudOperation>
</div>
@@ -177,7 +177,7 @@ export default {
data.log_type = 'ERROR'
this.showDtlLoading = true
download('/api/logs/download', data).then(result => {
downloadFile(result, '日志查询', 'xlsx')
downloadFile(result, '异常日志查询', 'pdf')
this.showDtlLoading = false
}).catch(() => {
this.showDtlLoading = false

View File

@@ -56,7 +56,19 @@
</el-form>
</div>
<!--如果想在工具栏加入更多按钮可以使用插槽方式 slot = 'left' or 'right'-->
<crudOperation :permission="permission"/>
<crudOperation :permission="permission">
<el-button
slot="right"
class="filter-item"
type="success"
icon="el-icon-thumb"
size="mini"
:loading="showDtlLoading"
@click="downdtl"
>
导出PDF
</el-button>
</crudOperation>
<!--表格渲染-->
<el-table
ref="table"
@@ -75,11 +87,12 @@
<el-table-column prop="vehicle_code" label="载具编码" :min-width="flexWidth('vehicle_code',crud.data,'载具编码')" />
<!-- <el-table-column prop="supp_code" label="供应商编码" :min-width="flexWidth('supp_code',crud.data,'供应商编码')" />-->
<!-- <el-table-column prop="supp_name" label="供应商名称" :min-width="flexWidth('supp_name',crud.data,'供应商名称')" />-->
<el-table-column prop="create_time" label="时间" :min-width="flexWidth('create_time',crud.data,'时间')" />
<el-table-column prop="create_code" label="操作人编码" :min-width="flexWidth('create_code',crud.data,'操作人编码')" />
<el-table-column prop="create_name" label="操作人名称" :min-width="flexWidth('create_name',crud.data,'操作人名称')" />
<el-table-column prop="create_time" label="操作时间" :min-width="flexWidth('create_time',crud.data,'时间')" />
<el-table-column prop="review_code" label="复核人编码" :min-width="flexWidth('review_code',crud.data,'复核人编码')" />
<el-table-column prop="review_name" label="复核人名称" :min-width="flexWidth('review_name',crud.data,'复核人名称')" />
<el-table-column prop="create_time" label="复核时间" :min-width="flexWidth('create_time',crud.data,'复核时间')" />
<el-table-column prop="action" label="动作" :min-width="flexWidth('action',crud.data,'动作')" />
</el-table>
<!--分页组件-->
@@ -162,9 +175,14 @@ export default {
},
downdtl() {
if (this.currentRow !== null) {
const data = this.crud.query
if (this.crud.query.createTime !== undefined) {
data.begin_time = this.crud.query.createTime[0]
data.end_time = this.crud.query.createTime[1]
}
this.showDtlLoading = true
download('/api/review/download', this.crud.query).then(result => {
downloadFile(result, '复核记录', 'xlsx')
download('/api/review/download', data).then(result => {
downloadFile(result, '复核记录', 'pdf')
this.showDtlLoading = false
}).catch(() => {
this.showDtlLoading = false