退料接收撤回代码提交
This commit is contained in:
parent
37784d49e7
commit
09dd56414a
|
|
@ -123,7 +123,6 @@ public class BackReceiveController extends BaseController {
|
|||
* 编码退料--管理方式为0的
|
||||
*
|
||||
* @param record 查询条件
|
||||
*
|
||||
* @return AjaxResult对象
|
||||
*/
|
||||
@Log(title = "退料接收-编码退料", businessType = BusinessType.INSERT)
|
||||
|
|
@ -143,6 +142,22 @@ public class BackReceiveController extends BaseController {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 退料接收撤回
|
||||
*
|
||||
* @return AjaxResult对象
|
||||
*/
|
||||
@Log(title = "退料接收撤回")
|
||||
@PostMapping("revoke")
|
||||
public AjaxResult revoke(@RequestBody BackApplyInfo record) {
|
||||
int res = backReceiveService.revoke(record);
|
||||
if (res > 0) {
|
||||
return AjaxResult.success("撤回成功");
|
||||
} else {
|
||||
return AjaxResult.error("撤回失败");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 退料接收-rfid退料
|
||||
*
|
||||
|
|
|
|||
|
|
@ -190,4 +190,8 @@ public interface BackReceiveMapper {
|
|||
List<TmTask> getBackMachine(TmTask task);
|
||||
|
||||
List<TmTask> getRecord(TmTask task);
|
||||
|
||||
int deleteCheckDetails(BackApplyInfo backApplyInfo);
|
||||
|
||||
List<Integer> getMaId(BackApplyInfo backApplyInfo);
|
||||
}
|
||||
|
|
@ -114,4 +114,6 @@ public interface TmTaskMapper {
|
|||
List<TmTask> getLeaseOutListByUser(TmTask task);
|
||||
|
||||
List<TmTask> getLeaseDetailByParentId(TmTask record);
|
||||
|
||||
List<TmTask> getMaTypeDetails(List<LeaseApplyDetails> leaseApplyDetails);
|
||||
}
|
||||
|
|
@ -93,4 +93,6 @@ public interface BackReceiveService {
|
|||
List<TmTask> getBackMachine(TmTask task);
|
||||
|
||||
List<TmTask> getRecord(TmTask task);
|
||||
|
||||
int revoke(BackApplyInfo record);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -261,6 +261,16 @@ public class BackReceiveServiceImpl implements BackReceiveService {
|
|||
return backReceiveMapper.getRecord(task);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int revoke(BackApplyInfo record) {
|
||||
//删除back_check_details
|
||||
int res = deleteBcd(record);
|
||||
if (res == 0) {
|
||||
throw new RuntimeException("删除back_check_details异常");
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
private int insertRad(int taskId, List<BackApplyInfo> wxList) {
|
||||
int result = 0;
|
||||
if (wxList != null) {
|
||||
|
|
@ -378,6 +388,23 @@ public class BackReceiveServiceImpl implements BackReceiveService {
|
|||
return res;
|
||||
}
|
||||
|
||||
private int deleteBcd(BackApplyInfo record) {
|
||||
int res = 0;
|
||||
if (record != null) {
|
||||
String manageType = record.getManageType();
|
||||
if ("0".equals(manageType)) {
|
||||
List<Integer> maId = backReceiveMapper.getMaId(record);
|
||||
for (Integer s : maId) {
|
||||
//机具状态变为在用
|
||||
backReceiveMapper.updateMaStatus(s, "16");
|
||||
}
|
||||
}
|
||||
res = backReceiveMapper.deleteCheckDetails(record);
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 编号生成规则
|
||||
|
|
|
|||
|
|
@ -546,6 +546,7 @@ public class TmTaskServiceImpl implements TmTaskService {
|
|||
// 去查询领料任务详情表
|
||||
List<LeaseApplyDetails> leaseApplyDetails = tmTaskMapper.getLeaseApplyDetailsCq(leaseApplyInfo);
|
||||
if (leaseApplyDetails != null && !leaseApplyDetails.isEmpty()) {
|
||||
tmTaskMapper.getMaTypeDetails(leaseApplyDetails);
|
||||
listLeaseDetails.addAll(leaseApplyDetails);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -578,6 +578,12 @@
|
|||
status = '1'
|
||||
where id = #{info.id}
|
||||
</update>
|
||||
<delete id="deleteCheckDetails">
|
||||
delete from back_check_details where parent_id = #{parentId} and type_id = #{typeId}
|
||||
<if test="maId != null and maId != ''">
|
||||
and ma_id = #{maId}
|
||||
</if>
|
||||
</delete>
|
||||
|
||||
<select id="getbackReceiveList" resultType="com.bonus.sgzb.app.domain.BackApplyInfo">
|
||||
SELECT
|
||||
|
|
@ -919,6 +925,9 @@
|
|||
ORDER BY
|
||||
bcd.create_time DESC
|
||||
</select>
|
||||
<select id="getMaId" resultType="java.lang.Integer">
|
||||
select ma_id from back_check_details where parent_id = #{parentId} and type_id = #{typeId}
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
|
@ -967,4 +967,10 @@
|
|||
and lad.type_id = #{typeId}
|
||||
</if>
|
||||
</select>
|
||||
<select id="getMaTypeDetails" resultType="com.bonus.sgzb.app.domain.TmTask">
|
||||
select mt2.type_name as typeName,
|
||||
mt.type_name as typeModelName
|
||||
from ma_type mt on lad.type_id = mt.type_id
|
||||
LEFT JOIN ma_type mt2 on mt.parent_id = mt2.type_id
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -133,4 +133,10 @@ public interface BackApplyMapper {
|
|||
List<BackApplyInfo> selectIdByTaskId(Integer taskId);
|
||||
|
||||
int getUseNumByTypeId(String typeId);
|
||||
|
||||
int getManageType(String typeId);
|
||||
|
||||
int getLeaseOutNum(String typeId);
|
||||
|
||||
int getbackCheckNum(String typeId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -375,7 +375,16 @@ public class BackApplyServiceImpl implements BackApplyService {
|
|||
|
||||
@Override
|
||||
public int getUseNumByTypeId(String typeId) {
|
||||
int manageType = backApplyMapper.getManageType(typeId);
|
||||
if (manageType == 0) {
|
||||
// 编码入库的机具
|
||||
return backApplyMapper.getUseNumByTypeId(typeId);
|
||||
} else {
|
||||
// 数量入库的机具
|
||||
int leaseOutNum = backApplyMapper.getLeaseOutNum(typeId);
|
||||
int backCheckNum = backApplyMapper.getbackCheckNum(typeId);
|
||||
return leaseOutNum - backCheckNum;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -815,5 +815,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<select id="getUseNumByTypeId" resultType="java.lang.Integer">
|
||||
select count(*) as useNum from ma_machine where type_id = #{typeId} and ma_status in (16,84)
|
||||
</select>
|
||||
<select id="getManageType" resultType="java.lang.Integer">
|
||||
select mt.manage_type AS manageType FROM ma_type mt WHERE mt.type_id = #{typeId}
|
||||
</select>
|
||||
<select id="getLeaseOutNum" resultType="java.lang.Integer">
|
||||
SELECT sum(lod.out_num) FROM lease_out_details lod WHERE lod.type_id = #{typeId}
|
||||
</select>
|
||||
<select id="getbackCheckNum" resultType="java.lang.Integer">
|
||||
SELECT sum(bcd.back_num) FROM back_check_details bcd WHERE bcd.type_id = #{typeId}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue