From 7903d8ff962b03a233c5a3ea26907e37ff566713 Mon Sep 17 00:00:00 2001 From: syruan <321359594@qq.com> Date: Wed, 13 Nov 2024 17:20:24 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E9=A2=86=E6=96=99=E7=AE=A1=E7=90=86--?= =?UTF-8?q?=E9=A2=86=E6=96=99=E4=BB=BB=E5=8A=A1=E7=8A=B6=E6=80=81=E6=9E=9A?= =?UTF-8?q?=E4=B8=BE=E5=AE=9A=E4=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/biz/enums/LeaseTaskStatusEnum.java | 24 +++++++++++++++++++ .../biz/enums/PurchaseTaskStatusEnum.java | 4 +--- .../impl/LeaseApplyInfoServiceImpl.java | 5 ++-- 3 files changed, 28 insertions(+), 5 deletions(-) create mode 100644 bonus-common-biz/src/main/java/com/bonus/common/biz/enums/LeaseTaskStatusEnum.java diff --git a/bonus-common-biz/src/main/java/com/bonus/common/biz/enums/LeaseTaskStatusEnum.java b/bonus-common-biz/src/main/java/com/bonus/common/biz/enums/LeaseTaskStatusEnum.java new file mode 100644 index 00000000..9ea25c98 --- /dev/null +++ b/bonus-common-biz/src/main/java/com/bonus/common/biz/enums/LeaseTaskStatusEnum.java @@ -0,0 +1,24 @@ +package com.bonus.common.biz.enums; + +import lombok.Getter; + +/** + * @author : 阮世耀 + * @version : 1.0 + * 领料任务状态枚举 + */ +@Getter +public enum LeaseTaskStatusEnum { + + LEASE_TASK_NO_PUBLISHED(0, "领料任务--未发布"), + LEASE_TASK_PUBLISHED(1, "领料任务--已发布"), + LEASE_TASK_FINISH(2, "领料任务--已完成"); + + private final Integer status; + private final String statusName; + + LeaseTaskStatusEnum(Integer status, String statusName) { + this.status = status; + this.statusName = statusName; + } +} diff --git a/bonus-common-biz/src/main/java/com/bonus/common/biz/enums/PurchaseTaskStatusEnum.java b/bonus-common-biz/src/main/java/com/bonus/common/biz/enums/PurchaseTaskStatusEnum.java index a9403ad7..63ad4c2a 100644 --- a/bonus-common-biz/src/main/java/com/bonus/common/biz/enums/PurchaseTaskStatusEnum.java +++ b/bonus-common-biz/src/main/java/com/bonus/common/biz/enums/PurchaseTaskStatusEnum.java @@ -18,9 +18,7 @@ public enum PurchaseTaskStatusEnum { IN_STORE(19, "已入库"), TASK_TO_START(20, "入库待开始"), TASK_IN_PROGRESS(21, "入库进行中"), - TASK_FINISHED(22, "入库已完成"), - LEASE_TASK_NO_PUBLISHED(0, "领料任务--未发布"), - LEASE_TASK_PUBLISHED(1, "领料任务--已发布"); + TASK_FINISHED(22, "入库已完成"); private final Integer status; private final String statusName; diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/impl/LeaseApplyInfoServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/impl/LeaseApplyInfoServiceImpl.java index 11bfa242..0380e9f8 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/impl/LeaseApplyInfoServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/impl/LeaseApplyInfoServiceImpl.java @@ -5,6 +5,7 @@ import java.util.Optional; import cn.hutool.core.collection.CollectionUtil; import com.bonus.common.biz.constant.MaterialConstants; +import com.bonus.common.biz.enums.LeaseTaskStatusEnum; import com.bonus.common.biz.enums.PurchaseTaskStatusEnum; import com.bonus.common.biz.enums.TmTaskTypeEnum; import com.bonus.common.core.exception.ServiceException; @@ -151,14 +152,14 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService { } leaseApplyInfo.setUpdateTime(DateUtils.getNowDate()); - leaseApplyInfo.setStatus(String.valueOf(PurchaseTaskStatusEnum.LEASE_TASK_PUBLISHED.getStatus())); + leaseApplyInfo.setStatus(String.valueOf(LeaseTaskStatusEnum.LEASE_TASK_PUBLISHED.getStatus())); try { int result = leaseApplyInfoMapper.updateLeaseApplyInfo(leaseApplyInfo); if (result > 0) { // 同步修改tm_task任务状态 TmTask tmTask = new TmTask(); tmTask.setTaskId(leaseApplyInfo.getTaskId()); - tmTask.setStatus(String.valueOf(PurchaseTaskStatusEnum.LEASE_TASK_PUBLISHED.getStatus())); + tmTask.setStatus(String.valueOf(LeaseTaskStatusEnum.LEASE_TASK_PUBLISHED.getStatus())); tmTaskMapper.updateTmTask(tmTask); return AjaxResult.success("发布成功"); } From 1db9924f0d80ce181c5e5ed30899fea756953479 Mon Sep 17 00:00:00 2001 From: syruan <321359594@qq.com> Date: Wed, 13 Nov 2024 17:43:39 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E9=A2=86=E6=96=99=E7=AE=A1=E7=90=86--?= =?UTF-8?q?=E9=A2=86=E6=96=99=E4=BB=BB=E5=8A=A1=E7=8A=B6=E6=80=81=E6=9E=9A?= =?UTF-8?q?=E4=B8=BE=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/bonus/common/biz/enums/LeaseTaskStatusEnum.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bonus-common-biz/src/main/java/com/bonus/common/biz/enums/LeaseTaskStatusEnum.java b/bonus-common-biz/src/main/java/com/bonus/common/biz/enums/LeaseTaskStatusEnum.java index 9ea25c98..402fc9bd 100644 --- a/bonus-common-biz/src/main/java/com/bonus/common/biz/enums/LeaseTaskStatusEnum.java +++ b/bonus-common-biz/src/main/java/com/bonus/common/biz/enums/LeaseTaskStatusEnum.java @@ -10,9 +10,11 @@ import lombok.Getter; @Getter public enum LeaseTaskStatusEnum { - LEASE_TASK_NO_PUBLISHED(0, "领料任务--未发布"), + LEASE_TASK_TO_PUBLISHED(0, "领料任务--未发布"), LEASE_TASK_PUBLISHED(1, "领料任务--已发布"), - LEASE_TASK_FINISH(2, "领料任务--已完成"); + LEASE_TASK_TO_STORE(2, "领料任务--待出库"), + LEASE_TASK_IN_STORE(3, "领料任务--进行中"), + LEASE_TASK_END_STORE(4, "领料任务--已出库完成"); private final Integer status; private final String statusName; From be2c9ff8a393a0112d815b0e35e6fe3ad7537dbe Mon Sep 17 00:00:00 2001 From: mashuai Date: Wed, 13 Nov 2024 18:01:55 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E9=80=80=E6=96=99=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/biz/domain/TypeTreeBuild.java | 77 ++++ .../bonus/common/biz/domain/TypeTreeNode.java | 37 ++ .../controller/BackApplyInfoController.java | 33 +- .../back/domain/BackApplyDetails.java | 50 ++- .../material/back/domain/BackApplyInfo.java | 64 ++- .../bonus/material/back/domain/MaCodeDto.java | 34 ++ .../back/domain/vo/BackApplyRequestVo.java | 28 ++ .../material/back/domain/vo/MaCodeVo.java | 27 ++ .../back/mapper/BackApplyInfoMapper.java | 98 ++++ .../back/service/IBackApplyInfoService.java | 22 +- .../impl/BackApplyInfoServiceImpl.java | 422 +++++++++++++++++- .../common/controller/SelectController.java | 7 + .../material/common/mapper/SelectMapper.java | 23 + .../common/service/SelectService.java | 7 + .../service/impl/SelectServiceImpl.java | 43 +- .../material/back/BackApplyInfoMapper.xml | 327 +++++++++++++- .../mapper/material/common/SelectMapper.xml | 77 ++++ 17 files changed, 1302 insertions(+), 74 deletions(-) create mode 100644 bonus-common-biz/src/main/java/com/bonus/common/biz/domain/TypeTreeBuild.java create mode 100644 bonus-common-biz/src/main/java/com/bonus/common/biz/domain/TypeTreeNode.java create mode 100644 bonus-modules/bonus-material/src/main/java/com/bonus/material/back/domain/MaCodeDto.java create mode 100644 bonus-modules/bonus-material/src/main/java/com/bonus/material/back/domain/vo/BackApplyRequestVo.java create mode 100644 bonus-modules/bonus-material/src/main/java/com/bonus/material/back/domain/vo/MaCodeVo.java diff --git a/bonus-common-biz/src/main/java/com/bonus/common/biz/domain/TypeTreeBuild.java b/bonus-common-biz/src/main/java/com/bonus/common/biz/domain/TypeTreeBuild.java new file mode 100644 index 00000000..9d72bc79 --- /dev/null +++ b/bonus-common-biz/src/main/java/com/bonus/common/biz/domain/TypeTreeBuild.java @@ -0,0 +1,77 @@ +package com.bonus.common.biz.domain; + +import java.util.ArrayList; +import java.util.List; + +/** + * BuildTree 构建树形结构 + * @author 10488 + */ +public class TypeTreeBuild { + + public List nodeList = new ArrayList<>(); + + /** + * 构造方法 + * @param nodeList 将数据集合赋值给nodeList,即所有数据作为所有节点。 + */ + public TypeTreeBuild(List nodeList){ + this.nodeList = nodeList; + } + + /** + * 获取需构建的所有根节点(顶级节点) "0" + * @return 所有根节点List集合 + */ + public List getRootNode(){ + // 保存所有根节点(所有根节点的数据) + List rootNodeList = new ArrayList<>(); + // treeNode:查询出的每一条数据(节点) + for (TypeTreeNode treeNode : nodeList){ + // 判断当前节点是否为根节点,此处注意:若parentId类型是String,则要采用equals()方法判断。 + if (0 == treeNode.getParentId()) { + // 是,添加 + rootNodeList.add(treeNode); + } + } + return rootNodeList; + } + + /** + * 根据每一个顶级节点(根节点)进行构建树形结构 + * @return 构建整棵树 + */ + public List buildTree(){ + // treeNodes:保存一个顶级节点所构建出来的完整树形 + List treeNodes = new ArrayList(); + // getRootNode():获取所有的根节点 + for (TypeTreeNode treeRootNode : getRootNode()) { + // 将顶级节点进行构建子树 + treeRootNode = buildChildTree(treeRootNode); + // 完成一个顶级节点所构建的树形,增加进来 + treeNodes.add(treeRootNode); + } + return treeNodes; + } + + /** + * 递归-----构建子树形结构 + * @param pNode 根节点(顶级节点) + * @return 整棵树 + */ + public TypeTreeNode buildChildTree(TypeTreeNode pNode){ + List childTree = new ArrayList(); + // nodeList:所有节点集合(所有数据) + for (TypeTreeNode treeNode : nodeList) { + // 判断当前节点的父节点ID是否等于根节点的ID,即当前节点为其下的子节点 + if (treeNode.getParentId() == pNode.getTypeId()) { + // 再递归进行判断当前节点的情况,调用自身方法 + childTree.add(buildChildTree(treeNode)); + } + } + // for循环结束,即节点下没有任何节点,树形构建结束,设置树结果 + pNode.setChildren(childTree); + return pNode; + } + +} diff --git a/bonus-common-biz/src/main/java/com/bonus/common/biz/domain/TypeTreeNode.java b/bonus-common-biz/src/main/java/com/bonus/common/biz/domain/TypeTreeNode.java new file mode 100644 index 00000000..5f5e443d --- /dev/null +++ b/bonus-common-biz/src/main/java/com/bonus/common/biz/domain/TypeTreeNode.java @@ -0,0 +1,37 @@ +package com.bonus.common.biz.domain; + +import com.fasterxml.jackson.annotation.JsonInclude; +import lombok.Data; + +import java.util.ArrayList; +import java.util.List; + +/** + * 下拉树-实体类 + * @Author 阮世耀 + * @Create 2023/12/13 15:45 + * @Version 1.0 + */ +@Data +public class TypeTreeNode { + + private long typeId; + + private long parentId; + private int companyId; + + private String num; + + private String manageType; + + private String unitName; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + private String level; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + private String typeName; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + private List children = new ArrayList<>(); +} diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/controller/BackApplyInfoController.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/controller/BackApplyInfoController.java index 46a9e1e8..505ec15e 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/controller/BackApplyInfoController.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/controller/BackApplyInfoController.java @@ -3,13 +3,13 @@ package com.bonus.material.back.controller; import java.util.List; import javax.servlet.http.HttpServletResponse; import com.bonus.common.log.enums.OperaType; +import com.bonus.material.back.domain.vo.BackApplyRequestVo; import com.bonus.material.common.annotation.PreventRepeatSubmit; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; @@ -41,7 +41,7 @@ public class BackApplyInfoController extends BaseController { * 查询退料任务列表 */ @ApiOperation(value = "查询退料任务列表") - @RequiresPermissions("back:info:list") + //@RequiresPermissions("back:info:list") @GetMapping("/list") public TableDataInfo list(BackApplyInfo backApplyInfo) { startPage(); @@ -49,6 +49,13 @@ public class BackApplyInfoController extends BaseController { return getDataTable(list); } + + @ApiOperation(value = "根据单位和工程id查询领料机具") + @GetMapping("/getMachineById") + public AjaxResult getMachineById(BackApplyInfo dto){ + return backApplyInfoService.getMachineById(dto); + } + /** * 导出退料任务列表 */ @@ -67,7 +74,7 @@ public class BackApplyInfoController extends BaseController { * 获取退料任务详细信息 */ @ApiOperation(value = "获取退料任务详细信息") - @RequiresPermissions("back:info:query") + //@RequiresPermissions("back:info:query") @GetMapping(value = "/{id}") public AjaxResult getInfo(@PathVariable("id") Long id) { return success(backApplyInfoService.selectBackApplyInfoById(id)); @@ -81,9 +88,9 @@ public class BackApplyInfoController extends BaseController { @RequiresPermissions("back:info:add") @SysLog(title = "退料任务", businessType = OperaType.INSERT, logType = 1,module = "仓储管理->新增退料任务") @PostMapping - public AjaxResult add(@RequestBody BackApplyInfo backApplyInfo) { + public AjaxResult add(@RequestBody BackApplyRequestVo dto) { try { - return toAjax(backApplyInfoService.insertBackApplyInfo(backApplyInfo)); + return backApplyInfoService.insertBackApplyInfo(dto); } catch (Exception e) { return error("系统错误, " + e.getMessage()); } @@ -96,10 +103,10 @@ public class BackApplyInfoController extends BaseController { @PreventRepeatSubmit @RequiresPermissions("back:info:edit") @SysLog(title = "退料任务", businessType = OperaType.UPDATE, logType = 1,module = "仓储管理->修改退料任务") - @PutMapping - public AjaxResult edit(@RequestBody BackApplyInfo backApplyInfo) { + @PostMapping("/edit") + public AjaxResult edit(@RequestBody BackApplyRequestVo dto) { try { - return toAjax(backApplyInfoService.updateBackApplyInfo(backApplyInfo)); + return backApplyInfoService.updateBackApplyInfo(dto); } catch (Exception e) { return error("系统错误, " + e.getMessage()); } @@ -109,11 +116,11 @@ public class BackApplyInfoController extends BaseController { * 删除退料任务 */ @ApiOperation(value = "删除退料任务") - @PreventRepeatSubmit - @RequiresPermissions("back:info:remove") + //@PreventRepeatSubmit + //@RequiresPermissions("back:info:remove") @SysLog(title = "退料任务", businessType = OperaType.DELETE, logType = 1,module = "仓储管理->删除退料任务") - @DeleteMapping("/{ids}") - public AjaxResult remove(@PathVariable Long[] ids) { - return toAjax(backApplyInfoService.deleteBackApplyInfoByIds(ids)); + @DeleteMapping("/{id}") + public AjaxResult remove(@PathVariable Long id) { + return backApplyInfoService.deleteBackApplyInfoById(id); } } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/domain/BackApplyDetails.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/domain/BackApplyDetails.java index 0aa10f25..cb0844c4 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/domain/BackApplyDetails.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/domain/BackApplyDetails.java @@ -1,11 +1,14 @@ package com.bonus.material.back.domain; import com.bonus.common.core.annotation.Excel; +import com.bonus.material.basic.domain.BmFileInfo; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import lombok.ToString; import com.bonus.common.core.web.domain.BaseEntity; +import java.util.List; + /** * 退料任务详细对象 back_apply_details * @@ -27,6 +30,9 @@ public class BackApplyDetails extends BaseEntity { @ApiModelProperty(value = "退料单号") private String code; + @ApiModelProperty(value = "机具id") + private Long maId; + /** 任务ID */ @Excel(name = "任务ID") @ApiModelProperty(value = "任务ID") @@ -37,25 +43,53 @@ public class BackApplyDetails extends BaseEntity { @ApiModelProperty(value = "规格ID") private Long typeId; - /** 申请数量 */ - @Excel(name = "申请数量") - @ApiModelProperty(value = "申请数量") - private Long preNum; + @ApiModelProperty(value = "类型名称") + private String typeName; + + @ApiModelProperty(value = "规格型号") + private String typeModel; + + @ApiModelProperty(value = "单位名称") + private String unitName; + + @ApiModelProperty(value = "管理方式(0编号 1计数)") + private String manageType; + + /** + * 机具编码集合(可能存在多个,数据库存储用逗号分割) + */ + private List maCodeList; + + @ApiModelProperty(value = "机具编码") + private String maCode; + + /** 退料数量 */ + @ApiModelProperty(value = "退料数量") + private Integer preNum; /** 审批数量 */ - @Excel(name = "审批数量") @ApiModelProperty(value = "审批数量") - private Long auditNum; + private Integer auditNum; + + /** 在用数量 */ + @ApiModelProperty(value = "在用数量") + private Integer num; /** 状态(0待审批,1进行中,2已出库,3已驳回) */ - @Excel(name = "状态(0待审批,1进行中,2已出库,3已驳回)") @ApiModelProperty(value = "状态(0待审批,1进行中,2已出库,3已驳回)") private String status; + @ApiModelProperty(value = "机具外观判断") + private String apDetection; + /** 数据所属组织 */ - @Excel(name = "数据所属组织") @ApiModelProperty(value = "数据所属组织") private Long companyId; + /** + * 附件列表 + */ + @ApiModelProperty(value = "附件列表") + List bmFileInfos; } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/domain/BackApplyInfo.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/domain/BackApplyInfo.java index a00b775c..5225d9f3 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/domain/BackApplyInfo.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/domain/BackApplyInfo.java @@ -18,17 +18,44 @@ import com.bonus.common.core.web.domain.BaseEntity; @Data @ToString -public class BackApplyInfo extends BaseEntity { +public class BackApplyInfo { private static final long serialVersionUID = 1L; /** ID */ private Long id; + @ApiModelProperty(value = "协议id") + private Long agreementId; + + @ApiModelProperty(value = "任务类型") + private Integer taskType; + + @ApiModelProperty(value = "单位id") + private Long unitId; + + @ApiModelProperty(value = "单位名称") + @Excel(name = "退料单位") + private String unitName; + + @ApiModelProperty(value="工程id") + private Long proId; + + @ApiModelProperty(value="工程名称") + @Excel(name = "工程名称") + private String proName; + /** 退料单号 */ @Excel(name = "退料单号") @ApiModelProperty(value = "退料单号") private String code; + @ApiModelProperty(value = "类型id") + private String typeId; + + @ApiModelProperty(value = "类型名称") + @Excel(name = "物资类型") + private String typeName; + /** 任务ID */ @Excel(name = "任务ID") @ApiModelProperty(value = "任务ID") @@ -40,7 +67,7 @@ public class BackApplyInfo extends BaseEntity { private String backPerson; /** 联系方式 */ - @Excel(name = "联系方式") + @Excel(name = "退料人电话") @ApiModelProperty(value = "联系方式") private String phone; @@ -68,18 +95,45 @@ public class BackApplyInfo extends BaseEntity { /** 预退料时间 */ @ApiModelProperty(value = "预退料时间") @JsonFormat(pattern = "yyyy-MM-dd") - @Excel(name = "预退料时间", width = 30, dateFormat = "yyyy-MM-dd") private Date backTime; + @Excel(name = "创建人") + private String createBy; + + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "创建时间") + private Date createTime; + /** 1.机具分公司审核通过,2.机具分公司审批不通过,3.调试分公司审批通过,4.调试分公司审批不通过,5.出库进行中,6.出库完成 */ - @Excel(name = "1.机具分公司审核通过,2.机具分公司审批不通过,3.调试分公司审批通过,4.调试分公司审批不通过,5.出库进行中,6.出库完成") + @Excel(name = "状态") @ApiModelProperty(value = "1.机具分公司审核通过,2.机具分公司审批不通过,3.调试分公司审批通过,4.调试分公司审批不通过,5.出库进行中,6.出库完成") private String status; + @ApiModelProperty(value = "任务状态") + private Integer taskStatus; + + private String updateBy; + + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date updateTime; + + @ApiModelProperty(value = "打印状态") + @Excel(name = "打印状态") + private String printStatus; + + @Excel(name = "备注") + private String remark; + /** 直转id */ - @Excel(name = "直转id") @ApiModelProperty(value = "直转id") private Long directId; + @ApiModelProperty(value="开始时间") + private String startTime; + @ApiModelProperty(value="结束时间") + private String endTime; + + @ApiModelProperty(value="关键字") + private String keyWord; } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/domain/MaCodeDto.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/domain/MaCodeDto.java new file mode 100644 index 00000000..8d076054 --- /dev/null +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/domain/MaCodeDto.java @@ -0,0 +1,34 @@ +package com.bonus.material.back.domain; + +import com.bonus.material.basic.domain.BmFileInfo; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +/** + * 机具编码及附件集合 + * @Author ma_sh + * @create 2024/11/11 15:57 + */ +@Data +public class MaCodeDto { + + @ApiModelProperty(value = "机具id") + private Long maId; + + /** + * 机具编码 + */ + @ApiModelProperty(value = "机具编码") + private String maCode; + + @ApiModelProperty(value = "机具外观判断") + private String apDetection; + + /** + * 附件列表 + */ + @ApiModelProperty(value = "附件列表") + List bmFileInfos; +} diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/domain/vo/BackApplyRequestVo.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/domain/vo/BackApplyRequestVo.java new file mode 100644 index 00000000..2327ebcb --- /dev/null +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/domain/vo/BackApplyRequestVo.java @@ -0,0 +1,28 @@ +package com.bonus.material.back.domain.vo; + +import com.bonus.material.back.domain.BackApplyDetails; +import com.bonus.material.back.domain.BackApplyInfo; +import lombok.Data; + +import java.util.List; + +/** + * 退料申请请求参数 + * @Author ma_sh + * @create 2024/11/11 15:32 + */ +@Data +public class BackApplyRequestVo { + + private Long id; + + /** + * 退料申请信息 + */ + private BackApplyInfo backApplyInfo; + + /** + * 退料申请明细 + */ + private List backApplyDetailsList; +} diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/domain/vo/MaCodeVo.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/domain/vo/MaCodeVo.java new file mode 100644 index 00000000..9334e9a8 --- /dev/null +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/domain/vo/MaCodeVo.java @@ -0,0 +1,27 @@ +package com.bonus.material.back.domain.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @Author ma_sh + * @create 2024/11/11 18:30 + */ +@Data +public class MaCodeVo { + + private Long maId; + + private String maCode; + + private String maStatus; + + private String typeId; + + private String materialName; + + private String typeName; + + @ApiModelProperty(value = "机具外观判断") + private String apDetection; +} diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/mapper/BackApplyInfoMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/mapper/BackApplyInfoMapper.java index 339080b0..b47379f7 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/mapper/BackApplyInfoMapper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/mapper/BackApplyInfoMapper.java @@ -1,7 +1,12 @@ package com.bonus.material.back.mapper; +import java.util.Date; import java.util.List; + +import com.bonus.material.back.domain.BackApplyDetails; import com.bonus.material.back.domain.BackApplyInfo; +import com.bonus.material.back.domain.vo.MaCodeVo; +import org.apache.ibatis.annotations.Param; /** * 退料任务Mapper接口 @@ -57,4 +62,97 @@ public interface BackApplyInfoMapper { * @return 结果 */ public int deleteBackApplyInfoByIds(Long[] ids); + + /** + * 查询任务编号 + * @param date + * @param taskType + * @return + */ + String selectTaskNumByMonth(@Param("date") Date date, @Param("taskType") Integer taskType); + + /** + * 新增任务 + * @param backApplyInfo + * @return + */ + int insertTmTask(BackApplyInfo backApplyInfo); + + /** + * 新增任务关联协议 + * @param backApplyInfo + * @return + */ + int insertTaskAgreement(BackApplyInfo backApplyInfo); + + /** + * 新增任务详情 + * @param details + * @return + */ + int insertBackApplyDetails(BackApplyDetails details); + + /** + * 根据机具编码和类型查询机具是否存在 + * @param dto + * @return + */ + List getMachineById(BackApplyInfo dto); + + /** + * 根据任务id查询详情 + * @param id + * @return + */ + List selectBackApplyDetailsListByTaskId(Long id); + + /** + * 根据设备编码查询设备信息 + * @param id + * @return + */ + List selectByCode(Long id); + + /** + * 新增机具退料详情 + * @param details + * @return + */ + int insertCheckDetails(BackApplyDetails details); + + /** + * 删除任务 + * @param taskId + * @return + */ + int deleteTask(Long taskId); + + /** + * 删除任务关联协议 + * @param taskId + * @return + */ + int deleteTaskAgreement(Long taskId); + + /** + * 删除退料主表 + * @param id + * @return + */ + int deleteBackApply(Long id); + + /** + * 删除退料详情 + * @param id + * @return + */ + int deleteBackApplyDetails(Long id); + + /** + * 删除机具退料详情 + * @param id + * @return + */ + int deleteCheckDetails(Long id); + } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/service/IBackApplyInfoService.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/service/IBackApplyInfoService.java index ad063be6..d8cea68c 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/service/IBackApplyInfoService.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/service/IBackApplyInfoService.java @@ -1,7 +1,10 @@ package com.bonus.material.back.service; import java.util.List; + +import com.bonus.common.core.web.domain.AjaxResult; import com.bonus.material.back.domain.BackApplyInfo; +import com.bonus.material.back.domain.vo.BackApplyRequestVo; /** * 退料任务Service接口 @@ -16,7 +19,7 @@ public interface IBackApplyInfoService { * @param id 退料任务主键 * @return 退料任务 */ - public BackApplyInfo selectBackApplyInfoById(Long id); + public BackApplyRequestVo selectBackApplyInfoById(Long id); /** * 查询退料任务列表 @@ -29,18 +32,18 @@ public interface IBackApplyInfoService { /** * 新增退料任务 * - * @param backApplyInfo 退料任务 + * @param dto 退料任务 * @return 结果 */ - public int insertBackApplyInfo(BackApplyInfo backApplyInfo); + public AjaxResult insertBackApplyInfo(BackApplyRequestVo dto); /** * 修改退料任务 * - * @param backApplyInfo 退料任务 + * @param dto 退料任务 * @return 结果 */ - public int updateBackApplyInfo(BackApplyInfo backApplyInfo); + public AjaxResult updateBackApplyInfo(BackApplyRequestVo dto); /** * 批量删除退料任务 @@ -56,5 +59,12 @@ public interface IBackApplyInfoService { * @param id 退料任务主键 * @return 结果 */ - public int deleteBackApplyInfoById(Long id); + public AjaxResult deleteBackApplyInfoById(Long id); + + /** + * 根据机具编码和类型查询机具是否存在 + * @param dto + * @return + */ + AjaxResult getMachineById(BackApplyInfo dto); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/service/impl/BackApplyInfoServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/service/impl/BackApplyInfoServiceImpl.java index 301f3d8e..41a4a5eb 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/service/impl/BackApplyInfoServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/service/impl/BackApplyInfoServiceImpl.java @@ -1,13 +1,31 @@ package com.bonus.material.back.service.impl; -import java.util.List; +import java.text.SimpleDateFormat; +import java.util.*; +import java.util.stream.Collectors; + +import cn.hutool.core.util.PhoneUtil; +import com.alibaba.nacos.common.utils.CollectionUtils; +import com.bonus.common.biz.enums.HttpCodeEnum; import com.bonus.common.core.exception.ServiceException; import com.bonus.common.core.utils.DateUtils; -import org.springframework.beans.factory.annotation.Autowired; +import com.bonus.common.core.utils.StringUtils; +import com.bonus.common.core.web.domain.AjaxResult; +import com.bonus.common.security.utils.SecurityUtils; +import com.bonus.material.back.domain.BackApplyDetails; +import com.bonus.material.back.domain.MaCodeDto; +import com.bonus.material.back.domain.vo.BackApplyRequestVo; +import com.bonus.material.back.domain.vo.MaCodeVo; +import com.bonus.material.basic.domain.BmFileInfo; +import com.bonus.material.basic.mapper.BmFileInfoMapper; +import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; import com.bonus.material.back.mapper.BackApplyInfoMapper; import com.bonus.material.back.domain.BackApplyInfo; import com.bonus.material.back.service.IBackApplyInfoService; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.Resource; /** * 退料任务Service业务层处理 @@ -16,10 +34,15 @@ import com.bonus.material.back.service.IBackApplyInfoService; * @date 2024-10-16 */ @Service +@Slf4j public class BackApplyInfoServiceImpl implements IBackApplyInfoService { - @Autowired + + @Resource private BackApplyInfoMapper backApplyInfoMapper; + @Resource + private BmFileInfoMapper bmFileInfoMapper; + /** * 查询退料任务 * @@ -27,8 +50,109 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService { * @return 退料任务 */ @Override - public BackApplyInfo selectBackApplyInfoById(Long id) { - return backApplyInfoMapper.selectBackApplyInfoById(id); + public BackApplyRequestVo selectBackApplyInfoById(Long id) { + BackApplyRequestVo backApplyRequestVo = new BackApplyRequestVo(); + //先根据外层id查询上层信息 + BackApplyInfo backApplyInfo = backApplyInfoMapper.selectBackApplyInfoById(id); + backApplyRequestVo.setBackApplyInfo(backApplyInfo); + //查询退料详情信息 + List backApplyDetailsList = backApplyInfoMapper.selectBackApplyDetailsListByTaskId(id); + if (CollectionUtils.isNotEmpty(backApplyDetailsList)) { + // 批量查询附件信息,减少数据库访问次数 + List bmFileInfos = fetchBmFileInfos(id, backApplyDetailsList); + // 查询编码设备信息 + List maCodeList = fetchMaCodeList(id); + for (BackApplyDetails details : backApplyDetailsList) { + // 为每个退料详情设置附件信息 + setBmFileInfosForDetails(details, bmFileInfos); + // 如果是编码设备,查询并设置相关的编码信息和附件 + if ("0".equals(details.getManageType())) { + setMaCodeDetails(details, maCodeList); + } + } + backApplyRequestVo.setBackApplyDetailsList(backApplyDetailsList); + } + return backApplyRequestVo; + } + + /** + * 批量查询附件信息 + * @param id + * @param backApplyDetailsList + * @return + */ + private List fetchBmFileInfos(Long id, List backApplyDetailsList) { + List bmFileInfos = new ArrayList<>(); + for (BackApplyDetails details : backApplyDetailsList) { + BmFileInfo bmFileInfo = new BmFileInfo(); + bmFileInfo.setTaskId(id); + bmFileInfo.setTaskType(3); + bmFileInfo.setModelId(details.getId()); + List bmFileInfoList = bmFileInfoMapper.selectBmFileInfoList(bmFileInfo); + // 合并所有附件信息 + bmFileInfos.addAll(bmFileInfoList); + } + return bmFileInfos; + } + + /** + * 查询编码设备信息 + * @param id + * @return + */ + private List fetchMaCodeList(Long id) { + return backApplyInfoMapper.selectByCode(id); + } + + /** + * 为每个退料详情设置附件信息 + * @param details + * @param bmFileInfos + */ + private void setBmFileInfosForDetails(BackApplyDetails details, List bmFileInfos) { + // 为每个退料详情设置附件信息 + List relatedFileInfos = bmFileInfos.stream() + .filter(fileInfo -> fileInfo.getModelId().equals(details.getId())) + .collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(relatedFileInfos)) { + details.setBmFileInfos(relatedFileInfos); + } + } + + /** + * 为编码设备详情设置编码信息和附件信息 + * @param details + * @param maCodeList + */ + private void setMaCodeDetails(BackApplyDetails details, List maCodeList) { + List maCodeDtos = new ArrayList<>(); + for (MaCodeVo maCodeVo : maCodeList) { + MaCodeDto maCodeDto = new MaCodeDto(); + maCodeDto.setMaCode(maCodeVo.getMaCode()); + maCodeDto.setMaId(maCodeVo.getMaId()); + maCodeDto.setApDetection(maCodeVo.getApDetection()); + // 查询并设置编码附件 + List bmFileInfoList = fetchBmFileInfos(details.getId(), maCodeVo.getMaId()); + if (CollectionUtils.isNotEmpty(bmFileInfoList)) { + maCodeDto.setBmFileInfos(bmFileInfoList); + } + maCodeDtos.add(maCodeDto); + } + details.setMaCodeList(maCodeDtos); + } + + /** + * 查询编码设备附件信息 + * @param taskId + * @param modelId + * @return + */ + private List fetchBmFileInfos(Long taskId, Long modelId) { + BmFileInfo fileInfo = new BmFileInfo(); + fileInfo.setTaskId(taskId); + fileInfo.setTaskType(3); + fileInfo.setModelId(modelId); + return bmFileInfoMapper.selectBmFileInfoList(fileInfo); } /** @@ -45,33 +169,206 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService { /** * 新增退料任务 * - * @param backApplyInfo 退料任务 + * @param dto 退料任务 * @return 结果 */ @Override - public int insertBackApplyInfo(BackApplyInfo backApplyInfo) { - backApplyInfo.setCreateTime(DateUtils.getNowDate()); - try { - return backApplyInfoMapper.insertBackApplyInfo(backApplyInfo); - } catch (Exception e) { - throw new ServiceException("错误信息描述"); + @Transactional(rollbackFor = Exception.class) + public AjaxResult insertBackApplyInfo(BackApplyRequestVo dto) { + if (dto == null || dto.getBackApplyInfo() == null || CollectionUtils.isEmpty(dto.getBackApplyDetailsList())) { + return AjaxResult.error("参数为空,请重新选择后上传!"); } + //对传入的手机号进行校验 + if (StringUtils.isNotBlank(dto.getBackApplyInfo().getPhone()) && !PhoneUtil.isMobile(dto.getBackApplyInfo().getPhone())) { + return AjaxResult.error("手机号格式不正确,请重新填写!"); + } + //生成退料单号 + String code = getString(); + if (StringUtils.isBlank(code)) { + return AjaxResult.error("后台退料编号生成异常,请重试!"); + } + BackApplyInfo backApplyInfo = dto.getBackApplyInfo(); + backApplyInfo.setCode(code); + backApplyInfo.setCreateBy(SecurityUtils.getUsername()); + backApplyInfo.setCreateTime(DateUtils.getNowDate()); + backApplyInfo.setTaskType(3); + backApplyInfo.setTaskStatus(0); + backApplyInfo.setStatus("0"); + + int result = 0; + try { + // 保存退料信息到 tm_task 表中 + result += backApplyInfoMapper.insertTmTask(backApplyInfo); + if (result > 0) { + Long taskId = backApplyInfo.getTaskId(); + result += backApplyInfoMapper.insertTaskAgreement(backApplyInfo); + backApplyInfo.setTaskId(taskId); + result += backApplyInfoMapper.insertBackApplyInfo(backApplyInfo); + } + // 保存退料详情 + result = saveBackApplyDetails(dto, backApplyInfo, result); + } catch (Exception e) { + log.error("保存退料信息时发生异常: ", e); + } + return result > 0 ? AjaxResult.success() : AjaxResult.error("保存失败,请重试!"); + } + + /** + * 保存退料详情 + * @param dto + * @param backApplyInfo + * @param result + * @return + */ + private int saveBackApplyDetails(BackApplyRequestVo dto, BackApplyInfo backApplyInfo, int result) { + for (BackApplyDetails details : dto.getBackApplyDetailsList()) { + details.setCode(backApplyInfo.getCode()); + details.setParentId(backApplyInfo.getId()); + details.setAuditNum(details.getPreNum()); + details.setStatus("0"); + details.setCreateBy(SecurityUtils.getUsername()); + details.setCreateTime(DateUtils.getNowDate()); + // 保存退料详情 + result += backApplyInfoMapper.insertBackApplyDetails(details); + // 处理附件 + result = saveBmFileInfo(details, backApplyInfo.getId(), result); + // 判断是否为编码设备并处理附件 + result = saveMaCodeBmFileInfo(details, backApplyInfo.getId(), result); + } + return result; + } + + /** + * 保存附件 + * @param details + * @param taskId + * @param result + * @return + */ + private int saveBmFileInfo(BackApplyDetails details, Long taskId, int result) { + if (CollectionUtils.isNotEmpty(details.getBmFileInfos())) { + for (BmFileInfo bmFileInfo : details.getBmFileInfos()) { + bmFileInfo.setCreateBy(SecurityUtils.getUsername()); + bmFileInfo.setCreateTime(DateUtils.getNowDate()); + bmFileInfo.setTaskId(taskId); + bmFileInfo.setTaskType(3); + bmFileInfo.setModelId(details.getId()); + result += bmFileInfoMapper.insertBmFileInfo(bmFileInfo); + } + } + return result; + } + + /** + * 保存编码设备附件 + * @param details + * @param id + * @param result + * @return + */ + private int saveMaCodeBmFileInfo(BackApplyDetails details, Long id, int result) { + if (CollectionUtils.isNotEmpty(details.getMaCodeList())) { + for (MaCodeDto maCodeDto : details.getMaCodeList()) { + details.setMaId(maCodeDto.getMaId()); + details.setParentId(id); + details.setCreateBy(SecurityUtils.getUsername()); + details.setCreateTime(DateUtils.getNowDate()); + details.setStatus("0"); + result += backApplyInfoMapper.insertCheckDetails(details); + if (CollectionUtils.isNotEmpty(maCodeDto.getBmFileInfos())) { + for (BmFileInfo bmFileInfo : maCodeDto.getBmFileInfos()) { + bmFileInfo.setCreateBy(SecurityUtils.getUsername()); + bmFileInfo.setCreateTime(DateUtils.getNowDate()); + bmFileInfo.setTaskId(details.getId()); + bmFileInfo.setTaskType(3); + bmFileInfo.setModelId(maCodeDto.getMaId()); + result += bmFileInfoMapper.insertBmFileInfo(bmFileInfo); + } + } + } + } + return result; + } + + /** + * 生成退料单号 + * @return + */ + private String getString() { + //根据前台传过来的数据,生成退料单号 + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd"); + Date nowDate = DateUtils.getNowDate(); + String format = dateFormat.format(nowDate); + String taskNum = backApplyInfoMapper.selectTaskNumByMonth(nowDate, 3); + if (StringUtils.isNotBlank(taskNum)) { + // 将字符串转换为整数 + int num = Integer.parseInt(taskNum); + // 执行加一操作 + num++; + // 将结果转换回字符串格式,并确保结果是2位数,不足2位则在前面补0 + taskNum = String.format("%02d", num); + } else { + taskNum = "01"; + } + return "H" + format + "-" + taskNum; } /** * 修改退料任务 * - * @param backApplyInfo 退料任务 + * @param dto 退料任务 * @return 结果 */ @Override - public int updateBackApplyInfo(BackApplyInfo backApplyInfo) { - backApplyInfo.setUpdateTime(DateUtils.getNowDate()); + public AjaxResult updateBackApplyInfo(BackApplyRequestVo dto) { try { - return backApplyInfoMapper.updateBackApplyInfo(backApplyInfo); + //针对修改,先删除,后添加 + //对传入的手机号进行校验 + if (StringUtils.isNotBlank(dto.getBackApplyInfo().getPhone()) && !PhoneUtil.isMobile(dto.getBackApplyInfo().getPhone())) { + return AjaxResult.error("手机号格式不正确,请重新填写!"); + } + // 查询信息 + Long id = dto.getId(); + BackApplyInfo backApplyInfo = backApplyInfoMapper.selectBackApplyInfoById(id); + List backApplyDetailsList = backApplyInfoMapper.selectBackApplyDetailsListByTaskId(id); + List maCodeList = backApplyInfoMapper.selectByCode(id); + // 删除相关任务信息 + int result = 0; + result += backApplyInfoMapper.deleteTask(backApplyInfo.getTaskId()); + result += backApplyInfoMapper.deleteTaskAgreement(backApplyInfo.getTaskId()); + result += backApplyInfoMapper.deleteBackApplyDetails(backApplyInfo.getId()); + result += backApplyInfoMapper.deleteCheckDetails(backApplyInfo.getId()); + // 删除退料详情附件 + result += deleteFileInfoForDetails(backApplyDetailsList, id); + // 删除编码设备附件 + result += deleteFileInfoForMaCodes(maCodeList, id); + if (result > 0) { + //执行新增操作 + backApplyInfo.setTaskType(3); + backApplyInfo.setTaskStatus(0); + backApplyInfo.setStatus("0"); + backApplyInfo.setId(id); + backApplyInfo.setUpdateTime(DateUtils.getNowDate()); + backApplyInfo.setUpdateBy(SecurityUtils.getUsername()); + backApplyInfo.setBackPerson(dto.getBackApplyInfo().getBackPerson()); + backApplyInfo.setPhone(dto.getBackApplyInfo().getPhone()); + backApplyInfo.setRemark(dto.getBackApplyInfo().getRemark() == null ? backApplyInfo.getRemark() : dto.getBackApplyInfo().getRemark()); + // 保存退料信息到 tm_task 表中 + result += backApplyInfoMapper.insertTmTask(backApplyInfo); + if (result > 0) { + Long taskId = backApplyInfo.getTaskId(); + result += backApplyInfoMapper.insertTaskAgreement(backApplyInfo); + backApplyInfo.setTaskId(taskId); + result += backApplyInfoMapper.updateBackApplyInfo(backApplyInfo); + } + // 保存退料详情 + result = saveBackApplyDetails(dto, backApplyInfo, result); + return AjaxResult.success(result); + } } catch (Exception e) { - throw new ServiceException("错误信息描述"); + throw new ServiceException("修改失败,请联系管理员"); } + return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), HttpCodeEnum.FAIL.getMsg()); } /** @@ -92,7 +389,94 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService { * @return 结果 */ @Override - public int deleteBackApplyInfoById(Long id) { - return backApplyInfoMapper.deleteBackApplyInfoById(id); + @Transactional(rollbackFor = Exception.class) + public AjaxResult deleteBackApplyInfoById(Long id) { + try { + // 查询信息 + BackApplyInfo backApplyInfo = backApplyInfoMapper.selectBackApplyInfoById(id); + List backApplyDetailsList = backApplyInfoMapper.selectBackApplyDetailsListByTaskId(id); + List maCodeList = backApplyInfoMapper.selectByCode(id); + // 删除相关任务信息 + int result = deleteTaskInfo(backApplyInfo); + // 删除退料详情附件 + result += deleteFileInfoForDetails(backApplyDetailsList, id); + // 删除编码设备附件 + result += deleteFileInfoForMaCodes(maCodeList, id); + if (result > 0) { + return AjaxResult.success(result); + } + } catch (Exception e) { + e.printStackTrace(); + } + return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), HttpCodeEnum.FAIL.getMsg()); } + + /** + * 删除任务信息 + * @param backApplyInfo + * @return + */ + private int deleteTaskInfo(BackApplyInfo backApplyInfo) { + // 删除任务、任务协议及相关信息 + int result = 0; + result += backApplyInfoMapper.deleteTask(backApplyInfo.getTaskId()); + result += backApplyInfoMapper.deleteTaskAgreement(backApplyInfo.getTaskId()); + result += backApplyInfoMapper.deleteBackApply(backApplyInfo.getId()); + result += backApplyInfoMapper.deleteBackApplyDetails(backApplyInfo.getId()); + result += backApplyInfoMapper.deleteCheckDetails(backApplyInfo.getId()); + return result; + } + + /** + * 删除退料详情相关附件 + * @param backApplyDetailsList + * @param taskId + * @return + */ + private int deleteFileInfoForDetails(List backApplyDetailsList, Long taskId) { + // 删除退料详情相关附件 + int result = 0; + if (CollectionUtils.isNotEmpty(backApplyDetailsList)) { + for (BackApplyDetails details : backApplyDetailsList) { + BmFileInfo bmFileInfo = new BmFileInfo(); + bmFileInfo.setModelId(details.getId()); + bmFileInfo.setTaskId(taskId); + bmFileInfo.setTaskType(3); + result += bmFileInfoMapper.deleteBmFileInfoByBizInfo(bmFileInfo); + } + } + return result; + } + + /** + * 删除编码设备相关附件 + * @param maCodeList + * @param taskId + * @return + */ + private int deleteFileInfoForMaCodes(List maCodeList, Long taskId) { + // 删除编码设备相关附件 + int result = 0; + if (CollectionUtils.isNotEmpty(maCodeList)) { + for (MaCodeVo maCodeVo : maCodeList) { + BmFileInfo bmFileInfo = new BmFileInfo(); + bmFileInfo.setModelId(maCodeVo.getMaId()); + bmFileInfo.setTaskId(taskId); + bmFileInfo.setTaskType(3); + result += bmFileInfoMapper.deleteBmFileInfoByBizInfo(bmFileInfo); + } + } + return result; + } + + /** + * 根据机具编码和类型查询机具是否存在 + * @param dto + * @return + */ + @Override + public AjaxResult getMachineById(BackApplyInfo dto) { + return AjaxResult.success(backApplyInfoMapper.getMachineById(dto)); + } + } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/common/controller/SelectController.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/common/controller/SelectController.java index c549b584..735a1a84 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/common/controller/SelectController.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/common/controller/SelectController.java @@ -1,6 +1,7 @@ package com.bonus.material.common.controller; import com.bonus.common.core.web.domain.AjaxResult; +import com.bonus.material.back.domain.BackApplyInfo; import com.bonus.material.basic.domain.BmProject; import com.bonus.material.basic.domain.BmUnit; import com.bonus.material.common.domain.dto.SelectDto; @@ -124,4 +125,10 @@ public class SelectController { public AjaxResult getAgreementInfoById(@RequestBody SelectDto dto){ return service.getAgreementInfoById(dto); } + + @ApiOperation(value = "在用设备类型树") + @PostMapping("/getUseTypeTree") + public AjaxResult getUseTypeTree(@RequestBody BackApplyInfo bean) { + return service.getUseTypeTree(bean); + } } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/common/mapper/SelectMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/common/mapper/SelectMapper.java index 13a6baa1..6340dc38 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/common/mapper/SelectMapper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/common/mapper/SelectMapper.java @@ -1,6 +1,8 @@ package com.bonus.material.common.mapper; import com.bonus.common.biz.domain.TreeNode; +import com.bonus.common.biz.domain.TypeTreeNode; +import com.bonus.material.back.domain.BackApplyInfo; import com.bonus.material.basic.domain.BmProject; import com.bonus.material.basic.domain.BmUnit; import com.bonus.material.common.domain.dto.SelectDto; @@ -113,4 +115,25 @@ public interface SelectMapper { * @return List */ List getPartTree(SelectDto dto); + + /** + * 在用设备类型树4级 + * @param bean + * @return + */ + List getUseTypeTreeL4(BackApplyInfo bean); + + /** + * 在用设备类型树3级 + * @param list + * @return + */ + List getUseTypeTreeL3(List list); + + /** + * 在用设备类型树2级 + * @param list + * @return + */ + List getUseTypeTreeL21(List list); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/common/service/SelectService.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/common/service/SelectService.java index 5e63291f..d8aec26e 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/common/service/SelectService.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/common/service/SelectService.java @@ -1,6 +1,7 @@ package com.bonus.material.common.service; import com.bonus.common.core.web.domain.AjaxResult; +import com.bonus.material.back.domain.BackApplyInfo; import com.bonus.material.basic.domain.BmProject; import com.bonus.material.basic.domain.BmUnit; import com.bonus.material.common.domain.dto.SelectDto; @@ -178,4 +179,10 @@ public interface SelectService { */ AjaxResult getPartTree(SelectDto dto); + /** + * 在用设备类型树 + * @param bean + * @return + */ + AjaxResult getUseTypeTree(BackApplyInfo bean); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/common/service/impl/SelectServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/common/service/impl/SelectServiceImpl.java index ad6f57c5..769ac569 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/common/service/impl/SelectServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/common/service/impl/SelectServiceImpl.java @@ -3,7 +3,10 @@ package com.bonus.material.common.service.impl; import com.bonus.common.biz.constant.GlobalConstants; import com.bonus.common.biz.domain.TreeBuild; import com.bonus.common.biz.domain.TreeNode; +import com.bonus.common.biz.domain.TypeTreeBuild; +import com.bonus.common.biz.domain.TypeTreeNode; import com.bonus.common.core.web.domain.AjaxResult; +import com.bonus.material.back.domain.BackApplyInfo; import com.bonus.material.basic.domain.BmProject; import com.bonus.material.basic.domain.BmUnit; import com.bonus.material.common.domain.dto.SelectDto; @@ -17,7 +20,7 @@ import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.util.ArrayList; import java.util.List; -import java.util.Objects; +import java.util.stream.Collectors; /** * @author 10488 @@ -213,6 +216,44 @@ public class SelectServiceImpl implements SelectService { return AjaxResult.success(groupList); } + /** + * 在用设备类型树 + * @param bean + * @return + */ + @Override + public AjaxResult getUseTypeTree(BackApplyInfo bean) { + List groupList = new ArrayList<>(); + List list = new ArrayList<>(); + List listL4 = new ArrayList<>(); + List listL3 = new ArrayList<>(); + List listL21 = new ArrayList<>(); + try { + // 先查第四层类型 + listL4 = mapper.getUseTypeTreeL4(bean); + if (CollectionUtils.isNotEmpty(listL4)) { + List list4ParentIds = listL4.stream().map(o -> o.getParentId()).collect(Collectors.toList()); + // 根据第四层parentId 查第三层类型 + listL3 = mapper.getUseTypeTreeL3(list4ParentIds); + List list3ParentIds = listL3.stream().map(o -> o.getParentId()).collect(Collectors.toList()); + // 根据第三层parentId 查第1.2层类型 + listL21 = mapper.getUseTypeTreeL21(list3ParentIds); + list.addAll(listL4); + list.addAll(listL3); + list.addAll(listL21); + } + if (CollectionUtils.isNotEmpty(list)) { + // 创建树形结构(数据集合作为参数) + TypeTreeBuild treeBuild = new TypeTreeBuild(list); + // 原查询结果转换树形结构 + groupList = treeBuild.buildTree(); + } + } catch (Exception e) { + AjaxResult.error("类型树-查询失败", e); + } + return AjaxResult.success(groupList); + } + @Override public AjaxResult getGoodsShelvesCbx(SelectDto dto) { List groupList = new ArrayList<>(); diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/back/BackApplyInfoMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/back/BackApplyInfoMapper.xml index f0f4ac26..50b1d7f8 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/back/BackApplyInfoMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/back/BackApplyInfoMapper.xml @@ -27,28 +27,174 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" select id, code, task_id, back_person, phone, direct_audit_by, direct_audit_time, direct_audit_remark, create_by, create_time, update_by, update_time, remark, company_id, back_time, status, direct_id from back_apply_info - + SELECT + bai.id as id, + bai.`code` as code, + bai.back_person as backPerson, + bai.phone as phone, + bp.pro_id as proId, + bai.remark as remark, + bp.pro_name as proName, + bu.unit_id as unitId, + bu.unit_name as unitName, + bai.back_time as backTime, + tt.task_status as taskStatus, + bai.create_by as createBy, + bai.create_time as createTime, + GROUP_CONCAT(DISTINCT mt2.type_id) as typeId, + GROUP_CONCAT(mt2.type_name) AS typeName, + bai.`status` AS status, + bai.print_status as printStatus + FROM + back_apply_info bai + LEFT JOIN back_apply_details bad on bad.parent_id = bai.id + LEFT JOIN tm_task tt on tt.task_id = bai.task_id and tt.status = '1' + LEFT JOIN tm_task_agreement tta on tta.task_id = tt.task_id + LEFT JOIN bm_agreement_info bagi on bagi.agreement_id = tta.agreement_id + AND bagi.`status` = '1' + LEFT JOIN bm_project bp on bp.pro_id = bagi.project_id + AND bp.del_flag = '0' + LEFT JOIN bm_unit bu on bu.unit_id = bagi.unit_id + AND bu.del_flag = '0' + LEFT JOIN ma_type mt1 ON mt1.type_id = bad.type_id AND mt1.del_flag = '0' + LEFT JOIN ma_type mt2 ON mt2.type_id = mt1.parent_id AND mt2.del_flag = '0' + WHERE + 1=1 + + and ( + bu.unit_name like concat('%', #{keyWord}, '%') or + bp.pro_name like concat('%', #{keyWord}, '%') or + bai.`code` like concat('%', #{keyWord}, '%') or + bai.back_person like concat('%', #{keyWord}, '%') or + bai.phone like concat('%', #{keyWord}, '%') + ) + + + + + + and bai.status = #{status} + + GROUP BY bai.`code` + ORDER BY bai.create_time desc - - + SELECT SUBSTRING(`code`, - 2) as code + FROM tm_task + WHERE DATE_FORMAT(create_time, '%y%m') = DATE_FORMAT(#{date}, '%y%m') + AND task_type = #{taskType} + ORDER BY create_time DESC LIMIT 1 - + + + + + + + + + insert into back_apply_info @@ -89,6 +235,125 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + insert into tm_task ( + task_type, + task_status, + code, + create_by, + remark, + company_id, + create_time + ) values ( + #{taskType}, + #{taskStatus}, + #{code}, + #{createBy}, + #{remark}, + #{companyId}, + NOW() + ) + + + + insert into tm_task_agreement + ( + + task_id, + + + agreement_id, + + + create_by, + + + remark, + + + company_id, + + create_time + ) values ( + + #{taskId}, + + + #{agreementId}, + + + #{createBy}, + + + #{remark}, + + + #{companyId}, + + NOW() + ) + + + + insert into back_apply_details + + code, + parent_id, + type_id, + pre_num, + audit_num, + use_num, + status, + create_by, + create_time, + ap_detection, + remark, + company_id, + + + #{code}, + #{parentId}, + #{typeId}, + #{preNum}, + #{auditNum}, + #{num}, + #{status}, + #{createBy}, + #{createTime}, + #{apDetection}, + #{remark}, + #{companyId}, + + + + + insert into back_check_details + + parent_id, + type_id, + back_num, + ma_id, + status, + create_by, + create_time, + remark, + ap_detection, + company_id, + + + #{parentId}, + #{typeId}, + #{preNum}, + #{maId}, + #{status}, + #{createBy}, + #{createTime}, + #{remark}, + #{apDetection}, + #{companyId}, + + + update back_apply_info @@ -99,8 +364,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" direct_audit_by = #{directAuditBy}, direct_audit_time = #{directAuditTime}, direct_audit_remark = #{directAuditRemark}, - create_by = #{createBy}, - create_time = #{createTime}, update_by = #{updateBy}, update_time = #{updateTime}, remark = #{remark}, @@ -122,4 +385,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{id} + + + update tm_task set status = 0 where task_id = #{taskId} + + + + delete from tm_task_agreement where task_id = #{taskId} + + + + delete from back_apply_info where id = #{id} + + + + delete from back_apply_details where parent_id = #{id} + + + + delete from back_check_details where parent_id = #{id} + \ No newline at end of file diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/common/SelectMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/common/SelectMapper.xml index 6b18ebed..f44d948e 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/common/SelectMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/common/SelectMapper.xml @@ -144,4 +144,81 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" FROM bm_agreement_info WHERE unit_id = #{unitId} AND project_id = #{projectId} AND status = '1' + + + + + + \ No newline at end of file From 3806ae330aa5315f8b253c7d7c5b03e0f30589b5 Mon Sep 17 00:00:00 2001 From: sxu <602087911@qq.com> Date: Wed, 13 Nov 2024 18:26:33 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E5=90=88=E5=B9=B6=E9=A2=86=E6=96=99?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../LeaseApplyDetailsController.java | 238 +++++++++--------- .../controller/LeaseApplyInfoController.java | 27 +- .../controller/LeaseOutDetailsController.java | 226 ++++++++--------- .../material/lease/domain/LeaseApplyInfo.java | 56 ++++- .../lease/domain/vo/LeaseApplyRequestVo.java | 9 +- .../lease/domain/vo/LeaseOutRequestVo.java | 35 +++ .../lease/service/ILeaseApplyInfoService.java | 22 +- .../service/ILeaseOutDetailsService.java | 2 + .../impl/LeaseApplyInfoServiceImpl.java | 64 +++-- .../impl/LeaseOutDetailsServiceImpl.java | 2 +- .../task/controller/TmTaskController.java | 3 - .../task/domain/vo/TmTaskRequestVo.java | 194 +++++++------- .../material/task/mapper/TmTaskMapper.java | 4 - .../material/task/service/ITmTaskService.java | 1 - .../task/service/impl/TmTaskServiceImpl.java | 7 - 15 files changed, 507 insertions(+), 383 deletions(-) create mode 100644 bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/domain/vo/LeaseOutRequestVo.java diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/controller/LeaseApplyDetailsController.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/controller/LeaseApplyDetailsController.java index bab9f5e5..c30853b0 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/controller/LeaseApplyDetailsController.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/controller/LeaseApplyDetailsController.java @@ -1,119 +1,119 @@ -package com.bonus.material.lease.controller; - -import java.util.List; -import javax.servlet.http.HttpServletResponse; -import com.bonus.common.log.enums.OperaType; -import com.bonus.material.common.annotation.PreventRepeatSubmit; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; -import com.bonus.common.log.annotation.SysLog; -import com.bonus.common.security.annotation.RequiresPermissions; -import com.bonus.material.lease.domain.LeaseApplyDetails; -import com.bonus.material.lease.service.ILeaseApplyDetailsService; -import com.bonus.common.core.web.controller.BaseController; -import com.bonus.common.core.web.domain.AjaxResult; -import com.bonus.common.core.utils.poi.ExcelUtil; -import com.bonus.common.core.web.page.TableDataInfo; - -/** - * 领料任务详细Controller - * - * @author xsheng - * @date 2024-10-16 - */ -@Api(tags = "领料任务详细接口") -@RestController -@RequestMapping("/lease_apply_details") -public class LeaseApplyDetailsController extends BaseController { - @Autowired - private ILeaseApplyDetailsService leaseApplyDetailsService; - - /** - * 查询领料任务详细列表 - */ - @ApiOperation(value = "查询领料任务详细列表") - @RequiresPermissions("lease:details:list") - @GetMapping("/list") - public TableDataInfo list(LeaseApplyDetails leaseApplyDetails) { - startPage(); - List list = leaseApplyDetailsService.selectLeaseApplyDetailsList(leaseApplyDetails); - return getDataTable(list); - } - - /** - * 导出领料任务详细列表 - */ - @ApiOperation(value = "导出领料任务详细列表") - @PreventRepeatSubmit - @RequiresPermissions("lease:details:export") - @SysLog(title = "领料任务详细", businessType = OperaType.EXPORT, logType = 1,module = "仓储管理->导出领料任务详细") - @PostMapping("/export") - public void export(HttpServletResponse response, LeaseApplyDetails leaseApplyDetails) { - List list = leaseApplyDetailsService.selectLeaseApplyDetailsList(leaseApplyDetails); - ExcelUtil util = new ExcelUtil(LeaseApplyDetails.class); - util.exportExcel(response, list, "领料任务详细数据"); - } - - /** - * 获取领料任务详细详细信息 - */ - @ApiOperation(value = "获取领料任务详细详细信息") - @RequiresPermissions("lease:details:query") - @GetMapping(value = "/{id}") - public AjaxResult getInfo(@PathVariable("id") Long id) { - return success(leaseApplyDetailsService.selectLeaseApplyDetailsById(id)); - } - - /** - * 新增领料任务详细 - */ - @ApiOperation(value = "新增领料任务详细") - @PreventRepeatSubmit - @RequiresPermissions("lease:details:add") - @SysLog(title = "领料任务详细", businessType = OperaType.INSERT, logType = 1,module = "仓储管理->新增领料任务详细") - @PostMapping - public AjaxResult add(@RequestBody LeaseApplyDetails leaseApplyDetails) { - try { - return toAjax(leaseApplyDetailsService.insertLeaseApplyDetails(leaseApplyDetails)); - } catch (Exception e) { - return error("系统错误, " + e.getMessage()); - } - } - - /** - * 修改领料任务详细 - */ - @ApiOperation(value = "修改领料任务详细") - @PreventRepeatSubmit - @RequiresPermissions("lease:details:edit") - @SysLog(title = "领料任务详细", businessType = OperaType.UPDATE, logType = 1,module = "仓储管理->修改领料任务详细") - @PutMapping - public AjaxResult edit(@RequestBody LeaseApplyDetails leaseApplyDetails) { - try { - return toAjax(leaseApplyDetailsService.updateLeaseApplyDetails(leaseApplyDetails)); - } catch (Exception e) { - return error("系统错误, " + e.getMessage()); - } - } - - /** - * 删除领料任务详细 - */ - @ApiOperation(value = "删除领料任务详细") - @PreventRepeatSubmit - @RequiresPermissions("lease:details:remove") - @SysLog(title = "领料任务详细", businessType = OperaType.DELETE, logType = 1,module = "仓储管理->删除领料任务详细") - @DeleteMapping("/{ids}") - public AjaxResult remove(@PathVariable Long[] ids) { - return toAjax(leaseApplyDetailsService.deleteLeaseApplyDetailsByIds(ids)); - } -} +//package com.bonus.material.lease.controller; +// +//import java.util.List; +//import javax.servlet.http.HttpServletResponse; +//import com.bonus.common.log.enums.OperaType; +//import com.bonus.material.common.annotation.PreventRepeatSubmit; +//import io.swagger.annotations.Api; +//import io.swagger.annotations.ApiOperation; +//import org.springframework.beans.factory.annotation.Autowired; +//import org.springframework.web.bind.annotation.GetMapping; +//import org.springframework.web.bind.annotation.PostMapping; +//import org.springframework.web.bind.annotation.PutMapping; +//import org.springframework.web.bind.annotation.DeleteMapping; +//import org.springframework.web.bind.annotation.PathVariable; +//import org.springframework.web.bind.annotation.RequestBody; +//import org.springframework.web.bind.annotation.RequestMapping; +//import org.springframework.web.bind.annotation.RestController; +//import com.bonus.common.log.annotation.SysLog; +//import com.bonus.common.security.annotation.RequiresPermissions; +//import com.bonus.material.lease.domain.LeaseApplyDetails; +//import com.bonus.material.lease.service.ILeaseApplyDetailsService; +//import com.bonus.common.core.web.controller.BaseController; +//import com.bonus.common.core.web.domain.AjaxResult; +//import com.bonus.common.core.utils.poi.ExcelUtil; +//import com.bonus.common.core.web.page.TableDataInfo; +// +///** +// * 领料任务详细Controller +// * +// * @author xsheng +// * @date 2024-10-16 +// */ +//@Api(tags = "领料任务详细接口") +//@RestController +//@RequestMapping("/lease_apply_details") +//public class LeaseApplyDetailsController extends BaseController { +// @Autowired +// private ILeaseApplyDetailsService leaseApplyDetailsService; +// +// /** +// * 查询领料任务详细列表 +// */ +// @ApiOperation(value = "查询领料任务详细列表") +// @RequiresPermissions("lease:details:list") +// @GetMapping("/list") +// public TableDataInfo list(LeaseApplyDetails leaseApplyDetails) { +// startPage(); +// List list = leaseApplyDetailsService.selectLeaseApplyDetailsList(leaseApplyDetails); +// return getDataTable(list); +// } +// +// /** +// * 导出领料任务详细列表 +// */ +// @ApiOperation(value = "导出领料任务详细列表") +// @PreventRepeatSubmit +// @RequiresPermissions("lease:details:export") +// @SysLog(title = "领料任务详细", businessType = OperaType.EXPORT, logType = 1,module = "仓储管理->导出领料任务详细") +// @PostMapping("/export") +// public void export(HttpServletResponse response, LeaseApplyDetails leaseApplyDetails) { +// List list = leaseApplyDetailsService.selectLeaseApplyDetailsList(leaseApplyDetails); +// ExcelUtil util = new ExcelUtil(LeaseApplyDetails.class); +// util.exportExcel(response, list, "领料任务详细数据"); +// } +// +// /** +// * 获取领料任务详细详细信息 +// */ +// @ApiOperation(value = "获取领料任务详细详细信息") +// @RequiresPermissions("lease:details:query") +// @GetMapping(value = "/{id}") +// public AjaxResult getInfo(@PathVariable("id") Long id) { +// return success(leaseApplyDetailsService.selectLeaseApplyDetailsById(id)); +// } +// +// /** +// * 新增领料任务详细 +// */ +// @ApiOperation(value = "新增领料任务详细") +// @PreventRepeatSubmit +// @RequiresPermissions("lease:details:add") +// @SysLog(title = "领料任务详细", businessType = OperaType.INSERT, logType = 1,module = "仓储管理->新增领料任务详细") +// @PostMapping +// public AjaxResult add(@RequestBody LeaseApplyDetails leaseApplyDetails) { +// try { +// return toAjax(leaseApplyDetailsService.insertLeaseApplyDetails(leaseApplyDetails)); +// } catch (Exception e) { +// return error("系统错误, " + e.getMessage()); +// } +// } +// +// /** +// * 修改领料任务详细 +// */ +// @ApiOperation(value = "修改领料任务详细") +// @PreventRepeatSubmit +// @RequiresPermissions("lease:details:edit") +// @SysLog(title = "领料任务详细", businessType = OperaType.UPDATE, logType = 1,module = "仓储管理->修改领料任务详细") +// @PutMapping +// public AjaxResult edit(@RequestBody LeaseApplyDetails leaseApplyDetails) { +// try { +// return toAjax(leaseApplyDetailsService.updateLeaseApplyDetails(leaseApplyDetails)); +// } catch (Exception e) { +// return error("系统错误, " + e.getMessage()); +// } +// } +// +// /** +// * 删除领料任务详细 +// */ +// @ApiOperation(value = "删除领料任务详细") +// @PreventRepeatSubmit +// @RequiresPermissions("lease:details:remove") +// @SysLog(title = "领料任务详细", businessType = OperaType.DELETE, logType = 1,module = "仓储管理->删除领料任务详细") +// @DeleteMapping("/{ids}") +// public AjaxResult remove(@PathVariable Long[] ids) { +// return toAjax(leaseApplyDetailsService.deleteLeaseApplyDetailsByIds(ids)); +// } +//} diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/controller/LeaseApplyInfoController.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/controller/LeaseApplyInfoController.java index 553f9899..06fa72e9 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/controller/LeaseApplyInfoController.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/controller/LeaseApplyInfoController.java @@ -8,12 +8,12 @@ import com.bonus.common.log.annotation.SysLog; import com.bonus.common.log.enums.OperaType; import com.bonus.material.common.annotation.PreventRepeatSubmit; import com.bonus.material.lease.domain.LeaseApplyInfo; +import com.bonus.material.lease.domain.vo.LeaseApplyRequestVo; +import com.bonus.material.lease.domain.vo.LeaseOutRequestVo; import com.bonus.material.lease.service.ILeaseApplyInfoService; -import com.bonus.material.task.domain.vo.TmTaskRequestVo; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.web.bind.annotation.*; - import javax.annotation.Resource; import javax.servlet.http.HttpServletResponse; import javax.validation.constraints.NotNull; @@ -77,7 +77,7 @@ public class LeaseApplyInfoController extends BaseController { //@RequiresPermissions("lease:info:add") @SysLog(title = "领料任务", businessType = OperaType.INSERT, logType = 1,module = "仓储管理->新增领料任务") @PostMapping - public AjaxResult add(@NotNull(message = "领料任务不能为空") @RequestBody TmTaskRequestVo tmTaskRequestVo) { + public AjaxResult add(@NotNull(message = "领料任务不能为空") @RequestBody LeaseApplyRequestVo tmTaskRequestVo) { try { return leaseApplyInfoService.insertLeaseApplyInfo(tmTaskRequestVo); } catch (Exception e) { @@ -93,9 +93,9 @@ public class LeaseApplyInfoController extends BaseController { //@RequiresPermissions("lease:info:edit") @SysLog(title = "领料任务", businessType = OperaType.UPDATE, logType = 1,module = "仓储管理->修改领料任务") @PutMapping - public AjaxResult edit(@RequestBody @NotNull TmTaskRequestVo tmTaskRequestVo) { + public AjaxResult edit(@RequestBody @NotNull LeaseApplyRequestVo leaseApplyRequestVo) { try { - return toAjax(leaseApplyInfoService.updateLeaseApplyInfo(tmTaskRequestVo)); + return toAjax(leaseApplyInfoService.updateLeaseApplyInfo(leaseApplyRequestVo)); } catch (Exception e) { return error("系统错误, " + e.getMessage()); } @@ -127,6 +127,23 @@ public class LeaseApplyInfoController extends BaseController { return success("批量发布完成"); } + + /** + * 领料:出库 + */ + @ApiOperation(value = "领料出库") + @PreventRepeatSubmit + //@RequiresPermissions("lease:info:add") + @SysLog(title = "领料出库", businessType = OperaType.INSERT, logType = 1,module = "仓储管理->领料出库") + @PostMapping("/submitOut") + public AjaxResult submitOut(@NotNull(message = "领料出库信息不能为空") @RequestBody LeaseOutRequestVo leaseOutRequestVo) { + try { + return leaseApplyInfoService.submitOut(leaseOutRequestVo); + } catch (Exception e) { + return error("系统错误, " + e.getMessage()); + } + } + /** * 删除领料任务 */ diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/controller/LeaseOutDetailsController.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/controller/LeaseOutDetailsController.java index ae641dd2..76ffaf99 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/controller/LeaseOutDetailsController.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/controller/LeaseOutDetailsController.java @@ -1,113 +1,113 @@ -package com.bonus.material.lease.controller; - -import java.util.List; -import javax.servlet.http.HttpServletResponse; -import com.bonus.common.log.enums.OperaType; -import com.bonus.material.common.annotation.PreventRepeatSubmit; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; -import com.bonus.common.log.annotation.SysLog; -import com.bonus.material.lease.domain.LeaseOutDetails; -import com.bonus.material.lease.service.ILeaseOutDetailsService; -import com.bonus.common.core.web.controller.BaseController; -import com.bonus.common.core.web.domain.AjaxResult; -import com.bonus.common.core.utils.poi.ExcelUtil; -import com.bonus.common.core.web.page.TableDataInfo; - -/** - * 领料出库详细Controller - * - * @author xsheng - * @date 2024-10-16 - */ -@Api(tags = "领料出库详细接口") -@RestController -@RequestMapping("/lease_out_details") -public class LeaseOutDetailsController extends BaseController { - - @Autowired - private ILeaseOutDetailsService leaseOutDetailsService; - - /** - * 查询领料出库详细列表 - */ - @ApiOperation(value = "查询领料出库详细列表") - @GetMapping("/list") - public TableDataInfo list(LeaseOutDetails leaseOutDetails) { - startPage(); - List list = leaseOutDetailsService.selectLeaseOutDetailsList(leaseOutDetails); - return getDataTable(list); - } - - /** - * 导出领料出库详细列表 - */ - @ApiOperation(value = "导出领料出库详细列表") - @PreventRepeatSubmit - @SysLog(title = "领料出库详细", businessType = OperaType.EXPORT, logType = 1,module = "仓储管理->导出领料出库详细") - @PostMapping("/export") - public void export(HttpServletResponse response, LeaseOutDetails leaseOutDetails) { - List list = leaseOutDetailsService.selectLeaseOutDetailsList(leaseOutDetails); - ExcelUtil util = new ExcelUtil<>(LeaseOutDetails.class); - util.exportExcel(response, list, "领料出库详细数据"); - } - - /** - * 获取领料出库详细详细信息 - */ - @ApiOperation(value = "获取领料出库详细详细信息") - @GetMapping(value = "/{id}") - public AjaxResult getInfo(@PathVariable("id") Long id) { - return success(leaseOutDetailsService.selectLeaseOutDetailsById(id)); - } - - /** - * 新增领料出库详细 - */ - @ApiOperation(value = "新增领料出库详细") - @PreventRepeatSubmit - @SysLog(title = "领料出库详细", businessType = OperaType.INSERT, logType = 1,module = "仓储管理->新增领料出库详细") - @PostMapping - public AjaxResult add(@RequestBody List leaseOutDetailsList) { - try { - return leaseOutDetailsService.insertLeaseOutDetails(leaseOutDetailsList); - } catch (Exception e) { - return error("系统错误, " + e.getMessage()); - } - } - - /** - * 修改领料出库详细 - */ - @ApiOperation(value = "修改领料出库详细") - @PreventRepeatSubmit - @SysLog(title = "领料出库详细", businessType = OperaType.UPDATE, logType = 1,module = "仓储管理->修改领料出库详细") - @PutMapping - public AjaxResult edit(@RequestBody LeaseOutDetails leaseOutDetails) { - try { - return toAjax(leaseOutDetailsService.updateLeaseOutDetails(leaseOutDetails)); - } catch (Exception e) { - return error("系统错误, " + e.getMessage()); - } - } - - /** - * 删除领料出库详细 - */ - @ApiOperation(value = "删除领料出库详细") - @PreventRepeatSubmit - @SysLog(title = "领料出库详细", businessType = OperaType.DELETE, logType = 1,module = "仓储管理->删除领料出库详细") - @DeleteMapping("/{ids}") - public AjaxResult remove(@PathVariable Long[] ids) { - return toAjax(leaseOutDetailsService.deleteLeaseOutDetailsByIds(ids)); - } -} +//package com.bonus.material.lease.controller; +// +//import java.util.List; +//import javax.servlet.http.HttpServletResponse; +//import com.bonus.common.log.enums.OperaType; +//import com.bonus.material.common.annotation.PreventRepeatSubmit; +//import io.swagger.annotations.Api; +//import io.swagger.annotations.ApiOperation; +//import org.springframework.beans.factory.annotation.Autowired; +//import org.springframework.web.bind.annotation.GetMapping; +//import org.springframework.web.bind.annotation.PostMapping; +//import org.springframework.web.bind.annotation.PutMapping; +//import org.springframework.web.bind.annotation.DeleteMapping; +//import org.springframework.web.bind.annotation.PathVariable; +//import org.springframework.web.bind.annotation.RequestBody; +//import org.springframework.web.bind.annotation.RequestMapping; +//import org.springframework.web.bind.annotation.RestController; +//import com.bonus.common.log.annotation.SysLog; +//import com.bonus.material.lease.domain.LeaseOutDetails; +//import com.bonus.material.lease.service.ILeaseOutDetailsService; +//import com.bonus.common.core.web.controller.BaseController; +//import com.bonus.common.core.web.domain.AjaxResult; +//import com.bonus.common.core.utils.poi.ExcelUtil; +//import com.bonus.common.core.web.page.TableDataInfo; +// +///** +// * 领料出库详细Controller +// * +// * @author xsheng +// * @date 2024-10-16 +// */ +//@Api(tags = "领料出库详细接口") +//@RestController +//@RequestMapping("/lease_out_details") +//public class LeaseOutDetailsController extends BaseController { +// +// @Autowired +// private ILeaseOutDetailsService leaseOutDetailsService; +// +// /** +// * 查询领料出库详细列表 +// */ +// @ApiOperation(value = "查询领料出库详细列表") +// @GetMapping("/list") +// public TableDataInfo list(LeaseOutDetails leaseOutDetails) { +// startPage(); +// List list = leaseOutDetailsService.selectLeaseOutDetailsList(leaseOutDetails); +// return getDataTable(list); +// } +// +// /** +// * 导出领料出库详细列表 +// */ +// @ApiOperation(value = "导出领料出库详细列表") +// @PreventRepeatSubmit +// @SysLog(title = "领料出库详细", businessType = OperaType.EXPORT, logType = 1,module = "仓储管理->导出领料出库详细") +// @PostMapping("/export") +// public void export(HttpServletResponse response, LeaseOutDetails leaseOutDetails) { +// List list = leaseOutDetailsService.selectLeaseOutDetailsList(leaseOutDetails); +// ExcelUtil util = new ExcelUtil<>(LeaseOutDetails.class); +// util.exportExcel(response, list, "领料出库详细数据"); +// } +// +// /** +// * 获取领料出库详细详细信息 +// */ +// @ApiOperation(value = "获取领料出库详细详细信息") +// @GetMapping(value = "/{id}") +// public AjaxResult getInfo(@PathVariable("id") Long id) { +// return success(leaseOutDetailsService.selectLeaseOutDetailsById(id)); +// } +// +// /** +// * 新增领料出库详细 +// */ +// @ApiOperation(value = "新增领料出库详细") +// @PreventRepeatSubmit +// @SysLog(title = "领料出库详细", businessType = OperaType.INSERT, logType = 1,module = "仓储管理->新增领料出库详细") +// @PostMapping +// public AjaxResult add(@RequestBody List leaseOutDetailsList) { +// try { +// return leaseOutDetailsService.insertLeaseOutDetails(leaseOutDetailsList); +// } catch (Exception e) { +// return error("系统错误, " + e.getMessage()); +// } +// } +// +// /** +// * 修改领料出库详细 +// */ +// @ApiOperation(value = "修改领料出库详细") +// @PreventRepeatSubmit +// @SysLog(title = "领料出库详细", businessType = OperaType.UPDATE, logType = 1,module = "仓储管理->修改领料出库详细") +// @PutMapping +// public AjaxResult edit(@RequestBody LeaseOutDetails leaseOutDetails) { +// try { +// return toAjax(leaseOutDetailsService.updateLeaseOutDetails(leaseOutDetails)); +// } catch (Exception e) { +// return error("系统错误, " + e.getMessage()); +// } +// } +// +// /** +// * 删除领料出库详细 +// */ +// @ApiOperation(value = "删除领料出库详细") +// @PreventRepeatSubmit +// @SysLog(title = "领料出库详细", businessType = OperaType.DELETE, logType = 1,module = "仓储管理->删除领料出库详细") +// @DeleteMapping("/{ids}") +// public AjaxResult remove(@PathVariable Long[] ids) { +// return toAjax(leaseOutDetailsService.deleteLeaseOutDetailsByIds(ids)); +// } +//} diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/domain/LeaseApplyInfo.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/domain/LeaseApplyInfo.java index 07756675..4a3f84ec 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/domain/LeaseApplyInfo.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/domain/LeaseApplyInfo.java @@ -18,7 +18,6 @@ import com.bonus.common.core.web.domain.BaseEntity; * @date 2024-10-16 */ - @EqualsAndHashCode(callSuper = false) @Data @ToString @@ -29,7 +28,7 @@ public class LeaseApplyInfo extends BaseEntity { /** ID */ private Long id; - /** 领料单号 */ + /** 任务编号: 领料单号 */ @Excel(name = "领料单号") @ApiModelProperty(value = "领料单号") private String code; @@ -132,10 +131,6 @@ public class LeaseApplyInfo extends BaseEntity { @ApiModelProperty(value = "费用承担方(01项目03分包)") private String costBearingParty; - /** 机具规格详情列表 */ - @ApiModelProperty(value = "机具规格详情列表") - List leaseApplyDetails; - @ApiModelProperty(value = "租赁工程") @Excel(name = "领料工程") private String leaseProject; @@ -157,4 +152,53 @@ public class LeaseApplyInfo extends BaseEntity { @Excel(name = "协议号") private String agreementCode; + /** 任务类型(定义数据字典) */ + @Excel(name = "任务类型(定义数据字典)") + @ApiModelProperty(value = "任务类型(定义数据字典)") + private Integer taskType; + + /** 任务状态(定义数据字典) */ + @Excel(name = "任务状态(定义数据字典)") + @ApiModelProperty(value = "任务状态(定义数据字典)") + private Integer taskStatus; + + @ApiModelProperty(value = "任务当月序号 例如:1 插入及查询时请携带任务类型") + private Integer monthOrder; + + @ApiModelProperty(value = "领料人手机号") + //@Excel(name = "联系电话", sort = 6) + private String leasePhone; + + @ApiModelProperty(value = "往来单位id") + private Long unitId; + + @ApiModelProperty(value = "往来单位") + //@Excel(name = "领料单位", sort = 2) + private String unitName; + + @ApiModelProperty(value = "工程id") + private Long projectId; + + /** + * 工程名称 + */ + @ApiModelProperty(value = "工程名称") + @Excel(name = "领料工程", sort = 3) + private String projectName; + + /** + * 预领料合计数 + */ + @ApiModelProperty(value = "预领料合计数") + private Integer preCountNum; + + @ApiModelProperty(value = "开始时间") + private String startTime; + + @ApiModelProperty(value = "结束时间") + private String endTime; + + @ApiModelProperty(value = "关键字") + private String keyWord; + } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/domain/vo/LeaseApplyRequestVo.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/domain/vo/LeaseApplyRequestVo.java index 1ff206c6..325a980f 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/domain/vo/LeaseApplyRequestVo.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/domain/vo/LeaseApplyRequestVo.java @@ -3,6 +3,7 @@ package com.bonus.material.lease.domain.vo; import com.bonus.common.core.web.domain.BaseEntity; import com.bonus.material.lease.domain.LeaseApplyDetails; import com.bonus.material.lease.domain.LeaseApplyInfo; +import io.swagger.annotations.ApiModelProperty; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.ToString; @@ -11,19 +12,23 @@ import java.util.List; /** * 领料任务对象 lease_apply_info - * + * 领料申请物资列表 leaseApplyDetailsList + * * @author xsheng * @date 2024-10-16 */ - @EqualsAndHashCode(callSuper = false) @Data @ToString public class LeaseApplyRequestVo extends BaseEntity { + /** 领料-任务对象 */ + @ApiModelProperty(value = "领料-任务对象") private LeaseApplyInfo leaseApplyInfo; + /** 领料-机具规格详情列表 */ + @ApiModelProperty(value = "领料-机具规格详情列表") private List leaseApplyDetailsList; } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/domain/vo/LeaseOutRequestVo.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/domain/vo/LeaseOutRequestVo.java new file mode 100644 index 00000000..468fc150 --- /dev/null +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/domain/vo/LeaseOutRequestVo.java @@ -0,0 +1,35 @@ +package com.bonus.material.lease.domain.vo; + +import com.bonus.common.core.web.domain.BaseEntity; +import com.bonus.material.lease.domain.LeaseApplyDetails; +import com.bonus.material.lease.domain.LeaseApplyInfo; +import com.bonus.material.lease.domain.LeaseOutDetails; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; + +import java.util.List; + +/** + * 领料出库任务对象 lease_apply_info + * 领料出库物资列表 leaseOutDetailsList + * + * @author xsheng + * @date 2024-10-16 + */ + +@EqualsAndHashCode(callSuper = false) +@Data +@ToString +public class LeaseOutRequestVo extends BaseEntity { + + /** 领料-任务对象 */ + @ApiModelProperty(value = "领料-任务对象") + private LeaseApplyInfo leaseApplyInfo; + + /** 领料-机具规格详情列表 */ + @ApiModelProperty(value = "领料-机具规格详情列表") + private List leaseOutDetailsList; + +} diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/ILeaseApplyInfoService.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/ILeaseApplyInfoService.java index a74bbc2a..89e7a2a3 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/ILeaseApplyInfoService.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/ILeaseApplyInfoService.java @@ -1,11 +1,11 @@ package com.bonus.material.lease.service; import java.util.List; - import com.bonus.common.core.web.domain.AjaxResult; +import com.bonus.material.lease.domain.LeaseApplyDetails; import com.bonus.material.lease.domain.LeaseApplyInfo; import com.bonus.material.lease.domain.vo.LeaseApplyRequestVo; -import com.bonus.material.task.domain.vo.TmTaskRequestVo; +import com.bonus.material.lease.domain.vo.LeaseOutRequestVo; /** * 领料任务Service接口 @@ -36,7 +36,7 @@ public interface ILeaseApplyInfoService { * @param leaseApplyRequestVo 领料任务 * @return 结果 */ - AjaxResult insertLeaseApplyInfo(TmTaskRequestVo leaseApplyRequestVo); + AjaxResult insertLeaseApplyInfo(LeaseApplyRequestVo leaseApplyRequestVo); /** * 发布任务 @@ -46,10 +46,22 @@ public interface ILeaseApplyInfoService { /** * 修改领料任务 * - * @param tmTaskRequestVo 领料任务 + * @param leaseApplyRequestVo 领料任务 * @return 结果 */ - boolean updateLeaseApplyInfo(TmTaskRequestVo tmTaskRequestVo); + boolean updateLeaseApplyInfo(LeaseApplyRequestVo leaseApplyRequestVo); + + + + + /** + * 领料:出库 + * + * @param leaseOutRequestVo 领料:出库 + * @return 结果 + */ + AjaxResult submitOut(LeaseOutRequestVo leaseOutRequestVo); + /** * 批量删除领料任务 diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/ILeaseOutDetailsService.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/ILeaseOutDetailsService.java index 22a77582..f348e599 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/ILeaseOutDetailsService.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/ILeaseOutDetailsService.java @@ -59,4 +59,6 @@ public interface ILeaseOutDetailsService { * @return 结果 */ int deleteLeaseOutDetailsById(Long id); + + public AjaxResult submitOut(LeaseOutDetails record); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/impl/LeaseApplyInfoServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/impl/LeaseApplyInfoServiceImpl.java index 0380e9f8..9c6fa185 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/impl/LeaseApplyInfoServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/impl/LeaseApplyInfoServiceImpl.java @@ -2,7 +2,6 @@ package com.bonus.material.lease.service.impl; import java.util.List; import java.util.Optional; - import cn.hutool.core.collection.CollectionUtil; import com.bonus.common.biz.constant.MaterialConstants; import com.bonus.common.biz.enums.LeaseTaskStatusEnum; @@ -13,13 +12,16 @@ import com.bonus.common.core.utils.DateUtils; import com.bonus.common.core.web.domain.AjaxResult; import com.bonus.common.security.utils.SecurityUtils; import com.bonus.material.lease.domain.LeaseApplyDetails; +import com.bonus.material.lease.domain.LeaseOutDetails; import com.bonus.material.lease.domain.vo.LeaseApplyRequestVo; +import com.bonus.material.lease.domain.vo.LeaseOutRequestVo; import com.bonus.material.lease.mapper.LeaseApplyDetailsMapper; +import com.bonus.material.lease.service.ILeaseOutDetailsService; import com.bonus.material.task.domain.TmTask; import com.bonus.material.task.domain.TmTaskAgreement; -import com.bonus.material.task.domain.vo.TmTaskRequestVo; import com.bonus.material.task.mapper.TmTaskAgreementMapper; import com.bonus.material.task.mapper.TmTaskMapper; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.dao.DataAccessException; import org.springframework.stereotype.Service; import com.bonus.material.lease.mapper.LeaseApplyInfoMapper; @@ -27,7 +29,6 @@ import com.bonus.material.lease.domain.LeaseApplyInfo; import com.bonus.material.lease.service.ILeaseApplyInfoService; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; - import javax.annotation.Resource; /** @@ -39,6 +40,9 @@ import javax.annotation.Resource; @Service public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService { + @Autowired + private ILeaseOutDetailsService leaseOutDetailsService; + @Resource private LeaseApplyInfoMapper leaseApplyInfoMapper; @@ -95,37 +99,37 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService { /** * 新增领料任务 * - * @param tmTaskRequestVo 领料任务 + * @param leaseApplyRequestVo 领料任务 * @return 结果 */ @Override - public AjaxResult insertLeaseApplyInfo(TmTaskRequestVo tmTaskRequestVo) { - if (tmTaskRequestVo.getLeaseApplyInfo() == null) { + public AjaxResult insertLeaseApplyInfo(LeaseApplyRequestVo leaseApplyRequestVo) { + if (leaseApplyRequestVo.getLeaseApplyInfo() == null) { return AjaxResult.error("请先填写领料任务信息"); } - if (CollectionUtil.isEmpty(tmTaskRequestVo.getLeaseApplyDetailsList())) { + if (CollectionUtil.isEmpty(leaseApplyRequestVo.getLeaseApplyDetailsList())) { return AjaxResult.error("请先添加领料任务物资明细"); } - tmTaskRequestVo.getLeaseApplyInfo().setCreateTime(DateUtils.getNowDate()); - tmTaskRequestVo.getLeaseApplyInfo().setCreateBy(SecurityUtils.getUsername()); + leaseApplyRequestVo.getLeaseApplyInfo().setCreateTime(DateUtils.getNowDate()); + leaseApplyRequestVo.getLeaseApplyInfo().setCreateBy(SecurityUtils.getUsername()); try { int thisMonthMaxOrder = tmTaskMapper.getMonthMaxOrderByDate(DateUtils.getCurrentYear(), DateUtils.getCurrentMonth(), TmTaskTypeEnum.TM_TASK_LEASE.getTaskTypeId()); String taskCode = genderTaskCode(thisMonthMaxOrder); TmTask tmTask = new TmTask(null, TmTaskTypeEnum.TM_TASK_LEASE.getTaskTypeId(), PurchaseTaskStatusEnum.TO_NOTICE.getStatus(), - tmTaskRequestVo.getLeaseApplyInfo().getCompanyId(), "1", thisMonthMaxOrder + 1, taskCode); + leaseApplyRequestVo.getLeaseApplyInfo().getCompanyId(), "1", thisMonthMaxOrder + 1, taskCode); tmTask.setCreateTime(DateUtils.getNowDate()); tmTask.setCreateBy(SecurityUtils.getUsername()); tmTaskMapper.insertTmTask(tmTask); - TmTaskAgreement tmTaskAgreement = new TmTaskAgreement(tmTask.getTaskId(), tmTaskRequestVo.getLeaseApplyInfo().getAgreementId()); + TmTaskAgreement tmTaskAgreement = new TmTaskAgreement(tmTask.getTaskId(), leaseApplyRequestVo.getLeaseApplyInfo().getAgreementId()); tmTaskAgreement.setCreateTime(DateUtils.getNowDate()); tmTaskAgreement.setCreateBy(SecurityUtils.getUsername()); tmTaskAgreementMapper.insertTmTaskAgreement(tmTaskAgreement); - tmTaskRequestVo.getLeaseApplyInfo().setTaskId(tmTask.getTaskId()); - tmTaskRequestVo.getLeaseApplyInfo().setCode(taskCode); - int count = leaseApplyInfoMapper.insertLeaseApplyInfo(tmTaskRequestVo.getLeaseApplyInfo()); + leaseApplyRequestVo.getLeaseApplyInfo().setTaskId(tmTask.getTaskId()); + leaseApplyRequestVo.getLeaseApplyInfo().setCode(taskCode); + int count = leaseApplyInfoMapper.insertLeaseApplyInfo(leaseApplyRequestVo.getLeaseApplyInfo()); if (count > 0) { - return insertPurchaseCheckDetails(tmTaskRequestVo.getLeaseApplyDetailsList(), tmTask.getTaskId()); + return insertPurchaseCheckDetails(leaseApplyRequestVo.getLeaseApplyDetailsList(), tmTask.getTaskId()); } else { return AjaxResult.error("新增任务失败,lease_apply_info表插入0条"); } @@ -204,14 +208,14 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService { /** * 修改领料任务 * - * @param tmTaskRequestVo 领料任务 + * @param leaseApplyRequestVo 领料任务 * @return 结果 */ @Override - public boolean updateLeaseApplyInfo(TmTaskRequestVo tmTaskRequestVo) { + public boolean updateLeaseApplyInfo(LeaseApplyRequestVo leaseApplyRequestVo) { try { // 提取到局部变量中,减少重复代码 - LeaseApplyInfo leaseApplyInfo = tmTaskRequestVo.getLeaseApplyInfo(); + LeaseApplyInfo leaseApplyInfo = leaseApplyRequestVo.getLeaseApplyInfo(); if (leaseApplyInfo != null && leaseApplyInfo.getId() != null) { leaseApplyInfo.setUpdateTime(DateUtils.getNowDate()); leaseApplyInfo.setUpdateBy(SecurityUtils.getUsername()); @@ -219,10 +223,10 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService { // 去除创建一个新的数组对象,直接复用 Long[] ids = {leaseApplyInfo.getId()}; - if (CollectionUtil.isNotEmpty(tmTaskRequestVo.getLeaseApplyDetailsList())) { + if (CollectionUtil.isNotEmpty(leaseApplyRequestVo.getLeaseApplyDetailsList())) { // 业务逻辑代码 leaseApplyDetailsMapper.deleteLeaseApplyDetailsByParentIds(ids); - insertPurchaseCheckDetails(tmTaskRequestVo.getLeaseApplyDetailsList(), leaseApplyInfo.getTaskId()); + insertPurchaseCheckDetails(leaseApplyRequestVo.getLeaseApplyDetailsList(), leaseApplyInfo.getTaskId()); } // 修改外层info leaseApplyInfoMapper.updateLeaseApplyInfo(leaseApplyInfo); @@ -238,6 +242,26 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService { } } + + /** + * 领料:出库 + * + * @param leaseOutRequestVo 领料:出库 + * @return 结果 + */ + @Override + public AjaxResult submitOut(LeaseOutRequestVo leaseOutRequestVo) { + for (LeaseOutDetails bean : leaseOutRequestVo.getLeaseOutDetailsList()) { + AjaxResult ajaxResult = leaseOutDetailsService.submitOut(bean); + if (ajaxResult.isError()) { + return ajaxResult; + } + } + return AjaxResult.success(); + } + + + /** * 批量删除领料任务 * diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/impl/LeaseOutDetailsServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/impl/LeaseOutDetailsServiceImpl.java index 759fe3d0..b44596fc 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/impl/LeaseOutDetailsServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/impl/LeaseOutDetailsServiceImpl.java @@ -125,7 +125,7 @@ public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService { * @param record 出库对象 * @return 结果 */ - //@Override + @Override @Transactional(rollbackFor = Exception.class) public AjaxResult submitOut(LeaseOutDetails record) { int res = 0; diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/controller/TmTaskController.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/controller/TmTaskController.java index 4f006037..daa65cbb 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/controller/TmTaskController.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/controller/TmTaskController.java @@ -2,11 +2,8 @@ package com.bonus.material.task.controller; import java.util.List; import javax.servlet.http.HttpServletResponse; - -import com.bonus.common.core.utils.StringUtils; import com.bonus.common.log.enums.OperaType; import com.bonus.material.common.annotation.PreventRepeatSubmit; -import com.bonus.material.task.domain.vo.TmTaskRequestVo; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/domain/vo/TmTaskRequestVo.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/domain/vo/TmTaskRequestVo.java index 23db290f..a4d2f587 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/domain/vo/TmTaskRequestVo.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/domain/vo/TmTaskRequestVo.java @@ -1,97 +1,97 @@ -package com.bonus.material.task.domain.vo; - -import com.bonus.common.core.annotation.Excel; -import com.bonus.common.core.web.domain.BaseEntity; -import com.bonus.material.lease.domain.LeaseApplyDetails; -import com.bonus.material.lease.domain.LeaseApplyInfo; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import java.util.List; - -@Data -public class TmTaskRequestVo extends BaseEntity { - - /** 任务ID */ - private Long taskId; - - /** 任务类型(定义数据字典) */ - @Excel(name = "任务类型(定义数据字典)") - @ApiModelProperty(value = "任务类型(定义数据字典)") - private Integer taskType; - - /** 任务状态(定义数据字典) */ - @Excel(name = "任务状态(定义数据字典)") - @ApiModelProperty(value = "任务状态(定义数据字典)") - private Integer taskStatus; - - /** 任务编号,如新购单号,领料单号,退料单号等 */ - @Excel(name = "任务编号") - @ApiModelProperty(value = "编号") - private String code; - - /** 数据所属组织 */ - @Excel(name = "数据所属组织") - @ApiModelProperty(value = "数据所属组织") - private Long companyId; - - /** 0不启用 1启用 */ - @Excel(name = "0不启用 1启用") - @ApiModelProperty(value = "0不启用 1启用") - private String status; - - @ApiModelProperty(value = "任务当月序号 例如:1 插入及查询时请携带任务类型") - private Integer monthOrder; - - @ApiModelProperty(value = "协议id") - private Long agreementId; - - @ApiModelProperty(value = "协议编号") - @Excel(name = "协议号", sort = 4) - private String agreementCode; - - @ApiModelProperty(value = "领料人") - //@Excel(name = "领料人", sort = 5) - private String leasePerson; - - @ApiModelProperty(value = "领料人手机号") - //@Excel(name = "联系电话", sort = 6) - private String leasePhone; - - @ApiModelProperty(value = "往来单位id") - private Long unitId; - - @ApiModelProperty(value = "往来单位") - //@Excel(name = "领料单位", sort = 2) - private String unitName; - - @ApiModelProperty(value = "工程id") - private Long projectId; - - /** - * 工程名称 - */ - @ApiModelProperty(value = "工程名称") - @Excel(name = "领料工程", sort = 3) - private String projectName; - - /** - * 预领料合计数 - */ - @ApiModelProperty(value = "预领料合计数") - private Integer preCountNum; - - @ApiModelProperty(value = "开始时间") - private String startTime; - - @ApiModelProperty(value = "结束时间") - private String endTime; - - @ApiModelProperty(value = "关键字") - private String keyWord; - - @ApiModelProperty(value = "领料任务汇总") - private LeaseApplyInfo leaseApplyInfo; - - @ApiModelProperty(value = "领料任务物资列表") - private List leaseApplyDetailsList; -} +//package com.bonus.material.task.domain.vo; +// +//import com.bonus.common.core.annotation.Excel; +//import com.bonus.common.core.web.domain.BaseEntity; +//import com.bonus.material.lease.domain.LeaseApplyDetails; +//import com.bonus.material.lease.domain.LeaseApplyInfo; +//import io.swagger.annotations.ApiModelProperty; +//import lombok.Data; +//import java.util.List; +// +//@Data +//public class TmTaskRequestVo extends BaseEntity { +// +// /** 任务ID */ +// private Long taskId; +// +// /** 任务类型(定义数据字典) */ +// @Excel(name = "任务类型(定义数据字典)") +// @ApiModelProperty(value = "任务类型(定义数据字典)") +// private Integer taskType; +// +// /** 任务状态(定义数据字典) */ +// @Excel(name = "任务状态(定义数据字典)") +// @ApiModelProperty(value = "任务状态(定义数据字典)") +// private Integer taskStatus; +// +// /** 任务编号,如新购单号,领料单号,退料单号等 */ +// @Excel(name = "任务编号") +// @ApiModelProperty(value = "编号") +// private String code; +// +// /** 数据所属组织 */ +// @Excel(name = "数据所属组织") +// @ApiModelProperty(value = "数据所属组织") +// private Long companyId; +// +// /** 0不启用 1启用 */ +// @Excel(name = "0不启用 1启用") +// @ApiModelProperty(value = "0不启用 1启用") +// private String status; +// +// @ApiModelProperty(value = "任务当月序号 例如:1 插入及查询时请携带任务类型") +// private Integer monthOrder; +// +// @ApiModelProperty(value = "协议id") +// private Long agreementId; +// +// @ApiModelProperty(value = "协议编号") +// @Excel(name = "协议号", sort = 4) +// private String agreementCode; +// +// @ApiModelProperty(value = "领料人") +// //@Excel(name = "领料人", sort = 5) +// private String leasePerson; +// +// @ApiModelProperty(value = "领料人手机号") +// //@Excel(name = "联系电话", sort = 6) +// private String leasePhone; +// +// @ApiModelProperty(value = "往来单位id") +// private Long unitId; +// +// @ApiModelProperty(value = "往来单位") +// //@Excel(name = "领料单位", sort = 2) +// private String unitName; +// +// @ApiModelProperty(value = "工程id") +// private Long projectId; +// +// /** +// * 工程名称 +// */ +// @ApiModelProperty(value = "工程名称") +// @Excel(name = "领料工程", sort = 3) +// private String projectName; +// +// /** +// * 预领料合计数 +// */ +// @ApiModelProperty(value = "预领料合计数") +// private Integer preCountNum; +// +// @ApiModelProperty(value = "开始时间") +// private String startTime; +// +// @ApiModelProperty(value = "结束时间") +// private String endTime; +// +// @ApiModelProperty(value = "关键字") +// private String keyWord; +// +// @ApiModelProperty(value = "领料任务汇总") +// private LeaseApplyInfo leaseApplyInfo; +// +// @ApiModelProperty(value = "领料任务物资列表") +// private List leaseApplyDetailsList; +//} diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/mapper/TmTaskMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/mapper/TmTaskMapper.java index 47f64e6d..3c8793ab 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/mapper/TmTaskMapper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/mapper/TmTaskMapper.java @@ -1,11 +1,7 @@ package com.bonus.material.task.mapper; import java.util.List; - -import com.bonus.material.lease.domain.LeaseApplyDetails; -import com.bonus.material.lease.domain.LeaseApplyInfo; import com.bonus.material.task.domain.TmTask; -import com.bonus.material.task.domain.vo.TmTaskRequestVo; import org.apache.ibatis.annotations.Param; /** diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/service/ITmTaskService.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/service/ITmTaskService.java index bf13ef28..0fbb4443 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/service/ITmTaskService.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/service/ITmTaskService.java @@ -2,7 +2,6 @@ package com.bonus.material.task.service; import java.util.List; import com.bonus.material.task.domain.TmTask; -import com.bonus.material.task.domain.vo.TmTaskRequestVo; /** * 任务Service接口 diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/service/impl/TmTaskServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/service/impl/TmTaskServiceImpl.java index c812bde3..167203b1 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/service/impl/TmTaskServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/service/impl/TmTaskServiceImpl.java @@ -1,15 +1,8 @@ package com.bonus.material.task.service.impl; import java.util.List; -import java.util.Set; - -import com.bonus.common.biz.constant.MaterialConstants; import com.bonus.common.core.exception.ServiceException; import com.bonus.common.core.utils.DateUtils; -import com.bonus.common.security.utils.SecurityUtils; -import com.bonus.material.lease.domain.LeaseApplyDetails; -import com.bonus.material.lease.domain.LeaseApplyInfo; -import com.bonus.material.task.domain.vo.TmTaskRequestVo; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.bonus.material.task.mapper.TmTaskMapper; From 1e4fb18018ae8f023d48e1365f1e534fccc20fe9 Mon Sep 17 00:00:00 2001 From: mashuai Date: Wed, 13 Nov 2024 18:53:14 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E9=80=80=E6=96=99=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/bonus/material/back/domain/MaCodeDto.java | 8 ++++++++ .../back/service/impl/BackApplyInfoServiceImpl.java | 4 ++++ .../mapper/material/back/BackApplyInfoMapper.xml | 5 +++-- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/domain/MaCodeDto.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/domain/MaCodeDto.java index 8d076054..6f0479b8 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/domain/MaCodeDto.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/domain/MaCodeDto.java @@ -26,6 +26,14 @@ public class MaCodeDto { @ApiModelProperty(value = "机具外观判断") private String apDetection; + private String typeId; + + private String materialName; + + private String typeName; + + private String maStatus; + /** * 附件列表 */ diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/service/impl/BackApplyInfoServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/service/impl/BackApplyInfoServiceImpl.java index 41a4a5eb..4345593f 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/service/impl/BackApplyInfoServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/service/impl/BackApplyInfoServiceImpl.java @@ -131,6 +131,10 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService { maCodeDto.setMaCode(maCodeVo.getMaCode()); maCodeDto.setMaId(maCodeVo.getMaId()); maCodeDto.setApDetection(maCodeVo.getApDetection()); + maCodeDto.setTypeName(maCodeVo.getTypeName()); + maCodeDto.setMaterialName(maCodeVo.getMaterialName()); + maCodeDto.setTypeId(maCodeVo.getTypeId()); + maCodeDto.setMaStatus(maCodeVo.getMaStatus()); // 查询并设置编码附件 List bmFileInfoList = fetchBmFileInfos(details.getId(), maCodeVo.getMaId()); if (CollectionUtils.isNotEmpty(bmFileInfoList)) { diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/back/BackApplyInfoMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/back/BackApplyInfoMapper.xml index 50b1d7f8..be833193 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/back/BackApplyInfoMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/back/BackApplyInfoMapper.xml @@ -107,7 +107,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" LEFT JOIN tm_task_agreement tta ON lai.task_id = tta.task_id LEFT JOIN bm_agreement_info ba ON tta.agreement_id = ba.agreement_id WHERE - 1 = 1 + 1 = 1 and mm.ma_status = '2' and ba.unit_id = #{unitId} @@ -186,7 +186,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" bcd.type_id AS typeId, mt.type_name AS materialName, mt1.type_name AS typeName, - bcd.ap_detection AS apDetection + bcd.ap_detection AS apDetection, + mm.ma_status AS maStatus FROM back_check_details bcd left join ma_machine mm on bcd.ma_id = mm.ma_id