| | |
| | | import cn.hutool.core.lang.Assert; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | import com.kangaroohy.milo.model.ReadWriteEntity; |
| | | import com.kangaroohy.milo.service.MiloService; |
| | |
| | | import com.mes.hollow.entity.HollowBigStorageCageDetails; |
| | | import com.mes.hollow.entity.HollowGlassOutRelationInfo; |
| | | import com.mes.hollow.entity.HollowGlassRelationInfo; |
| | | import com.mes.hollow.entity.dto.*; |
| | | import com.mes.hollow.entity.dto.BigStorageSequenceDTO; |
| | | import com.mes.hollow.entity.dto.FlowCardVirtualSlotDTO; |
| | | import com.mes.hollow.entity.dto.HollowBigStorageDTO; |
| | | import com.mes.hollow.entity.dto.UpdateHollowBigStorageCageDTO; |
| | | import com.mes.hollow.service.HollowBigStorageCageDetailsService; |
| | | import com.mes.hollow.service.HollowBigStorageCageService; |
| | | import com.mes.hollow.service.HollowGlassOutRelationInfoService; |
| | |
| | | noDealOutTask(v); |
| | | } |
| | | }); |
| | | |
| | | for (BigStorageCageTask item : outTaskList) { |
| | | //更新历史任务表中的任务状态 |
| | | hollowBigStorageCageHistoryTaskService.update(new LambdaUpdateWrapper<HollowBigStorageCageHistoryTask>() |
| | |
| | | // 空执行 |
| | | } |
| | | } |
| | | //更新数量 |
| | | try { |
| | | //更新数量 |
| | | //按照玻璃id获取需要出片对列表中的数据 |
| | | if(finalTaskType.equals(Const.BIG_STORAGE_AFTER_OUT) ){ |
| | | HollowGlassQueueInfo hollowGlassQueueInfo = hollowGlassQueueInfoService.getOne(new LambdaQueryWrapper<HollowGlassQueueInfo>() |
| | | .eq(HollowGlassQueueInfo::getGlassId, outTaskList.get(0).getGlassId()) |
| | | .orderByDesc(HollowGlassQueueInfo::getUpdateTime).last("limit 1")); |
| | | List<HollowGlassQueueInfo> list = hollowGlassQueueInfoService.list(new LambdaQueryWrapper<HollowGlassQueueInfo>() |
| | | .eq(HollowGlassQueueInfo::getFlowCardId, hollowGlassQueueInfo.getFlowCardId()) |
| | | .eq(HollowGlassQueueInfo::getCell, hollowGlassQueueInfo.getCell()) |
| | | .eq(HollowGlassQueueInfo::getIsPair, 1) |
| | | .eq(HollowGlassQueueInfo::getState, Const.TEMPERING_NEW) |
| | | ); |
| | | if (CollectionUtil.isEmpty(list)){ |
| | | // 任务更新为已完成 |
| | | hollowGlassOutRelationInfoService.update(new UpdateWrapper<HollowGlassOutRelationInfo>() |
| | | .eq("flow_card_id",hollowGlassQueueInfo.getFlowCardId()) |
| | | .eq("cell",hollowGlassQueueInfo.getCell()) |
| | | .setSql("pair_quantity = total_pair_quantity") |
| | | .set("state",Const.HOLLOW_FLOW_CARD_SUCCESS) |
| | | ); |
| | | }else{ |
| | | // 计算剩余玻璃对数,用任务总队数减剩余对数 |
| | | int remainCount = list.size() / hollowGlassQueueInfo.getTotalLayer(); |
| | | hollowGlassOutRelationInfoService.update(new UpdateWrapper<HollowGlassOutRelationInfo>() |
| | | .eq("flow_card_id",hollowGlassQueueInfo.getFlowCardId()) |
| | | .eq("cell",hollowGlassQueueInfo.getCell()) |
| | | .setSql("pair_quantity = total_pair_quantity -"+remainCount) |
| | | ); |
| | | } |
| | | } |
| | | }catch (Exception e){ |
| | | log.info("计算玻璃数量过程中出现错误,错误信息{}",e.getMessage()); |
| | | } |
| | | |
| | | // hollowGlassOutRelationInfoService.update |
| | | // 重置任务表数据 |
| | | bigStorageCageTaskService.updateOutTaskMessage(BIG_STORAGE_CAGE_OUT_TWO_TASK); |
| | |
| | | |
| | | private <T extends HollowBigStorageCageBaseInfo> Boolean hollowOutGlassByIsPair(List<T> list, int targetSlot, int isPair, int totalLayer,int isForce) { |
| | | List<T> resultList = new ArrayList<>(); |
| | | List<T> tempList = new ArrayList<>(); |
| | | int taskType = Const.BIG_STORAGE_AFTER_OUT; |
| | | int taskState = Const.GLASS_STATE_OUT_ING; |
| | | for (T t : list) { |
| | | if (isPair == (t.getIsPair() == null ? 0 : t.getIsPair())) { |
| | | resultList.add(t); |
| | | tempList.add(t); |
| | | }else{ |
| | | break; |
| | | } |
| | | } |
| | | if (isPair == 0 && isForce!=1) { |
| | | taskType = Const.BIG_STORAGE_AFTER_DISPATCH; |
| | | taskState = Const.GLASS_STATE_SCHEDULE_ING; |
| | | resultList.add(list.get(0)); |
| | | //目前调度任务totalLayer为0 出片调度任务有层号,用于区分调度方式 |
| | | if (totalLayer !=0){ |
| | | HollowBigStorageCage storageCage = hollowBigStorageCageService.getOne(new LambdaQueryWrapper<HollowBigStorageCage>() |
| | | .eq(HollowBigStorageCage::getEnableState, Const.SLOT_ON).eq(HollowBigStorageCage::getRemainWidth, slotWidth).last("limit 1")); |
| | | targetSlot = storageCage.getSlot(); |
| | | } |
| | | totalLayer = 0; |
| | | }else{ |
| | | resultList = tempList; |
| | | } |
| | | return computeOutGlassInfo(resultList, BIG_STORAGE_CAGE_OUT_TWO_TASK, targetSlot, taskState, taskType, totalLayer,isForce); |
| | | } |