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