退料修改
This commit is contained in:
parent
c6b7c6ab2d
commit
86ad36e74d
|
|
@ -16,10 +16,7 @@ import com.bonus.material.archives.service.ArchivesService;
|
|||
import com.bonus.material.back.domain.BackApplyDetails;
|
||||
import com.bonus.material.back.domain.HandlingOrder;
|
||||
import com.bonus.material.back.domain.MaCode;
|
||||
import com.bonus.material.back.domain.vo.BackAppRequestVo;
|
||||
import com.bonus.material.back.domain.vo.BackApplyInfoVo;
|
||||
import com.bonus.material.back.domain.vo.BackApplyRequestVo;
|
||||
import com.bonus.material.back.domain.vo.BackApplyVo;
|
||||
import com.bonus.material.back.domain.vo.*;
|
||||
import com.bonus.material.common.annotation.PreventRepeatSubmit;
|
||||
import com.bonus.system.api.RemoteFileService;
|
||||
import io.swagger.annotations.Api;
|
||||
|
|
@ -207,6 +204,20 @@ public class BackApplyInfoController extends BaseController {
|
|||
return backApplyInfoService.selectMachineById(dto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据typeId查询领料机具列表
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "根据typeId查询领料机具列表")
|
||||
@GetMapping("/selectMachineByIdList")
|
||||
public AjaxResult selectMachineByIdList(BackApplyInfo dto){
|
||||
Integer pageIndex = Convert.toInt(ServletUtils.getParameter("pageNum"), 1);
|
||||
Integer pageSize = Convert.toInt(ServletUtils.getParameter("pageSize"), 10);
|
||||
List<MaCodeVo> list = backApplyInfoService.selectMachineByIdList(dto);
|
||||
return AjaxResult.success(ListPagingUtil.paging(pageIndex, pageSize, list));
|
||||
}
|
||||
|
||||
/**
|
||||
* app根据设备编码去检索领料详情
|
||||
* @param dto
|
||||
|
|
|
|||
|
|
@ -129,4 +129,5 @@ public class BackApplyDetails extends BaseEntity {
|
|||
@ApiModelProperty(value = "一级类型id")
|
||||
private Long firstId;
|
||||
|
||||
List<MaCodeDto> maVos;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,10 +7,7 @@ import com.bonus.material.back.domain.BackApplyDetails;
|
|||
import com.bonus.material.back.domain.BackApplyInfo;
|
||||
import com.bonus.material.back.domain.HandlingOrder;
|
||||
import com.bonus.material.back.domain.MaCode;
|
||||
import com.bonus.material.back.domain.vo.BackAppRequestVo;
|
||||
import com.bonus.material.back.domain.vo.BackApplyInfoVo;
|
||||
import com.bonus.material.back.domain.vo.BackApplyRequestVo;
|
||||
import com.bonus.material.back.domain.vo.BackApplyVo;
|
||||
import com.bonus.material.back.domain.vo.*;
|
||||
|
||||
/**
|
||||
* 退料任务Service接口
|
||||
|
|
@ -160,6 +157,8 @@ public interface IBackApplyInfoService {
|
|||
*/
|
||||
AjaxResult selectMachineById(BackApplyInfo dto);
|
||||
|
||||
List<MaCodeVo> selectMachineByIdList(BackApplyInfo dto);
|
||||
|
||||
/**
|
||||
* APP删除退料任务
|
||||
* @param id
|
||||
|
|
|
|||
|
|
@ -1200,7 +1200,7 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService {
|
|||
BackApplyDetails details = dto.getBackApplyDetails();
|
||||
details.setCode(dto.getBackApplyInfo().getCode());
|
||||
details.setParentId(dto.getBackApplyInfo().getId());
|
||||
details.setPreNum(BigDecimal.valueOf(1));
|
||||
details.setPreNum(BigDecimal.valueOf(dto.getBackApplyDetails().getMaVos().size()));
|
||||
details.setAuditNum(details.getPreNum());
|
||||
details.setNum(BigDecimal.valueOf(num));
|
||||
details.setGoodNum(details.getGoodNum());
|
||||
|
|
@ -1221,25 +1221,42 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService {
|
|||
setCommonFields(details, dto.getBackApplyInfo().getId());
|
||||
// 插入 CheckDetails
|
||||
//根据id查询back_check_details表,看数据是否存在,存在则对数量进行更新,不存在则插入
|
||||
BackApplyDetails checkDetails = backApplyInfoMapper.selectCheckDetails(details);
|
||||
if (checkDetails != null) {
|
||||
checkDetails.setId(checkDetails.getId());
|
||||
result += backApplyInfoMapper.updateCheck(checkDetails);
|
||||
} else {
|
||||
result += backApplyInfoMapper.insertCheckDetails(details);
|
||||
for(MaCodeDto maCodeDto : details.getMaVos()){
|
||||
BackApplyDetails backInfo = new BackApplyDetails();
|
||||
backInfo = details;
|
||||
backInfo.setMaId(maCodeDto.getMaId());
|
||||
backInfo.setMaCode(maCodeDto.getMaCode());
|
||||
BackApplyDetails checkDetails = backApplyInfoMapper.selectCheckDetails(details);
|
||||
if (checkDetails != null) {
|
||||
checkDetails.setId(checkDetails.getId());
|
||||
result += backApplyInfoMapper.updateCheck(checkDetails);
|
||||
} else {
|
||||
result += backApplyInfoMapper.insertCheckDetails(details);
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(details.getBmFileInfos())) {
|
||||
for (BmFileInfo bmFileInfo : details.getBmFileInfos()) {
|
||||
bmFileInfo.setCreateBy(SecurityUtils.getLoginUser().getSysUser().getNickName());
|
||||
bmFileInfo.setCreateTime(DateUtils.getNowDate());
|
||||
bmFileInfo.setTaskId(details.getId());
|
||||
bmFileInfo.setTaskType(3);
|
||||
bmFileInfo.setModelId(backInfo.getMaId());
|
||||
result += bmFileInfoMapper.insertBmFileInfo(bmFileInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
//更新ma_machine表状态为3(退料检修)
|
||||
// result += machineMapper.updateStatus(details.getMaId(), MaMachineStatusEnum.BACK_REPAIR.getStatus());
|
||||
if (CollectionUtils.isNotEmpty(details.getBmFileInfos())) {
|
||||
for (BmFileInfo bmFileInfo : details.getBmFileInfos()) {
|
||||
bmFileInfo.setCreateBy(SecurityUtils.getLoginUser().getSysUser().getNickName());
|
||||
bmFileInfo.setCreateTime(DateUtils.getNowDate());
|
||||
bmFileInfo.setTaskId(details.getId());
|
||||
bmFileInfo.setTaskType(3);
|
||||
bmFileInfo.setModelId(details.getMaId());
|
||||
result += bmFileInfoMapper.insertBmFileInfo(bmFileInfo);
|
||||
}
|
||||
}
|
||||
// if (CollectionUtils.isNotEmpty(details.getBmFileInfos())) {
|
||||
// for (BmFileInfo bmFileInfo : details.getBmFileInfos()) {
|
||||
// bmFileInfo.setCreateBy(SecurityUtils.getLoginUser().getSysUser().getNickName());
|
||||
// bmFileInfo.setCreateTime(DateUtils.getNowDate());
|
||||
// bmFileInfo.setTaskId(details.getId());
|
||||
// bmFileInfo.setTaskType(3);
|
||||
// bmFileInfo.setModelId(details.getMaId());
|
||||
// result += bmFileInfoMapper.insertBmFileInfo(bmFileInfo);
|
||||
// }
|
||||
// }
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
@ -1354,10 +1371,18 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService {
|
|||
}
|
||||
//判断输入或者编码识别或者二维码识别是否为领料工程和单位对应
|
||||
List<MaCodeVo> list = new ArrayList<>();
|
||||
dto.setUserId(SecurityUtils.getLoginUser().getUserid());
|
||||
if (dto.getMaCode() != null) {
|
||||
list = backApplyInfoMapper.getMachine(dto);
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
return AjaxResult.error("该编码非您负责的设备,请重新选择");
|
||||
}
|
||||
} else if (dto.getQrCode() != null) {
|
||||
|
||||
list = backApplyInfoMapper.getMachineByQrCode(dto);
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
return AjaxResult.error("该编码非您负责的设备,请重新选择");
|
||||
}
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
for (MaCodeVo maCodeVo : list) {
|
||||
|
|
@ -1632,6 +1657,24 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService {
|
|||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MaCodeVo> selectMachineByIdList(BackApplyInfo dto) {
|
||||
List<MaCodeVo> list = backApplyInfoMapper.getMachineById(dto);
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
// 根据id查询该单据可能存在的设备编码
|
||||
List<MaCodeVo> maCodeVos = backApplyInfoMapper.selectByCode(dto.getId());
|
||||
if (CollectionUtils.isNotEmpty(maCodeVos)) {
|
||||
// 获取maCodeVos中的编码
|
||||
List<String> maCodes = maCodeVos.stream().map(MaCodeVo::getMaCode).collect(Collectors.toList());
|
||||
// 将maCodes中存在于list集合中的编码,把数据从list集合中去除
|
||||
list = list.stream().
|
||||
filter(info -> !maCodes.contains(info.getMaCode())).
|
||||
collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* APP删除退料任务
|
||||
* @param id
|
||||
|
|
|
|||
|
|
@ -139,6 +139,12 @@ public class SelectController {
|
|||
return service.getDeviceTypeTree(dto);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "退料设备类型树")
|
||||
@PostMapping("getBackDeviceTypeTree")
|
||||
public AjaxResult getBackDeviceTypeTree(@RequestBody SelectDto dto){
|
||||
return service.getBackDeviceTypeTree(dto);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "资产属性")
|
||||
@PostMapping("getAssetAttributesCbx")
|
||||
public AjaxResult getAssetAttributesCbx(@RequestBody SelectDto dto){
|
||||
|
|
|
|||
|
|
@ -61,6 +61,8 @@ public interface SelectMapper {
|
|||
*/
|
||||
List<TreeNode> getDeviceTypeTree(SelectDto dto);
|
||||
|
||||
List<TreeNode> getBackDeviceTypeTree(SelectDto dto);
|
||||
|
||||
/**
|
||||
* 资产属性
|
||||
* @param dto
|
||||
|
|
@ -126,6 +128,8 @@ public interface SelectMapper {
|
|||
*/
|
||||
List<TypeTreeNode> getUseTypeTreeL4(BackApplyInfo bean);
|
||||
|
||||
List<TypeTreeNode> getUseTypeTreeL4Back(SelectDto bean);
|
||||
|
||||
/**
|
||||
* 在用设备类型树3级
|
||||
* @param list
|
||||
|
|
@ -133,6 +137,7 @@ public interface SelectMapper {
|
|||
*/
|
||||
List<TypeTreeNode> getUseTypeTreeL3(List<Long> list);
|
||||
|
||||
|
||||
/**
|
||||
* 在用设备类型树2级
|
||||
* @param list
|
||||
|
|
|
|||
|
|
@ -103,6 +103,8 @@ public interface SelectService {
|
|||
*/
|
||||
AjaxResult getDeviceTypeTree(SelectDto dto);
|
||||
|
||||
AjaxResult getBackDeviceTypeTree(SelectDto dto);
|
||||
|
||||
/**
|
||||
* 资产属性
|
||||
* @param dto
|
||||
|
|
|
|||
|
|
@ -343,6 +343,68 @@ public class SelectServiceImpl implements SelectService {
|
|||
return AjaxResult.success(groupList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult getBackDeviceTypeTree(SelectDto dto) {
|
||||
List<TypeTreeNode> groupList = new ArrayList<>();
|
||||
List<TypeTreeNode> list = new ArrayList<>();
|
||||
List<TypeTreeNode> listL4 = new ArrayList<>();
|
||||
List<TypeTreeNode> listL3 = new ArrayList<>();
|
||||
List<TypeTreeNode> listL21 = new ArrayList<>();
|
||||
try {
|
||||
// 先查第四层类型
|
||||
listL4 = mapper.getUseTypeTreeL4Back(dto);
|
||||
if (CollectionUtils.isNotEmpty(listL4)) {
|
||||
List<Long> list4ParentIds = listL4.stream().map(o -> o.getParentId()).collect(Collectors.toList());
|
||||
// 根据第四层parentId 查第三层类型
|
||||
listL3 = mapper.getUseTypeTreeL3(list4ParentIds);
|
||||
List<Long> list3ParentIds = listL3.stream().map(o -> o.getParentId()).collect(Collectors.toList());
|
||||
// 根据第三层parentId 查第1.2层类型
|
||||
listL21 = mapper.getUseTypeTreeL21(list3ParentIds);
|
||||
list.addAll(listL4);
|
||||
list.addAll(listL3);
|
||||
list.addAll(listL21);
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
// 创建树形结构(数据集合作为参数)
|
||||
TypeTreeBuild treeBuild = new TypeTreeBuild(list);
|
||||
// 原查询结果转换树形结构
|
||||
groupList = treeBuild.buildTree();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
AjaxResult.error("类型树-查询失败", e);
|
||||
}
|
||||
return AjaxResult.success(groupList);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// List<TreeNode> groupList = new ArrayList<>();
|
||||
// List<TreeNode> list = new ArrayList<>();
|
||||
// try {
|
||||
// list = mapper.getBackDeviceTypeTree(dto);
|
||||
// if (CollectionUtils.isNotEmpty(list)) {
|
||||
// // 创建树形结构(数据集合作为参数)
|
||||
// TreeBuild treeBuild = new TreeBuild(list);
|
||||
// // 原查询结果转换树形结构
|
||||
// groupList = treeBuild.buildTree();
|
||||
// }
|
||||
// } catch (Exception e) {
|
||||
// log.error("单位树/归属部门/所属上级-查询失败", e);
|
||||
// }
|
||||
// return AjaxResult.success(groupList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult getAssetAttributesCbx(SelectDto dto) {
|
||||
List<SelectVo> list = new ArrayList<>();
|
||||
|
|
|
|||
|
|
@ -141,6 +141,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="typeId != null">
|
||||
and mm.type_id = #{typeId}
|
||||
</if>
|
||||
<if test="keyWord != null and keyWord != ''">
|
||||
and (
|
||||
mm.ma_code like concat('%', #{keyWord}, '%')
|
||||
)
|
||||
</if>
|
||||
GROUP BY mm.ma_code
|
||||
</select>
|
||||
|
||||
|
|
@ -337,6 +342,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
ba.agreement_id AS agreementId
|
||||
FROM slt_agreement_info sai
|
||||
LEFT JOIN ma_machine mm ON sai.ma_id = mm.ma_id
|
||||
LEFT JOIN ma_type_repair mtr ON mm.type_id = mtr.type_id
|
||||
LEFT JOIN ma_type mt ON mm.type_id = mt.type_id
|
||||
AND mt.del_flag = '0'
|
||||
LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id
|
||||
|
|
@ -350,6 +356,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
LEFT JOIN bm_unit bu on bu.unit_id = ba.unit_id
|
||||
AND bu.del_flag = '0'
|
||||
WHERE sai.`status`=0 and mm.ma_status = '2'
|
||||
and mtr.user_id = #{userId}
|
||||
and mm.ma_code = #{maCode}
|
||||
AND ba.unit_id = #{unitId}
|
||||
AND ba.project_id = #{proId}
|
||||
|
|
@ -428,6 +435,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
FROM
|
||||
slt_agreement_info sai
|
||||
LEFT JOIN ma_machine mm ON sai.ma_id = mm.ma_id
|
||||
LEFT JOIN ma_type_repair mtr ON mm.type_id = mtr.type_id
|
||||
LEFT JOIN ma_type mt ON mm.type_id = mt.type_id
|
||||
AND mt.del_flag = '0'
|
||||
LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id
|
||||
|
|
@ -442,6 +450,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
AND bu.del_flag = '0'
|
||||
WHERE
|
||||
sai.`status`=0 and mm.qr_code = #{qrCode}
|
||||
and mtr.user_id = #{userId}
|
||||
<if test="agreementId != null">
|
||||
AND ba.unit_id = #{unitId}
|
||||
</if>
|
||||
|
|
|
|||
|
|
@ -585,4 +585,57 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
FROM clz_bm_agreement_info
|
||||
WHERE unit_id = #{unitId} AND project_id = #{projectId} AND status = '1'
|
||||
</select>
|
||||
<select id="getBackDeviceTypeTree" resultType="com.bonus.common.biz.domain.TreeNode">
|
||||
SELECT mt.type_id AS id,
|
||||
mt.type_name AS label,
|
||||
CASE WHEN mt.level = '3' THEN '0' ELSE mt.parent_id END AS parentId,
|
||||
mt.unit_name AS unitName,
|
||||
mt.model_code AS modelCode,
|
||||
mt.manage_type AS manageType
|
||||
FROM ma_type mt
|
||||
INNER join (SELECT
|
||||
mm.type_id AS type_id,
|
||||
mt2.type_name AS typeName,
|
||||
mt.type_name AS typeModelName
|
||||
FROM
|
||||
slt_agreement_info sai
|
||||
LEFT JOIN ma_machine mm ON sai.ma_id = mm.ma_id
|
||||
LEFT JOIN ma_type mt ON mm.type_id = mt.type_id
|
||||
AND mt.del_flag = '0'
|
||||
LEFT JOIN ma_type mt2 ON mt.parent_id = mt2.type_id
|
||||
AND mt2.del_flag = '0'
|
||||
LEFT JOIN bm_agreement_info ba ON sai.agreement_id = ba.agreement_id
|
||||
WHERE
|
||||
mm.ma_status = '2'
|
||||
AND ba.unit_id = #{unitId}
|
||||
AND ba.project_id = #{proId}
|
||||
GROUP BY mm.type_id) AS subquery0 ON subquery0.type_id = mt.type_id
|
||||
WHERE mt.del_flag = '0'
|
||||
|
||||
AND mt.level IN ('3','4')
|
||||
|
||||
|
||||
</select>
|
||||
<select id="getUseTypeTreeL4Back" resultType="com.bonus.common.biz.domain.TypeTreeNode">
|
||||
SELECT
|
||||
mt.type_id AS typeId,
|
||||
mt1.type_name as materialName,
|
||||
mt.type_name as typeName,
|
||||
mt.parent_id as parentId,
|
||||
mt.LEVEL as level
|
||||
|
||||
FROM
|
||||
slt_agreement_info sai
|
||||
LEFT JOIN ma_machine mm ON sai.ma_id = mm.ma_id
|
||||
LEFT JOIN ma_type mt ON mm.type_id = mt.type_id
|
||||
AND mt.del_flag = '0'
|
||||
LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id
|
||||
AND mt1.del_flag = '0'
|
||||
LEFT JOIN bm_agreement_info ba ON sai.agreement_id = ba.agreement_id
|
||||
WHERE
|
||||
mm.ma_status = '2'
|
||||
AND ba.unit_id = #{unitId}
|
||||
AND ba.project_id = #{proId}
|
||||
GROUP BY mm.type_id
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
Loading…
Reference in New Issue