部分退料
This commit is contained in:
parent
99fe304cd7
commit
2a7961c72a
|
|
@ -281,6 +281,11 @@ public class BackApplyInfo extends BaseEntity {
|
||||||
@ApiModelProperty(value = "数量")
|
@ApiModelProperty(value = "数量")
|
||||||
private String num;
|
private String num;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 已完成的退料数量
|
||||||
|
*/
|
||||||
|
private String finishedBackNum;
|
||||||
|
|
||||||
@ApiModelProperty(value = "详情id和数量")
|
@ApiModelProperty(value = "详情id和数量")
|
||||||
private String detailsIdByNum;
|
private String detailsIdByNum;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,4 +9,4 @@ spring:
|
||||||
name: sgzb-auth
|
name: sgzb-auth
|
||||||
profiles:
|
profiles:
|
||||||
# 环境配置
|
# 环境配置
|
||||||
active: sgzb_cloud_local
|
active: sgzb_cq_local
|
||||||
|
|
|
||||||
|
|
@ -9,4 +9,4 @@ spring:
|
||||||
name: sgzb-gateway
|
name: sgzb-gateway
|
||||||
profiles:
|
profiles:
|
||||||
# 环境配置
|
# 环境配置
|
||||||
active: sgzb_cloud_local
|
active: sgzb_cq_local
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
<artifactId>sgzb-modules-material-cq1.0</artifactId>
|
<artifactId>sgzb-modules-material-common-3.0</artifactId>
|
||||||
|
|
||||||
<description>
|
<description>
|
||||||
sgzb-modules-material
|
sgzb-modules-material
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
@ -207,4 +209,6 @@ public interface BackReceiveMapper {
|
||||||
List<BackApplyInfo> getCtList(BackApplyInfo record);
|
List<BackApplyInfo> getCtList(BackApplyInfo record);
|
||||||
|
|
||||||
List<BackApplyInfo> backReceiveRecordWebPt(BackApplyInfo record);
|
List<BackApplyInfo> backReceiveRecordWebPt(BackApplyInfo record);
|
||||||
|
|
||||||
|
int finishBackCheckDetails(BackApplyInfo record);
|
||||||
}
|
}
|
||||||
|
|
@ -98,6 +98,10 @@ public class BackReceiveServiceImpl implements BackReceiveService {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int finishBackCheckDetails(BackApplyInfo record) {
|
||||||
|
return backReceiveMapper.finishBackCheckDetails(record);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public int setCodeBack(BackApplyInfo record) {
|
public int setCodeBack(BackApplyInfo record) {
|
||||||
|
|
@ -143,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;
|
||||||
|
|
@ -163,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,修改机具状态
|
||||||
|
|
@ -236,6 +244,9 @@ public class BackReceiveServiceImpl implements BackReceiveService {
|
||||||
record.setPostStoreNum(postStoreNum);
|
record.setPostStoreNum(postStoreNum);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//完成退料的部分,更新 back_check_details 为 is_finished=1,此部分不支持撤回
|
||||||
|
finishBackCheckDetails(record);
|
||||||
|
|
||||||
//库存日志
|
//库存日志
|
||||||
record.setBackNum(passNum+maintenanceNum+scrapNum);
|
record.setBackNum(passNum+maintenanceNum+scrapNum);
|
||||||
record.setPassNum(passNum);
|
record.setPassNum(passNum);
|
||||||
|
|
|
||||||
|
|
@ -5,4 +5,4 @@ spring:
|
||||||
name: sgzb-material
|
name: sgzb-material
|
||||||
profiles:
|
profiles:
|
||||||
# 环境配置
|
# 环境配置
|
||||||
active: sgzb_cloud_local
|
active: sgzb_cq_local
|
||||||
|
|
@ -578,8 +578,13 @@
|
||||||
status = '1'
|
status = '1'
|
||||||
where id = #{info.id}
|
where id = #{info.id}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
<update id="finishBackCheckDetails">
|
||||||
|
update back_check_details set is_finished = 1 where parent_id = #{parentId} and type_id = #{typeId} and (is_finished is null or is_finished != 1)
|
||||||
|
</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>
|
||||||
|
|
@ -669,6 +674,7 @@
|
||||||
bad.status as status,
|
bad.status as status,
|
||||||
IFNULL(bad.audit_num,0)-IFNULL(aa.back_num,0) as num,
|
IFNULL(bad.audit_num,0)-IFNULL(aa.back_num,0) as num,
|
||||||
mt.manage_type as manageType,
|
mt.manage_type as manageType,
|
||||||
|
bb.finished_back_num,
|
||||||
mtk.user_id,
|
mtk.user_id,
|
||||||
CONCAT('NSJJ',mt.`code`,mt.model_code) as `code`
|
CONCAT('NSJJ',mt.`code`,mt.model_code) as `code`
|
||||||
FROM
|
FROM
|
||||||
|
|
@ -688,6 +694,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 != ''">
|
||||||
|
|
@ -698,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>
|
||||||
|
|
@ -723,7 +791,7 @@
|
||||||
LEFT JOIN tm_task_agreement tta on tta.task_id=bai.task_id
|
LEFT JOIN tm_task_agreement tta on tta.task_id=bai.task_id
|
||||||
WHERE
|
WHERE
|
||||||
parent_id=#{parentId}
|
parent_id=#{parentId}
|
||||||
and bcd.back_status='1'
|
and bcd.back_status='1' and (bcd.is_finished is null or bcd.is_finished != 1)
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getWxList" resultType="com.bonus.sgzb.base.api.domain.BackApplyInfo">
|
<select id="getWxList" resultType="com.bonus.sgzb.base.api.domain.BackApplyInfo">
|
||||||
|
|
@ -743,7 +811,7 @@
|
||||||
LEFT JOIN tm_task_agreement tta on tta.task_id=bai.task_id
|
LEFT JOIN tm_task_agreement tta on tta.task_id=bai.task_id
|
||||||
WHERE
|
WHERE
|
||||||
parent_id=#{parentId}
|
parent_id=#{parentId}
|
||||||
and bcd.back_status='2'
|
and bcd.back_status='2' and (bcd.is_finished is null or bcd.is_finished != 1)
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getBfList" resultType="com.bonus.sgzb.base.api.domain.BackApplyInfo">
|
<select id="getBfList" resultType="com.bonus.sgzb.base.api.domain.BackApplyInfo">
|
||||||
|
|
@ -763,7 +831,7 @@
|
||||||
LEFT JOIN tm_task_agreement tta on tta.task_id=bai.task_id
|
LEFT JOIN tm_task_agreement tta on tta.task_id=bai.task_id
|
||||||
WHERE
|
WHERE
|
||||||
parent_id=#{parentId}
|
parent_id=#{parentId}
|
||||||
and bcd.back_status='3'
|
and bcd.back_status='3' and (bcd.is_finished is null or bcd.is_finished != 1)
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="codeQuery" resultType="com.bonus.sgzb.base.api.domain.BackApplyInfo">
|
<select id="codeQuery" resultType="com.bonus.sgzb.base.api.domain.BackApplyInfo">
|
||||||
|
|
@ -895,7 +963,7 @@
|
||||||
LEFT JOIN back_apply_info bai ON bai.id = bcd.parent_id
|
LEFT JOIN back_apply_info bai ON bai.id = bcd.parent_id
|
||||||
LEFT JOIN tm_task_agreement tta ON tta.task_id = bai.task_id
|
LEFT JOIN tm_task_agreement tta ON tta.task_id = bai.task_id
|
||||||
WHERE
|
WHERE
|
||||||
parent_id = #{parentId}
|
parent_id = #{parentId} and (bcd.is_finished is null or bcd.is_finished != 1)
|
||||||
GROUP By bcd.type_id,bcd.ma_id
|
GROUP By bcd.type_id,bcd.ma_id
|
||||||
</select>
|
</select>
|
||||||
<select id="getBackMachine" resultType="com.bonus.sgzb.app.domain.TmTask">
|
<select id="getBackMachine" resultType="com.bonus.sgzb.app.domain.TmTask">
|
||||||
|
|
|
||||||
|
|
@ -9,4 +9,4 @@ spring:
|
||||||
name: sgzb-system
|
name: sgzb-system
|
||||||
profiles:
|
profiles:
|
||||||
# 环境配置
|
# 环境配置
|
||||||
active: sgzb_cloud_local
|
active: sgzb_cq_local
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue