|
|
|
|
@ -17,6 +17,10 @@ import org.springblade.core.mp.base.BaseServiceImpl; |
|
|
|
|
import org.springblade.core.secure.BladeUser; |
|
|
|
|
import org.springblade.core.secure.utils.AuthUtil; |
|
|
|
|
import org.springblade.core.tool.utils.Func; |
|
|
|
|
import org.springblade.desk.basic.pojo.entity.CenterTeam; |
|
|
|
|
import org.springblade.desk.basic.pojo.entity.WorkCenter; |
|
|
|
|
import org.springblade.desk.basic.service.ICenterTeamService; |
|
|
|
|
import org.springblade.desk.basic.service.IWorkCenterService; |
|
|
|
|
import org.springblade.desk.dashboard.pojo.entity.*; |
|
|
|
|
import org.springblade.desk.dashboard.service.*; |
|
|
|
|
import org.springblade.desk.device.pojo.entity.EquipmentEntity; |
|
|
|
|
@ -52,8 +56,11 @@ import org.springblade.desk.quality.service.IInspectionTaskService; |
|
|
|
|
import org.springblade.desk.quality.service.IReviewSheetService; |
|
|
|
|
import org.springblade.erpdata.feign.IErpDataProduceClient; |
|
|
|
|
import org.springblade.erpdata.pojo.vo.PpmReportDetailModelVO; |
|
|
|
|
import org.springblade.system.cache.DictCache; |
|
|
|
|
import org.springblade.system.feign.IUserClient; |
|
|
|
|
import org.springblade.system.pojo.entity.Dict; |
|
|
|
|
import org.springblade.system.pojo.entity.User; |
|
|
|
|
import org.springblade.system.pojo.enums.DictEnum; |
|
|
|
|
import org.springblade.wms.pojo.entity.StClassRequest; |
|
|
|
|
import org.springframework.beans.BeanUtils; |
|
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
@ -106,6 +113,10 @@ public class PdaSaveServiceImpl extends BaseServiceImpl<WorkPlanMapper, WorkPlan |
|
|
|
|
|
|
|
|
|
private final IInspectionTaskService inspectionTaskService; |
|
|
|
|
|
|
|
|
|
private final ICenterTeamService centerTeamService; |
|
|
|
|
|
|
|
|
|
private final IWorkCenterService workCenterService; |
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
private IErpDataProduceClient erpDataProduceClient; |
|
|
|
|
|
|
|
|
|
@ -467,6 +478,96 @@ public class PdaSaveServiceImpl extends BaseServiceImpl<WorkPlanMapper, WorkPlan |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
|
public boolean unBindEc() { |
|
|
|
|
// 查询所有未解绑的数据
|
|
|
|
|
List<MacToolUse> mtuList = macToolUseService.listByNoFinished(); |
|
|
|
|
if (mtuList == null || mtuList.isEmpty()) { |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 查询所有的配置项
|
|
|
|
|
List<Dict> configs = DictCache.getList(DictEnum.UNBIND_CONFIG.getName()); |
|
|
|
|
if (configs == null || configs.isEmpty()) { |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
Map<String, Integer> ucMap = new LinkedHashMap<>(); |
|
|
|
|
for (Dict uc : configs) { |
|
|
|
|
ucMap.put(uc.getDictKey(), Integer.valueOf(uc.getDictValue())); |
|
|
|
|
} |
|
|
|
|
List<MacToolUse> list = new ArrayList<>(); |
|
|
|
|
Date nowDate = new Date(); |
|
|
|
|
Double cycle = 0d; |
|
|
|
|
double num = 0d; |
|
|
|
|
|
|
|
|
|
for (MacToolUse mtu : mtuList) { |
|
|
|
|
WorkPlan workPlan = this.getById(mtu.getWpId()); |
|
|
|
|
if (workPlan == null) { |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
CenterTeam centerTeam = centerTeamService.getByTsId(workPlan.getMakeTeam()); |
|
|
|
|
if (centerTeam == null) { |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
WorkCenter workCenter = workCenterService.getById(centerTeam.getWcId()); |
|
|
|
|
if (workCenter == null) { |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
if (ucMap.get(workCenter.getWcName()) != null) { |
|
|
|
|
cycle = Double.valueOf(ucMap.get(workCenter.getWcName())); |
|
|
|
|
} else { |
|
|
|
|
cycle = 0d; |
|
|
|
|
} |
|
|
|
|
if (cycle <= 0) { |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
long difference = (nowDate.getTime() - mtu.getCreateTime().getTime()); |
|
|
|
|
num = (double) (difference / (60 * 60 * 1000)); |
|
|
|
|
//计算出时间差,以小时结尾
|
|
|
|
|
if (cycle <= num) { |
|
|
|
|
list.add(mtu); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (list.isEmpty()) { |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
//更改状态
|
|
|
|
|
RackSetEntity brs; |
|
|
|
|
FeiBaSetEntity bfs; |
|
|
|
|
EquipmentEntity dec; |
|
|
|
|
for (MacToolUse mtu : list) { |
|
|
|
|
mtu.setFinished(1); |
|
|
|
|
mtu.setUnBuildTime(new Date()); |
|
|
|
|
macToolUseService.updateById(mtu); |
|
|
|
|
//挂具解绑
|
|
|
|
|
if (mtu.getBsRackSet() != null) { |
|
|
|
|
brs = rackSetService.getById(mtu.getBsRackSet()); |
|
|
|
|
brs.setBindQty((short) 0); |
|
|
|
|
brs.setStatus(RackSetEntity.RS_STATUS_FREE); |
|
|
|
|
rackSetService.updateById(brs); |
|
|
|
|
} |
|
|
|
|
//飞靶解绑
|
|
|
|
|
if (mtu.getBsFeiBaSet() != null) { |
|
|
|
|
bfs = feiBaSetService.getById(mtu.getBsFeiBaSet()); |
|
|
|
|
bfs.setBindQty((short) 0); |
|
|
|
|
bfs.setStatus(FeiBaSetEntity.FS_STATUS_FREE); |
|
|
|
|
feiBaSetService.updateById(bfs); |
|
|
|
|
} |
|
|
|
|
//设备解绑
|
|
|
|
|
if (mtu.getEquipmentCard() != null) { |
|
|
|
|
dec = equipmentService.getById(mtu.getEquipmentCard()); |
|
|
|
|
dec.setBindQty(dec.getBindQty().subtract(BigDecimal.valueOf(1))); |
|
|
|
|
if (dec.getBindQty().compareTo(BigDecimal.valueOf(0)) <= 0) { |
|
|
|
|
dec.setBindQty(BigDecimal.valueOf(0)); |
|
|
|
|
dec.setStatus(0); |
|
|
|
|
} |
|
|
|
|
equipmentService.updateById(dec); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public List<MacToolUseVO> getUnbindByCard(String cardNo) { |
|
|
|
|
WorkOrder prWorkOrder = workOrderService.getWorkOrderByCardNo(cardNo); |
|
|
|
|
@ -837,23 +938,23 @@ public class PdaSaveServiceImpl extends BaseServiceImpl<WorkPlanMapper, WorkPlan |
|
|
|
|
* TODO: 2026/4/23 参考旧mes 接口 /webapi/saveSafetyInspection |
|
|
|
|
* { |
|
|
|
|
* // 根据编码去拿未检验的数据
|
|
|
|
|
* |
|
|
|
|
* <p> |
|
|
|
|
* List<SafePatrolInspection> spiList = safePatrolInspectionDao.getByCode(code); |
|
|
|
|
* |
|
|
|
|
* <p> |
|
|
|
|
* if (spiList == null || spiList.size() == 0) { |
|
|
|
|
* throw new BusinessException("根据编码未找到需要处理数据"); |
|
|
|
|
* } |
|
|
|
|
* |
|
|
|
|
* <p> |
|
|
|
|
* PfUserInfo userByLdapName = epDosingRecDao.getUserByLdapName(man); |
|
|
|
|
* |
|
|
|
|
* <p> |
|
|
|
|
* if (userByLdapName == null || userByLdapName.getUserId() == null) { |
|
|
|
|
* throw new BusinessException("根据域账号未找到对应的处理人"); |
|
|
|
|
* } |
|
|
|
|
* |
|
|
|
|
* <p> |
|
|
|
|
* Date date = new Date(); |
|
|
|
|
* for (SafePatrolInspection safePatrolInspection : spiList) { |
|
|
|
|
* // 如果在一个小时内将生成的任务处理掉那么算准时完成,在一个小时以后并且下个任务未生成之前处理 算未准时完成,如果在下个任务生成时还未处理算缺卡,并将任务改为缺卡,7点生成的任务除外特殊算(8点查询有任务改为缺卡)
|
|
|
|
|
* |
|
|
|
|
* <p> |
|
|
|
|
* // 不超过一个小时算正常检验
|
|
|
|
|
* if (new Date().getTime() - safePatrolInspection.getLaunchTime().getTime() <= 60 * 60 * 1000) { |
|
|
|
|
* safePatrolInspection.setTaskStatus(SafePatrolInspection.CHECKED); |
|
|
|
|
@ -882,7 +983,8 @@ public class PdaSaveServiceImpl extends BaseServiceImpl<WorkPlanMapper, WorkPlan |
|
|
|
|
* this.updateOldPatrol(safePatrolInspection.getIpId(), safePatrolInspection.getLaunchTime(), userByLdapName.getUserId()); |
|
|
|
|
* } |
|
|
|
|
* } |
|
|
|
|
* */ |
|
|
|
|
* |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
@Transactional |
|
|
|
|
public void saveSafetyInspection(String code, String memo, String pathStr) { |
|
|
|
|
@ -970,9 +1072,9 @@ public class PdaSaveServiceImpl extends BaseServiceImpl<WorkPlanMapper, WorkPlan |
|
|
|
|
@Override |
|
|
|
|
public void saveSubOrder(SaveSubOrderVo subOrder) { |
|
|
|
|
Long wpId = subOrder.getWpId(); |
|
|
|
|
Long shId = subOrder.getWpId(); |
|
|
|
|
Long cslId = subOrder.getWpId(); |
|
|
|
|
if (wpId == null || shId == null || cslId == null) { |
|
|
|
|
// Long shId = subOrder.getWpId();
|
|
|
|
|
// Long cslId = subOrder.getWpId();
|
|
|
|
|
if (wpId == null) { |
|
|
|
|
throw new ServiceException("参数异常!"); |
|
|
|
|
} |
|
|
|
|
WorkPlan wp = this.getById(wpId); |
|
|
|
|
@ -990,8 +1092,7 @@ public class PdaSaveServiceImpl extends BaseServiceImpl<WorkPlanMapper, WorkPlan |
|
|
|
|
WorkOrder wo = workOrderService.getById(wp.getWoId()); |
|
|
|
|
YieldOrder yo = yieldOrderService.getById(wo.getYoId()); |
|
|
|
|
//不是子件车间订单不允许从此处入库
|
|
|
|
|
if (yo.getFatherYoId() == null && (StringUtils.isBlank(yo.getMemo()) |
|
|
|
|
|| !yo.getMemo().contains("WO-"))) { |
|
|
|
|
if (yo.getFatherYoId() == null && (StringUtils.isBlank(yo.getMemo()) || !yo.getMemo().contains("WO-"))) { |
|
|
|
|
throw new ServiceException("不是子件车间订单,不允许在此入库!"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|