diff --git a/bonus-common-biz/src/main/java/com/bonus/common/biz/domain/TreeNode.java b/bonus-common-biz/src/main/java/com/bonus/common/biz/domain/TreeNode.java index 6f6e0170..1bf8218a 100644 --- a/bonus-common-biz/src/main/java/com/bonus/common/biz/domain/TreeNode.java +++ b/bonus-common-biz/src/main/java/com/bonus/common/biz/domain/TreeNode.java @@ -40,8 +40,13 @@ public class TreeNode { @ApiModelProperty(value = "实时库存") private Long storageNum; + private Long num; + private String remark; + @ApiModelProperty(value = "类型") + private String manageType; + @JsonInclude(JsonInclude.Include.NON_EMPTY) private List children = new ArrayList<>(); } diff --git a/bonus-common-biz/src/main/java/com/bonus/common/biz/domain/lease/LeaseApplyInfo.java b/bonus-common-biz/src/main/java/com/bonus/common/biz/domain/lease/LeaseApplyInfo.java index 56bb4bd2..77991d14 100644 --- a/bonus-common-biz/src/main/java/com/bonus/common/biz/domain/lease/LeaseApplyInfo.java +++ b/bonus-common-biz/src/main/java/com/bonus/common/biz/domain/lease/LeaseApplyInfo.java @@ -347,5 +347,9 @@ public class LeaseApplyInfo extends BaseEntity{ */ private List projectIdList; + private Long parentId; + @ApiModelProperty(value = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + private String leaseTime; } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/controller/BackApplyInfoController.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/controller/BackApplyInfoController.java index eaf488f6..9623dfd5 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/controller/BackApplyInfoController.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/controller/BackApplyInfoController.java @@ -120,6 +120,8 @@ public class BackApplyInfoController extends BaseController { if (!result.isSuccess()) { return AjaxResult.error("SysFile文件服务上传失败:" + result.get("msg")); } + //电子档案工程同步,第一次执行时间较长 + syncProject(); @SuppressWarnings("unchecked") Map jsonObject = (Map) result.get("data"); @@ -559,6 +561,7 @@ public class BackApplyInfoController extends BaseController { } catch (Exception e) { return AjaxResult.success(ListPagingUtil.paging(pageIndex, pageSize, new ArrayList<>())); } + } /** @@ -573,4 +576,27 @@ public class BackApplyInfoController extends BaseController { } /** -------出门证结束------- */ + + + /** + * 电子档案工程同步 + */ + public void syncProject() { + //1、查询未同步的工程信息 + List list = backApplyInfoService.selectNotSyncProject(); + if (list.size()>0){ + for (BackApplyInfo backApplyInfo : list){ + //2、将所有工程信息插入archives_record_info,并返回id + backApplyInfoService.syncProject(backApplyInfo); + if (backApplyInfo.getId()!=null){ + //3、将返回的每个id插入archives_record_details + backApplyInfoService.syncProjectDetails(backApplyInfo); + } + } + } + + + + } + } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/mapper/BackApplyInfoMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/mapper/BackApplyInfoMapper.java index 21ce84d0..c2da6189 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/mapper/BackApplyInfoMapper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/mapper/BackApplyInfoMapper.java @@ -507,4 +507,10 @@ public interface BackApplyInfoMapper { * @return */ int delHandlingOrder(HandlingOrder bean); + + List selectNotSyncProject(); + + int syncProject(BackApplyInfo backApplyInfo); + + int syncProjectDetails(BackApplyInfo backApplyInfo2); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/service/IBackApplyInfoService.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/service/IBackApplyInfoService.java index 0b0467b5..bb6fabf6 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/service/IBackApplyInfoService.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/service/IBackApplyInfoService.java @@ -242,5 +242,12 @@ public interface IBackApplyInfoService { * @return */ AjaxResult delHandlingOrder(HandlingOrder bean); + + + List selectNotSyncProject(); + + int syncProject(BackApplyInfo backApplyInfo); + + int syncProjectDetails(BackApplyInfo backApplyInfo); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/service/impl/BackApplyInfoServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/service/impl/BackApplyInfoServiceImpl.java index 8c3aea8d..0b85ef5f 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/service/impl/BackApplyInfoServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/service/impl/BackApplyInfoServiceImpl.java @@ -2294,6 +2294,29 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService { } } + @Override + public List selectNotSyncProject() { + return backApplyInfoMapper.selectNotSyncProject(); + } + + @Override + public int syncProject(BackApplyInfo backApplyInfo) { + return backApplyInfoMapper.syncProject(backApplyInfo); + } + + @Override + public int syncProjectDetails(BackApplyInfo backApplyInfo) { + BackApplyInfo backApplyInfo2 = new BackApplyInfo(); + backApplyInfo2.setId(backApplyInfo.getId()); + backApplyInfo2.setTypeName("领料单"); + backApplyInfoMapper.syncProjectDetails(backApplyInfo2); + backApplyInfo2.setTypeName("退料单"); + backApplyInfoMapper.syncProjectDetails(backApplyInfo2); + backApplyInfo2.setTypeName("业务联系单"); + backApplyInfoMapper.syncProjectDetails(backApplyInfo2); + return 1; + } + /** * 处理班组退料结算协议 * @param record diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/common/controller/SelectController.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/common/controller/SelectController.java index 45f6de00..ada88817 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/common/controller/SelectController.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/common/controller/SelectController.java @@ -151,6 +151,13 @@ public class SelectController { return service.getDeviceTypeTree(dto); } + @ApiOperation(value = "设备类型树") + @PostMapping("getDeviceTypeTreeTwo") + public AjaxResult getDeviceTypeTreeTwo(@RequestBody SelectDto dto){ + return service.getDeviceTypeTreeTwo(dto); + } + + @ApiOperation(value = "退料设备类型树") @PostMapping("getBackDeviceTypeTree") public AjaxResult getBackDeviceTypeTree(@RequestBody SelectDto dto){ 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 852ffde7..748d9e8c 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 @@ -299,4 +299,6 @@ public interface SelectMapper { * @return */ List getBzUseTypeTreeL4(BackApplyInfo bean); + + List getDeviceTypeTreeTwo(SelectDto dto); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/common/service/SelectService.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/common/service/SelectService.java index 0153ca24..acd8f3ed 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/common/service/SelectService.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/common/service/SelectService.java @@ -103,6 +103,8 @@ public interface SelectService { */ AjaxResult getDeviceTypeTree(SelectDto dto); + AjaxResult getDeviceTypeTreeTwo(SelectDto dto); + AjaxResult getBackDeviceTypeTree(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 53486a8a..f69f555f 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 @@ -433,6 +433,24 @@ public class SelectServiceImpl implements SelectService { return AjaxResult.success(groupList); } + @Override + public AjaxResult getDeviceTypeTreeTwo(SelectDto dto) { + List groupList = new ArrayList<>(); + List list = new ArrayList<>(); + try { + list = mapper.getDeviceTypeTreeTwo(dto); + if (CollectionUtils.isNotEmpty(list)) { + // 创建树形结构(数据集合作为参数) + TreeBuild treeBuild = new TreeBuild(list); + // 原查询结果转换树形结构 + groupList = treeBuild.buildTree(); + } + } catch (Exception e) { + log.error("单位树/归属部门/所属上级-查询失败", e); + } + return AjaxResult.success(groupList); + } + @Override public AjaxResult getBackDeviceTypeTree(SelectDto dto) { List groupList = new ArrayList<>(); 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 e85b3276..eea67988 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 @@ -172,11 +172,7 @@ public class MachineController extends BaseController { @ApiOperation(value = "电子标签查询") @GetMapping("/getElectronicLabel") public AjaxResult getElectronicLabel(Machine machine) { - try { - return success(machineService.getElectronicLabel(machine)); - } catch (Exception e) { - return error("系统错误, " + e.getMessage()); - } + return machineService.getElectronicLabel(machine); } /** diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/WarehousingController.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/WarehousingController.java new file mode 100644 index 00000000..2a614664 --- /dev/null +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/WarehousingController.java @@ -0,0 +1,79 @@ +package com.bonus.material.ma.controller; + +import com.bonus.common.core.web.controller.BaseController; +import com.bonus.common.core.web.domain.AjaxResult; +import com.bonus.common.core.web.page.TableDataInfo; +import com.bonus.material.common.annotation.PreventRepeatSubmit; +import com.bonus.material.ma.domain.PutInStorageBean; +import com.bonus.material.ma.domain.SavePutInfoDto; +import com.bonus.material.ma.domain.SupplierInfo; +import com.bonus.material.ma.service.WarehousingService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.java.Log; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +/** +* @description 入库盘点 +*/ +@Api(tags = " 入库盘点") +@RestController +@RequestMapping("/warehousing") +@Slf4j +public class WarehousingController extends BaseController { + @Autowired + private WarehousingService warehousingService; + + /** + * 查询入库盘点列表 + */ + @ApiOperation(value = "获取入库盘点列表") + @GetMapping("/getList") + public TableDataInfo getList(PutInStorageBean bean) { + startPage(); + List list = warehousingService.getList(bean); + return getDataTable(list); + } + + /** + * 查询供应商管理列表 + */ + @ApiOperation(value = "查询供应商管理列表") + @GetMapping("/supplierInfoList") + public TableDataInfo supplierInfoList(SupplierInfo maSupplierInfo) + { + List list = warehousingService.selectMaSupplierInfoList(maSupplierInfo); + return getDataTable(list); + } + + /** + * 新增入库盘点 + * @param dto + * @return + */ + @ApiOperation(value = "新增入库盘点") + @PreventRepeatSubmit + @PostMapping("/addList") + public AjaxResult savePutInfo(@RequestBody SavePutInfoDto dto) { + return warehousingService.savePutInfo(dto); + } + + + /** + * 根据入库单号查看详情 + * @param bean + * @return + */ + @ApiOperation(value = "根据入库单号查看详情") + @GetMapping("/getDetail") + public TableDataInfo getDetail(PutInStorageBean bean) { + startPage(); + List list = warehousingService.getDetails(bean); + return getDataTable(list); + } + +} diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/domain/MachIneDto.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/domain/MachIneDto.java new file mode 100644 index 00000000..27a82ccd --- /dev/null +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/domain/MachIneDto.java @@ -0,0 +1,158 @@ +package com.bonus.material.ma.domain; + +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.springframework.format.annotation.DateTimeFormat; + +import java.math.BigDecimal; +import java.util.Date; + +/** + * 表单类型表单集合 + * @Author ma_sh + * @create 2024/3/28 17:53 + */ +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +@ApiModel("表单类型表单集合") +public class MachIneDto { + + /** + * 判断为数量还是编号,true为编号 + */ + @ApiModelProperty(value = "判断为数量还是编号,true为编号") + private Boolean isCode; + + /** + * 主键id + */ + @ApiModelProperty(value = "主键id") + private Integer id; + + /** 机具ID */ + @ApiModelProperty(value = "机具ID") + private Long maId; + + /** + * 主键id + */ + @ApiModelProperty(value = "主键id") + private Integer infoId; + + /** 设备编号 */ + @ApiModelProperty(value = "设备编号") + private String maCode; + + /** 二维码 */ + @ApiModelProperty(value = "二维码") + private String qrCode; + + + /** + * 类型id + */ + @ApiModelProperty(value = "类型id") + private String typeId; + + /** + * 主信息 + */ + @ApiModelProperty(value = "主信息") + private Integer info; + + /** 出厂编码 */ + @ApiModelProperty(value = "出厂编码") + private String outFacCode; + + /** 生产厂家 */ + @ApiModelProperty(value = "生产厂家") + private String maVender; + + /** 本次检修日期 */ + @ApiModelProperty(value = "本次检修日期") + @DateTimeFormat(pattern = "yyyy-MM-dd") + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + private Date thisCheckTime; + + /** 下次检修日期 */ + @ApiModelProperty(value = "下次检修日期") + @DateTimeFormat(pattern = "yyyy-MM-dd") + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + private Date nextCheckTime; + + /** 单价 */ + @ApiModelProperty(value = "单价") + private BigDecimal buyPrice; + + /** 编码 */ + @ApiModelProperty(value = "编码") + private String code; + + /** + * 创建者 + */ + @ApiModelProperty(value = "创建者") + private Long creator; + + /** + * 入库形式 + */ + @ApiModelProperty(value = "入库形式") + private String putInType; + + /** + * 备注 + */ + @ApiModelProperty(value = "备注") + private String remarks; + + /** + * 单位名称 + */ + @ApiModelProperty(value = "单位名称") + private String unitId; + + /** + * 工程名称 + */ + @ApiModelProperty(value = "工程名称") + private String proId; + + /** + * 表单备注 + */ + @ApiModelProperty(value = "表单备注") + private String remark; + + /** + * 数量 + */ + @ApiModelProperty(value = "上方页面入库数量") + private Integer num; + + /** + * 数量 + */ + @ApiModelProperty(value = "数量") + private Integer totalNum; + + /** + * 检验人 + */ + @ApiModelProperty(value = "检验人") + private String checkMan; + + /** + * 入库数量 + */ + @ApiModelProperty(value = "表单集合入库数量") + private Integer putInStoreNum; + +} 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 26f37947..88ca091d 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 @@ -329,4 +329,6 @@ public class Machine extends BaseEntity { private int devType; private String type; + + private Integer manageType; } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/domain/PutInStorageBean.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/domain/PutInStorageBean.java new file mode 100644 index 00000000..ef15dd91 --- /dev/null +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/domain/PutInStorageBean.java @@ -0,0 +1,101 @@ +package com.bonus.material.ma.domain; + +import com.bonus.common.core.web.domain.BaseEntity; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.math.BigDecimal; + +/** +* @description 入库盘点 +*/ +@Data +public class PutInStorageBean extends BaseEntity { + private static final long serialVersionUID = 1L; + + /** id */ + @ApiModelProperty(value = "id") + private Integer id; + + /** 入库形式 */ + @ApiModelProperty(value = "入库形式") + private String putInType; + + /** 关键字 */ + @ApiModelProperty(value = "关键字") + private String keyWord; + + /** 入库数量 */ + @ApiModelProperty(value = "入库数量") + private BigDecimal num; + + /** 创建者 */ + @ApiModelProperty(value = "创建者") + private Integer creator; + + /** 入库人 */ + @ApiModelProperty(value = "入库人") + private String modelName; + + /** 盘点入库单号 */ + @ApiModelProperty(value = "盘点入库单号") + private String kindName; + + /** 设备编号 */ + @ApiModelProperty(value = "设备编号") + private String maCode; + + /** 单位ID */ + @ApiModelProperty(value = "单位ID") + private String unitId; + + /** 单位名称 */ + @ApiModelProperty(value = "单位名称") + private String unitName; + + /** 工程ID */ + @ApiModelProperty(value = "工程ID") + private String projectId; + + /** 工程名称 */ + @ApiModelProperty(value = "工程名称") + private String projectName; + + /** 创建日期 */ + @ApiModelProperty(value = "创建日期") + private String createDate; + + /** 备注 */ + @ApiModelProperty(value = "备注") + private String remark; + + + /** 主信息 */ + @ApiModelProperty(value = "主信息") + private Integer info; + + /** 库房 */ + @ApiModelProperty(value = "库房") + private Integer ram; + + /** 设备工器具类型 */ + @ApiModelProperty(value = "设备工器具类型") + private Integer type; + + /** 设备工器具类型名称 */ + @ApiModelProperty(value = "设备工器具类型名称") + private String typeName; + + /** 规格型号 */ + @ApiModelProperty(value = "规格型号") + private String typeModelName; + + /** 设备主键 */ + @ApiModelProperty(value = "设备主键") + private Integer machine; + + + private String code; + + private Integer infoId; +} diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/domain/SavePutInfoDto.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/domain/SavePutInfoDto.java new file mode 100644 index 00000000..d5e59844 --- /dev/null +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/domain/SavePutInfoDto.java @@ -0,0 +1,124 @@ +package com.bonus.material.ma.domain; + +import com.bonus.common.core.web.domain.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.List; + +/** + * 新增盘点入库接口实体类dto + * @Author ma_sh + * @create 2024/3/28 14:22 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +@ApiModel("新增盘点入库接口实体类dto") +public class SavePutInfoDto extends BaseEntity { + + /** + * 判断为数量还是编号,true为编号 + */ + @ApiModelProperty(value = "判断为数量还是编号,true为编号") + private Boolean isCode; + + /** + * 主键id + */ + @ApiModelProperty(value = "主键id") + private Integer id; + + /** + * 类型id + */ + @ApiModelProperty(value = "类型id") + private String typeId; + + /** + * 主信息 + */ + @ApiModelProperty(value = "主信息") + private Integer info; + + /** + * 数量 + */ + @ApiModelProperty(value = "数量") + private Integer num; + + /** + * 库房 + */ + @ApiModelProperty(value = "库房") + private Integer ram; + + /** + * 设备工器具类型 + */ + @ApiModelProperty(value = "设备工器具类型") + private Integer type; + + /** + * 设备主键 + */ + @ApiModelProperty(value = "设备主键") + private Integer machine; + + /** + * 入库形式 + */ + @ApiModelProperty(value = "入库形式") + private String putInType; + + /** + * 盘点入库单号 + */ + @ApiModelProperty(value = "盘点入库单号") + private String code; + + /** + * 单位名称 + */ + @ApiModelProperty(value = "单位名称") + private String unitId; + + /** + * 工程名称 + */ + @ApiModelProperty(value = "工程名称") + private String proId; + + /** + * 创建者 + */ + @ApiModelProperty(value = "创建者") + private Long creator; + + /** + * 创建时间 + */ + @ApiModelProperty(value = "创建时间") + private String createDate; + + /** + * 备注 + */ + @ApiModelProperty(value = "备注") + private String remarks; + + /** + * 检验人 + */ + @ApiModelProperty(value = "检验人") + private String checkMan; + + /** + * 表单类型表单集合 + */ + private List machIneDtoList; + +} diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/domain/vo/ExceptionEnum.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/domain/vo/ExceptionEnum.java new file mode 100644 index 00000000..fa67acd6 --- /dev/null +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/domain/vo/ExceptionEnum.java @@ -0,0 +1,39 @@ +package com.bonus.material.ma.domain.vo; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * 返回异常枚举类 + * @Author ma_sh + * @create 2024/3/29 14:43 + */ +@Getter +@AllArgsConstructor +public enum ExceptionEnum { + + PARAM_NULL(1001, "参数为空"), + IOT_CODE_DUPLICATE(1002, "设备编号重复"), + IOT_TO_DELETE(1003, "该iot设备绑定相关类型设备,无法删除"), + SUCCESS(200, "操作成功"), + SAVE_TO_DATABASE(500, "新增保存失败,请联系管理员!!!"), + DELETE_TO_DATABASE(500, "删除失败,请联系管理员!!!"), + BIND_TO_DATABASE(500, "绑定失败,请联系管理员!!!"), + UN_BIND_TO_DATABASE(500, "解绑失败,请联系管理员!!!"), + UPDATE_TO_DATABASE(500, "修改失败,请联系管理员!!!"), + + RETURN_DATA_IS_EMPTY(501, "返回数据为空!!"), + IOT_ENCODING_ERROR(502, "输入的IOT编码有误,请输入正确的编码!!!"); + + private Integer code; + + private String msg; + + public Integer getCode() { + return code; + } + + public String getMsg() { + return msg; + } +} diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/domain/vo/FieldGenerator.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/domain/vo/FieldGenerator.java new file mode 100644 index 00000000..9d7958aa --- /dev/null +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/domain/vo/FieldGenerator.java @@ -0,0 +1,23 @@ +package com.bonus.material.ma.domain.vo; + +import java.time.LocalDate; +import java.time.format.DateTimeFormatter; +import java.util.UUID; + +/** + * 后端生产随机编码通用方法(格式:今日年月日日期-随机4位编码 20240328-0001) + * @Author ma_sh + * @create 2024/3/28 17:42 + */ +public class FieldGenerator { + + public static String generateField() { + LocalDate today = LocalDate.now(); + String currentDate = today.format(DateTimeFormatter.ofPattern("yyyyMMdd")); + // 生成UUID并取后4位,转换为纯数字类型 + String uuid = UUID.randomUUID().toString().replaceAll("-", ""); + String uuidLast4Digits = uuid.substring(uuid.length() - 7); + int uuidLast4DigitsNumeric = Integer.parseInt(uuidLast4Digits, 16); + return currentDate + "-" + String.format("%07d", uuidLast4DigitsNumeric % 10000); + } +} diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/domain/vo/GlobalContants.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/domain/vo/GlobalContants.java new file mode 100644 index 00000000..d9040ae8 --- /dev/null +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/domain/vo/GlobalContants.java @@ -0,0 +1,15 @@ +package com.bonus.material.ma.domain.vo; + +/** + * @Author:梁超 + * @date:2024/1/30 - 14:09 + */ +public class GlobalContants { + public static final int NUM1 = 9; + public static final int NUM2 = 100; + public static final int NUM3 = 99; + public static final int NUM4 = 1000; + + public static final int NUM5 = 68; + public static final int NUM6 = 24; +} 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 318cc80e..ff358075 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 @@ -204,4 +204,12 @@ public interface MachineMapper List getElectronicLabelByWsMaInfo(Machine machine); List getHisByCodeNewByWsMaInfo(Machine machine); + + LeaseApplyInfo getLeaseParentId(Machine machine); + + LeaseApplyInfo getLeaseUnitAndProject(LeaseApplyInfo leaseInfo); + + LeaseApplyInfo getBackParentId(Machine machine); + + LeaseApplyInfo getBackUnitAndProject(LeaseApplyInfo leaseInfoBack); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/mapper/WarehousingMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/mapper/WarehousingMapper.java new file mode 100644 index 00000000..4f7c0bc0 --- /dev/null +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/mapper/WarehousingMapper.java @@ -0,0 +1,71 @@ +package com.bonus.material.ma.mapper; + + +import com.bonus.material.ma.domain.MachIneDto; +import com.bonus.material.ma.domain.PutInStorageBean; +import com.bonus.material.ma.domain.SupplierInfo; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.Date; +import java.util.List; + +/** +* @description 入库盘点 +* @author hay +* @date 2024/3/27 13:33 +*/ +@Mapper +public interface WarehousingMapper { + + /** + * 查询入库盘点列表 + * @param bean + * @return 结果 + */ + List getList(PutInStorageBean bean); + + + List selectMaSupplierInfoList(SupplierInfo maSupplierInfo); + + + int selectByMaCode(String maCode); + + /** + * 插入ma_type_put_in_storage_info表 + * @param machIneDto + * @return + */ + int saveInfo(MachIneDto machIneDto); + + /** + * 新增ma_machine表 + * @param machIneDto + * @return + */ + int insertMachine(MachIneDto machIneDto); + + /** + * 新增ma_type_put_in_storage_details表 + * @param machIneDto + * @return + */ + Integer saveDetails(MachIneDto machIneDto); + + /** + * 查询 + * @param nowDate + * @return + */ + int selectTaskNumByMonth(@Param("date") Date nowDate); + + /** + * 更新matype表中num数量 + * @param typeId + * @param num + * @return + */ + int updateMaType(@Param("typeId") String typeId, @Param("num") Integer num); + + List getDetails(PutInStorageBean bean); +} 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 224c7494..67098632 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 @@ -84,7 +84,7 @@ public interface IMachineService * @param machine * @return */ - List getElectronicLabel(Machine machine); + AjaxResult getElectronicLabel(Machine machine); /** * 根据标签信息查询出库单 diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/WarehousingService.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/WarehousingService.java new file mode 100644 index 00000000..f3585a00 --- /dev/null +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/WarehousingService.java @@ -0,0 +1,43 @@ +package com.bonus.material.ma.service; + + + + +import com.bonus.common.core.web.domain.AjaxResult; +import com.bonus.material.ma.domain.PutInStorageBean; +import com.bonus.material.ma.domain.SavePutInfoDto; +import com.bonus.material.ma.domain.SupplierInfo; + +import java.util.List; + +/** +* @description 入库盘点 +* @author hay +* @date 2024/3/27 13:31 +*/ +public interface WarehousingService { + + /** + * 查询入库盘点列表 + * @param bean + * @return 结果 + */ + List getList(PutInStorageBean bean); + + List selectMaSupplierInfoList(SupplierInfo maSupplierInfo); + + /** + * 新增入库盘点 + * @param dto + * @return + */ + AjaxResult savePutInfo(SavePutInfoDto dto); + + + /** + * 根据入库单号查看详情 + * @param bean + * @return + */ + List getDetails(PutInStorageBean bean); +} 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 0f05747b..546665eb 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 @@ -1,6 +1,8 @@ package com.bonus.material.ma.service.impl; +import java.time.ZoneId; import java.util.ArrayList; +import java.util.Date; import java.util.List; import java.util.Map; @@ -207,8 +209,9 @@ public class MachineServiceImpl implements IMachineService * @return */ @Override - public List getElectronicLabel(Machine machine) { + public AjaxResult getElectronicLabel(Machine machine) { List list = new ArrayList<>(); + int type = 0; try { if (machine.getDevType()==1){ //查询ws_ma_info,工器具 @@ -217,6 +220,18 @@ public class MachineServiceImpl implements IMachineService //查询ma_machine表,安全工器具 list = machineMapper.getElectronicLabel(machine); } + for (Machine dto : list){ + Date nextCheckTime = dto.getNextCheckTime(); + Date todayStart = new Date(); // 获取当前时间 + // 将 todayStart 设置为当天的开始时间(00:00:00) + todayStart = Date.from(todayStart.toInstant().atZone(ZoneId.systemDefault()) + .withHour(0).withMinute(0).withSecond(0).withNano(0) + .toInstant()); + if (nextCheckTime != null && nextCheckTime.before(todayStart)) { + type=1; + throw new RuntimeException("该工器具已临近下次检验时间,请及时退还至机具(物流)分公司!"); + } + } if (CollectionUtils.isNotEmpty(list)) { for (Machine dto : list) { @@ -237,9 +252,13 @@ public class MachineServiceImpl implements IMachineService } } } - return list; + return AjaxResult.success(list); } catch (Exception e){ - return new ArrayList<>(); + if (type==1){ + return AjaxResult.error("该工器具已临近下次检验时间,请及时退还至机具(物流)分公司!"); + } else { + return AjaxResult.success(new ArrayList<>()); + } } } @@ -338,8 +357,36 @@ public class MachineServiceImpl implements IMachineService Machine checkNum = machineMapper.getCheckNumByQrcode(machine); //报废时间 Machine scrapTime = machineMapper.getScrapTimeByQrcode(machine); - //3根据机具id查询领退工程 - Machine leaseInfo = machineMapper.getLeaseInfoByQrcode(machine); +// //3根据机具id查询领退工程 +// Machine leaseInfo = machineMapper.getLeaseInfoByQrcode(machine); + + // 根据maid查询领料任务 + LeaseApplyInfo leaseInfo = machineMapper.getLeaseParentId(machine); + if (leaseInfo.getParentId() == null){ + baseInfo.setLeaseTime(null); + baseInfo.setLeaseUnit(null); + baseInfo.setLeaseProject(null); + }else{ + LeaseApplyInfo leaseDetail = machineMapper.getLeaseUnitAndProject(leaseInfo); + baseInfo.setLeaseTime(String.valueOf(leaseDetail.getLeaseTime())); + baseInfo.setLeaseUnit(leaseDetail.getUnitName()); + baseInfo.setLeaseProject(leaseDetail.getProjectName()); + } + + // 根据maid查询退料任务 + LeaseApplyInfo leaseInfoBack = machineMapper.getBackParentId(machine); + if (leaseInfoBack.getParentId() == null){ + baseInfo.setBackTime(null); + baseInfo.setBackUnit(null); + baseInfo.setBackProject(null); + }else{ + LeaseApplyInfo leaseDetailBack = machineMapper.getBackUnitAndProject(leaseInfoBack); + baseInfo.setBackTime(String.valueOf(leaseDetailBack.getLeaseTime())); + baseInfo.setBackUnit(leaseDetailBack.getUnitName()); + baseInfo.setBackProject(leaseDetailBack.getProjectName()); + } + + if (inTime != null){ Integer taskId = inTime.getTaskId(); if(taskId != null){ @@ -368,14 +415,6 @@ public class MachineServiceImpl implements IMachineService 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()); - } return success(baseInfo); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/WarehousingServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/WarehousingServiceImpl.java new file mode 100644 index 00000000..4afde39d --- /dev/null +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/WarehousingServiceImpl.java @@ -0,0 +1,284 @@ +package com.bonus.material.ma.service.impl; + + +import com.bonus.common.core.exception.ServiceException; +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.ma.domain.MachIneDto; +import com.bonus.material.ma.domain.PutInStorageBean; +import com.bonus.material.ma.domain.SavePutInfoDto; +import com.bonus.material.ma.domain.SupplierInfo; +import com.bonus.material.ma.domain.vo.ExceptionEnum; +import com.bonus.material.ma.domain.vo.FieldGenerator; +import com.bonus.material.ma.domain.vo.GlobalContants; +import com.bonus.material.ma.mapper.WarehousingMapper; +import com.bonus.material.ma.service.WarehousingService; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.transaction.interceptor.TransactionAspectSupport; + +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.stream.Collectors; + +/** + * @author hay + * @description 入库盘点 + * @date 2024/3/27 13:32 + */ +@Service +@Slf4j +public class WarehousingServiceImpl implements WarehousingService { + + @Autowired + private WarehousingMapper warehousingMapper; + +// @Autowired +// private PurchaseInputMapper purchaseInputMapper; + + /** + * 查询入库盘点列表 + * @param bean + * @return + */ + @Override + public List getList(PutInStorageBean bean) { + return warehousingMapper.getList(bean); + } + + @Override + public List selectMaSupplierInfoList(SupplierInfo maSupplierInfo) + { + return warehousingMapper.selectMaSupplierInfoList(maSupplierInfo); + } + + /** + * 生成code编码 + * @return + */ + public String genderBackCode() { + log.info("enter method genderBackCode"); + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd"); + Date nowDate = DateUtils.getNowDate(); + String format = dateFormat.format(nowDate); + int taskNum = warehousingMapper.selectTaskNumByMonth(nowDate) + 1; + String code = ""; + if (taskNum > GlobalContants.NUM1 && taskNum < GlobalContants.NUM2) { + code = "PD" + format + "-00" + taskNum; + } else if (taskNum > GlobalContants.NUM3 && taskNum < GlobalContants.NUM4) { + code = "PD" + format + "-0" + taskNum; + } else { + code = "PD" + format + "-000" + taskNum; + } + log.info("end method genderBackCode" + code); + return code; + } + + /** + * 新增入库盘点 + * @param dto + * @return + */ + @Override + @Transactional(rollbackFor = Exception.class) + public AjaxResult savePutInfo(SavePutInfoDto dto) { + log.info("新增入库盘点入参dto:{}", dto); + Long userId = SecurityUtils.getLoginUser().getUserid(); + dto.setCreator(userId); + String code = genderBackCode(); + List machIneDtoList = dto.getMachIneDtoList(); + //判断提交表单中是否存在相同编码 + for (int i = 0; i < machIneDtoList.size() - 1; i++) { + for (int j = i + 1; j < machIneDtoList.size(); j++) { + if (StringUtils.isNotEmpty(machIneDtoList.get(i).getMaCode()) && StringUtils.isNotEmpty(machIneDtoList.get(j).getMaCode()) + && machIneDtoList.get(i).getMaCode().equals(machIneDtoList.get(j).getMaCode())) { + throw new ServiceException("列表中包含以下相同的设备编码,请修改后重新提交:" + machIneDtoList.get(i).getMaCode()); + } + } + } + //判断提交中设备编码是否与库中相同 + if (CollectionUtils.isNotEmpty(machIneDtoList)) { + for (MachIneDto machIneDto : machIneDtoList) { + if (StringUtils.isNotBlank(machIneDto.getMaCode())) { + int count = selectByMaCode(machIneDto.getMaCode()); + if (count != 0) { + throw new ServiceException("以下设备编码与库中数据存在重复,请修改后重新提交:" + machIneDto.getMaCode()); + } + } + } + } + int res; + try { + //1. 判断是数量还是编号入库,保存到不同表 + //1.1 如果是编号入库 + if (dto.getIsCode()) { + res = insertMaMachineInfo(dto, code); + if (res == 0) { + log.error("insertMaMachineInfo方法插入异常"); + throw new RuntimeException("insertMaMachineInfo方法插入异常"); + } + //去修改ma_type里面的库存num,根据前端传的数量追加 + res = updateMaTypeInfo(dto.getTypeId(), dto.getNum()); + if (res == 0) { + log.error("updateMaTypeInfo方法修改异常"); + throw new RuntimeException("updateMaTypeInfo方法修改异常"); + } + } else { + //2.插入ma_type_put_in_storage_info表和ma_type_put_in_storage_details表 + res = insertPutInfo(dto, code); + if (res == 0) { + log.error("insertPutInfo方法插入异常"); + throw new RuntimeException("insertPutInfo方法插入异常"); + } + } + + } catch (Exception e) { + log.error("保存入库盘点异常:{}",e.getMessage()); + // 添加事务回滚逻辑,保证入库全部成功或者全部失败 + TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); + return AjaxResult.error(ExceptionEnum.SAVE_TO_DATABASE.getCode(), ExceptionEnum.SAVE_TO_DATABASE.getMsg()); + } + return AjaxResult.success(res); + } + + /** + * 根据设备编码code查重 + * @param maCode + * @return + */ + private int selectByMaCode(String maCode) { + return warehousingMapper.selectByMaCode(maCode); + } + + /** + * 编号新增,插入ma_machine、ma_machine_label和ma_label_bind + * @param dto + * @param code + * @return + */ + private int insertMaMachineInfo(SavePutInfoDto dto, String code) { + int res = 0; + if (dto.getNum() != null) { + MachIneDto machIneDto = dto.getMachIneDtoList().get(0); + machIneDto.setCode(code); + machIneDto.setPutInType(dto.getPutInType()); + machIneDto.setCreator(dto.getCreator()); + machIneDto.setNum(dto.getNum()); + machIneDto.setIsCode(dto.getIsCode()); + machIneDto.setTypeId(dto.getTypeId()); + machIneDto.setUnitId(dto.getUnitId()); + machIneDto.setProId(dto.getProId()); + machIneDto.setRemarks(dto.getRemarks()); + res += insertInfo(machIneDto); + machIneDto.setInfoId(machIneDto.getId()); + } + for (int i = 0; i < dto.getMachIneDtoList().size(); i++) { + MachIneDto machIneDto = dto.getMachIneDtoList().get(i); + machIneDto.setCode(code); + machIneDto.setIsCode(dto.getIsCode()); + machIneDto.setTypeId(dto.getTypeId()); + machIneDto.setCreator(dto.getCreator()); + machIneDto.setPutInType(dto.getPutInType()); + machIneDto.setNum(dto.getNum()); + machIneDto.setCheckMan(dto.getCheckMan()); + machIneDto.setInfoId(dto.getMachIneDtoList().get(0).getInfoId()); + res += insertMachineInfo(machIneDto); + } + return res; + } + + /** + * 插入ma_type_put_in_storage_info表,返回主键id + * @param machIneDto + * @return + */ + private int insertInfo(MachIneDto machIneDto) { + return warehousingMapper.saveInfo(machIneDto); + } + + /** + * 方法抽取,保持到ma_machine、ma_machine_label和ma_label_bind + * @param machIneDto + * @return + */ + private int insertMachineInfo(MachIneDto machIneDto) { + int res = warehousingMapper.insertMachine(machIneDto); + + res += insertTypePutInStorageInfo(machIneDto); + return res; + } + + /** + * 方法抽取 + * @param machIneDto + * @return + */ + private int insertTypePutInStorageInfo(MachIneDto machIneDto) { + //ma_type_put_in_storage_details表 + return warehousingMapper.saveDetails(machIneDto); + } + + /** + * 方法抽取,追加ma_type表里面的num + * @param typeId + * @param num + * @return + */ + private int updateMaTypeInfo(String typeId, Integer num) { + return warehousingMapper.updateMaType(typeId, num); + } + + /** + * 插入表方法 + * @param dto + * @return + */ + private int insertPutInfo(SavePutInfoDto dto, String code) { + int res = 0; + Integer total = dto.getMachIneDtoList().stream() + .map(MachIneDto::getPutInStoreNum) + .filter(num -> num != null) + .collect(Collectors.summingInt(Integer::intValue)); + if (CollectionUtils.isNotEmpty(dto.getMachIneDtoList())) { + MachIneDto machIneDto = dto.getMachIneDtoList().get(0); + machIneDto.setCode(code); + machIneDto.setPutInType(dto.getPutInType()); + machIneDto.setCreator(dto.getCreator()); + machIneDto.setIsCode(dto.getIsCode()); + machIneDto.setTotalNum(total); + machIneDto.setRemarks(dto.getRemarks()); + res += insertInfo(machIneDto); + machIneDto.setInfoId(machIneDto.getId()); + } + for (int i = 0; i < dto.getMachIneDtoList().size(); i++) { + MachIneDto machIneDto = dto.getMachIneDtoList().get(i); + machIneDto.setCreator(dto.getCreator()); + machIneDto.setPutInType(dto.getPutInType()); + machIneDto.setRemarks(dto.getRemarks()); + machIneDto.setCode(code); + machIneDto.setInfoId(dto.getMachIneDtoList().get(0).getInfoId()); + res += insertTypePutInStorageInfo(machIneDto); + //根据类型追加ma_type表里面的num + res += updateMaTypeInfo(machIneDto.getTypeId(), machIneDto.getPutInStoreNum()); + } + return res; + } + + + /** + * 根据入库单号查看详情 + * @param bean + * @return + */ + @Override + public List getDetails(PutInStorageBean bean) { + return warehousingMapper.getDetails(bean); + } +} diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/mapper/RepairApplyDetailsMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/mapper/RepairApplyDetailsMapper.java index 498b0941..e69e36aa 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/mapper/RepairApplyDetailsMapper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/mapper/RepairApplyDetailsMapper.java @@ -72,6 +72,11 @@ public interface RepairApplyDetailsMapper { */ public int deleteRepairApplyDetailsByIds(Long[] ids); + /** + * 批量根据维修ID数组查询维修任务单号 + */ + List selectRepairCodeByIds(@Param("list") List list); + /** * 根据维修ID查询维修任务单号 * @param repairId @@ -102,6 +107,11 @@ public interface RepairApplyDetailsMapper { */ int updateRepairApplyDetailsAfterAudit(RepairAuditDetails dto); + /** + * 批量修改repair_apply_record维修任务详情状态 + */ + int updateRepairApplyDetailsAfterAuditBatch(@Param("list") List list); + /** * 根据back_id获取最大level * @param backId diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/service/impl/RepairAuditDetailsServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/service/impl/RepairAuditDetailsServiceImpl.java index 8c95719d..10102a97 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/service/impl/RepairAuditDetailsServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/service/impl/RepairAuditDetailsServiceImpl.java @@ -603,21 +603,10 @@ public class RepairAuditDetailsServiceImpl implements IRepairAuditDetailsService level = details.getLevel(); } } - /*if (Objects.nonNull(preTmTaskInfo) && Objects.nonNull(preTmTaskInfo.getPreTaskId())) { - taskMapper.updateTaskStatus(String.valueOf(preTmTaskInfo.getPreTaskId()), RepairTaskStatusEnum.TASK_STATUS_PROCESSING.getStatus()); - }*/ // 根据taskId查询维修审核明细 final List repairAuditDetailsByTaskId = repairAuditDetailsMapper.selectRepairAuditDetailsByTaskId(auditDetails.getTaskId()); if (!CollectionUtils.isEmpty(repairAuditDetailsByTaskId)) { for (RepairAuditDetails repairAuditDetail : repairAuditDetailsByTaskId) { - /*if ("1".equals(repairAuditDetail.getStatus()) || "2".equals(repairAuditDetail.getStatus())) { - continue; - } - // 根据查询详情获取的维修ID,更新scrap_apply_details维修数量 - repairApplyDetailsMapper.updateRepairApplyDetailsAfterReject( - ObjectUtils.defaultIfNull(repairAuditDetail.getRepairedNum(),0).longValue(), - ObjectUtils.defaultIfNull(repairAuditDetail.getScrapNum(),0).longValue(), repairAuditDetail.getRepairId()); - repairApplyDetailsMapper.updateStatus(repairAuditDetail.getRepairId(), RepairTaskStatusEnum.TASK_STATUS_PROCESSING.getStatus());*/ RepairTaskDetails repairTaskDetails = new RepairTaskDetails(); repairTaskDetails.setNewTaskId(newTaskId); repairTaskDetails.setMaId(repairAuditDetail.getMaId() == null ? null : repairAuditDetail.getMaId().toString()); @@ -785,6 +774,12 @@ public class RepairAuditDetailsServiceImpl implements IRepairAuditDetailsService } } + /** + * 批量插入维修明细 + * @param scrapApplyDetailList 报废明细 + * @param repairAuditDetailsByQuery 维修明细by查询 + * @param agreementId 协议ID + */ private void batchInsertRepairInputDetails(List scrapApplyDetailList, List repairAuditDetailsByQuery, Long agreementId) { boolean inputFlag = false; boolean scrapFlag = false; @@ -803,7 +798,9 @@ public class RepairAuditDetailsServiceImpl implements IRepairAuditDetailsService //插入修饰审核入库任务表 Long newTaskId = null; if (inputFlag) { + // 插入任务表 newTaskId = insertTt(); + // 插入任务协议关联表 insertTta(newTaskId, agreementId); } //插入报废任务表 @@ -813,11 +810,37 @@ public class RepairAuditDetailsServiceImpl implements IRepairAuditDetailsService insertScrapTta(newScrapTaskId, agreementId); } final List inputList = new ArrayList<>(); + + List dtoArray = new ArrayList<>(); + List listAll = new ArrayList<>(); + if (CollectionUtil.isNotEmpty(repairAuditDetailsByQuery)) { + dtoArray = repairApplyDetailsMapper.selectRepairCodeByIds(repairAuditDetailsByQuery.stream().map(RepairAuditDetails::getRepairId).collect(Collectors.toList())); + repairApplyDetailsMapper.updateRepairApplyDetailsAfterAuditBatch(repairAuditDetailsByQuery); + listAll = scrapApplyDetailsMapper.selectScrapByTaskIdList(repairAuditDetailsByQuery); + } + for (final RepairAuditDetails details : repairAuditDetailsByQuery) { - RepairAuditDetails dto = repairApplyDetailsMapper.selectById(details.getRepairId()); - // 根据taskId修改repair_apply_record的status状态为已审核1 - repairApplyDetailsMapper.updateRepairApplyDetailsAfterAudit(dto); - List list = scrapApplyDetailsMapper.selectScrapByTaskId(dto); + RepairAuditDetails dto; + if (CollectionUtil.isEmpty(dtoArray)) { + dto = repairApplyDetailsMapper.selectById(details.getRepairId()); + // 根据taskId修改repair_apply_record的status状态为已审核1 + repairApplyDetailsMapper.updateRepairApplyDetailsAfterAudit(dto); + } else { + dto = dtoArray.stream().filter(dto1 -> dto1.getRepairId().equals(details.getRepairId())).findFirst().orElse(null); + } + + List list; + if (CollectionUtil.isNotEmpty(listAll)) { + list = listAll.stream().filter(item -> { + if (dto != null) { + return item.getTaskId().equals(dto.getTaskId()); + } + return false; + }).collect(Collectors.toList()); + } else { + list = scrapApplyDetailsMapper.selectScrapByTaskId(dto); + } + if (details.getRepairedNum().compareTo(BigDecimal.ZERO) > 0) { //修改机具状态为修试后待入库 if (null != details.getMaId()) { diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/scrap/mapper/ScrapApplyDetailsMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/scrap/mapper/ScrapApplyDetailsMapper.java index 63c1a8f4..e1cca0f9 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/scrap/mapper/ScrapApplyDetailsMapper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/scrap/mapper/ScrapApplyDetailsMapper.java @@ -119,6 +119,11 @@ public interface ScrapApplyDetailsMapper { */ List selectScrapByTaskId(RepairAuditDetails dto); + /** + * 批量根据任务id数组查询报废详情 + */ + List selectScrapByTaskIdList(@Param("list") List list); + /** * 台账审核 * @param scrapApplyDetails diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/controller/SltAgreementInfoController.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/controller/SltAgreementInfoController.java index 99bb2f61..8edfb6dc 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/controller/SltAgreementInfoController.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/controller/SltAgreementInfoController.java @@ -1445,9 +1445,6 @@ public class SltAgreementInfoController extends BaseController { @ApiOperation(value = "未结算报表list查询") @GetMapping("/getSltReportList") public TableDataInfo getSltReportList(SltAgreementInfo query) { - // ----------- 定义返回集合 ------------ - List resultList = new ArrayList<>(); - try { // ----------- 查询列表 --------------- List list = sltAgreementInfoService.getSltReportList(query); @@ -1457,12 +1454,14 @@ public class SltAgreementInfoController extends BaseController { // 设置结算权限,控制展示 list.forEach(info -> info.setSettlementType(settlementType)); + // --------- 定义返回集合 ------------------ List dataList = new ArrayList<>(); - SltInfoVo bean = new SltInfoVo(); + // --------- 拿到list中所有的agreementId存成集合,给每个info赋值 ------------------ + List AgreementIdsArray = list.stream().map(SltAgreementInfo::getAgreementId).collect(Collectors.toList()); // 把每个对象的agreementId设置成集合,避免重复查询 list.forEach(info -> { - info.setAgreementIds(list.stream().map(SltAgreementInfo::getAgreementId).collect(Collectors.toList())); + info.setAgreementIds(AgreementIdsArray); SltInfoVo vo = sltAgreementInfoService.getSltInfoReportBatch(info); if (vo != null && !ObjectUtil.isEmpty(vo)) { vo.setAgreementId(info.getAgreementId()); diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/back/BackApplyInfoMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/back/BackApplyInfoMapper.xml index 9f8c514c..e790268d 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/back/BackApplyInfoMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/back/BackApplyInfoMapper.xml @@ -796,6 +796,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" insert into bm_exit_permit (material,name,car_code,add_date,create_by,create_time) values (#{material}, #{name}, #{carCode}, #{addDate}, #{createBy}, now()) + + INSERT INTO archives_record_info + ( + parent_id,`level`,archives_value,archives_name,del_flag,create_time + ) VALUES ( + '22','2',#{proId},#{proName},'0',NOW() + ) + + + INSERT INTO archives_record_details + ( + info_id,parent_id,`level`,doc_name,doc_type,del_flag,create_time + ) VALUES ( + #{id},'0','1',#{typeName},'文件夹','0',NOW() + ) + delete from back_apply_info where id = #{id} @@ -1558,4 +1574,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" from sys_user su where su.user_id = 474 and su.del_flag = 0 + 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 bdbd6c88..324d33fa 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 @@ -903,4 +903,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" GROUP BY mt.type_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 20ac6078..3b58cc4b 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 @@ -490,8 +490,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" mi.ma_name as materialName, mi.ma_model as materialModel, mi.ma_code as maCode, - mi.this_check_time as thisCheckTime, - mi.next_check_time as nextCheckTime, + LEFT(mi.this_check_time, 10) AS thisCheckTime, + LEFT(mi.next_check_time, 10) AS nextCheckTime, mi.repair_man as repairMan, mi.check_man as checkMan, mi.phone, @@ -500,15 +500,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" '1' as devType FROM ws_ma_info mi - WHERE mi.ma_code LIKE CONCAT('%',#{maCode},'%') and mi.is_active = 1 and DATEDIFF(mi.next_check_time,NOW()) > 0 + WHERE mi.ma_code LIKE CONCAT('%',#{maCode},'%') and mi.is_active = 1 UNION SELECT mm.ma_id AS id, mt2.type_name as maName, mt.type_name as maModel, mm.ma_code as maCode, - mm.this_check_time as thisCheckTime, - mm.next_check_time as nextCheckTime, + LEFT(mm.this_check_time, 10) AS thisCheckTime, + LEFT(mm.next_check_time, 10) AS nextCheckTime, mm.check_man as repairMan, ifnull(mm.inspect_man,"高民") as checkMan, "0551-63703966" as phone, @@ -518,7 +518,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" FROM ma_machine mm LEFT JOIN ma_type mt on mm.type_id = mt.type_id LEFT JOIN ma_type mt2 on mt.parent_id = mt2.type_id - WHERE mm.ma_code LIKE CONCAT('%',#{maCode},'%') and mt.MANAGE_TYPE =0 and DATEDIFF(mm.next_check_time,NOW()) > 0 + WHERE mm.ma_code LIKE CONCAT('%',#{maCode},'%') and mt.MANAGE_TYPE =0 @@ -807,6 +807,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" mm.check_man as checkMan, mm.this_check_time as thisCheckTime, mm.next_check_time as nextCheckTime, + mt.manage_type as manageType, mm.in_out_num as inOutNum, mt.jiju_type as jiJuType, mt.is_check as isCheck, @@ -838,6 +839,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" wmi.check_man as checkMan, wmi.this_check_time as thisCheckTime, wmi.next_check_time as nextCheckTime, + 1 as manageType, '' as inOutNum, '1' as jiJuType, '' as isCheck, @@ -900,4 +902,34 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and wmi.id = #{maId} LIMIT 100 + + + + diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/ma/WarehousingMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/ma/WarehousingMapper.xml new file mode 100644 index 00000000..a7451a2d --- /dev/null +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/ma/WarehousingMapper.xml @@ -0,0 +1,221 @@ + + + + + + + + + + + INSERT INTO ma_type_put_in_storage_info + + put_in_type, + + + num, + + + + num, + + + + type_id, + creator, + code, + remarks, + create_time + + VALUES + + #{putInType}, + + + #{num}, + + + + #{totalNum}, + + + + #{typeId}, + #{creator}, + #{code}, + #{remarks}, + sysdate() + + + + + INSERT INTO ma_type_put_in_storage_details ( + + + + num, + + + + num, + + + + + info_id, + + + type_id, + + + ma_id, + + + remarks, + + + ma_code, + + + ) + VALUES ( + + + 1, + + + + #{putInStoreNum}, + + + + + + #{infoId}, + + + #{typeId}, + + + #{maId}, + + + #{remark}, + + + #{maCode}, + + + ) + + + + insert into ma_machine ( + type_id, + ma_code, + ma_status, + buy_price, + ma_vender, + check_man, + out_fac_code, + this_check_time, + next_check_time, + create_time + )values( + #{typeId}, + #{maCode}, + 1, + #{buyPrice}, + #{maVender}, + #{checkMan}, + #{outFacCode}, + #{thisCheckTime}, + #{nextCheckTime}, + sysdate() + ) + + + + UPDATE ma_type + SET storage_num = IFNULL(storage_num, 0) + #{num}, + update_time = now() + + and type_id = #{typeId} + + + + + \ No newline at end of file diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/repair/RepairApplyDetailsMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/repair/RepairApplyDetailsMapper.xml index 37ae0af7..1a160ce7 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/repair/RepairApplyDetailsMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/repair/RepairApplyDetailsMapper.xml @@ -260,4 +260,28 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{id} + + + + + update repair_apply_record + set status = 1, + update_time = NOW() + where task_id in + + #{obj.taskId} + + \ No newline at end of file diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/scrap/ScrapApplyDetailsMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/scrap/ScrapApplyDetailsMapper.xml index 458dafdd..4044b4db 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/scrap/ScrapApplyDetailsMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/scrap/ScrapApplyDetailsMapper.xml @@ -579,4 +579,32 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" AND m.type_id = #{typeId} + \ No newline at end of file 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 0bd6bb37..81476536 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 @@ -197,11 +197,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" LEFT JOIN bm_unit bui ON bui.unit_id = bai.unit_id LEFT JOIN slt_agreement_apply saa on saa.agreement_id = bai.agreement_id where bai.status = '1' AND bui.type_id != '1731' - + and bui.unit_id in - - #{item} - + + #{item} + and bp.pro_id = #{projectId} @@ -209,6 +209,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and bai.is_slt = #{sltStatus} + + and bai.agreement_code like concat('%',#{agreementCode},'%') + GROUP BY bai.agreement_id ORDER BY bai.create_time desc @@ -855,6 +858,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and bai.is_slt = #{sltStatus} + + and bai.agreement_code = #{agreementCode} + GROUP BY bai.agreement_id ORDER BY bai.create_time desc