完成部分退料功能

This commit is contained in:
sxu 2024-07-30 16:07:50 +08:00
parent 9ef0b256aa
commit 800c97fb94
5 changed files with 40 additions and 9 deletions

View File

@ -118,22 +118,22 @@ public class BackReceiveController extends BaseController {
@Log(title = "退料接收明细-web", businessType = BusinessType.QUERY)
@PostMapping("/getReceiveViewWebNum")
public AjaxResult getReceiveViewWebNum(@RequestBody BackApplyInfo record) {
int res = 0;
boolean allowBack = true;
String[] split = record.getTypeId().split(",");
for (String s : split) {
record.setModelId(s);
record.setTypeId(null);
List<BackApplyInfo> list = backReceiveService.receiveView(record);
for (BackApplyInfo backApplyInfo : list) {
if (Double.valueOf(backApplyInfo.getNum()).intValue() != 0) {
res++;
if (Double.valueOf(backApplyInfo.getNum()).intValue() < 0) {
allowBack = allowBack && false;
}
}
}
if (res > 0) {
return AjaxResult.success(0);
} else {
if (allowBack) {
return AjaxResult.success(1);
} else {
return AjaxResult.success(0);
}
}

View File

@ -82,6 +82,10 @@ public class BackApplyInfo {
* 在用数量
*/
private String num;
/**
* 已完成的退料数量
*/
private String finishedBackNum;
/**
* 编码
*/
@ -229,4 +233,7 @@ public class BackApplyInfo {
*
*/
private Integer pageSize;
/**0:未完成退料,可以撤回 1:已完成退料,不能撤回*/
private Integer isFinished;
}

View File

@ -209,4 +209,6 @@ public interface BackReceiveMapper {
List<TmTask> getScrapBackMachine(TmTask task);
int updateStatus(BackApplyInfo record);
int finishBackCheckDetails(BackApplyInfo record);
}

View File

@ -99,6 +99,10 @@ public class BackReceiveServiceImpl implements BackReceiveService {
return backReceiveMapper.updateStatus(record);
}
private int finishBackCheckDetails(BackApplyInfo record) {
return backReceiveMapper.finishBackCheckDetails(record);
}
private int updateTaskStatus(int taskId, int i) {
int res;
res = backReceiveMapper.updateTaskStatus(taskId, i);
@ -173,8 +177,12 @@ public class BackReceiveServiceImpl implements BackReceiveService {
if (StringUtils.isNotBlank(record.getTypeId())) {
for (String s : record.getTypeId().split(",")) {
record.setTypeId(s);
//修改back_apply_details为已退料1
res = updateStatus(record);
if (allZeros) {
//修改back_apply_details为已退料1
res = updateStatus(record);
}
//完成退料的部分更新 back_check_details is_finished=1此部分不支持撤回
finishBackCheckDetails(record);
List<BackApplyInfo> hgList = backReceiveMapper.getHgList(record);
if (hgList != null && hgList.size() > 0) {
res = insertIad(hgList);

View File

@ -617,8 +617,11 @@
<update id="updateStatus">
update back_apply_details set back_status = 1 where parent_id = #{parentId} and type_id = #{typeId}
</update>
<update id="finishBackCheckDetails">
update back_check_details set is_finished = 1 where parent_id = #{parentId} and type_id = #{typeId}
</update>
<delete id="deleteCheckDetails">
delete from back_check_details where parent_id = #{parentId} and type_id = #{typeId}
delete from back_check_details where parent_id = #{parentId} and type_id = #{typeId} and (is_finished is null or is_finished != 1)
<if test="maId != null and maId != ''">
and ma_id = #{maId}
</if>
@ -713,6 +716,7 @@
bad.status as status,
bad.back_status as backStatus,
IFNULL(bad.audit_num,0)-IFNULL(aa.back_num,0) as num,
bb.finished_back_num,
mt.manage_type as manageType,
CONCAT('NSJJ',mt.`code`,mt.model_code) as `code`
FROM
@ -731,6 +735,16 @@
parent_id=#{id}
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=#{id} and is_finished = 1
GROUP BY type_id
) bb on bb.typeId=bad.type_id
WHERE
bai.id=#{id}
<if test="typeId != null and typeId != ''">