Merge remote-tracking branch 'origin/master'

This commit is contained in:
syruan 2024-12-20 13:29:19 +08:00
commit bc2c414a61
12 changed files with 871 additions and 1 deletions

View File

@ -202,6 +202,8 @@ public class StoreLogAspect {
} }
bmStorageLogList.add(bmStorageLog); bmStorageLogList.add(bmStorageLog);
} }
//修饰入库库存变化 /repair_input_details/warehouse
} }
} }
} }

View File

@ -79,6 +79,136 @@ public class ComplexQueryController extends BaseController {
util.exportExcel(response, list, "综合查询--保有设备总量查询"); util.exportExcel(response, list, "综合查询--保有设备总量查询");
} }
/**
* 查询在库机具设备详情
* @param bean
* @return
*/
@ApiOperation(value = "综合查询--查询在库机具设备详情")
@GetMapping("/getStorageInfoList")
public AjaxResult getStorageInfoList(StorageInfo bean) {
startPage();
List<StorageInfo> list = complexQueryService.getMaCodeList(bean);
return AjaxResult.success(getDataTable(list));
}
/**
* 导出查询在库机具设备详情
* @param bean
* @return
*/
@ApiOperation(value = "综合查询--查询在库机具设备详情")
@GetMapping("/exportStorageInfoList")
public void exportStorageInfoList(HttpServletResponse response, StorageInfo bean) {
List<StorageInfo> list = complexQueryService.getMaCodeList(bean);
ExcelUtil<StorageInfo> util = new ExcelUtil<>(StorageInfo.class);
util.exportExcel(response, list, "综合查询--在库机具设备详情");
}
/**
* 查询在用设备详情
* @param bean
* @return
*/
@ApiOperation(value = "综合查询--查询在用设备详情")
@GetMapping("/getUserRecordList")
public AjaxResult getUserRecords(UseStorageInfo bean) {
startPage();
List<UseStorageInfo> list = complexQueryService.getUserRecords(bean);
return AjaxResult.success(getDataTable(list));
}
/**
* 导出在用设备详情
* @param response
* @param bean
*/
@ApiOperation(value = "综合查询--导出在用设备详情")
@GetMapping("/exportUserRecordList")
public void exportUserRecordList(HttpServletResponse response, UseStorageInfo bean) {
List<UseStorageInfo> list = complexQueryService.getUserRecords(bean);
ExcelUtil<UseStorageInfo> util = new ExcelUtil<>(UseStorageInfo.class);
util.exportExcel(response, list, "综合查询--导出在用设备详情");
}
/**
* 查询在修设备详情
* @param bean
* @return
*/
@ApiOperation(value = "综合查询--查询在修设备详情")
@GetMapping("/getRepairRecordList")
public AjaxResult getRepairRecordList(RepairStorageInfo bean) {
startPage();
List<RepairStorageInfo> list = complexQueryService.getRepairRecordList(bean);
return AjaxResult.success(getDataTable(list));
}
/**
* 导出在修设备详情
* @param response
* @param bean
*/
@ApiOperation(value = "综合查询--导出在修设备详情")
@GetMapping("/exportRepairRecordList")
public void exportRepairRecordList(HttpServletResponse response, RepairStorageInfo bean) {
List<RepairStorageInfo> list = complexQueryService.getRepairRecordList(bean);
ExcelUtil<RepairStorageInfo> util = new ExcelUtil<>(RepairStorageInfo.class);
util.exportExcel(response, list, "综合查询--导出在修设备详情");
}
/**
* 查询新购待入库设备详情
* @param bean
* @return
*/
@ApiOperation(value = "综合查询--查询新购待入库设备详情")
@GetMapping("/getPurchaseRecordList")
public AjaxResult getPurchaseRecordList(PurchaseInputInfo bean) {
startPage();
List<PurchaseInputInfo> list = complexQueryService.getPurchaseRecordList(bean);
return AjaxResult.success(getDataTable(list));
}
/**
* 导出新购待入库详情
* @param response
* @param bean
*/
@ApiOperation(value = "综合查询--导出新购待入库详情")
@GetMapping("/exportPurchaseRecordList")
public void exportPurchaseRecordList(HttpServletResponse response, PurchaseInputInfo bean) {
List<PurchaseInputInfo> list = complexQueryService.getPurchaseRecordList(bean);
ExcelUtil<PurchaseInputInfo> util = new ExcelUtil<>(PurchaseInputInfo.class);
util.exportExcel(response, list, "综合查询--导出新购待入库详情");
}
/**
* 查询修饰待入库设备详情
* @param bean
* @return
*/
@ApiOperation(value = "综合查询--查询修饰待入库设备详情")
@GetMapping("/getRepairInputList")
public AjaxResult getRepairInputList(RepairInputRecord bean) {
startPage();
List<RepairInputRecord> list = complexQueryService.getRepairInputList(bean);
return AjaxResult.success(getDataTable(list));
}
/**
* 导出修饰待入库详情
* @param response
* @param bean
*/
@ApiOperation(value = "综合查询--导出修饰待入库详情")
@GetMapping("/exportRepairInputList")
public void exportRepairInputList(HttpServletResponse response, RepairInputRecord bean) {
List<RepairInputRecord> list = complexQueryService.getRepairInputList(bean);
ExcelUtil<RepairInputRecord> util = new ExcelUtil<>(RepairInputRecord.class);
util.exportExcel(response, list, "综合查询--导出修饰待入库详情");
}
/** /**
* 工程机具使用列表 * 工程机具使用列表
* @param bean * @param bean

View File

@ -0,0 +1,65 @@
package com.bonus.material.basic.domain;
import com.bonus.common.core.annotation.Excel;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.math.BigDecimal;
import java.util.Date;
/**
* 综合查询新购待入库详情
* @Author ma_sh
* @create 2024/12/19 13:22
*/
@Data
public class PurchaseInputInfo {
@ApiModelProperty(value = "主键id")
private Integer id;
@ApiModelProperty(value = "机具名称")
@Excel(name = "机具名称")
private String typeName;
@ApiModelProperty(value = "规格ID")
private Integer typeId;
@ApiModelProperty(value = "任务ID")
private Long taskId;
@ApiModelProperty(value = "规格型号")
@Excel(name = "规格型号")
private String typeModelName;
@ApiModelProperty(value = "新购待入库数量")
@Excel(name = "新购待入库数量")
private BigDecimal inputNum;
@ApiModelProperty(value = "购置单价")
@Excel(name = "原值(元)")
private BigDecimal buyPrice;
@ApiModelProperty(value = "设备编码")
@Excel(name = "设备编码")
private String maCode;
@ApiModelProperty(value = "库管员")
@Excel(name = "库管员")
private String maKeeper;
@ApiModelProperty(value = "验收完成时间")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "验收完成时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date checkTime;
@ApiModelProperty(value = "新购待入库单号")
@Excel(name = "新购待入库单号")
private String purchaseCode;
@ApiModelProperty(value = "关键字")
private String keyWord;
}

View File

@ -0,0 +1,66 @@
package com.bonus.material.basic.domain;
import com.bonus.common.core.annotation.Excel;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.math.BigDecimal;
import java.util.Date;
/**
* 综合查询 维修待入库详情
* @Author ma_sh
* @create 2024/12/19 13:29
*/
@Data
public class RepairInputRecord {
@ApiModelProperty(value = "主键id")
private Integer id;
@ApiModelProperty(value = "机具名称")
@Excel(name = "机具名称")
private String typeName;
@ApiModelProperty(value = "规格ID")
private Integer typeId;
@ApiModelProperty(value = "规格型号")
@Excel(name = "规格型号")
private String typeModelName;
@ApiModelProperty(value = "修饰待入库数量")
@Excel(name = "修饰待入库数量")
private BigDecimal repairInputNum;
@ApiModelProperty(value = "购置单价")
@Excel(name = "原值(元)")
private BigDecimal buyPrice;
@ApiModelProperty(value = "设备编码")
@Excel(name = "设备编码")
private String maCode;
@ApiModelProperty(value = "库管员")
@Excel(name = "库管员")
private String maKeeper;
@ApiModelProperty(value = "维修员")
@Excel(name = "维修员")
private String repairer;
@ApiModelProperty(value = "修饰提交时间")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "修饰提交时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date repairInputTime;
@ApiModelProperty(value = "修饰待入库单号")
@Excel(name = "修饰待入库单号")
private String repairInputCode;
@ApiModelProperty(value = "关键字")
private String keyWord;
}

View File

@ -0,0 +1,66 @@
package com.bonus.material.basic.domain;
import com.bonus.common.core.annotation.Excel;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.math.BigDecimal;
import java.util.Date;
/**
* 综合查询在修数量详情
* @Author ma_sh
* @create 2024/12/19 13:09
*/
@Data
public class RepairStorageInfo {
@ApiModelProperty(value = "主键id")
private Integer id;
@ApiModelProperty(value = "机具名称")
@Excel(name = "机具名称")
private String typeName;
@ApiModelProperty(value = "规格ID")
private Integer typeId;
@ApiModelProperty(value = "规格型号")
@Excel(name = "规格型号")
private String typeModelName;
@ApiModelProperty(value = "在修数量")
@Excel(name = "在修数量")
private BigDecimal repairNum;
@ApiModelProperty(value = "购置单价")
@Excel(name = "原值(元)")
private BigDecimal buyPrice;
@ApiModelProperty(value = "设备编码")
@Excel(name = "设备编码")
private String maCode;
@ApiModelProperty(value = "维修员")
@Excel(name = "维修员")
private String repairer;
@ApiModelProperty(value = "操作人")
@Excel(name = "操作人")
private String creator;
@ApiModelProperty(value = "退料时间")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "退料时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date leaseTime;
@ApiModelProperty(value = "维修单号")
@Excel(name = "维修单号")
private String repairCode;
@ApiModelProperty(value = "关键字")
private String keyWord;
}

View File

@ -0,0 +1,66 @@
package com.bonus.material.basic.domain;
import com.bonus.common.core.annotation.Excel;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.math.BigDecimal;
import java.util.Date;
/**
* 机具入库查询详情
* @Author ma_sh
* @create 2024/12/19 9:50
*/
@Data
public class StorageInfo {
@ApiModelProperty(value = "主键id")
private Integer id;
@ApiModelProperty(value = "机具名称")
@Excel(name = "机具名称")
private String typeName;
@ApiModelProperty(value = "规格ID")
private Integer typeId;
@ApiModelProperty(value = "规格型号")
@Excel(name = "规格型号")
private String typeModelName;
@ApiModelProperty(value = "入库数量")
@Excel(name = "入库数量")
private BigDecimal storeNum;
@ApiModelProperty(value = "购置单价")
@Excel(name = "原值(元)")
private BigDecimal buyPrice;
@ApiModelProperty(value = "设备编码")
@Excel(name = "设备编码")
private String maCode;
@ApiModelProperty(value = "库管员")
@Excel(name = "库管员")
private String maKeeper;
@ApiModelProperty(value = "操作人")
@Excel(name = "操作人")
private String inputUser;
@ApiModelProperty(value = "创建时间")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "入库时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date inputTime;
@ApiModelProperty(value = "入库方式")
@Excel(name = "入库方式")
private String inputType;
@ApiModelProperty(value = "关键字")
private String keyWord;
}

View File

@ -0,0 +1,66 @@
package com.bonus.material.basic.domain;
import com.bonus.common.core.annotation.Excel;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.math.BigDecimal;
import java.util.Date;
/**
* 在用机具查询详情
* @Author ma_sh
* @create 2024/12/19 10:41
*/
@Data
public class UseStorageInfo {
@ApiModelProperty(value = "主键id")
private Integer id;
@ApiModelProperty(value = "机具名称")
@Excel(name = "机具名称")
private String typeName;
@ApiModelProperty(value = "规格ID")
private Integer typeId;
@ApiModelProperty(value = "规格型号")
@Excel(name = "规格型号")
private String typeModelName;
@ApiModelProperty(value = "在用数量")
@Excel(name = "在用数量")
private BigDecimal usNum;
@ApiModelProperty(value = "购置单价")
@Excel(name = "原值(元)")
private BigDecimal buyPrice;
@ApiModelProperty(value = "设备编码")
@Excel(name = "设备编码")
private String maCode;
@ApiModelProperty(value = "库管员")
@Excel(name = "库管员")
private String maKeeper;
@ApiModelProperty(value = "操作人")
@Excel(name = "操作人")
private String creator;
@ApiModelProperty(value = "出库时间")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "出库时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date outTime;
@ApiModelProperty(value = "领料单号")
@Excel(name = "领料单号")
private String leaseCode;
@ApiModelProperty(value = "关键字")
private String keyWord;
}

View File

@ -1,6 +1,7 @@
package com.bonus.material.basic.mapper; package com.bonus.material.basic.mapper;
import com.bonus.material.basic.domain.*; import com.bonus.material.basic.domain.*;
import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
@ -44,4 +45,47 @@ public interface ComplexQueryMapper {
* @return * @return
*/ */
List<RetainedEquipmentInfo> getRetainedEquipmentList(RetainedEquipmentInfo bean); List<RetainedEquipmentInfo> getRetainedEquipmentList(RetainedEquipmentInfo bean);
/**
* 查询机具编码
* @param bean
* @return
*/
List<StorageInfo> getMaCodeList(StorageInfo bean);
/**
* 查询在用设备详情
* @param bean
* @return
*/
List<UseStorageInfo> getUserRecords(UseStorageInfo bean);
/**
* 查询在修设备详情
* @param bean
* @return
*/
List<RepairStorageInfo> getRepairRecordList(RepairStorageInfo bean);
/**
* 查询新购待入库设备详情
* @param bean
* @return
*/
List<PurchaseInputInfo> getPurchaseRecordList(PurchaseInputInfo bean);
/**
* 查询修饰待入库设备详情
* @param bean
* @return
*/
List<RepairInputRecord> getRepairInputList(RepairInputRecord bean);
/**
* 根据任务ID和机具规格ID查询机具编码
* @param taskId
* @param typeId
* @return
*/
List<PurchaseInputInfo> selectMaCodeByTaskIdAndTypeId(@Param("taskId") Long taskId, @Param("typeId") Integer typeId);
} }

View File

@ -51,4 +51,39 @@ public interface ComplexQueryService {
* @return * @return
*/ */
List<RetainedEquipmentInfo> getRetainedEquipmentList(RetainedEquipmentInfo bean); List<RetainedEquipmentInfo> getRetainedEquipmentList(RetainedEquipmentInfo bean);
/**
* 查询机具编码
* @param bean
* @return
*/
List<StorageInfo> getMaCodeList(StorageInfo bean);
/**
* 查询在用设备详情
* @param bean
* @return
*/
List<UseStorageInfo> getUserRecords(UseStorageInfo bean);
/**
* 查询在修设备详情
* @param bean
* @return
*/
List<RepairStorageInfo> getRepairRecordList(RepairStorageInfo bean);
/**
* 查询新购待入库设备详情
* @param bean
* @return
*/
List<PurchaseInputInfo> getPurchaseRecordList(PurchaseInputInfo bean);
/**
* 查询修饰待入库设备详情
* @param bean
* @return
*/
List<RepairInputRecord> getRepairInputList(RepairInputRecord bean);
} }

View File

@ -98,6 +98,7 @@ public class ComplexQueryServiceImpl implements ComplexQueryService {
InputRecordInfo newRecord = new InputRecordInfo(); InputRecordInfo newRecord = new InputRecordInfo();
BeanUtils.copyProperties(inputRecordInfo, newRecord); BeanUtils.copyProperties(inputRecordInfo, newRecord);
newRecord.setMaCode(code); newRecord.setMaCode(code);
newRecord.setInputNum(BigDecimal.ONE);
list.add(newRecord); list.add(newRecord);
} }
} else { } else {
@ -246,4 +247,128 @@ public class ComplexQueryServiceImpl implements ComplexQueryService {
return recordList; return recordList;
} }
/**
* 查询机具编码
* @param bean
* @return
*/
@Override
public List<StorageInfo> getMaCodeList(StorageInfo bean) {
List<StorageInfo> recordList = complexQueryMapper.getMaCodeList(bean);
List<StorageInfo> list = new ArrayList<>();
if (CollectionUtils.isNotEmpty(recordList)) {
for (StorageInfo storageInfo : recordList) {
if (StringUtils.isNotBlank(storageInfo.getMaCode())) {
String[] split = storageInfo.getMaCode().split(",");
if (split.length > 1) {
for (String code : split) {
StorageInfo newRecord = new StorageInfo();
BeanUtils.copyProperties(storageInfo, newRecord);
newRecord.setMaCode(code);
newRecord.setStoreNum(BigDecimal.ONE);
list.add(newRecord);
}
} else {
list.add(storageInfo);
}
} else {
list.add(storageInfo);
}
}
}
if (StringUtils.isNotBlank(bean.getKeyWord())) {
String keyword = bean.getKeyWord();
return list.stream().filter(item -> {
return (StringUtils.isNotBlank(item.getMaCode()) && item.getMaCode().contains(keyword)) ||
(StringUtils.isNotBlank(item.getTypeName()) && item.getTypeName().contains(keyword)) ||
(StringUtils.isNotBlank(item.getTypeModelName()) && item.getTypeModelName().contains(keyword)) ||
(StringUtils.isNotBlank(item.getInputUser()) && item.getInputUser().contains(keyword)) ||
(StringUtils.isNotBlank(item.getMaKeeper()) && item.getMaKeeper().contains(keyword)) ||
(StringUtils.isNotBlank(item.getInputType()) && item.getInputType().contains(keyword));
}).collect(Collectors.toList());
}
return list;
}
/**
* 查询在用设备详情
* @param bean
* @return
*/
@Override
public List<UseStorageInfo> getUserRecords(UseStorageInfo bean) {
return complexQueryMapper.getUserRecords(bean);
}
/**
* 查询在修设备详情
* @param bean
* @return
*/
@Override
public List<RepairStorageInfo> getRepairRecordList(RepairStorageInfo bean) {
return complexQueryMapper.getRepairRecordList(bean);
}
/**
* 查询新购待入库设备详情
* @param bean
* @return
*/
@Override
public List<PurchaseInputInfo> getPurchaseRecordList(PurchaseInputInfo bean) {
List<PurchaseInputInfo> recordList = complexQueryMapper.getPurchaseRecordList(bean);
List<PurchaseInputInfo> tempList = new ArrayList<>();
Iterator<PurchaseInputInfo> iterator = recordList.iterator();
while (iterator.hasNext()) {
PurchaseInputInfo purchaseInputInfo = iterator.next();
// 根据任务id和类型id查询未入库编码信息
List<PurchaseInputInfo> maCodeList = complexQueryMapper.selectMaCodeByTaskIdAndTypeId(purchaseInputInfo.getTaskId(), bean.getTypeId());
if (CollectionUtils.isNotEmpty(maCodeList)) {
boolean addedPurchaseInputInfo = false;
for (PurchaseInputInfo info : maCodeList) {
if (purchaseInputInfo.getInputNum().compareTo(BigDecimal.valueOf(maCodeList.size())) > 0) {
purchaseInputInfo.setInputNum(purchaseInputInfo.getInputNum().subtract(BigDecimal.valueOf(maCodeList.size())));
String maCode = info.getMaCode();
BeanUtils.copyProperties(purchaseInputInfo, info);
info.setMaCode(maCode);
info.setInputNum(BigDecimal.ONE);
tempList.add(info);
if (!addedPurchaseInputInfo) {
tempList.add(purchaseInputInfo);
addedPurchaseInputInfo = true;
}
} else if (purchaseInputInfo.getInputNum().compareTo(BigDecimal.valueOf(maCodeList.size())) == 0) {
String maCode = info.getMaCode();
BeanUtils.copyProperties(purchaseInputInfo, info);
info.setMaCode(maCode);
info.setInputNum(BigDecimal.ONE);
tempList.add(info);
}
}
}
}
if (StringUtils.isNotBlank(bean.getKeyWord())) {
String keyword = bean.getKeyWord();
return tempList.stream().filter(item -> {
return (StringUtils.isNotBlank(item.getMaCode()) && item.getMaCode().contains(keyword)) ||
(StringUtils.isNotBlank(item.getTypeName()) && item.getTypeName().contains(keyword)) ||
(StringUtils.isNotBlank(item.getTypeModelName()) && item.getTypeModelName().contains(keyword)) ||
(StringUtils.isNotBlank(item.getMaKeeper()) && item.getMaKeeper().contains(keyword));
}).collect(Collectors.toList());
}
return tempList;
}
/**
* 查询修饰待入库设备详情
* @param bean
* @return
*/
@Override
public List<RepairInputRecord> getRepairInputList(RepairInputRecord bean) {
return complexQueryMapper.getRepairInputList(bean);
}
} }

View File

@ -344,6 +344,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="getRetainedEquipmentList" resultType="com.bonus.material.basic.domain.RetainedEquipmentInfo"> <select id="getRetainedEquipmentList" resultType="com.bonus.material.basic.domain.RetainedEquipmentInfo">
SELECT SELECT
mt.type_id AS typeId,
mt4.type_name AS constructionType, mt4.type_name AS constructionType,
mt3.type_name AS materialType, mt3.type_name AS materialType,
mt2.type_name AS typeName, mt2.type_name AS typeName,
@ -445,7 +446,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
mt2.type_name AS typeName, mt2.type_name AS typeName,
mt.type_name AS typeModelName, mt.type_name AS typeModelName,
SUM( SUM(
IFNULL(rad.repair_num, 0)) AS repairNum IFNULL(rad.repair_num, 0) - IFNULL(rad.repaired_num, 0) -
IFNULL(rad.scrap_num, 0)) AS repairNum
FROM repair_apply_details rad FROM repair_apply_details rad
LEFT JOIN ma_type mt ON mt.type_id = rad.type_id 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 ma_type mt2 ON mt2.type_id = mt.parent_id
@ -520,4 +522,206 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</if> </if>
</select> </select>
<select id="getMaCodeList" resultType="com.bonus.material.basic.domain.StorageInfo">
SELECT
bs.type_id as typeId,
mt1.type_name as typeName,
mt.type_name as typeModelName,
bs.ma_code as maCode,
bs.in_num as storeNum,
bs.creator as inputUser,
bs.create_time as inputTime,
CASE
WHEN tt.`code` LIKE 'XG%' THEN '新购入库'
WHEN tt.`code` LIKE 'R%' THEN '修饰入库'
WHEN tt.`code` LIKE 'PD%' THEN '盘点入库'
ELSE '未知入库类型'
END AS inputType,
mt.buy_price as buyPrice,
GROUP_CONCAT( DISTINCT su.nick_name ORDER BY su.nick_name SEPARATOR ', ' ) AS maKeeper
FROM
bm_storage_log bs
LEFT JOIN ma_type mt ON bs.type_id = mt.type_id
AND mt.del_flag = '0'
LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id
AND mt1.del_flag = '0'
LEFT JOIN tm_task tt ON bs.task_id = tt.task_id
LEFT JOIN ma_type_keeper mtk ON mtk.type_id = bs.type_id
LEFT JOIN sys_user su ON mtk.user_id = su.user_id
WHERE bs.in_num != 0
<if test="typeId != null">
AND bs.type_id = #{typeId}
</if>
<if test="keyWord != null and keyWord != ''">
AND (
mt1.type_name like concat('%',#{keyWord},'%') or
mt.type_name like concat('%',#{keyWord},'%') or
bs.creator like concat('%',#{keyWord},'%') or
su.nick_name like concat('%',#{keyWord},'%')
)
</if>
GROUP BY bs.ma_code, mt.type_id, mt1.type_name, mt.type_name, bs.ma_code,
bs.in_num, bs.creator, bs.create_time, tt.CODE, mt.buy_price
</select>
<select id="getUserRecords" resultType="com.bonus.material.basic.domain.UseStorageInfo">
SELECT
mt2.type_name AS typeName,
mt.type_name AS typeModelName,
mt.buy_price AS buyPrice,
sai.num AS usNum,
mm.ma_code AS maCode,
lai.`code` AS leaseCode,
GROUP_CONCAT(DISTINCT su.nick_name ORDER BY su.nick_name SEPARATOR ', ') AS maKeeper,
lod.create_by AS creator,
lod.create_time AS outTime
FROM
slt_agreement_info sai
LEFT JOIN ma_type mt ON mt.type_id = sai.type_id
LEFT JOIN ma_type mt2 ON mt.parent_id = mt2.type_id
LEFT JOIN ma_type_keeper mtk ON mtk.type_id = sai.type_id
LEFT JOIN sys_user su ON mtk.user_id = su.user_id
LEFT JOIN ma_machine mm ON mm.ma_id = sai.ma_id
LEFT JOIN lease_apply_info lai ON lai.id = sai.lease_id
LEFT JOIN ( SELECT parent_id, create_time, create_by FROM lease_out_details GROUP BY parent_id, create_by ) AS lod ON lod.parent_id = lai.id
WHERE
sai.end_time IS NULL
AND sai.back_id IS NULL
<if test="typeId != null">
AND sai.type_id = #{typeId}
</if>
<if test="keyWord != null and keyWord != ''">
AND (
mt2.type_name like concat('%',#{keyWord},'%') or
mt.type_name like concat('%',#{keyWord},'%') or
mm.ma_code like concat('%',#{keyWord},'%') or
lai.`code` like concat('%',#{keyWord},'%') or
lod.create_by like concat('%',#{keyWord},'%') or
su.nick_name like concat('%',#{keyWord},'%')
)
</if>
GROUP BY mm.ma_code,lai.`code`,mt.type_id
</select>
<select id="getRepairRecordList" resultType="com.bonus.material.basic.domain.RepairStorageInfo">
SELECT
mt2.type_name AS typeName,
mt.type_name AS typeModelName,
mt.buy_price AS buyPrice,
IFNULL( rad.repair_num, 0 ) - IFNULL( rad.repaired_num, 0 ) - IFNULL( rad.scrap_num, 0 ) AS repairNum,
tt.`code` AS repairCode,
bai.create_time AS leaseTime,
GROUP_CONCAT(DISTINCT su.nick_name ORDER BY su.nick_name SEPARATOR ', ') AS repairer,
bai.back_person AS creator,
mm.ma_code as maCode
FROM
repair_apply_details rad
LEFT JOIN ma_type mt ON mt.type_id = rad.type_id
LEFT JOIN ma_type mt2 ON mt.parent_id = mt2.type_id
LEFT JOIN ma_type_repair mtr ON mtr.type_id = rad.type_id
LEFT JOIN sys_user su ON mtr.user_id = su.user_id
LEFT JOIN ma_machine mm ON mm.ma_id = rad.ma_id
LEFT JOIN tm_task tt ON rad.task_id = tt.task_id
LEFT JOIN back_apply_info bai ON rad.back_id = bai.id
WHERE rad.`status` = '0'
<if test="typeId != null">
AND rad.type_id = #{typeId}
</if>
<if test="keyWord != null and keyWord != ''">
AND (
mt2.type_name like concat('%',#{keyWord},'%') or
mt.type_name like concat('%',#{keyWord},'%') or
mm.ma_code like concat('%',#{keyWord},'%') or
tt.`code` like concat('%',#{keyWord},'%') or
rad.repairer like concat('%',#{keyWord},'%') or
bai.back_person like concat('%',#{keyWord},'%') or
su.nick_name like concat('%',#{keyWord},'%')
)
</if>
GROUP BY mm.ma_code,tt.`code`,mt.type_id
</select>
<select id="getPurchaseRecordList" resultType="com.bonus.material.basic.domain.PurchaseInputInfo">
SELECT
pcd.task_id as taskId,
mt2.type_name AS typeName,
mt.type_name AS typeModelName,
mt.buy_price AS buyPrice,
IFNULL( pcd.check_num, 0 ) - IFNULL( pcd.input_num, 0 ) AS inputNum,
tt.`code` AS purchaseCode,
GROUP_CONCAT( DISTINCT su.nick_name ORDER BY su.nick_name SEPARATOR ', ' ) AS maKeeper,
pcd.check_time AS checkTime
FROM
purchase_check_details pcd
LEFT JOIN ma_type mt ON mt.type_id = pcd.type_id
LEFT JOIN ma_type mt2 ON mt.parent_id = mt2.type_id
LEFT JOIN tm_task tt ON pcd.task_id = tt.task_id
LEFT JOIN ma_type_keeper mtk ON mtk.type_id = pcd.type_id
LEFT JOIN sys_user su ON mtk.user_id = su.user_id
WHERE
pcd.`status` IN ( 3, 4, 13, 14 )
<if test="typeId != null">
AND pcd.type_id = #{typeId}
</if>
GROUP BY tt.`code`,
mt.type_id
</select>
<select id="getRepairInputList" resultType="com.bonus.material.basic.domain.RepairInputRecord">
SELECT
mt2.type_name AS typeName,
mt.type_name AS typeModelName,
mt.buy_price AS buyPrice,
IFNULL(rid.repair_num, 0) - IFNULL(rid.input_num, 0) AS repairInputNum,
tt.`code` AS repairInputCode,
GROUP_CONCAT(DISTINCT su.nick_name ORDER BY su.nick_name SEPARATOR ', ') AS maKeeper,
GROUP_CONCAT(DISTINCT su2.nick_name ORDER BY su2.nick_name SEPARATOR ', ') AS repairer,
rid.create_time as repairInputTime,
mm.ma_code as maCode
FROM
repair_input_details rid
LEFT JOIN ma_type mt ON mt.type_id = rid.type_id
LEFT JOIN ma_type mt2 ON mt.parent_id = mt2.type_id
LEFT JOIN tm_task tt ON rid.task_id = tt.task_id
LEFT JOIN ma_type_keeper mtk ON mtk.type_id = rid.type_id
LEFT JOIN sys_user su ON mtk.user_id = su.user_id
LEFT JOIN ma_type_repair mtr ON mtr.type_id = rid.type_id
LEFT JOIN sys_user su2 ON mtr.user_id = su2.user_id
LEFT JOIN repair_apply_details rad ON rid.repair_id = rad.id
LEFT JOIN ma_machine mm ON mm.ma_id = rid.ma_id
WHERE
rid.`status` IN (0)
<if test="typeId != null">
AND rid.type_id = #{typeId}
</if>
<if test="keyWord != null and keyWord != ''">
AND (
mt2.type_name like concat('%',#{keyWord},'%') or
mt.type_name like concat('%',#{keyWord},'%') or
tt.`code` like concat('%',#{keyWord},'%') or
su.nick_name like concat('%',#{keyWord},'%') or
su2.nick_name like concat('%',#{keyWord},'%') or
mm.ma_code like concat('%',#{keyWord},'%')
)
</if>
GROUP BY mm.ma_code,tt.`code`,mt.type_id
</select>
<select id="selectMaCodeByTaskIdAndTypeId" resultType="com.bonus.material.basic.domain.PurchaseInputInfo">
SELECT
pmi.id as id,
pmi.task_id as taskId,
pmi.type_id as typeId,
pmi.ma_code as maCode
FROM
purchase_macode_info pmi
LEFT JOIN ma_machine mm ON pmi.ma_code = mm.ma_code
AND mm.type_id = #{typeId}
WHERE
pmi.task_id = #{taskId}
AND pmi.type_id = #{typeId}
AND mm.ma_code IS NULL
AND pmi.ma_code IS NOT NULL
</select>
</mapper> </mapper>

View File

@ -337,6 +337,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
`status` = #{status}, `status` = #{status},
check_result = #{checkResult}, check_result = #{checkResult},
check_num = purchase_num, check_num = purchase_num,
check_time = NOW(),
<if test="warnDocuments != null and warnDocuments != ''"> <if test="warnDocuments != null and warnDocuments != ''">
warn_documents = #{warnDocuments}, warn_documents = #{warnDocuments},
</if> </if>