| | |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.mapper.Wrapper; |
| | | import com.core.common.BaseRes; |
| | | import com.core.common.Cools; |
| | | import com.core.common.DateUtils; |
| | | import com.core.common.SnowflakeIdWorker; |
| | | import com.core.common.*; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.entity.*; |
| | | import com.zy.asrs.entity.param.EmptyPlateOutParam; |
| | |
| | | wrkMast.setCrnNo(locMast.getCrnNo()); |
| | | wrkMast.setSourceStaNo(staDesc.getCrnStn() + ""); // 源站 |
| | | wrkMast.setStaNo(staDesc.getStnNo() + ""); // 目标站 |
| | | wrkMast.setOveMk(staDesc.getStnNo()==1076? "Y":"N"); |
| | | wrkMast.setSourceLocNo(dto.getLocNo()); // 源库位 |
| | | wrkMast.setFullPlt("Y"); // 满板:Y |
| | | wrkMast.setPicking("N"); // 拣料 |
| | |
| | | .eq("dev_no", basDevice.getType()).orderBy("order_no")); |
| | | |
| | | if (Objects.isNull(binds)) { |
| | | throw new CoolException("机台未设置默认工作位!!"); |
| | | log.error(deviceNo+"---"+basDevice.getType()+"--没有可用机台"); |
| | | return; |
| | | } |
| | | // |
| | | // Set<String> locs = binds.stream().map(LocAroundBind::getBlocNo).collect(Collectors.toSet()); |
| | |
| | | wrkMast.setExitMk("N"); // 退出 |
| | | wrkMast.setEmptyMk("Y"); // 空板 |
| | | wrkMast.setLinkMis("N"); |
| | | wrkMast.setOveMk("Y"); |
| | | wrkMast.setBarcode(locMast.getBarcode()); |
| | | wrkMast.setAppeUser(userId); |
| | | wrkMast.setAppeTime(now); |
| | | wrkMast.setModiUser(userId); |
| | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void backLocOperation(String workNo, Long userId) { |
| | | public R backLocOperation(String workNo, Long userId) { |
| | | WrkMast wrkMast = wrkMastService.selectById(workNo); |
| | | if (Cools.isEmpty(wrkMast)) { |
| | | throw new CoolException(workNo + "工作档不存在"); |
| | | return R.error(workNo+"工作档不存在"); |
| | | } |
| | | if (wrkMast.getWrkSts() != 15) { |
| | | throw new CoolException("当前任务状态不能执行此操作!"); |
| | | return R.error("当前任务状态不能执行此操作!"); |
| | | } |
| | | |
| | | Integer ioType = wrkMast.getIoType() - 50; |
| | |
| | | // ioType = 10; |
| | | // } |
| | | if (Objects.isNull(wrkMast.getIsSuplus())) { |
| | | throw new CoolException("回库类型不能为空!!"); |
| | | return R.error("回库类型不能为空!!"); |
| | | } |
| | | |
| | | if (wrkMast.getIsSuplus() == 0) { |
| | |
| | | .eq("crn_no", locMast1.getCrnNo()); // 堆垛机号 |
| | | StaDesc staDesc = staDescService.selectOne(wrapper); |
| | | if (Cools.isEmpty(staDesc)) { |
| | | throw new CoolException("入库路径不存在"); |
| | | return R.error("入库路径不存在"); |
| | | } |
| | | |
| | | int count = wrkMastService.selectCount(new EntityWrapper<WrkMast>().eq("barcode", wrkMast.getBarcode())); |
| | | if (count >= 2) { |
| | | throw new CoolException("任务档已生成,不可以重复生成相同的子任务!!"); |
| | | return R.error("任务档已生成,不可以重复生成相同的子任务!!"); |
| | | } |
| | | |
| | | WrkDetl detl = wrkDetlService.selectOne(new EntityWrapper<WrkDetl>().eq("wrk_no", wrkMast.getWrkNo())); |
| | |
| | | mast.setModiTime(now); |
| | | mast.setModiUser(userId); |
| | | if (!wrkMastService.insert(mast)) { |
| | | throw new CoolException("更新工作档数据状态失败"); |
| | | return R.error("更新工作档数据状态失败"); |
| | | } |
| | | List<WrkDetl> wrkDetls = wrkDetlService.selectList(new EntityWrapper<WrkDetl>().eq("wrk_no", wrkMast.getWrkNo())); |
| | | if (Cools.isEmpty(wrkDetls)) { |
| | | throw new CoolException("数据错误,任务档明细不存在 !!"); |
| | | return R.error("数据错误,任务档明细不存在 !!"); |
| | | } |
| | | |
| | | // 修改库位状态 Q.拣料/盘点/并板再入库 |
| | |
| | | inLoc.setModiTime(now); |
| | | inLoc.setModiUser(userId); |
| | | if (!locMastService.updateById(inLoc)) { |
| | | throw new CoolException("修改库位状态失败"); |
| | | return R.error("修改库位状态失败"); |
| | | } |
| | | |
| | | LocAroundBind aroundBind = locAroundBindService.selectOne(new EntityWrapper<LocAroundBind>().eq("b_loc_no", mast.getSourceLocNo())); |
| | | if (!Objects.isNull(aroundBind)) { |
| | | aroundBind.setLocType(LocStsType.LOC_STS_TYPE_R.type); |
| | | if (!locAroundBindService.updateById(aroundBind)) { |
| | | throw new CoolException("工位状态修改失败!!"); |
| | | return R.error("工位状态修改失败!!"); |
| | | } |
| | | } |
| | | |
| | |
| | | locMast.setModiTime(now); |
| | | locMast.setModiUser(userId); |
| | | if (!locMastService.updateById(locMast)) { |
| | | throw new CoolException("修改库位状态失败"); |
| | | return R.error("修改库位状态失败"); |
| | | } |
| | | |
| | | // wrkMast.setWrkCode(null); |
| | |
| | | // if (!wrkMastService.updateById(wrkMast)) { |
| | | // throw new CoolException("任务档更新失败!!"); |
| | | // } |
| | | if (Cools.isEmpty(mast)) { |
| | | return R.error("没有生成任务"); |
| | | } |
| | | return R.ok("生成回库任务成功!!"); |
| | | } |
| | | |
| | | |