部分退料

This commit is contained in:
sxu 2024-08-23 20:15:16 +08:00
parent 539c876927
commit 136ffdaf3b
3 changed files with 62 additions and 4 deletions

View File

@ -32,6 +32,8 @@ public interface BackReceiveMapper {
*/
List<BackApplyInfo> receiveView(BackApplyInfo record);
List<BackApplyInfo> receiveView2(BackApplyInfo record);
/**
* 添加接收数据back_check_details
* @param record

View File

@ -147,7 +147,7 @@ public class BackReceiveServiceImpl implements BackReceiveService {
@Override
@Transactional(rollbackFor = Exception.class)
public int endBack(BackApplyInfo record) {
int res;
int res = 0;
// try {
int taskId = record.getTaskId();
int passNum = 0;
@ -167,10 +167,14 @@ public class BackReceiveServiceImpl implements BackReceiveService {
throw new RuntimeException("该退料单已完成退料");
}
//修改任务状态
List<BackApplyInfo> list = backReceiveMapper.receiveView2(record);
boolean allZeros = list.stream().allMatch(n -> Double.valueOf(n.getNum()).intValue() == 0);
if (allZeros) {
res = updateTaskStatus(taskId, 40);
if (res == 0) {
throw new RuntimeException("tm_task修改状态");
}
}
//更加退料接收的数据创建下一步流程
//合格的插入入库记录input_apply_details修改库存ma_type,修改机具状态
List<BackApplyInfo> hgList = backReceiveMapper.getHgList(record);

View File

@ -714,6 +714,58 @@
</if>
</select>
<select id="receiveView2" resultType="com.bonus.sgzb.base.api.domain.BackApplyInfo">
SELECT
bai.id,
bai.task_id as taskId,
tta.agreement_id as agreementId,
mt.type_id as modelId,
mt2.type_id as typeId,
mt.type_name as typeCode,
mt.unit_name as unitName,
mt2.type_name AS typeName,
bad.pre_num as preNum,
bad.audit_num as auditNum,
bad.status as status,
IFNULL(bad.audit_num,0)-IFNULL(aa.back_num,0) as num,
mt.manage_type as manageType,
bb.finished_back_num,
mtk.user_id,
CONCAT('NSJJ',mt.`code`,mt.model_code) as `code`
FROM
back_apply_details bad
LEFT JOIN back_apply_info bai on bai.id=bad.parent_id
LEFT JOIN tm_task_agreement tta on tta.task_id=bai.task_id
LEFT JOIN ma_type mt on mt.type_id=bad.type_id
LEFT JOIN ma_type mt2 ON mt2.type_id=mt.parent_id
LEFT JOIN ma_type_keeper mtk on mt.type_id=mtk.type_id
LEFT JOIN (
SELECT
type_id as typeId,
SUM(IFNULL(back_num,0)) as back_num
FROM
back_check_details
WHERE
parent_id=#{parentId}
GROUP BY 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=#{parentId} and is_finished = 1
GROUP BY type_id
) bb on bb.typeId=bad.type_id
WHERE
bai.id=#{parentId}
<if test="typeId != null and typeId != ''">
and mt.type_id = #{typeId}
</if>
</select>
<select id="getmaChineByCt" resultType="java.lang.Integer">
select num from ma_type WHERE type_id = #{typeId}
</select>