From 35e2da343ab0f48c26ac4ed4b0af1d9d2720d3b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=99=93=E8=BF=AA?= <2596750866@qq.com> Date: Tue, 15 Oct 2024 14:01:19 +0800 Subject: [PATCH] =?UTF-8?q?[fix]=20=E7=94=9F=E4=BA=A7=E7=AE=A1=E7=90=86=20?= =?UTF-8?q?=E7=94=9F=E4=BA=A7=E9=A2=86=E6=96=99=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E7=94=9F=E4=BA=A7=E9=A2=86=E6=96=99=E5=AE=9E=E4=BD=93=E7=B1=BB?= =?UTF-8?q?=E5=AF=BC=E5=87=BA=E5=AD=97=E6=AE=B5=E5=8F=8A=E9=A1=BA=E5=BA=8F?= =?UTF-8?q?=EF=BC=9B=20=E6=96=B0=E5=A2=9E=E7=94=9F=E4=BA=A7=E9=A2=86?= =?UTF-8?q?=E6=96=99=E8=AF=A6=E6=83=85=E5=AE=9E=E4=BD=93=E7=B1=BB=E5=8F=AF?= =?UTF-8?q?=E7=94=A8=E5=BA=93=E5=AD=98=E6=95=B0=E3=80=81=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E7=94=A8=E9=87=8F=E5=AD=97=E6=AE=B5=EF=BC=9B=20=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E7=94=9F=E4=BA=A7=E9=A2=86=E6=96=99vo=E5=AE=9E?= =?UTF-8?q?=E4=BD=93=E7=B1=BB=EF=BC=8C=E6=96=B0=E5=A2=9E=E5=BD=93=E5=89=8D?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E5=AD=97=E6=AE=B5=EF=BC=9B=20=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E7=94=9F=E4=BA=A7=E9=A2=86=E6=96=99controller?= =?UTF-8?q?=E5=AF=BC=E5=87=BA=E6=8E=A5=E5=8F=A3=EF=BC=9B=20=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E7=94=9F=E4=BA=A7=E9=A2=86=E6=96=99service=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E9=A2=86=E6=96=99=E5=8D=95=E6=96=B9=E6=B3=95=EF=BC=8C?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=A2=86=E6=96=99=E6=95=B0=E4=B8=8D=E5=85=A8?= =?UTF-8?q?=E4=B8=BA=E7=A9=BA=E3=80=81=E4=B8=8D=E8=B6=85=E8=BF=87=E5=8F=AF?= =?UTF-8?q?=E7=94=A8=E5=BA=93=E5=AD=98=E6=95=B0=E5=92=8C=E6=9C=AC=E5=8D=95?= =?UTF-8?q?=E7=94=A8=E9=87=8F=E5=88=A4=E6=96=AD=EF=BC=9B=20=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E7=94=9F=E4=BA=A7=E9=A2=86=E6=96=99=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2mapper=EF=BC=8C=E6=A8=A1=E7=B3=8A=E6=90=9C?= =?UTF-8?q?=E7=B4=A2=EF=BC=8C=E6=96=B0=E5=A2=9E=E6=8C=89=E5=8D=95=E5=8F=B7?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E6=9F=A5=E8=AF=A2=E9=A2=86=E6=96=99=E5=8D=95?= =?UTF-8?q?=E9=9B=86=E5=90=88mapper=E6=96=B9=E6=B3=95=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SysMakeorderPickController.java | 35 +++++++++++++++---- .../ruoyi/system/domain/SysMakeorderPick.java | 26 ++++++-------- .../system/domain/SysMakeorderPickDetail.java | 22 ++++++++++++ .../system/domain/SysMakeorderPickVo.java | 2 ++ .../system/mapper/SysMakeorderPickMapper.java | 3 ++ .../impl/SysMakeorderPickServiceImpl.java | 26 +++++++++----- .../mapper/system/SysMakeorderPickMapper.xml | 27 +++++++++----- 7 files changed, 103 insertions(+), 38 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysMakeorderPickController.java b/ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysMakeorderPickController.java index b301e1aa..5cecaaba 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysMakeorderPickController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysMakeorderPickController.java @@ -3,15 +3,19 @@ package com.ruoyi.system.controller; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.utils.ShiroUtils; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.process.general.service.IProcessService; +import com.ruoyi.system.domain.OutsourceQuoteChild; import com.ruoyi.system.domain.SysMakeorderPick; import com.ruoyi.system.domain.SysMakeorderPickVo; +import com.ruoyi.system.mapper.SysMakeorderPickMapper; import com.ruoyi.system.service.ISysMakeorderPickService; +import com.ruoyi.system.service.ISysUserService; import com.ruoyi.warehouse.service.IWarehouseOutOrderService; import org.activiti.engine.RuntimeService; import org.activiti.engine.TaskService; @@ -56,6 +60,12 @@ public class SysMakeorderPickController extends BaseController @Autowired private IWarehouseOutOrderService warehouseOutOrderService; + @Autowired + private SysMakeorderPickMapper sysMakeorderPickMapper; + + @Autowired + private ISysUserService sysUserService; + @RequiresPermissions("system:makeorderpick:view") @GetMapping() public String makeorderpick(ModelMap mmap) @@ -84,11 +94,18 @@ public class SysMakeorderPickController extends BaseController @Log(title = "生产领料单", businessType = BusinessType.EXPORT) @PostMapping("/export") @ResponseBody - public AjaxResult export(SysMakeorderPickVo sysMakeorderPickVo) + public AjaxResult export(SysMakeorderPickVo sysMakeorderPickVo,String ids) { - List list = sysMakeorderPickService.selectSysMakeorderPickList(sysMakeorderPickVo); - ExcelUtil util = new ExcelUtil(SysMakeorderPickVo.class); - return util.exportExcel(list, "生产领料单数据"); + if (org.springframework.util.StringUtils.isEmpty(ids)){ + List pickVoList = sysMakeorderPickMapper.selectSysMakeorderPickList(sysMakeorderPickVo); + ExcelUtil util = new ExcelUtil(SysMakeorderPickVo.class); + return util.exportExcel(pickVoList, "生产领料数据"); + }else { + String[] makeNos = ids.split(","); + List pickVoList = sysMakeorderPickMapper.selectSysMakeorderPickListByNos(makeNos); + ExcelUtil util = new ExcelUtil(SysMakeorderPickVo.class); + return util.exportExcel(pickVoList, ids); + } } /** @@ -110,7 +127,7 @@ public class SysMakeorderPickController extends BaseController public AjaxResult addSave(SysMakeorderPick sysMakeorderPick) { if (StringUtils.isEmpty(sysMakeorderPick.getPickDetails())){ - return AjaxResult.success(); + return AjaxResult.error("领料子表数据为空!"); } // 审核状态-待审核 sysMakeorderPick.setAuditStatus("0"); @@ -268,5 +285,11 @@ public class SysMakeorderPickController extends BaseController return toAjax(sysMakeorderPickService.restoreSysMakeorderPickById(id)); } - + @GetMapping("/getBinessMembers") + @ResponseBody + public TableDataInfo getBusinessMembers(){ + startPage(); + List list = sysUserService.selectRoleToUserList("scyRole,scjlRole,sczgRole,admin"); + return getDataTable(list); + } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysMakeorderPick.java b/ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysMakeorderPick.java index 8209a79a..afa4e62a 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysMakeorderPick.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysMakeorderPick.java @@ -26,15 +26,15 @@ public class SysMakeorderPick extends BaseEntity private String delFlag; /** 生产订单号 */ - @Excel(name = "生产订单号") + @Excel(name = "生产订单号", sort = 2) private String makeNo; /** 关联销售订单号 */ - @Excel(name = "关联销售订单号") + @Excel(name = "关联销售订单号", sort = 3) private String saleNo; /** 生产领料单号 */ - @Excel(name = "生产领料单号") + @Excel(name = "生产领料单号", sort = 1) private String pickNo; /** 出库单号 */ @@ -43,53 +43,49 @@ public class SysMakeorderPick extends BaseEntity /** 领料状态 0-待领料 1-部分领料 2-全部领料 */ - @Excel(name = "领料状态 0-待领料 1-部分领料 2-全部领料") + @Excel(name = "领料状态",dictType = "pickStatus", sort = 6) private String pickStatus; /** 领料员 */ - @Excel(name = "领料员") +// @Excel(name = "领料员", sort = 6) private String pickUser; /*物料合计*/ + @Excel(name = "物料合计", sort = 4) private Integer materialSum; /*数量合计*/ + @Excel(name = "数量合计", sort = 5) private Integer enterpriseSum; /** 审核状态 0-待审核 1-审核通过 2-审核拒绝 */ - @Excel(name = "审核状态 0-待审核 1-审核通过 2-审核拒绝") + @Excel(name = "审核状态",dictType = "auditStatus", sort = 7) private String auditStatus; /** 流程实例ID */ - @Excel(name = "流程实例ID") private String instanceId; /** 流程实例类型 */ - @Excel(name = "流程实例类型") private String instanceType; /** 流程提交实例ID */ - @Excel(name = "流程提交实例ID") private String submitInstanceId; /** 流程作废实例ID */ - @Excel(name = "流程作废实例ID") private String cancelInstanceId; /** 流程恢复实例ID */ - @Excel(name = "流程恢复实例ID") private String restoreInstanceId; /** 申请标题 */ - @Excel(name = "申请标题") private String applyTitle; /** 申请人 */ - @Excel(name = "申请人") + @Excel(name = "申请人", sort = 8) private String applyUser; /** 申请时间 */ - @JsonFormat(pattern = "yyyy-MM-dd") - @Excel(name = "申请时间", width = 30, dateFormat = "yyyy-MM-dd") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "申请时间", width = 30, dateFormat = "yyyy-MM-dd",sort = 9) private Date applyTime; private List pickDetails; diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysMakeorderPickDetail.java b/ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysMakeorderPickDetail.java index 475566ec..51726414 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysMakeorderPickDetail.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysMakeorderPickDetail.java @@ -72,6 +72,12 @@ public class SysMakeorderPickDetail extends BaseEntity /** 排序 */ private Long sortNo; +// 可用库存数 + private BigDecimal storageNum; + +// 订单用量 + private BigDecimal orderNum; + public void setId(Long id) { this.id = id; @@ -240,6 +246,22 @@ public class SysMakeorderPickDetail extends BaseEntity this.sortNo = sortNo; } + public BigDecimal getStorageNum() { + return storageNum; + } + + public void setStorageNum(BigDecimal storageNum) { + this.storageNum = storageNum; + } + + public BigDecimal getOrderNum() { + return orderNum; + } + + public void setOrderNum(BigDecimal orderNum) { + this.orderNum = orderNum; + } + @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysMakeorderPickVo.java b/ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysMakeorderPickVo.java index 05ddc621..62ad1693 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysMakeorderPickVo.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysMakeorderPickVo.java @@ -21,6 +21,8 @@ public class SysMakeorderPickVo extends SysMakeorderPick { private String taskId; /** 任务名称 */ private String taskName; +// 当前任务状态 + private String taskStatus; /** 办理时间 */ private Date doneTime; /** 创建人 */ diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysMakeorderPickMapper.java b/ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysMakeorderPickMapper.java index 5f98cb6c..f979c7eb 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysMakeorderPickMapper.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysMakeorderPickMapper.java @@ -89,4 +89,7 @@ public interface SysMakeorderPickMapper * */ int updateMakeorderPickByCode(String outOrderCode); +// 根据单号集合查询生产领料单 + public List selectSysMakeorderPickListByNos(String[] pickNos); + } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysMakeorderPickServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysMakeorderPickServiceImpl.java index 792e1e38..8396e437 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysMakeorderPickServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysMakeorderPickServiceImpl.java @@ -148,6 +148,12 @@ public class SysMakeorderPickServiceImpl implements ISysMakeorderPickService } else { pickVo.setTaskName("未启动"); } + pickVo.setTaskStatus(pickVo.getTaskName()); + if(pickVo.getAuditStatus().equals("1")){ + pickVo.setTaskStatus("审核通过"); + }else if(pickVo.getAuditStatus().equals("2")){ + pickVo.setTaskStatus("审核拒绝"); + } returnList.add(pickVo); } returnList.setTotal(org.springframework.util.CollectionUtils.isEmpty(list) ? 0 : list.getTotal()); @@ -176,7 +182,10 @@ public class SysMakeorderPickServiceImpl implements ISysMakeorderPickService sysMakeorderPick.setPickNo(billNo); //保留领料单数不为空的数据 - List filterPickDetails = pickDetails.stream().filter(details -> details.getPickNum() != null).collect(Collectors.toList()); + List filterPickDetails = pickDetails.stream().filter(details -> details.getPickNum() != null&& details.getPickNum() > 0).collect(Collectors.toList()); + if(CollectionUtil.isEmpty(filterPickDetails)){ + throw new BusinessException("领料数不能全为空!"); + } Integer enterpriseSum = (int) filterPickDetails.stream() .mapToLong(SysMakeorderPickDetail::getPickNum) @@ -185,15 +194,16 @@ public class SysMakeorderPickServiceImpl implements ISysMakeorderPickService sysMakeorderPick.setEnterpriseSum(enterpriseSum); sysMakeorderPick.setMaterialSum(filterPickDetails.size()); - int id = sysMakeorderPickMapper.insertSysMakeorderPick(sysMakeorderPick); - - // 插入子表 - for (int i = 0; i < filterPickDetails.size(); i++) { - //获取过滤后的领料单详情 - SysMakeorderPickDetail pickDetail = filterPickDetails.get(i); + for (SysMakeorderPickDetail pickDetail:filterPickDetails) { pickDetail.setPickNo(billNo); pickDetail.setMakeNo(makeNo); + if(pickDetail.getPickNum()>pickDetail.getStorageNum().intValue()){ + throw new BusinessException("物料" + pickDetail.getMaterialNo() + "领料数超出可用库存数!"); + } + if(pickDetail.getPickNum()>pickDetail.getOrderNum().intValue()){ + throw new BusinessException("物料" + pickDetail.getMaterialNo() + "领料数超出订单用量数!"); + } int insertMakeorderPickDetailResult = makeorderPickDetailService.insertSysMakeorderPickDetail(pickDetail); if (insertMakeorderPickDetailResult <= 0){ throw new BusinessException("新增生产领料单详情失败"); @@ -201,7 +211,7 @@ public class SysMakeorderPickServiceImpl implements ISysMakeorderPickService } - + int id = sysMakeorderPickMapper.insertSysMakeorderPick(sysMakeorderPick); return id; } diff --git a/ruoyi-admin/src/main/resources/mapper/system/SysMakeorderPickMapper.xml b/ruoyi-admin/src/main/resources/mapper/system/SysMakeorderPickMapper.xml index c30f97a9..4c60398d 100644 --- a/ruoyi-admin/src/main/resources/mapper/system/SysMakeorderPickMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/system/SysMakeorderPickMapper.xml @@ -46,9 +46,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + where a.pick_no in + + #{pickNo} + + \ No newline at end of file