This commit is contained in:
parent
a848e238e8
commit
a3637a710b
|
|
@ -597,6 +597,19 @@ public class BackApplyInfoController extends BaseController {
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* 出门证列表导出
|
||||
* @param response
|
||||
* @param bean
|
||||
*/
|
||||
@ApiOperation(value = "导出出门证列表")
|
||||
@PostMapping("/exportExitPermitList")
|
||||
public void exportExitPermitList(HttpServletResponse response, ExitPermit bean) {
|
||||
List<ExitPermit> list = backApplyInfoService.getExitPermitList(bean);
|
||||
ExcelUtil<ExitPermit> util = new ExcelUtil<ExitPermit>(ExitPermit.class);
|
||||
util.exportExcel(response, list, "出门证列表");
|
||||
}
|
||||
|
||||
@ApiOperation(value = "出门证领料单号下拉")
|
||||
@GetMapping("/getCodeList")
|
||||
public AjaxResult getCodeList(ExitPermit bean) {
|
||||
|
|
@ -658,6 +671,18 @@ public class BackApplyInfoController extends BaseController {
|
|||
return AjaxResult.success(ListPagingUtil.paging(pageIndex, pageSize, list));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出退料明细
|
||||
* @param response
|
||||
* @param dto
|
||||
*/
|
||||
@PostMapping("/exportBackDetailsList")
|
||||
public void exportBackDetailsList(HttpServletResponse response, BackApplyInfo dto) {
|
||||
List<BackExportDetailsVo> list = backApplyInfoService.exportBackDetailsList(dto);
|
||||
ExcelUtil<BackExportDetailsVo> util = new ExcelUtil<BackExportDetailsVo>(BackExportDetailsVo.class);
|
||||
util.exportExcel(response, list, "退料明细数据");
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,11 +1,13 @@
|
|||
package com.bonus.material.back.domain;
|
||||
|
||||
import com.bonus.common.core.annotation.Excel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.ToString;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 出门证
|
||||
|
|
@ -28,18 +30,26 @@ public class ExitPermit implements Serializable {
|
|||
@ApiModelProperty(value="姓名")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "车牌号")
|
||||
private String carCode;
|
||||
|
||||
@ApiModelProperty(value = "物资")
|
||||
@Excel(name = "物资")
|
||||
private String material;
|
||||
|
||||
@ApiModelProperty(value = "日期")
|
||||
private String addDate;
|
||||
@ApiModelProperty(value = "车牌号")
|
||||
@Excel(name = "车牌号")
|
||||
private String carCode;
|
||||
|
||||
@ApiModelProperty(value = "领料单号")
|
||||
@Excel(name = "领料单号")
|
||||
private String code;
|
||||
|
||||
@ApiModelProperty(value = "日期")
|
||||
@Excel(name = "日期")
|
||||
private String addDate;
|
||||
|
||||
@ApiModelProperty(value = "备注")
|
||||
@Excel(name = "备注")
|
||||
private String remark;
|
||||
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
|
|
@ -75,4 +85,7 @@ public class ExitPermit implements Serializable {
|
|||
*/
|
||||
private String source;
|
||||
|
||||
@ApiModelProperty(value = "领料单号集合")
|
||||
private List<String> codeList;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,151 @@
|
|||
package com.bonus.material.back.domain.vo;
|
||||
|
||||
import com.bonus.common.core.annotation.Excel;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.ToString;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.apache.poi.ss.usermodel.HorizontalAlignment;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 退料任务对象 back_apply_info
|
||||
*
|
||||
* @author xsheng
|
||||
* @date 2024-10-16
|
||||
*/
|
||||
|
||||
@Accessors(chain = true)
|
||||
@Data
|
||||
@ToString
|
||||
public class BackExportDetailsVo implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Boolean isExport;
|
||||
|
||||
@ApiModelProperty(value = "登录用户id")
|
||||
private Long userId;
|
||||
|
||||
private Long deptId;
|
||||
|
||||
/** ID */
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "协议id")
|
||||
private Long agreementId;
|
||||
|
||||
@ApiModelProperty(value = "材料站协议id")
|
||||
private Long clzAgreementId;
|
||||
|
||||
@ApiModelProperty(value = "任务类型")
|
||||
private Integer taskType;
|
||||
|
||||
@ApiModelProperty(value = "单位id")
|
||||
private Long unitId;
|
||||
|
||||
@ApiModelProperty(value = "单位名称")
|
||||
@Excel(name = "退料单位")
|
||||
private String unitName;
|
||||
|
||||
@ApiModelProperty(value="工程id")
|
||||
private Long proId;
|
||||
|
||||
@ApiModelProperty(value="工程名称")
|
||||
@Excel(name = "退料工程")
|
||||
private String proName;
|
||||
|
||||
@Excel(name = "退料单号")
|
||||
@ApiModelProperty(value = "退料单号")
|
||||
private String code;
|
||||
|
||||
@ApiModelProperty(value = "类型id")
|
||||
private String typeId;
|
||||
|
||||
@ApiModelProperty(value = "类型名称")
|
||||
@Excel(name = "物资类型")
|
||||
private String typeName;
|
||||
|
||||
@ApiModelProperty(value = "规格型号")
|
||||
@Excel(name = "规格型号")
|
||||
private String typeModelName;
|
||||
|
||||
@ApiModelProperty(value="设备编码")
|
||||
@Excel(name = "设备编码")
|
||||
private String maCode;
|
||||
|
||||
@Excel(name = "退料数量", cellType = Excel.ColumnType.NUMERIC, align = HorizontalAlignment.RIGHT)
|
||||
private BigDecimal backNum;
|
||||
|
||||
@ApiModelProperty(value = "任务ID")
|
||||
private Long taskId;
|
||||
|
||||
@Excel(name = "退料人")
|
||||
@ApiModelProperty(value = "退料人")
|
||||
private String backPerson;
|
||||
|
||||
private String backSignUrl;
|
||||
|
||||
private Byte backSignType;
|
||||
|
||||
@ApiModelProperty(value = "退料人电话")
|
||||
private String phone;
|
||||
|
||||
@ApiModelProperty(value = "预退料时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private Date backTime;
|
||||
|
||||
@Excel(name = "创建人")
|
||||
private String createBy;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "创建时间", dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
|
||||
@ApiModelProperty(value = "1.机具分公司审核通过,2.机具分公司审批不通过,3.调试分公司审批通过,4.调试分公司审批不通过,5.出库进行中,6.出库完成")
|
||||
private String status;
|
||||
|
||||
@ApiModelProperty(value = "任务状态")
|
||||
@Excel(name = "状态", readConverterExp = "0=退料未完成,1=维修驳回,2=退料已完成")
|
||||
private Integer taskStatus;
|
||||
|
||||
private String updateBy;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date updateTime;
|
||||
|
||||
@ApiModelProperty(value = "打印状态")
|
||||
private String printStatus;
|
||||
|
||||
@Excel(name = "备注")
|
||||
private String remark;
|
||||
|
||||
@ApiModelProperty(value = "机具id")
|
||||
private Long maId;
|
||||
|
||||
@ApiModelProperty(value = "任务ID")
|
||||
private Long parentId;
|
||||
|
||||
@ApiModelProperty(value="开始时间")
|
||||
private String startTime;
|
||||
|
||||
@ApiModelProperty(value="结束时间")
|
||||
private String endTime;
|
||||
|
||||
@ApiModelProperty(value="关键字")
|
||||
private String keyWord;
|
||||
|
||||
@ApiModelProperty(value = "制单人签名地址")
|
||||
private String signUrl;
|
||||
|
||||
@ApiModelProperty(value = "制单人签名类型 手写0 和 图片上传1")
|
||||
private int signType;
|
||||
|
||||
@ApiModelProperty("机具类型(1机具,2安全工器具)")
|
||||
@Excel(name = "机具类型", readConverterExp = "1=机具,2=安全工器具")
|
||||
private String jiJuType;
|
||||
}
|
||||
|
|
@ -8,6 +8,7 @@ import com.bonus.common.core.web.domain.AjaxResult;
|
|||
import com.bonus.material.back.domain.*;
|
||||
import com.bonus.material.back.domain.vo.BackApplyInfoVo;
|
||||
import com.bonus.material.back.domain.vo.BackApplyVo;
|
||||
import com.bonus.material.back.domain.vo.BackExportDetailsVo;
|
||||
import com.bonus.material.back.domain.vo.MaCodeVo;
|
||||
import com.bonus.material.clz.domain.back.MaterialBackApplyDetails;
|
||||
import com.bonus.material.settlement.domain.SltAgreementInfo;
|
||||
|
|
@ -469,9 +470,10 @@ public interface BackApplyInfoMapper {
|
|||
/**
|
||||
* 查询是否存在班组数据
|
||||
* @param bean
|
||||
* @param agreementId
|
||||
* @return
|
||||
*/
|
||||
List<SltAgreementInfo> getTbList(BackApplyInfo bean);
|
||||
List<SltAgreementInfo> getTbList(@Param("record") BackApplyInfo bean, @Param("agreementId") Long agreementId);
|
||||
|
||||
/**
|
||||
* 获取出门证
|
||||
|
|
@ -539,10 +541,24 @@ public interface BackApplyInfoMapper {
|
|||
*/
|
||||
List<SltAgreementInfo> getClzList(BackApplyDetails applyInfo);
|
||||
|
||||
/**
|
||||
* 查询该编码是否存在于班组在用
|
||||
* @param info
|
||||
* @return
|
||||
*/
|
||||
List<SltAgreementInfo> getMaIdInfo(SltAgreementInfo info);
|
||||
|
||||
/**
|
||||
* 退料查询
|
||||
* @param backApplyInfo
|
||||
* @return
|
||||
*/
|
||||
List<BackApplyInfo> getBackQueryList(BackApplyInfo backApplyInfo);
|
||||
|
||||
/**
|
||||
* 导出退料明细
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
List<BackExportDetailsVo> exportBackDetailsList(BackApplyInfo dto);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -265,5 +265,12 @@ public interface IBackApplyInfoService {
|
|||
* @return
|
||||
*/
|
||||
List<BackApplyInfo> getBackQueryList(BackApplyInfo backApplyInfo);
|
||||
|
||||
/**
|
||||
* 导出退料明细
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
List<BackExportDetailsVo> exportBackDetailsList(BackApplyInfo dto);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -420,6 +420,28 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出退料明细
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<BackExportDetailsVo> exportBackDetailsList(BackApplyInfo dto) {
|
||||
try {
|
||||
Long userId = SecurityUtils.getLoginUser().getUserid();
|
||||
Set<String> userRoles = SecurityUtils.getLoginUser().getRoles();
|
||||
// 检查用户是否具有特殊角色
|
||||
boolean hasSpecialRole = hasSpecialRole(userRoles);
|
||||
if (!hasSpecialRole) {
|
||||
dto.setUserId(userId == 0 ? null : userId);
|
||||
}
|
||||
return backApplyInfoMapper.exportBackDetailsList(dto);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return new ArrayList<>();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查是否有编码设备
|
||||
*/
|
||||
|
|
@ -2327,9 +2349,12 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService {
|
|||
|
||||
List<BackApplyInfo> codeList = new ArrayList<>();
|
||||
// 根据传入的id查询退料申请信息
|
||||
// 原始协议id
|
||||
Long agreementId = null;
|
||||
List<BackApplyInfo> applyInfoList = backApplyInfoMapper.selectBackDetails(backApplyInfo);
|
||||
// 将applyInfoList中状态不为在用的数据收集到新集合中
|
||||
if (CollectionUtils.isNotEmpty(applyInfoList)) {
|
||||
agreementId = applyInfoList.get(0).getAgreementId();
|
||||
for (BackApplyInfo applyInfo : applyInfoList) {
|
||||
// 根据maId查询设备是否处于在用状态(需要同时查询机具和材料站)
|
||||
if (applyInfo.getMaId() != null) {
|
||||
|
|
@ -2406,7 +2431,7 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService {
|
|||
// 插入任务表
|
||||
Long newTaskId = insertTt(SecurityUtils.getLoginUser().getSysUser().getNickName(), backApplyInfo.getRemark(), backApplyInfo.getTaskId());
|
||||
// 插入协议任务表,使用的是项目部协议ID
|
||||
result += insertTeamTta(newTaskId, leaseOutDetail.getProjectUnitAgreementId());
|
||||
result += insertTeamTta(newTaskId, agreementId);
|
||||
|
||||
// -----------------给材料站新建退料任务,处理数据开始✅ ----------------
|
||||
BackApplyInfo backApplyInfo4 = new BackApplyInfo();
|
||||
|
|
@ -2521,7 +2546,7 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService {
|
|||
List<BackApplyInfo> allList = backApplyInfoMapper.selectBackDetails(backApplyInfo);
|
||||
if (CollectionUtils.isNotEmpty(allList)) {
|
||||
// 更新结算协议✍️表
|
||||
int res = updateBzSlt4Bean(backApplyInfo,backApplyInfo4, allList);
|
||||
int res = updateBzSlt4Bean(backApplyInfo,backApplyInfo4, allList, leaseOutDetail.getProjectUnitAgreementId());
|
||||
// 检查机具是否领料
|
||||
if (res == 0) { throw new RuntimeException("该机具未被领料使用");}
|
||||
|
||||
|
|
@ -2627,7 +2652,7 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService {
|
|||
* @param allList
|
||||
* @return
|
||||
*/
|
||||
private int updateBzSlt4Bean(BackApplyInfo record, BackApplyInfo backApplyInfo4, List<BackApplyInfo> allList) {
|
||||
private int updateBzSlt4Bean(BackApplyInfo record, BackApplyInfo backApplyInfo4, List<BackApplyInfo> allList, Long projectUnitAgreementId) {
|
||||
for (BackApplyInfo bean : allList) {
|
||||
List<SltAgreementInfo> infoList = backApplyInfoMapper.getStlInfo(bean);
|
||||
if (CollectionUtils.isEmpty(infoList)) {
|
||||
|
|
@ -2660,9 +2685,8 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService {
|
|||
}
|
||||
}
|
||||
|
||||
// 查询是否存在班组数据
|
||||
List<SltAgreementInfo> tbList = backApplyInfoMapper.getTbList(bean);
|
||||
// 非班组退料才同步班组分公司数据
|
||||
// 查询是否存在项目部数据
|
||||
List<SltAgreementInfo> tbList = backApplyInfoMapper.getTbList(bean, projectUnitAgreementId);
|
||||
BigDecimal tbBackNum = bean.getBackNum();
|
||||
if (CollectionUtils.isNotEmpty(tbList)) {
|
||||
BackApplyInfo backApplyInfo = new BackApplyInfo();
|
||||
|
|
@ -2679,7 +2703,7 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService {
|
|||
} else {
|
||||
BigDecimal many = num.subtract(tbBackNum);
|
||||
backApplyInfoMapper.updateStlInfoTwo(info, backApplyInfo, tbBackNum);
|
||||
info.setSource("2");
|
||||
info.setSource("1");
|
||||
backApplyInfoMapper.insStlInfoTwo(info, many);
|
||||
break;
|
||||
}
|
||||
|
|
@ -2692,7 +2716,19 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService {
|
|||
@Override
|
||||
public List<ExitPermit> getExitPermitList(ExitPermit bean) {
|
||||
try {
|
||||
return backApplyInfoMapper.getExitPermitList(bean);
|
||||
List<ExitPermit> exitPermitList = backApplyInfoMapper.getExitPermitList(bean);
|
||||
if (CollectionUtils.isNotEmpty(exitPermitList)) {
|
||||
for (ExitPermit exitPermit : exitPermitList) {
|
||||
// 如果领料单号不为空,转换为集合
|
||||
if (StringUtils.isNotBlank(exitPermit.getCode())) {
|
||||
exitPermit.setCodeList(Arrays.asList(exitPermit.getCode().split(",")));
|
||||
} else {
|
||||
exitPermit.setCode("/");
|
||||
exitPermit.setCodeList(Collections.singletonList("/"));
|
||||
}
|
||||
}
|
||||
}
|
||||
return exitPermitList;
|
||||
} catch (Exception e) {
|
||||
log.error("获取退料任务列表失败", e);
|
||||
return new ArrayList<>();
|
||||
|
|
@ -2704,6 +2740,10 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService {
|
|||
try {
|
||||
Long userId = SecurityUtils.getLoginUser().getUserid();
|
||||
bean.setCreateBy(userId.toString());
|
||||
if (CollectionUtils.isNotEmpty(bean.getCodeList())) {
|
||||
// 将领料单号集合转换成字符串
|
||||
bean.setCode(String.join(",", bean.getCodeList()));
|
||||
}
|
||||
int re = backApplyInfoMapper.addExitPermit(bean);
|
||||
if (re > 0) {
|
||||
return AjaxResult.success("添加成功");
|
||||
|
|
@ -2762,6 +2802,13 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService {
|
|||
BigDecimal backNum = bean.getBackNum();
|
||||
for (SltAgreementInfo info : infoList) {
|
||||
BigDecimal num = info.getBackNum();
|
||||
if (info.getMaId() != null) {
|
||||
// 查询该编码是否存在于班组在用,若存在,则同步进行退料
|
||||
List<SltAgreementInfo> maIdList = backApplyInfoMapper.getMaIdInfo(info);
|
||||
if (CollectionUtils.isNotEmpty(maIdList)) {
|
||||
backApplyInfoMapper.updateStlInfo(maIdList.get(0), record);
|
||||
}
|
||||
}
|
||||
if (backNum.compareTo(num) == 0) {
|
||||
backApplyInfoMapper.updateStlInfo(info, record);
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -102,8 +102,6 @@ public interface BmReportMapper {
|
|||
*/
|
||||
List<RepairInputDetails> getRepairInputDetailsList(RepairInputDto bean);
|
||||
|
||||
LeaseOutInfo getLeaseInfoById(Long parentId);
|
||||
|
||||
/**
|
||||
* 报废报表
|
||||
* @param bean
|
||||
|
|
@ -131,4 +129,11 @@ public interface BmReportMapper {
|
|||
* @return
|
||||
*/
|
||||
List<ReportQuery> getReportList(ReportQuery bean);
|
||||
|
||||
/**
|
||||
* 查询领用出库任务数据
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
List<LeaseOutInfo> selectPublishList(LeaseOutInfo bean);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -125,22 +125,13 @@ public class BmReportServiceImpl implements BmReportService {
|
|||
BigDecimal totalLeaseNum = BigDecimal.ZERO.setScale(3, RoundingMode.HALF_UP);
|
||||
BigDecimal totalOutNumNum = BigDecimal.ZERO.setScale(3, RoundingMode.HALF_UP);
|
||||
BigDecimal totalPendingOutNum = BigDecimal.ZERO.setScale(3, RoundingMode.HALF_UP);
|
||||
// 先查询领料任务数据
|
||||
bean.setUserId(userId);
|
||||
List<LeaseOutInfo> list = bmReportMapper.getLeaseOutList(bean);
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
// 将list集合中userId不为空,且和userId相等的数据过滤处理
|
||||
list = list.stream().filter(item -> item.getUserId() != null && item.getUserId().equals(userId))
|
||||
.collect(Collectors.toList());
|
||||
for (LeaseOutInfo leaseOutInfo : list) {
|
||||
totalLeaseNum = totalLeaseNum.add(leaseOutInfo.getLeaseNum());
|
||||
totalOutNumNum = totalOutNumNum.add(leaseOutInfo.getOutNum());
|
||||
totalPendingOutNum = totalPendingOutNum.add(leaseOutInfo.getPendingOutNum());
|
||||
//判断是否是领用任务
|
||||
if (StringUtils.isNotNull(leaseOutInfo) && leaseOutInfo.getTaskType()==19){
|
||||
LeaseOutInfo leaseOutInfoNew = bmReportMapper.getLeaseInfoById(leaseOutInfo.getParentId());
|
||||
leaseOutInfo.setLeaseUnitName(leaseOutInfoNew.getLeaseUnitName());
|
||||
leaseOutInfo.setLeaseProjectName(leaseOutInfoNew.getLeaseProjectName());
|
||||
}
|
||||
}
|
||||
// 查询领用出库任务数据
|
||||
List<LeaseOutInfo> leaseOutList = bmReportMapper.selectPublishList(bean);
|
||||
if (CollectionUtils.isNotEmpty(leaseOutList)) {
|
||||
list.addAll(leaseOutList);
|
||||
}
|
||||
//模糊查询
|
||||
if (!org.springframework.util.CollectionUtils.isEmpty(list)) {
|
||||
|
|
@ -152,6 +143,13 @@ public class BmReportServiceImpl implements BmReportService {
|
|||
.collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
for (LeaseOutInfo leaseOutInfo : list) {
|
||||
totalLeaseNum = totalLeaseNum.add(leaseOutInfo.getLeaseNum());
|
||||
totalOutNumNum = totalOutNumNum.add(leaseOutInfo.getOutNum());
|
||||
totalPendingOutNum = totalPendingOutNum.add(leaseOutInfo.getPendingOutNum());
|
||||
}
|
||||
}
|
||||
if (bean.getIsExport() == 0) {
|
||||
LeaseOutInfo info = new LeaseOutInfo();
|
||||
info.setLeaseNum(totalLeaseNum);
|
||||
|
|
|
|||
|
|
@ -800,8 +800,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</insert>
|
||||
|
||||
<insert id="addExitPermit">
|
||||
insert into bm_exit_permit (material,name,car_code,add_date,create_by,create_time,code)
|
||||
values (#{material}, #{name}, #{carCode}, #{addDate}, #{createBy}, now(), #{code})
|
||||
insert into bm_exit_permit (material,name,car_code,add_date,create_by,create_time,code, remark)
|
||||
values (#{material}, #{name}, #{carCode}, #{addDate}, #{createBy}, now(), #{code}, #{remark})
|
||||
</insert>
|
||||
<insert id="syncProject" useGeneratedKeys="true" keyProperty="id">
|
||||
INSERT INTO archives_record_info
|
||||
|
|
@ -1493,11 +1493,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
FROM
|
||||
slt_agreement_info
|
||||
WHERE
|
||||
source = '2'
|
||||
AND type_id = #{typeId}
|
||||
source = '1'
|
||||
AND agreement_id = #{agreementId}
|
||||
AND type_id = #{record.typeId}
|
||||
AND status = 0
|
||||
<if test="maId != null">
|
||||
AND ma_id = #{maId}
|
||||
<if test="record.maId != null">
|
||||
AND ma_id = #{record.maId}
|
||||
</if>
|
||||
order by start_time asc
|
||||
</select>
|
||||
|
|
@ -1675,7 +1676,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
slt_agreement_info
|
||||
WHERE
|
||||
status = 0
|
||||
AND source = '2'
|
||||
AND source = '1'
|
||||
AND type_id = #{typeId}
|
||||
AND agreement_id = #{agreementId}
|
||||
<if test="maId != null">
|
||||
|
|
@ -1765,4 +1766,98 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</if>
|
||||
ORDER BY bcd.parent_id desc,bcd.create_time desc
|
||||
</select>
|
||||
|
||||
<select id="getMaIdInfo" resultType="com.bonus.material.settlement.domain.SltAgreementInfo">
|
||||
SELECT
|
||||
id AS id,
|
||||
agreement_id AS agreementId,
|
||||
type_id AS typeId,
|
||||
ma_id AS maId,
|
||||
num AS backNum,
|
||||
start_time AS startTime,
|
||||
end_time AS endTime,
|
||||
status AS status,
|
||||
lease_id AS leaseId,
|
||||
lease_type AS leaseType,
|
||||
back_id AS backId,
|
||||
lease_price AS leasePrice,
|
||||
buy_price AS buyPrice,
|
||||
company_id AS companyId
|
||||
FROM
|
||||
slt_agreement_info
|
||||
WHERE
|
||||
status = 0
|
||||
AND source = '2'
|
||||
AND type_id = #{typeId}
|
||||
AND ma_id = #{maId}
|
||||
order by start_time asc
|
||||
</select>
|
||||
|
||||
<select id="exportBackDetailsList" resultType="com.bonus.material.back.domain.vo.BackExportDetailsVo">
|
||||
SELECT
|
||||
bcd.parent_id as parentId,
|
||||
mt2.type_name AS typeName,
|
||||
mt.type_name AS typeModelName,
|
||||
bai2.`code` AS code,
|
||||
mm.ma_code as maCode,
|
||||
bcd.back_num as backNum,
|
||||
bai2.back_person as backPerson,
|
||||
bcd.create_by as createBy,
|
||||
bcd.create_time AS createTime,
|
||||
bu2.unit_name AS unitName,
|
||||
bp2.pro_name AS proName,
|
||||
mt.jiju_type AS jijuType,
|
||||
bcd.is_finished AS status,
|
||||
bcd.remark AS remark,
|
||||
tt.task_status AS taskStatus,
|
||||
bai2.phone AS phone
|
||||
FROM
|
||||
back_check_details bcd
|
||||
LEFT JOIN back_apply_info bai2 ON bcd.parent_id = bai2.id
|
||||
LEFT JOIN tm_task tt ON bai2.task_id = tt.task_id
|
||||
LEFT JOIN tm_task_agreement tta ON bai2.task_id = tta.task_id
|
||||
LEFT JOIN bm_agreement_info bai ON tta.agreement_id = bai.agreement_id
|
||||
LEFT JOIN bm_unit bu2 ON bai.unit_id = bu2.unit_id
|
||||
LEFT JOIN bm_project bp2 ON bai.project_id = bp2.pro_id
|
||||
LEFT JOIN ma_type mt ON bcd.type_id = mt.type_id
|
||||
LEFT JOIN ma_type mt2 ON mt.parent_id = mt2.type_id
|
||||
LEFT JOIN ma_machine mm ON mm.ma_id = bcd.ma_id
|
||||
<if test="userId != null">
|
||||
JOIN ma_type_repair mtr ON mtr.type_id = bcd.type_id AND mtr.user_id = #{userId}
|
||||
</if>
|
||||
WHERE
|
||||
bai2.back_style = '1' and bai2.direct_id IS NULL
|
||||
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
|
||||
and bai2.create_time BETWEEN CONCAT(#{startTime}, ' 00:00:00') AND CONCAT(#{endTime}, ' 23:59:59')
|
||||
</if>
|
||||
<if test="status != null">
|
||||
and tt.task_status = #{status}
|
||||
</if>
|
||||
<if test="keyWord != null and keyWord != ''">
|
||||
and (
|
||||
mt2.type_name like concat('%',#{keyWord},'%') or
|
||||
bai2.`code` like concat('%',#{keyWord},'%') or
|
||||
bai2.back_person like concat('%',#{keyWord},'%') or
|
||||
bu2.unit_name like concat('%', #{keyWord}, '%') or
|
||||
bp2.pro_name like concat('%', #{keyWord}, '%') or
|
||||
bai2.phone like concat('%', #{keyWord}, '%')
|
||||
)
|
||||
</if>
|
||||
<if test="unitId != null">
|
||||
and bu2.unit_id = #{unitId}
|
||||
</if>
|
||||
<if test="proId != null">
|
||||
and bp2.pro_id = #{proId}
|
||||
</if>
|
||||
<if test="typeId != null and typeId!=''">
|
||||
and mt2.type_id = #{typeId}
|
||||
</if>
|
||||
<if test="typeModelId != null and typeModelId!=''">
|
||||
and mt.type_id = #{typeModelId}
|
||||
</if>
|
||||
GROUP BY
|
||||
bcd.parent_id,bcd.type_id,bcd.ma_id
|
||||
ORDER BY
|
||||
bcd.create_time desc
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -215,48 +215,112 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
|
||||
<select id="getLeaseOutList" resultType="com.bonus.material.basic.domain.report.LeaseOutInfo">
|
||||
SELECT
|
||||
mt2.type_name AS typeName,
|
||||
mt1.type_name AS typeModelName,
|
||||
mt1.unit_name AS unitName,
|
||||
lad.pre_num as leaseNum,
|
||||
IFNULL( lad.al_num, 0 ) as outNum,
|
||||
lad.pre_num - IFNULL( lad.al_num, 0 ) as pendingOutNum,
|
||||
lai.create_time as leaseTime,
|
||||
a.createTime as outTime,
|
||||
bu.unit_name as leaseUnitName,
|
||||
bp.pro_name as leaseProjectName,
|
||||
lai.create_by as leasePersonName,
|
||||
a.createBy as outPersonName,
|
||||
lai.`code` as code,
|
||||
mt1.manage_type as manageType,
|
||||
lad.parent_id as parentId,
|
||||
lad.type_id as typeId,
|
||||
tt.task_type as taskType,
|
||||
mtm.user_id as userId
|
||||
FROM
|
||||
lease_apply_details lad
|
||||
LEFT JOIN ma_type mt1 ON lad.type_id = mt1.type_id
|
||||
AND mt1.del_flag = '0'
|
||||
LEFT JOIN ma_type mt2 ON mt1.parent_id = mt2.type_id
|
||||
AND mt2.del_flag = '0'
|
||||
LEFT JOIN lease_apply_info lai ON lad.parent_id = lai.id
|
||||
LEFT JOIN tm_task tt ON tt.task_id = lai.task_id
|
||||
LEFT JOIN tm_task_agreement tta ON lai.task_id = tta.task_id
|
||||
LEFT JOIN bm_agreement_info bai ON tta.agreement_id = bai.agreement_id
|
||||
LEFT JOIN bm_unit bu ON bai.unit_id = bu.unit_id
|
||||
LEFT JOIN bm_project bp ON bai.project_id = bp.pro_id
|
||||
LEFT JOIN ( SELECT lod.parent_id, lod.type_id, GROUP_CONCAT( DISTINCT su.nick_name ) AS createBy, MAX( lod.create_time ) AS createTime FROM lease_out_details lod
|
||||
LEFT JOIN sys_user su ON lod.create_by = su.user_id GROUP BY parent_id, type_id ) a ON a.parent_id = lad.parent_id
|
||||
AND a.type_id = lad.type_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 ma_type_manage mtm ON mt4.type_id = mtm.type_id
|
||||
mt1.type_name AS typeName,
|
||||
mt.type_name AS typeModelName,
|
||||
mt.unit_name AS unitName,
|
||||
IFNULL(lad.pre_num, 0) as leaseNum,
|
||||
IFNULL(a.num, 0) as outNum,
|
||||
IFNULL(lad.pre_num, 0) - IFNULL(a.num, 0) as pendingOutNum,
|
||||
COALESCE(lai.release_time, lai.create_time) as leaseTime,
|
||||
a.createTime as outTime,
|
||||
bu.unit_name as leaseUnitName,
|
||||
bp.pro_name as leaseProjectName,
|
||||
lai.lease_person as leasePersonName,
|
||||
a.createBy as outPersonName,
|
||||
lai.`code` as code,
|
||||
mt.manage_type as manageType,
|
||||
mtm.user_id as userId,
|
||||
lad.parent_id as parentId,
|
||||
lad.type_id as typeId
|
||||
from
|
||||
lease_apply_details lad
|
||||
LEFT JOIN lease_apply_info lai ON lad.parent_id = lai.id
|
||||
LEFT JOIN tm_task tt ON tt.task_id = lai.task_id
|
||||
LEFT JOIN (SELECT lod.parent_id, lod.type_id ,IFNULL( sum( lod.out_num ), 0 ) as num, MIN( lod.create_time ) AS createTime,
|
||||
CASE
|
||||
WHEN lod.create_by REGEXP '^[0-9]+$' THEN su.nick_name
|
||||
ELSE lod.create_by
|
||||
END AS createBy
|
||||
FROM lease_out_details lod
|
||||
LEFT JOIN sys_user su ON lod.create_by = su.user_id
|
||||
GROUP BY parent_id,type_id) a ON lai.id = a.parent_id and lad.type_id = a.type_id
|
||||
left join tm_task_agreement tta on lai.task_id = tta.task_id
|
||||
left join bm_agreement_info bai on tta.agreement_id = bai.agreement_id
|
||||
left join bm_unit bu on bu.unit_id = bai.unit_id
|
||||
left join bm_project bp on bp.pro_id = bai.project_id
|
||||
left join sys_dept sd on sd.dept_id = bp.imp_unit
|
||||
left join ma_type mt on lad.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 ma_type mt2 ON mt1.parent_id = mt2.type_id and mt2.del_flag = '0'
|
||||
left join ma_type mt3 ON mt2.parent_id = mt3.type_id and mt3.del_flag = '0'
|
||||
LEFT JOIN ma_type_manage mtm ON mt3.type_id = mtm.type_id
|
||||
WHERE
|
||||
1 = 1
|
||||
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
|
||||
<![CDATA[and DATE_FORMAT( lai.create_time, '%Y-%m-%d' ) BETWEEN #{startTime} AND #{endTime} ]]>
|
||||
tt.task_type = '2' and lai.direct_id is null
|
||||
<if test="userId != null">
|
||||
AND mtm.user_id = #{userId}
|
||||
</if>
|
||||
ORDER BY a.createTime DESC
|
||||
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
|
||||
<![CDATA[and DATE_FORMAT( COALESCE(lai.release_time, lai.create_time), '%Y-%m-%d' ) BETWEEN #{startTime} AND #{endTime} ]]>
|
||||
</if>
|
||||
GROUP BY
|
||||
lad.parent_id,
|
||||
lad.type_id
|
||||
ORDER BY a.createTime DESC
|
||||
</select>
|
||||
|
||||
<select id="selectPublishList" resultType="com.bonus.material.basic.domain.report.LeaseOutInfo">
|
||||
SELECT
|
||||
mt1.type_name AS typeName,
|
||||
mt.type_name AS typeModelName,
|
||||
mt.unit_name AS unitName,
|
||||
IFNULL(lpd.num, 0) as leaseNum,
|
||||
IFNULL(a.num, 0) as outNum,
|
||||
IFNULL(lpd.num, 0) - IFNULL(a.num, 0) as pendingOutNum,
|
||||
a.createTime as outTime,
|
||||
bu.unit_name as leaseUnitName,
|
||||
bp.pro_name as leaseProjectName,
|
||||
lpd.lease_person as leasePersonName,
|
||||
a.createBy as outPersonName,
|
||||
lpd.`code` as code,
|
||||
mt.manage_type as manageType,
|
||||
lpd.create_time AS leaseTime,
|
||||
lpd.parent_id as parentId,
|
||||
lpd.type_id as typeId
|
||||
FROM
|
||||
lease_publish_details lpd
|
||||
LEFT JOIN lease_apply_info lai ON lai.id = lpd.parent_id
|
||||
LEFT JOIN tm_task tt ON lai.task_id = tt.task_id
|
||||
LEFT JOIN (SELECT IFNULL( sum(lod.out_num ), 0) AS num, lod.parent_id, lod.publish_task, MIN( lod.create_time ) AS createTime,
|
||||
lod.type_id,
|
||||
CASE
|
||||
WHEN lod.create_by REGEXP '^[0-9]+$' THEN su.nick_name
|
||||
ELSE lod.create_by
|
||||
END AS createBy
|
||||
from lease_out_details lod
|
||||
LEFT JOIN sys_user su ON lod.create_by = su.user_id
|
||||
WHERE lod.publish_task is not null
|
||||
GROUP BY lod.parent_id, lod.publish_task, lod.type_id) a ON lpd.parent_id = a.parent_id
|
||||
AND lpd.publish_task = a.publish_task
|
||||
AND lpd.type_id = a.type_id
|
||||
LEFT JOIN bm_unit bu ON bu.unit_id = lpd.unit_id
|
||||
LEFT JOIN bm_project bp ON bp.pro_id = lpd.project_id
|
||||
LEFT JOIN ma_type mt ON lpd.new_type = 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 ma_type mt2 ON mt1.parent_id = mt2.type_id and mt2.del_flag = '0'
|
||||
left join ma_type mt3 ON mt2.parent_id = mt3.type_id and mt3.del_flag = '0'
|
||||
LEFT JOIN ma_type_manage mtm ON mt3.type_id = mtm.type_id
|
||||
<where>
|
||||
<if test="userId != null">
|
||||
AND mtm.user_id = #{userId}
|
||||
</if>
|
||||
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
|
||||
<![CDATA[ AND DATE_FORMAT( lpd.create_time , '%Y-%m-%d' ) BETWEEN #{startTime} AND #{endTime} ]]>
|
||||
</if>
|
||||
</where>
|
||||
GROUP BY
|
||||
lpd.publish_task,
|
||||
lpd.type_id
|
||||
ORDER BY a.createTime DESC
|
||||
</select>
|
||||
|
||||
<select id="getLeaseOutDetailsList" resultType="com.bonus.material.basic.domain.report.LeaseOutDetails">
|
||||
|
|
@ -264,8 +328,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
mt2.type_name AS typeName,
|
||||
mt1.type_name AS typeModelName,
|
||||
mm.ma_code as maCode,
|
||||
lod.create_by as outPersonName,
|
||||
lod.create_time as outTime
|
||||
lod.create_time as outTime,
|
||||
CASE
|
||||
WHEN lod.create_by REGEXP '^[0-9]+$' THEN su.nick_name
|
||||
ELSE lod.create_by
|
||||
END AS outPersonName
|
||||
FROM
|
||||
lease_out_details lod
|
||||
LEFT JOIN ma_type mt1 ON lod.type_id = mt1.type_id
|
||||
|
|
@ -273,6 +340,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
LEFT JOIN ma_type mt2 ON mt1.parent_id = mt2.type_id
|
||||
AND mt2.del_flag = '0'
|
||||
LEFT JOIN ma_machine mm ON lod.ma_id = mm.ma_id
|
||||
LEFT JOIN sys_user su on su.user_id = lod.create_by
|
||||
WHERE
|
||||
lod.parent_id = #{parentId} and lod.type_id = #{typeId}
|
||||
<if test="keyWord != null and keyWord != ''">
|
||||
|
|
@ -521,14 +589,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</if>
|
||||
GROUP BY mm.ma_id
|
||||
</select>
|
||||
<select id="getLeaseInfoById" resultType="com.bonus.material.basic.domain.report.LeaseOutInfo">
|
||||
select bu.unit_name as leaseUnitName,
|
||||
bp.pro_name as leaseProjectName
|
||||
from lease_apply_info lai
|
||||
LEFT JOIN bm_unit bu ON lai.unit_id = bu.unit_id
|
||||
LEFT JOIN bm_project bp ON lai.project_id = bp.pro_id
|
||||
where lai.id=#{parentId}
|
||||
</select>
|
||||
|
||||
<select id="getScrapList" resultType="com.bonus.material.basic.domain.report.ScrapInfo">
|
||||
SELECT
|
||||
|
|
|
|||
Loading…
Reference in New Issue