| | |
| | | import request from '@/utils/request'; |
| | | |
| | | const DictionarySelect = (props) => { |
| | | const { |
| | | dictTypeCode, |
| | | name, |
| | | const { |
| | | dictTypeCode, |
| | | name, |
| | | group, |
| | | multiple = false, |
| | | multiple = false, |
| | | perPage = 100, // 默认每页显示100条数据 |
| | | page = 1, // 默认第一页 |
| | | ...parmas |
| | | ...parmas |
| | | } = props; |
| | | const translate = useTranslate(); |
| | | const notify = useNotify(); |
| | | const { watch } = useFormContext(); |
| | | const [list, setList] = useState([]); |
| | | const [loading, setLoading] = useState(false); |
| | | |
| | | |
| | | // 获取当前表单值 |
| | | const currentValue = watch(name); |
| | | |
| | |
| | | const http = async () => { |
| | | setLoading(true); |
| | | try { |
| | | const res = await request.post('/dictData/page', { |
| | | const res = await request.post('/dictData/page', { |
| | | dictTypeCode, |
| | | group, |
| | | current: page, |
| | | pageSize: perPage |
| | | }); |
| | | |
| | | |
| | | if (res?.data?.code === 200) { |
| | | setList(res.data.data.records.map((item) => { |
| | | return { |
| | |
| | | if (!list || list.length === 0) { |
| | | // 如果列表为空但当前有值,添加占位选项以避免警告 |
| | | if (currentValue !== undefined && currentValue !== null && currentValue !== '') { |
| | | if (multiple && Array.isArray(currentValue)) { |
| | | return currentValue.map(v => ({ id: v, name: String(v) })); |
| | | } |
| | | return [{ id: currentValue, name: String(currentValue) }]; |
| | | } |
| | | return []; |
| | | } |
| | | |
| | | // 检查当前值是否在选项中 |
| | | const valueExists = list.some(item => String(item.id) === String(currentValue)); |
| | | |
| | | // 如果当前值不在选项中,添加它(可能是加载延迟导致的) |
| | | if (currentValue !== undefined && currentValue !== null && currentValue !== '' && !valueExists) { |
| | | return [...list, { id: currentValue, name: String(currentValue) }]; |
| | | |
| | | if (currentValue !== undefined && currentValue !== null && currentValue !== '') { |
| | | if (multiple && Array.isArray(currentValue)) { |
| | | let newChoices = [...list]; |
| | | currentValue.forEach(val => { |
| | | const exists = newChoices.some(item => String(item.id) === String(val)); |
| | | if (!exists) { |
| | | newChoices.push({ id: val, name: String(val) }); |
| | | } |
| | | }); |
| | | return newChoices; |
| | | } else { |
| | | // 检查当前值是否在选项中 |
| | | const valueExists = list.some(item => String(item.id) === String(currentValue)); |
| | | |
| | | // 如果当前值不在选项中,添加它(可能是加载延迟导致的) |
| | | if (!valueExists) { |
| | | return [...list, { id: currentValue, name: String(currentValue) }]; |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | return list; |
| | | }, [list, currentValue]); |
| | | }, [list, currentValue, multiple]); |
| | | |
| | | const InputComponent = multiple ? SelectArrayInput : SelectInput; |
| | | |
| | |
| | | actions={( |
| | | <TopToolbar> |
| | | <FilterButton /> |
| | | <CreateByOrderButton setCreateDialog={setCreateDialog} /> |
| | | <MyCreateButton onClick={() => { setManualDialog(true); setmodalType(0) }} /> |
| | | <ColumnsButton storeKey='outStock' /> |
| | | <ImportButton value={'outStockItem'} /> |
| | |
| | | |
| | | BasStation isBarcodeSta = basStationService.getOne(new LambdaQueryWrapper<BasStation>() |
| | | .eq(BasStation::getBarcode, barcode) |
| | | , false |
| | | .last("limit 1") |
| | | ); |
| | | if (!Cools.isEmpty(isBarcodeSta)) { |
| | | throw new CoolException("该条码已被" + isBarcodeSta.getStationName() + "站绑定"); |
| | |
| | | if (checkDiff.getExceStatus().equals(CheckDiffExceStatus.CHECK_DIFF_EXCE_STATUS_END.val)) { |
| | | return R.error("该盘点单已完成"); |
| | | } |
| | | Task task = taskService.getOne(new LambdaQueryWrapper<Task>().eq(Task::getBarcode, params.getContainer())); |
| | | Task task = taskService.getOne(new LambdaQueryWrapper<Task>().eq(Task::getBarcode, params.getContainer()).last("limit 1")); |
| | | if (null == task) { |
| | | throw new CoolException("数据错误,未找到容器码对应盘点任务"); |
| | | } |
| | |
| | | .setBarcode(task.getBarcode()) |
| | | .setAnfme(ckDiffItem.getCheckQty()); |
| | | |
| | | Matnr matnr = matnrService.getOne(new LambdaQueryWrapper<Matnr>().eq(Matnr::getCode, diffItem.getMatnrCode())); |
| | | Matnr matnr = matnrService.getOne(new LambdaQueryWrapper<Matnr>().eq(Matnr::getCode, diffItem.getMatnrCode()).last("limit 1")); |
| | | if (Objects.isNull(matnr)) { |
| | | throw new CoolException("单据物料名称不存在!!"); |
| | | } |
| | |
| | | if (Cools.isEmpty(matnrCode)){ |
| | | return R.error("物料码为空"); |
| | | } |
| | | Matnr matnr = matnrService.getOne(new LambdaQueryWrapper<Matnr>().eq(Matnr::getCode, matnrCode)); |
| | | Matnr matnr = matnrService.getOne(new LambdaQueryWrapper<Matnr>().eq(Matnr::getCode, matnrCode).last("limit 1")); |
| | | if (null == matnr){ |
| | | return R.error("未找到编码对应的明细"); |
| | | } |
| | |
| | | public R getCheckTaskItemList2(String barcode) { |
| | | LambdaQueryWrapper<Task> lambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | lambdaQueryWrapper.eq(Task::getBarcode, barcode); |
| | | Task task = taskService.getOne(lambdaQueryWrapper); |
| | | Task task = taskService.getOne(lambdaQueryWrapper.last("limit 1")); |
| | | if (null == task) { |
| | | throw new CoolException("未找到容器号对应任务"); |
| | | } |
| | |
| | | throw new CoolException("未找到该容器码对应的任务明细"); |
| | | } |
| | | String sourceCode = taskItems.stream().findFirst().map(TaskItem::getSourceCode).orElse(null); |
| | | CheckDiff checkDiff = checkDiffService.getOne(new LambdaQueryWrapper<CheckDiff>().eq(CheckDiff::getOrderCode,sourceCode)); |
| | | CheckDiff checkDiff = checkDiffService.getOne(new LambdaQueryWrapper<CheckDiff>().eq(CheckDiff::getOrderCode,sourceCode).last("limit 1")); |
| | | if (null == checkDiff) { |
| | | return R.error("未找到盘点差异单"); |
| | | } |
| | |
| | | public R getOutStockTaskItem(String barcode) { |
| | | LambdaQueryWrapper<Task> lambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | lambdaQueryWrapper.eq(Task::getBarcode, barcode); |
| | | Task task = taskService.getOne(lambdaQueryWrapper); |
| | | Task task = taskService.getOne(lambdaQueryWrapper.last("limit 1")); |
| | | if (null == task) { |
| | | return R.error("未查询到相关任务"); |
| | | } |
| | |
| | | public R saveOutTaskSts(String barcode) { |
| | | LambdaQueryWrapper<Task> lambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | lambdaQueryWrapper.eq(Task::getBarcode, barcode); |
| | | Task task = taskService.getOne(lambdaQueryWrapper); |
| | | Task task = taskService.getOne(lambdaQueryWrapper.last("limit 1")); |
| | | if (null == task) { |
| | | throw new CoolException("未找到容器号对应任务"); |
| | | } |
| | |
| | | if (Cools.isEmpty(barcode)) { |
| | | throw new CoolException("参数有误"); |
| | | } |
| | | Task task = taskService.getOne(new LambdaQueryWrapper<Task>().eq(Task::getBarcode, barcode)); |
| | | Task task = taskService.getOne(new LambdaQueryWrapper<Task>().eq(Task::getBarcode, barcode).last("limit 1")); |
| | | if (null == task) { |
| | | throw new CoolException("未找到容器号对应任务"); |
| | | } |
| | |
| | | if (null == containerWaveParam || containerWaveParam.getContainerWaveDtos().size() <= 0) { |
| | | return R.error("参数错误"); |
| | | } |
| | | Task task = taskService.getOne(new LambdaQueryWrapper<Task>().eq(Task::getBarcode, containerWaveParam.getContainer())); |
| | | Task task = taskService.getOne(new LambdaQueryWrapper<Task>().eq(Task::getBarcode, containerWaveParam.getContainer()).last("limit 1")); |
| | | if (null == task) { |
| | | return R.error("未找到托盘对应的任务"); |
| | | } |
| | |
| | | BasStation basStation = basStationService.getOne(new LambdaQueryWrapper<BasStation>() |
| | | .eq(BasStation::getStationName, containerWaveParam.getStaNo()) |
| | | .orderByDesc(BasStation::getId) |
| | | .last("LIMIT 1"), false); |
| | | .last("LIMIT 1")); |
| | | |
| | | if (Objects.isNull(basStation)) { |
| | | throw new CoolException(containerWaveParam.getStaNo() + "站点不存在!!"); |
| | |
| | | } |
| | | |
| | | BasContainer basContainer = basContainerService.getOne(new LambdaQueryWrapper<BasContainer>() |
| | | .in(BasContainer::getContainerType, containerWaveParam.getType(), false)); |
| | | .in(BasContainer::getContainerType, containerWaveParam.getType(), false).last("limit 1")); |
| | | if (Cools.isEmpty(basContainer)){ |
| | | throw new CoolException("未查询到相关容器规则"); |
| | | } |
| | |
| | | BeanUtils.copyProperties(matnr, mat); |
| | | mat.setCode(matnr.getMatnr()).setName(matnr.getMaktx()); |
| | | if (!Objects.isNull(matnr.getGroupName())) { |
| | | MatnrGroup matnrGroup = matnrGroupService.getOne(new LambdaQueryWrapper<MatnrGroup>().eq(MatnrGroup::getName, matnr.getGroupName()), false); |
| | | MatnrGroup matnrGroup = matnrGroupService.getOne(new LambdaQueryWrapper<MatnrGroup>().eq(MatnrGroup::getName, matnr.getGroupName()).last("limit 1"), false); |
| | | if (Objects.isNull(matnrGroup)) { |
| | | mat.setGroupCode(matnrGroup.getCode()).setGroupId(matnrGroup.getId()); |
| | | } |
| | |
| | | @Override |
| | | public R queryOrderStatus(QueryOrderParam queryParams) { |
| | | WkOrder wkOrders = asnOrderService.getOne(new LambdaQueryWrapper<WkOrder>() |
| | | .eq(WkOrder::getPoCode, queryParams.getOrderNo())); |
| | | .eq(WkOrder::getPoCode, queryParams.getOrderNo()).last("limit 1")); |
| | | if (Objects.isNull(wkOrders)) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("exceStatus", "-1"); |
| | | return R.ok("单据不存在 !!").add(map); |
| | | } |
| | | |
| | | AsnOrderLog orderLog = asnOrderLogService.getOne(new LambdaQueryWrapper<AsnOrderLog>().eq(AsnOrderLog::getCode, queryParams.getOrderNo())); |
| | | AsnOrderLog orderLog = asnOrderLogService.getOne(new LambdaQueryWrapper<AsnOrderLog>().eq(AsnOrderLog::getCode, queryParams.getOrderNo()).last("limit 1")); |
| | | if (!Objects.isNull(orderLog)) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("exceStatus", "4"); |
| | |
| | | if (Objects.isNull(companys.getCode())) { |
| | | throw new CoolException("企业编码不能为空!!"); |
| | | } |
| | | Companys one = companysService.getOne(new LambdaQueryWrapper<Companys>().eq(Companys::getName, param.getName())); |
| | | Companys one = companysService.getOne(new LambdaQueryWrapper<Companys>().eq(Companys::getName, param.getName()).last("limit 1")); |
| | | if (Objects.isNull(one)) { |
| | | String ruleCode = SerialRuleUtils.generateRuleCode(SerialRuleCode.SYS_COMPANYS_CODE, null); |
| | | companys.setCode(ruleCode); |
| | |
| | | } |
| | | String shallowLocNo = LocUtils.getShallowLoc(loc1.getCode()); |
| | | // 检测目标库位是否为空库位 |
| | | Loc shallowLoc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getCode, shallowLocNo)); |
| | | Loc shallowLoc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getCode, shallowLocNo).last("limit 1")); |
| | | if (shallowLoc != null && shallowLoc.getUseStatus().equals(LocStsType.LOC_STS_TYPE_O.type)) { |
| | | if (LocUtils.locMoveCheckLocTypeComplete(shallowLoc, locTypeDto)) { |
| | | loc = shallowLoc; |
| | |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:outStock:update')") |
| | | @OperationLog("Update ;出库单据") |
| | | @OperationLog("Update 出库单据") |
| | | @PostMapping("/preparation/update") |
| | | @ApiOperation("更新") |
| | | public R update(@RequestBody WkOrder wkOrder) { |
| | |
| | | private WaveService waveService; |
| | | @Autowired |
| | | private BasStationService basStationService; |
| | | @Autowired |
| | | private LocItemWorkingService locItemWorkingService; |
| | | |
| | | |
| | | /** |
| | |
| | | //空容器出库 |
| | | DeviceSite deviceSite = deviceSiteService.getOne(new LambdaQueryWrapper<DeviceSite>() |
| | | .eq(!Objects.isNull(loc.getChannel()), DeviceSite::getChannel, loc.getChannel()) |
| | | .eq(DeviceSite::getSite, siteNo).eq(DeviceSite::getType, TaskType.TASK_TYPE_EMPTY_OUT.type)); |
| | | .eq(DeviceSite::getSite, siteNo).eq(DeviceSite::getType, TaskType.TASK_TYPE_EMPTY_OUT.type).last("limit 1")); |
| | | if (Objects.isNull(deviceSite)) { |
| | | throw new CoolException("站点不支持空容器出库!!"); |
| | | } |
| | |
| | | DeviceSite deviceSite = deviceSiteService.getOne(new LambdaQueryWrapper<DeviceSite>() |
| | | .eq(DeviceSite::getSite, siteNo) |
| | | .eq(!Objects.isNull(loc.getChannel()),DeviceSite::getChannel, loc.getChannel()) |
| | | .eq(DeviceSite::getType, TaskType.TASK_TYPE_PICK_AGAIN_OUT.type)); |
| | | .eq(DeviceSite::getType, TaskType.TASK_TYPE_PICK_AGAIN_OUT.type).last("limit 1"),false); |
| | | if (Objects.isNull(deviceSite)) { |
| | | throw new CoolException("站点不支持拣料出库!!"); |
| | | } |
| | |
| | | if (resouce.equals(TaskResouceType.TASK_RESOUCE_STOCK_UP.val)){ |
| | | //全板出库 |
| | | DeviceSite deviceSite = deviceSiteService.getOne(new LambdaQueryWrapper<DeviceSite>() |
| | | .eq(DeviceSite::getSite, siteNo).eq(DeviceSite::getType, TaskType.TASK_TYPE_CROSS_DOCKING_OUT.type)); |
| | | // .eq(!Objects.isNull(loc.getChannel()), DeviceSite::getChannel, loc.getChannel()) |
| | | .eq(DeviceSite::getSite, siteNo).eq(DeviceSite::getType, TaskType.TASK_TYPE_CROSS_DOCKING_OUT.type) |
| | | .eq(!Objects.isNull(loc.getChannel()), DeviceSite::getChannel, loc.getChannel()).last("limit 1")); |
| | | if (Objects.isNull(deviceSite)) { |
| | | throw new CoolException("站点不支持越库!!"); |
| | | } |
| | |
| | | } else { |
| | | //全板出库 |
| | | DeviceSite deviceSite = deviceSiteService.getOne(new LambdaQueryWrapper<DeviceSite>() |
| | | .eq(DeviceSite::getSite, siteNo).eq(DeviceSite::getType, TaskType.TASK_TYPE_OUT.type)); |
| | | // .eq(!Objects.isNull(loc.getChannel()), DeviceSite::getChannel, loc.getChannel()) |
| | | .eq(DeviceSite::getSite, siteNo).eq(DeviceSite::getType, TaskType.TASK_TYPE_OUT.type) |
| | | .eq(!Objects.isNull(loc.getChannel()), DeviceSite::getChannel, loc.getChannel()).last("limit 1")); |
| | | if (Objects.isNull(deviceSite)) { |
| | | throw new CoolException("站点不支持全板出库!!"); |
| | | } |
| | |
| | | DeviceSite deviceSite = deviceSiteService.getOne(new LambdaQueryWrapper<DeviceSite>() |
| | | .eq(!Objects.isNull(loc.getChannel()), DeviceSite::getChannel, loc.getChannel()) |
| | | .eq(DeviceSite::getSite, siteNo) |
| | | .eq(DeviceSite::getType, TaskType.TASK_TYPE_CHECK_OUT.type)); |
| | | .eq(DeviceSite::getType, TaskType.TASK_TYPE_CHECK_OUT.type).last("limit 1")); |
| | | if (Objects.isNull(deviceSite)) { |
| | | throw new CoolException("当前站点不支持盘点出库!!"); |
| | | } |
| | |
| | | throw new CoolException("主任务关联失败!!"); |
| | | } |
| | | } |
| | | locItemWorkingService.remove(new LambdaQueryWrapper<LocItemWorking>().eq(LocItemWorking::getTaskId, task.getId())); |
| | | |
| | | List<TaskItem> taskItems = new ArrayList<>(); |
| | | listMap.get(key).forEach(item -> { |
| | |
| | | if (!locItemService.updateById(item)) { |
| | | throw new CoolException("库存信息修改失败!!"); |
| | | } |
| | | |
| | | if (taskItem.getAnfme() > 0) { |
| | | LocItemWorking itemWorking = new LocItemWorking(); |
| | | BeanUtils.copyProperties(taskItem, itemWorking); |
| | | itemWorking.setTaskId(task.getId()) |
| | | .setQty(0.0) |
| | | .setLocId(loc.getId()) |
| | | .setLocItemId(locItem.getId()) |
| | | .setType("out") |
| | | .setLocCode(loc.getCode()); |
| | | |
| | | if (!locItemWorkingService.save(itemWorking)) { |
| | | throw new CoolException("临时库存更新失败!!"); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | if (!taskItemService.saveBatch(taskItems)) { |
| | |
| | | //目标库位为空,自动获取新库位 |
| | | DeviceSite deviceSite = deviceSiteService.getOne(new LambdaQueryWrapper<DeviceSite>() |
| | | .eq(DeviceSite::getType, TaskType.TASK_TYPE_LOC_MOVE.type) |
| | | .eq(!Objects.isNull(orgLoc.getChannel()), DeviceSite::getChannel, orgLoc.getChannel()), false); |
| | | .eq(!Objects.isNull(orgLoc.getChannel()), DeviceSite::getChannel, orgLoc.getChannel()).last("limit 1"), false); |
| | | if (Objects.isNull(deviceSite)) { |
| | | throw new CoolException("站点信息不存在!!"); |
| | | } |
| | |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Task pickOrCheckTask(Long id, String oType) throws Exception { |
| | | public synchronized Task pickOrCheckTask(Long id, String oType) throws Exception { |
| | | Task task = this.getById(id); |
| | | if (Objects.isNull(task)) { |
| | | throw new CoolException("当前任务不存在!!"); |
| | |
| | | .setIoType(type) |
| | | .setLocType1(Integer.parseInt(loc.getType())); |
| | | //获取新库位 |
| | | InTaskMsgDto locInfo = wcsService.getLocNo(param); |
| | | InTaskMsgDto locInfo = null; |
| | | try{ |
| | | locInfo = wcsService.getLocNo(param); |
| | | } catch (Exception e) { |
| | | throw new CoolException("获取库位失败!!"+e.getMessage()); |
| | | } |
| | | |
| | | if (Objects.isNull(locInfo)) { |
| | | throw new CoolException("获取库位失败!!"); |