材料站功能优化

This commit is contained in:
mashuai 2025-09-13 01:02:36 +08:00
parent 4e1becb6a5
commit 16573aedc9
20 changed files with 1064 additions and 223 deletions

View File

@ -37,7 +37,9 @@ public enum TmTaskTypeEnum {
// 材料站领料
TM_TASK_MATERIAL_LEASE(22, "材料站领料任务"),
// 材料站退料
TM_TASK_MATERIAL_BACK(23, "材料站退料任务");
TM_TASK_MATERIAL_BACK(23, "材料站退料任务"),
// 材料站预约退料
TM_TASK_MATERIAL_BACK_APPOINT(24, "材料站预约退料任务");

View File

@ -277,9 +277,9 @@ public class MaterialLeaseInfoController extends BaseController {
@ApiOperation(value = "删除领料任务")
@PreventRepeatSubmit
@SysLog(title = "领料任务", businessType = OperaType.DELETE, logType = 1,module = "仓储管理->删除领料任务")
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(materialLeaseInfoService.deleteLeaseApplyInfoByIds(ids));
@PostMapping("/delete")
public AjaxResult delete(@RequestBody MaterialLeaseApplyInfo info) {
return toAjax(materialLeaseInfoService.deleteLeaseApplyInfoByIds(info));
}
/**

View File

@ -7,6 +7,7 @@ import com.bonus.common.core.utils.ServletUtils;
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.material.clz.domain.TeamVo;
import com.bonus.material.clz.domain.machine.MaterialUseStorageInfo;
import com.bonus.material.clz.domain.vo.MaterialRetainedTeamTotalVo;
import com.bonus.material.clz.domain.vo.MaterialRetainedTeamVo;
@ -60,34 +61,12 @@ public class MaterialMachineController extends BaseController {
@ApiOperation(value = "综合查询--保有设备总量查询")
@GetMapping("/getRetainedEquipmentList")
public AjaxResult getRetainedEquipmentList(MaterialRetainedEquipmentInfo bean) {
bean.setIsExport(1);
if (bean.getIsApp() != null && bean.getIsApp() == 1) {
List<MaterialRetainedEquipmentInfo> pageList = materialMachineService.getRetainedEquipmentList(bean);
return AjaxResult.success(pageList);
}
Integer pageIndex = Convert.toInt(ServletUtils.getParameter("pageNum"), 1);
Integer pageSize = Convert.toInt(ServletUtils.getParameter("pageSize"), 10);
List<MaterialRetainedEquipmentInfo> list = materialMachineService.getRetainedEquipmentList(bean);
return AjaxResult.success(ListPagingUtil.paging(pageIndex, pageSize, list));
}
/**
* 保有设备总量查询不带分页
* @param bean
* @return
*/
@ApiOperation(value = "综合查询--保有设备总量查询不带分页")
@GetMapping("/getRetainedEquipmentListNoPage")
public AjaxResult getRetainedEquipmentListNoPage(MaterialRetainedEquipmentInfo bean) {
bean.setIsExport(0);
List<MaterialRetainedEquipmentInfo> list = materialMachineService.getRetainedEquipmentList(bean);
MaterialRetainedEquipmentInfo dto = new MaterialRetainedEquipmentInfo();
if (CollectionUtils.isNotEmpty(list)) {
dto = list.get(0);
}
return AjaxResult.success(dto);
}
/**
* 工器具台账
* @param bean
@ -96,24 +75,10 @@ public class MaterialMachineController extends BaseController {
@ApiOperation(value = "工器具台账查询")
@GetMapping("/getTotalList")
public AjaxResult getTotalList(MaterialRetainedEquipmentInfo bean) {
Integer pageIndex = Convert.toInt(ServletUtils.getParameter("pageNum"), 1);
Integer pageSize = Convert.toInt(ServletUtils.getParameter("pageSize"), 10);
List<MaterialTotalMentInfo> list = materialMachineService.getTotalList(bean);
return AjaxResult.success(ListPagingUtil.paging(pageIndex, pageSize, list));
MaterialTotalMentInfo info = materialMachineService.getTotalList(bean);
return AjaxResult.success(info);
}
/**
* 导出工器具台账查询
* @param bean
* @return
*/
@ApiOperation(value = "综合查询--导出工器具台账查询")
@PostMapping("/exportTotalList")
public void exportTotalList(HttpServletResponse response, MaterialRetainedEquipmentInfo bean) {
List<MaterialTotalMentInfo> list = materialMachineService.getTotalList(bean);
ExcelUtil<MaterialTotalMentInfo> util = new ExcelUtil<>(MaterialTotalMentInfo.class);
util.exportExcel(response, list, "综合查询--工器具台账查询");
}
/**
* 导出保有设备总量查询
@ -123,10 +88,9 @@ public class MaterialMachineController extends BaseController {
@ApiOperation(value = "综合查询--导出保有设备总量查询")
@PostMapping("/exportRetainedEquipmentList")
public void exportRetainedEquipmentList(HttpServletResponse response, MaterialRetainedEquipmentInfo bean) {
bean.setIsExport(0);
List<MaterialRetainedEquipmentInfo> list = materialMachineService.getRetainedEquipmentList(bean);
ExcelUtil<MaterialRetainedEquipmentInfo> util = new ExcelUtil<>(MaterialRetainedEquipmentInfo.class);
util.exportExcel(response, list, "综合查询--在库机具设备详情");
util.exportExcel(response, list, "综合查询--保有设备总量查询");
}
/**
@ -339,4 +303,30 @@ public class MaterialMachineController extends BaseController {
List<MaterialRetainedEquipmentInfo> list = materialMachineService.getTeamNumThirdList(bean);
return AjaxResult.success(getDataTable(list));
}
/**
* 班组进出场记录
* @param bean
* @return
*/
@ApiOperation(value = "班组进出场记录")
@GetMapping("/getTeamInOrOutInfo")
public AjaxResult getTeamInOrOutInfo(TeamVo bean) {
startPage();
List<TeamVo> list = materialMachineService.getTeamInOrOutInfo(bean);
return AjaxResult.success(getDataTable(list));
}
/**
* 导出班组进出场记录
* @param response
* @param bean
*/
@ApiOperation(value = "导出班组进出场记录")
@PostMapping("/exportTeamInOrOutInfo")
public void exportTeamInOrOutInfo(HttpServletResponse response, TeamVo bean) {
List<TeamVo> list = materialMachineService.getTeamInOrOutInfo(bean);
ExcelUtil<TeamVo> util = new ExcelUtil<>(TeamVo.class);
util.exportExcel(response, list, "导出班组进出场记录");
}
}

View File

@ -0,0 +1,216 @@
package com.bonus.material.clz.domain;
import com.bonus.common.core.annotation.Excel;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
/**
* @description 综合查询--保有设备总量查询
* @author ma_sh
* @date 2024/2/26 14:51
*/
@ApiModel(description = "保有设备总量查询")
@Data
public class MaterialDto {
private static final long serialVersionUID = 2227217051604273598L;
@ApiModelProperty(value = "分公司名称")
private String impUnitName;
@ApiModelProperty(value = "项目部名称")
private String departName;
@ApiModelProperty(value = "工程id")
private String proId;
@ApiModelProperty(value = "工程名称")
private String proName;
@ApiModelProperty(value = "分包单位名称")
@Excel(name = "分包单位名称")
private String subUnitName;
@ApiModelProperty(value = "物资类型")
@Excel(name = "物资类型")
private String materialType;
@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 String unit;
@ApiModelProperty(value = "在库数量")
@Excel(name = "在库数量")
private BigDecimal storeNum;
@ApiModelProperty(value = "在用数量")
@Excel(name = "在用数量")
private BigDecimal usNum;
@ApiModelProperty(value = "在修数量")
private BigDecimal repairNum;
@ApiModelProperty(value = "新购待入库")
private BigDecimal inputNum;
@ApiModelProperty(value = "修试后待入库")
private BigDecimal repairInputNum;
@ApiModelProperty(value = "待报废数量")
private BigDecimal pendingScrapNum;
@ApiModelProperty(value = "已审核报废数量")
private BigDecimal scrapNum;
@ApiModelProperty(value = "总保有量")
@Excel(name = "总保有数量")
private BigDecimal allNum;
@ApiModelProperty(value = "购置单价")
private BigDecimal buyPrice;
@ApiModelProperty(value = "投入总价值")
//@Excel(name = "总保有量资产(万元)")
private BigDecimal totalPrice;
@ApiModelProperty(value = "五年以内成新率")
private String fiveReplacementRate;
@ApiModelProperty(value = "五年以内设备数量")
private BigDecimal fiveReplacementNum;
@ApiModelProperty(value = "五年至十年成新率")
private String tenReplacementRate;
@ApiModelProperty(value = "五年至十年设备数量")
private BigDecimal tenReplacementNum;
@ApiModelProperty(value = "十年以上成新率")
private String tenPlusReplacementRate;
@ApiModelProperty(value = "十年以上设备数量")
private BigDecimal tenPlusReplacementNum;
@ApiModelProperty(value = "管理模式")
@Excel(name = "管理模式")
private String manageType;
@ApiModelProperty(value = "创建者")
private String createBy;
@ApiModelProperty(value = "创建时间")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
@ApiModelProperty(value = "更新者")
private String updateBy;
@ApiModelProperty(value = "更新时间 ")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updateTime;
@ApiModelProperty(value = "关键字")
private String keyWord;
@ApiModelProperty(value = "数据所属组织")
private Integer companyId;
/** 1.机具仓储 2.调试仓储 */
private String maType;
private String maTypeName;
@ApiModelProperty(value = "一级类型id")
private Integer firstTypeId;
@ApiModelProperty(value = "二级类型id")
private Integer secondTypeId;
@ApiModelProperty(value = "三级类型id")
private Integer thirdTypeId;
private List<MaterialDto> modelList;
/**
* 是否伸展APP
*/
private boolean expanded = false;
/**
* 检验状态
*/
private String checkStatus;
private String maCode;
/** 本次检验日期 */
@ApiModelProperty(value = "本次检验日期")
@DateTimeFormat(pattern="yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date thisCheckTime;
/** 下次检验日期 */
@ApiModelProperty(value = "下次检验日期")
@DateTimeFormat(pattern="yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date nextCheckTime;
/**
* 状态(0 =正常1= 3个月检测到期2= 1个月检测到期3= 已过期)
*/
private String status;
/** 正常设备数量 */
private long normalNum;
/** 3个月检测到期设备数量 */
private long threeMonthNum;
/** 1个月检测到期设备数量 */
private long oneMonthNum;
/** 已过期设备数量 */
private long expiredNum;
@ApiModelProperty(value = "班组名称")
private String teamName;
@ApiModelProperty(value = "班组id")
private String teamId;
/**
* 班组长账号
*/
private String teamLeaderIdCard;
@ApiModelProperty(value = "i8工程id")
private String externalId;
@ApiModelProperty(value = "身份证号码")
private String idCard;
@ApiModelProperty(value = "实施单位id")
private String impUnit;
}

View File

@ -0,0 +1,136 @@
package com.bonus.material.clz.domain;
import com.bonus.common.core.annotation.Excel;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import lombok.Data;
import java.util.Date;
import java.util.List;
/**
* 班组管理
* @Author ma_sh
* @create 2025/5/12 10:07
*/
@Data
public class TeamVo {
/**
* 是否下拉选
*/
private Integer isAll;
/**
* 主键
*/
private Long id;
/**
* 工程名称
*/
@Excel(name = "工程名称", width = 70)
private String projectName;
/**
* 分包商名称
*/
@Excel(name = "班组分包名称", width = 30)
private String subcontractor;
/**
* 班组名称
*/
@Excel(name = "班组名称")
private String teamName;
/**
* 班组状态 1空闲2申报3进场
*/
private String teamStatus;
/**
* 班组状态 1空闲2申报3进场
*/
@Excel(name = "班组状态")
private String teamStatusName;
/**
* 是否解散 01
*/
private String isDismiss;
/**
* 是否解散 01
*/
@Excel(name = "是否解散")
private String isDismissName;
/**
* 实际进场时间
*/
@Excel(name = "实际进场时间")
private String actualProcessTime;
/**
* 实际出场时间
*/
@Excel(name = "实际出场时间")
private String actualExitTime;
/**
* 创建时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
/**
* 修改时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updateTime;
/**
* 修改人
*/
private String updateUser;
/**
* 关键字
*/
private String keyWord;
/**
* i8工程id
*/
private String projectId;
/**
* 工程id
*/
private String proId;
/**
* 班组长身份证号
*/
private String teamLeaderIdCard;
/**
* 班组长名称
*/
private String teamLeaderName;
/**
* 班组长电话
*/
private String teamLeaderPhone;
/**
* i8工程id集合
*/
private List<String> projectIdList;
@ApiModelProperty(value = "实施单位id")
private String impUnit;
}

View File

@ -310,4 +310,9 @@ public class MaterialLeaseApplyInfo extends BaseEntity {
* i8工程id集合
*/
private List<String> projectIdList;
/**
* 状态
*/
private String status;
}

View File

@ -38,17 +38,25 @@ public class MaterialRetainedEquipmentInfo {
@ApiModelProperty(value = "工程id")
private String proId;
@ApiModelProperty(value = "分公司")
@Excel(name = "分公司")
private String impUnitName;
@ApiModelProperty(value = "项目部")
@Excel(name = "项目部")
private String departName;
@ApiModelProperty(value = "工程名称")
@Excel(name = "工程名称")
private String proName;
@ApiModelProperty(value = "施工类型")
@Excel(name = "施工类型")
private String constructionType;
@ApiModelProperty(value = "分包单位")
@Excel(name = "分包单位")
private String subUnitName;
@ApiModelProperty(value = "物资类型")
@Excel(name = "物资类型")
private String materialType;
@ApiModelProperty(value = "班组名称")
@Excel(name = "班组名称")
private String teamName;
@ApiModelProperty(value = "物资名称")
@Excel(name = "物资名称")
@ -66,30 +74,13 @@ public class MaterialRetainedEquipmentInfo {
private String unit;
@ApiModelProperty(value = "在库数量")
@Excel(name = "在库数量")
private BigDecimal storeNum;
@ApiModelProperty(value = "在用数量")
@Excel(name = "在用数量")
private BigDecimal usNum;
@ApiModelProperty(value = "在修数量")
private BigDecimal repairNum;
@ApiModelProperty(value = "新购待入库")
private BigDecimal inputNum;
@ApiModelProperty(value = "修试后待入库")
private BigDecimal repairInputNum;
@ApiModelProperty(value = "待报废数量")
private BigDecimal pendingScrapNum;
@ApiModelProperty(value = "已审核报废数量")
private BigDecimal scrapNum;
@ApiModelProperty(value = "总保有量")
@Excel(name = "总保有数量")
@ApiModelProperty(value = "数量")
@Excel(name = "数量")
private BigDecimal allNum;
@ApiModelProperty(value = "购置单价")
@ -118,7 +109,6 @@ public class MaterialRetainedEquipmentInfo {
private BigDecimal tenPlusReplacementNum;
@ApiModelProperty(value = "管理模式")
@Excel(name = "管理模式")
private String manageType;
@ApiModelProperty(value = "创建者")
@ -200,9 +190,6 @@ public class MaterialRetainedEquipmentInfo {
/** 已过期设备数量 */
private long expiredNum;
@ApiModelProperty(value = "班组名称")
private String teamName;
@ApiModelProperty(value = "班组id")
private String teamId;

View File

@ -36,7 +36,27 @@ public class MaterialTotalMentInfo {
@Excel(name = "工程名称", width = 80)
private String proName;
@ApiModelProperty(value = "项目部总数")
@Excel(name = "项目部总数")
private Integer departNum;
@ApiModelProperty(value = "工程总数")
@Excel(name = "工程总数")
private Integer proNum;
@ApiModelProperty(value = "班组总数")
@Excel(name = "班组总数")
private Integer teamNum;
@ApiModelProperty(value = "总保有量")
@Excel(name = "总保有量", align = HorizontalAlignment.RIGHT)
@Excel(name = "总保有量")
private BigDecimal allNum;
@ApiModelProperty(value = "站内数量")
@Excel(name = "站内数量")
private BigDecimal inNum;
@ApiModelProperty(value = "在用数量")
@Excel(name = "在用数量")
private BigDecimal useNum;
}

View File

@ -36,4 +36,11 @@ public interface IwsTeamUserMapper {
* @return List集合
*/
List<IwsTeamUserVo> selectProjectTeamInfoByProjectIds(@Param("ids") List<String> ids);
/**
* 根据班组名称查询分包名称
* @param teamName
* @return
*/
String getTeamName(String teamName);
}

View File

@ -141,16 +141,16 @@ public interface MaterialLeaseInfoMapper {
/**
* 删除站点领料详情数据
* @param ids
* @param id
* @return
*/
int deleteLeaseApplyDetailsByParentIds(Long[] ids);
int deleteLeaseApplyDetailsByParentIds(Long id);
/**
* 删除站点领料记录
* @param ids
* @param id
*/
int deleteById(Long[] ids);
int deleteById(Long id);
/**
* 修改领料任务
@ -181,10 +181,10 @@ public interface MaterialLeaseInfoMapper {
/**
* 删除站点领料记录
* @param ids
* @param id
* @return
*/
int deleteLeaseApplyInfoByIds(Long[] ids);
int deleteLeaseApplyInfoByIds(Long id);
/**
* 工器具领料记录
@ -353,10 +353,10 @@ public interface MaterialLeaseInfoMapper {
/**
* 根据任务id查询领料任务ID
* @param ids
* @param id
* @return
*/
List<Long> getTaskIds(Long[] ids);
Long getTaskIds(Long id);
/**
* ocr出库根据code查询在库机具信息
@ -371,4 +371,18 @@ public interface MaterialLeaseInfoMapper {
* @return
*/
List<LeaseOutDetails> getInfoByCode(BmQrcodeInfo bmQrcodeInfo);
/**
* 删除协议表数据
* @param id
* @return
*/
int deleteSltInfo(Long id);
/**
* 先根据id查询该领料单是否已经退料
* @param id
* @return
*/
List<MaterialLeaseApplyInfo> getSltInfoList(Long id);
}

View File

@ -1,6 +1,7 @@
package com.bonus.material.clz.mapper;
import com.bonus.material.back.domain.vo.MaCodeVo;
import com.bonus.material.clz.domain.TeamVo;
import com.bonus.material.clz.domain.machine.MaterialUseStorageInfo;
import com.bonus.material.clz.domain.vo.MaterialRetainedTeamTotalVo;
import com.bonus.material.clz.domain.vo.MaterialRetainedTeamVo;
@ -157,4 +158,60 @@ public interface MaterialMachineMapper {
* @return
*/
List<MaterialRetainedEquipmentInfo> getTotalInfoList(MaterialRetainedEquipmentInfo bean);
/**
* 班组进出场记录
* @param bean
* @return
*/
List<TeamVo> getTeamInOrOutInfo(TeamVo bean);
/**
* 获取项目部总数
* @param bean
* @return
*/
Integer selectDepartNum(MaterialRetainedEquipmentInfo bean);
/**
* 获取工程总数
* @param bean
* @return
*/
Integer selectProjectNum(MaterialRetainedEquipmentInfo bean);
/**
* 获取班组总数
* @param bean
* @return
*/
Integer selectTeamNum(MaterialRetainedEquipmentInfo bean);
/**
* 获取站内库存在用量保有量
* @param bean
* @return
*/
MaterialRetainedEquipmentInfo getRetainTotalInfo(MaterialRetainedEquipmentInfo bean);
/**
* 库存量
* @param bean
* @return
*/
MaterialRetainedEquipmentInfo getRetainStoreInfo(MaterialRetainedEquipmentInfo bean);
/**
* 查询目前还有库存的设备
* @param bean
* @return
*/
List<MaterialRetainedEquipmentInfo> getRetainInfoList(MaterialRetainedEquipmentInfo bean);
/**
* 查询目前正在使用的设备
* @param bean
* @return
*/
List<MaterialRetainedEquipmentInfo> getUsInfoList(MaterialRetainedEquipmentInfo bean);
}

View File

@ -112,10 +112,10 @@ public interface MaterialLeaseInfoService {
/**
* 删除领料任务
* @param ids
* @param info
* @return
*/
int deleteLeaseApplyInfoByIds(Long[] ids);
int deleteLeaseApplyInfoByIds(MaterialLeaseApplyInfo info);
/**
* 工器具领料记录

View File

@ -1,6 +1,7 @@
package com.bonus.material.clz.service;
import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.material.clz.domain.TeamVo;
import com.bonus.material.clz.domain.machine.MaterialUseStorageInfo;
import com.bonus.material.clz.domain.vo.MaterialRetainedTeamTotalVo;
import com.bonus.material.clz.domain.vo.MaterialRetainedTeamVo;
@ -127,5 +128,12 @@ public interface MaterialMachineService {
* @param bean
* @return
*/
List<MaterialTotalMentInfo> getTotalList(MaterialRetainedEquipmentInfo bean);
MaterialTotalMentInfo getTotalList(MaterialRetainedEquipmentInfo bean);
/**
* 班组进出场记录
* @param bean
* @return
*/
List<TeamVo> getTeamInOrOutInfo(TeamVo bean);
}

View File

@ -1044,7 +1044,7 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService {
leaseApplyInfo.setUpdateBy(createBy);
// 去除创建一个新的数组对象直接复用
Long[] ids = {leaseApplyInfo.getId()};
Long id = leaseApplyInfo.getId();
if (CollectionUtil.isNotEmpty(leaseApplyInfo.getBmFileInfos())) {
// 删除原有数据
BmFileInfo bmFileInfo = new BmFileInfo();
@ -1065,9 +1065,9 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService {
}
if (CollectionUtil.isNotEmpty(leaseApplyRequestVo.getLeaseApplyDetailsList())) {
// 业务逻辑代码,删除lease_apply_details
materialLeaseInfoMapper.deleteLeaseApplyDetailsByParentIds(ids);
materialLeaseInfoMapper.deleteLeaseApplyDetailsByParentIds(id);
// 业务逻辑代码,删除lease_out_details
materialLeaseInfoMapper.deleteById(ids);
materialLeaseInfoMapper.deleteById(id);
/*for (MaterialLeaseApplyDetails leaseApplyDetails : leaseApplyRequestVo.getLeaseApplyDetailsList()) {
if (!CollectionUtils.isEmpty(leaseApplyDetails.getMaCodeList())) {
for (MaterialLeaseMaCodeDto leaseMaCodeDto : leaseApplyDetails.getMaCodeList()) {
@ -1184,32 +1184,44 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService {
/**
* 删除领料任务
*
* @param ids
* @param info
* @return
*/
@Override
public int deleteLeaseApplyInfoByIds(Long[] ids) {
public int deleteLeaseApplyInfoByIds(MaterialLeaseApplyInfo info) {
int result = 0;
// 根据ids查询任务id
List<Long> taskIds = materialLeaseInfoMapper.getTaskIds(ids);
if (!CollectionUtils.isEmpty(taskIds)) {
// 先根据id查询该领料单是否已经退料
List<MaterialLeaseApplyInfo> list = materialLeaseInfoMapper.getSltInfoList(info.getId());
if (!CollectionUtils.isEmpty(list)) {
// 如果list包含状态为1的数据
if (list.stream().anyMatch(item -> "1".equals(item.getStatus()))) {
throw new ServiceException("该领料单已经进行退料操作,无法删除");
}
}
// 根据id查询任务id
Long taskId = materialLeaseInfoMapper.getTaskIds(info.getId());
if (taskId != null) {
// 根据任务id删除任务表数据
result = tmTaskMapper.deleteTaskByIds(taskIds);
result = tmTaskMapper.deleteTaskByIds(taskId);
if (result < 1) {
throw new ServiceException("删除任务信息失败");
}
// 根据任务id删除任务协议表数据
result = tmTaskMapper.deleteAgreementId(taskIds);
result = tmTaskMapper.deleteAgreementId(taskId);
if (result < 1) {
throw new ServiceException("删除任务协议信息失败");
}
}
result = materialLeaseInfoMapper.deleteLeaseApplyInfoByIds(ids);
result = materialLeaseInfoMapper.deleteLeaseApplyInfoByIds(info.getId());
if (result > 0) {
// 删除lease_apply_details表数据
result += materialLeaseInfoMapper.deleteLeaseApplyDetailsByParentIds(ids);
// 业务逻辑代码,删除lease_out_details
result += materialLeaseInfoMapper.deleteById(ids);
// 删除clz_lease_apply_details表数据
result += materialLeaseInfoMapper.deleteLeaseApplyDetailsByParentIds(info.getId());
// 业务逻辑代码,删除clz_lease_out_details
result += materialLeaseInfoMapper.deleteById(info.getId());
// 如果为领料出库删除协议表数据
if ("1".equals(info.getType())) {
result += materialLeaseInfoMapper.deleteSltInfo(info.getId());
}
}
return result;
}

View File

@ -6,6 +6,7 @@ import com.alibaba.nacos.common.utils.StringUtils;
import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.common.security.utils.SecurityUtils;
import com.bonus.material.basic.domain.BmProject;
import com.bonus.material.clz.domain.TeamVo;
import com.bonus.material.clz.domain.lease.MaterialLeaseApplyInfo;
import com.bonus.material.clz.domain.machine.MaterialUseStorageInfo;
import com.bonus.material.clz.domain.vo.*;
@ -16,7 +17,6 @@ import com.bonus.material.common.mapper.SelectMapper;
import com.bonus.material.ma.domain.Machine;
import com.bonus.material.clz.domain.BmTeam;
import com.bonus.material.clz.domain.machine.MaterialStorageInfo;
import com.bonus.material.clz.mapper.BmTeamMapper;
import com.bonus.material.clz.mapper.MaterialMachineMapper;
import com.bonus.material.clz.service.MaterialMachineService;
import lombok.extern.slf4j.Slf4j;
@ -24,11 +24,6 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.Period;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.stream.Collectors;
@ -43,9 +38,6 @@ public class MaterialMachineServiceImpl implements MaterialMachineService {
@Resource
private MaterialMachineMapper materialMachineMapper;
@Resource
private BmTeamMapper bmTeamMapper;
@Resource
private SelectMapper mapper;
@ -162,53 +154,32 @@ public class MaterialMachineServiceImpl implements MaterialMachineService {
bean.setProjectIdList(projectIdList);
}
}
BigDecimal totalPrice = BigDecimal.ZERO.setScale(2, RoundingMode.HALF_UP);
BigDecimal totalStoreNum = BigDecimal.ZERO.setScale(3, RoundingMode.HALF_UP);
BigDecimal totalUsNum = BigDecimal.ZERO.setScale(3, RoundingMode.HALF_UP);
BigDecimal totalRepairNum = BigDecimal.ZERO.setScale(3, RoundingMode.HALF_UP);
BigDecimal totalInputNum = BigDecimal.ZERO.setScale(3, RoundingMode.HALF_UP);
BigDecimal totalRepairInputNum = BigDecimal.ZERO.setScale(3, RoundingMode.HALF_UP);
BigDecimal totalAllNum = BigDecimal.ZERO.setScale(3, RoundingMode.HALF_UP);
Long deptId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
if (deptId != null) {
bean.setImpUnit(deptId.toString());
}
List<MaterialRetainedEquipmentInfo> recordList = materialMachineMapper.getRetainedEquipmentList(bean);
if (!org.springframework.util.CollectionUtils.isEmpty(recordList)) {
// 查询目前在用的设备信息
List<MaterialRetainedEquipmentInfo> usList = materialMachineMapper.getUsInfoList(bean);
//查询目前还有库存的设备
List<MaterialRetainedEquipmentInfo> recordList = materialMachineMapper.getRetainInfoList(bean);
if (!CollectionUtils.isEmpty(usList)) {
for (MaterialRetainedEquipmentInfo materialRetainedEquipmentInfo : usList) {
// 根据班组名称查询分包单位
String subUnitName = iwsTeamUserMapper.getTeamName(materialRetainedEquipmentInfo.getTeamName());
materialRetainedEquipmentInfo.setSubUnitName(subUnitName);
}
// 数据合并
if (!CollectionUtils.isEmpty(recordList)) {
usList.addAll(recordList);
}
if (teamData != null) {
// 将sortedList中班组身份证号与username相同的元素过滤处理
recordList = recordList.stream()
usList = usList.stream()
.filter(item -> StringUtils.isBlank(item.getIdCard()) || username.equals(item.getIdCard()))
.collect(Collectors.toList());
} /*else {
recordList = filterInfo(recordList, username);
}*/
}
if (CollectionUtils.isNotEmpty(recordList)) {
for (MaterialRetainedEquipmentInfo retainedEquipmentInfo : recordList) {
totalStoreNum = totalStoreNum.add(retainedEquipmentInfo.getStoreNum());
totalUsNum = totalUsNum.add(retainedEquipmentInfo.getUsNum());
totalAllNum = totalAllNum.add(retainedEquipmentInfo.getAllNum());
BigDecimal equipmentPrice = retainedEquipmentInfo.getAllNum()
.multiply(retainedEquipmentInfo.getBuyPrice())
.divide(new BigDecimal(10000), 2, RoundingMode.HALF_UP);
totalPrice = totalPrice.add(equipmentPrice);
retainedEquipmentInfo.setTotalPrice(equipmentPrice);
}
if (bean.getIsExport() == 0) {
MaterialRetainedEquipmentInfo retainedEquipmentInfo = new MaterialRetainedEquipmentInfo();
retainedEquipmentInfo.setStoreNum(totalStoreNum);
retainedEquipmentInfo.setUsNum(totalUsNum);
retainedEquipmentInfo.setRepairNum(totalRepairNum);
retainedEquipmentInfo.setInputNum(totalInputNum);
retainedEquipmentInfo.setRepairInputNum(totalRepairInputNum);
retainedEquipmentInfo.setAllNum(totalAllNum);
retainedEquipmentInfo.setTotalPrice(totalPrice);
retainedEquipmentInfo.setUnit("合计");
recordList.add(0, retainedEquipmentInfo);
}
}
return recordList;
return usList;
}
/**
@ -758,7 +729,8 @@ public class MaterialMachineServiceImpl implements MaterialMachineService {
* @return
*/
@Override
public List<MaterialTotalMentInfo> getTotalList(MaterialRetainedEquipmentInfo bean) {
public MaterialTotalMentInfo getTotalList(MaterialRetainedEquipmentInfo bean) {
MaterialTotalMentInfo info = new MaterialTotalMentInfo();
String username = SecurityUtils.getLoginUser().getUsername();
BmTeam teamData = null;
Set<String> userRoles = SecurityUtils.getLoginUser().getRoles();
@ -771,9 +743,11 @@ public class MaterialMachineServiceImpl implements MaterialMachineService {
// 根据用户名查询项目部信息
List<String> departId = mapper.getDepartId(username);
// 根据项目部id查询工程信息
List<String> projectIdList = mapper.getProjectId(departId);
if (!org.springframework.util.CollectionUtils.isEmpty(projectIdList)) {
bean.setProjectIdList(projectIdList);
if (!CollectionUtils.isEmpty(departId)) {
List<String> projectIdList = mapper.getProjectId(departId);
if (!CollectionUtils.isEmpty(projectIdList)) {
bean.setProjectIdList(projectIdList);
}
}
}
Long deptId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
@ -781,54 +755,47 @@ public class MaterialMachineServiceImpl implements MaterialMachineService {
bean.setImpUnit(deptId.toString());
}
}
// 获取项目部总数
Integer departNum = materialMachineMapper.selectDepartNum(bean);
// 获取工程总数
Integer projectNum = materialMachineMapper.selectProjectNum(bean);
// 获取班组总数
Integer teamNum = materialMachineMapper.selectTeamNum(bean);
// 获取在用量
MaterialRetainedEquipmentInfo useInfo = materialMachineMapper.getRetainTotalInfo(bean);
BigDecimal useNum = (useInfo != null && useInfo.getUsNum() != null) ?
useInfo.getUsNum() : BigDecimal.ZERO;
List<MaterialRetainedEquipmentInfo> recordList = materialMachineMapper.getRetainedEquipmentList(bean);
if (!CollectionUtils.isEmpty(recordList)) {
if (teamData != null) {
// 将sortedList中班组身份证号与username相同的元素过滤处理
recordList = recordList.stream()
.filter(item -> StringUtils.isBlank(item.getIdCard()) || username.equals(item.getIdCard()))
.collect(Collectors.toList());
}
// 库存量
MaterialRetainedEquipmentInfo storeInfo = materialMachineMapper.getRetainStoreInfo(bean);
BigDecimal storeNum = (storeInfo != null && storeInfo.getStoreNum() != null) ?
storeInfo.getStoreNum() : BigDecimal.ZERO;
BigDecimal storeUseNum = (storeInfo != null && storeInfo.getUsNum() != null) ?
storeInfo.getUsNum() : BigDecimal.ZERO;
// 站内库存量 = 库存量 - 库存中已使用量不能为负数
BigDecimal inNum = storeNum.subtract(storeUseNum);
if (inNum.compareTo(BigDecimal.ZERO) < 0) {
inNum = BigDecimal.ZERO;
}
List<MaterialTotalMentInfo> groupedList = new ArrayList<>();
if (CollectionUtils.isNotEmpty(recordList)) {
// 用于分组的Map键为包含proCenter和proId的组合对象值为分组后的汇总信息
Map<String, MaterialTotalMentInfo> groupMap = new HashMap<>();
// 设置结果
info.setInNum(inNum);
info.setUseNum(useNum);
info.setDepartNum(departNum);
info.setProNum(projectNum);
info.setTeamNum(teamNum);
info.setAllNum(inNum.add(useNum));
return info;
}
for (MaterialRetainedEquipmentInfo record : recordList) {
// 构建唯一的分组键将proCenter和proId拼接确保相同组合的键一致
String groupKey = record.getProCenter() + "_" + record.getProId();
// 检查Map中是否已存在该分组
if (groupMap.containsKey(groupKey)) {
// 已存在则累加allNum
MaterialTotalMentInfo existingRecord = groupMap.get(groupKey);
existingRecord.setAllNum(existingRecord.getAllNum().add(record.getAllNum()));
} else {
// 不存在则新增分组注意如果需要保留原始对象其他字段建议创建新对象避免修改原数据
MaterialTotalMentInfo newRecord = new MaterialTotalMentInfo();
newRecord.setProCenter(record.getProCenter());
newRecord.setProId(record.getProId());
newRecord.setProName(record.getProName());
newRecord.setAllNum(record.getAllNum());
// 如需保留其他字段在这里继续设置
groupMap.put(groupKey, newRecord);
}
}
// 分组后的结果集合可根据需要转换为List
groupedList = new ArrayList<>(groupMap.values());
// 如果关键字不为空进行过滤
if (CollectionUtils.isNotEmpty(groupedList)) {
if (StringUtils.isNotBlank(bean.getKeyWord())) {
groupedList = groupedList.stream()
.filter(item -> containsTotalKeyword(item, bean.getKeyWord()))
.collect(Collectors.toList());
}
}
}
return groupedList;
/**
* 班组进出场记录
* @param bean
* @return
*/
@Override
public List<TeamVo> getTeamInOrOutInfo(TeamVo bean) {
return materialMachineMapper.getTeamInOrOutInfo(bean);
}
/**

View File

@ -149,17 +149,17 @@ public interface TmTaskMapper {
/**
* 批量删除任务
* @param taskIds
* @param taskId
* @return
*/
int deleteTaskByIds(@Param("taskIds") List<Long> taskIds);
int deleteTaskByIds(@Param("taskId") Long taskId);
/**
* 批量删除协议id
* @param taskIds
* @param taskId
* @return
*/
int deleteAgreementId(@Param("taskIds") List<Long> taskIds);
int deleteAgreementId(@Param("taskId") Long taskId);
/**
* 根据任务id查询任务状态

View File

@ -46,4 +46,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{id}
</foreach>
</select>
<select id="getTeamName" resultType="java.lang.String">
select
DISTINCT
bzgl_bz.ssfbdw
from
`micro-tool`.bzgl_bz bzgl_bz
WHERE bzgl_bz.bz_status = '3'
and bzgl_bz.bzmc = #{teamName}
Limit 1
</select>
</mapper>

View File

@ -370,24 +370,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</update>
<delete id="deleteLeaseApplyDetailsByParentIds">
delete from clz_lease_apply_details where parent_id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
delete from clz_lease_apply_details where parent_id = #{id}
</delete>
<delete id="deleteById">
delete from clz_lease_out_details where parent_id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
delete from clz_lease_out_details where parent_id = #{id}
</delete>
<delete id="deleteLeaseApplyInfoByIds">
delete from clz_lease_apply_info where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
delete from clz_lease_apply_info where id = #{id}
</delete>
<delete id="deleteSltInfo">
delete from clz_slt_agreement_info where lease_id = #{id}
</delete>
<select id="selectLeaseApplyInfoList" parameterType="com.bonus.material.clz.domain.lease.MaterialLeaseApplyInfo" resultMap="LeaseApplyInfoResult">
@ -1206,10 +1201,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
FROM
clz_lease_apply_info
WHERE
id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
id = #{id}
</select>
<select id="getMaCodeList" resultType="com.bonus.common.biz.domain.lease.LeaseOutDetails">
@ -1274,4 +1266,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND mt.type_id = #{typeId}
</if>
</select>
<select id="getSltInfoList" resultType="com.bonus.material.clz.domain.lease.MaterialLeaseApplyInfo">
SELECT
id as id,
type_id as typeId,
status as status
FROM
clz_slt_agreement_info
WHERE
lease_id = #{id}
</select>
</mapper>

View File

@ -945,4 +945,416 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</if>
</select>
<select id="getTeamInOrOutInfo" resultType="com.bonus.material.clz.domain.TeamVo">
SELECT DISTINCT
bzgl_bz.ssfbdw AS subcontractor,
bzgl_bz.bzmc AS teamName,
bzgl_bz.bzz_name AS teamLeaderName,
bzgl_bz.bz_status AS teamStatus,
CASE bzgl_bz.bz_status
WHEN '1' THEN '空闲'
WHEN '2' THEN '申报'
WHEN '3' THEN '进场'
ELSE '未知'
END AS teamStatusName,
bzgl_bz.project_name AS projectName,
org_user.mobile AS teamLeaderPhone,
bzgl_bz.sfjs AS isDismiss,
CASE bzgl_bz.sfjs
WHEN '0' THEN '否'
WHEN '1' THEN '是'
ELSE '未知'
END AS isDismissName,
bzgl_bz.sjjcsj AS actualProcessTime,
bzgl_bz.sjccsj AS actualExitTime,
bp.imp_unit AS impUnit
FROM
`micro-tool`.bzgl_bz bzgl_bz
LEFT JOIN `uni_org`.org_user org_user ON bzgl_bz.bzz_idcard = org_user.id_card
LEFT JOIN bm_project bp ON bp.external_id = bzgl_bz.project_id
WHERE 1 = 1
<if test="proId != null and proId != ''">
AND bp.pro_id = #{proId}
</if>
<if test="impUnit != null and impUnit != ''">
AND bp.imp_unit = #{impUnit}
</if>
<if test="keyWord != null and keyWord != ''">
AND (
bzgl_bz.ssfbdw like concat('%',#{keyWord},'%') or
bzgl_bz.bzmc like concat('%',#{keyWord},'%') or
bzgl_bz.bzz_name like concat('%',#{keyWord},'%') or
bzgl_bz.project_name like concat('%',#{keyWord},'%')
)
</if>
GROUP BY bzgl_bz.bzmc
</select>
<select id="selectDepartNum" resultType="java.lang.Integer">
SELECT
COUNT( project_dept_id )
FROM
data_center.dx_fb_son
WHERE
1 =1
<if test="impUnitName != null and impUnitName != ''">
AND apply_company = #{impUnitName}
</if>
<if test="departName != null and departName != ''">
AND project_dept = #{departName}
</if>
</select>
<select id="selectProjectNum" resultType="java.lang.Integer">
SELECT
count( DISTINCT bp.external_id ) AS total_external_id
FROM
slt_agreement_info sai
LEFT JOIN bm_agreement_info bai ON sai.agreement_id = bai.agreement_id
LEFT JOIN bm_project bp ON bai.project_id = bp.pro_id
LEFT JOIN sys_dept sd ON sd.dept_id = bp.imp_unit
WHERE
sai.is_slt = 0
AND bp.external_id IS NOT NULL
<if test="impUnitName != null and impUnitName != ''">
AND sd.dept_name = #{impUnitName}
</if>
<if test="departName != null and departName != ''">
AND bp.pro_center = #{departName}
</if>
</select>
<select id="selectTeamNum" resultType="java.lang.Integer">
SELECT
COUNT( DISTINCT bz.id )
FROM
`micro-tool`.bzgl_bz bz
LEFT JOIN `micro-tool`.bzgl_bz_jccdj bc ON bz.id = bc.bz_id
WHERE
bz.bz_status = 3
<if test="impUnitName != null and impUnitName != ''">
AND bc.sszz = #{impUnitName}
</if>
<if test="proName != null and proName != ''">
AND bz.project_name = #{proName}
</if>
<if test="teamName != null and teamName != ''">
AND bz.bzmc = #{teamName}
</if>
</select>
<select id="getRetainTotalInfo" resultType="com.bonus.material.clz.domain.vo.MaterialRetainedEquipmentInfo">
SELECT
mt.type_id,
mt4.type_name AS constructionType,
mt4.type_id AS firstTypeId,
mt3.type_name AS materialType,
mt3.type_id AS secondTypeId,
mt2.type_name AS typeName,
mt2.type_id AS thirdTypeId,
mt.type_name AS typeModelName,
SUM(IFNULL( sai.num, 0 )) AS usNum,
bp.pro_name as proName,
bp.pro_id as proId,
bp.external_id as externalId,
bp.imp_unit AS impUnit,
bu.bzz_idcard AS idCard,
bp.pro_center AS proCenter
FROM
clz_slt_agreement_info sai
LEFT JOIN ma_type mt ON mt.type_id = sai.type_id
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
LEFT JOIN ma_type mt3 ON mt3.type_id = mt2.parent_id
LEFT JOIN ma_type mt4 ON mt4.type_id = mt3.parent_id
LEFT JOIN clz_bm_agreement_info bai ON sai.agreement_id = bai.agreement_id
LEFT JOIN bm_project bp ON bai.project_id = bp.pro_id
LEFT JOIN bm_unit bu ON bai.unit_id = bu.unit_id AND bu.del_flag = '0'
LEFT JOIN sys_dept sd ON sd.dept_id = bp.imp_unit
WHERE
sai.`status` = '0'
AND sai.end_time IS NULL
AND sai.back_id IS NULL
<if test="impUnitName != null and impUnitName != ''">
AND sd.dept_name = #{impUnitName}
</if>
<if test="proName != null and proName != ''">
AND bp.pro_name = #{proName}
</if>
<if test="departName != null and departName != ''">
AND bp.pro_center = #{departName}
</if>
<if test="teamName != null and teamName != ''">
AND bu.unit_name = #{teamName}
</if>
<if test="typeName != null and typeName != ''">
AND mt2.type_name = #{typeName}
</if>
<if test="typeModelName != null and typeModelName != ''">
AND mt.type_name = #{typeModelName}
</if>
<if test="projectIdList != null and projectIdList.size() > 0">
and bp.external_id in
<foreach item="item" collection="projectIdList" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="impUnit != null and impUnit != ''">
and bp.imp_unit = #{impUnit}
</if>
</select>
<select id="getRetainStoreInfo" resultType="com.bonus.material.clz.domain.vo.MaterialRetainedEquipmentInfo">
SELECT
mt.type_id,
mt4.type_name AS constructionType,
mt4.type_id AS firstTypeId,
mt3.type_name AS materialType,
mt3.type_id AS secondTypeId,
mt2.type_name AS typeName,
mt2.type_id AS thirdTypeId,
mt.type_name AS typeModelName,
SUM(IFNULL( sai.num, 0 )) AS storeNum,
bp.pro_name as proName,
bp.pro_id as proId,
bp.external_id as externalId,
bp.imp_unit AS impUnit,
bu.bzz_idcard AS idCard,
bp.pro_center AS proCenter
FROM
slt_agreement_info sai
LEFT JOIN ma_type mt ON mt.type_id = sai.type_id
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
LEFT JOIN ma_type mt3 ON mt3.type_id = mt2.parent_id
LEFT JOIN ma_type mt4 ON mt4.type_id = mt3.parent_id
LEFT JOIN bm_agreement_info bai ON sai.agreement_id = bai.agreement_id
LEFT JOIN bm_project bp ON bai.project_id = bp.pro_id
LEFT JOIN bm_unit bu ON bai.unit_id = bu.unit_id AND bu.del_flag = '0'
LEFT JOIN sys_dept sd ON sd.dept_id = bp.imp_unit
WHERE
sai.`status` = '0'
AND sai.is_slt = '0'
AND sai.end_time IS NULL
AND sai.back_id IS NULL
<if test="impUnitName != null and impUnitName != ''">
AND sd.dept_name = #{impUnitName}
</if>
<if test="proName != null and proName != ''">
AND bp.pro_name = #{proName}
</if>
<if test="departName != null and departName != ''">
AND bp.pro_center = #{departName}
</if>
<if test="teamName != null and teamName != ''">
AND bu.unit_name = #{teamName}
</if>
<if test="typeName != null and typeName != ''">
AND mt2.type_name = #{typeName}
</if>
<if test="typeModelName != null and typeModelName != ''">
AND mt.type_name = #{typeModelName}
</if>
<if test="projectIdList != null and projectIdList.size() > 0">
and bp.external_id in
<foreach item="item" collection="projectIdList" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="impUnit != null and impUnit != ''">
and bp.imp_unit = #{impUnit}
</if>
</select>
<select id="getRetainInfoList" resultType="com.bonus.material.clz.domain.vo.MaterialRetainedEquipmentInfo">
SELECT
mt.type_id AS typeId,
mt4.type_name AS constructionType,
mt3.type_name AS materialType,
mt2.type_name AS typeName,
mt2.type_id AS thirdTypeId,
mt.type_name AS typeModelName,
mt.unit_name AS unit,
subquery1.proId AS proId,
subquery1.proName AS proName,
subquery1.externalId AS externalId,
subquery1.impUnit AS impUnit,
subquery1.idCard AS idCard,
IFNULL(subquery1.usNum, 0) - IFNULL(subquery3.usNum, 0) AS storeNum,
IFNULL(subquery3.usNum, 0) AS usNum,
IFNULL(subquery1.usNum, 0) AS allNum,
subquery1.proCenter AS departName,
subquery1.departName AS impUnitName
FROM ma_type mt
LEFT JOIN (
SELECT
mt.type_id,
mt4.type_name AS constructionType,
mt4.type_id AS firstTypeId,
mt3.type_name AS materialType,
mt3.type_id AS secondTypeId,
mt2.type_name AS typeName,
mt2.type_id AS thirdTypeId,
mt.type_name AS typeModelName,
SUM(IFNULL( sai.num, 0 )) AS usNum,
bp.pro_name as proName,
bp.pro_id as proId,
bp.external_id as externalId,
bp.imp_unit AS impUnit,
bu.bzz_idcard AS idCard,
bp.pro_center AS proCenter,
sd.dept_name AS departName
FROM
slt_agreement_info sai
LEFT JOIN ma_type mt ON mt.type_id = sai.type_id
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
LEFT JOIN ma_type mt3 ON mt3.type_id = mt2.parent_id
LEFT JOIN ma_type mt4 ON mt4.type_id = mt3.parent_id
LEFT JOIN bm_agreement_info bai ON sai.agreement_id = bai.agreement_id
LEFT JOIN bm_project bp ON bai.project_id = bp.pro_id
LEFT JOIN bm_unit bu ON bai.unit_id = bu.unit_id
AND bu.del_flag = '0'
LEFT JOIN sys_dept sd ON sd.dept_id = bp.imp_unit
WHERE
sai.`status` = '0'
AND sai.is_slt = '0'
AND sai.end_time IS NULL
AND sai.back_id IS NULL
GROUP BY mt.type_id, bp.pro_id
) AS subquery1 ON mt.type_id = subquery1.type_id
LEFT JOIN (
SELECT
mt.type_id,
mt4.type_name AS constructionType,
mt4.type_id AS firstTypeId,
mt3.type_name AS materialType,
mt3.type_id AS secondTypeId,
mt2.type_name AS typeName,
mt2.type_id AS thirdTypeId,
mt.type_name AS typeModelName,
SUM(IFNULL( sai.num, 0 )) AS usNum,
bp.pro_name as proName,
bp.pro_id as proId,
bp.external_id as externalId,
bp.imp_unit AS impUnit,
bu.bzz_idcard AS idCard,
bp.pro_center AS proCenter,
sd.dept_name AS departName
FROM
clz_slt_agreement_info sai
LEFT JOIN ma_type mt ON mt.type_id = sai.type_id
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
LEFT JOIN ma_type mt3 ON mt3.type_id = mt2.parent_id
LEFT JOIN ma_type mt4 ON mt4.type_id = mt3.parent_id
LEFT JOIN clz_bm_agreement_info bai ON sai.agreement_id = bai.agreement_id
LEFT JOIN bm_project bp ON bai.project_id = bp.pro_id
LEFT JOIN bm_unit bu ON bai.unit_id = bu.unit_id
AND bu.del_flag = '0'
LEFT JOIN sys_dept sd ON sd.dept_id = bp.imp_unit
WHERE
sai.`status` = '0'
AND sai.end_time IS NULL
AND sai.back_id IS NULL
GROUP BY mt.type_id, bp.pro_id
) AS subquery3
ON mt.type_id = subquery3.type_id
AND subquery1.proId = subquery3.proId
LEFT JOIN ma_type mt2 on mt2.type_id = mt.parent_id
LEFT JOIN ma_type mt3 ON mt3.type_id = mt2.parent_id
LEFT JOIN ma_type mt4 ON mt4.type_id = mt3.parent_id
WHERE mt.`level` = 4 and mt.del_flag = '0'
AND IFNULL(subquery1.usNum, 0) - IFNULL(subquery3.usNum, 0) > 0
<if test="impUnitName != null and impUnitName != ''">
AND subquery1.departName = #{impUnitName}
</if>
<if test="proName != null and proName != ''">
AND subquery1.proName = #{proName}
</if>
<if test="departName != null and departName != ''">
AND subquery1.proCenter = #{departName}
</if>
<if test="typeName != null and typeName != ''">
AND mt2.type_name = #{typeName}
</if>
<if test="typeModelName != null and typeModelName != ''">
AND mt.type_name = #{typeModelName}
</if>
<if test="projectIdList != null and projectIdList.size() > 0">
and subquery1.externalId in
<foreach item="item" collection="projectIdList" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="impUnit != null and impUnit != ''">
and subquery1.impUnit = #{impUnit}
</if>
GROUP BY mt.type_id
</select>
<select id="getUsInfoList" resultType="com.bonus.material.clz.domain.vo.MaterialRetainedEquipmentInfo">
SELECT
mt.type_id,
mt4.type_name AS constructionType,
mt4.type_id AS firstTypeId,
mt3.type_name AS materialType,
mt3.type_id AS secondTypeId,
mt2.type_name AS typeName,
mt2.type_id AS thirdTypeId,
mt.type_name AS typeModelName,
SUM(IFNULL( sai.num, 0 )) AS allNum,
bu.unit_name AS teamName,
bp.pro_name as proName,
bp.pro_id as proId,
bp.external_id as externalId,
bp.imp_unit AS impUnit,
bu.bzz_idcard AS idCard,
bp.pro_center AS departName,
mt.unit_name AS unit,
sd.dept_name AS impUnitName
FROM
clz_slt_agreement_info sai
LEFT JOIN ma_type mt ON mt.type_id = sai.type_id
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
LEFT JOIN ma_type mt3 ON mt3.type_id = mt2.parent_id
LEFT JOIN ma_type mt4 ON mt4.type_id = mt3.parent_id
LEFT JOIN clz_bm_agreement_info bai ON sai.agreement_id = bai.agreement_id
LEFT JOIN bm_project bp ON bai.project_id = bp.pro_id
LEFT JOIN bm_unit bu ON bai.unit_id = bu.unit_id AND bu.del_flag = '0'
LEFT JOIN sys_dept sd ON sd.dept_id = bp.imp_unit
WHERE
sai.`status` = '0'
AND sai.end_time IS NULL
AND sai.back_id IS NULL
AND bu.unit_name is not null
AND bp.external_id is not NULL
<if test="impUnitName != null and impUnitName != ''">
AND sd.dept_name = #{impUnitName}
</if>
<if test="proName != null and proName != ''">
AND bp.pro_name = #{proName}
</if>
<if test="departName != null and departName != ''">
AND bp.pro_center = #{departName}
</if>
<if test="teamName != null and teamName != ''">
AND bu.unit_name = #{teamName}
</if>
<if test="typeName != null and typeName != ''">
AND mt2.type_name = #{typeName}
</if>
<if test="typeModelName != null and typeModelName != ''">
AND mt.type_name = #{typeModelName}
</if>
<if test="projectIdList != null and projectIdList.size() > 0">
and bp.external_id in
<foreach item="item" collection="projectIdList" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="impUnit != null and impUnit != ''">
and bp.imp_unit = #{impUnit}
</if>
GROUP BY mt.type_id,
bu.unit_name,
bp.pro_name
</select>
</mapper>

View File

@ -140,17 +140,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete>
<delete id="deleteTaskByIds">
delete from tm_task where task_id in
<foreach item="taskId" collection="taskIds" open="(" separator="," close=")">
#{taskId}
</foreach>
delete from tm_task where task_id = #{taskId}
</delete>
<delete id="deleteAgreementId">
delete from tm_task_agreement where task_id in
<foreach item="taskId" collection="taskIds" open="(" separator="," close=")">
#{taskId}
</foreach>
delete from tm_task_agreement where task_id = #{taskId}
</delete>
<select id="selectTaskNumByMonths" resultType="java.lang.String">