问题修改
This commit is contained in:
parent
3a0500117e
commit
cf547a0424
|
|
@ -28,6 +28,8 @@ import org.springframework.transaction.annotation.Transactional;
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.ZoneId;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
import static com.bonus.common.biz.constant.MaterialConstants.ADMIN_ID;
|
import static com.bonus.common.biz.constant.MaterialConstants.ADMIN_ID;
|
||||||
|
|
@ -93,9 +95,12 @@ public class BackChangeServiceImpl implements BackChangeService {
|
||||||
)
|
)
|
||||||
public AjaxResult addDevDetails(BackCsDeviceVo csDeviceVo) {
|
public AjaxResult addDevDetails(BackCsDeviceVo csDeviceVo) {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
|
||||||
if (csDeviceVo == null || csDeviceVo.getDevInfo() == null || CollectionUtils.isEmpty(csDeviceVo.getDevDetailsList())) {
|
if (csDeviceVo == null || csDeviceVo.getDevInfo() == null || CollectionUtils.isEmpty(csDeviceVo.getDevDetailsList())) {
|
||||||
return AjaxResult.error("请选择需要添加的设备");
|
return AjaxResult.error("请选择需要添加的设备");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 判断提交的数据csDeviceVo.getDevDetailsList()中是否存在相同编号或者数量设备typeId相同的数据
|
// 判断提交的数据csDeviceVo.getDevDetailsList()中是否存在相同编号或者数量设备typeId相同的数据
|
||||||
Set<String> devCodeSet = new HashSet<>();
|
Set<String> devCodeSet = new HashSet<>();
|
||||||
Set<Long> typeIdSet = new HashSet<>();
|
Set<Long> typeIdSet = new HashSet<>();
|
||||||
|
|
@ -104,6 +109,18 @@ public class BackChangeServiceImpl implements BackChangeService {
|
||||||
if (details == null) {
|
if (details == null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
Date updateTime = details.getUpdateTime();
|
||||||
|
LocalDate updateLocalDate = updateTime.toInstant()
|
||||||
|
.atZone(ZoneId.systemDefault()) // 转换为带时区的ZonedDateTime
|
||||||
|
.toLocalDate(); // 提取日期部分
|
||||||
|
|
||||||
|
// 步骤2:获取useTime并比较
|
||||||
|
LocalDate useTime = details.getUseTime();
|
||||||
|
|
||||||
|
boolean isUseTimeGreater = !useTime.isBefore(updateLocalDate);
|
||||||
|
if (!isUseTimeGreater) {
|
||||||
|
throw new RuntimeException(details.getTypeName() + ",退库日期不能早于出库日期");
|
||||||
|
}
|
||||||
// 编码重复
|
// 编码重复
|
||||||
String devCode = details.getDevCode();
|
String devCode = details.getDevCode();
|
||||||
if (!devCode.equals("/") && StringUtils.isNotBlank(devCode) && devCodeSet.contains(devCode)) {
|
if (!devCode.equals("/") && StringUtils.isNotBlank(devCode) && devCodeSet.contains(devCode)) {
|
||||||
|
|
@ -150,7 +167,7 @@ public class BackChangeServiceImpl implements BackChangeService {
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error(e.getMessage());
|
log.error(e.getMessage());
|
||||||
throw new RuntimeException("添加失败");
|
throw new RuntimeException(e.getMessage());
|
||||||
}
|
}
|
||||||
return AjaxResult.success("退库申请提交成功,等待审批", csDeviceVo.getDevInfo().getId());
|
return AjaxResult.success("退库申请提交成功,等待审批", csDeviceVo.getDevInfo().getId());
|
||||||
}
|
}
|
||||||
|
|
@ -539,6 +556,7 @@ public class BackChangeServiceImpl implements BackChangeService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生成维修任务编号
|
* 生成维修任务编号
|
||||||
|
*
|
||||||
* @param thisMonthMaxOrder
|
* @param thisMonthMaxOrder
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -9,16 +9,21 @@ package com.bonus.material.devConfig.controller;
|
||||||
// EquipmentTypeController.java
|
// EquipmentTypeController.java
|
||||||
|
|
||||||
|
|
||||||
|
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.domain.AjaxResult;
|
||||||
import com.bonus.material.devConfig.domain.PageResult;
|
import com.bonus.common.core.web.page.TableDataInfo;
|
||||||
import com.bonus.material.devConfig.domain.EquipmentTypeDTO;
|
import com.bonus.material.devConfig.domain.*;
|
||||||
import com.bonus.material.devConfig.domain.EquipmentType;
|
|
||||||
import com.bonus.material.devConfig.domain.EquipmentTypeQuery;
|
|
||||||
import com.bonus.material.devConfig.service.EquipmentTypeService;
|
import com.bonus.material.devConfig.service.EquipmentTypeService;
|
||||||
|
import com.bonus.material.device.domain.vo.DevInfoVo;
|
||||||
|
import com.bonus.material.toolProcess.domain.ToolApplyEntity;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -26,7 +31,7 @@ import java.util.List;
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/equipment/type")
|
@RequestMapping("/equipment/type")
|
||||||
public class EquipmentTypeController {
|
public class EquipmentTypeController extends BaseController {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private EquipmentTypeService equipmentTypeService;
|
private EquipmentTypeService equipmentTypeService;
|
||||||
|
|
@ -47,10 +52,26 @@ public class EquipmentTypeController {
|
||||||
|
|
||||||
//获取列表
|
//获取列表
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public AjaxResult getEquipmentTypeList(EquipmentTypeQuery query) {
|
public TableDataInfo getEquipmentTypeList(EquipmentTypeEntity query) {
|
||||||
PageResult<EquipmentType> result = equipmentTypeService.getEquipmentTypeList(query);
|
try {
|
||||||
return AjaxResult.success(result);
|
startPage();
|
||||||
|
List<EquipmentTypeEntity> list = equipmentTypeService.getEquipmentTypeList(query);
|
||||||
|
return getDataTable(list);
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error(e.toString(), e);
|
||||||
}
|
}
|
||||||
|
return getDataTableError(new ArrayList<>());
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取列表
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(HttpServletResponse response, EquipmentTypeEntity query) {
|
||||||
|
List<EquipmentTypeEntity> list = equipmentTypeService.getEquipmentTypeList(query);
|
||||||
|
ExcelUtil<EquipmentTypeEntity> util = new ExcelUtil<>(EquipmentTypeEntity.class);
|
||||||
|
util.exportExcel(response, list, "装备类型数据");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//获取详细信息
|
//获取详细信息
|
||||||
@GetMapping("/detail/{id}")
|
@GetMapping("/detail/{id}")
|
||||||
|
|
|
||||||
|
|
@ -82,4 +82,5 @@ public class EquipmentType {
|
||||||
* 删除标志(0代表存在 2代表删除),默认值0
|
* 删除标志(0代表存在 2代表删除),默认值0
|
||||||
*/
|
*/
|
||||||
private String delFlag = "0";
|
private String delFlag = "0";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -0,0 +1,92 @@
|
||||||
|
package com.bonus.material.devConfig.domain;
|
||||||
|
|
||||||
|
import com.bonus.common.core.annotation.Excel;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class EquipmentTypeEntity implements Serializable {
|
||||||
|
/**
|
||||||
|
* 订单id
|
||||||
|
*/
|
||||||
|
private Integer typeId;
|
||||||
|
/**
|
||||||
|
* 专业Id
|
||||||
|
* 说明:装备所属的专业领域(如机械、电子、建筑等)
|
||||||
|
*/
|
||||||
|
private Integer majorId;
|
||||||
|
/**
|
||||||
|
* 专业
|
||||||
|
* 说明:装备所属的专业领域(如机械、电子、建筑等)
|
||||||
|
*/
|
||||||
|
@Excel(name = "所属专业")
|
||||||
|
private String major;
|
||||||
|
/**
|
||||||
|
* 主工序id
|
||||||
|
*/
|
||||||
|
private Integer mainProcessId;
|
||||||
|
/**
|
||||||
|
* 主工序
|
||||||
|
* 说明:装备主要参与的工序环节
|
||||||
|
*/
|
||||||
|
@Excel(name = "施工主工序")
|
||||||
|
private String mainProcess;
|
||||||
|
/**
|
||||||
|
* 子工序id
|
||||||
|
* 说明:装备参与的具体子工序
|
||||||
|
*/
|
||||||
|
private Integer subProcessId;
|
||||||
|
/**
|
||||||
|
* 子工序
|
||||||
|
* 说明:装备参与的具体子工序
|
||||||
|
*/
|
||||||
|
@Excel(name = "施工子工序")
|
||||||
|
private String subProcess;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 装备大类目id
|
||||||
|
* 说明:装备所属的一级分类(如工程机械、仪器仪表等)
|
||||||
|
*/
|
||||||
|
private Integer mainCategoryId;
|
||||||
|
/**
|
||||||
|
* 装备大类目
|
||||||
|
* 说明:装备所属的一级分类(如工程机械、仪器仪表等)
|
||||||
|
*/
|
||||||
|
@Excel(name = "装备大类")
|
||||||
|
private String mainCategory;
|
||||||
|
/**
|
||||||
|
* 装备小类目id
|
||||||
|
* 说明:装备所属的二级分类,主类目下的细分分类
|
||||||
|
*/
|
||||||
|
private Integer subCategoryId;
|
||||||
|
/**
|
||||||
|
* 装备小类目
|
||||||
|
* 说明:装备所属的二级分类,主类目下的细分分类
|
||||||
|
*/
|
||||||
|
@Excel(name = "装备小类")
|
||||||
|
private String subCategory;
|
||||||
|
/**
|
||||||
|
* 装备分支id
|
||||||
|
* 说明:小类目下的更细分类,代表具体的装备类型分支
|
||||||
|
*/
|
||||||
|
private Integer branchId;
|
||||||
|
/**
|
||||||
|
* 装备分支
|
||||||
|
* 说明:小类目下的更细分类,代表具体的装备类型分支
|
||||||
|
*/
|
||||||
|
@Excel(name = "类型分支")
|
||||||
|
private String branch;
|
||||||
|
/**
|
||||||
|
* 关键字
|
||||||
|
*/
|
||||||
|
private String keyWord;
|
||||||
|
/**
|
||||||
|
* 级别
|
||||||
|
*/
|
||||||
|
private String actualLevel;
|
||||||
|
}
|
||||||
|
|
@ -3,6 +3,7 @@ package com.bonus.material.devConfig.mapper;
|
||||||
// EquipmentTypeMapper.java
|
// EquipmentTypeMapper.java
|
||||||
|
|
||||||
import com.bonus.material.devConfig.domain.EquipmentType;
|
import com.bonus.material.devConfig.domain.EquipmentType;
|
||||||
|
import com.bonus.material.devConfig.domain.EquipmentTypeEntity;
|
||||||
import com.bonus.material.devConfig.domain.EquipmentTypeQuery;
|
import com.bonus.material.devConfig.domain.EquipmentTypeQuery;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
@ -18,7 +19,7 @@ public interface EquipmentTypeMapper {
|
||||||
/**
|
/**
|
||||||
* 查询装备分类列表
|
* 查询装备分类列表
|
||||||
*/
|
*/
|
||||||
List<EquipmentType> selectEquipmentTypeList(EquipmentTypeQuery query);
|
List<EquipmentTypeEntity> selectEquipmentTypeList(EquipmentTypeEntity query);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询装备分类数量
|
* 查询装备分类数量
|
||||||
|
|
|
||||||
|
|
@ -4,10 +4,7 @@ package com.bonus.material.devConfig.service;
|
||||||
|
|
||||||
|
|
||||||
import com.bonus.common.core.web.domain.AjaxResult;
|
import com.bonus.common.core.web.domain.AjaxResult;
|
||||||
import com.bonus.material.devConfig.domain.PageResult;
|
import com.bonus.material.devConfig.domain.*;
|
||||||
import com.bonus.material.devConfig.domain.EquipmentTypeDTO;
|
|
||||||
import com.bonus.material.devConfig.domain.EquipmentType;
|
|
||||||
import com.bonus.material.devConfig.domain.EquipmentTypeQuery;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
@ -20,7 +17,7 @@ public interface EquipmentTypeService {
|
||||||
|
|
||||||
List<EquipmentTypeDTO> getEquipmentCascader();
|
List<EquipmentTypeDTO> getEquipmentCascader();
|
||||||
|
|
||||||
PageResult<EquipmentType> getEquipmentTypeList(EquipmentTypeQuery query);
|
List<EquipmentTypeEntity> getEquipmentTypeList(EquipmentTypeEntity query);
|
||||||
|
|
||||||
EquipmentType getEquipmentTypeDetail(Long id);
|
EquipmentType getEquipmentTypeDetail(Long id);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,11 +2,8 @@ package com.bonus.material.devConfig.service.impl;
|
||||||
|
|
||||||
import com.bonus.common.core.utils.StringUtils;
|
import com.bonus.common.core.utils.StringUtils;
|
||||||
import com.bonus.common.core.web.domain.AjaxResult;
|
import com.bonus.common.core.web.domain.AjaxResult;
|
||||||
import com.bonus.material.devConfig.domain.PageResult;
|
import com.bonus.material.devConfig.domain.*;
|
||||||
import com.bonus.material.devConfig.domain.EquipmentTypeDTO;
|
|
||||||
import com.bonus.material.devConfig.domain.EquipmentType;
|
|
||||||
import com.bonus.material.devConfig.mapper.EquipmentTypeMapper;
|
import com.bonus.material.devConfig.mapper.EquipmentTypeMapper;
|
||||||
import com.bonus.material.devConfig.domain.EquipmentTypeQuery;
|
|
||||||
import com.bonus.material.devConfig.service.EquipmentTypeService;
|
import com.bonus.material.devConfig.service.EquipmentTypeService;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
@ -39,15 +36,8 @@ public class EquipmentTypeServiceImpl implements EquipmentTypeService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageResult<EquipmentType> getEquipmentTypeList(EquipmentTypeQuery query) {
|
public List<EquipmentTypeEntity> getEquipmentTypeList(EquipmentTypeEntity query) {
|
||||||
// 计算offset,修正分页参数
|
return equipmentTypeMapper.selectEquipmentTypeList(query);
|
||||||
if (query.getPageNum() != null && query.getPageSize() != null) {
|
|
||||||
query.setOffset((query.getPageNum() - 1) * query.getPageSize());
|
|
||||||
}
|
|
||||||
|
|
||||||
List<EquipmentType> list = equipmentTypeMapper.selectEquipmentTypeList(query);
|
|
||||||
Long total = equipmentTypeMapper.countEquipmentTypeList(query);
|
|
||||||
return new PageResult<>(total, list, query.getPageNum(), query.getPageSize());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -93,8 +93,6 @@ public class CsDeviceDetails {
|
||||||
|
|
||||||
@ApiModelProperty(value = "数据所属组织")
|
@ApiModelProperty(value = "数据所属组织")
|
||||||
private Long companyId;
|
private Long companyId;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 下次维保日期
|
* 下次维保日期
|
||||||
*/
|
*/
|
||||||
|
|
@ -105,4 +103,6 @@ public class CsDeviceDetails {
|
||||||
|
|
||||||
private String remainingYears;
|
private String remainingYears;
|
||||||
|
|
||||||
|
private String proCode;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -298,4 +298,8 @@ public interface DevChangeMapper {
|
||||||
|
|
||||||
|
|
||||||
BigDecimal getToolNum(CsDeviceDetails entity);
|
BigDecimal getToolNum(CsDeviceDetails entity);
|
||||||
|
|
||||||
|
BigDecimal getMaNum(CsDeviceDetails entity);
|
||||||
|
|
||||||
|
DevChangeVo getChange(CsDeviceChangeDetailsVo vo);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -539,6 +539,17 @@ public class DevChangeServiceImpl implements DevChangeService {
|
||||||
try {
|
try {
|
||||||
//装备
|
//装备
|
||||||
if (entity.getDevType().equals("1")) {
|
if (entity.getDevType().equals("1")) {
|
||||||
|
BigDecimal toolNum = mapper.getMaNum(entity);
|
||||||
|
if (toolNum.compareTo(entity.getOutNum()) < 0) {
|
||||||
|
// 库存不足,计算差额
|
||||||
|
BigDecimal shortage = entity.getOutNum().subtract(toolNum);
|
||||||
|
return AjaxResult.error(String.format(
|
||||||
|
"库存不足!当前可用:%s,需要出库:%s,短缺:%s",
|
||||||
|
toolNum.stripTrailingZeros().toPlainString(),
|
||||||
|
entity.getOutNum().stripTrailingZeros().toPlainString(),
|
||||||
|
shortage.stripTrailingZeros().toPlainString()
|
||||||
|
));
|
||||||
|
}
|
||||||
mapper.updateZb(entity);
|
mapper.updateZb(entity);
|
||||||
} else {
|
} else {
|
||||||
BigDecimal toolNum = mapper.getToolNum(entity);
|
BigDecimal toolNum = mapper.getToolNum(entity);
|
||||||
|
|
@ -621,6 +632,20 @@ public class DevChangeServiceImpl implements DevChangeService {
|
||||||
shortage.stripTrailingZeros().toPlainString()
|
shortage.stripTrailingZeros().toPlainString()
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
// 工器具需要检查库存
|
||||||
|
BigDecimal toolNum = mapper.getMaNum(item); // 注意:参数应该是 item
|
||||||
|
BigDecimal outNum = item.getOutNum();
|
||||||
|
if (toolNum.compareTo(outNum) < 0) {
|
||||||
|
BigDecimal shortage = outNum.subtract(toolNum);
|
||||||
|
return AjaxResult.error(String.format(
|
||||||
|
"库存不足! 装备:%s,当前可用:%s,需要出库:%s,短缺:%s",
|
||||||
|
item.getTypeName(),
|
||||||
|
toolNum.stripTrailingZeros().toPlainString(),
|
||||||
|
outNum.stripTrailingZeros().toPlainString(),
|
||||||
|
shortage.stripTrailingZeros().toPlainString()
|
||||||
|
));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1129,6 +1154,8 @@ public class DevChangeServiceImpl implements DevChangeService {
|
||||||
@Override
|
@Override
|
||||||
public List<DevChangeVo> getDevDetails(CsDeviceChangeDetailsVo vo) {
|
public List<DevChangeVo> getDevDetails(CsDeviceChangeDetailsVo vo) {
|
||||||
try {
|
try {
|
||||||
|
DevChangeVo entity = mapper.getChange(vo);
|
||||||
|
vo.setType(entity.getType());
|
||||||
List<DevChangeVo> list = mapper.getDevDetails(vo);
|
List<DevChangeVo> list = mapper.getDevDetails(vo);
|
||||||
for (DevChangeVo devChangeVo : list) {
|
for (DevChangeVo devChangeVo : list) {
|
||||||
if (devChangeVo.getWorkingHours() == null) {
|
if (devChangeVo.getWorkingHours() == null) {
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,12 @@ public class MaDevQc extends BaseEntity implements Serializable {
|
||||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||||
private Date nextCheckTime;
|
private Date nextCheckTime;
|
||||||
|
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "上次检验日期")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||||
|
private Date upCheckTime;
|
||||||
|
|
||||||
@ApiModelProperty(value = "质检编码")
|
@ApiModelProperty(value = "质检编码")
|
||||||
private String qcCode;
|
private String qcCode;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -81,7 +81,7 @@ public interface DevMergeMapper {
|
||||||
|
|
||||||
List<MaDevInfo> getDeviceByOrderId(MaDevInfo o);
|
List<MaDevInfo> getDeviceByOrderId(MaDevInfo o);
|
||||||
|
|
||||||
void interFile(MaDevFile item);
|
Integer interFile(MaDevFile item);
|
||||||
|
|
||||||
Integer updateDeviceByMaId(MaDevInfo maDevInfo);
|
Integer updateDeviceByMaId(MaDevInfo maDevInfo);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -449,7 +449,9 @@ public class DevMergeServiceImpl implements DevMergeService {
|
||||||
list = list.stream().filter(item -> StringUtils.isNotBlank(item.getProfession())).collect(Collectors.toList());
|
list = list.stream().filter(item -> StringUtils.isNotBlank(item.getProfession())).collect(Collectors.toList());
|
||||||
|
|
||||||
// 3. 再次检查过滤后是否有有效数据
|
// 3. 再次检查过滤后是否有有效数据
|
||||||
if (list.isEmpty()) {return AjaxResult.error("表格内没有有效数据");}
|
if (list.isEmpty()) {
|
||||||
|
return AjaxResult.error("表格内没有有效数据");
|
||||||
|
}
|
||||||
|
|
||||||
if (ObjectUtil.isEmpty(orderId)) {
|
if (ObjectUtil.isEmpty(orderId)) {
|
||||||
DevMergeVo o = new DevMergeVo();
|
DevMergeVo o = new DevMergeVo();
|
||||||
|
|
@ -488,7 +490,10 @@ public class DevMergeServiceImpl implements DevMergeService {
|
||||||
if (item.getProductionDate() != null && item.getPurchaseDate() != null && item.getProductionDate().after(item.getPurchaseDate())) {
|
if (item.getProductionDate() != null && item.getPurchaseDate() != null && item.getProductionDate().after(item.getPurchaseDate())) {
|
||||||
rowError.append("生产日期不能晚于采购日期;");
|
rowError.append("生产日期不能晚于采购日期;");
|
||||||
}
|
}
|
||||||
|
Integer typeId = devMergeMapper.getTypeId(item.getProfession());
|
||||||
|
if (ObjectUtil.isEmpty(typeId)) {
|
||||||
|
rowError.append("请选择类别");
|
||||||
|
}
|
||||||
// 4.5 若当前行有错误,记录并继续校验其他行
|
// 4.5 若当前行有错误,记录并继续校验其他行
|
||||||
if (rowError.length() > ("第" + (i + 1) + "行:").length()) {
|
if (rowError.length() > ("第" + (i + 1) + "行:").length()) {
|
||||||
errorMessages.add(rowError.toString());
|
errorMessages.add(rowError.toString());
|
||||||
|
|
@ -498,7 +503,7 @@ public class DevMergeServiceImpl implements DevMergeService {
|
||||||
// 5. 校验通过,执行导入逻辑
|
// 5. 校验通过,执行导入逻辑
|
||||||
try {
|
try {
|
||||||
MaDevInfo maDevInfo = new MaDevInfo();
|
MaDevInfo maDevInfo = new MaDevInfo();
|
||||||
Integer typeId = devMergeMapper.getTypeId(item.getProfession());
|
|
||||||
maDevInfo.setTypeId(typeId);
|
maDevInfo.setTypeId(typeId);
|
||||||
maDevInfo.setProductionDate(item.getProductionDate());
|
maDevInfo.setProductionDate(item.getProductionDate());
|
||||||
maDevInfo.setPurchaseDate(item.getPurchaseDate());
|
maDevInfo.setPurchaseDate(item.getPurchaseDate());
|
||||||
|
|
@ -743,7 +748,7 @@ public class DevMergeServiceImpl implements DevMergeService {
|
||||||
// 4. 核心:递归遍历所有层级,找出所有Apply-开头的目录
|
// 4. 核心:递归遍历所有层级,找出所有Apply-开头的目录
|
||||||
Set<File> applyFolders = new HashSet<>();
|
Set<File> applyFolders = new HashSet<>();
|
||||||
findAllApplyFolders(tempUnzipDir, applyFolders);
|
findAllApplyFolders(tempUnzipDir, applyFolders);
|
||||||
|
Integer num = 0;
|
||||||
// 5. 遍历所有Apply-目录并处理
|
// 5. 遍历所有Apply-目录并处理
|
||||||
for (File applyFolder : applyFolders) {
|
for (File applyFolder : applyFolders) {
|
||||||
String applyFolderName = applyFolder.getName();
|
String applyFolderName = applyFolder.getName();
|
||||||
|
|
@ -786,7 +791,7 @@ public class DevMergeServiceImpl implements DevMergeService {
|
||||||
// 这里编写对每个 image 的处理逻辑,比如打印、处理等
|
// 这里编写对每个 image 的处理逻辑,比如打印、处理等
|
||||||
item.setFileUrl(url);
|
item.setFileUrl(url);
|
||||||
item.setCreator(Math.toIntExact(SecurityUtils.getLoginUser().getUserid()));
|
item.setCreator(Math.toIntExact(SecurityUtils.getLoginUser().getUserid()));
|
||||||
devMergeMapper.interFile(item);
|
num += devMergeMapper.interFile(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -812,6 +817,10 @@ public class DevMergeServiceImpl implements DevMergeService {
|
||||||
if (totalRootFolder == 0) {
|
if (totalRootFolder == 0) {
|
||||||
return AjaxResult.error(400, "未找到有效的Apply-开头的目录");
|
return AjaxResult.error(400, "未找到有效的Apply-开头的目录");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (num == 0) {
|
||||||
|
return AjaxResult.error(400, "无数据导入,请检查模板");
|
||||||
|
}
|
||||||
result.put("code", 200);
|
result.put("code", 200);
|
||||||
result.put("msg", "ZIP包解压完成(识别到" + totalRootFolder + "个Apply-目录)");
|
result.put("msg", "ZIP包解压完成(识别到" + totalRootFolder + "个Apply-目录)");
|
||||||
result.put("totalRootFolder", totalRootFolder);
|
result.put("totalRootFolder", totalRootFolder);
|
||||||
|
|
|
||||||
|
|
@ -508,7 +508,6 @@ public class RepairServiceImpl implements RepairService {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 处理文件
|
* 处理文件
|
||||||
*/
|
*/
|
||||||
|
|
@ -526,6 +525,7 @@ public class RepairServiceImpl implements RepairService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生成任务编号
|
* 生成任务编号
|
||||||
|
*
|
||||||
* @param thisMonthMaxOrder
|
* @param thisMonthMaxOrder
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -204,7 +204,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
tl.type_id as typeId,
|
tl.type_id as typeId,
|
||||||
tl.id as id
|
tl.id as id
|
||||||
FROM tool_ledger tl
|
FROM tool_ledger tl
|
||||||
LEFT JOIN cs_device_change_details cdc ON tl.tool_code = cdc.dev_code
|
LEFT JOIN cs_device_change_details cdc ON tl.tool_code = cdc.dev_code AND tl.type_id = cdc.dev_type_id
|
||||||
LEFT JOIN cs_device_change cd ON cd.id = cdc.change_id
|
LEFT JOIN cs_device_change cd ON cd.id = cdc.change_id
|
||||||
LEFT JOIN tool_type tt ON tl.type_id = tt.type_id
|
LEFT JOIN tool_type tt ON tl.type_id = tt.type_id
|
||||||
LEFT JOIN tool_type tt1 ON tt.parent_id = tt1.type_id
|
LEFT JOIN tool_type tt1 ON tt.parent_id = tt1.type_id
|
||||||
|
|
@ -251,7 +251,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
tl.type_id as typeId,
|
tl.type_id as typeId,
|
||||||
tl.id as id
|
tl.id as id
|
||||||
FROM tool_ledger tl
|
FROM tool_ledger tl
|
||||||
LEFT JOIN cs_device_change_details cdc ON tl.type_id = cdc.dev_type_id
|
LEFT JOIN cs_device_change_details cdc ON tl.type_id = cdc.dev_type_id AND cdc.dev_code = '/'
|
||||||
LEFT JOIN cs_device_change cd ON cd.id = cdc.change_id
|
LEFT JOIN cs_device_change cd ON cd.id = cdc.change_id
|
||||||
LEFT JOIN tool_type tt ON tl.type_id = tt.type_id
|
LEFT JOIN tool_type tt ON tl.type_id = tt.type_id
|
||||||
LEFT JOIN tool_type tt1 ON tt.parent_id = tt1.type_id
|
LEFT JOIN tool_type tt1 ON tt.parent_id = tt1.type_id
|
||||||
|
|
|
||||||
|
|
@ -17,26 +17,6 @@
|
||||||
type_id, type_name, parent_id, level, create_time, update_time, create_by, update_by
|
type_id, type_name, parent_id, level, create_time, update_time, create_by, update_by
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="selectEquipmentTypeList" resultMap="BaseResultMap">
|
|
||||||
SELECT <include refid="Base_Column_List" />
|
|
||||||
FROM ma_type
|
|
||||||
<where>
|
|
||||||
<if test="deviceName != null and deviceName != '' ">
|
|
||||||
AND type_name LIKE CONCAT('%', #{deviceName}, '%')
|
|
||||||
</if>
|
|
||||||
<if test="parentId != null">
|
|
||||||
AND parent_id = #{parentId}
|
|
||||||
</if>
|
|
||||||
<if test="typeName != null and typeName != ''">
|
|
||||||
AND type_name LIKE CONCAT('%', #{typeName}, '%')
|
|
||||||
</if>
|
|
||||||
AND level != '7'
|
|
||||||
</where>
|
|
||||||
ORDER BY create_time DESC
|
|
||||||
<if test="pageSize != null and pageSize > 0">
|
|
||||||
LIMIT #{pageSize} OFFSET #{offset}
|
|
||||||
</if>
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<select id="countEquipmentTypeList" resultType="java.lang.Long">
|
<select id="countEquipmentTypeList" resultType="java.lang.Long">
|
||||||
SELECT COUNT(*)
|
SELECT COUNT(*)
|
||||||
|
|
@ -123,5 +103,34 @@
|
||||||
AND type_name = #{typeName}
|
AND type_name = #{typeName}
|
||||||
AND type_id != #{typeId} <!-- 排除自身 -->
|
AND type_id != #{typeId} <!-- 排除自身 -->
|
||||||
</select>
|
</select>
|
||||||
|
<select id="selectEquipmentTypeList" resultType="com.bonus.material.devConfig.domain.EquipmentTypeEntity">
|
||||||
|
SELECT typeId,
|
||||||
|
proType AS major,
|
||||||
|
mainGx AS mainProcess,
|
||||||
|
childGx AS subProcess,
|
||||||
|
devCategory AS mainCategory,
|
||||||
|
devSubcategory AS subCategory,
|
||||||
|
actual_level AS actualLevel,
|
||||||
|
devName AS branch
|
||||||
|
FROM ma_type_view
|
||||||
|
<where>
|
||||||
|
<if test="keyWord != null and keyWord != '' ">
|
||||||
|
AND (proType LIKE CONCAT('%', #{keyWord}, '%') or
|
||||||
|
mainGx LIKE CONCAT('%', #{keyWord}, '%') or
|
||||||
|
childGx LIKE CONCAT('%', #{keyWord}, '%') or
|
||||||
|
devCategory LIKE CONCAT('%', #{keyWord}, '%') or
|
||||||
|
devSubcategory LIKE CONCAT('%', #{keyWord}, '%') or
|
||||||
|
devName LIKE CONCAT('%', #{keyWord}, '%'))
|
||||||
|
</if>
|
||||||
|
<if test="typeId != null and typeId != '' ">
|
||||||
|
AND (maxTypeId = #{typeId} or
|
||||||
|
mainGxId = #{typeId} or
|
||||||
|
childGxId = #{typeId} or
|
||||||
|
devCategoryId = #{typeId} or
|
||||||
|
devSubcategoryId = #{typeId} or
|
||||||
|
devNameId = #{typeId})
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
@ -137,9 +137,10 @@
|
||||||
cds.user_name AS userName,
|
cds.user_name AS userName,
|
||||||
cds.user_phone AS userPhone,
|
cds.user_phone AS userPhone,
|
||||||
cds.change_unit AS changeUnit,
|
cds.change_unit AS changeUnit,
|
||||||
|
CASE
|
||||||
-- 修正点:使用 SUM 计算数量总和,并用 IFNULL 处理没有明细的情况
|
WHEN cds.type = 2 THEN IFNULL(SUM(dcd.real_num), 0)
|
||||||
IFNULL(SUM(dcd.num), 0) AS devNum,
|
ELSE IFNULL(SUM(dcd.num), 0)
|
||||||
|
END AS devNum,
|
||||||
|
|
||||||
CASE
|
CASE
|
||||||
WHEN cds.change_status = 1 THEN '在库'
|
WHEN cds.change_status = 1 THEN '在库'
|
||||||
|
|
@ -176,6 +177,9 @@
|
||||||
<if test="type!=null and type!=''">
|
<if test="type!=null and type!=''">
|
||||||
and cds.type=#{type}
|
and cds.type=#{type}
|
||||||
</if>
|
</if>
|
||||||
|
<if test="type!=null and type=='2'">
|
||||||
|
AND is_finished in ('1','2')
|
||||||
|
</if>
|
||||||
<if test="startTime!=null and startTime!='' and endTime!=null and endTime!='' ">
|
<if test="startTime!=null and startTime!='' and endTime!=null and endTime!='' ">
|
||||||
and cds.create_time between #{startTime} and #{endTime}
|
and cds.create_time between #{startTime} and #{endTime}
|
||||||
</if>
|
</if>
|
||||||
|
|
@ -252,12 +256,17 @@
|
||||||
LEFT JOIN ma_dev_info dev ON dcd.dev_code = dev.code
|
LEFT JOIN ma_dev_info dev ON dcd.dev_code = dev.code
|
||||||
LEFT JOIN bm_company_info bci ON bci.company_id = dev.on_company
|
LEFT JOIN bm_company_info bci ON bci.company_id = dev.on_company
|
||||||
INNER JOIN ma_type_view mt ON mt.typeId = dev.type_id
|
INNER JOIN ma_type_view mt ON mt.typeId = dev.type_id
|
||||||
LEFT JOIN (SELECT max(next_check_time) next_check_time, ma_id FROM ma_dev_qc GROUP BY ma_id) mdq ON dev.ma_id = mdq.ma_id
|
LEFT JOIN (SELECT max(next_check_time) next_check_time, ma_id FROM ma_dev_qc GROUP BY ma_id) mdq ON dev.ma_id =
|
||||||
|
mdq.ma_id
|
||||||
LEFT JOIN jj_sing_project pro ON pro.pro_code = dev.on_project
|
LEFT JOIN jj_sing_project pro ON pro.pro_code = dev.on_project
|
||||||
WHERE
|
WHERE
|
||||||
is_active = 1
|
is_active = 1
|
||||||
AND dcd.change_id = #{id}
|
AND dcd.change_id = #{id}
|
||||||
|
|
||||||
|
<if test="type!=null and type==2">
|
||||||
|
AND dcd.real_num is NOT null
|
||||||
|
</if>
|
||||||
|
|
||||||
UNION ALL
|
UNION ALL
|
||||||
|
|
||||||
SELECT
|
SELECT
|
||||||
|
|
@ -308,6 +317,9 @@
|
||||||
WHERE
|
WHERE
|
||||||
dcd.change_id = #{id}
|
dcd.change_id = #{id}
|
||||||
and dcd.dev_type='2'
|
and dcd.dev_type='2'
|
||||||
|
<if test="type!=null and type==2">
|
||||||
|
AND dcd.real_num is NOT null
|
||||||
|
</if>
|
||||||
|
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
|
|
@ -748,9 +760,11 @@
|
||||||
END, ''
|
END, ''
|
||||||
) AS typeName,
|
) AS typeName,
|
||||||
|
|
||||||
COALESCE(cdcd.num, 0) - COALESCE(cdcd.real_num, 0) AS outNum
|
COALESCE(cdcd.num, 0) - COALESCE(cdcd.real_num, 0) AS outNum,
|
||||||
|
cdc.pro_code AS proCode,
|
||||||
|
cdcd.use_end_time AS useEndTime
|
||||||
FROM cs_device_change_details cdcd
|
FROM cs_device_change_details cdcd
|
||||||
|
LEFT JOIN cs_device_change cdc ON cdc.id = cdcd.change_id
|
||||||
LEFT JOIN ma_dev_info a
|
LEFT JOIN ma_dev_info a
|
||||||
ON cdcd.dev_type = '1'
|
ON cdcd.dev_type = '1'
|
||||||
AND cdcd.dev_code = a.`code`
|
AND cdcd.dev_code = a.`code`
|
||||||
|
|
@ -1064,9 +1078,11 @@
|
||||||
END, ''
|
END, ''
|
||||||
) AS id,
|
) AS id,
|
||||||
cdcd.devType AS devType,
|
cdcd.devType AS devType,
|
||||||
COALESCE(cdcd.num, 0) - COALESCE(cdcd.real_num, 0) AS outNum
|
COALESCE(cdcd.num, 0) - COALESCE(cdcd.real_num, 0) AS outNum,
|
||||||
|
moi.pro_code AS proCode,
|
||||||
|
cdcd.rent_end_time AS useEndTime
|
||||||
FROM ma_order_details cdcd
|
FROM ma_order_details cdcd
|
||||||
|
LEFT JOIN ma_order_info moi ON moi.order_id = cdcd.order_id
|
||||||
LEFT JOIN ma_dev_info a
|
LEFT JOIN ma_dev_info a
|
||||||
ON cdcd.devType = '0'
|
ON cdcd.devType = '0'
|
||||||
AND cdcd.ma_id = a.ma_id
|
AND cdcd.ma_id = a.ma_id
|
||||||
|
|
@ -1081,6 +1097,17 @@
|
||||||
FROM tool_ledger
|
FROM tool_ledger
|
||||||
WHERE id = #{id}
|
WHERE id = #{id}
|
||||||
</select>
|
</select>
|
||||||
|
<select id="getMaNum" resultType="java.math.BigDecimal">
|
||||||
|
SELECT count(1)
|
||||||
|
FROM ma_dev_info
|
||||||
|
WHERE ma_id = #{id}
|
||||||
|
and ma_status = '1'
|
||||||
|
</select>
|
||||||
|
<select id="getChange" resultType="com.bonus.material.devchange.domain.DevChangeVo">
|
||||||
|
SELECT type
|
||||||
|
FROM cs_device_change
|
||||||
|
WHERE id = #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
<insert id="addChangeInfoNew" keyProperty="id" useGeneratedKeys="true">
|
<insert id="addChangeInfoNew" keyProperty="id" useGeneratedKeys="true">
|
||||||
|
|
@ -1212,13 +1239,17 @@
|
||||||
<update id="updateZb">
|
<update id="updateZb">
|
||||||
UPDATE ma_dev_info
|
UPDATE ma_dev_info
|
||||||
set ma_status = '2',
|
set ma_status = '2',
|
||||||
change_status = '2'
|
change_status = '2',
|
||||||
|
on_project = #{proCode},
|
||||||
|
expiration_time = #{useEndTime}
|
||||||
WHERE ma_id = #{id}
|
WHERE ma_id = #{id}
|
||||||
</update>
|
</update>
|
||||||
<update id="updateOrderZb">
|
<update id="updateOrderZb">
|
||||||
UPDATE ma_dev_info
|
UPDATE ma_dev_info
|
||||||
set ma_status = '3',
|
set ma_status = '3',
|
||||||
change_status = '3'
|
change_status = '3',
|
||||||
|
on_project = #{proCode},
|
||||||
|
expiration_time = #{useEndTime}
|
||||||
WHERE ma_id = #{id}
|
WHERE ma_id = #{id}
|
||||||
</update>
|
</update>
|
||||||
<update id="updateOrderGj">
|
<update id="updateOrderGj">
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@
|
||||||
mdi.ma_id=mdq.ma_id
|
mdi.ma_id=mdq.ma_id
|
||||||
LEFT JOIN ma_supplier ms ON ms.supplier_id = mdi.supplier_id
|
LEFT JOIN ma_supplier ms ON ms.supplier_id = mdi.supplier_id
|
||||||
LEFT JOIN sys_cnarea sc ON sc.area_code = mdi.province_id
|
LEFT JOIN sys_cnarea sc ON sc.area_code = mdi.province_id
|
||||||
WHERE mdi.is_active = 1 and mdi.entry_status = '1'
|
WHERE mdi.is_active = 1 and mdi.entry_status = '1' AND mdi.ma_status != '99'
|
||||||
<if test="name != null and name != ''">
|
<if test="name != null and name != ''">
|
||||||
AND mdi.device_name like concat('%',#{name},'%')
|
AND mdi.device_name like concat('%',#{name},'%')
|
||||||
</if>
|
</if>
|
||||||
|
|
|
||||||
|
|
@ -64,34 +64,44 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
m1.qc_code AS qcCode,
|
m1.qc_code AS qcCode,
|
||||||
m1.qc_user AS qcUser,
|
m1.qc_user AS qcUser,
|
||||||
m1.qc_time AS qcTime,
|
m1.qc_time AS qcTime,
|
||||||
m3.maintenance_alarm_day,
|
|
||||||
su.nick_name AS createBy,
|
|
||||||
m1.next_check_time AS nextCheckTime,
|
m1.next_check_time AS nextCheckTime,
|
||||||
|
mdq1.qc_time AS upCheckTime,
|
||||||
m1.create_time AS updateTime,
|
m1.create_time AS updateTime,
|
||||||
aa.create_time AS createTime,
|
aa.create_time AS createTime,
|
||||||
m1.phonenumber AS phonenumber,
|
m1.phonenumber AS phonenumber,
|
||||||
CASE
|
CASE
|
||||||
WHEN DATEDIFF(m1.next_check_time, CURDATE()) < 0 THEN '已超期'
|
WHEN mdq.next_check_time <= CURRENT_DATE() THEN '已超期'
|
||||||
WHEN DATEDIFF(m1.next_check_time, CURDATE()) <= 30 THEN '一月内到期'
|
WHEN mdq.next_check_time <= DATE_ADD(CURRENT_DATE(), INTERVAL 1 MONTH) THEN '一月内到期'
|
||||||
ELSE '正常'
|
ELSE '正常'
|
||||||
END AS alert
|
END AS alert
|
||||||
FROM
|
FROM
|
||||||
ma_dev_info m2
|
ma_dev_info m2
|
||||||
LEFT JOIN ma_dev_qc m1 ON m1.ma_id = m2.ma_id
|
LEFT JOIN ma_dev_qc m1 ON m1.ma_id = m2.ma_id
|
||||||
INNER JOIN ma_type m3 ON m2.type_id = m3.type_id
|
|
||||||
LEFT JOIN sys_user su ON su.user_id = m1.create_by
|
|
||||||
LEFT JOIN ( SELECT count(*) as num, ma_id, MAX( qc_time ) AS max_qc_time FROM ma_dev_qc GROUP BY ma_id )
|
LEFT JOIN ( SELECT count(*) as num, ma_id, MAX( qc_time ) AS max_qc_time FROM ma_dev_qc GROUP BY ma_id )
|
||||||
latest_qc ON m1.ma_id = latest_qc.ma_id
|
latest_qc ON m1.ma_id = latest_qc.ma_id
|
||||||
LEFT JOIN ( SELECT ma_id, min( create_time ) AS create_time FROM ma_dev_qc GROUP BY ma_id ) aa ON m1.ma_id =
|
LEFT JOIN ( SELECT ma_id, min( create_time ) AS create_time FROM ma_dev_qc GROUP BY ma_id ) aa ON m1.ma_id =
|
||||||
aa.ma_id
|
aa.ma_id
|
||||||
LEFT JOIN jj_sing_project jsp ON m2.on_project = jsp.pro_code
|
|
||||||
LEFT JOIN sys_dept sd ON sd.dept_id = m2.on_company
|
|
||||||
LEFT JOIN (SELECT max( next_check_time) next_check_time,ma_id from ma_dev_qc GROUP BY ma_id ) mdq on
|
LEFT JOIN (SELECT max( next_check_time) next_check_time,ma_id from ma_dev_qc GROUP BY ma_id ) mdq on
|
||||||
m2.ma_id=mdq.ma_id
|
m2.ma_id=mdq.ma_id
|
||||||
LEFT JOIN ma_supplier ms ON ms.supplier_id = m2.supplier_id
|
LEFT JOIN (
|
||||||
LEFT JOIN sys_cnarea sc ON sc.area_code = m2.province_id
|
SELECT
|
||||||
|
ma_id,
|
||||||
|
qc_time
|
||||||
|
FROM (
|
||||||
|
-- 内层:按ma_id分组,给next_check_time降序排名
|
||||||
|
SELECT
|
||||||
|
ma_id,
|
||||||
|
qc_time,
|
||||||
|
ROW_NUMBER() OVER (PARTITION BY ma_id ORDER BY qc_time DESC) AS rn
|
||||||
|
FROM ma_dev_qc
|
||||||
|
-- 过滤掉next_check_time为NULL的记录(可选,根据业务需求)
|
||||||
|
WHERE qc_time IS NOT NULL
|
||||||
|
) t
|
||||||
|
-- 筛选排名为2的记录(第二大)
|
||||||
|
WHERE t.rn = 2
|
||||||
|
) mdq1 ON m2.ma_id = mdq1.ma_id
|
||||||
<where>
|
<where>
|
||||||
m2.is_active = '1' and m2.entry_status = '1'
|
m2.is_active = '1' and m2.entry_status = '1' AND m2.ma_status != '99'
|
||||||
<if test="deviceCode != null and deviceCode != ''">
|
<if test="deviceCode != null and deviceCode != ''">
|
||||||
and m2.code like concat('%',#{deviceCode},'%')
|
and m2.code like concat('%',#{deviceCode},'%')
|
||||||
</if>
|
</if>
|
||||||
|
|
@ -113,6 +123,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="qcCom != null and qcCom != ''">
|
<if test="qcCom != null and qcCom != ''">
|
||||||
and m2.on_company = #{qcCom}
|
and m2.on_company = #{qcCom}
|
||||||
</if>
|
</if>
|
||||||
|
<if test="alert != null and alert != ''">
|
||||||
|
<choose>
|
||||||
|
<!-- 筛选“已超期” -->
|
||||||
|
<when test="alert == '已超期'">
|
||||||
|
and mdq.next_check_time <= CURRENT_DATE()
|
||||||
|
</when>
|
||||||
|
<!-- 筛选“一月内到期” -->
|
||||||
|
<when test="alert == '一月内到期'">
|
||||||
|
and mdq.next_check_time <= DATE_ADD(CURRENT_DATE(), INTERVAL 1 MONTH)
|
||||||
|
</when>
|
||||||
|
<!-- 筛选“正常” -->
|
||||||
|
<when test="alert == '正常'">
|
||||||
|
and mdq.next_check_time > DATE_ADD(CURRENT_DATE(), INTERVAL 1 MONTH)
|
||||||
|
</when>
|
||||||
|
</choose>
|
||||||
|
</if>
|
||||||
</where>
|
</where>
|
||||||
GROUP BY m2.ma_id
|
GROUP BY m2.ma_id
|
||||||
ORDER BY
|
ORDER BY
|
||||||
|
|
@ -146,6 +172,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="createStartTime != null and createStartTime != '' and createEndTime != null and createEndTime != ''">
|
<if test="createStartTime != null and createStartTime != '' and createEndTime != null and createEndTime != ''">
|
||||||
and DATE_FORMAT(mdq.create_time,'%Y-%m-%d') between #{createStartTime} and #{createEndTime}
|
and DATE_FORMAT(mdq.create_time,'%Y-%m-%d') between #{createStartTime} and #{createEndTime}
|
||||||
</if>
|
</if>
|
||||||
|
ORDER BY mdq.qc_time DESC
|
||||||
</select>
|
</select>
|
||||||
<select id="getQcList" resultType="com.bonus.material.device.domain.MaDevQc">
|
<select id="getQcList" resultType="com.bonus.material.device.domain.MaDevQc">
|
||||||
SELECT
|
SELECT
|
||||||
|
|
|
||||||
|
|
@ -193,9 +193,9 @@
|
||||||
mdi.ma_id,
|
mdi.ma_id,
|
||||||
CASE
|
CASE
|
||||||
WHEN ROUND(TIMESTAMPDIFF(DAY, mdi.production_date, CURDATE()) / 365.25, 1) >= mdi.max_working_hours THEN '已超期'
|
WHEN ROUND(TIMESTAMPDIFF(DAY, mdi.production_date, CURDATE()) / 365.25, 1) >= mdi.max_working_hours THEN '已超期'
|
||||||
WHEN (mdi.max_working_hours - ROUND(TIMESTAMPDIFF(DAY, mdi.production_date, CURDATE()) / 365.25, 1)) * 365.25
|
WHEN (mdi.max_working_hours - ROUND(TIMESTAMPDIFF(DAY, mdi.production_date, CURDATE()) / 365.25, 1))
|
||||||
<=
|
<=
|
||||||
30 THEN '一月内超期'
|
1 THEN '一月内超期'
|
||||||
ELSE '正常'
|
ELSE '正常'
|
||||||
END AS expire_type
|
END AS expire_type
|
||||||
FROM
|
FROM
|
||||||
|
|
|
||||||
|
|
@ -423,7 +423,7 @@
|
||||||
tool_ledger tl
|
tool_ledger tl
|
||||||
WHERE
|
WHERE
|
||||||
tl.type_id=#{typeId}
|
tl.type_id=#{typeId}
|
||||||
<if test="code != null and code!=''">
|
<if test="code != null and code!='/'">
|
||||||
and tl.tool_code=#{code}
|
and tl.tool_code=#{code}
|
||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
|
||||||
|
|
@ -287,7 +287,7 @@
|
||||||
INNER JOIN tool_type tt1 ON tt1.type_id = tt.parent_id
|
INNER JOIN tool_type tt1 ON tt1.type_id = tt.parent_id
|
||||||
WHERE tl.status = #{status}
|
WHERE tl.status = #{status}
|
||||||
AND tl.type_id = #{typeId}
|
AND tl.type_id = #{typeId}
|
||||||
AND tl.manage_mode = #{type}
|
|
||||||
<if test="companyId != null">
|
<if test="companyId != null">
|
||||||
AND (tl.company_id = #{companyId} OR tl.company_id IS NULL)
|
AND (tl.company_id = #{companyId} OR tl.company_id IS NULL)
|
||||||
</if>
|
</if>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue