接口对接
This commit is contained in:
parent
046b71dec7
commit
17ceb7b0c5
|
|
@ -8,7 +8,12 @@ import com.bonus.common.core.utils.poi.ExcelUtil;
|
|||
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.common.log.annotation.SysLog;
|
||||
import com.bonus.common.log.enums.OperaType;
|
||||
import com.bonus.common.security.annotation.RequiresPermissions;
|
||||
import com.bonus.material.back.domain.vo.BackApplyVo;
|
||||
import com.bonus.material.common.annotation.PreventRepeatSubmit;
|
||||
import com.bonus.material.ma.domain.LabelBind;
|
||||
import com.bonus.material.repair.domain.*;
|
||||
import com.bonus.material.repair.domain.vo.*;
|
||||
import com.bonus.material.repair.service.RepairService;
|
||||
|
|
@ -19,15 +24,14 @@ import com.fasterxml.jackson.databind.ObjectMapper;
|
|||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.aspectj.weaver.loadtime.Aj;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author syruan
|
||||
|
|
@ -60,6 +64,7 @@ public class RepairController extends BaseController {
|
|||
|
||||
/**
|
||||
* 获取维修任务列表--分页
|
||||
*
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
|
|
@ -74,6 +79,7 @@ public class RepairController extends BaseController {
|
|||
|
||||
/**
|
||||
* 获取维修任务列表--app
|
||||
*
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
|
|
@ -159,7 +165,8 @@ public class RepairController extends BaseController {
|
|||
try {
|
||||
String partStrList = bean.getPartStrList();
|
||||
if (StringUtils.isNoneBlank(partStrList)) {
|
||||
List<RepairPartDetails> repairPartDetails = objectMapper.readValue(partStrList, new TypeReference<List<RepairPartDetails>>() {});
|
||||
List<RepairPartDetails> repairPartDetails = objectMapper.readValue(partStrList, new TypeReference<List<RepairPartDetails>>() {
|
||||
});
|
||||
bean.setPartList(Optional.ofNullable(repairPartDetails).orElse(new ArrayList<>()));
|
||||
}
|
||||
return service.submitRepairApply(bean);
|
||||
|
|
@ -210,7 +217,7 @@ public class RepairController extends BaseController {
|
|||
@ApiOperation(value = "驳回退料--批量")
|
||||
//@RequiresPermissions(value = "repair:manage:reject")
|
||||
@PostMapping("/rejectRepair")
|
||||
public AjaxResult rejectRepair(@RequestBody RepairTask bean) {
|
||||
public AjaxResult rejectRepair(@RequestBody RepairTask bean) {
|
||||
return service.rejectRepair(bean);
|
||||
}
|
||||
|
||||
|
|
@ -223,14 +230,14 @@ public class RepairController extends BaseController {
|
|||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* 导出维修任务列表--外层--壹级列表
|
||||
*/
|
||||
@PostMapping("/export")
|
||||
//@RequiresPermissions("repair:manage:export")
|
||||
@ApiOperation(value = "导出维修任务列表")
|
||||
public void export(HttpServletResponse response, RepairTask bean) {
|
||||
List<RepairTask> list=new ArrayList<>();
|
||||
List<RepairTask> list = new ArrayList<>();
|
||||
try {
|
||||
list = service.exportRepairTaskList(bean);
|
||||
} catch (Exception e) {
|
||||
|
|
@ -243,7 +250,7 @@ public class RepairController extends BaseController {
|
|||
@ApiOperation(value = "获取修试后入库列表")
|
||||
@GetMapping("getRepairedList")
|
||||
//@RequiresPermissions("warehousing:repair:list")
|
||||
public TableDataInfo getRepairedList(RepairInputDetailsVo dto){
|
||||
public TableDataInfo getRepairedList(RepairInputDetailsVo dto) {
|
||||
startPage();
|
||||
List<RepairInputDetailsVo> list = service.getRepairedList(dto);
|
||||
return getDataTable(list);
|
||||
|
|
@ -252,7 +259,7 @@ public class RepairController extends BaseController {
|
|||
@ApiOperation(value = "获取修试后入库列表-详情")
|
||||
@GetMapping("getRepairedDetailList")
|
||||
//@RequiresPermissions("warehousing:repair:list")
|
||||
public TableDataInfo getRepairedDetailList(RepairInputDetailsVo dto){
|
||||
public TableDataInfo getRepairedDetailList(RepairInputDetailsVo dto) {
|
||||
startPage();
|
||||
List<RepairInputDetailsVo> list = service.getRepairedDetailList(dto);
|
||||
return getDataTable(list);
|
||||
|
|
@ -277,6 +284,7 @@ public class RepairController extends BaseController {
|
|||
|
||||
/**
|
||||
* 查询修试查询-维修配件查询列表
|
||||
*
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
|
|
@ -291,6 +299,7 @@ public class RepairController extends BaseController {
|
|||
|
||||
/**
|
||||
* 导出修试查询-维修配件查询列表
|
||||
*
|
||||
* @param response
|
||||
* @param dto
|
||||
*/
|
||||
|
|
@ -303,6 +312,7 @@ public class RepairController extends BaseController {
|
|||
|
||||
/**
|
||||
* 查询修试查询-维修配件查询二级列表
|
||||
*
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
|
|
@ -325,4 +335,70 @@ public class RepairController extends BaseController {
|
|||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "维修检验试验报表")
|
||||
@GetMapping("/getRepairInspection")
|
||||
public TableDataInfo getRepairInspection(RepairInspection dto) {
|
||||
try {
|
||||
startPage();
|
||||
List<RepairInspection> list = service.getRepairInspection(dto);
|
||||
return getDataTable(list);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getMessage());
|
||||
return getDataTable(Collections.emptyList());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出机具设备标签列表
|
||||
*/
|
||||
@ApiOperation(value = "导出维修检验试验报表")
|
||||
@PreventRepeatSubmit
|
||||
@SysLog(title = "机具设备标签", businessType = OperaType.EXPORT, logType = 1, module = "仓储管理->导出维修检验试验报表")
|
||||
@PostMapping("/getRepairInspectionExport")
|
||||
public void getRepairInspectionExport(HttpServletResponse response, RepairInspection dto) {
|
||||
List<RepairInspection> list = service.getRepairInspection(dto);
|
||||
ExcelUtil<RepairInspection> util = new ExcelUtil<RepairInspection>(RepairInspection.class);
|
||||
util.exportExcel(response, list, "机具设备标签数据");
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "维修检验试验报表")
|
||||
@GetMapping("/getTestRecord")
|
||||
public TableDataInfo getTestRecord(TestRecord dto) {
|
||||
try {
|
||||
startPage();
|
||||
List<TestRecord> list = service.getTestRecord(dto);
|
||||
return getDataTable(list);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getMessage());
|
||||
return getDataTable(Collections.emptyList());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 导出机具设备标签列表
|
||||
*/
|
||||
@ApiOperation(value = "导出维修检验试验报表")
|
||||
@PreventRepeatSubmit
|
||||
@SysLog(title = "机具设备标签", businessType = OperaType.EXPORT, logType = 1, module = "仓储管理->导出维修检验试验报表")
|
||||
@PostMapping("/getTestRecordExport")
|
||||
public void getTestRecordExport(HttpServletResponse response, TestRecord dto) {
|
||||
List<TestRecord> list = service.getTestRecord(dto);
|
||||
ExcelUtil<TestRecord> util = new ExcelUtil<TestRecord>(TestRecord.class);
|
||||
util.exportExcel(response, list, "机具设备标签数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询试验记录表数据
|
||||
*/
|
||||
@ApiOperation(value = "查询试验记录表数据")
|
||||
@GetMapping("/getTestRecordDetails")
|
||||
public AjaxResult getTestRecordDetails(TestRecord bean) {
|
||||
List<RepairTaskDetails> list = service.getTestRecordDetails(bean);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,66 +22,109 @@ public class RepairInputDetailsVo {
|
|||
@ApiModelProperty(value = "规格ID")
|
||||
private Long typeId;
|
||||
|
||||
/** 设备类型*/
|
||||
/**
|
||||
* 设备类型
|
||||
*/
|
||||
@Excel(name = "工机具类型")
|
||||
private String typeName2;
|
||||
|
||||
/** 规格型号*/
|
||||
/**
|
||||
* 规格型号
|
||||
*/
|
||||
@Excel(name = "规格型号")
|
||||
private String typeName;
|
||||
|
||||
/** 维修单号*/
|
||||
/**
|
||||
* 维修单号
|
||||
*/
|
||||
private String repairCode;
|
||||
|
||||
/** 工器具类型*/
|
||||
/**
|
||||
* 工器具类型
|
||||
*/
|
||||
private String maTypeName;
|
||||
|
||||
/** 维修人员*/
|
||||
/**
|
||||
* 维修人员
|
||||
*/
|
||||
private String wxName;
|
||||
|
||||
/** 维修时间*/
|
||||
/**
|
||||
* 维修时间
|
||||
*/
|
||||
private String wxTime;
|
||||
|
||||
/** 状态*/
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
private String taskStatus;
|
||||
|
||||
/** 工程 */
|
||||
/**
|
||||
* 工程
|
||||
*/
|
||||
private String projectName;
|
||||
|
||||
/** 单位 */
|
||||
/**
|
||||
* 单位
|
||||
*/
|
||||
private String unitName;
|
||||
|
||||
/** 关键字*/
|
||||
/**
|
||||
* 关键字
|
||||
*/
|
||||
private String keyWord;
|
||||
|
||||
/** 设备类型*/
|
||||
/**
|
||||
* 设备类型
|
||||
*/
|
||||
private String deviceTypeId;
|
||||
|
||||
/** 管理方式(0编号 1计数)*/
|
||||
/**
|
||||
* 管理方式(0编号 1计数)
|
||||
*/
|
||||
private String manageType;
|
||||
|
||||
/** 数量*/
|
||||
/**
|
||||
* 数量
|
||||
*/
|
||||
@Excel(name = "数量")
|
||||
private Integer repairNum;
|
||||
|
||||
/** 编号*/
|
||||
/**
|
||||
* 编号
|
||||
*/
|
||||
@Excel(name = "编号")
|
||||
private String maCode;
|
||||
|
||||
/** 提交入库人员*/
|
||||
/**
|
||||
* 提交入库人员
|
||||
*/
|
||||
@Excel(name = "提交入库人员")
|
||||
private String updateBy;
|
||||
|
||||
/** 提交入库时间*/
|
||||
/**
|
||||
* 提交入库时间
|
||||
*/
|
||||
@Excel(name = "提交入库时间")
|
||||
private String updateTime;
|
||||
|
||||
/** 不通过原因*/
|
||||
/**
|
||||
* 不通过原因
|
||||
*/
|
||||
@Excel(name = "不通过原因")
|
||||
private String remark;
|
||||
|
||||
/** 状态*/
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
@Excel(name = "状态")
|
||||
private String status;
|
||||
|
||||
|
||||
private String backUnitName;
|
||||
|
||||
private String typeModelName;
|
||||
|
||||
private Integer num;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,145 @@
|
|||
package com.bonus.material.repair.domain.vo;
|
||||
|
||||
import com.bonus.common.core.annotation.Excel;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class RepairInspection implements Serializable {
|
||||
|
||||
/**
|
||||
* 退回单位名称
|
||||
*/
|
||||
@Excel(name = "退料单位")
|
||||
private String backUnitName;
|
||||
|
||||
/**
|
||||
* 项目名称
|
||||
*/
|
||||
@Excel(name = "退料工程")
|
||||
private String projectName;
|
||||
/**
|
||||
* 维修单号
|
||||
*/
|
||||
@Excel(name = "维修单号")
|
||||
private String repairCode;
|
||||
|
||||
/**
|
||||
* 类型名称
|
||||
*/
|
||||
@Excel(name = "机具名称")
|
||||
private String typeName;
|
||||
|
||||
|
||||
/**
|
||||
* 型号名称
|
||||
*/
|
||||
@Excel(name = "规格型号")
|
||||
private String typeModelName;
|
||||
|
||||
|
||||
/**
|
||||
* 单位名称
|
||||
*/
|
||||
@Excel(name = "计量单位")
|
||||
private String unitName;
|
||||
|
||||
|
||||
/**
|
||||
* 维修数量
|
||||
*/
|
||||
@Excel(name = "退料数量")
|
||||
private String repairNum;
|
||||
|
||||
|
||||
/**
|
||||
* 计算数量(采样比例 * 维修数量)
|
||||
*/
|
||||
@Excel(name = "抽检数量")
|
||||
private String num;
|
||||
|
||||
|
||||
/**
|
||||
* 计算数量(采样比例 * 维修数量)
|
||||
*/
|
||||
@Excel(name = "试验数量")
|
||||
private String expNum;
|
||||
|
||||
@Excel(name = "抽检人")
|
||||
private String samplePerson;
|
||||
|
||||
@Excel(name = "试验人")
|
||||
private String testPerson;
|
||||
|
||||
|
||||
private String unitId;
|
||||
|
||||
private String proId;
|
||||
|
||||
|
||||
/**
|
||||
* 采样比例
|
||||
*/
|
||||
private String samplingRatio;
|
||||
|
||||
/**
|
||||
* 额定负载
|
||||
*/
|
||||
@Excel(name = "额定载荷")
|
||||
private String ratedLoad;
|
||||
|
||||
/**
|
||||
* 测试负载
|
||||
*/
|
||||
@Excel(name = "试验载荷")
|
||||
private String testLoad;
|
||||
|
||||
/**
|
||||
* 保持时间
|
||||
*/
|
||||
@Excel(name = "持荷时间")
|
||||
private String holdingTime;
|
||||
|
||||
/**
|
||||
* 物料编码
|
||||
*/
|
||||
private String maCode;
|
||||
|
||||
|
||||
/**
|
||||
* 任务ID
|
||||
*/
|
||||
private String taskId;
|
||||
|
||||
/**
|
||||
* 类型ID
|
||||
*/
|
||||
private String typeId;
|
||||
|
||||
/**
|
||||
* 物料ID
|
||||
*/
|
||||
private String maId;
|
||||
|
||||
/**
|
||||
* 维修时间
|
||||
*/
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||
private Date repairTime;
|
||||
|
||||
|
||||
@ApiModelProperty(value = "开始时间")
|
||||
private String startTime;
|
||||
|
||||
@ApiModelProperty(value = "结束时间")
|
||||
private String endTime;
|
||||
|
||||
|
||||
private String keyWord;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,141 @@
|
|||
package com.bonus.material.repair.domain.vo;
|
||||
|
||||
import com.bonus.common.core.annotation.Excel;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class TestRecord implements Serializable {
|
||||
|
||||
private String id;
|
||||
/**
|
||||
* 退回单位名称
|
||||
*/
|
||||
@Excel(name = "退料单位")
|
||||
private String backUnitName;
|
||||
|
||||
/**
|
||||
* 项目名称
|
||||
*/
|
||||
@Excel(name = "退料工程")
|
||||
private String projectName;
|
||||
/**
|
||||
* 维修单号
|
||||
*/
|
||||
@Excel(name = "维修单号")
|
||||
private String repairCode;
|
||||
|
||||
/**
|
||||
* 类型名称
|
||||
*/
|
||||
@Excel(name = "机具名称")
|
||||
private String typeName;
|
||||
|
||||
|
||||
/**
|
||||
* 型号名称
|
||||
*/
|
||||
@Excel(name = "规格型号")
|
||||
private String typeModelName;
|
||||
|
||||
|
||||
/**
|
||||
* 物料编码
|
||||
*/
|
||||
@Excel(name = "设备编码")
|
||||
private String maCode;
|
||||
/**
|
||||
* 单位名称
|
||||
*/
|
||||
private String unitName;
|
||||
|
||||
|
||||
/**
|
||||
* 维修数量
|
||||
*/
|
||||
|
||||
private String repairNum;
|
||||
|
||||
|
||||
/**
|
||||
* 计算数量(采样比例 * 维修数量)
|
||||
*/
|
||||
|
||||
private String num;
|
||||
|
||||
|
||||
/**
|
||||
* 计算数量(采样比例 * 维修数量)
|
||||
*/
|
||||
|
||||
private String expNum;
|
||||
|
||||
|
||||
private String samplePerson;
|
||||
|
||||
private String testPerson;
|
||||
|
||||
|
||||
private String unitId;
|
||||
|
||||
private String proId;
|
||||
|
||||
|
||||
/**
|
||||
* 采样比例
|
||||
*/
|
||||
private String samplingRatio;
|
||||
|
||||
/**
|
||||
* 额定负载
|
||||
*/
|
||||
private String ratedLoad;
|
||||
|
||||
/**
|
||||
* 测试负载
|
||||
*/
|
||||
private String testLoad;
|
||||
|
||||
/**
|
||||
* 保持时间
|
||||
*/
|
||||
|
||||
private String holdingTime;
|
||||
|
||||
|
||||
/**
|
||||
* 任务ID
|
||||
*/
|
||||
private String taskId;
|
||||
|
||||
/**
|
||||
* 类型ID
|
||||
*/
|
||||
private String typeId;
|
||||
|
||||
/**
|
||||
* 物料ID
|
||||
*/
|
||||
private String maId;
|
||||
|
||||
/**
|
||||
* 维修时间
|
||||
*/
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||
private Date repairTime;
|
||||
|
||||
|
||||
@ApiModelProperty(value = "开始时间")
|
||||
private String startTime;
|
||||
|
||||
@ApiModelProperty(value = "结束时间")
|
||||
private String endTime;
|
||||
|
||||
|
||||
private String keyWord;
|
||||
|
||||
}
|
||||
|
|
@ -2,10 +2,7 @@ package com.bonus.material.repair.mapper;
|
|||
|
||||
import com.bonus.material.ma.domain.PartType;
|
||||
import com.bonus.material.repair.domain.*;
|
||||
import com.bonus.material.repair.domain.vo.RepairDeviceVO;
|
||||
import com.bonus.material.repair.domain.vo.RepairInputDetailsVo;
|
||||
import com.bonus.material.repair.domain.vo.RepairPartInfo;
|
||||
import com.bonus.material.repair.domain.vo.RepairPartVo;
|
||||
import com.bonus.material.repair.domain.vo.*;
|
||||
import com.bonus.system.api.domain.SysUser;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
|
@ -21,6 +18,7 @@ import java.util.List;
|
|||
public interface RepairMapper {
|
||||
/**
|
||||
* 获取维修任务列表
|
||||
*
|
||||
* @param bean 维修任务信息--查询条件
|
||||
*/
|
||||
List<RepairTask> getRepairTaskList(RepairTask bean);
|
||||
|
|
@ -32,6 +30,7 @@ public interface RepairMapper {
|
|||
|
||||
/**
|
||||
* 获取维修任务列表
|
||||
*
|
||||
* @param taskId 任务id
|
||||
*/
|
||||
RepairTask getRepairTaskInfoByTaskId(Long taskId);
|
||||
|
|
@ -46,78 +45,89 @@ public interface RepairMapper {
|
|||
|
||||
/**
|
||||
* 新增维修记录
|
||||
*
|
||||
* @param bean 维修记录信息
|
||||
*/
|
||||
int addRecord(RepairApplyRecord bean);
|
||||
|
||||
/**
|
||||
* 根据id查询维修明细
|
||||
*
|
||||
* @param id 主键key
|
||||
*/
|
||||
RepairTaskDetails getById(Long id);
|
||||
|
||||
/**
|
||||
* 修改维修数量
|
||||
* @param id 主键key
|
||||
*
|
||||
* @param id 主键key
|
||||
* @param repairNum 维修数量
|
||||
* @param repairer 维修人员
|
||||
* @param userId 用户id
|
||||
* @param repairer 维修人员
|
||||
* @param userId 用户id
|
||||
*/
|
||||
int updateRepairedNum(@Param("id") Long id, @Param("repairNum") BigDecimal repairNum, @Param("repairer") Long repairer, @Param("userId") Long userId);
|
||||
|
||||
int updateRepairNum(@Param("id") Long id, @Param("repairNum") BigDecimal repairNum, @Param("repairer") Long repairer, @Param("userId") Long userId);
|
||||
|
||||
int updateThisRepairedAndScrapNum(@Param("id") Long id, @Param("thisRepairedNum") BigDecimal repairNum, @Param("thisScrapNum") BigDecimal thisScrapNum,@Param("repairer") Long repairer, @Param("userId") Long userId);
|
||||
int updateThisRepairedAndScrapNum(@Param("id") Long id, @Param("thisRepairedNum") BigDecimal repairNum, @Param("thisScrapNum") BigDecimal thisScrapNum, @Param("repairer") Long repairer, @Param("userId") Long userId);
|
||||
|
||||
int updateRepairedAndScrapNum(@Param("id") Long id, @Param("thisRepairedNum") BigDecimal repairNum, @Param("thisScrapNum") BigDecimal thisScrapNum,@Param("repairer") Long repairer, @Param("userId") Long userId);
|
||||
int updateRepairedAndScrapNum(@Param("id") Long id, @Param("thisRepairedNum") BigDecimal repairNum, @Param("thisScrapNum") BigDecimal thisScrapNum, @Param("repairer") Long repairer, @Param("userId") Long userId);
|
||||
|
||||
int updateRepairedNumAndStatus(@Param("id") Long id, @Param("repairNum") BigDecimal repairNum, @Param("status") int status, @Param("repairer") String repairer, @Param("userId") Long userId);
|
||||
|
||||
/**
|
||||
* 修改维修数量
|
||||
* @param id 主键 key
|
||||
*
|
||||
* @param id 主键 key
|
||||
* @param repairNum 维修数量
|
||||
* @param userid 用户id
|
||||
* @param userid 用户id
|
||||
*/
|
||||
int updateRepairedNumTwo(@Param("id") Long id, @Param("repairNum") BigDecimal repairNum, @Param("userId") Long userid);
|
||||
|
||||
/**
|
||||
* 修改维修数量和状态
|
||||
* @param id 主键 key
|
||||
*
|
||||
* @param id 主键 key
|
||||
* @param repairNum 维修数量
|
||||
* @param userid 用户id
|
||||
* @param userid 用户id
|
||||
*/
|
||||
int updateRepairedNumTwoAndStatus(@Param("id") Long id, @Param("repairNum") BigDecimal repairNum, @Param("status") int status, @Param("userId") Long userid);
|
||||
|
||||
/**
|
||||
* 修改报废数量
|
||||
* @param id 主键key
|
||||
*
|
||||
* @param id 主键key
|
||||
* @param scrapNum 报废数量
|
||||
* @param userId 用户id
|
||||
* @param userId 用户id
|
||||
*/
|
||||
int updateScrapNum(@Param("id") Long id, @Param("scrapNum") BigDecimal scrapNum, @Param("userId") Long userId);
|
||||
|
||||
/**
|
||||
* 修改报废数量和状态
|
||||
* @param id 主键key
|
||||
*
|
||||
* @param id 主键key
|
||||
* @param scrapNum 报废数量
|
||||
* @param userId 用户id
|
||||
* @param userId 用户id
|
||||
*/
|
||||
int updateScrapNumAndStatus(@Param("id") Long id, @Param("scrapNum") BigDecimal scrapNum, @Param("status") int status, @Param("userId") Long userId);
|
||||
|
||||
/**
|
||||
* 新增配件维修记录
|
||||
*
|
||||
* @param partDetails 配件详情
|
||||
*/
|
||||
int addPart(RepairPartDetails partDetails);
|
||||
|
||||
/**
|
||||
* 完成维修--更改维修状态
|
||||
* @param ids 主键集合
|
||||
*
|
||||
* @param ids 主键集合
|
||||
* @param userName
|
||||
*/
|
||||
int batchQualified(@Param("ids") ArrayList<Long> ids, @Param("userName") String userName);
|
||||
|
||||
int updateMaMachine(@Param("ids") ArrayList<Long> ids, @Param("userName") String userName);
|
||||
|
||||
/**
|
||||
* 根据已修数量、已报废数量--更新维修状态
|
||||
*/
|
||||
|
|
@ -130,8 +140,9 @@ public interface RepairMapper {
|
|||
|
||||
/**
|
||||
* 修改维修任务状态
|
||||
*
|
||||
* @param taskList 任务列表集合
|
||||
* @param userid 用户id
|
||||
* @param userid 用户id
|
||||
*/
|
||||
int updateTaskStatus(@Param("taskList") List<RepairTask> taskList, @Param("userId") Long userid, @Param("taskStatus") Integer taskStatus);
|
||||
|
||||
|
|
@ -139,30 +150,35 @@ public interface RepairMapper {
|
|||
|
||||
/**
|
||||
* 新增任务
|
||||
*
|
||||
* @param task 任务信息
|
||||
*/
|
||||
int addTask(RepairTask task);
|
||||
|
||||
/**
|
||||
* 查询协议Id
|
||||
*
|
||||
* @param task 任务信息
|
||||
*/
|
||||
Long getAgreementId(RepairTask task);
|
||||
|
||||
/**
|
||||
* 新增 协议与任务关联
|
||||
*
|
||||
* @param task 任务信息
|
||||
*/
|
||||
int createAgreementTask(RepairTask task);
|
||||
|
||||
/**
|
||||
* 查询是否存在未完成维修的
|
||||
*
|
||||
* @param task 任务信息
|
||||
*/
|
||||
int getUnFinish(RepairTask task);
|
||||
|
||||
/**
|
||||
* 新增修饰审核审核数据
|
||||
*
|
||||
* @param details 数据详情
|
||||
*/
|
||||
int addAuditDetails(RepairTaskDetails details);
|
||||
|
|
@ -179,6 +195,7 @@ public interface RepairMapper {
|
|||
|
||||
/**
|
||||
* 查询配件价格
|
||||
*
|
||||
* @param partId 配件id
|
||||
*/
|
||||
BigDecimal selectPartPrice(Long partId);
|
||||
|
|
@ -190,6 +207,7 @@ public interface RepairMapper {
|
|||
|
||||
/**
|
||||
* 维修人信息修改
|
||||
*
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
|
|
@ -197,6 +215,7 @@ public interface RepairMapper {
|
|||
|
||||
/**
|
||||
* 扣减个人库配件库存数量
|
||||
*
|
||||
* @param partDetails
|
||||
* @return
|
||||
*/
|
||||
|
|
@ -204,6 +223,7 @@ public interface RepairMapper {
|
|||
|
||||
/**
|
||||
* 查询维修明细
|
||||
*
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
|
|
@ -211,6 +231,7 @@ public interface RepairMapper {
|
|||
|
||||
/**
|
||||
* 查询维修审核明细
|
||||
*
|
||||
* @param details
|
||||
* @return
|
||||
*/
|
||||
|
|
@ -218,6 +239,7 @@ public interface RepairMapper {
|
|||
|
||||
/**
|
||||
* 新增维修任务明细
|
||||
*
|
||||
* @param repairTaskDetail
|
||||
* @return
|
||||
*/
|
||||
|
|
@ -225,6 +247,7 @@ public interface RepairMapper {
|
|||
|
||||
/**
|
||||
* 查询维修任务明细
|
||||
*
|
||||
* @param taskList
|
||||
* @return
|
||||
*/
|
||||
|
|
@ -232,6 +255,7 @@ public interface RepairMapper {
|
|||
|
||||
/**
|
||||
* 查询维修任务明细
|
||||
*
|
||||
* @param details
|
||||
* @return
|
||||
*/
|
||||
|
|
@ -239,6 +263,7 @@ public interface RepairMapper {
|
|||
|
||||
/**
|
||||
* 修改维修任务明细
|
||||
*
|
||||
* @param details
|
||||
* @return
|
||||
*/
|
||||
|
|
@ -246,6 +271,7 @@ public interface RepairMapper {
|
|||
|
||||
/**
|
||||
* 查询修试查询-维修配件查询列表
|
||||
*
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
|
|
@ -253,6 +279,7 @@ public interface RepairMapper {
|
|||
|
||||
/**
|
||||
* 查询配件相关信息
|
||||
*
|
||||
* @param repairPartVo
|
||||
* @return
|
||||
*/
|
||||
|
|
@ -260,6 +287,7 @@ public interface RepairMapper {
|
|||
|
||||
/**
|
||||
* 查询修试查询-维修配件查询二级列表
|
||||
*
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
|
|
@ -267,6 +295,7 @@ public interface RepairMapper {
|
|||
|
||||
/**
|
||||
* 获取维修任务列表--app
|
||||
*
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
|
|
@ -274,6 +303,7 @@ public interface RepairMapper {
|
|||
|
||||
/**
|
||||
* 获取配件
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
|
|
@ -281,6 +311,7 @@ public interface RepairMapper {
|
|||
|
||||
/**
|
||||
* 查询报废数和维修数判断是否提交了一次
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
|
|
@ -288,6 +319,7 @@ public interface RepairMapper {
|
|||
|
||||
/**
|
||||
* 查询定损是否把价格已经添加
|
||||
*
|
||||
* @param repairApplyRecord
|
||||
* @return
|
||||
*/
|
||||
|
|
@ -295,6 +327,7 @@ public interface RepairMapper {
|
|||
|
||||
/**
|
||||
* 获取维修任务机具列表--三级页面详情列表--编码
|
||||
*
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
|
|
@ -302,6 +335,7 @@ public interface RepairMapper {
|
|||
|
||||
/**
|
||||
* 查询试验记录表数据
|
||||
*
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
|
|
@ -309,6 +343,7 @@ public interface RepairMapper {
|
|||
|
||||
/**
|
||||
* 查询配件
|
||||
*
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
|
|
@ -316,6 +351,7 @@ public interface RepairMapper {
|
|||
|
||||
/**
|
||||
* 删除任务
|
||||
*
|
||||
* @param taskId
|
||||
* @return
|
||||
*/
|
||||
|
|
@ -323,6 +359,7 @@ public interface RepairMapper {
|
|||
|
||||
/**
|
||||
* 查询已修和已报废数量
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
|
|
@ -330,6 +367,7 @@ public interface RepairMapper {
|
|||
|
||||
/**
|
||||
* 删除单条维修任务
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
|
|
@ -337,6 +375,7 @@ public interface RepairMapper {
|
|||
|
||||
/**
|
||||
* 查询配件数量
|
||||
*
|
||||
* @param partId
|
||||
* @return
|
||||
*/
|
||||
|
|
@ -344,6 +383,7 @@ public interface RepairMapper {
|
|||
|
||||
/**
|
||||
* 获取配件列表
|
||||
*
|
||||
* @param partId
|
||||
* @return
|
||||
*/
|
||||
|
|
@ -351,6 +391,7 @@ public interface RepairMapper {
|
|||
|
||||
/**
|
||||
* 修改配件数量
|
||||
*
|
||||
* @param currentPart
|
||||
* @return
|
||||
*/
|
||||
|
|
@ -358,15 +399,25 @@ public interface RepairMapper {
|
|||
|
||||
/**
|
||||
* 查询维修任务信息
|
||||
*
|
||||
* @param repairTask
|
||||
* @return
|
||||
*/
|
||||
RepairTask selectInfo(RepairTask repairTask);
|
||||
|
||||
/**
|
||||
* 查询机具列表--三级页面详情列表
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
* 查询机具列表--三级页面详情列表
|
||||
*
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
List<RepairDeviceVO> getAppRepairMaTypeListByTaskIdAndTypeId(RepairTaskDetails bean);
|
||||
|
||||
List<RepairInspection> getRepairInspection(RepairInspection dto);
|
||||
|
||||
List<TestRecord> getTestRecord(TestRecord dto);
|
||||
|
||||
List<RepairTaskDetails> getTestRecordDetails(TestRecord bean);
|
||||
|
||||
List<PartType> getPartDetails(RepairTaskDetails bean1);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -146,4 +146,10 @@ public interface RepairService {
|
|||
* @return
|
||||
*/
|
||||
List<RepairDeviceVO> getAppRepairMaTypeListByTaskIdAndTypeId(RepairTaskDetails bean);
|
||||
|
||||
List<RepairInspection> getRepairInspection(RepairInspection dto);
|
||||
|
||||
List<TestRecord> getTestRecord(TestRecord dto);
|
||||
|
||||
List<RepairTaskDetails> getTestRecordDetails(TestRecord bean);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ import org.springframework.stereotype.Service;
|
|||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.math.BigDecimal;
|
||||
|
|
@ -99,6 +100,7 @@ public class RepairServiceImpl implements RepairService {
|
|||
|
||||
/**
|
||||
* 维修任务一级列表
|
||||
*
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
|
|
@ -152,6 +154,7 @@ public class RepairServiceImpl implements RepairService {
|
|||
|
||||
/**
|
||||
* 关键字搜索
|
||||
*
|
||||
* @param item
|
||||
* @param keyWord
|
||||
* @return
|
||||
|
|
@ -281,6 +284,7 @@ public class RepairServiceImpl implements RepairService {
|
|||
|
||||
/**
|
||||
* 查询维修单
|
||||
*
|
||||
* @param taskId 任务id
|
||||
*/
|
||||
@Override
|
||||
|
|
@ -317,7 +321,7 @@ public class RepairServiceImpl implements RepairService {
|
|||
List<RepairPart> repairPartList = repairAuditDetailsMapper.getPartDetailsByTaskId(new RepairAuditDetails().setTaskId(taskId));
|
||||
repairPartList = mergePartsNum(repairPartList);
|
||||
List<RepairPart> repairPartList2 = repairAuditDetailsMapper.getPartRecordNum(new RepairAuditDetails().setTaskId(taskId));
|
||||
if(!repairPartList2.isEmpty()){
|
||||
if (!repairPartList2.isEmpty()) {
|
||||
repairPartList.addAll(repairPartList2);
|
||||
}
|
||||
RepairTicketVo result = new RepairTicketVo().setRepairTaskInfo(repairTaskInfo)
|
||||
|
|
@ -335,19 +339,19 @@ public class RepairServiceImpl implements RepairService {
|
|||
}
|
||||
|
||||
public static List<RepairPart> mergePartsNum(@NotNull List<RepairPart> devices) {
|
||||
try {
|
||||
Map<String, RepairPart> map = devices.stream().filter(Objects::nonNull).collect(
|
||||
try {
|
||||
Map<String, RepairPart> map = devices.stream().filter(Objects::nonNull).collect(
|
||||
Collectors.toConcurrentMap(device -> device.getTypeId() + ":" + device.getPartCost() + ":" + device.getPartName(),
|
||||
device -> device, (existing, recently) -> {
|
||||
existing.setPartNum(existing.getPartNum() + recently.getPartNum());
|
||||
return existing;
|
||||
}, ConcurrentHashMap::new)
|
||||
);
|
||||
List<RepairPart> list = new ArrayList<>(map.values());
|
||||
list.forEach(item -> item.setPartCost(Optional.ofNullable(item.getPartPrice()).orElse(BigDecimal.ZERO)
|
||||
.multiply(BigDecimal.valueOf(Optional.ofNullable(item.getPartNum()).orElse(0))))
|
||||
);
|
||||
return list;
|
||||
device -> device, (existing, recently) -> {
|
||||
existing.setPartNum(existing.getPartNum() + recently.getPartNum());
|
||||
return existing;
|
||||
}, ConcurrentHashMap::new)
|
||||
);
|
||||
List<RepairPart> list = new ArrayList<>(map.values());
|
||||
list.forEach(item -> item.setPartCost(Optional.ofNullable(item.getPartPrice()).orElse(BigDecimal.ZERO)
|
||||
.multiply(BigDecimal.valueOf(Optional.ofNullable(item.getPartNum()).orElse(0))))
|
||||
);
|
||||
return list;
|
||||
} catch (Exception e) {
|
||||
throw new ServiceException("Error merging parts" + e.getMessage());
|
||||
}
|
||||
|
|
@ -355,6 +359,7 @@ public class RepairServiceImpl implements RepairService {
|
|||
|
||||
/**
|
||||
* 提交维修记录
|
||||
*
|
||||
* @param bean repairApplyRecord
|
||||
*/
|
||||
@Override
|
||||
|
|
@ -492,7 +497,7 @@ public class RepairServiceImpl implements RepairService {
|
|||
if (null == details.getRepairNum()) {
|
||||
details.setRepairNum(BigDecimal.ZERO);
|
||||
}
|
||||
BigDecimal repairNum = details.getRepairedNum().add(bean.getRepairNum()) ;
|
||||
BigDecimal repairNum = details.getRepairedNum().add(bean.getRepairNum());
|
||||
|
||||
if (repairNum.add(details.getScrapNum()).compareTo(details.getRepairNum()) > 0) {
|
||||
throw new ServiceException("维修数量大于维修总量");
|
||||
|
|
@ -545,11 +550,15 @@ public class RepairServiceImpl implements RepairService {
|
|||
repairDeviceVOList.removeIf(Objects::isNull);
|
||||
|
||||
for (RepairDeviceVO bean : repairDeviceVOList) {
|
||||
if (null == bean.getManageType()) {throw new ServiceException("请选择物资管理方式");}
|
||||
if (null == bean.getManageType()) {
|
||||
throw new ServiceException("请选择物资管理方式");
|
||||
}
|
||||
if (Objects.equals(MaTypeManageTypeEnum.CODE_DEVICE.getTypeId(), bean.getManageType())) {
|
||||
partList = bean.getNumberInRepairPartList();
|
||||
// 物资管理方式--编码管理
|
||||
if (null == bean.getRepairType()) {continue;}
|
||||
if (null == bean.getRepairType()) {
|
||||
continue;
|
||||
}
|
||||
// 根据维修方式,更新维修数量、报废数量
|
||||
switch (bean.getRepairType()) {
|
||||
case INNER_REPAIR: {
|
||||
|
|
@ -691,7 +700,9 @@ public class RepairServiceImpl implements RepairService {
|
|||
// 分拆维修单, 准备数据
|
||||
outerRepairNum = partList.get(0).getRepairNum();
|
||||
|
||||
if (null == partList.get(0).getSupplierId()) {throw new ServiceException("请选择返厂厂家");}
|
||||
if (null == partList.get(0).getSupplierId()) {
|
||||
throw new ServiceException("请选择返厂厂家");
|
||||
}
|
||||
|
||||
// 数量管理--外部返厂维修 -- 记录表插入数据
|
||||
RepairApplyRecord repairApplyRecord = new RepairApplyRecord();
|
||||
|
|
@ -797,6 +808,7 @@ public class RepairServiceImpl implements RepairService {
|
|||
|
||||
/**
|
||||
* 拆分维修单,生成任务协议表
|
||||
*
|
||||
* @param newTaskId
|
||||
* @param agreementId
|
||||
* @return
|
||||
|
|
@ -812,6 +824,7 @@ public class RepairServiceImpl implements RepairService {
|
|||
|
||||
/**
|
||||
* 生成任务表
|
||||
*
|
||||
* @param createBy
|
||||
* @return
|
||||
*/
|
||||
|
|
@ -821,7 +834,7 @@ public class RepairServiceImpl implements RepairService {
|
|||
// 生成维修单号
|
||||
String code = genderWxTaskCode(thisMonthMaxOrder);
|
||||
TmTask tmTask = new TmTask(null, TmTaskTypeEnum.TM_TASK_REPAIR.getTaskTypeId(), RepairTaskStatusEnum.TASK_LOSS_ASSESSMENT_COMPLETE.getStatus(),
|
||||
null,thisMonthMaxOrder + 1, code);
|
||||
null, thisMonthMaxOrder + 1, code);
|
||||
tmTask.setCreateTime(DateUtils.getNowDate());
|
||||
tmTask.setCreateBy(createBy);
|
||||
// 插入任务
|
||||
|
|
@ -839,20 +852,20 @@ public class RepairServiceImpl implements RepairService {
|
|||
* 它首先检查提交的总维修数量是否超过实际维修数量,如果超过,则抛出异常
|
||||
* 如果本次维修完成了全部维修任务,则直接更新实际维修数量和报废数量,否则,更新本次维修和报废的数量
|
||||
*
|
||||
* @param bean 维修设备的视图对象,包含维修相关信息
|
||||
* @param bean 维修设备的视图对象,包含维修相关信息
|
||||
* @param innerRepairNum 内部维修数量
|
||||
* @param outerRepairNum 外部维修数量
|
||||
* @param scrapNum 报废数量
|
||||
* @param loginUser 当前登录用户信息,用于记录操作者
|
||||
* @param scrapNum 报废数量
|
||||
* @param loginUser 当前登录用户信息,用于记录操作者
|
||||
* @throws ServiceException 如果本次维修提交总数过大,则抛出此异常
|
||||
*/
|
||||
private void splitRepairDetailsToMultiple(RepairDeviceVO bean, BigDecimal innerRepairNum, BigDecimal outerRepairNum, BigDecimal scrapNum, LoginUser loginUser) {
|
||||
if (bean.getRepairNum().compareTo(innerRepairNum.add(outerRepairNum).add(scrapNum) ) < 0) {
|
||||
if (bean.getRepairNum().compareTo(innerRepairNum.add(outerRepairNum).add(scrapNum)) < 0) {
|
||||
throw new ServiceException("本次维修提交总数过大");
|
||||
}
|
||||
//本次修完了
|
||||
// TODO 2024-12-11 阮世耀:经过讨论 这里不管一次是否全部修完 都要先修复this 那么此判断是无意义的
|
||||
if ((bean.getRepairNum().subtract(innerRepairNum).subtract(outerRepairNum).subtract(scrapNum).compareTo(BigDecimal.valueOf(0)) ) == 0) {
|
||||
if ((bean.getRepairNum().subtract(innerRepairNum).subtract(outerRepairNum).subtract(scrapNum).compareTo(BigDecimal.valueOf(0))) == 0) {
|
||||
// TODO 2024-12-12 阮世耀:按逻辑来说 在审核之后才会PUT到真实的维修or报废数量,那么这里统一只修改this值
|
||||
// repairMapper.updateRepairedNum(bean.getId(), innerRepairNum.add(outerRepairNum) , loginUser.getUserid(), loginUser.getUserid());
|
||||
// repairMapper.updateScrapNum(bean.getId(), scrapNum, loginUser.getUserid());
|
||||
|
|
@ -869,8 +882,9 @@ public class RepairServiceImpl implements RepairService {
|
|||
|
||||
/**
|
||||
* 配件列表价格合计
|
||||
*
|
||||
* @param partList 配件列表
|
||||
* @param sfCosts 配件价格合计
|
||||
* @param sfCosts 配件价格合计
|
||||
* @return 配件合计后的价格
|
||||
*/
|
||||
private static BigDecimal countPartCosts(List<RepairPartDetails> partList, BigDecimal sfCosts) {
|
||||
|
|
@ -886,9 +900,10 @@ public class RepairServiceImpl implements RepairService {
|
|||
|
||||
/**
|
||||
* 处理配件集合数据
|
||||
* @param bean 维修申请单
|
||||
* @param partList 配件列表
|
||||
* @param loginUser 当前登录用户
|
||||
*
|
||||
* @param bean 维修申请单
|
||||
* @param partList 配件列表
|
||||
* @param loginUser 当前登录用户
|
||||
* @param manageType 管理方式:0编码管理 1数量管理
|
||||
*/
|
||||
private void copeNumberManageInList(RepairDeviceVO bean, List<RepairPartDetails> partList, LoginUser loginUser, Integer manageType) {
|
||||
|
|
@ -921,14 +936,16 @@ public class RepairServiceImpl implements RepairService {
|
|||
}
|
||||
repairApplyRecord.setCreateBy(loginUser.getSysUser().getNickName());
|
||||
repairApplyRecord.setStatus(0L);
|
||||
if(bean.getInRepairList()!=null){
|
||||
if (bean.getInRepairList() != null) {
|
||||
repairApplyRecord.setRemark(StringUtils.isNotBlank(bean.getInRepairList().get(0).getRemark()) ? bean.getInRepairList().get(0).getRemark() : "");
|
||||
}
|
||||
|
||||
if ((null != partDetails.getId() || null != partDetails.getPartId()) && null != partDetails.getPartNum()) {
|
||||
partDetails.setPartId(null != partDetails.getPartId() ? partDetails.getPartId() : partDetails.getId());
|
||||
// 有维修配件时,如果价格为空,设置为0
|
||||
if (null == partDetails.getPartCost()) {partDetails.setPartCost(BigDecimal.ZERO);}
|
||||
if (null == partDetails.getPartCost()) {
|
||||
partDetails.setPartCost(BigDecimal.ZERO);
|
||||
}
|
||||
|
||||
partDetails.setTaskId(bean.getTaskId()).setMaId(bean.getMaId()).setTypeId(bean.getTypeId()).setCompanyId(null);
|
||||
partDetails.setCreateBy(String.valueOf(loginUser.getUserid()));
|
||||
|
|
@ -989,7 +1006,7 @@ public class RepairServiceImpl implements RepairService {
|
|||
repairApplyRecord.setRepairNum(partList.get(0).getPartNum() != null ? BigDecimal.valueOf(partList.get(0).getPartNum()) : BigDecimal.ZERO);
|
||||
//查询定损是否把价格已经添加
|
||||
int count = repairMapper.getCostCount(repairApplyRecord);
|
||||
if (count<=0){
|
||||
if (count <= 0) {
|
||||
repairMapper.addRepairCost(repairApplyRecord, sfCosts, partList.get(0).getPartType().toString());
|
||||
}
|
||||
}
|
||||
|
|
@ -998,9 +1015,9 @@ public class RepairServiceImpl implements RepairService {
|
|||
if (RepairTypeEnum.RETURN_FACTORY.getTypeId().equals(bean.getRepairType())) {
|
||||
// ---------------校验维修数量-----------------
|
||||
// 统计已维修数量 + 本次维修数量
|
||||
BigDecimal repairNum = bean.getRepairedNum().add(bean.getRepairNum()) ;
|
||||
BigDecimal repairNum = bean.getRepairedNum().add(bean.getRepairNum());
|
||||
// 统计报废数量 + 维修合计数量 不能 大与> 总的待维修量
|
||||
if (repairNum.add(bean.getScrapNum()).compareTo(bean.getRepairNum())>0 ) {
|
||||
if (repairNum.add(bean.getScrapNum()).compareTo(bean.getRepairNum()) > 0) {
|
||||
throw new ServiceException("维修数量大于维修总量");
|
||||
}
|
||||
|
||||
|
|
@ -1008,7 +1025,7 @@ public class RepairServiceImpl implements RepairService {
|
|||
repairMapper.updateRepairedNumTwo(bean.getId(), repairNum, loginUser.getUserid());
|
||||
|
||||
// 编码管理--外部返厂维修
|
||||
if(partList!=null && partList.size()>0){
|
||||
if (partList != null && partList.size() > 0) {
|
||||
for (int i = 0; i < partList.size(); i++) {
|
||||
RepairApplyRecord repairApplyRecord = new RepairApplyRecord().setId(bean.getId()).setTaskId(bean.getTaskId()).setMaId(bean.getMaId())
|
||||
.setTypeId(bean.getTypeId()).setRepairType(RepairTypeEnum.RETURN_FACTORY.getTypeId())
|
||||
|
|
@ -1042,7 +1059,7 @@ public class RepairServiceImpl implements RepairService {
|
|||
repairApplyRecord.setRepairNum(partList.get(i).getPartNum() != null ? BigDecimal.valueOf(partList.get(i).getPartNum()) : BigDecimal.ZERO);
|
||||
//查询定损是否把价格已经添加
|
||||
int count = repairMapper.getCostCount(repairApplyRecord);
|
||||
if (count<=0){
|
||||
if (count <= 0) {
|
||||
repairMapper.addRepairCost(repairApplyRecord, sfCosts, partList.get(i).getPartType().toString());
|
||||
}
|
||||
}
|
||||
|
|
@ -1118,9 +1135,9 @@ public class RepairServiceImpl implements RepairService {
|
|||
BigDecimal scrapNum = BigDecimal.ZERO;
|
||||
String taskCode = "";
|
||||
for (RepairTaskDetails repairTaskDetails : detailsList) {
|
||||
repairedNum = repairedNum.add(repairTaskDetails.getRepairedNum());
|
||||
scrapNum = scrapNum.add(repairTaskDetails.getScrapNum());
|
||||
taskCode = repairTaskDetails.getTaskCode();
|
||||
repairedNum = repairedNum.add(repairTaskDetails.getRepairedNum());
|
||||
scrapNum = scrapNum.add(repairTaskDetails.getScrapNum());
|
||||
taskCode = repairTaskDetails.getTaskCode();
|
||||
}
|
||||
if (repairedNum.add(scrapNum).compareTo(BigDecimal.ZERO) == 0) {
|
||||
return AjaxResult.error("维修单号" + taskCode + "还未进行维修,请先维修后再提交审核!");
|
||||
|
|
@ -1195,7 +1212,7 @@ public class RepairServiceImpl implements RepairService {
|
|||
if (CollectionUtils.isEmpty(repairMapper.getAuditDetailsById(details))) {
|
||||
// 如果合格数和报废数都为0,则未进行维修,不插入审核表
|
||||
if (details.getRepairedNum().compareTo(BigDecimal.ZERO) == 0 &&
|
||||
details.getScrapNum().compareTo(BigDecimal.ZERO) == 0) {
|
||||
details.getScrapNum().compareTo(BigDecimal.ZERO) == 0) {
|
||||
continue;
|
||||
}
|
||||
result = repairMapper.addAuditDetails(details);
|
||||
|
|
@ -1237,6 +1254,7 @@ public class RepairServiceImpl implements RepairService {
|
|||
|
||||
/**
|
||||
* 获取前置任务详情
|
||||
*
|
||||
* @param repairTaskDetails
|
||||
* @return
|
||||
*/
|
||||
|
|
@ -1265,15 +1283,16 @@ public class RepairServiceImpl implements RepairService {
|
|||
private static RepairApplyDetails createRepairDetailsCope(RepairTaskDetails details) {
|
||||
RepairApplyDetails repairApplyDetails = new RepairApplyDetails();
|
||||
repairApplyDetails.setId(details.getId());
|
||||
repairApplyDetails.setRepairedNum( (details.getRepairedNum().add(details.getThisRepairedNum()) ));
|
||||
repairApplyDetails.setRepairedNum((details.getRepairedNum().add(details.getThisRepairedNum())));
|
||||
repairApplyDetails.setThisRepairedNum(BigDecimal.valueOf(0));
|
||||
repairApplyDetails.setScrapNum( (details.getScrapNum().add( details.getThisScrapNum())));
|
||||
repairApplyDetails.setScrapNum((details.getScrapNum().add(details.getThisScrapNum())));
|
||||
repairApplyDetails.setThisScrapNum(BigDecimal.valueOf(0));
|
||||
return repairApplyDetails;
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成维修审核单号
|
||||
*
|
||||
* @param thisMonthMaxOrder 当前月最大序号
|
||||
*/
|
||||
private String genderWsTaskCode(int thisMonthMaxOrder) {
|
||||
|
|
@ -1286,6 +1305,7 @@ public class RepairServiceImpl implements RepairService {
|
|||
|
||||
/**
|
||||
* 生成维修单号
|
||||
*
|
||||
* @param thisMonthMaxOrder
|
||||
* @return
|
||||
*/
|
||||
|
|
@ -1299,12 +1319,13 @@ public class RepairServiceImpl implements RepairService {
|
|||
|
||||
/**
|
||||
* 驳回维修申请
|
||||
*
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public AjaxResult rejectRepair(RepairTask bean) {
|
||||
public AjaxResult rejectRepair(RepairTask bean) {
|
||||
try {
|
||||
if (!CollectionUtils.isEmpty(bean.getTaskIds())) {
|
||||
for (Long taskId : bean.getTaskIds()) {
|
||||
|
|
@ -1406,6 +1427,7 @@ public class RepairServiceImpl implements RepairService {
|
|||
|
||||
/**
|
||||
* 驳回至退料详情方法抽取
|
||||
*
|
||||
* @param repairApplyDetails
|
||||
*/
|
||||
private void extractedByDetails(RepairApplyDetails repairApplyDetails) {
|
||||
|
|
@ -1450,6 +1472,7 @@ public class RepairServiceImpl implements RepairService {
|
|||
|
||||
/**
|
||||
* 驳回至退料任务单抽取
|
||||
*
|
||||
* @param taskId
|
||||
*/
|
||||
private void extractedTaskId(Long taskId) {
|
||||
|
|
@ -1492,6 +1515,7 @@ public class RepairServiceImpl implements RepairService {
|
|||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int batchQualified(ArrayList<Long> ids) {
|
||||
repairMapper.updateMaMachine(ids, SecurityUtils.getLoginUser().getSysUser().getNickName());
|
||||
return repairMapper.batchQualified(ids, SecurityUtils.getLoginUser().getSysUser().getNickName());
|
||||
}
|
||||
|
||||
|
|
@ -1518,6 +1542,7 @@ public class RepairServiceImpl implements RepairService {
|
|||
|
||||
/**
|
||||
* 获取维修明细列表
|
||||
*
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
|
|
@ -1573,7 +1598,7 @@ public class RepairServiceImpl implements RepairService {
|
|||
public List<RepairTaskDetails> getRepairCodeList(RepairTaskDetails bean) {
|
||||
try {
|
||||
return repairMapper.getRepairCodeList(bean);
|
||||
} catch (Exception e){
|
||||
} catch (Exception e) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
}
|
||||
|
|
@ -1588,7 +1613,7 @@ public class RepairServiceImpl implements RepairService {
|
|||
bean1.setUserName(SecurityUtils.getLoginUser().getSysUser().getNickName());
|
||||
//查询配件列表
|
||||
List<PartType> partList = repairMapper.getPartData(bean1);
|
||||
if(partList.size() > 0){
|
||||
if (partList.size() > 0) {
|
||||
bean1.setPartTypeList(partList);
|
||||
}
|
||||
}
|
||||
|
|
@ -1610,8 +1635,53 @@ public class RepairServiceImpl implements RepairService {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<RepairInspection> getRepairInspection(RepairInspection dto) {
|
||||
return repairMapper.getRepairInspection(dto);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<TestRecord> getTestRecord(TestRecord dto) {
|
||||
return repairMapper.getTestRecord(dto);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<RepairTaskDetails> getTestRecordDetails(TestRecord bean) {
|
||||
try {
|
||||
//查询
|
||||
List<RepairTaskDetails> list = repairMapper.getTestRecordDetails(bean);
|
||||
if (list.size() > 0) {
|
||||
for (RepairTaskDetails bean1 : list) {
|
||||
bean1.setUserName(SecurityUtils.getLoginUser().getSysUser().getNickName());
|
||||
//查询配件列表
|
||||
List<PartType> partList = repairMapper.getPartDetails(bean1);
|
||||
if (partList.size() > 0) {
|
||||
bean1.setPartTypeList(partList);
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
} catch (Exception e) {
|
||||
log.error("查询试验记录表", e.getMessage());
|
||||
return new ArrayList<>();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询修试查询-维修配件查询列表
|
||||
*
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
|
|
@ -1642,6 +1712,7 @@ public class RepairServiceImpl implements RepairService {
|
|||
|
||||
/**
|
||||
* 查询修试查询-维修配件查询二级列表
|
||||
*
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
|
|
@ -1661,6 +1732,7 @@ public class RepairServiceImpl implements RepairService {
|
|||
|
||||
/**
|
||||
* 判断维修配件查询二级列表是否包含关键字
|
||||
*
|
||||
* @param item
|
||||
* @param keyWord
|
||||
* @return
|
||||
|
|
@ -1672,6 +1744,7 @@ public class RepairServiceImpl implements RepairService {
|
|||
|
||||
/**
|
||||
* 判断维修配件查询列表是否包含关键字
|
||||
*
|
||||
* @param item
|
||||
* @param keyWord
|
||||
* @return
|
||||
|
|
|
|||
|
|
@ -1129,6 +1129,144 @@
|
|||
GROUP BY rad.id
|
||||
order by rad.create_time desc
|
||||
</select>
|
||||
<select id="getRepairInspection" resultType="com.bonus.material.repair.domain.vo.RepairInspection">
|
||||
SELECT tt.`code` AS repairCode,
|
||||
bu.unit_name AS backUnitName,
|
||||
bp.pro_name AS projectName,
|
||||
mt2.type_name AS typeName,
|
||||
mt1.type_name AS typeModelName,
|
||||
mt1.sampling_ratio * SUM(rad.repair_num) / 100 AS num,
|
||||
mt1.sampling_ratio AS samplingRatio,
|
||||
mt1.rated_load AS ratedLoad,
|
||||
mt1.test_load AS testLoad,
|
||||
mt1.holding_time AS holdingTime,
|
||||
mm.ma_code AS maCode,
|
||||
mt1.unit_name AS unitName,
|
||||
SUM(rad.repair_num) AS repairNum,
|
||||
SUM(rad.repair_num) AS expNum,
|
||||
rad.task_id AS taskId,
|
||||
rad.type_id AS typeId,
|
||||
rad.ma_id AS maId,
|
||||
rad.create_time AS repairTime
|
||||
FROM repair_apply_details rad
|
||||
LEFT JOIN repair_audit_details rd ON rad.id = rd.repair_id
|
||||
LEFT JOIN tm_task tt ON tt.task_id = rad.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
|
||||
AND bagi.`status` = '1'
|
||||
LEFT JOIN bm_project bp ON bp.pro_id = bagi.project_id
|
||||
AND bp.del_flag = '0'
|
||||
LEFT JOIN bm_unit bu ON bu.unit_id = bagi.unit_id
|
||||
AND bu.del_flag = '0'
|
||||
LEFT JOIN ma_type mt1 ON mt1.type_id = rad.type_id
|
||||
AND mt1.del_flag = '0'
|
||||
LEFT JOIN ma_type mt2 ON mt2.type_id = mt1.parent_id
|
||||
AND mt2.del_flag = '0'
|
||||
LEFT JOIN ma_machine mm ON rad.ma_id = mm.ma_id
|
||||
WHERE rd.`status` = '1'
|
||||
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
|
||||
<![CDATA[and DATE_FORMAT( rad.create_time, '%Y-%m-%d' ) BETWEEN #{startTime} AND #{endTime} ]]>
|
||||
</if>
|
||||
<if test="unitId != null and unitId != ''">
|
||||
and bu.unit_id = #{unitId}
|
||||
</if>
|
||||
<if test="proId != null and proId != ''">
|
||||
and bp.pro_id = #{proId}
|
||||
</if>
|
||||
<if test="typeName != null and typeName != ''">
|
||||
and mt2.type_name like CONCAT('%', #{typeName}, '%')
|
||||
</if>
|
||||
<if test="keyWord != null and keyWord != ''">
|
||||
and (mt2.type_name like CONCAT('%', #{keyWord}, '%') OR tt.`code` like CONCAT('%', #{keyWord}, '%') OR
|
||||
mt1.type_name like CONCAT('%', #{keyWord}, '%'))
|
||||
</if>
|
||||
GROUP BY typeName, typeModelName, repairCode
|
||||
</select>
|
||||
<select id="getTestRecord" resultType="com.bonus.material.repair.domain.vo.TestRecord">
|
||||
SELECT
|
||||
rad.id AS id,
|
||||
tt.`code` AS repairCode,
|
||||
bu.unit_name AS backUnitName,
|
||||
bp.pro_name AS projectName,
|
||||
mt2.type_name AS typeName,
|
||||
mt1.type_name AS typeModelName,
|
||||
rad.create_time AS repairTime ,
|
||||
mm.ma_code AS maCode
|
||||
FROM
|
||||
repair_apply_details rad
|
||||
LEFT JOIN repair_audit_details rd ON rad.id = rd.repair_id
|
||||
LEFT JOIN tm_task tt ON tt.task_id = rad.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
|
||||
AND bagi.`status` = '1'
|
||||
LEFT JOIN bm_project bp ON bp.pro_id = bagi.project_id
|
||||
AND bp.del_flag = '0'
|
||||
LEFT JOIN bm_unit bu ON bu.unit_id = bagi.unit_id
|
||||
AND bu.del_flag = '0'
|
||||
LEFT JOIN ma_type mt1 ON mt1.type_id = rad.type_id
|
||||
AND mt1.del_flag = '0'
|
||||
LEFT JOIN ma_type mt2 ON mt2.type_id = mt1.parent_id
|
||||
AND mt2.del_flag = '0'
|
||||
LEFT JOIN ma_machine mm ON rad.ma_id = mm.ma_id
|
||||
WHERE
|
||||
rd.`status` = '1' and mt1.manage_type='0'
|
||||
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
|
||||
<![CDATA[and DATE_FORMAT( rad.create_time, '%Y-%m-%d' ) BETWEEN #{startTime} AND #{endTime} ]]>
|
||||
</if>
|
||||
<if test="unitId != null and unitId != ''">
|
||||
and bu.unit_id = #{unitId}
|
||||
</if>
|
||||
<if test="proId != null and proId != ''">
|
||||
and bp.pro_id = #{proId}
|
||||
</if>
|
||||
<if test="typeName != null and typeName != ''">
|
||||
and mt2.type_name like CONCAT('%', #{typeName}, '%')
|
||||
</if>
|
||||
<if test="keyWord != null and keyWord != ''">
|
||||
and (mt2.type_name like CONCAT('%', #{keyWord}, '%') OR tt.`code` like CONCAT('%', #{keyWord}, '%') OR
|
||||
mt1.type_name like CONCAT('%', #{keyWord}, '%') OR mm.ma_code like CONCAT('%', #{keyWord}, '%'))
|
||||
</if>
|
||||
GROUP BY typeName, typeModelName, repairCode,maCode
|
||||
</select>
|
||||
<select id="getTestRecordDetails" resultType="com.bonus.material.repair.domain.RepairTaskDetails">
|
||||
SELECT
|
||||
rad.id,
|
||||
rad.type_id as typeId,
|
||||
mt.type_name as type,
|
||||
mt2.type_name as typeName,
|
||||
CONCAT(bai.`code`, '-', rad.`level`) as `code`,
|
||||
mm.ma_code as maCode,
|
||||
su.nick_name as repairer,
|
||||
DATE_FORMAT(rad.update_time,'%Y-%m-%d') as createTime,
|
||||
mt.rated_load as ratedLoad,
|
||||
mt.test_load as testLoad,
|
||||
mt.holding_time as holdingTime,
|
||||
rad.scrap_num as scrapNum
|
||||
FROM
|
||||
repair_apply_details rad
|
||||
LEFT JOIN ma_type mt on mt.type_id=rad.type_id
|
||||
LEFT JOIN ma_type mt2 on mt2.type_id=mt.parent_id
|
||||
LEFT JOIN back_apply_info bai on bai.id=rad.back_id
|
||||
LEFT JOIN ma_machine mm on mm.ma_id=rad.ma_id
|
||||
LEFT JOIN sys_user su on su.user_id=rad.repairer
|
||||
WHERE
|
||||
rad.id=#{id}
|
||||
</select>
|
||||
<select id="getPartDetails" resultType="com.bonus.material.ma.domain.PartType">
|
||||
SELECT rar.part_id as id,
|
||||
mpt2.pa_name as partName
|
||||
|
||||
FROM repair_apply_record rar
|
||||
LEFT JOIN repair_apply_details rad
|
||||
on rad.task_id = rar.task_id and rad.type_id = rar.type_id and rad.ma_id = rar.ma_id
|
||||
LEFT JOIN ma_part_type mpt on mpt.pa_id = rar.part_id
|
||||
LEFT JOIN ma_part_type mpt2 on mpt2.pa_id = mpt.parent_id
|
||||
LEFT JOIN ma_part_type mpt3 on mpt2.parent_id = mpt.parent_id
|
||||
WHERE rad.id = #{id}
|
||||
and rar.is_ds = 0
|
||||
and rar.part_id IS NOT NULL
|
||||
and mpt2.pa_name IS NOT NULL
|
||||
</select>
|
||||
|
||||
<update id="updateRepairedAndScrapNum">
|
||||
update
|
||||
|
|
@ -1181,4 +1319,24 @@
|
|||
where
|
||||
id=#{id}
|
||||
</update>
|
||||
<update id="updateMaMachine">
|
||||
UPDATE ma_machine
|
||||
SET this_check_time = NOW(),
|
||||
next_check_time = DATE_SUB(DATE_ADD(NOW(), INTERVAL 1 YEAR), INTERVAL 1 DAY),
|
||||
check_man = #{userName},
|
||||
update_time = NOW()
|
||||
WHERE ma_id IN (
|
||||
SELECT DISTINCT rad.ma_id
|
||||
FROM repair_apply_details rad
|
||||
INNER JOIN ma_type mt ON mt.type_id = rad.type_id
|
||||
WHERE mt.manage_type = 0
|
||||
AND mt.jiju_type = 1
|
||||
AND rad.id IN
|
||||
<foreach item="id" collection="ids" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
|
||||
)
|
||||
|
||||
</update>
|
||||
</mapper>
|
||||
|
|
|
|||
Loading…
Reference in New Issue