退料可选需求变更
This commit is contained in:
parent
aaa118151a
commit
801ac0807d
|
|
@ -118,14 +118,23 @@ 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;
|
||||||
|
String[] split = record.getTypeId().split(",");
|
||||||
|
for (String s : split) {
|
||||||
|
record.setModelId(s);
|
||||||
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++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (res > 0) {
|
||||||
return AjaxResult.success(0);
|
return AjaxResult.success(0);
|
||||||
}
|
} else {
|
||||||
}
|
|
||||||
return AjaxResult.success(1);
|
return AjaxResult.success(1);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 数量退料--管理方式为1的
|
* 数量退料--管理方式为1的
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,7 @@ public interface BackReceiveMapper {
|
||||||
* @return List<BackApplyInfo>
|
* @return List<BackApplyInfo>
|
||||||
*/
|
*/
|
||||||
List<BackApplyInfo> receiveView(BackApplyInfo record);
|
List<BackApplyInfo> receiveView(BackApplyInfo record);
|
||||||
|
List<BackApplyInfo> receiveView2(BackApplyInfo record);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加接收数据back_check_details
|
* 添加接收数据back_check_details
|
||||||
|
|
@ -207,4 +208,5 @@ public interface BackReceiveMapper {
|
||||||
|
|
||||||
List<TmTask> getScrapBackMachine(TmTask task);
|
List<TmTask> getScrapBackMachine(TmTask task);
|
||||||
|
|
||||||
|
int updateStatus(BackApplyInfo record);
|
||||||
}
|
}
|
||||||
|
|
@ -13,8 +13,10 @@ import com.bonus.sgzb.common.core.enums.TaskTypeEnum;
|
||||||
import com.bonus.sgzb.common.core.utils.DateUtils;
|
import com.bonus.sgzb.common.core.utils.DateUtils;
|
||||||
import com.bonus.sgzb.common.core.utils.GlobalConstants;
|
import com.bonus.sgzb.common.core.utils.GlobalConstants;
|
||||||
import com.bonus.sgzb.common.core.utils.StringHelper;
|
import com.bonus.sgzb.common.core.utils.StringHelper;
|
||||||
|
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
|
||||||
import com.bonus.sgzb.common.security.utils.SecurityUtils;
|
import com.bonus.sgzb.common.security.utils.SecurityUtils;
|
||||||
import org.apache.commons.lang3.ObjectUtils;
|
import org.apache.commons.lang3.ObjectUtils;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
|
@ -65,32 +67,11 @@ public class BackReceiveServiceImpl implements BackReceiveService {
|
||||||
@Override
|
@Override
|
||||||
public List<BackApplyInfo> receiveView(BackApplyInfo record) {
|
public List<BackApplyInfo> receiveView(BackApplyInfo record) {
|
||||||
List<BackApplyInfo> backApplyInfoList = backReceiveMapper.receiveView(record);
|
List<BackApplyInfo> backApplyInfoList = backReceiveMapper.receiveView(record);
|
||||||
//重庆成套设备处理(宁夏不用)
|
return backApplyInfoList;
|
||||||
/* int count1 = 0;
|
|
||||||
int count2 = 0;
|
|
||||||
for (BackApplyInfo backApplyInfo : backApplyInfoList) {
|
|
||||||
if ("2".equals(backApplyInfo.getManageType())) {
|
|
||||||
List<MachinePart> machineParts = new ArrayList<>();
|
|
||||||
List<TmTask> typeIds = tmTaskMapper.getMaTypeDetailsByTypeId(backApplyInfo);
|
|
||||||
typeIds.removeIf(item -> item == null);
|
|
||||||
for (TmTask typeId : typeIds) {
|
|
||||||
MachinePart machinePart = tmTaskMapper.getMachineParts(typeId);
|
|
||||||
machinePart.setParentId(record.getId());
|
|
||||||
int countMachineByPidAndTid = tmTaskMapper.getCountMachineByPidAndTid(machinePart);
|
|
||||||
Double machinePartNum = typeId.getPartNum() * Double.parseDouble(backApplyInfo.getPreNum());
|
|
||||||
count1 += machinePartNum;
|
|
||||||
count2 += countMachineByPidAndTid;
|
|
||||||
machinePart.setPartNum(machinePartNum - countMachineByPidAndTid);
|
|
||||||
machineParts.add(machinePart);
|
|
||||||
}
|
}
|
||||||
backApplyInfo.setMaTypeDetails(machineParts);
|
|
||||||
if (count1 == count2) {
|
public List<BackApplyInfo> receiveView2(BackApplyInfo record) {
|
||||||
backApplyInfo.setPartNum(0);
|
List<BackApplyInfo> backApplyInfoList = backReceiveMapper.receiveView2(record);
|
||||||
} else {
|
|
||||||
backApplyInfo.setPartNum((int) Double.parseDouble(backApplyInfo.getPreNum()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
return backApplyInfoList;
|
return backApplyInfoList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -114,6 +95,10 @@ public class BackReceiveServiceImpl implements BackReceiveService {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int updateStatus(BackApplyInfo record) {
|
||||||
|
return backReceiveMapper.updateStatus(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);
|
||||||
|
|
@ -165,8 +150,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 {
|
|
||||||
int taskId = record.getTaskId();
|
int taskId = record.getTaskId();
|
||||||
//先判断是否已经完成退料了
|
//先判断是否已经完成退料了
|
||||||
int taskStatus = selectTaskStatus(taskId);
|
int taskStatus = selectTaskStatus(taskId);
|
||||||
|
|
@ -174,12 +158,23 @@ public class BackReceiveServiceImpl implements BackReceiveService {
|
||||||
throw new RuntimeException("该退料单已完成退料");
|
throw new RuntimeException("该退料单已完成退料");
|
||||||
}
|
}
|
||||||
//修改任务状态
|
//修改任务状态
|
||||||
res = updateTaskStatus(taskId, 40);
|
/* res = updateTaskStatus(taskId, 40);
|
||||||
if (res == 0) {
|
if (res == 0) {
|
||||||
throw new RuntimeException("tm_task修改状态");
|
throw new RuntimeException("tm_task修改状态");
|
||||||
|
}*/
|
||||||
|
record.setId(record.getParentId());
|
||||||
|
List<BackApplyInfo> list = receiveView2(record);
|
||||||
|
boolean allZeros = list.stream().allMatch(n -> Double.valueOf(n.getNum()).intValue() == 0);
|
||||||
|
if (allZeros) {
|
||||||
|
res = updateTaskStatus(taskId, 40);
|
||||||
}
|
}
|
||||||
//更加退料接收的数据创建下一步流程
|
//更加退料接收的数据创建下一步流程
|
||||||
//合格的插入入库记录input_apply_details,修改库存ma_type,修改机具状态
|
//合格的插入入库记录input_apply_details,修改库存ma_type,修改机具状态
|
||||||
|
if (StringUtils.isNotBlank(record.getTypeId())) {
|
||||||
|
for (String s : record.getTypeId().split(",")) {
|
||||||
|
record.setTypeId(s);
|
||||||
|
//修改back_apply_details为已退料(1)
|
||||||
|
res = updateStatus(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);
|
||||||
|
|
@ -187,14 +182,14 @@ public class BackReceiveServiceImpl implements BackReceiveService {
|
||||||
throw new RuntimeException("input_apply_details");
|
throw new RuntimeException("input_apply_details");
|
||||||
}
|
}
|
||||||
// 如果是成套的机具,成套机具的库存也要添加
|
// 如果是成套的机具,成套机具的库存也要添加
|
||||||
List<BackApplyInfo> ctList = backReceiveMapper.getCtList(record);
|
/* List<BackApplyInfo> ctList = backReceiveMapper.getCtList(record);
|
||||||
if (ctList.size() > 0) {
|
if (ctList.size() > 0) {
|
||||||
for (BackApplyInfo backApplyInfo : ctList) {
|
for (BackApplyInfo backApplyInfo : ctList) {
|
||||||
if ("2".equals(backApplyInfo.getManageType())) {
|
if ("2".equals(backApplyInfo.getManageType())) {
|
||||||
backReceiveMapper.updateMt(backApplyInfo);
|
backReceiveMapper.updateMt(backApplyInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
res = updateMt(hgList);
|
res = updateMt(hgList);
|
||||||
if (res == 0) {
|
if (res == 0) {
|
||||||
throw new RuntimeException("ma_type");
|
throw new RuntimeException("ma_type");
|
||||||
|
|
@ -226,7 +221,7 @@ public class BackReceiveServiceImpl implements BackReceiveService {
|
||||||
//插入维修记录表scrap_apply_details
|
//插入维修记录表scrap_apply_details
|
||||||
res = insertSad(newTaskId, bfList);
|
res = insertSad(newTaskId, bfList);
|
||||||
}
|
}
|
||||||
|
// 结算功能
|
||||||
List<BackApplyInfo> allList = backReceiveMapper.getAllList(record);
|
List<BackApplyInfo> allList = backReceiveMapper.getAllList(record);
|
||||||
if (allList != null && allList.size() > 0) {
|
if (allList != null && allList.size() > 0) {
|
||||||
res = updateSlt(record, allList);
|
res = updateSlt(record, allList);
|
||||||
|
|
@ -234,9 +229,10 @@ public class BackReceiveServiceImpl implements BackReceiveService {
|
||||||
throw new RuntimeException("该机具未被领料使用");
|
throw new RuntimeException("该机具未被领料使用");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// } catch (Exception e) {
|
}
|
||||||
// throw new RuntimeException(e.getMessage());
|
} else {
|
||||||
// }
|
throw new RuntimeException("typeId为空");
|
||||||
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -249,6 +245,11 @@ public class BackReceiveServiceImpl implements BackReceiveService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<BackApplyInfo> codeQuery(BackApplyInfo record) {
|
||||||
|
return backReceiveMapper.codeQuery(record);
|
||||||
|
}
|
||||||
|
|
||||||
private int updateSlt(BackApplyInfo record, List<BackApplyInfo> hgList) {
|
private int updateSlt(BackApplyInfo record, List<BackApplyInfo> hgList) {
|
||||||
for (BackApplyInfo bean : hgList) {
|
for (BackApplyInfo bean : hgList) {
|
||||||
List<SltAgreementInfo> infoList = backReceiveMapper.getStlInfo(bean);
|
List<SltAgreementInfo> infoList = backReceiveMapper.getStlInfo(bean);
|
||||||
|
|
@ -276,11 +277,6 @@ public class BackReceiveServiceImpl implements BackReceiveService {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<BackApplyInfo> codeQuery(BackApplyInfo record) {
|
|
||||||
return backReceiveMapper.codeQuery(record);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<BackApplyInfo> qrcodeQuery(BackApplyInfo record) {
|
public List<BackApplyInfo> qrcodeQuery(BackApplyInfo record) {
|
||||||
return backReceiveMapper.qrcodeQuery(record);
|
return backReceiveMapper.qrcodeQuery(record);
|
||||||
|
|
|
||||||
|
|
@ -614,6 +614,9 @@
|
||||||
status = '1'
|
status = '1'
|
||||||
where id = #{info.id}
|
where id = #{info.id}
|
||||||
</update>
|
</update>
|
||||||
|
<update id="updateStatus">
|
||||||
|
update back_apply_details set back_status = 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}
|
||||||
<if test="maId != null and maId != ''">
|
<if test="maId != null and maId != ''">
|
||||||
|
|
@ -658,7 +661,7 @@
|
||||||
LEFT JOIN sys_dic sd ON sd.id = tt.task_status
|
LEFT JOIN sys_dic sd ON sd.id = tt.task_status
|
||||||
LEFT JOIN tm_task tt1 on tt1.task_id = bai.parent_id
|
LEFT JOIN tm_task tt1 on tt1.task_id = bai.parent_id
|
||||||
WHERE
|
WHERE
|
||||||
tt.task_status IN ( 37, 38, 39, 40 )
|
tt.task_status IN ( 38, 39, 40 )
|
||||||
<if test="keyWord != null and keyWord != ''">
|
<if test="keyWord != null and keyWord != ''">
|
||||||
and bai.code like concat('%', #{keyWord}, '%')
|
and bai.code like concat('%', #{keyWord}, '%')
|
||||||
</if>
|
</if>
|
||||||
|
|
@ -708,6 +711,7 @@
|
||||||
mt2.type_name AS typeName,
|
mt2.type_name AS typeName,
|
||||||
bad.audit_num as preNum,
|
bad.audit_num as preNum,
|
||||||
bad.status as status,
|
bad.status as status,
|
||||||
|
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,
|
||||||
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`
|
||||||
|
|
@ -757,7 +761,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
|
||||||
bcd.parent_id=#{parentId}
|
bcd.parent_id=#{parentId} and bcd.type_id=#{typeId}
|
||||||
and bcd.back_status='1'
|
and bcd.back_status='1'
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
@ -777,7 +781,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
|
||||||
bcd.parent_id=#{parentId}
|
bcd.parent_id=#{parentId} and bcd.type_id=#{typeId}
|
||||||
and bcd.back_status='2'
|
and bcd.back_status='2'
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
@ -800,7 +804,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
|
||||||
bcd.parent_id=#{parentId}
|
bcd.parent_id=#{parentId} and bcd.type_id=#{typeId}
|
||||||
and bcd.back_status='3'
|
and bcd.back_status='3'
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
@ -932,7 +936,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
|
||||||
bcd.parent_id = #{parentId}
|
bcd.parent_id = #{parentId} and bcd.type_id=#{typeId}
|
||||||
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">
|
||||||
|
|
@ -1093,5 +1097,41 @@
|
||||||
AND mm.ma_code like concat('%', #{maCode}, '%')
|
AND mm.ma_code like concat('%', #{maCode}, '%')
|
||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
<select id="receiveView2" resultType="com.bonus.sgzb.app.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.audit_num as preNum,
|
||||||
|
bad.status as status,
|
||||||
|
bad.back_status as backStatus,
|
||||||
|
IFNULL(bad.audit_num,0)-IFNULL(aa.back_num,0) as num,
|
||||||
|
mt.manage_type as manageType,
|
||||||
|
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 (
|
||||||
|
SELECT
|
||||||
|
type_id as typeId,
|
||||||
|
SUM(IFNULL(back_num,0)) as back_num
|
||||||
|
FROM
|
||||||
|
back_check_details
|
||||||
|
WHERE
|
||||||
|
parent_id=#{id}
|
||||||
|
GROUP BY type_id
|
||||||
|
) aa on aa.typeId=bad.type_id
|
||||||
|
WHERE
|
||||||
|
bai.id=#{id}
|
||||||
|
order by bad.create_time
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
@ -60,12 +60,6 @@ public class BackApplyController extends BaseController {
|
||||||
return AjaxResult.success(ListPagingUtil.paging(pageIndex, pageSize, list));
|
return AjaxResult.success(ListPagingUtil.paging(pageIndex, pageSize, list));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* @ApiOperation(value = "退料申请获取当前类型在用量")
|
|
||||||
@GetMapping("/getUseNumByTypeId")
|
|
||||||
public AjaxResult getUseNumByTypeId(String typeId) {
|
|
||||||
return AjaxResult.success(backApplyService.getUseNumByTypeId(typeId));
|
|
||||||
}*/
|
|
||||||
|
|
||||||
@ApiOperation(value = "在用设备类型树")
|
@ApiOperation(value = "在用设备类型树")
|
||||||
@PostMapping("/getUseTypeTree")
|
@PostMapping("/getUseTypeTree")
|
||||||
public AjaxResult getUseTypeTree(@RequestBody BackApplyInfo bean) {
|
public AjaxResult getUseTypeTree(@RequestBody BackApplyInfo bean) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue