领料优化
This commit is contained in:
parent
7902b21197
commit
955c20af02
|
|
@ -180,6 +180,9 @@ public class LeaseOutDetails extends BaseEntity {
|
||||||
private String keyId;
|
private String keyId;
|
||||||
|
|
||||||
@ApiModelProperty(value = "老规格型号id")
|
@ApiModelProperty(value = "老规格型号id")
|
||||||
private Long oldTypeId;
|
private String oldTypeId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "老规格型号id集合")
|
||||||
|
private List<String> oldTypeIdList;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -103,4 +103,7 @@ public class MaCodeVo {
|
||||||
@Excel(name = "出库时间", width = 30, dateFormat = "yyyy-MM-dd")
|
@Excel(name = "出库时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
private Date outTime;
|
private Date outTime;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "发布批次")
|
||||||
|
private String publishTask;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@ public class LeaseApplyDetails extends BaseEntity {
|
||||||
private Long newTypeId;
|
private Long newTypeId;
|
||||||
|
|
||||||
@ApiModelProperty(value = "老规格型号id")
|
@ApiModelProperty(value = "老规格型号id")
|
||||||
private Long oldTypeId;
|
private String oldTypeId;
|
||||||
|
|
||||||
@ApiModelProperty(value = "三级id")
|
@ApiModelProperty(value = "三级id")
|
||||||
private Long thirdTypeId;
|
private Long thirdTypeId;
|
||||||
|
|
|
||||||
|
|
@ -213,7 +213,7 @@ public interface LeaseTaskMapper {
|
||||||
* @param leaseApplyDetails
|
* @param leaseApplyDetails
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
LeaseApplyDetails selectTypeByNewType(LeaseApplyDetails leaseApplyDetails);
|
List<LeaseApplyDetails> selectTypeByNewType(LeaseApplyDetails leaseApplyDetails);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 领用申请发布详情查询
|
* 领用申请发布详情查询
|
||||||
|
|
|
||||||
|
|
@ -258,6 +258,12 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
|
||||||
if (detail.getTypeId() != null) {
|
if (detail.getTypeId() != null) {
|
||||||
List<MaCodeVo> maCodeVoList = maCodeMap.get(detail.getTypeId().toString());
|
List<MaCodeVo> maCodeVoList = maCodeMap.get(detail.getTypeId().toString());
|
||||||
if (!CollectionUtils.isEmpty(maCodeVoList)) {
|
if (!CollectionUtils.isEmpty(maCodeVoList)) {
|
||||||
|
if (StringUtils.isNotBlank(publishTask)) {
|
||||||
|
// 获取到maCodeVoList中publishTask与detail中publishTask相同的
|
||||||
|
maCodeVoList = maCodeVoList.stream()
|
||||||
|
.filter(maCode -> StringUtils.equals(maCode.getPublishTask(), publishTask))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
}
|
||||||
detail.setMaCodeVoList(maCodeVoList);
|
detail.setMaCodeVoList(maCodeVoList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,9 +3,8 @@ package com.bonus.material.lease.service.impl;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.util.Date;
|
import java.util.*;
|
||||||
import java.util.List;
|
import java.util.stream.Collectors;
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
import com.bonus.common.biz.constant.GlobalConstants;
|
import com.bonus.common.biz.constant.GlobalConstants;
|
||||||
import com.bonus.common.biz.constant.MaterialConstants;
|
import com.bonus.common.biz.constant.MaterialConstants;
|
||||||
|
|
@ -792,6 +791,16 @@ public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService {
|
||||||
// 首先更新领料任务详情表的领料数及状态(lease_apply_details)
|
// 首先更新领料任务详情表的领料数及状态(lease_apply_details)
|
||||||
if (StringUtils.isNotBlank(record.getPublishTask())) {
|
if (StringUtils.isNotBlank(record.getPublishTask())) {
|
||||||
// 领用
|
// 领用
|
||||||
|
// 获取record中的oldTypeId转换为集合
|
||||||
|
List<String> oldTypeIdList = new ArrayList<>();
|
||||||
|
String oldTypeIdStr = record.getOldTypeId();
|
||||||
|
|
||||||
|
if (StringUtils.isNotBlank(oldTypeIdStr)) {
|
||||||
|
oldTypeIdList = Arrays.stream(oldTypeIdStr.split(","))
|
||||||
|
.filter(StringUtils::isNotBlank)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
record.setOldTypeIdList(oldTypeIdList);
|
||||||
|
}
|
||||||
List<LeaseApplyDetails> allList = leaseApplyDetailsMapper.getLeasePublishApplyDetails(record);
|
List<LeaseApplyDetails> allList = leaseApplyDetailsMapper.getLeasePublishApplyDetails(record);
|
||||||
// 出库数量
|
// 出库数量
|
||||||
BigDecimal outNum = record.getOutNum();
|
BigDecimal outNum = record.getOutNum();
|
||||||
|
|
|
||||||
|
|
@ -1044,15 +1044,22 @@ public class LeaseTaskServiceImpl implements ILeaseTaskService {
|
||||||
return AjaxResult.error("参数不能为空");
|
return AjaxResult.error("参数不能为空");
|
||||||
}
|
}
|
||||||
//查询是否有newType
|
//查询是否有newType
|
||||||
LeaseApplyDetails newType = mapper.selectTypeByNewType(leaseApplyDetails);
|
List<LeaseApplyDetails> list = mapper.selectTypeByNewType(leaseApplyDetails);
|
||||||
if (newType != null) {
|
int result = 0;
|
||||||
leaseApplyDetails.setTypeId(newType.getTypeId());
|
if (!CollectionUtils.isEmpty(list) && list.size() > 1) {
|
||||||
}
|
for (LeaseApplyDetails applyDetails : list) {
|
||||||
// 根据parentId及typeId更新lease_apply_details表的发布数量
|
result = mapper.updatePublishSub(applyDetails);
|
||||||
int result = mapper.updatePublishSub(leaseApplyDetails);
|
|
||||||
if (result == 0) {
|
if (result == 0) {
|
||||||
return AjaxResult.error("发布驳回失败,请联系管理员");
|
return AjaxResult.error("发布驳回失败,请联系管理员");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// 根据parentId及typeId更新lease_apply_details表的发布数量
|
||||||
|
result = mapper.updatePublishSub(leaseApplyDetails);
|
||||||
|
if (result == 0) {
|
||||||
|
return AjaxResult.error("发布驳回失败,请联系管理员");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 根据parentId及newTypeId删除lease_publish_details
|
// 根据parentId及newTypeId删除lease_publish_details
|
||||||
int details = mapper.deletePublishDetails(leaseApplyDetails);
|
int details = mapper.deletePublishDetails(leaseApplyDetails);
|
||||||
|
|
|
||||||
|
|
@ -1266,7 +1266,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
LEFT JOIN bm_unit bu ON bai.unit_id = bu.unit_id
|
LEFT JOIN bm_unit bu ON bai.unit_id = bu.unit_id
|
||||||
WHERE
|
WHERE
|
||||||
sai.is_slt = '0'
|
sai.is_slt = '0'
|
||||||
AND sai.`status` = '0'
|
|
||||||
AND bu.unit_name = #{teamName}
|
AND bu.unit_name = #{teamName}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -385,7 +385,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
mt1.type_name as materialName,
|
mt1.type_name as materialName,
|
||||||
mt.type_name as typeName,
|
mt.type_name as typeName,
|
||||||
mm.ma_id as maId,
|
mm.ma_id as maId,
|
||||||
mm.ma_code as maCode
|
mm.ma_code as maCode,
|
||||||
|
lod.publish_task as publishTask
|
||||||
FROM
|
FROM
|
||||||
lease_out_details lod
|
lease_out_details lod
|
||||||
LEFT JOIN ma_machine mm ON lod.ma_id = mm.ma_id
|
LEFT JOIN ma_machine mm ON lod.ma_id = mm.ma_id
|
||||||
|
|
@ -555,7 +556,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
mt4.type_id as firstId,
|
mt4.type_id as firstId,
|
||||||
su.sign_url as signUrl,
|
su.sign_url as signUrl,
|
||||||
su.sign_type as signType,
|
su.sign_type as signType,
|
||||||
lpd.type_id as oldTypeId
|
GROUP_CONCAT(lpd.type_id) as oldTypeId
|
||||||
FROM
|
FROM
|
||||||
lease_publish_details lpd
|
lease_publish_details lpd
|
||||||
LEFT JOIN ma_type mt ON lpd.new_type = mt.type_id
|
LEFT JOIN ma_type mt ON lpd.new_type = mt.type_id
|
||||||
|
|
@ -683,7 +684,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
lease_apply_details
|
lease_apply_details
|
||||||
WHERE
|
WHERE
|
||||||
parent_id = #{record.parentId}
|
parent_id = #{record.parentId}
|
||||||
AND type_id = #{record.oldTypeId}
|
<if test="record.oldTypeIdList != null and record.oldTypeIdList.size() > 0">
|
||||||
|
AND type_id in
|
||||||
|
<foreach item="item" collection="record.oldTypeIdList" open="(" separator="," close=")">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
</select>
|
</select>
|
||||||
<select id="getPendingLeaseApplyDetails" resultType="com.bonus.material.lease.domain.LeaseApplyDetails">
|
<select id="getPendingLeaseApplyDetails" resultType="com.bonus.material.lease.domain.LeaseApplyDetails">
|
||||||
SELECT
|
SELECT
|
||||||
|
|
|
||||||
|
|
@ -711,7 +711,8 @@
|
||||||
update
|
update
|
||||||
lease_apply_details
|
lease_apply_details
|
||||||
set
|
set
|
||||||
publish_num = IFNULL(publish_num, 0) - #{outNum}
|
publish_num = IFNULL(publish_num, 0) - #{outNum},
|
||||||
|
new_type = NULL
|
||||||
where
|
where
|
||||||
parent_id = #{parentId}
|
parent_id = #{parentId}
|
||||||
and type_id = #{typeId}
|
and type_id = #{typeId}
|
||||||
|
|
@ -1183,11 +1184,12 @@
|
||||||
id,
|
id,
|
||||||
parent_id as parentId,
|
parent_id as parentId,
|
||||||
type_id as typeId,
|
type_id as typeId,
|
||||||
new_type as newTypeId
|
new_type as newTypeId,
|
||||||
|
num as outNum
|
||||||
FROM
|
FROM
|
||||||
lease_publish_details lpd
|
lease_publish_details
|
||||||
WHERE
|
WHERE
|
||||||
lpd.parent_id=#{parentId}
|
parent_id=#{parentId}
|
||||||
and new_type=#{newTypeId}
|
and new_type=#{newTypeId}
|
||||||
</select>
|
</select>
|
||||||
<select id="selectPendingOutNum" resultType="com.bonus.material.lease.domain.LeaseApplyDetails">
|
<select id="selectPendingOutNum" resultType="com.bonus.material.lease.domain.LeaseApplyDetails">
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue