领料联调
This commit is contained in:
parent
e1ae49f773
commit
a3a8783f57
|
|
@ -316,4 +316,7 @@ public class LeaseApplyInfo extends BaseEntity{
|
||||||
|
|
||||||
@ApiModelProperty(value = "计量单位")
|
@ApiModelProperty(value = "计量单位")
|
||||||
private String unitNames;
|
private String unitNames;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "是否电子签名 0 是,1 否")
|
||||||
|
private Integer isElectronicSign;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -342,6 +342,21 @@ public class LeaseApplyInfoController extends BaseController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* app领料出库提交
|
||||||
|
* @param leaseApplyDetails
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "app领料出库提交")
|
||||||
|
@PostMapping("/submitLeaseOut")
|
||||||
|
public AjaxResult submitLeaseOut(@RequestBody LeaseApplyDetails leaseApplyDetails) {
|
||||||
|
try {
|
||||||
|
return leaseApplyInfoService.submitLeaseOut(leaseApplyDetails);
|
||||||
|
} catch (Exception e) {
|
||||||
|
return error("系统错误, " + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* app领料出库退回
|
* app领料出库退回
|
||||||
* @param leaseOutDetails
|
* @param leaseOutDetails
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,11 @@ public class LeaseApplyDetails extends BaseEntity {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否第一次提交 0 是
|
||||||
|
*/
|
||||||
|
private Integer isSubmit;
|
||||||
|
|
||||||
/** ID */
|
/** ID */
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -206,4 +206,11 @@ public interface ILeaseApplyInfoService {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<LeaseApplyDetails> getOutNum(LeaseApplyDetails leaseApplyDetails);
|
List<LeaseApplyDetails> getOutNum(LeaseApplyDetails leaseApplyDetails);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* app领料出库提交
|
||||||
|
* @param leaseApplyDetails
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
AjaxResult submitLeaseOut(LeaseApplyDetails leaseApplyDetails);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -151,27 +151,7 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<LeaseApplyInfo> selectLeaseApplyInfoList(LeaseApplyInfo leaseApplyInfo) {
|
public List<LeaseApplyInfo> selectLeaseApplyInfoList(LeaseApplyInfo leaseApplyInfo) {
|
||||||
//leaseApplyInfo.setUserId(SecurityUtils.getUserId());
|
|
||||||
List<LeaseApplyInfo> list = leaseApplyInfoMapper.selectLeaseApplyInfoList(leaseApplyInfo);
|
List<LeaseApplyInfo> list = leaseApplyInfoMapper.selectLeaseApplyInfoList(leaseApplyInfo);
|
||||||
/*// 如果statusList包含3、4、5,则为领料出库查询,需查询领用出库数据,进行拼接
|
|
||||||
if (!CollectionUtils.isEmpty(leaseApplyInfo.getStatusList())) {
|
|
||||||
if (leaseApplyInfo.getStatusList().contains(3) || leaseApplyInfo.getStatusList().contains(4) || leaseApplyInfo.getStatusList().contains(5)) {
|
|
||||||
// 查询领用出库数据
|
|
||||||
List<LeaseApplyInfo> leaseApplyOutList = leaseApplyInfoMapper.selectPublishList(leaseApplyInfo);
|
|
||||||
if (!CollectionUtils.isEmpty(leaseApplyOutList)) {
|
|
||||||
for (LeaseApplyInfo applyInfo : leaseApplyOutList) {
|
|
||||||
if (applyInfo.getPreCountNum().compareTo(applyInfo.getAlNum()) == 0) {
|
|
||||||
applyInfo.setTaskStatus(LeaseTaskStatusEnum.LEASE_TASK_FINISHED.getStatus());
|
|
||||||
applyInfo.setTaskStatusName(LeaseTaskStatusEnum.LEASE_TASK_FINISHED.getStatusName());
|
|
||||||
} else {
|
|
||||||
applyInfo.setTaskStatus(LeaseTaskStatusEnum.LEASE_TASK_IN_PROGRESS.getStatus());
|
|
||||||
applyInfo.setTaskStatusName(LeaseTaskStatusEnum.LEASE_TASK_IN_PROGRESS.getStatusName());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
list.addAll(leaseApplyOutList);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
// 使用 Stream API 进行降序排序
|
// 使用 Stream API 进行降序排序
|
||||||
List<LeaseApplyInfo> sortedList = list.stream()
|
List<LeaseApplyInfo> sortedList = list.stream()
|
||||||
.sorted(Comparator.comparing(LeaseApplyInfo::getCreateTime).reversed())
|
.sorted(Comparator.comparing(LeaseApplyInfo::getCreateTime).reversed())
|
||||||
|
|
@ -183,9 +163,13 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
|
||||||
if (num == null) {
|
if (num == null) {
|
||||||
num = BigDecimal.ZERO;
|
num = BigDecimal.ZERO;
|
||||||
}
|
}
|
||||||
applyInfo.setPreCountNum(applyInfo.getPreCountNum().add(num));
|
|
||||||
applyInfo.setAlNum(num);
|
applyInfo.setAlNum(num);
|
||||||
applyInfo.setWaitCountNum(applyInfo.getPreCountNum().subtract(num).compareTo(BigDecimal.ZERO) <= 0 ? BigDecimal.ZERO : applyInfo.getPreCountNum().subtract(num));
|
applyInfo.setWaitCountNum(applyInfo.getPreCountNum().subtract(num).compareTo(BigDecimal.ZERO) <= 0 ? BigDecimal.ZERO : applyInfo.getPreCountNum().subtract(num));
|
||||||
|
if (StringUtils.isNotBlank(applyInfo.getLeaseSignUrl())) {
|
||||||
|
applyInfo.setIsElectronicSign(0);
|
||||||
|
} else {
|
||||||
|
applyInfo.setIsElectronicSign(1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
String keyWord = leaseApplyInfo.getKeyWord();
|
String keyWord = leaseApplyInfo.getKeyWord();
|
||||||
// 如果关键字不为空,进行过滤
|
// 如果关键字不为空,进行过滤
|
||||||
|
|
@ -646,11 +630,12 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
|
||||||
// 处理已有数据的状态
|
// 处理已有数据的状态
|
||||||
list.forEach(applyDetails -> {
|
list.forEach(applyDetails -> {
|
||||||
if (outNumMap.containsKey(applyDetails.getTypeId())) {
|
if (outNumMap.containsKey(applyDetails.getTypeId())) {
|
||||||
applyDetails.setStatus("1");
|
outNumMap.remove(applyDetails.getTypeId());// 移除已匹配的项
|
||||||
outNumMap.remove(applyDetails.getTypeId()); // 移除已匹配的项
|
if (applyDetails.getOutNum().compareTo(BigDecimal.ZERO) == 0){
|
||||||
|
applyDetails.setStatus("1");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// 添加outNumList中剩余的typeId对应数据
|
// 添加outNumList中剩余的typeId对应数据
|
||||||
if (!outNumMap.isEmpty()) {
|
if (!outNumMap.isEmpty()) {
|
||||||
list.addAll(outNumMap.values());
|
list.addAll(outNumMap.values());
|
||||||
|
|
@ -664,6 +649,42 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AjaxResult submitLeaseOut(LeaseApplyDetails leaseApplyDetails) {
|
||||||
|
// 第一次提交,进行数据查询,给予提醒
|
||||||
|
if (leaseApplyDetails.getIsSubmit() != null && leaseApplyDetails.getIsSubmit() == 0) {
|
||||||
|
List<LeaseApplyDetails> list = leaseApplyDetailsMapper.getOutNum(leaseApplyDetails);
|
||||||
|
// 根据id去出库表查询数据,进行数据拼接
|
||||||
|
List<LeaseApplyDetails> outNumList = leaseApplyDetailsMapper.getOutNumList(leaseApplyDetails);
|
||||||
|
// 构建typeId到LeaseApplyDetails的映射,用于快速查找
|
||||||
|
Map<Long, LeaseApplyDetails> outNumMap = outNumList.stream()
|
||||||
|
.collect(Collectors.toMap(LeaseApplyDetails::getTypeId, details -> details, (existing, replacement) -> existing));
|
||||||
|
if (!CollectionUtils.isEmpty(list)) {
|
||||||
|
// 处理已有数据的状态
|
||||||
|
list.forEach(applyDetails -> {
|
||||||
|
if (outNumMap.containsKey(applyDetails.getTypeId()) && applyDetails.getOutNum().compareTo(BigDecimal.ZERO) == 0) {
|
||||||
|
applyDetails.setStatus("1");
|
||||||
|
outNumMap.remove(applyDetails.getTypeId());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// 添加outNumList中剩余的typeId对应数据
|
||||||
|
if (!outNumMap.isEmpty()) {
|
||||||
|
list.addAll(outNumMap.values());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 判断list中status状态是否全部为1 已完成
|
||||||
|
if (list.size() > list.stream().filter(item -> "1".equals(item.getStatus())).count()) {
|
||||||
|
return AjaxResult.success("该领料单有未出库领料数据,请确认是否提交");
|
||||||
|
} else {
|
||||||
|
return AjaxResult.success("该领料单无未出库领料数据,请确认是否提交");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
String taskId = leaseApplyInfoMapper.getTaskId(leaseApplyDetails.getId());
|
||||||
|
int result = tmTaskMapper.updateTaskStatus(taskId, LeaseTaskStatusEnum.LEASE_TASK_FINISHED.getStatus());
|
||||||
|
return result == 1 ? AjaxResult.success("提交成功") : AjaxResult.error("提交失败");
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 总站点领料记录数据过滤
|
* 总站点领料记录数据过滤
|
||||||
* @param item
|
* @param item
|
||||||
|
|
@ -860,6 +881,8 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int updateLeaseApplyInfoSign(LeaseApplyInfo leaseApplyInfo) {
|
public int updateLeaseApplyInfoSign(LeaseApplyInfo leaseApplyInfo) {
|
||||||
|
leaseApplyInfo.setUpdateBy( SecurityUtils.getUserId().toString());
|
||||||
|
leaseApplyInfo.setUpdateTime(DateUtils.getNowDate());
|
||||||
return leaseApplyInfoMapper.updateLeaseApplyInfoSign(leaseApplyInfo);
|
return leaseApplyInfoMapper.updateLeaseApplyInfoSign(leaseApplyInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -188,7 +188,7 @@ public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService {
|
||||||
throw new RuntimeException("出库失败,更新设备规格库存数量时出错!");
|
throw new RuntimeException("出库失败,更新设备规格库存数量时出错!");
|
||||||
}
|
}
|
||||||
// 4、修改任务状态(tm_task)
|
// 4、修改任务状态(tm_task)
|
||||||
if (record.getIsApp() != null && record.getIsApp() == 0) {
|
/*if (record.getIsApp() != null && record.getIsApp() == 0) {
|
||||||
LeaseApplyDetails leaseApplyDetails = new LeaseApplyDetails();
|
LeaseApplyDetails leaseApplyDetails = new LeaseApplyDetails();
|
||||||
leaseApplyDetails.setId(record.getParentId());
|
leaseApplyDetails.setId(record.getParentId());
|
||||||
List<LeaseApplyDetails> list = leaseApplyDetailsMapper.getOutNum(leaseApplyDetails);
|
List<LeaseApplyDetails> list = leaseApplyDetailsMapper.getOutNum(leaseApplyDetails);
|
||||||
|
|
@ -200,7 +200,7 @@ public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService {
|
||||||
if (!CollectionUtils.isEmpty(list)) {
|
if (!CollectionUtils.isEmpty(list)) {
|
||||||
// 处理已有数据的状态
|
// 处理已有数据的状态
|
||||||
list.forEach(applyDetails -> {
|
list.forEach(applyDetails -> {
|
||||||
if (outNumMap.containsKey(applyDetails.getTypeId())) {
|
if (outNumMap.containsKey(applyDetails.getTypeId()) && applyDetails.getOutNum().compareTo(BigDecimal.ZERO) == 0) {
|
||||||
applyDetails.setStatus("1");
|
applyDetails.setStatus("1");
|
||||||
outNumMap.remove(applyDetails.getTypeId()); // 移除已匹配的项
|
outNumMap.remove(applyDetails.getTypeId()); // 移除已匹配的项
|
||||||
}
|
}
|
||||||
|
|
@ -220,7 +220,7 @@ public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService {
|
||||||
}
|
}
|
||||||
if (res == 0) {
|
if (res == 0) {
|
||||||
throw new RuntimeException("出库失败,修改任务状态失败");
|
throw new RuntimeException("出库失败,修改任务状态失败");
|
||||||
}
|
}*/
|
||||||
// 5、插入结算记录
|
// 5、插入结算记录
|
||||||
String taskId = leaseApplyInfoMapper.getTaskId(record.getParentId());
|
String taskId = leaseApplyInfoMapper.getTaskId(record.getParentId());
|
||||||
record.setTaskId(taskId);
|
record.setTaskId(taskId);
|
||||||
|
|
|
||||||
|
|
@ -277,7 +277,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id AND mt1.del_flag = '0'
|
LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id AND mt1.del_flag = '0'
|
||||||
LEFT JOIN ma_station_code ms ON mm.ma_code = ms.ma_code
|
LEFT JOIN ma_station_code ms ON mm.ma_code = ms.ma_code
|
||||||
where
|
where
|
||||||
ms.ma_qrcode = #{qrCode}
|
ms.ma_qrcode = #{qrCode}
|
||||||
|
<if test="typeId != null and typeId != ''">
|
||||||
|
and mt.type_id = #{typeId}
|
||||||
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getCodeList" resultType="com.bonus.material.back.domain.vo.MaCodeVo">
|
<select id="getCodeList" resultType="com.bonus.material.back.domain.vo.MaCodeVo">
|
||||||
|
|
@ -724,6 +727,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
GROUP BY mt.type_id) AS subquery0 ON subquery0.type_id = mt.type_id
|
GROUP BY mt.type_id) AS subquery0 ON subquery0.type_id = mt.type_id
|
||||||
WHERE
|
WHERE
|
||||||
lad.parent_id = #{id}
|
lad.parent_id = #{id}
|
||||||
|
<if test="typeId != null and typeId != ''">
|
||||||
|
AND lad.type_id = #{typeId}
|
||||||
|
</if>
|
||||||
GROUP BY
|
GROUP BY
|
||||||
lad.parent_id,
|
lad.parent_id,
|
||||||
lad.type_id;
|
lad.type_id;
|
||||||
|
|
|
||||||
|
|
@ -225,6 +225,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<trim prefix="SET" suffixOverrides=",">
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
<if test="leaseSignUrl != null and leaseSignUrl != '' ">lease_sign_url = #{leaseSignUrl},</if>
|
<if test="leaseSignUrl != null and leaseSignUrl != '' ">lease_sign_url = #{leaseSignUrl},</if>
|
||||||
<if test="leaseSignType != null">lease_sign_type = #{leaseSignType},</if>
|
<if test="leaseSignType != null">lease_sign_type = #{leaseSignType},</if>
|
||||||
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||||
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||||
</trim>
|
</trim>
|
||||||
where id = #{id}
|
where id = #{id}
|
||||||
</update>
|
</update>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue