完成部分退料功能
This commit is contained in:
parent
9ef0b256aa
commit
800c97fb94
|
|
@ -118,22 +118,22 @@ public class BackReceiveController extends BaseController {
|
||||||
@Log(title = "退料接收明细-web", businessType = BusinessType.QUERY)
|
@Log(title = "退料接收明细-web", businessType = BusinessType.QUERY)
|
||||||
@PostMapping("/getReceiveViewWebNum")
|
@PostMapping("/getReceiveViewWebNum")
|
||||||
public AjaxResult getReceiveViewWebNum(@RequestBody BackApplyInfo record) {
|
public AjaxResult getReceiveViewWebNum(@RequestBody BackApplyInfo record) {
|
||||||
int res = 0;
|
boolean allowBack = true;
|
||||||
String[] split = record.getTypeId().split(",");
|
String[] split = record.getTypeId().split(",");
|
||||||
for (String s : split) {
|
for (String s : split) {
|
||||||
record.setModelId(s);
|
record.setModelId(s);
|
||||||
record.setTypeId(null);
|
record.setTypeId(null);
|
||||||
List<BackApplyInfo> list = backReceiveService.receiveView(record);
|
List<BackApplyInfo> list = backReceiveService.receiveView(record);
|
||||||
for (BackApplyInfo backApplyInfo : list) {
|
for (BackApplyInfo backApplyInfo : list) {
|
||||||
if (Double.valueOf(backApplyInfo.getNum()).intValue() != 0) {
|
if (Double.valueOf(backApplyInfo.getNum()).intValue() < 0) {
|
||||||
res++;
|
allowBack = allowBack && false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (res > 0) {
|
if (allowBack) {
|
||||||
return AjaxResult.success(0);
|
|
||||||
} else {
|
|
||||||
return AjaxResult.success(1);
|
return AjaxResult.success(1);
|
||||||
|
} else {
|
||||||
|
return AjaxResult.success(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -82,6 +82,10 @@ public class BackApplyInfo {
|
||||||
* 在用数量
|
* 在用数量
|
||||||
*/
|
*/
|
||||||
private String num;
|
private String num;
|
||||||
|
/**
|
||||||
|
* 已完成的退料数量
|
||||||
|
*/
|
||||||
|
private String finishedBackNum;
|
||||||
/**
|
/**
|
||||||
* 编码
|
* 编码
|
||||||
*/
|
*/
|
||||||
|
|
@ -229,4 +233,7 @@ public class BackApplyInfo {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private Integer pageSize;
|
private Integer pageSize;
|
||||||
|
|
||||||
|
/**0:未完成退料,可以撤回 1:已完成退料,不能撤回*/
|
||||||
|
private Integer isFinished;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -209,4 +209,6 @@ public interface BackReceiveMapper {
|
||||||
List<TmTask> getScrapBackMachine(TmTask task);
|
List<TmTask> getScrapBackMachine(TmTask task);
|
||||||
|
|
||||||
int updateStatus(BackApplyInfo record);
|
int updateStatus(BackApplyInfo record);
|
||||||
|
|
||||||
|
int finishBackCheckDetails(BackApplyInfo record);
|
||||||
}
|
}
|
||||||
|
|
@ -99,6 +99,10 @@ public class BackReceiveServiceImpl implements BackReceiveService {
|
||||||
return backReceiveMapper.updateStatus(record);
|
return backReceiveMapper.updateStatus(record);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int finishBackCheckDetails(BackApplyInfo record) {
|
||||||
|
return backReceiveMapper.finishBackCheckDetails(record);
|
||||||
|
}
|
||||||
|
|
||||||
private int updateTaskStatus(int taskId, int i) {
|
private int updateTaskStatus(int taskId, int i) {
|
||||||
int res;
|
int res;
|
||||||
res = backReceiveMapper.updateTaskStatus(taskId, i);
|
res = backReceiveMapper.updateTaskStatus(taskId, i);
|
||||||
|
|
@ -173,8 +177,12 @@ public class BackReceiveServiceImpl implements BackReceiveService {
|
||||||
if (StringUtils.isNotBlank(record.getTypeId())) {
|
if (StringUtils.isNotBlank(record.getTypeId())) {
|
||||||
for (String s : record.getTypeId().split(",")) {
|
for (String s : record.getTypeId().split(",")) {
|
||||||
record.setTypeId(s);
|
record.setTypeId(s);
|
||||||
//修改back_apply_details为已退料(1)
|
if (allZeros) {
|
||||||
res = updateStatus(record);
|
//修改back_apply_details为已退料(1)
|
||||||
|
res = updateStatus(record);
|
||||||
|
}
|
||||||
|
//完成退料的部分,更新 back_check_details 为 is_finished=1,此部分不支持撤回
|
||||||
|
finishBackCheckDetails(record);
|
||||||
List<BackApplyInfo> hgList = backReceiveMapper.getHgList(record);
|
List<BackApplyInfo> hgList = backReceiveMapper.getHgList(record);
|
||||||
if (hgList != null && hgList.size() > 0) {
|
if (hgList != null && hgList.size() > 0) {
|
||||||
res = insertIad(hgList);
|
res = insertIad(hgList);
|
||||||
|
|
|
||||||
|
|
@ -617,8 +617,11 @@
|
||||||
<update id="updateStatus">
|
<update id="updateStatus">
|
||||||
update back_apply_details set back_status = 1 where parent_id = #{parentId} and type_id = #{typeId}
|
update back_apply_details set back_status = 1 where parent_id = #{parentId} and type_id = #{typeId}
|
||||||
</update>
|
</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 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 != ''">
|
<if test="maId != null and maId != ''">
|
||||||
and ma_id = #{maId}
|
and ma_id = #{maId}
|
||||||
</if>
|
</if>
|
||||||
|
|
@ -713,6 +716,7 @@
|
||||||
bad.status as status,
|
bad.status as status,
|
||||||
bad.back_status as backStatus,
|
bad.back_status as backStatus,
|
||||||
IFNULL(bad.audit_num,0)-IFNULL(aa.back_num,0) as num,
|
IFNULL(bad.audit_num,0)-IFNULL(aa.back_num,0) as num,
|
||||||
|
bb.finished_back_num,
|
||||||
mt.manage_type as manageType,
|
mt.manage_type as manageType,
|
||||||
CONCAT('NSJJ',mt.`code`,mt.model_code) as `code`
|
CONCAT('NSJJ',mt.`code`,mt.model_code) as `code`
|
||||||
FROM
|
FROM
|
||||||
|
|
@ -731,6 +735,16 @@
|
||||||
parent_id=#{id}
|
parent_id=#{id}
|
||||||
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=#{id}
|
bai.id=#{id}
|
||||||
<if test="typeId != null and typeId != ''">
|
<if test="typeId != null and typeId != ''">
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue