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 969978fd..fb06a234 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 @@ -110,8 +110,17 @@ public class LeaseOutDetails extends BaseEntity { @ApiModelProperty(value = "是否完成 (0:未完成 1:已完成)") private Integer isFinished; + @ApiModelProperty(value = "领料单位") + private String leaseUnit; + + @ApiModelProperty(value = "领料工程") + private String leaseProject; + + @ApiModelProperty(value = "是否退回 (0:未退回,1:退回)") + private Integer isBack; + /** * 领料出库机具编码集合 */ - private List maCodeList; + private List maCodeList; } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/controller/BmQrBoxController.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/controller/BmQrBoxController.java index fe8b19d1..90a3b976 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/controller/BmQrBoxController.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/controller/BmQrBoxController.java @@ -316,4 +316,15 @@ public class BmQrBoxController extends BaseController { public AjaxResult addMaCodeBoxBind(@RequestBody @NotNull(message = "参数不能为空") Machine machine) { return qrBoxService.addMaCodeBoxBind(machine); } + + /** + * APP -- 查询新信息采集二维码标准箱绑定列表 + * @param bean + * @return + */ + @ApiOperation(value = "APP -- 查询新信息采集二维码标准箱绑定列表") + @GetMapping("/app_box_bind_wsList") + public AjaxResult getBoxBindWsList(BmQrBoxInfo bean) { + return AjaxResult.success(getDataTable(qrBoxService.getBoxBindWsList(bean))); + } } 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 1fe82706..9600b17d 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 @@ -79,4 +79,8 @@ public interface BmAgreementInfoMapper * @return */ BmAgreementInfo queryByTeamIdAndProjectId(BmAgreementInfo bmAgreementInfo); + + BmAgreementInfo queryByTeamIdAndProjectIdCl(BmAgreementInfo bmAgreementInfo); + + int insertBmAgreementInfoClz(BmAgreementInfo bmAgreementInfo); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/mapper/BmQrBoxMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/mapper/BmQrBoxMapper.java index 343c8d4a..667f2b05 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/mapper/BmQrBoxMapper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/mapper/BmQrBoxMapper.java @@ -159,4 +159,18 @@ public interface BmQrBoxMapper { * @return */ BoxBindWarehouseDto getBoxInfo(BoxBindWarehouseDto info); + + /** + * 一个标准型只有1种类型 + * @param boxId + * @return + */ + List getBoxWsTypeList(Long boxId); + + /** + * 查询标准箱已绑定的仓库信息 + * @param bean + * @return + */ + List getBoxBindWsList(BmQrBoxInfo bean); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/service/BmQrBoxService.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/service/BmQrBoxService.java index f9de6c98..7ff26f7c 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/service/BmQrBoxService.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/service/BmQrBoxService.java @@ -141,4 +141,11 @@ public interface BmQrBoxService { * @return */ AjaxResult addMaCodeBoxBind(Machine machine); + + /** + * 查询移交库管员列表 + * @param bean + * @return + */ + List getBoxBindWsList(BmQrBoxInfo bean); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/service/impl/BmQrBoxServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/service/impl/BmQrBoxServiceImpl.java index 9400787f..76fe14a1 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/service/impl/BmQrBoxServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/service/impl/BmQrBoxServiceImpl.java @@ -656,13 +656,13 @@ public class BmQrBoxServiceImpl implements BmQrBoxService { */ @Override public AjaxResult getMaCodeList(BmQrBoxInfo info) { - // 先根据编码查询ma_machine + /* // 先根据编码查询ma_machine MachineVo machineVo = machineMapper.selectMachineByMaCode(info); if (machineVo != null) { if (!Objects.equals(machineVo.getMaStatus(), MaMachineStatusEnum.INFORMATION_COLLECTION.getStatus().toString())) { return AjaxResult.error("物资状态非信息采集待入库状态,无法操作!"); } - } + }*/ // 先根据编码查询ws_ma_info MachineVo wsMaInfo = machineMapper.selectMaInfoByMaCode(info); return AjaxResult.success(wsMaInfo); @@ -683,9 +683,9 @@ public class BmQrBoxServiceImpl implements BmQrBoxService { // 先查询数据是否存在 BmQrBoxInfo bmQrBoxInfo = new BmQrBoxInfo(); bmQrBoxInfo.setMaCode(machine.getMaCode()); - MachineVo vo = machineMapper.selectMachineByMaCode(bmQrBoxInfo); - machine.setMaStatus(MaMachineStatusEnum.INFORMATION_COLLECTION.getStatus().toString()); - if (vo != null) { + //MachineVo vo = machineMapper.selectMachineByMaCode(bmQrBoxInfo); + //machine.setMaStatus(MaMachineStatusEnum.INFORMATION_COLLECTION.getStatus().toString()); + /*if (vo != null) { machine.setMaId(vo.getMaId()); machine.setUpdateTime(DateUtils.getNowDate()); int i = machineMapper.updateMachine(machine); @@ -699,14 +699,14 @@ public class BmQrBoxServiceImpl implements BmQrBoxService { if (0 == result) { return AjaxResult.error("新增绑定机具失败"); } - } + }*/ // 此物资未在其他标准型入过库,才可以绑定 if (0 < bmQrBoxMapper.existsMaId(machine.getMaId())) { return AjaxResult.error("该物资已绑定其他标准箱,无法再次绑定!"); } // 一个标准型只有1种类型 - final List boxMaTypeList = bmQrBoxMapper.getBoxMaTypeList(machine.getBoxId()); + final List boxMaTypeList = bmQrBoxMapper.getBoxWsTypeList(machine.getBoxId()); if (!boxMaTypeList.isEmpty()) { if (1 < boxMaTypeList.size()) { return AjaxResult.error("该标准箱已绑定多种物资,无法进行操作,请联系运维人员处理!"); @@ -721,8 +721,11 @@ public class BmQrBoxServiceImpl implements BmQrBoxService { bmQrBoxInfo.setCreateBy(SecurityUtils.getLoginUser().getSysUser().getNickName()); bmQrBoxInfo.setCreateTime(DateUtils.getNowDate()); bmQrBoxInfo.setBoxId(machine.getBoxId()); + // 关联ws_ma_info + bmQrBoxInfo.setBoxType("0"); + bmQrBoxMapper.updateBmQrcodeInfoById(bmQrBoxInfo); if (0 < bmQrBoxMapper.addQrcodeBoxBind(bmQrBoxInfo)) { - // 修改标准箱状态为已完成 + // 修改标准箱状态为待移交 bmQrBoxInfo.setStatus(QrBoxStatusEnum.QR_BOX_STATUS_WAIT_TRANSFER.getStatus().toString()); bmQrBoxMapper.updateBmQrcodeStatus(bmQrBoxInfo); return AjaxResult.success(HttpCodeEnum.SUCCESS.getMsg()); @@ -734,6 +737,16 @@ public class BmQrBoxServiceImpl implements BmQrBoxService { } } + /** + * 获取标准箱绑定物资信息 + * @param bean + * @return + */ + @Override + public List getBoxBindWsList(BmQrBoxInfo bean) { + return bmQrBoxMapper.getBoxBindWsList(bean); + } + private int updateBoxStatus(BoxBindWarehouseDto boxMa) { int result = 0; result = bmQrBoxMapper.updateBoxStatus(boxMa); diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/domain/BmTeam.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/domain/BmTeam.java index 6b3f64e0..921a2bab 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/domain/BmTeam.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/domain/BmTeam.java @@ -109,4 +109,9 @@ public class BmTeam { * 班组长账号 */ private String idCard; + + /** + * 单位类型id + */ + private Long typeId; } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/domain/lease/MaterialLeaseApplyInfo.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/domain/lease/MaterialLeaseApplyInfo.java index 8a4d582e..393feaef 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/domain/lease/MaterialLeaseApplyInfo.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/domain/lease/MaterialLeaseApplyInfo.java @@ -278,4 +278,7 @@ public class MaterialLeaseApplyInfo extends BaseEntity { @ApiModelProperty(value="工程id") private Long proId; + + @ApiModelProperty(value = "协议id集合") + private List agreementIdList; } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/mapper/MaterialLeaseInfoMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/mapper/MaterialLeaseInfoMapper.java index a9b7e8f8..4fd37b10 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/mapper/MaterialLeaseInfoMapper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/mapper/MaterialLeaseInfoMapper.java @@ -3,6 +3,7 @@ package com.bonus.material.clz.mapper; import com.bonus.common.biz.domain.TypeTreeNode; import com.bonus.common.biz.domain.lease.LeaseOutDetails; import com.bonus.material.back.domain.vo.MaCodeVo; +import com.bonus.material.basic.domain.BmAgreementInfo; import com.bonus.material.basic.domain.BmQrcodeInfo; import com.bonus.material.clz.domain.vo.MaterialMaCodeVo; import com.bonus.material.ma.domain.Type; @@ -269,4 +270,18 @@ public interface MaterialLeaseInfoMapper { * @return */ BigDecimal getStorageNum(@Param("agreementId") Long agreementId, @Param("typeId") Long typeId); + + /** + * 根据工程id去协议表中查询协议id + * @param bean + * @return + */ + List getAgreementIdByProId(MaterialLeaseApplyInfo bean); + + /** + * 根据工程和班组id查询协议id + * @param bean + * @return + */ + BmAgreementInfo getAgreeId(MaterialLeaseApplyInfo bean); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/service/impl/IwsTeamUserServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/service/impl/IwsTeamUserServiceImpl.java index 46d4940f..ed595c51 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/service/impl/IwsTeamUserServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/service/impl/IwsTeamUserServiceImpl.java @@ -115,6 +115,8 @@ public class IwsTeamUserServiceImpl implements IwsTeamUserService { bmTeam.setIdCard(StringUtils.isNotBlank(iwsTeamUserVo.getTeamLeaderIdCard()) ? iwsTeamUserVo.getTeamLeaderIdCard() : null); bmTeam.setProjectId(StringUtils.isNotBlank(iwsTeamUserVo.getProjectId()) ? iwsTeamUserVo.getProjectId() : null); bmTeam.setRelPhone(StringUtils.isNotBlank(iwsTeamUserVo.getTeamLeaderPhone()) ? iwsTeamUserVo.getTeamLeaderPhone() : null); + // 班组类型固定传值 + bmTeam.setTypeId(1731L); // 根据班组名称去bm_unit表查询班组信息 BmTeam bmTeam1 = bmTeamMapper.selectByName(bmTeam); if (bmTeam1 == null) { 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 10e6d787..844fa92b 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 @@ -493,12 +493,14 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService { bmAgreementInfo.setUnitId(leaseApplyRequestVo.getLeaseApplyInfo().getTeamId()); bmAgreementInfo.setCreateTime(DateUtils.getNowDate()); bmAgreementInfo.setCreateBy(createBy); + bmAgreementInfo.setSignTime(DateUtils.getNowDate()); + bmAgreementInfo.setAgreementCode(getAgreementCode()); // 先根据班组和工程id查询,若存在则直接返回,不存在则新增 - BmAgreementInfo info = bmAgreementInfoMapper.queryByTeamIdAndProjectId(bmAgreementInfo); + BmAgreementInfo info = bmAgreementInfoMapper.queryByTeamIdAndProjectIdCl(bmAgreementInfo); if (info != null) { leaseApplyRequestVo.getLeaseApplyInfo().setAgreementId(info.getAgreementId()); } else { - int count = bmAgreementInfoMapper.insertBmAgreementInfo(bmAgreementInfo); + int count = bmAgreementInfoMapper.insertBmAgreementInfoClz(bmAgreementInfo); if (count > 0) { leaseApplyRequestVo.getLeaseApplyInfo().setAgreementId(bmAgreementInfo.getAgreementId()); } else { @@ -540,6 +542,19 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService { } } + /** + * 获取协议编号 + * @return + */ + private String getAgreementCode() { + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); + Date nowDate = DateUtils.getNowDate(); + String format = dateFormat.format(nowDate); + String result = format.replace("-", ""); + int num = bmAgreementInfoMapper.selectNumByMonth(nowDate); + return MaterialConstants.AGREEMENT_PREFIX + result + String.format("-%03d", num + 1); + } + /** * 修改领料任务 * @param leaseApplyRequestVo @@ -781,72 +796,118 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService { List listL4 = new ArrayList<>(); List listL3 = new ArrayList<>(); List listL21 = new ArrayList<>(); + List listL5 = new ArrayList<>(); + List list7 = new ArrayList<>(); try { // 先查第四层类型 BackApplyInfo backApplyInfo = new BackApplyInfo(); - backApplyInfo.setAgreementId(bean.getAgreementId()); - listL4 = mapper.getUseTypeTreeL4(backApplyInfo); - // 根据协议id去clz_slt_agreement_info材料站协议表中查询在用设备,进行数据筛选去除 - List list5 = materialLeaseInfoMapper.getUseTypeTree(bean); - if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(listL4)) { - if (!CollectionUtils.isEmpty(list5)) { - // 将list4中typeId和list5中相同数据进行num相减,并剔除相减后为0的数据 - Map typeIdToNum = list5.stream() - .collect(Collectors.toMap( - TypeTreeNode::getTypeId, - TypeTreeNode::getNum, - BigDecimal::add - )); - Iterator iterator = listL4.iterator(); - while (iterator.hasNext()) { - TypeTreeNode node = iterator.next(); - Long typeId = node.getTypeId(); - // 获取要减去的值,默认值为BigDecimal.ZERO - BigDecimal subtractNum = typeIdToNum.getOrDefault(typeId, BigDecimal.ZERO); - // 计算新值,处理num为null的情况(若业务允许) - BigDecimal currentNum = Optional.ofNullable(node.getNum()) - .orElse(BigDecimal.ZERO); - BigDecimal newNum = currentNum.subtract(subtractNum); - if (newNum.compareTo(BigDecimal.ZERO) == 0) { - iterator.remove(); - } else { - node.setNum(newNum); + if (!CollectionUtils.isEmpty(bean.getAgreementIdList())) { + for (Long agreementId : bean.getAgreementIdList()) { + backApplyInfo.setAgreementId(agreementId); + listL4 = mapper.getUseTypeTreeL4(backApplyInfo); + if (!CollectionUtils.isEmpty(listL4)) { + // 将listL5中typeId相同的数据进行num相加 + for (TypeTreeNode node : listL4) { + // 根据node中的typeId查询listL5中相同数据,如果在listL5中存在,则将num相加,反之将node添加到list5中 + TypeTreeNode node1 = listL5.stream() + .filter(item -> item.getTypeId() == (node.getTypeId())) + .findFirst() + .orElse(null); + if (node1 != null) { + node1.setNum(node1.getNum().add(node.getNum())); + } + if (node1 == null) { + listL5.add(node); + } } } } - } - if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(listL4)) { - for (TypeTreeNode node : listL4) { - // 根据协议id以及typeId查询在用量 - if (bean.getAgreementId() != null) { - Type maType = new Type(); - maType.setAgreementId(bean.getAgreementId()); - maType.setTypeId(node.getTypeId()); - Type dto = typeMapper.getNumList(maType); - if (dto != null) { - node.setUseNum(dto.getUseNum()); + // 根据工程id去协议表中查询协议id + List listAgreement = materialLeaseInfoMapper.getAgreementIdByProId(bean); + if (!CollectionUtils.isEmpty(listAgreement)) { + for (BmAgreementInfo agreementInfo : listAgreement) { + bean.setAgreementId(agreementInfo.getAgreementId()); + List list6 = materialLeaseInfoMapper.getUseTypeTree(bean); + if (!CollectionUtils.isEmpty(list6)) { + for (TypeTreeNode node : list6) { + // 根据node中的typeId查询listL7中相同数据,如果在listL7中存在,则将num相加,反之将node添加到list7中 + TypeTreeNode node1 = list7.stream() + .filter(item -> item.getTypeId() == (node.getTypeId())) + .findFirst() + .orElse(null); + if (node1 != null) { + node1.setNum(node1.getNum().add(node.getNum())); + } + if (node1 == null) { + list7.add(node); + } + } + } + } + } + // 根据协议id去clz_slt_agreement_info材料站协议表中查询在用设备,进行数据筛选去除 + if (!CollectionUtils.isEmpty(listL5)) { + if (!CollectionUtils.isEmpty(list7)) { + // 将list5中typeId和list7中相同数据进行num相减,并剔除相减后为0的数据 + Map typeIdToNum = list7.stream() + .collect(Collectors.toMap( + TypeTreeNode::getTypeId, + TypeTreeNode::getNum, + BigDecimal::add + )); + Iterator iterator = listL5.iterator(); + while (iterator.hasNext()) { + TypeTreeNode node = iterator.next(); + Long typeId = node.getTypeId(); + // 获取要减去的值,默认值为BigDecimal.ZERO + BigDecimal subtractNum = typeIdToNum.getOrDefault(typeId, BigDecimal.ZERO); + // 计算新值,处理num为null的情况(若业务允许) + BigDecimal currentNum = Optional.ofNullable(node.getNum()) + .orElse(BigDecimal.ZERO); + BigDecimal newNum = currentNum.subtract(subtractNum); + if (newNum.compareTo(BigDecimal.ZERO) == 0) { + iterator.remove(); + } else { + node.setNum(newNum); + } + } + } + } + if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(listL5)) { + for (TypeTreeNode node : listL5) { + // 根据协议id以及typeId查询在用量 + if (bean.getAgreementId() != null) { + // 根据工程和班组id查询协议id + BmAgreementInfo info = materialLeaseInfoMapper.getAgreeId(bean); + Type maType = new Type(); + maType.setAgreementId(info.getAgreementId()); + maType.setTypeId(node.getTypeId()); + Type dto = typeMapper.getNumList(maType); + if (dto != null) { + node.setUseNum(dto.getUseNum()); + } else { + node.setUseNum(BigDecimal.ZERO); + } } else { node.setUseNum(BigDecimal.ZERO); } - } else { - node.setUseNum(BigDecimal.ZERO); } + List list4ParentIds = listL5.stream().map(TypeTreeNode::getParentId).collect(Collectors.toList()); + // 根据第四层parentId 查第三层类型 + listL3 = mapper.getUseTypeTreeL3(list4ParentIds); + List list3ParentIds = listL3.stream().map(TypeTreeNode::getParentId).collect(Collectors.toList()); + // 根据第三层parentId 查第1.2层类型 + listL21 = mapper.getUseTypeTreeL21(list3ParentIds); + list.addAll(listL5); + list.addAll(listL3); + list.addAll(listL21); + } + if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(list)) { + // 创建树形结构(数据集合作为参数) + TypeTreeBuild treeBuild = new TypeTreeBuild(list); + // 原查询结果转换树形结构 + groupList = treeBuild.buildTree(); } - List list4ParentIds = listL4.stream().map(TypeTreeNode::getParentId).collect(Collectors.toList()); - // 根据第四层parentId 查第三层类型 - listL3 = mapper.getUseTypeTreeL3(list4ParentIds); - List list3ParentIds = listL3.stream().map(TypeTreeNode::getParentId).collect(Collectors.toList()); - // 根据第三层parentId 查第1.2层类型 - listL21 = mapper.getUseTypeTreeL21(list3ParentIds); - list.addAll(listL4); - list.addAll(listL3); - list.addAll(listL21); - } - if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(list)) { - // 创建树形结构(数据集合作为参数) - TypeTreeBuild treeBuild = new TypeTreeBuild(list); - // 原查询结果转换树形结构 - groupList = treeBuild.buildTree(); } } catch (Exception e) { AjaxResult.error("类型树-查询失败", e); diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/codeCollection/domain/WsMaInfo.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/codeCollection/domain/WsMaInfo.java index 13204358..e6964042 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/codeCollection/domain/WsMaInfo.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/codeCollection/domain/WsMaInfo.java @@ -4,6 +4,8 @@ import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; +import java.util.List; + /** * 机具信息实体类,对应数据库表 ws_ma_info。 * 用于记录每台机具的基础信息、检修信息、检验情况等。 @@ -96,4 +98,14 @@ public class WsMaInfo { * 最后更新时间,建议格式 yyyy-MM-dd HH:mm:ss */ private String optTime; + + /** + * 编码集合 + */ + private List maCodeList; + + /** + * 二维码 + */ + private String qrCode; } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/codeCollection/mapper/WsMaInfoMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/codeCollection/mapper/WsMaInfoMapper.java index 8b59e46c..212a49f6 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/codeCollection/mapper/WsMaInfoMapper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/codeCollection/mapper/WsMaInfoMapper.java @@ -82,12 +82,10 @@ public interface WsMaInfoMapper { /** * 判断编码是否存在 - * - * @param maModel 规格 * @param maCode 编码 * @return 条数 */ - int existsByModelAndCode(@Param("maModel") String maModel, @Param("maCode") String maCode); + int existsByModelAndCode(@Param("maCode") String maCode); /** * 更新时间 diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/codeCollection/service/impl/WsMaInfoServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/codeCollection/service/impl/WsMaInfoServiceImpl.java index cef5d5e8..44df07f5 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/codeCollection/service/impl/WsMaInfoServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/codeCollection/service/impl/WsMaInfoServiceImpl.java @@ -1,5 +1,6 @@ package com.bonus.material.codeCollection.service.impl; +import com.alibaba.nacos.common.utils.CollectionUtils; import com.bonus.common.core.web.domain.AjaxResult; import com.bonus.material.codeCollection.domain.WsMaInfo; import com.bonus.material.codeCollection.mapper.WsMaInfoMapper; @@ -74,12 +75,22 @@ public class WsMaInfoServiceImpl implements WsMaInfoService { */ @Override public AjaxResult save(WsMaInfo info) { + if (CollectionUtils.isEmpty(info.getMaCodeList())) { + return AjaxResult.error("机具编码不能为空"); + } try { - int i = mapper.existsByModelAndCode(info.getMaModel(), info.getMaCode()); - if (i > 0) { - return AjaxResult.error("该机具规格与编码已存在,请勿重复添加!"); + for (String maCode : info.getMaCodeList()) { + info.setMaCode(maCode); + int i = mapper.existsByModelAndCode(info.getMaCode()); + if (i > 0) { + return AjaxResult.error(info.getMaCode() + ":该机具规格与编码已存在,请勿重复添加!"); + } + } + int result = 0; + for (String maCode : info.getMaCodeList()) { + info.setMaCode(maCode); + result = mapper.insert(info); } - int result = mapper.insert(info); return result > 0 ? AjaxResult.success("新增成功") : AjaxResult.error("新增失败"); } catch (Exception e) { log.error(e.getMessage()); @@ -100,7 +111,7 @@ public class WsMaInfoServiceImpl implements WsMaInfoService { if (info.getId() == null) { return AjaxResult.error("ID不能为空"); } - int i = mapper.existsByModelAndCode(info.getMaModel(), info.getMaCode()); + int i = mapper.existsByModelAndCode(info.getMaCode()); if (i > 1) { return AjaxResult.error("该机具规格与编码已存在,请勿重复添加!"); } @@ -142,7 +153,7 @@ public class WsMaInfoServiceImpl implements WsMaInfoService { public AjaxResult getMaTypeData() { try { List> maTypeData = mapper.getMaTypeData(); - return ObjectUtils.isNotEmpty(maTypeData) ? AjaxResult.success(maTypeData) : AjaxResult.error(""); + return ObjectUtils.isNotEmpty(maTypeData) ? AjaxResult.success(maTypeData) : AjaxResult.success(); } catch (Exception e) { log.error(e.getMessage()); return AjaxResult.error(""); 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 6388f08e..58681aea 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 @@ -193,4 +193,11 @@ public interface SelectMapper { * @return */ List getProjectInfo(BmProject bmProject); + + /** + * 获取往来单位id和标段工程id获取协议信息 + * @param dto + * @return + */ + List getAgreementInfoBy(SelectDto dto); } 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 aeb37213..f0e21180 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 @@ -154,6 +154,7 @@ public class SelectServiceImpl implements SelectService { @Override public AjaxResult getTeamList(ProAuthorizeInfo bean) { try { + // 班组固定查询,typeId为1731 return AjaxResult.success(mapper.getTeamList(bean)); } catch (Exception e) { log.error("班组-查询失败", e); @@ -455,14 +456,22 @@ public class SelectServiceImpl implements SelectService { @Override public AjaxResult getAgreementInfoById(SelectDto dto) { + List agreementIdList = new ArrayList<>(); AgreementVo vo = new AgreementVo(); try { if (dto != null && dto.getTeamId() > 0) { - dto.setUnitId(dto.getTeamId()); - } - List list = mapper.getAgreementInfoById(dto); - if (CollectionUtils.isNotEmpty(list)) { - vo = list.get(0); + List list = mapper.getAgreementInfoBy(dto); + if (CollectionUtils.isNotEmpty(list)) { + for (AgreementVo agreementVo : list) { + agreementIdList.add(agreementVo.getAgreementId()); + } + } + return AjaxResult.success(agreementIdList); + } else { + List list = mapper.getAgreementInfoById(dto); + if (CollectionUtils.isNotEmpty(list)) { + vo = list.get(0); + } } } catch (Exception e) { log.error("往来单位id和标段工程id获取协议信息", e); 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 4618da5d..0400f497 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 @@ -295,6 +295,21 @@ public class LeaseApplyInfoController extends BaseController { } } + /** + * 信息采集领料出库 + * @param leaseOutRequestVo + * @return + */ + @ApiOperation(value = "信息采集领料出库") + @PostMapping("/leaseOutByInfo") + public AjaxResult leaseOutByInfo(@NotNull(message = "领料出库信息不能为空") @RequestBody LeaseOutRequestVo leaseOutRequestVo) { + try { + return leaseApplyInfoService.leaseOutByInfo(leaseOutRequestVo); + } catch (Exception e) { + return error("系统错误, " + e.getMessage()); + } + } + /** * app领料出库退回 * @param leaseOutDetails diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/mapper/LeaseOutDetailsMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/mapper/LeaseOutDetailsMapper.java index 865a1096..b998622a 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/mapper/LeaseOutDetailsMapper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/mapper/LeaseOutDetailsMapper.java @@ -88,4 +88,18 @@ public interface LeaseOutDetailsMapper { * @return */ int deleteLeaseOutDetails(LeaseOutDetails leaseOutDetails); + + /** + * 添加领料出库明细lease_out_num + * @param record + * @return + */ + int insertLeaseOutNum(LeaseOutDetails record); + + /** + * 修改机具数据 + * @param record + * @return + */ + int updateMachine(LeaseOutDetails record); } 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 65660464..7b3963eb 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 @@ -168,4 +168,10 @@ public interface ILeaseApplyInfoService { AjaxResult useExamine(LeaseApplyInfo leaseApplyInfo); + /** + * 信息采集领料出库 + * @param leaseOutRequestVo + * @return + */ + AjaxResult leaseOutByInfo(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 97e9924f..ed2f8624 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 @@ -68,4 +68,11 @@ public interface ILeaseOutDetailsService { * @return */ AjaxResult leaseOutBack(LeaseOutDetails leaseOutDetails); + + /** + * 信息采集领料出库 + * @param bean + * @return + */ + AjaxResult leaseOutByInfo(LeaseOutDetails bean); } 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 b9d6023b..69cfb247 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 @@ -573,6 +573,21 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService { } } + /** + * 信息采集领料出库 + * @param leaseOutRequestVo + * @return + */ + @Override + public AjaxResult leaseOutByInfo(LeaseOutRequestVo leaseOutRequestVo) { + for (LeaseOutDetails bean : leaseOutRequestVo.getLeaseOutDetailsList()) { + AjaxResult ajaxResult = leaseOutDetailsService.leaseOutByInfo(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 c5ca9099..30c802dd 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 @@ -270,6 +270,86 @@ public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService { return AjaxResult.success("出库退回成功"); } + /** + * 信息采集领料出库 + * @param record + * @return + */ + @Override + public AjaxResult leaseOutByInfo(LeaseOutDetails record) { + int res = 0; + try { + if (!CollectionUtils.isEmpty(record.getMaCodeList())) { + record.setCreateBy(SecurityUtils.getLoginUser().getUserid().toString()); + record.setCreateTime(DateUtils.getNowDate()); + record.setOutNum(record.getInputNum()); + res = leaseOutDetailsMapper.insertLeaseOutDetails(record); + if (res == 0) { + return AjaxResult.error("出库失败"); + } + for (LeaseOutDetails leaseOutDetails : record.getMaCodeList()) { + // 3、插入出库记录,修改库存,修改机具状态 + leaseOutDetails.setOutNum(BigDecimal.valueOf(1)); + leaseOutDetails.setParentId(record.getParentId()); + leaseOutDetails.setPublishTask(StringUtils.isNotBlank(record.getPublishTask()) ? record.getPublishTask() : null); + leaseOutDetails.setLeaseUnit(record.getLeaseUnit()); + leaseOutDetails.setLeaseProject(record.getLeaseProject()); + res = insertRecordsByInfo(leaseOutDetails); + if (res == 0) { + throw new RuntimeException("出库失败,更新设备规格库存数量时出错!"); + } + // 4、修改任务状态(tm_task) + res = updateTaskStatus(leaseOutDetails); + if (res == 0) { + throw new RuntimeException("出库失败,修改任务状态失败"); + } + // 6、如果标准箱入库,需要将设备从标准箱移出 + if (leaseOutDetails.getMaId() != null) { + // 先查询设备是否在标准箱中 + List list = bmQrBoxMapper.selectByMaId(leaseOutDetails.getMaId()); + if (!CollectionUtils.isEmpty(list)) { + res = updateBoxBind(leaseOutDetails); + if (res == 0) { + throw new RuntimeException("出库失败,移出设备失败"); + } + } + } + } + } else { + return AjaxResult.error("机具编码不能为空"); + } + } catch (Exception e) { + log.error(e.getMessage()); + return AjaxResult.error("出库失败"); + } + return AjaxResult.success("出库成功"); + } + + /** + * 信息采集领料出库 + * @param record + * @return + */ + private int insertRecordsByInfo(LeaseOutDetails record) { + int res = 0; + // 首先更新领料任务详情表的领料数及状态(lease_apply_details) + res = leaseApplyDetailsMapper.updateLeaseApplyDetailsOutNum(record); + LeaseApplyDetails leaseApplyDetails = leaseApplyDetailsMapper.getLeaseApplyDetails(record); + if (leaseApplyDetails.getPreNum().equals(leaseApplyDetails.getAlNum()) || leaseApplyDetails.getAuditNum().equals(leaseApplyDetails.getAlNum())) { + leaseApplyDetailsMapper.updateLeaseApplyDetailsByLeaseOutRecord(record); + } + if (res > 0) { + // 插入领料出库明细表(lease_out_details) + record.setCreateBy(SecurityUtils.getLoginUser().getUserid().toString()); + if (res > 0) { + res += leaseOutDetailsMapper.insertLeaseOutNum(record); + record.setIsBack(0); + res += leaseOutDetailsMapper.updateMachine(record); + } + } + return res; + } + /** * 删除结算记录 * @param leaseOutDetails 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 e1667f62..089d73c6 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,4 +303,18 @@ public class MachineController extends BaseController { return machineService.getHisByCode(machine); } + /** + * 根据类型id获取编码 + * @param machine + * @return + */ + @ApiOperation(value = "根据类型id获取编码") + @GetMapping(value = "/getInfoByTypeId") + public AjaxResult getInfoByTypeId(Machine machine) { + try { + return AjaxResult.success(machineService.getInfoByTypeId(machine)); + } catch (Exception e) { + return error("查询失败,请联系管理员"); + } + } } 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 94e712a0..d2ee9838 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 @@ -181,4 +181,11 @@ public interface MachineMapper * @return */ MachineVo selectMaInfoByMaCode(BmQrBoxInfo info); + + /** + * 根据typeId查询机具信息 + * @param machine + * @return + */ + List getInfoByTypeId(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 2572d7c3..2d4b86b0 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 @@ -126,4 +126,11 @@ public interface IMachineService * @return */ List getInfoByMaCode(Machine machine); + + /** + * 根据类型id获取编码 + * @param machine + * @return + */ + List getInfoByTypeId(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 5ead8b13..8ff423ee 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 @@ -444,4 +444,14 @@ public class MachineServiceImpl implements IMachineService return infoByMaCode; } + /** + * 根据类型id获取编码 + * @param machine + * @return + */ + @Override + public List getInfoByTypeId(Machine machine) { + return machineMapper.getInfoByTypeId(machine); + } + } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/controller/PurchaseBindController.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/controller/PurchaseBindController.java index 59a6a43b..83915036 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/controller/PurchaseBindController.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/controller/PurchaseBindController.java @@ -55,7 +55,7 @@ public class PurchaseBindController extends BaseController { @PreventRepeatSubmit // @RequiresPermissions("purchase:bind:add") @PostMapping("/inventoryBind") - public AjaxResult inventoryBind(@RequestBody @NotNull(message = "参数不能为空") PurchaseDto dto) { + public AjaxResult inventoryBind(@RequestBody @NotNull(message = "参数不能为空") PurchaseVo dto) { return purchaseBindService.inventoryBind(dto); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/domain/vo/PurchaseVo.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/domain/vo/PurchaseVo.java index 49f17dca..08b9d88d 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/domain/vo/PurchaseVo.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/domain/vo/PurchaseVo.java @@ -120,4 +120,6 @@ public class PurchaseVo { private int isBindInventory; + private String updateBy; + } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/mapper/PurchaseBindMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/mapper/PurchaseBindMapper.java index 9e22a671..05bf9727 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/mapper/PurchaseBindMapper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/mapper/PurchaseBindMapper.java @@ -152,9 +152,9 @@ public interface PurchaseBindMapper { PurchaseVo getInventoryInfo(PurchaseDto dto); - int updateQrCodeInfo(PurchaseDto dto); + int updateQrCodeInfo(PurchaseVo dto); int insertMachineBind(PurchaseDto dto); - int selectMaCodeCount(PurchaseDto dto); + int selectMaCodeCount(PurchaseVo dto); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/service/IPurchaseBindService.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/service/IPurchaseBindService.java index 9e3832a9..2ee3d216 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/service/IPurchaseBindService.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/service/IPurchaseBindService.java @@ -57,7 +57,7 @@ public interface IPurchaseBindService { AjaxResult getTypeByQrcode(PurchaseDto dto); - AjaxResult inventoryBind(PurchaseDto dto); + AjaxResult inventoryBind(PurchaseVo dto); AjaxResult getInventoryInfo(PurchaseDto dto); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/service/impl/PurchaseBindServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/service/impl/PurchaseBindServiceImpl.java index d6a580f7..aa3993b5 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/service/impl/PurchaseBindServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/service/impl/PurchaseBindServiceImpl.java @@ -12,6 +12,8 @@ import com.bonus.common.core.utils.DateUtils; 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.codeCollection.domain.WsMaInfo; +import com.bonus.material.codeCollection.mapper.WsMaInfoMapper; import com.bonus.material.purchase.config.RemoteConfig; import com.bonus.common.biz.domain.purchase.PurchaseDto; import com.bonus.material.purchase.domain.PurchaseCheckDetails; @@ -54,6 +56,9 @@ public class PurchaseBindServiceImpl implements IPurchaseBindService { @Resource private PurchaseCheckDetailsMapper purchaseCheckDetailsMapper; + @Resource + private WsMaInfoMapper mapper; + /** * 查询所有绑定信息 @@ -142,7 +147,7 @@ public class PurchaseBindServiceImpl implements IPurchaseBindService { return AjaxResult.error(1114,"二维码已绑定物资,请勿重复绑定"); } if (CollectionUtils.isNotEmpty(tbBdDeviceRecord)) { - return AjaxResult.error(1114,"设备编码与库中重复,请勿重复添加"); + return AjaxResult.error(1114,purchaseDto.getMaCode() + ":该设备编码与库中重复,请勿重复添加"); } } // 根据taskId查询厂商 @@ -211,7 +216,7 @@ public class PurchaseBindServiceImpl implements IPurchaseBindService { */ @Override @Transactional(rollbackFor = Exception.class) - public AjaxResult inventoryBind(PurchaseDto dto) { + public AjaxResult inventoryBind(PurchaseVo dto) { if(dto.getQrCode() == null || dto.getQrCode().isEmpty()){ return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), "二维码不能为空"); } @@ -233,9 +238,16 @@ public class PurchaseBindServiceImpl implements IPurchaseBindService { return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), "修改bm_qrcode_info表失败"); } //插入ma_machine表 - int countTwo = purchaseBindMapper.insertMachineBind(dto); + WsMaInfo wsMaInfo = new WsMaInfo(); + wsMaInfo.setMaName(dto.getMaterialName()); + wsMaInfo.setMaModel(dto.getMaterialModel()); + wsMaInfo.setMaCode(dto.getMaCode()); + wsMaInfo.setSupplier(dto.getSupplierName()); + wsMaInfo.setModelId(dto.getTypeId() + ""); + wsMaInfo.setQrCode(dto.getQrCode()); + int countTwo = mapper.insert(wsMaInfo); if (countTwo == 0) { - return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), "插入ma_machine表失败"); + return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), "插入ws_ma_info表失败"); } return AjaxResult.success("绑定成功"); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/warehouse/domain/WhHouseInfo.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/warehouse/domain/WhHouseInfo.java index b8fc30be..4b698dab 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/warehouse/domain/WhHouseInfo.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/warehouse/domain/WhHouseInfo.java @@ -79,4 +79,7 @@ public class WhHouseInfo extends BaseEntity { @ApiModelProperty(value = "关键字") private String keyWord; + @ApiModelProperty(value = "类型名称") + private String typeName; + } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/warehouse/mapper/WhHouseInfoMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/warehouse/mapper/WhHouseInfoMapper.java index 3b7af9d0..4a441bd1 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/warehouse/mapper/WhHouseInfoMapper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/warehouse/mapper/WhHouseInfoMapper.java @@ -58,4 +58,11 @@ public interface WhHouseInfoMapper * @return 结果 */ int deleteWhHouseInfoByHouseIds(Long[] houseIds); + + /** + * 根据仓库id查询仓库信息 + * @param houseId + * @return + */ + List selectByHouseId(Long houseId); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/warehouse/service/impl/WhHouseInfoServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/warehouse/service/impl/WhHouseInfoServiceImpl.java index 148d3f0d..575a6bb2 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/warehouse/service/impl/WhHouseInfoServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/warehouse/service/impl/WhHouseInfoServiceImpl.java @@ -1,8 +1,11 @@ package com.bonus.material.warehouse.service.impl; import java.util.List; + +import com.alibaba.nacos.common.utils.CollectionUtils; import com.bonus.common.core.exception.ServiceException; import com.bonus.common.core.utils.DateUtils; +import com.bonus.common.core.utils.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.bonus.material.warehouse.mapper.WhHouseInfoMapper; @@ -72,6 +75,9 @@ public class WhHouseInfoServiceImpl implements IWhHouseInfoService { whHouseInfo.setUpdateTime(DateUtils.getNowDate()); try { + if (StringUtils.isNotBlank(whHouseInfo.getTypeName())) { + whHouseInfo.setHouseName(whHouseInfo.getTypeName()); + } return whHouseInfoMapper.updateWhHouseInfo(whHouseInfo); } catch (Exception e) { throw new ServiceException("数据库错误或仓库重名"); @@ -87,6 +93,12 @@ public class WhHouseInfoServiceImpl implements IWhHouseInfoService @Override public int deleteWhHouseInfoByHouseIds(Long[] houseIds) { + for (Long houseId : houseIds) { + List list = whHouseInfoMapper.selectByHouseId(houseId); + if (CollectionUtils.isNotEmpty(list)) { + throw new ServiceException("该仓库下有资产,不能删除"); + } + } return whHouseInfoMapper.deleteWhHouseInfoByHouseIds(houseIds); } 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 ce8ec755..209e4966 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 @@ -90,6 +90,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ) + + insert into clz_bm_agreement_info (agreement_code, sign_time, 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}, + #{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}, + #{updateTime,jdbcType=TIMESTAMP}, #{remark,jdbcType=VARCHAR}, #{companyId,jdbcType=INTEGER}, #{protocol,jdbcType=VARCHAR}, + #{branchProIdsStr,jdbcType=VARCHAR} + ) + + update bm_agreement_info @@ -164,4 +181,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" unit_id = #{unitId} and project_id = #{projectId} + + \ No newline at end of file diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/basic/BmQrBoxMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/basic/BmQrBoxMapper.xml index 826190bf..294641fc 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/basic/BmQrBoxMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/basic/BmQrBoxMapper.xml @@ -401,6 +401,32 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" box_code = #{boxCode} + + + + UPDATE tm_task SET task_status = 22 WHERE task_id = #{taskId} diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/clz/BmTeamMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/clz/BmTeamMapper.xml index 71832964..9557a1a9 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/clz/BmTeamMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/clz/BmTeamMapper.xml @@ -15,6 +15,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" del_flag, project_id, bzz_idcard, + type_id, #{teamName}, @@ -26,6 +27,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" 0, #{projectId}, #{idCard}, + #{typeId}, 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 b90d03d6..c1a75fab 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 @@ -226,7 +226,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" LEFT JOIN clz_back_apply_details bad on bad.parent_id = bai.id LEFT JOIN tm_task tt on tt.task_id = bai.task_id 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 + LEFT JOIN clz_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' @@ -362,7 +362,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" FROM clz_back_apply_info bai LEFT JOIN tm_task_agreement tta ON bai.task_id = tta.task_id - LEFT JOIN bm_agreement_info ba ON ba.agreement_id = tta.agreement_id + LEFT JOIN clz_bm_agreement_info ba ON ba.agreement_id = tta.agreement_id AND ba.`status` = 1 LEFT JOIN bm_unit bt ON bt.unit_id = ba.unit_id AND bt.del_flag = '0' @@ -561,7 +561,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" LEFT JOIN clz_back_apply_info bai ON bcd.parent_id = bai.id LEFT JOIN tm_task tt ON tt.task_id = bai.task_id 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 + LEFT JOIN clz_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' @@ -666,7 +666,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" AND mt2.del_flag = '0' LEFT JOIN clz_slt_agreement_info sai on lod.type_id = sai.type_id and sai.ma_id = lod.ma_id - LEFT JOIN bm_agreement_info ba ON sai.agreement_id = ba.agreement_id + LEFT JOIN clz_bm_agreement_info ba ON sai.agreement_id = ba.agreement_id WHERE sai.status = '0' AND mt.type_id = #{typeId} diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/clz/MaterialLeaseInfoMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/clz/MaterialLeaseInfoMapper.xml index a70cbcb3..7917a8a9 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/clz/MaterialLeaseInfoMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/clz/MaterialLeaseInfoMapper.xml @@ -942,7 +942,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" AND mt2.del_flag = '0' LEFT JOIN clz_slt_agreement_info sai on lod.type_id = sai.type_id and sai.ma_id = lod.ma_id - LEFT JOIN bm_agreement_info ba ON sai.agreement_id = ba.agreement_id + LEFT JOIN clz_bm_agreement_info ba ON sai.agreement_id = ba.agreement_id WHERE sai.status = '0' AND mt.type_id = #{typeId} @@ -1018,4 +1018,27 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" agreement_id = #{agreementId} AND type_id = #{typeId} + + + + \ No newline at end of file diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/clz/MaterialMachineMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/clz/MaterialMachineMapper.xml index 19d015ba..086393ad 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/clz/MaterialMachineMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/clz/MaterialMachineMapper.xml @@ -262,7 +262,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" mt.manage_type AS manageType FROM clz_slt_agreement_info sai - LEFT JOIN bm_agreement_info bai ON sai.agreement_id = bai.agreement_id + LEFT JOIN clz_bm_agreement_info bai ON sai.agreement_id = bai.agreement_id LEFT JOIN bm_unit bt ON bai.unit_id = bt.unit_id LEFT JOIN ma_type mt ON mt.type_id = sai.type_id LEFT JOIN ma_type mt2 ON mt.parent_id = mt2.type_id @@ -353,7 +353,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" LEFT JOIN clz_back_apply_info bai ON bai.id = bcd.parent_id LEFT JOIN tm_task tt ON tt.task_id = bai.task_id 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 + LEFT JOIN clz_bm_agreement_info bagi ON bagi.agreement_id = tta.agreement_id LEFT JOIN ma_type mt1 ON mt1.type_id = bcd.type_id LEFT JOIN ma_type mt2 ON mt2.type_id = mt1.parent_id WHERE bagi.unit_id = #{id} @@ -404,7 +404,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" LEFT JOIN clz_back_apply_info bai ON bai.id = bcd.parent_id LEFT JOIN tm_task tt ON tt.task_id = bai.task_id 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 + LEFT JOIN clz_bm_agreement_info bagi ON bagi.agreement_id = tta.agreement_id LEFT JOIN ma_type mt1 ON mt1.type_id = bcd.type_id LEFT JOIN ma_type mt2 ON mt2.type_id = mt1.parent_id WHERE bagi.unit_id = #{id} @@ -578,7 +578,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" on bai.id=bcd.parent_id LEFT JOIN tm_task tt on tt.task_id = bai.task_id 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 + LEFT JOIN clz_bm_agreement_info bagi on bagi.agreement_id = tta.agreement_id WHERE bagi.unit_id = #{teamId} and bcd.is_finished='1' @@ -693,7 +693,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" LEFT JOIN ma_type mt ON mt.type_id = sai.type_id LEFT JOIN ma_type mt2 ON mt.parent_id = mt2.type_id LEFT JOIN ma_machine mm ON mm.ma_id = sai.ma_id - LEFT JOIN bm_agreement_info bai ON bai.agreement_id = sai.agreement_id + LEFT JOIN clz_bm_agreement_info bai ON bai.agreement_id = sai.agreement_id LEFT JOIN bm_unit bt ON bai.unit_id = bt.unit_id LEFT JOIN clz_lease_apply_info lai ON lai.id = sai.lease_id WHERE diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/codeCollection/WsMaInfoMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/codeCollection/WsMaInfoMapper.xml index 79ce5012..c77c707e 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/codeCollection/WsMaInfoMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/codeCollection/WsMaInfoMapper.xml @@ -71,8 +71,8 @@ - select bzgl_bz.id, - bzgl_bz.bzmc as name, - bzgl_bz.bzz_name as teamLeaderName, - bzgl_bz.bzz_idcard as teamLeaderIdCard, - bzgl_bz.bz as remark, - bzgl_bz.bz_status as teamStatus, - bzgl_bz.project_id as projectId, - bzgl_bz.project_name as projectName - from `micro-tool`.bzgl_bz bzgl_bz + SELECT + unit_id as id, + unit_name AS name + FROM + bm_unit + WHERE + type_id = 1731 - + + + 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 83904a25..7b06e908 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 @@ -377,7 +377,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" mt1.type_name as maTypeName, mt.type_name as typeName, mm.ma_code as maCode, - lod.create_by as createBy, + su.nick_name as createBy, lod.create_time as createTime, lod.ma_id as maId FROM @@ -388,7 +388,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" AND mt1.del_flag = '0' LEFT JOIN lease_apply_info lai ON lod.parent_id = lai.id LEFT JOIN ma_machine mm ON lod.ma_id = mm.ma_id - where lai.task_id = #{taskId} and lod.type_id = #{typeId} + LEFT JOIN sys_user su ON lod.create_by = su.user_id + where lai.task_id = #{taskId} and lod.type_id = #{typeId} ORDER BY lod.create_time DESC diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/lease/LeaseOutDetailsMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/lease/LeaseOutDetailsMapper.xml index e9460dbc..7ede2628 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/lease/LeaseOutDetailsMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/lease/LeaseOutDetailsMapper.xml @@ -151,6 +151,83 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" NOW() + + insert into lease_out_num + + + parent_id, + + + type_id, + + + ma_id, + + + out_num, + + + out_type, + + + create_by, + + + update_by, + + + remark, + + + company_id, + + + car_code, + + + publish_task, + + create_time, + update_time + + + + #{parentId}, + + + #{typeId}, + + + #{maId}, + + + #{outNum}, + + + #{outType}, + + + #{createBy}, + + + #{updateBy}, + + + #{remark}, + + + #{companyId}, + + + #{carCode}, + + + #{publishTask}, + + NOW(), + NOW() + + update lease_out_details @@ -172,6 +249,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where id = #{id} + + update ws_ma_info + + + lease_unit = #{leaseUnit}, + + + lease_project = #{leaseProject}, + + + is_back = #{isBack}, + + out_time = now() + + where id = #{maId} + + delete from lease_out_details where id = #{id} 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 ecdc8e54..80320503 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 @@ -740,9 +740,35 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" check_man as checkMan, model_id as typeId, result as inspectStatus, - phone as phone + phone as phone, + id as maId FROM ws_ma_info where ma_code = #{maCode} + + 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 c5754b99..0120c985 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 @@ -163,4 +163,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and agreement_id = #{agreementId} + + \ No newline at end of file diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/warehouse/WhHouseInfoMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/warehouse/WhHouseInfoMapper.xml index 9acdadb7..c1561973 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/warehouse/WhHouseInfoMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/warehouse/WhHouseInfoMapper.xml @@ -53,7 +53,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where house_id = #{houseId} - + + + insert into wh_house_info @@ -116,7 +128,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - delete from wh_house_info where house_id in + update wh_house_info + set del_flag = '2' + where house_id in #{houseId}