部分退料
This commit is contained in:
parent
539c876927
commit
136ffdaf3b
|
|
@ -32,6 +32,8 @@ public interface BackReceiveMapper {
|
||||||
*/
|
*/
|
||||||
List<BackApplyInfo> receiveView(BackApplyInfo record);
|
List<BackApplyInfo> receiveView(BackApplyInfo record);
|
||||||
|
|
||||||
|
List<BackApplyInfo> receiveView2(BackApplyInfo record);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加接收数据back_check_details
|
* 添加接收数据back_check_details
|
||||||
* @param record
|
* @param record
|
||||||
|
|
|
||||||
|
|
@ -147,7 +147,7 @@ public class BackReceiveServiceImpl implements BackReceiveService {
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public int endBack(BackApplyInfo record) {
|
public int endBack(BackApplyInfo record) {
|
||||||
int res;
|
int res = 0;
|
||||||
// try {
|
// try {
|
||||||
int taskId = record.getTaskId();
|
int taskId = record.getTaskId();
|
||||||
int passNum = 0;
|
int passNum = 0;
|
||||||
|
|
@ -167,9 +167,13 @@ public class BackReceiveServiceImpl implements BackReceiveService {
|
||||||
throw new RuntimeException("该退料单已完成退料");
|
throw new RuntimeException("该退料单已完成退料");
|
||||||
}
|
}
|
||||||
//修改任务状态
|
//修改任务状态
|
||||||
res = updateTaskStatus(taskId, 40);
|
List<BackApplyInfo> list = backReceiveMapper.receiveView2(record);
|
||||||
if (res == 0) {
|
boolean allZeros = list.stream().allMatch(n -> Double.valueOf(n.getNum()).intValue() == 0);
|
||||||
throw new RuntimeException("tm_task修改状态");
|
if (allZeros) {
|
||||||
|
res = updateTaskStatus(taskId, 40);
|
||||||
|
if (res == 0) {
|
||||||
|
throw new RuntimeException("tm_task修改状态");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//更加退料接收的数据创建下一步流程
|
//更加退料接收的数据创建下一步流程
|
||||||
//合格的插入入库记录input_apply_details,修改库存ma_type,修改机具状态
|
//合格的插入入库记录input_apply_details,修改库存ma_type,修改机具状态
|
||||||
|
|
|
||||||
|
|
@ -714,6 +714,58 @@
|
||||||
</if>
|
</if>
|
||||||
</select>
|
</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 id="getmaChineByCt" resultType="java.lang.Integer">
|
||||||
select num from ma_type WHERE type_id = #{typeId}
|
select num from ma_type WHERE type_id = #{typeId}
|
||||||
</select>
|
</select>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue