|
|
|
@ -1,14 +1,21 @@
|
|
|
|
|
package org.hy.modules.process.service.impl; |
|
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
|
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|
|
|
|
import org.hy.common.api.vo.Result; |
|
|
|
|
import org.hy.common.system.vo.SysDepartVo; |
|
|
|
|
import org.hy.modules.process.dto.ProcessMaterialsDeliveryListDTO; |
|
|
|
|
import org.hy.modules.process.entity.ProcessSmaterialsScrap; |
|
|
|
|
import org.hy.modules.process.entity.ProcessSmaterialsScrapList; |
|
|
|
|
import org.hy.modules.process.mapper.ProcessMaterialsDeliveryListMapper; |
|
|
|
|
import org.hy.modules.process.mapper.ProcessSmaterialsScrapListMapper; |
|
|
|
|
import org.hy.modules.process.mapper.ProcessSmaterialsScrapMapper; |
|
|
|
|
import org.hy.modules.process.service.IProcessMaterialsDeliveryListService; |
|
|
|
|
import org.hy.modules.process.service.IProcessMaterialsDeliveryService; |
|
|
|
|
import org.hy.modules.process.service.IProcessSmaterialsScrapListService; |
|
|
|
|
import org.hy.modules.process.service.IProcessSmaterialsScrapService; |
|
|
|
|
import org.hy.modules.wastematerials.entity.ProcessWasteMaterials; |
|
|
|
|
import org.hy.modules.wastematerials.service.IProcessWasteMaterialsService; |
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
@ -32,16 +39,22 @@ public class ProcessSmaterialsScrapServiceImpl extends ServiceImpl<ProcessSmater
|
|
|
|
|
@Autowired |
|
|
|
|
private ProcessSmaterialsScrapListMapper processSmaterialsScrapListMapper; |
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
private IProcessWasteMaterialsService processWasteMaterialsService; |
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
private IProcessSmaterialsScrapListService processSmaterialsScrapListService; |
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
IProcessMaterialsDeliveryService processMaterialsDeliveryService; |
|
|
|
|
@Autowired |
|
|
|
|
ProcessMaterialsDeliveryListMapper processMaterialsDeliveryListMapper; |
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
IProcessMaterialsDeliveryListService processMaterialsDeliveryListService; |
|
|
|
|
|
|
|
|
|
List<ProcessSmaterialsScrapList> processSmaterialsScrapLists; |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
@Transactional |
|
|
|
|
public boolean saveMain(ProcessSmaterialsScrap processSmaterialsScrap, List<ProcessSmaterialsScrapList> processSmaterialsScrapListList) { |
|
|
|
@ -135,4 +148,49 @@ public class ProcessSmaterialsScrapServiceImpl extends ServiceImpl<ProcessSmater
|
|
|
|
|
return processSmaterialsScrapMapper.queryPlanById(id); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public Result<?> getByIdOwn(ProcessWasteMaterials processWasteMateria) { |
|
|
|
|
//查询报废数据
|
|
|
|
|
ProcessSmaterialsScrap processSmaterialsScrap = baseMapper.queryPlanById(processWasteMateria.getProcessId()); |
|
|
|
|
//查询部门信息
|
|
|
|
|
SysDepartVo sysDepartVo = processMaterialsDeliveryListMapper.queryPageDepare(processSmaterialsScrap.getDepartId()); |
|
|
|
|
switch (sysDepartVo.getOrgType()){ |
|
|
|
|
case "1": |
|
|
|
|
|
|
|
|
|
return Result.OK(null); |
|
|
|
|
case "2": |
|
|
|
|
//项目部
|
|
|
|
|
ProcessWasteMaterials processWasteMaterials = processWasteMaterialsService.getById(processWasteMateria.getId()); |
|
|
|
|
if(processWasteMaterials==null) { |
|
|
|
|
return Result.error("未找到对应数据"); |
|
|
|
|
} |
|
|
|
|
return Result.OK(processWasteMaterials); |
|
|
|
|
case "3": |
|
|
|
|
//小队
|
|
|
|
|
ProcessMaterialsDeliveryListDTO p = new ProcessMaterialsDeliveryListDTO(); |
|
|
|
|
p.setEquipment(processWasteMateria.getMaterialNumber()); |
|
|
|
|
p.setDepartId(processSmaterialsScrap.getDepartId()); |
|
|
|
|
Integer equipment = processMaterialsDeliveryListMapper.getEquipment(p);//全部数量
|
|
|
|
|
ProcessSmaterialsScrapList scrapList = new ProcessSmaterialsScrapList(); |
|
|
|
|
scrapList.setEquipment(processWasteMateria.getMaterialNumber()); |
|
|
|
|
scrapList.setCreateBy(processSmaterialsScrap.getDepartId()); |
|
|
|
|
Integer equipment1 = processSmaterialsScrapListMapper.getEquipment(scrapList); // 报废数量
|
|
|
|
|
ProcessWasteMaterials processWaste = processWasteMaterialsService.getById(processWasteMateria.getId()); |
|
|
|
|
if(processWaste==null) { |
|
|
|
|
return Result.error("未找到对应数据"); |
|
|
|
|
} |
|
|
|
|
if(ObjectUtils.isNotNull(equipment)){ |
|
|
|
|
if(ObjectUtils.isNotNull(equipment1)){ |
|
|
|
|
processWaste.setMaterialQuantity(equipment-equipment1); |
|
|
|
|
}else{ |
|
|
|
|
processWaste.setMaterialQuantity(equipment); |
|
|
|
|
} |
|
|
|
|
}else{ |
|
|
|
|
processWaste.setMaterialQuantity(0); |
|
|
|
|
} |
|
|
|
|
return Result.OK(processWaste); |
|
|
|
|
} |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|