退料接收时,检查结算表拿到待退料数量,防止多退
This commit is contained in:
parent
8c1c1f41d1
commit
d811481ead
|
|
@ -292,9 +292,13 @@ public class BackApplyInfo extends BaseEntity {
|
||||||
private float inCompletedBackNum;
|
private float inCompletedBackNum;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 此协议号最大剩余退料数
|
* 此协议号最大剩余退料数 (前台显示 slt_agreement_info 表减去 back_check_details)
|
||||||
*/
|
*/
|
||||||
private float maxBackNum;
|
private float maxBackNum;
|
||||||
|
/**
|
||||||
|
* 此协议号最大剩余退料数 (后台计算,只查 slt_agreement_info 表)
|
||||||
|
*/
|
||||||
|
private float maxBackNumBackend;
|
||||||
|
|
||||||
@ApiModelProperty(value = "详情id和数量")
|
@ApiModelProperty(value = "详情id和数量")
|
||||||
private String detailsIdByNum;
|
private String detailsIdByNum;
|
||||||
|
|
|
||||||
|
|
@ -151,7 +151,7 @@ public class BackReceiveServiceImpl implements BackReceiveService {
|
||||||
int res = 0;
|
int res = 0;
|
||||||
// try {
|
// try {
|
||||||
int taskId = record.getTaskId();
|
int taskId = record.getTaskId();
|
||||||
int maxBackNum = 0;
|
int maxBackNumBackEnd = 0;
|
||||||
int passNum = 0;
|
int passNum = 0;
|
||||||
int maintenanceNum = 0;
|
int maintenanceNum = 0;
|
||||||
int scrapNum = 0;
|
int scrapNum = 0;
|
||||||
|
|
@ -172,7 +172,7 @@ public class BackReceiveServiceImpl implements BackReceiveService {
|
||||||
List<BackApplyInfo> list = backReceiveMapper.receiveView4Backend(record);
|
List<BackApplyInfo> list = backReceiveMapper.receiveView4Backend(record);
|
||||||
if (!CollectionUtils.isEmpty(list)) {
|
if (!CollectionUtils.isEmpty(list)) {
|
||||||
for (BackApplyInfo backApplyInfo : list) {
|
for (BackApplyInfo backApplyInfo : list) {
|
||||||
maxBackNum += (int) backApplyInfo.getMaxBackNum();
|
maxBackNumBackEnd += (int) backApplyInfo.getMaxBackNumBackend();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
List<BackApplyInfo> hgList = backReceiveMapper.getHgList(record);
|
List<BackApplyInfo> hgList = backReceiveMapper.getHgList(record);
|
||||||
|
|
@ -193,7 +193,7 @@ public class BackReceiveServiceImpl implements BackReceiveService {
|
||||||
scrapNum += bi.getBackNum();
|
scrapNum += bi.getBackNum();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (maxBackNum < passNum + maintenanceNum + scrapNum) {
|
if (maxBackNumBackEnd < passNum + maintenanceNum + scrapNum) {
|
||||||
throw new RuntimeException("提交退料数量大于最大退料数,可能您的退料已被别人退掉了");
|
throw new RuntimeException("提交退料数量大于最大退料数,可能您的退料已被别人退掉了");
|
||||||
}
|
}
|
||||||
boolean allZeros = list.stream().allMatch(n -> Double.valueOf(n.getNum()).intValue() == 0);
|
boolean allZeros = list.stream().allMatch(n -> Double.valueOf(n.getNum()).intValue() == 0);
|
||||||
|
|
|
||||||
|
|
@ -673,7 +673,11 @@
|
||||||
bad.pre_num as preNum,
|
bad.pre_num as preNum,
|
||||||
bad.audit_num as auditNum,
|
bad.audit_num as auditNum,
|
||||||
bad.status as status,
|
bad.status as status,
|
||||||
CASE WHEN (IFNULL(sai.num, 0)-IFNULL(aa.back_num,0)) < 0 THEN 0 ELSE (IFNULL(sai.num, 0)-IFNULL(aa.back_num,0)) END as max_back_num,
|
CASE WHEN ((IFNULL(sai.num, 0)-IFNULL(aa.back_num,0)) > (bad.audit_num-IFNULL(bb.finished_back_num,0)-IFNULL(aa.back_num,0)))
|
||||||
|
THEN (bad.audit_num-IFNULL(bb.finished_back_num,0)-IFNULL(aa.back_num,0))
|
||||||
|
ELSE
|
||||||
|
(CASE WHEN (IFNULL(sai.num, 0)-IFNULL(aa.back_num,0)) < 0 THEN 0 ELSE (IFNULL(sai.num, 0)-IFNULL(aa.back_num,0)) END)
|
||||||
|
END as max_back_num,
|
||||||
IFNULL(aa.back_num,0) as in_completed_back_num,
|
IFNULL(aa.back_num,0) as in_completed_back_num,
|
||||||
IFNULL(bb.finished_back_num, 0) as finished_back_num,
|
IFNULL(bb.finished_back_num, 0) as finished_back_num,
|
||||||
mt.manage_type as manageType,
|
mt.manage_type as manageType,
|
||||||
|
|
@ -731,8 +735,12 @@
|
||||||
bad.pre_num as preNum,
|
bad.pre_num as preNum,
|
||||||
bad.audit_num as auditNum,
|
bad.audit_num as auditNum,
|
||||||
bad.status as status,
|
bad.status as status,
|
||||||
CASE WHEN (IFNULL(sai.num, 0)-IFNULL(aa.back_num,0)) < 0 THEN 0 ELSE (IFNULL(sai.num, 0)-IFNULL(aa.back_num,0)) END as num,
|
CASE WHEN ((IFNULL(sai.num, 0)-IFNULL(aa.back_num,0)) > (bad.audit_num-IFNULL(bb.finished_back_num,0)-IFNULL(aa.back_num,0)))
|
||||||
IFNULL(sai.num, 0) as max_back_num,
|
THEN (bad.audit_num-IFNULL(bb.finished_back_num,0)-IFNULL(aa.back_num,0))
|
||||||
|
ELSE
|
||||||
|
(CASE WHEN (IFNULL(sai.num, 0)-IFNULL(aa.back_num,0)) < 0 THEN 0 ELSE (IFNULL(sai.num, 0)-IFNULL(aa.back_num,0)) END)
|
||||||
|
END as num,
|
||||||
|
IFNULL(sai.num, 0) as max_back_num_backend,
|
||||||
mt.manage_type as manageType,
|
mt.manage_type as manageType,
|
||||||
mtk.user_id,
|
mtk.user_id,
|
||||||
CONCAT('NSJJ',mt.`code`,mt.model_code) as `code`
|
CONCAT('NSJJ',mt.`code`,mt.model_code) as `code`
|
||||||
|
|
@ -755,6 +763,16 @@
|
||||||
parent_id=#{parentId} and is_finished is null
|
parent_id=#{parentId} and is_finished is null
|
||||||
GROUP BY type_id
|
GROUP BY type_id
|
||||||
) aa on aa.typeId=bad.type_id
|
) aa on aa.typeId=bad.type_id
|
||||||
|
LEFT JOIN (
|
||||||
|
SELECT
|
||||||
|
type_id as typeId,
|
||||||
|
SUM(IFNULL(back_num,0)) as finished_back_num
|
||||||
|
FROM
|
||||||
|
back_check_details
|
||||||
|
WHERE
|
||||||
|
parent_id=#{id} and is_finished = 1
|
||||||
|
GROUP BY type_id
|
||||||
|
) bb on bb.typeId=bad.type_id
|
||||||
WHERE
|
WHERE
|
||||||
bai.id=#{parentId}
|
bai.id=#{parentId}
|
||||||
<if test="typeId != null and typeId != ''">
|
<if test="typeId != null and typeId != ''">
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue