From 185769e896ec70e074706509657583f4865bf703 Mon Sep 17 00:00:00 2001 From: hayu <1604366271@qq.com> Date: Tue, 12 Aug 2025 15:01:52 +0800 Subject: [PATCH 1/7] =?UTF-8?q?=E9=97=AE=E9=A2=98=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/controller/AppOcrController.java | 8 ++++++++ .../material/app/service/AppOcrService.java | 7 +++++++ .../app/service/impl/AppOcrServiceImpl.java | 17 +++++++++++++++++ 3 files changed, 32 insertions(+) diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/app/controller/AppOcrController.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/app/controller/AppOcrController.java index f7a55d2d..f7783628 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/app/controller/AppOcrController.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/app/controller/AppOcrController.java @@ -92,6 +92,14 @@ public class AppOcrController extends BaseController { return appOcrService.getOcrCode(bean); } + @ApiOperation(value = "获取ocr编码") + @PreventRepeatSubmit + @PostMapping("/getOcrCodeTwo") + public AjaxResult getOcrCodeTwo(@RequestBody MachineOcrBean bean) + { + return appOcrService.getOcrCodeTwo(bean); + } + @ApiOperation(value = "推送设备至第三方入库") @PreventRepeatSubmit @PostMapping("/addDeviceNumber") diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/app/service/AppOcrService.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/app/service/AppOcrService.java index 5868dd14..d43d5a83 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/app/service/AppOcrService.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/app/service/AppOcrService.java @@ -61,4 +61,11 @@ public interface AppOcrService { * @return */ AjaxResult addDeviceNumber(MachineOcrBean bean); + + /** + * 获取ocr编码 + * @param bean + * @return + */ + AjaxResult getOcrCodeTwo(MachineOcrBean bean); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/app/service/impl/AppOcrServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/app/service/impl/AppOcrServiceImpl.java index 093d871c..cb4a6989 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/app/service/impl/AppOcrServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/app/service/impl/AppOcrServiceImpl.java @@ -263,6 +263,23 @@ public class AppOcrServiceImpl implements AppOcrService { return AjaxResult.success(js); } + @Override + public AjaxResult getOcrCodeTwo(MachineOcrBean bean) { + String url = "http://10.138.55.102:10000/api_gqj/pre"; + JSONObject js = null; + try { + System.out.println("ocr-base64数据:" + bean.getImage()); + String jsonStr = JSONObject.toJSONString(bean); + String data = HttpHelper.sendHttpPostForToken(url, jsonStr); + System.out.println("ocr返回数据:" + data); + js = JSONObject.parseObject(data); + } catch (Exception e) { + e.printStackTrace(); + log.error("获取OCR编码失败:" + e.getMessage()); + } + return AjaxResult.success(js); + } + /** * 推送设备至第三方入库 * @param bean From a0f4d1e8d556223984c153204aa6157d7bf3b968 Mon Sep 17 00:00:00 2001 From: syruan <15555146157@163.com> Date: Tue, 12 Aug 2025 15:09:12 +0800 Subject: [PATCH 2/7] =?UTF-8?q?feat(material):=20=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E7=8F=AD=E7=BB=84=E9=A2=86=E6=96=99=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增字段和方法以支持班组领料 - 修改出库流程,增加对班组领料的处理逻辑 - 更新退料和结算相关功能,以适应班组领料 - 优化查询接口,支持按班组查询领料信息 --- .../bonus/common/biz/domain/TypeTreeNode.java | 3 ++ .../biz/domain/lease/LeaseOutDetails.java | 6 +++ .../material/back/domain/BackApplyInfo.java | 3 ++ .../basic/domain/BmAgreementInfo.java | 7 +++ .../basic/mapper/BmAgreementInfoMapper.java | 5 ++ .../domain/back/MaterialBackApplyDetails.java | 4 ++ .../MaterialBackApplyInfoServiceImpl.java | 8 ++- .../impl/MaterialLeaseInfoServiceImpl.java | 3 +- .../material/common/domain/dto/SelectDto.java | 2 + .../service/impl/SelectServiceImpl.java | 8 +++ .../lease/mapper/LeaseApplyInfoMapper.java | 28 +++++++++- .../impl/LeaseApplyInfoServiceImpl.java | 16 ++++++ .../impl/LeaseOutDetailsServiceImpl.java | 54 ++++++++++++++++--- .../service/impl/LeaseTaskServiceImpl.java | 2 +- .../impl/SltAgreementInfoServiceImpl.java | 1 - .../material/basic/BmAgreementInfoMapper.xml | 10 ++-- .../material/clz/MaterialBackInfoMapper.xml | 4 +- .../mapper/material/common/SelectMapper.xml | 34 ++++++++++-- .../material/lease/LeaseApplyInfoMapper.xml | 35 ++++++++++++ .../settlement/SltAgreementInfoMapper.xml | 6 +++ 20 files changed, 217 insertions(+), 22 deletions(-) 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 index d1b4feb9..72abaddc 100644 --- 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 @@ -48,4 +48,7 @@ public class TypeTreeNode { @ApiModelProperty(value = "协议id") private Long agreementId; + + @ApiModelProperty(value = "领料方式 0材料领料 1工器具领料 2数据同步") + private Integer leaseStyle; } diff --git a/bonus-common-biz/src/main/java/com/bonus/common/biz/domain/lease/LeaseOutDetails.java b/bonus-common-biz/src/main/java/com/bonus/common/biz/domain/lease/LeaseOutDetails.java index a8de06a7..0f4f1c47 100644 --- a/bonus-common-biz/src/main/java/com/bonus/common/biz/domain/lease/LeaseOutDetails.java +++ b/bonus-common-biz/src/main/java/com/bonus/common/biz/domain/lease/LeaseOutDetails.java @@ -108,6 +108,9 @@ public class LeaseOutDetails extends BaseEntity { @ApiModelProperty(value = "协议id") private Long agreementId; + @ApiModelProperty(value = "项目部协议id") + private Long projectUnitAgreementId; + @ApiModelProperty(value = "是否完成 (0:未完成 1:已完成)") private Integer isFinished; @@ -140,6 +143,9 @@ public class LeaseOutDetails extends BaseEntity { @ApiModelProperty(value = "领料id") private Integer leaseUnitId; + @ApiModelProperty(value = "领料单位是否为班组") + private Boolean leaseUnitIsTeam; + @ApiModelProperty(value = "领料工程id") private Integer leaseProjectId; 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 0207b50c..22c9c4c9 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 @@ -39,6 +39,9 @@ public class BackApplyInfo implements Serializable { @ApiModelProperty(value = "协议id") private Long agreementId; + @ApiModelProperty(value = "材料站协议id") + private Long clzAgreementId; + @ApiModelProperty(value = "任务类型") private Integer taskType; diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/domain/BmAgreementInfo.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/domain/BmAgreementInfo.java index 5643ca51..fe169166 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/domain/BmAgreementInfo.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/domain/BmAgreementInfo.java @@ -49,6 +49,13 @@ public class BmAgreementInfo extends BaseEntity @NotNull(message = "往来单位id不能为空") private Long unitId; + /** + * 往来单位所属项目部ID + */ + @NotNull(message = "所属项目部ID不能为空") + @ApiModelProperty(value = "所属项目部ID") + private Long projectUnitId; + /** * 往来单位 */ diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/mapper/BmAgreementInfoMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/mapper/BmAgreementInfoMapper.java index 2b519aa4..de31fafd 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/mapper/BmAgreementInfoMapper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/mapper/BmAgreementInfoMapper.java @@ -62,6 +62,11 @@ public interface BmAgreementInfoMapper public int selectNumByMonth(Date nowDate); + /** + * 查询单位类型,是内部单位/外部单位 + * @param agreementId + * @return + */ String getProtocol(String agreementId); /** diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/domain/back/MaterialBackApplyDetails.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/domain/back/MaterialBackApplyDetails.java index 76edaa1b..68fe7314 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/domain/back/MaterialBackApplyDetails.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/domain/back/MaterialBackApplyDetails.java @@ -119,6 +119,10 @@ public class MaterialBackApplyDetails extends BaseEntity { @ApiModelProperty(value = "数据所属组织") private Long companyId; + /** 领用方式 */ + @ApiModelProperty(value = "领用方式 2数据同步") + private Integer leaseStyle; + /** * 附件列表 */ diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/service/impl/MaterialBackApplyInfoServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/service/impl/MaterialBackApplyInfoServiceImpl.java index 2d8d000a..f55a8274 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/service/impl/MaterialBackApplyInfoServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/service/impl/MaterialBackApplyInfoServiceImpl.java @@ -416,6 +416,7 @@ public class MaterialBackApplyInfoServiceImpl implements MaterialBackApplyInfoSe TmTaskAgreement tmTaskAgreement = new TmTaskAgreement(tmTask.getTaskId(), dto.getBackApplyInfo().getAgreementId()); tmTaskAgreement.setCreateTime(DateUtils.getNowDate()); tmTaskAgreement.setCreateBy(createBy); + // 增加任务和协议关联表数据 taskAgreementMapper.insertTmTaskAgreement(tmTaskAgreement); backApplyInfo.setTaskId(tmTask.getTaskId()); backApplyInfo.setBackStyle("1"); @@ -443,7 +444,7 @@ public class MaterialBackApplyInfoServiceImpl implements MaterialBackApplyInfoSe //对提交的退料详情数量进行校验 for (MaterialBackApplyDetails backApplyDetails : dto.getBackApplyDetailsList()) { if (backApplyDetails.getNum() != null && backApplyDetails.getPreNum() != null) { - if (backApplyDetails.getNum().compareTo(backApplyDetails.getPreNum())<0 ) { + if (backApplyDetails.getNum().compareTo(backApplyDetails.getPreNum()) < 0) { return AjaxResult.error(backApplyDetails.getTypeName() + "退料数量不能大于预退数量,请重新填写!"); } } @@ -851,6 +852,7 @@ public class MaterialBackApplyInfoServiceImpl implements MaterialBackApplyInfoSe * @return */ private int saveBackApplyDetails(String createBy, MaterialBackApplyRequestVo dto, MaterialBackApplyInfo backApplyInfo, int result) { + // 循环退料详情 for (MaterialBackApplyDetails details : dto.getBackApplyDetailsList()) { details.setCode(backApplyInfo.getCode()); details.setParentId(backApplyInfo.getId()); @@ -862,15 +864,18 @@ public class MaterialBackApplyInfoServiceImpl implements MaterialBackApplyInfoSe result += materialBackInfoMapper.insertBackApplyDetails(details); // 处理附件 result = saveBmFileInfo(details, backApplyInfo.getId(), result); + // 判断是否为编码设备并处理附件 Integer isBack = dto.getBackApplyInfo().getIsBack(); details.setIsFinished(isBack); result = saveMaCodeBmFileInfo(createBy, isBack, details, backApplyInfo.getId(), result); + if (isBack == 1) { // 更新任务表及退料申请表状态 result += updateTaskAndBackInfo(backApplyInfo); // 更新结算表 backApplyInfo.setTypeId(details.getTypeId().toString()); + // 查询材料站的退料明细 List allList = materialBackInfoMapper.selectBackDetails(backApplyInfo); if (CollectionUtils.isNotEmpty(allList)) { List newList = new ArrayList<>(); @@ -892,6 +897,7 @@ public class MaterialBackApplyInfoServiceImpl implements MaterialBackApplyInfoSe } } } + // 更新材料站的结算协议表 int res = updateSlt4Bean(backApplyInfo, newList); // 检查机具是否领料 if (res == 0) { diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/service/impl/MaterialLeaseInfoServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/service/impl/MaterialLeaseInfoServiceImpl.java index 130ba2b8..3f4b80e1 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/service/impl/MaterialLeaseInfoServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/service/impl/MaterialLeaseInfoServiceImpl.java @@ -1380,8 +1380,7 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService { // 获取要减去的值,默认值为BigDecimal.ZERO BigDecimal subtractNum = typeIdToNum.getOrDefault(typeId, BigDecimal.ZERO); // 计算新值,处理num为null的情况(若业务允许) - BigDecimal currentNum = Optional.ofNullable(node.getNum()) - .orElse(BigDecimal.ZERO); + BigDecimal currentNum = Optional.ofNullable(node.getNum()).orElse(BigDecimal.ZERO); BigDecimal newNum = currentNum.subtract(subtractNum); if (newNum.compareTo(BigDecimal.ZERO) == 0) { iterator.remove(); diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/common/domain/dto/SelectDto.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/common/domain/dto/SelectDto.java index b94ee401..e18955c5 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/common/domain/dto/SelectDto.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/common/domain/dto/SelectDto.java @@ -1,6 +1,7 @@ package com.bonus.material.common.domain.dto; import lombok.Data; +import lombok.experimental.Accessors; import java.util.List; @@ -8,6 +9,7 @@ import java.util.List; * @author 10488 */ @Data +@Accessors(chain = true) public class SelectDto { /** 参数id*/ 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 23db006f..79c29d66 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 @@ -507,6 +507,14 @@ public class SelectServiceImpl implements SelectService { List listL3 = new ArrayList<>(); List listL21 = new ArrayList<>(); try { + // 判断单位是否为班组,如果为班组的话,把材料站的领用数据也查询出来 + if (bean.getUnitId() != null && bean.getProId() != null) { + List clzAgreementInfos = mapper.getAgreementInfoByIdBack(new SelectDto().setProId(bean.getProId()).setUnitId(Math.toIntExact(bean.getUnitId()))); + // 如果在材料站该单位有签署协议,说明该单位是班组 + if (CollectionUtils.isNotEmpty(clzAgreementInfos)) { + bean.setClzAgreementId(Long.valueOf(clzAgreementInfos.get(0).getAgreementId())); + } + } // 先查第四层类型 listL4 = mapper.getUseTypeTreeL4(bean); if (CollectionUtils.isNotEmpty(listL4)) { diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/mapper/LeaseApplyInfoMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/mapper/LeaseApplyInfoMapper.java index 3104a998..00d02991 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/mapper/LeaseApplyInfoMapper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/mapper/LeaseApplyInfoMapper.java @@ -1,6 +1,5 @@ package com.bonus.material.lease.mapper; -import java.util.Date; import java.util.List; import com.bonus.common.biz.domain.lease.LeaseApplyInfo; import com.bonus.common.biz.domain.lease.LeaseConfirmSign; @@ -75,6 +74,33 @@ public interface LeaseApplyInfoMapper { */ int deleteLeaseApplyInfoByIds(Long[] ids); + /** + * 查询领料任务的单位类型是否是班组 + * @param leaseId 领料任务id + * @return 领料单位类型 + */ + Long selectLeaseApplyInfoIsTeam(Long leaseId); + + /** + * 根据单位id查询单位类型 + */ + Long selectUnitTypeByUnitId(Long unitId); + + /** + * 查询领料任务的单位ID + * @param leaseId 领料任务id + * @return 单位ID + */ + Long selectLeaseApplyInfoUnitIdByLeaseId(Long leaseId); + + /** + * 根据班组ID和工程ID查询挂靠的项目部的协议id + * @param teamId 班组单位id + * @param projectId 工程id + * @return 挂靠的项目部协议id + */ + Long selectProjectUnitAgreementIdByTeamAndProject(@Param("teamId") Integer teamId, @Param("projectId") Integer projectId); + String getTaskId(Long parentId); /** 设置审批人为默认的董班长 --防止代码冲突 **/ 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 6ede5f0f..7dc54b55 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 @@ -1273,6 +1273,22 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService { @Override public AjaxResult leaseOut(LeaseOutRequestVo leaseOutRequestVo) { for (LeaseOutDetails bean : leaseOutRequestVo.getLeaseOutDetailsList()) { + if (Objects.isNull(bean)) { + continue; + } + // 默认设置领料单位为非班组 + bean.setLeaseUnitIsTeam(false); + // 根据现在的领料发布出库单位ID来判断类型是否是班组 + if (bean.getLeaseUnitId() != null) { + // 查询单位类型 + Long leaseUnitTypeId = leaseApplyInfoMapper.selectUnitTypeByUnitId(Long.valueOf(bean.getLeaseUnitId())); + if (leaseUnitTypeId != null && Objects.equals(leaseUnitTypeId, 1731L)) { + System.out.println("发布出库的领料单位是班组,Yes"); + bean.setLeaseUnitIsTeam(true); + } else { + System.out.println("发布出库的领料单位不是班组,No"); + } + } AjaxResult ajaxResult = leaseOutDetailsService.leaseOut(bean); if (ajaxResult.isError()) { return ajaxResult; 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 5214d5c0..12669e64 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 @@ -205,6 +205,27 @@ public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService { // 5、插入结算记录 String taskId = leaseApplyInfoMapper.getTaskId(record.getParentId()); record.setTaskId(taskId); + // 判断如果是班组领料,则插入原本项目部的协议结算记录 + if (record.getLeaseUnitIsTeam() != null && record.getLeaseUnitIsTeam()) { + // 暂存现在出库的班组单位ID + Integer thisOutId = record.getLeaseUnitId(); + // 查询班组挂靠的项目部协议ID + Long projectUnitAgreementId = leaseApplyInfoMapper.selectProjectUnitAgreementIdByTeamAndProject(record.getLeaseUnitId(), record.getLeaseProjectId()); + if (projectUnitAgreementId != null && projectUnitAgreementId > 0L) { + record.setProjectUnitAgreementId(projectUnitAgreementId); + } else { + return AjaxResult.error("出库失败,没有找到班组所属项目部协议信息"); + } + // 查询申请领料的项目部单位ID + Long originLeaseUnitId = leaseApplyInfoMapper.selectLeaseApplyInfoUnitIdByLeaseId(record.getParentId()); + record.setLeaseUnitId(Math.toIntExact(originLeaseUnitId)); + // 插入项目部领料的结算记录 + int inserts = insSltInfo(taskId, record); + System.out.println("插入原本项目部领料结算记录" + (inserts > 0 ? "成功" : "失败")); + // 恢复出库班组单位ID + record.setLeaseUnitId(thisOutId); + record.setLeaseUnitIsTeam(false); + } res = insSltInfo(taskId, record); if (res == 0) { throw new RuntimeException("出库失败,插入结算记录失败"); @@ -230,8 +251,7 @@ public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService { if (task == null) { int thisMonthMaxOrder = tmTaskMapper.getMonthMaxOrderByDate(DateUtils.getCurrentYear(), DateUtils.getCurrentMonth(), TmTaskTypeEnum.TM_TASK_MATERIAL_LEASE.getTaskTypeId()); String taskCode = genderTaskCode(thisMonthMaxOrder); - TmTask tmTask = new TmTask(); - tmTask = new TmTask(null, TmTaskTypeEnum.TM_TASK_MATERIAL_LEASE.getTaskTypeId(), + TmTask tmTask = new TmTask(null, TmTaskTypeEnum.TM_TASK_MATERIAL_LEASE.getTaskTypeId(), LeaseTaskStatusEnum.LEASE_TASK_FINISHED.getStatus(), null, thisMonthMaxOrder + 1, taskCode); tmTask.setCreateTime(DateUtils.getNowDate()); @@ -261,6 +281,7 @@ public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService { bmAgreementInfo.setUnitId(tbTeam.getId()); } else { bmAgreementInfo.setUnitId(bmTeam.getId()); + // 修改班组信息 bmTeamMapper.update(tbTeam); } // 先根据班组和工程id查询,若存在则直接返回,不存在则新增 @@ -313,6 +334,7 @@ public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService { throw new Exception("更新clz_lease_apply_details表数据失败"); } } else { + // 走新增 record.setPreNum(record.getOutNum()); record.setAlNum(record.getOutNum()); res = materialLeaseInfoMapper.insertLeaseApplyDetails(record); @@ -357,7 +379,7 @@ public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService { } } catch (Exception e) { log.error(e.getMessage()); - return AjaxResult.error("出库失败"); + return AjaxResult.error("出库失败" + e.getMessage()); } return AjaxResult.success("出库成功"); } @@ -758,21 +780,35 @@ public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService { return res; } + /** + * 插入结算信息 + * @param taskId 任务id + * @param record 出库记录 + */ public int insSltInfo(String taskId, LeaseOutDetails record) { int res = 0; - SltAgreementInfo sltAgreementInfo = sltAgreementInfoMapper.getSltAgreementInfo(record); + // 根据发布批次查询结算协议信息 + SltAgreementInfo sltAgreementInfo; + // 判断是否是班组领用 + sltAgreementInfo = sltAgreementInfoMapper.getSltAgreementInfo(record); if (sltAgreementInfo != null) { BigDecimal num = sltAgreementInfo.getNum(); BigDecimal outNum = record.getOutNum(); sltAgreementInfo.setNum(num.add(outNum)); res = sltAgreementInfoMapper.updSltInfo(sltAgreementInfo); - record.setAgreementId(sltAgreementInfo.getAgreementId()); + if (!record.getLeaseUnitIsTeam()) { + record.setAgreementId(sltAgreementInfo.getAgreementId()); + } } else { - String agreementId = " "; - agreementId = tmTaskAgreementMapper.getAgreementId(taskId); + String agreementId = tmTaskAgreementMapper.getAgreementId(taskId); + // 根据发布批次,查询协议ID🆔 if (StringUtils.isNotBlank(record.getPublishTask())) { agreementId = tmTaskAgreementMapper.selectAgreementId(record.getPublishTask()); } + if (record.getLeaseUnitIsTeam()) { + agreementId = String.valueOf(record.getProjectUnitAgreementId()); + } + // 查询单位类型:内部单位/外部单位 String protocol = bmAgreementInfoMapper.getProtocol(agreementId); Type maType = typeMapper.getMaType(record.getTypeId()); if (StringUtils.isEmpty(protocol)) { @@ -787,7 +823,9 @@ public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService { } } res = sltAgreementInfoMapper.insSltInfo(record, agreementId, maType); - record.setAgreementId(Long.valueOf(agreementId)); + if (!record.getLeaseUnitIsTeam()) { + record.setAgreementId(Long.valueOf(agreementId)); + } } return res; } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/impl/LeaseTaskServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/impl/LeaseTaskServiceImpl.java index 314f6274..016a8940 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/impl/LeaseTaskServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/impl/LeaseTaskServiceImpl.java @@ -587,7 +587,7 @@ public class LeaseTaskServiceImpl implements ILeaseTaskService { if (0==sysWorkflowNode.getNodeSignType()){ //当前节点已经审核需要修改节点值 if (SysWorkflowRecordHistoryList.get(0) != null) { - // todo 固定的人员id 修改成 判断人员/角色 如果是人员的话要进行二次查询 + // 固定的人员id 修改成 判断人员/角色 如果是人员的话要进行二次查询 // String configValueNew = sysWorkflowConfigMapper.selectConfigValueByNodeId(SysWorkflowRecordHistoryList.get(0).getNextNodeId()); // leaseApplyInfoNew.setNodeId(SysWorkflowRecordHistoryList.get(0).getNextNodeId()); // leaseApplyInfoNew.setConfigValue(configValueNew); diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/service/impl/SltAgreementInfoServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/service/impl/SltAgreementInfoServiceImpl.java index 7b2f0463..5ddeba5d 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/service/impl/SltAgreementInfoServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/service/impl/SltAgreementInfoServiceImpl.java @@ -330,7 +330,6 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService { } for (SltAgreementInfo lose : loseList) { if (lose.getAgreementId().equals(sltInfo.getAgreementId().toString())) { - //TODO 上面已经set过值,这里为什么还要set值 relation.setAgreementId(String.valueOf(lose.getAgreementId())); relation.setProjectName(lose.getProjectName()); relation.setUnitName(lose.getUnitName()); diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/basic/BmAgreementInfoMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/basic/BmAgreementInfoMapper.xml index 0069998d..5310fd46 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/basic/BmAgreementInfoMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/basic/BmAgreementInfoMapper.xml @@ -8,6 +8,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + @@ -28,7 +29,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" SELECT bai.agreement_id, bai.agreement_code , contract_code,sign_time, - bu.unit_id,bu.unit_name , bp.pro_id as projectId , bp.pro_name as projectName, + bu.unit_id, bai.project_unit_id, bu.unit_name , bp.pro_id as projectId , bp.pro_name as projectName, plan_start_time,lease_day,auth_person,phone,bai.remark,bai.protocol,tta.task_id,bai.branch_project as branchProIdsStr FROM bm_agreement_info bai LEFT JOIN bm_project bp ON bp.pro_id = bai.project_id @@ -74,14 +75,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - insert into bm_agreement_info (agreement_code, sign_time, unit_id, + insert into bm_agreement_info (agreement_code, sign_time, unit_id, project_unit_id, project_id, create_by, lease_day, plan_start_time, contract_code, auth_person, phone, create_time, update_by, update_time, remark, company_id, protocol, branch_project ) - values (#{agreementCode,jdbcType=VARCHAR}, #{signTime,jdbcType=VARCHAR}, #{unitId,jdbcType=INTEGER}, + values (#{agreementCode,jdbcType=VARCHAR}, #{signTime,jdbcType=VARCHAR}, #{unitId,jdbcType=INTEGER}, #{projectUnitId,jdbcType=INTEGER}, #{projectId,jdbcType=INTEGER}, #{createBy,jdbcType=VARCHAR}, #{leaseDay,jdbcType=INTEGER}, #{planStartTime,jdbcType=TIMESTAMP}, #{contractCode,jdbcType=VARCHAR}, #{authPerson,jdbcType=VARCHAR}, #{phone,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{updateBy,jdbcType=VARCHAR}, @@ -113,6 +114,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" agreement_code = #{agreementCode}, sign_time = #{signTime}, unit_id = #{unitId}, + project_unit_id = #{projectUnitId}, project_id = #{projectId}, create_by = #{createBy}, lease_day = #{leaseDay}, diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/clz/MaterialBackInfoMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/clz/MaterialBackInfoMapper.xml index c0e99058..e5744c6d 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/clz/MaterialBackInfoMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/clz/MaterialBackInfoMapper.xml @@ -663,11 +663,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" mt.unit_value as unitValue, mt.manage_type as manageType, SUM(sai.num) AS num, - mt.LEVEL as level + mt.LEVEL as level, + clai.lease_style as leaseStyle FROM ma_type mt LEFT JOIN clz_slt_agreement_info sai ON mt.type_id = sai.type_id LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id and mt1.del_flag = '0' + LEFT JOIN clz_lease_apply_info clai ON sai.lease_id = clai.id WHERE sai.STATUS = '0' and sai.agreement_id = #{agreementId} GROUP BY 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 c311fd1e..e7d43647 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 @@ -216,13 +216,40 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" mt.LEVEL as level FROM ma_type mt - LEFT JOIN slt_agreement_info sai ON mt.type_id = sai.type_id - LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id and mt1.del_flag = '0' + LEFT JOIN slt_agreement_info sai ON mt.type_id = sai.type_id + LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id and mt1.del_flag = '0' WHERE sai.STATUS = '0' and sai.agreement_id = #{agreementId} GROUP BY mt.type_id - HAVING num> 0 + HAVING + num > 0 + + + union all + + SELECT + mt.type_id as typeId, + mt1.type_name as materialName, + mt.type_name as typeName, + mt.parent_id as parentId, + mt.unit_name as unitName, + mt.unit_value as unitValue, + mt.manage_type as manageType, + SUM( IF(sai.agreement_id = #{clzAgreementId} AND sai.STATUS = '0', sai.num, 0) ) AS num, + mt.LEVEL as level + FROM + ma_type mt + LEFT JOIN clz_slt_agreement_info sai ON mt.type_id = sai.type_id + LEFT JOIN clz_lease_apply_info clai ON sai.lease_id = clai.id + LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id and mt1.del_flag = '0' + WHERE + sai.STATUS = '0' and clai.lease_style != 2 + GROUP BY + mt.type_id + HAVING + num> 0 + + + + + + + + + diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/settlement/SltAgreementInfoMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/settlement/SltAgreementInfoMapper.xml index 734d87c1..724bdd60 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/settlement/SltAgreementInfoMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/settlement/SltAgreementInfoMapper.xml @@ -177,6 +177,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" AND publish_task = #{publishTask} + + AND agreement_id = #{projectUnitAgreementId} + + + AND agreement_id = #{agreementId} + AND DATE(start_time) = CURDATE(); From 2089c4eb125f01747a81600103787f8f59728464 Mon Sep 17 00:00:00 2001 From: mashuai Date: Tue, 12 Aug 2025 17:09:07 +0800 Subject: [PATCH 3/7] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MaterialBackApplyInfoServiceImpl.java | 3 --- .../material/basic/ComplexQueryMapper.xml | 22 +++++++++++++------ .../mapper/material/ma/MachineMapper.xml | 3 ++- 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/service/impl/MaterialBackApplyInfoServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/service/impl/MaterialBackApplyInfoServiceImpl.java index f55a8274..a40ee1f2 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/service/impl/MaterialBackApplyInfoServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/service/impl/MaterialBackApplyInfoServiceImpl.java @@ -985,9 +985,6 @@ public class MaterialBackApplyInfoServiceImpl implements MaterialBackApplyInfoSe result += bmFileInfoMapper.insertBmFileInfo(bmFileInfo); } } - if (isBack == 1) { - result += machineMapper.updateStatus(maCodeDto.getMaId(), MaMachineStatusEnum.IN_STORE.getStatus()); - } } } else { // 如果 MaCodeList 为空,只插入 CheckDetails diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/basic/ComplexQueryMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/basic/ComplexQueryMapper.xml index 4521bbaf..85e453ad 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/basic/ComplexQueryMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/basic/ComplexQueryMapper.xml @@ -556,8 +556,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" LEFT JOIN bm_agreement_info bai ON bai.agreement_id = sai.agreement_id LEFT JOIN bm_project bp ON bai.project_id = bp.pro_id WHERE - sai.end_time IS NULL - AND sai.back_id IS NULL + sai.`status` = '0' + AND sai.end_time IS NULL + AND sai.back_id IS NULL + AND sai.`is_slt` = '0' AND sai.type_id = #{typeId} @@ -707,12 +709,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/ma/MachineMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/ma/MachineMapper.xml index 403ca582..3f4dc8e8 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/ma/MachineMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/ma/MachineMapper.xml @@ -578,7 +578,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" mm.type_id as typeId, sd.dict_label as maStatus, mm.qr_code as qrCode, - mm.ma_vender as maVender, + msi.supplier as maVender, mm.out_fac_time as outFacTime, mm.out_fac_code as outFacCode, mm.assets_code as assetsCode, @@ -591,6 +591,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" LEFT JOIN ma_type mt ON mt.type_id = mm.type_id LEFT JOIN ma_type mt2 ON mt.parent_id = mt2.type_id LEFT JOIN sys_dict_data sd on mm.ma_status = sd.dict_value and sd.dict_type = "ma_machine_status" + LEFT JOIN ma_supplier_info msi on msi.supplier_id = mm.ma_vender where mm.qr_code = #{qrCode} From 2a91ea8e4861ffa3039f13408335d591d57af174 Mon Sep 17 00:00:00 2001 From: mashuai Date: Tue, 12 Aug 2025 17:29:47 +0800 Subject: [PATCH 4/7] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bonus/common/biz/domain/TypeTreeNode.java | 6 +++++ .../impl/MaterialLeaseInfoServiceImpl.java | 2 +- .../material/common/mapper/SelectMapper.java | 7 ++++++ .../lease/domain/LeaseApplyDetails.java | 6 +++++ .../mapper/material/common/SelectMapper.xml | 25 +++++++++++++++++++ .../lease/LeaseApplyDetailsMapper.xml | 8 ++++-- 6 files changed, 51 insertions(+), 3 deletions(-) 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 index 72abaddc..13f99ab9 100644 --- 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 @@ -51,4 +51,10 @@ public class TypeTreeNode { @ApiModelProperty(value = "领料方式 0材料领料 1工器具领料 2数据同步") private Integer leaseStyle; + + @ApiModelProperty("机具类型(1机具,2安全工器具)") + private int jiJuType; + + @ApiModelProperty(value = "是否检验(0不检验,1检验)") + private String isCheck; } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/service/impl/MaterialLeaseInfoServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/service/impl/MaterialLeaseInfoServiceImpl.java index 3f4b80e1..669945cb 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/service/impl/MaterialLeaseInfoServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/service/impl/MaterialLeaseInfoServiceImpl.java @@ -1319,7 +1319,7 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService { if (!CollectionUtils.isEmpty(bean.getAgreementIdList())) { for (Long agreementId : bean.getAgreementIdList()) { backApplyInfo.setAgreementId(agreementId); - listL4 = mapper.getUseTypeTreeL4(backApplyInfo); + listL4 = mapper.getUseTypeClzTree(backApplyInfo); if (!CollectionUtils.isEmpty(listL4)) { listL4 = listL4.stream() .filter(item -> StringUtils.isNotBlank(item.getMaterialName()) && StringUtils.isNotBlank(item.getTypeName())) 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 677fbff8..1391e04c 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 @@ -283,4 +283,11 @@ public interface SelectMapper { * @return */ BmUnit selectUnitByLeaseId(BmUnit bmUnit); + + /** + * 获取部门项目 + * @param backApplyInfo + * @return + */ + List getUseTypeClzTree(BackApplyInfo backApplyInfo); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/domain/LeaseApplyDetails.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/domain/LeaseApplyDetails.java index 328de02f..1f85828b 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/domain/LeaseApplyDetails.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/domain/LeaseApplyDetails.java @@ -193,6 +193,12 @@ public class LeaseApplyDetails extends BaseEntity { @ApiModelProperty(value = "编号") private String code; + @ApiModelProperty("机具类型(1机具,2安全工器具)") + private int jiJuType; + + @ApiModelProperty(value = "是否检验(0不检验,1检验)") + private String isCheck; + @ApiModelProperty(value = "领料物资名称汇总") private String maTypeNames; public LeaseApplyDetails(Long id, Long parentId, Long typeId, BigDecimal preNum, BigDecimal auditNum, BigDecimal alNum, String status, Long companyId) { 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 e7d43647..76688764 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 @@ -847,4 +847,29 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" WHERE bu.del_flag = '0' and bzgl_bz.project_id = #{externalId} + + diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/lease/LeaseApplyDetailsMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/lease/LeaseApplyDetailsMapper.xml index 58ace874..7c993098 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/lease/LeaseApplyDetailsMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/lease/LeaseApplyDetailsMapper.xml @@ -451,7 +451,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" lad.update_by as updateBy, lad.update_time as updateTime, lad.remark as remark, - lad.company_id as companyId + lad.company_id as companyId, + mt.jiju_type as jijuType, + mt.is_check as isCheck from lease_apply_details lad left join ma_type mt on lad.type_id = mt.type_id and mt.`level` = '4' and mt.del_flag = '0' @@ -605,7 +607,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" IFNULL(subquery0.num, 0) ELSE IFNULL(mt.storage_num, 0) - END as storageNum + END as storageNum, + mt.jiju_type as jijuType, + mt.is_check as isCheck FROM lease_publish_details lpd LEFT JOIN ma_type mt ON lpd.new_type = mt.type_id From 4ba06551dc07f838d816af86ecc1f6f56a7e7155 Mon Sep 17 00:00:00 2001 From: hayu <1604366271@qq.com> Date: Tue, 12 Aug 2025 18:20:35 +0800 Subject: [PATCH 5/7] =?UTF-8?q?=E9=97=AE=E9=A2=98=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ma/controller/MachineController.java | 10 +++ .../com/bonus/material/ma/domain/Machine.java | 5 ++ .../material/ma/mapper/MachineMapper.java | 7 ++ .../material/ma/service/IMachineService.java | 7 ++ .../ma/service/impl/MachineServiceImpl.java | 74 +++++++++++++++++++ .../mapper/material/ma/MachineMapper.xml | 62 +++++++++++++++- 6 files changed, 164 insertions(+), 1 deletion(-) diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/MachineController.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/MachineController.java index 947646e2..e85b3276 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/MachineController.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/MachineController.java @@ -303,6 +303,16 @@ public class MachineController extends BaseController { return machineService.getHisByCode(machine); } + /** + * 根据qrcode查询机具历史信息-New查询安全工器具和工器具 + * @param machine + * @return + */ + @GetMapping("/getHisByCodeNew") + public AjaxResult getHisByCodeNew(Machine machine) { + return machineService.getHisByCodeNew(machine); + } + /** * 根据类型id获取编码 * @param machine diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/domain/Machine.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/domain/Machine.java index 113bc753..370af476 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/domain/Machine.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/domain/Machine.java @@ -316,4 +316,9 @@ public class Machine extends BaseEntity { private List projectIdList; private String supplierId; + + /** + * 1-工器具,2-安全工器具 + */ + private int jiJuType; } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/mapper/MachineMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/mapper/MachineMapper.java index d2ee9838..0c5d6b17 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/mapper/MachineMapper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/mapper/MachineMapper.java @@ -188,4 +188,11 @@ public interface MachineMapper * @return */ List getInfoByTypeId(Machine machine); + + /** + * 根据编码查询机具信息 + * @param machine + * @return + */ + List getHisByCodeNew(Machine machine); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/IMachineService.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/IMachineService.java index 2d4b86b0..224c7494 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/IMachineService.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/IMachineService.java @@ -133,4 +133,11 @@ public interface IMachineService * @return */ List getInfoByTypeId(Machine machine); + + /** + * 根据编码查询机具历史信息-New查询安全工器具和工器具 + * @param machine + * @return + */ + AjaxResult getHisByCodeNew(Machine machine); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/MachineServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/MachineServiceImpl.java index 8ff423ee..52073f54 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/MachineServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/MachineServiceImpl.java @@ -433,6 +433,79 @@ public class MachineServiceImpl implements IMachineService } + @Override + public AjaxResult getHisByCodeNew(Machine machine) { + try { + List result = new ArrayList<>(); + List maList = machineMapper.getHisByCodeNew(machine); + if (CollectionUtils.isNotEmpty(maList)){ + if(maList.size() == 1){ + Machine baseInfo = maList.get(0); + if (baseInfo.getJiJuType()==2){ + machine.setMaId(baseInfo.getMaId()); + machine.setMaCode(baseInfo.getMaCode()); + //2根据二维码查询初次入库时间 + Machine inTime = machineMapper.getInTimeByQrcode(machine); + //服务工程次数,检验次数 + Machine serviceNum = machineMapper.getServiceNumByQrcode(machine); + //更换配件次数 + Machine checkNum = machineMapper.getCheckNumByQrcode(machine); + //报废时间 + Machine scrapTime = machineMapper.getScrapTimeByQrcode(machine); + //3根据机具id查询领退工程 + Machine leaseInfo = machineMapper.getLeaseInfoByQrcode(machine); + if (inTime != null){ + Integer taskId = inTime.getTaskId(); + if(taskId != null){ + baseInfo.setInTime(inTime.getInTime()+"(新购)"); + }else{ + baseInfo.setInTime(inTime.getInTime()); + } + + } + if(serviceNum != null){ + baseInfo.setServiceNum(serviceNum.getServiceNum()); + }else{ + baseInfo.setServiceNum(0); + } + + if(checkNum != null){ + baseInfo.setCheckNum(checkNum.getCheckNum()); + }else{ + baseInfo.setCheckNum(0); + } + + if (scrapTime != null){ + baseInfo.setScrapTime(scrapTime.getScrapTime()); + }else{ + baseInfo.setScrapTime("暂无"); + } + if(leaseInfo != null){ + baseInfo.setLeaseTime(leaseInfo.getLeaseTime()); + baseInfo.setLeaseUnit(leaseInfo.getLeaseUnit()); + baseInfo.setLeaseProject(leaseInfo.getLeaseProject()); + baseInfo.setBackTime(leaseInfo.getBackTime()); + baseInfo.setBackUnit(leaseInfo.getBackUnit()); + baseInfo.setBackProject(leaseInfo.getBackProject()); + } + result.add(baseInfo); + return success(result); + } else { + result.add(baseInfo); + return success(result); + } + } else { + return success(maList); + } + }else{ + return error("暂无该设备信息"); + } + } catch (Exception e) { + e.printStackTrace(); + return error("暂无该设备信息"); + } + } + /** * 编码铭牌信息 * @param machine @@ -454,4 +527,5 @@ public class MachineServiceImpl implements IMachineService return machineMapper.getInfoByTypeId(machine); } + } diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/ma/MachineMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/ma/MachineMapper.xml index 3f4dc8e8..3d065124 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/ma/MachineMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/ma/MachineMapper.xml @@ -75,7 +75,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ma.inspect_man as inspectMan, ma.inspect_status as inspectStatus, ma.phone as phone, - mt.jiju_type as jijuType, + mt.jiju_type as jiJuType, mt.is_check as isCheck, CASE WHEN RIGHT(ma.ma_code, 4) REGEXP '^[0-9]{4}$' THEN CAST(RIGHT(ma.ma_code, 4) AS UNSIGNED) @@ -787,4 +787,64 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and wsi.ma_code LIKE CONCAT('%',#{maCode},'%') + From 11a5411d21855109a0c33b95d0de9d7180033f61 Mon Sep 17 00:00:00 2001 From: mashuai Date: Tue, 12 Aug 2025 19:12:58 +0800 Subject: [PATCH 6/7] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lease/service/impl/LeaseTaskServiceImpl.java | 10 +++++++++- .../com/bonus/material/task/mapper/TmTaskMapper.java | 8 ++++++++ .../mapper/material/lease/LeaseTaskMapper.xml | 4 ++-- .../resources/mapper/material/task/TmTaskMapper.xml | 10 ++++++++++ 4 files changed, 29 insertions(+), 3 deletions(-) diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/impl/LeaseTaskServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/impl/LeaseTaskServiceImpl.java index 016a8940..db299b69 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/impl/LeaseTaskServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/impl/LeaseTaskServiceImpl.java @@ -127,7 +127,11 @@ public class LeaseTaskServiceImpl implements ILeaseTaskService { if (CollectionUtil.isEmpty(leaseApplyRequestVo.getLeaseApplyDetailsList())) { return AjaxResult.error("请先添加领用任务物资明细"); } - + // 根据单号查询此单号是否已经存在 + List codeInfo = tmTaskMapper.selectLeaseApplyInfoByTaskNo(leaseApplyRequestVo.getLeaseApplyInfo().getCode()); + if (CollectionUtil.isNotEmpty(codeInfo)) { + return AjaxResult.error("此业务单号已经存在,请叉掉后重新提交"); + } LeaseApplyInfo leaseApplyInfo = leaseApplyRequestVo.getLeaseApplyInfo(); SysUser sysUser = SecurityUtils.getLoginUser().getSysUser(); Date nowDate = DateUtils.getNowDate(); @@ -465,6 +469,10 @@ public class LeaseTaskServiceImpl implements ILeaseTaskService { } if(!deptName.equals("")){ int thisMonthMaxOrder = tmTaskMapper.getMonthMaxOrderByDate(DateUtils.getCurrentYear(), DateUtils.getCurrentMonth(), TmTaskTypeEnum.TM_TASK_LEASE_APPLY.getTaskTypeId()); + int lzThisMonthMaxOrder = tmTaskMapper.getMonthMaxOrderByDate(DateUtils.getCurrentYear(), DateUtils.getCurrentMonth(), TmTaskTypeEnum.TM_TASK_LEASE.getTaskTypeId()); + if (StringUtils.isBlank(leaseDeptInfo.getCompanySX())) { + thisMonthMaxOrder = Math.max(thisMonthMaxOrder, lzThisMonthMaxOrder); + } taskCode = genderTaskCodeTwo(thisMonthMaxOrder,leaseDeptInfo.getCompanySX()); leaseDeptInfo.setTaskCode(taskCode); } 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 d0c3f738..5186f812 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 @@ -3,6 +3,7 @@ package com.bonus.material.task.mapper; import java.util.Date; import java.util.List; +import com.bonus.common.biz.domain.lease.LeaseApplyInfo; import com.bonus.common.biz.domain.lease.LeaseOutDetails; import com.bonus.material.back.domain.BackApplyInfo; import com.bonus.material.basic.domain.BmUnit; @@ -137,4 +138,11 @@ public interface TmTaskMapper { * @return */ BmUnit selectBmUnitInfo(BackApplyInfo backApplyInfo); + + /** + * 根据任务编号查询任务信息 + * @param code + * @return + */ + List selectLeaseApplyInfoByTaskNo(String code); } diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/lease/LeaseTaskMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/lease/LeaseTaskMapper.xml index c21c0934..1f0a74e0 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/lease/LeaseTaskMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/lease/LeaseTaskMapper.xml @@ -392,8 +392,8 @@ case tt.task_status when 0 then '待审核' when 6 then '审核中' - when 3 then '已驳回' - when 2 then '已完成' + when 3 then '已完成' + when 2 then '已驳回' when 5 then '待提交' end as taskStatusName, IFNULL(sum(lad.pre_num),0) as preCountNum, diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/task/TmTaskMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/task/TmTaskMapper.xml index 1eb7536d..7892892b 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/task/TmTaskMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/task/TmTaskMapper.xml @@ -215,4 +215,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" WHERE unit_id = #{unitId} + + \ No newline at end of file From 335d48b5f39525c1813a7701a6609764bfca270d Mon Sep 17 00:00:00 2001 From: mashuai Date: Wed, 13 Aug 2025 11:09:23 +0800 Subject: [PATCH 7/7] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/PurchaseCheckInfoServiceImpl.java | 49 +++++++++++++++++-- 1 file changed, 46 insertions(+), 3 deletions(-) diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/service/impl/PurchaseCheckInfoServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/service/impl/PurchaseCheckInfoServiceImpl.java index dc87c11e..c85e5f45 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/service/impl/PurchaseCheckInfoServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/service/impl/PurchaseCheckInfoServiceImpl.java @@ -713,8 +713,6 @@ public class PurchaseCheckInfoServiceImpl implements IPurchaseCheckInfoService { typeMapper.updateType(type); } // 批量插入详情数据 - // 将purchaseCheckDetailsList的status全部设置为2 - purchaseCheckDetailsList.forEach(o -> o.setStatus(PurchaseTaskStatusEnum.TO_CHECK.getStatus())); final int count = purchaseCheckDetailsMapper.insertPurchaseCheckDetailsList(purchaseCheckDetailsList); if (0 < count) { return AjaxResult.success("新增任务成功"); @@ -1091,10 +1089,55 @@ public class PurchaseCheckInfoServiceImpl implements IPurchaseCheckInfoService { try { final Long[] ids = {purchaseCheckDto.getPurchaseCheckInfo().getId()}; purchaseCheckDetailsMapper.deleteDetails(ids); - insertPurchaseCheckDetails(purchaseCheckDto.getPurchaseCheckDetailsList(), purchaseCheckDto.getPurchaseCheckInfo().getTaskId()); + insertPurchaseCheckDetailsInfo(purchaseCheckDto.getPurchaseCheckDetailsList(), purchaseCheckDto.getPurchaseCheckInfo().getTaskId()); return purchaseCheckInfoMapper.updatePurchaseCheckInfo(purchaseCheckDto.getPurchaseCheckInfo()); } catch (final Exception e) { throw new ServiceException("错误信息描述"); } } + + /** + * 批量插入新购验收任务详情 + * @param purchaseCheckDetailsList + * @param taskId + * @return + */ + private int insertPurchaseCheckDetailsInfo(List purchaseCheckDetailsList, Long taskId) { + int count = 0; + if (!CollectionUtils.isEmpty(purchaseCheckDetailsList)) { + for (PurchaseCheckDetails details : purchaseCheckDetailsList) { + details.setTaskId(taskId); + details.setStatus(Objects.equals(PurchaseTaskStatusEnum.TO_CHECK_AFTER_REJECT.getStatus(), details.getStatus()) ? + PurchaseTaskStatusEnum.TO_CHECK.getStatus() : + PurchaseTaskStatusEnum.TO_NOTICE.getStatus()); + details.setInputStatus("0"); + final List bmFileInfos = details.getBmFileInfos(); + if (!CollectionUtils.isEmpty(bmFileInfos)) { + bmFileInfos.forEach(o -> { + o.setTaskId(taskId); + o.setModelId(details.getTypeId()); + o.setCreateBy(SecurityUtils.getLoginUser().getUserid().toString()); + o.setCreateTime(DateUtils.getNowDate()); + }); + bmFileInfoMapper.insertBmFileInfos(bmFileInfos); + } + Type type = new Type(); + type.setTypeId(details.getTypeId()); + type.setUpdateTime(DateUtils.getNowDate()); + type.setUpdateBy(SecurityUtils.getLoginUser().getUserid().toString()); + type.setBuyPrice(details.getPurchaseTaxPrice()); + type.setNotTaxPrice(details.getPurchasePrice()); + Type maType = typeMapper.getMaType(details.getTypeId()); + if (maType != null && (maType.getRentPrice() == null || maType.getRentPrice().compareTo(BigDecimal.ZERO) == 0)) { + type.setRentPrice(details.getRentPrice()); + } + typeMapper.updateType(type); + } + // 批量插入详情数据 + // 将purchaseCheckDetailsList的status全部设置为2 + purchaseCheckDetailsList.forEach(o -> o.setStatus(PurchaseTaskStatusEnum.TO_CHECK.getStatus())); + count = purchaseCheckDetailsMapper.insertPurchaseCheckDetailsList(purchaseCheckDetailsList); + } + return count; + } }