Merge branch 'devlop' of http://47.97.1.152:5880/r/wms-master into devlop
# Conflicts:
# rsf-server/src/main/java/com/vincent/rsf/server/api/service/impl/WcsServiceImpl.java
| | |
| | | stationName: 'stationName', |
| | | inAble: 'inAble', |
| | | outAble: 'outAble', |
| | | type: 'Site Type', |
| | | useStatus: 'useStatus', |
| | | status: 'status', |
| | | area: 'area', |
| | |
| | | }, |
| | | basStation: { |
| | | stationName: '站点名称', |
| | | type: '站点类型', |
| | | inAble: '能入', |
| | | outAble: '能出', |
| | | useStatus: '状态', |
| | |
| | | ReferenceInput, |
| | | ReferenceArrayInput, |
| | | AutocompleteInput, |
| | | DeleteButton, |
| | | |
| | | DeleteButton, |
| | | |
| | | } from 'react-admin'; |
| | | import { Box, Typography, Card, Stack } from '@mui/material'; |
| | | import { styled } from '@mui/material/styles'; |
| | |
| | | |
| | | const filters = [ |
| | | <SearchInput source="condition" alwaysOn />, |
| | | <DateInput label='common.time.after' source="timeStart" />, |
| | | <DateInput label='common.time.before' source="timeEnd" />, |
| | | <DateInput label='common.time.after' source="timeStart" />, |
| | | <DateInput label='common.time.before' source="timeEnd" />, |
| | | |
| | | <TextInput source="stationName" label="table.field.basStation.stationName" alwaysOn/>, |
| | | <TextInput source="stationName" label="table.field.basStation.stationName" alwaysOn />, |
| | | <NumberInput source="inAble" label="table.field.basStation.inAble" />, |
| | | <NumberInput source="outAble" label="table.field.basStation.outAble" />, |
| | | <TextInput source="useStatus" label="table.field.basStation.useStatus" />, |
| | |
| | | <StyledDatagrid |
| | | preferenceKey='basStation' |
| | | bulkActionButtons={() => <BulkDeleteButton mutationMode={OPERATE_MODE} />} |
| | | rowClick={(id, resource, record) => false} |
| | | rowClick={(id, resource, record) => false} |
| | | expandSingle={true} |
| | | omit={['id', 'createTime', 'createBy', 'memo','updateBy','autoTransfer']} |
| | | omit={['id', 'createTime', 'createBy', 'memo', 'updateBy', 'autoTransfer']} |
| | | > |
| | | <NumberField source="id" /> |
| | | <TextField source="type$" label="table.field.basStation.type" /> |
| | | <TextField source="stationName" label="table.field.basStation.stationName" /> |
| | | <TextField source="useStatus$" label="table.field.basStation.useStatus" /> |
| | | <TextField source="barcode" label="table.field.basStation.barcode" /> |
| | | <TextField source="barcode" label="table.field.basStation.barcode" /> |
| | | <FunctionField |
| | | source="inAble" |
| | | label="table.field.basStation.inAble" |
| | | render={record => record.inAble === 1 ? '是' : '否'} |
| | | /> |
| | | /> |
| | | <FunctionField |
| | | source="outAble" |
| | | label="table.field.basStation.outAble" |
| | | render={record => record.inAble === 1 ? '是' : '否'} |
| | | /> |
| | | |
| | | <NumberField source="area$" label="table.field.basStation.area" /> |
| | | <NumberField source="area$" label="table.field.basStation.area" /> |
| | | <FunctionField |
| | | source="isCrossZone" |
| | | label="table.field.basStation.isCrossZone" |
| | |
| | | <WrapperField cellClassName="crossZoneArea" label="table.field.basStation.crossZoneArea"> |
| | | <CrossZoneAreaField |
| | | open={areaFieldDialog} |
| | | setOpen={setAreaFieldDialog} |
| | | /> |
| | | </WrapperField> |
| | | setOpen={setAreaFieldDialog} |
| | | /> |
| | | </WrapperField> |
| | | <FunctionField |
| | | source="isWcs" |
| | | label="table.field.basStation.isWcs" |
| | | render={record => record.inAble === 1 ? '是' : '否'} |
| | | /> |
| | | |
| | | /> |
| | | <WrapperField cellClassName="containerType" label="table.field.basStation.containerType"> |
| | | <ContainerTypesField |
| | | open={areaFieldDialog2} |
| | | setOpen={setAreaFieldDialog2} |
| | | /> |
| | | setOpen={setAreaFieldDialog2} |
| | | /> |
| | | </WrapperField> |
| | | <FunctionField |
| | | source="autoTransfer" |
| | | label="table.field.basStation.autoTransfer" |
| | | render={record => record.inAble === 1 ? '是' : '否'} |
| | | /> |
| | | <ReferenceField source="updateBy" label="common.field.updateBy" reference="user" link={false} sortable={false}> |
| | | <TextField source="nickname" /> |
| | | </ReferenceField> |
| | | <TextField source="updateBy$" label="common.field.updateBy" /> |
| | | <DateField source="updateTime" label="common.field.updateTime" showTime /> |
| | | <ReferenceField source="createBy" label="common.field.createBy" reference="user" link={false} sortable={false}> |
| | | <TextField source="nickname" /> |
| | | </ReferenceField> |
| | | <DateField source="createTime" label="common.field.createTime" showTime /> |
| | | <TextField source="createBy$" label="common.field.createBy" /> |
| | | <DateField source="createTime" label="common.field.createTime" showTime /> |
| | | <BooleanField source="statusBool" label="common.field.status" sortable={false} /> |
| | | <TextField source="memo" label="common.field.memo" sortable={false} /> |
| | | <WrapperField cellClassName="opt" label="common.field.opt"> |
| | | <WrapperField cellClassName="opt" label="common.field.opt"> |
| | | <EditButton sx={{ padding: '1px', fontSize: '.75rem' }} /> |
| | | <DeleteButton sx={{ padding: '1px', fontSize: '.75rem' }} mutationMode={OPERATE_MODE} /> |
| | | </WrapperField> |
| | | </WrapperField> |
| | | </StyledDatagrid> |
| | | |
| | | |
| | | </List> |
| | | <BasStationCreate |
| | | open={createDialog} |
| | | setOpen={setCreateDialog} |
| | | /> |
| | | |
| | | |
| | | <PageDrawer |
| | | title='BasStation Detail' |
| | | drawerVal={drawerVal} |
| | |
| | | rowClick={(id, resource, record) => false} |
| | | expand={false} |
| | | expandSingle={false} |
| | | omit={['id', 'createTime', 'matnrId', 'waveId', 'batch', 'orderItemId', 'fieldsIndex', 'createBy', 'memo']} |
| | | omit={['id', 'createTime', 'matnrId', 'waveId', 'batch', 'orderItemId', 'fieldsIndex', 'createBy']} |
| | | > |
| | | <NumberField source="id" /> |
| | | <NumberField source="waveId" label="table.field.waveItem.waveId" /> |
| | |
| | | <DateField source="updateTime" label="common.field.updateTime" showTime /> |
| | | <TextField source="createBy$" label="common.field.createBy" /> |
| | | <DateField source="createTime" label="common.field.createTime" showTime /> |
| | | <TextField source="memo" label="common.field.memo" sortable={false} /> |
| | | <TextField source="exceStatus$" label="table.field.waveItem.exceStatus" /> |
| | | <TextField source="memo" label="common.field.memo" sortable={false} /> |
| | | </StyledDatagrid> |
| | | </List> |
| | | <WaveItemEdit |
| | |
| | | rowClick={(id, resource, record) => false} |
| | | expand={<WavePannel />} |
| | | expandSingle={true} |
| | | omit={['id', 'createTime', 'createBy', 'createBy$','memo']} |
| | | omit={['id', 'createTime', 'createBy', 'createBy$', 'memo']} |
| | | > |
| | | <NumberField source="id" /> |
| | | <TextField source="code" label="table.field.wave.code" /> |
| | |
| | | <DateField source="updateTime" label="common.field.updateTime" showTime /> |
| | | <TextField source="createBy$" label="common.field.createBy" /> |
| | | <CustomProcess source="progress" label="table.field.wave.progress" /> |
| | | <TextField source="memo" label="common.field.memo" sortable={false} /> |
| | | <TextField source="exceStatus$" label="table.field.wave.exceStatus" sortable={false} /> |
| | | <TextField source="memo" label="common.field.memo" sortable={false} /> |
| | | <WrapperField cellClassName="opt" label="common.field.opt"> |
| | | <PauseButton /> |
| | | <ContinueButton /> |
New file |
| | |
| | | package com.vincent.rsf.server.api.entity.enums; |
| | | |
| | | /** |
| | | * @author Ryan |
| | | * @date 2025/9/4 |
| | | * @description: 回调事件 |
| | | * @version 1.0 |
| | | */ |
| | | public enum CallBackEvent { |
| | | /**任务回调事件*/ |
| | | CALL_BACK_EVENT_START("START", "取箱完成"), |
| | | CALL_BACK_EVENT_OBIT("OTBIN", "搬运中"), |
| | | CALL_BACK_EVENT_END("END", "放箱完成"), |
| | | ; |
| | | |
| | | CallBackEvent( String event, String desc) { |
| | | this.event = event; |
| | | this.desc = desc; |
| | | } |
| | | |
| | | public String event; |
| | | |
| | | public String desc; |
| | | } |
| | |
| | | import com.vincent.rsf.server.api.entity.dto.LocTypeDto; |
| | | import com.vincent.rsf.server.api.controller.erp.params.TaskInParam; |
| | | import com.vincent.rsf.server.api.entity.dto.SyncLocsDto; |
| | | import com.vincent.rsf.server.api.entity.enums.CallBackEvent; |
| | | import com.vincent.rsf.server.api.entity.params.CommonRequest; |
| | | import com.vincent.rsf.server.api.entity.params.ExMsgParams; |
| | | import com.vincent.rsf.server.api.entity.params.WcsTaskParams; |
| | |
| | | if (Objects.isNull(params)) { |
| | | return R.error("参数不能为空!!"); |
| | | } |
| | | |
| | | Task task = taskService.getOne(new LambdaQueryWrapper<Task>().eq(Task::getTaskCode, params.getSeqNum())); |
| | | if (Objects.isNull(task)) { |
| | | throw new CoolException("任务不存在可已结束!!"); |
| | | } |
| | | |
| | | if (params.getEventType().equals("END")) { |
| | | /**料箱搬运中, 修改站点状态*/ |
| | | if (params.getEventType().equals(CallBackEvent.CALL_BACK_EVENT_OBIT.event)) { |
| | | if (task.getTaskType().equals(TaskType.TASK_TYPE_IN.type) |
| | | || task.getTaskType().equals(TaskType.TASK_TYPE_PICK_IN.type) |
| | | || task.getTaskType().equals(TaskType.TASK_TYPE_CHECK_IN.type) |
| | | || task.getTaskType().equals(TaskType.TASK_TYPE_EMPITY_IN.type) |
| | | || task.getTaskType().equals(TaskType.TASK_TYPE_MERGE_IN.type) |
| | | || task.getTaskType().equals(TaskType.TASK_TYPE_LOC_MOVE.type)) { |
| | | if (!task.getTaskType().equals(TaskType.TASK_TYPE_LOC_MOVE.type)) { |
| | | BasStation station = basStationService.getOne(new LambdaQueryWrapper<BasStation>().eq(BasStation::getStationName, task.getOrgSite())); |
| | | if (Objects.isNull(station)) { |
| | | throw new CoolException("数据错误,站点不存在!!"); |
| | | } |
| | | if (station.getType().equals(StationTypeEnum.STATION_TYPE_NORMAL.type)) { |
| | | station.setUseStatus(LocStsType.LOC_STS_TYPE_O.type); |
| | | if (!basStationService.updateById(station)) { |
| | | throw new CoolException("站点状态修改失败!!"); |
| | | } |
| | | } |
| | | } |
| | | } else if (task.getTaskType().equals(TaskType.TASK_TYPE_OUT.type) |
| | | || task.getTaskType().equals(TaskType.TASK_TYPE_PICK_AGAIN_OUT.type) |
| | | || task.getTaskType().equals(TaskType.TASK_TYPE_MERGE_OUT.type) |
| | | || task.getTaskType().equals(TaskType.TASK_TYPE_CHECK_OUT.type) |
| | | || task.getTaskType().equals(TaskType.TASK_TYPE_EMPITY_OUT.type)) { |
| | | /**修改出库站点状态*/ |
| | | BasStation station = basStationService.getOne(new LambdaQueryWrapper<BasStation>() |
| | | .eq(BasStation::getStationName, task.getTargSite())); |
| | | if (Objects.isNull(station)) { |
| | | throw new CoolException("数据错误,站点不存在!!"); |
| | | } |
| | | if (station.getType().equals(StationTypeEnum.STATION_TYPE_NORMAL.type)) { |
| | | station.setUseStatus(LocStsType.LOC_STS_TYPE_F.type); |
| | | if (!basStationService.updateById(station)) { |
| | | throw new CoolException("站点状态修改失败!!"); |
| | | } |
| | | } |
| | | } |
| | | /**取箱完成, 修改任务状态*/ |
| | | } else if (params.getEventType().equals(CallBackEvent.CALL_BACK_EVENT_END.event)) { |
| | | if (task.getTaskType().equals(TaskType.TASK_TYPE_IN.type) |
| | | || task.getTaskType().equals(TaskType.TASK_TYPE_PICK_IN.type) |
| | | || task.getTaskType().equals(TaskType.TASK_TYPE_CHECK_IN.type) |
| | |
| | | .eq(Task::getTaskCode, task.getTaskCode()) |
| | | .set(Task::getTaskStatus, TaskStsType.COMPLETE_IN.id))) { |
| | | throw new CoolException("任务状态修改失败!!"); |
| | | } |
| | | |
| | | if (!Objects.isNull(task.getOrgSite())) { |
| | | if (!basStationService.update(new LambdaUpdateWrapper<BasStation>() |
| | | .eq(BasStation::getStationName, task.getOrgSite()) |
| | | .set(BasStation::getUseStatus, LocStsType.LOC_STS_TYPE_O.type))) { |
| | | throw new CoolException("站点状态修改失败!!"); |
| | | } |
| | | } |
| | | } else if (task.getTaskType().equals(TaskType.TASK_TYPE_OUT.type) |
| | | || task.getTaskType().equals(TaskType.TASK_TYPE_PICK_AGAIN_OUT.type) |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | log.info(JSONObject.toJSONString(params)); |
| | | return R.ok(JSONObject.toJSONString(params)); |
| | | } |
| | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.vincent.rsf.server.manager.enums.StationTypeEnum; |
| | | import com.vincent.rsf.server.manager.service.WarehouseAreasService; |
| | | import com.vincent.rsf.server.system.entity.DictData; |
| | | import com.vincent.rsf.server.system.service.DictDataService; |
| | |
| | | */ |
| | | @ApiModelProperty(value= "站点名称") |
| | | private String stationName; |
| | | |
| | | @ApiModelProperty("站点类型: {0:光电, 1:无光电}") |
| | | private Integer type; |
| | | |
| | | /** |
| | | * 可入 |
| | |
| | | |
| | | public BasStation() {} |
| | | |
| | | |
| | | |
| | | // BasStation basStation = new BasStation( |
| | | // null, // 站点名称 |
| | | // null, // 可入 |
| | | // null, // 可出 |
| | | // null, // 状态 |
| | | // null, // 所属库区id |
| | | // null, // 是否可跨区 |
| | | // null, // 可跨区区域id |
| | | // null, // 是否wcs站点 |
| | | // null, // wcs站点信息 |
| | | // null, // 容器类型 |
| | | // null, // 条码 |
| | | // null, // 是否自动调拨 |
| | | // null, // 备注 |
| | | // null, // 创建人 |
| | | // null, // 创建时间 |
| | | // null, // 更新人 |
| | | // null // 更新时间 |
| | | // ); |
| | | public String getType$() { |
| | | if (this.type == null) return null; |
| | | return StationTypeEnum.getStationDesc(this.type); |
| | | } |
| | | |
| | | public List<Long> getContainerTypes$(){ |
| | | if (Cools.isEmpty(this.containerType)){ |
New file |
| | |
| | | package com.vincent.rsf.server.manager.enums; |
| | | |
| | | /** |
| | | * @author Ryan |
| | | * @date 2025/9/4 |
| | | * @description: 站点类型 |
| | | * @version 1.0 |
| | | */ |
| | | public enum StationTypeEnum { |
| | | //站点类型 |
| | | STATION_TYPE_MUTI(0, "光电站点"), |
| | | STATION_TYPE_NORMAL(1, "普通站点"), |
| | | ; |
| | | /**站点类型*/ |
| | | public Integer type; |
| | | /**站点说明*/ |
| | | public String desc; |
| | | |
| | | StationTypeEnum(Integer type, String desc) { |
| | | this.type = type; |
| | | this.desc = desc; |
| | | } |
| | | |
| | | public static String getStationDesc(Integer type) { |
| | | if (type.equals(STATION_TYPE_MUTI.type)) { |
| | | return STATION_TYPE_MUTI.desc; |
| | | } else if (type.equals(STATION_TYPE_NORMAL.type)) { |
| | | return STATION_TYPE_NORMAL.desc; |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | } |
| | |
| | | package com.vincent.rsf.server.manager.enums;
|
| | |
|
| | | public enum TaskStsType {
|
| | |
|
| | | //任务状态
|
| | | GENERATE_IN("1", "创建入库任务"),
|
| | | WCS_EXECUTE_IN("2", "RCS任务已下发"),
|
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | // 入库 应该根据工作档回去 |
| | | // this.runStaToLoc(locGroupList, staGroupList, staTaskMemo); |
| | | |
| | |
| | | private List<Loc> getAreaLocs(List<Integer> locGroupList, List<String> staGroupList, String memo) { |
| | | Integer startRow = Collections.min(locGroupList); |
| | | Integer endRow = Collections.max(locGroupList); |
| | | |
| | | // STA IDLE |
| | | // LambdaQueryWrapper<BasStation> idleWrapper = new LambdaQueryWrapper<BasStation>().eq(BasStation::getUseStatus, LocStsType.LOC_STS_TYPE_O.type).in(BasStation::getStationName, staGroupList); |
| | | // List<BasStation> idleList = stationService.list(idleWrapper); |
| | | // if (Cools.isEmpty(idleList)) { |
| | | // return new ArrayList<>(); |
| | | // } |
| | | // Collections.shuffle(idleList); |
| | | |
| | | // LOC STOCK |
| | | LambdaQueryWrapper<Loc> stockWrapper = new LambdaQueryWrapper<Loc>().eq(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_F.type); |
| | |
| | | Collections.shuffle(stockList); |
| | | |
| | | return stockList; |
| | | //生成入库工作档 |
| | | // generateTask(idleList.get(0).getStationName(), stockList.get(0).getCode(), idleList.get(0).getBarcode()); |
| | | } |
| | | |
| | | |
| | | // 出库 |
| | | private void runLocToSta(List<Integer> locGroupList, List<String> staGroupList, String memo) { |
| | | Integer startRow = Collections.min(locGroupList); |
| | | Integer endRow = Collections.max(locGroupList); |
| | | |
| | | |
| | | // STA IDLE |
| | | LambdaQueryWrapper<BasStation> idleWrapper = new LambdaQueryWrapper<BasStation>().eq(BasStation::getUseStatus, LocStsType.LOC_STS_TYPE_O.type).in(BasStation::getStationName, staGroupList); |
| | | List<BasStation> idleList = stationService.list(idleWrapper); |
| | | if (Cools.isEmpty(idleList)) { |
| | | return; |
| | | } |
| | | Collections.shuffle(idleList); |
| | | |
| | | // LOC STOCK |
| | | LambdaQueryWrapper<Loc> stockWrapper = new LambdaQueryWrapper<Loc>().eq(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_F.type); |
| | | if (null != startRow) { |
| | | stockWrapper.ge(Loc::getRow, startRow); |
| | | } |
| | | if (null != endRow) { |
| | | stockWrapper.le(Loc::getRow, endRow); |
| | | } |
| | | List<Loc> stockList = locService.list(stockWrapper); |
| | | if (Cools.isEmpty(stockList)) { |
| | | return; |
| | | } |
| | | Collections.shuffle(stockList); |
| | | |
| | | |
| | | Loc loc = stockList.get(0); |
| | | List<LocItem> list = locItemService.list(new LambdaQueryWrapper<LocItem>().eq(LocItem::getLocId, loc.getId())); |
| | | LocToTaskParams param = new LocToTaskParams(); |
| | | param.setType(Constants.TASK_TYPE_OUT_STOCK); |
| | | param.setTarLoc(loc.getCode()); |
| | | param.setItems(list); |
| | | param.setSiteNo(idleList.get(0).getStationName()); |
| | | param.setMemo(memo); |
| | | //生成出库工作档 |
| | | try { |
| | | locItemService.generateTask(TaskResouceType.TASK_RESOUCE_STOCK_TYPE.val, param, getLoginUserId()); |
| | | } catch (Exception e) { |
| | | log.info("生成出库任务失败", e); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | // 移库 |
| | | private void runLocToLoc(List<Integer> locGroupList, String staTaskMemo) { |
| | |
| | | } |
| | | |
| | | } |
| | | |
| | | private void generateTask(String sourceStaNo, String locNo, String barcode) { |
| | | String ruleCode = SerialRuleUtils.generateRuleCode(SerialRuleCode.SYS_TASK_CODE, null); |
| | | if (StringUtils.isBlank(ruleCode)) { |
| | | throw new CoolException("编码错误:请确认编码「SYS_TASK_CODE」是否已生成!!"); |
| | | } |
| | | Task task = new Task(); |
| | | task.setTaskCode(ruleCode) |
| | | .setTaskStatus(TaskStsType.GENERATE_IN.id) |
| | | .setTaskType(TaskType.TASK_TYPE_IN.type) |
| | | .setResource(TaskResouceType.TASK_RESOUCE_PAKIN_TYPE.val) |
| | | .setTargLoc(locNo) |
| | | .setBarcode(barcode) |
| | | .setOrgSite(sourceStaNo) |
| | | .setCreateBy(6666L) |
| | | .setUpdateBy(6666L); |
| | | |
| | | if (!taskService.save(task)) { |
| | | throw new CoolException("任务保存失败!!"); |
| | | } |
| | | LambdaQueryWrapper<Matnr> wrapper = new LambdaQueryWrapper<>(); |
| | | wrapper.eq(Matnr::getStatus, 1); |
| | | wrapper.orderByAsc(Matnr::getUpdateTime); |
| | | List<Matnr> list = matnrService.page(new Page<>(1, 100), wrapper).getRecords(); |
| | | Collections.shuffle(list); |
| | | List<TaskItem> taskItems = new ArrayList<>(); |
| | | int i = 0; |
| | | for (Matnr item : list) { |
| | | if (i > 5) { |
| | | break; |
| | | } |
| | | TaskItem taskItem = new TaskItem(); |
| | | BeanUtils.copyProperties(item, taskItem); |
| | | taskItem.setTaskId(task.getId()) |
| | | .setOrderType(OrderType.ORDER_IN.type) |
| | | .setCreateBy(6666L) |
| | | .setUpdateBy(6666L) |
| | | .setExtendFields(item.getExtendFields()); |
| | | taskItems.add(taskItem); |
| | | item.setUpdateTime(new Date()); |
| | | matnrService.updateById(item); |
| | | i++; |
| | | } |
| | | taskItemService.saveBatch(taskItems); |
| | | } |
| | | |
| | | |
| | | public static List<String> getStaPrefixes(List<String> staGroupList) { |
| | | Set<String> rowSet = new HashSet<>(); |
| | |
| | | private TransferOrderService transferOrderService; |
| | | @Autowired |
| | | private TransferService transferService; |
| | | |
| | | @Autowired |
| | | private RestTemplate restTemplate; |
| | | |
| | | @Autowired |
| | | private RemotesInfoProperties.RcsApi rcsApi; |
| | | @Autowired |
| | | private BasStationService basStationService; |
| | | |
| | | /** |
| | | * @param |
| | |
| | | // } |
| | | } |
| | | |
| | | /** |
| | | * 任务自动下发 |
| | | * |
| | | * @throws Exception |
| | | */ |
| | | @Scheduled(cron = "0/5 * * * * ? ") |
| | | |
| | | public void taskToWCS() { |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void pubTaskToWcs() { |
| | | Long loginUserId = SystemAuthUtils.getLoginUserId(); |
| | | List<Integer> list = Arrays.asList(TaskType.TASK_TYPE_IN.type, TaskType.TASK_TYPE_OUT.type, TaskType.TASK_TYPE_LOC_MOVE.type, TaskType.TASK_TYPE_EMPITY_IN.type |
| | | , TaskType.TASK_TYPE_CHECK_IN.type, TaskType.TASK_TYPE_MERGE_IN.type, TaskType.TASK_TYPE_EMPITY_OUT.type, |
| | |
| | | .in(Task::getTaskStatus, integers) |
| | | .orderByDesc(Task::getSort)); |
| | | for (Task task : tasks) { |
| | | // Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getBarcode, task.getBarcode())); |
| | | // if (Objects.isNull(loc)) { |
| | | // continue; |
| | | // } |
| | | // //判断是否深库位 |
| | | // if (!LocUtils.isShallowLoc(loc.getCode())) { |
| | | // //获取深库位对应的浅库位 |
| | | // String shallowLoc = LocUtils.getShallowLoc(loc.getCode()); |
| | | // if (StringUtils.isBlank(shallowLoc)) { |
| | | // continue; |
| | | // } |
| | | // Loc shalloc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getCode, shallowLoc)); |
| | | // if (Objects.isNull(shalloc) || !shalloc.getUseStatus().equals(LocStsType.LOC_STS_TYPE_F.type)) { |
| | | // //如果浅库位不在库跳出循环 |
| | | // continue; |
| | | // } |
| | | // LocToTaskParams params = new LocToTaskParams(); |
| | | // params.setOrgLoc(shallowLoc).setType(TaskType.TASK_TYPE_LOC_MOVE.type + ""); |
| | | // //生成移库任务 |
| | | // Task moveTask = locItemService.genMoveTask(params, loginUserId); |
| | | // moveTask.setSort(!Objects.isNull(task.getSort()) ? task.getSort() + 1 : Constants.TASK_SORT_DEFAULT_VALUE + 1); |
| | | // if (!taskService.updateById(moveTask)) { |
| | | // throw new Exception("任务优先级更新失败!!"); |
| | | // } |
| | | // } |
| | | //TODO 调用下发任务接口 |
| | | /**移库不做站点操作*/ |
| | | if (!task.getTaskType().equals(TaskType.TASK_TYPE_LOC_MOVE.type)) { |
| | | BasStation station = basStationService.getOne(new LambdaQueryWrapper<BasStation>().eq(BasStation::getStationName, |
| | | task.getTaskStatus().equals(TaskStsType.GENERATE_IN.id) ? task.getOrgSite() : task.getTargSite())); |
| | | if (station.getType().equals(StationTypeEnum.STATION_TYPE_MUTI.type)) { |
| | | continue; |
| | | } |
| | | } |
| | | /**下发普通站点任务,报错回滚,不再往下执行*/ |
| | | pubTaskToWcs(task); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @author Ryan |
| | | * @date 2025/9/4 |
| | | * @description: 光电站点任务下发 |
| | | * @version 1.0 |
| | | */ |
| | | @Scheduled(cron = "0/5 * * * * ? ") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void taskToWCS() throws Exception { |
| | | Long loginUserId = SystemAuthUtils.getLoginUserId(); |
| | | List<Integer> list = Arrays.asList(TaskType.TASK_TYPE_IN.type, TaskType.TASK_TYPE_OUT.type, TaskType.TASK_TYPE_LOC_MOVE.type, TaskType.TASK_TYPE_EMPITY_IN.type |
| | | , TaskType.TASK_TYPE_CHECK_IN.type, TaskType.TASK_TYPE_MERGE_IN.type, TaskType.TASK_TYPE_EMPITY_OUT.type, |
| | | TaskType.TASK_TYPE_PICK_AGAIN_OUT.type, TaskType.TASK_TYPE_CHECK_OUT.type, TaskType.TASK_TYPE_MERGE_OUT.type); |
| | | List<Integer> integers = Arrays.asList(TaskStsType.GENERATE_IN.id, TaskStsType.GENERATE_OUT.id); |
| | | List<Task> tasks = taskService.list(new LambdaQueryWrapper<Task>() |
| | | .in(Task::getTaskType, list) |
| | | .in(Task::getTaskStatus, integers) |
| | | .orderByDesc(Task::getSort)); |
| | | for (Task task : tasks) { |
| | | /**移库不做站点操作*/ |
| | | if (!task.getTaskType().equals(TaskType.TASK_TYPE_LOC_MOVE.type)) { |
| | | BasStation station = basStationService.getOne(new LambdaQueryWrapper<BasStation>().eq(BasStation::getStationName, |
| | | task.getTaskStatus().equals(TaskStsType.GENERATE_IN.id) ? task.getOrgSite() : task.getTargSite())); |
| | | /**过滤掉普通站点任务*/ |
| | | if (station.getType().equals(StationTypeEnum.STATION_TYPE_NORMAL.type)) { |
| | | continue; |
| | | } |
| | | Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getBarcode, task.getBarcode())); |
| | | if (Objects.isNull(loc)) { |
| | | continue; |
| | | } |
| | | //判断是否深库位 |
| | | if (!LocUtils.isShallowLoc(loc.getCode())) { |
| | | //获取深库位对应的浅库位 |
| | | String shallowLoc = LocUtils.getShallowLoc(loc.getCode()); |
| | | if (StringUtils.isBlank(shallowLoc)) { |
| | | continue; |
| | | } |
| | | Loc shalloc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getCode, shallowLoc)); |
| | | if (Objects.isNull(shalloc) || !shalloc.getUseStatus().equals(LocStsType.LOC_STS_TYPE_F.type)) { |
| | | //如果浅库位不在库跳出循环 |
| | | continue; |
| | | } |
| | | LocToTaskParams params = new LocToTaskParams(); |
| | | params.setOrgLoc(shallowLoc).setType(TaskType.TASK_TYPE_LOC_MOVE.type + ""); |
| | | //生成移库任务 |
| | | Task moveTask = locItemService.genMoveTask(params, loginUserId); |
| | | moveTask.setSort(!Objects.isNull(task.getSort()) ? task.getSort() + 1 : Constants.TASK_SORT_DEFAULT_VALUE + 1); |
| | | if (!taskService.updateById(moveTask)) { |
| | | throw new Exception("任务优先级更新失败!!"); |
| | | } |
| | | } |
| | | } |
| | | /**下发任务*/ |
| | | try { |
| | | pubTaskToWcs(task); |
| | | } catch (Exception e) { |
| | | log.error(e.getMessage()); |
| | | log.error("任务下发失败!!", e); |
| | | } |
| | | } |
| | | } |
| | |
| | | //任务类型,任务编码 |
| | | itemParam.setTaskType(RcsTaskType.getTypeDesc(task.getTaskType())) |
| | | .setSeqNum(task.getTaskCode()); |
| | | |
| | | //主参数 |
| | | taskParams.setBatch(task.getBarcode()); |
| | | |
| | | if (task.getTaskType().equals(TaskType.TASK_TYPE_IN.type) |
| | | BasStation station = basStationService.getOne(new LambdaQueryWrapper<BasStation>().eq(BasStation::getStationName, task.getTargSite())); |
| | | if (Objects.isNull(station)) { |
| | | throw new CoolException("站点不存在!!"); |
| | | } |
| | | /**判断是否光电站点,非光店站点需管控站点状态*/ |
| | | if (station.getType().equals(StationTypeEnum.STATION_TYPE_NORMAL.type)) { |
| | | if (task.getTaskType() <= TaskType.TASK_TYPE_CHECK_IN.type && task.getTaskType().equals(TaskType.TASK_TYPE_LOC_MOVE.type)) { |
| | | if (!station.getUseStatus().equals(LocStsType.LOC_STS_TYPE_F.type)) { |
| | | throw new CoolException("当前站点不是F.在库状态!!"); |
| | | } |
| | | } else if (task.getTaskType() >= TaskType.TASK_TYPE_OUT.type) { |
| | | if (!station.getUseStatus().equals(LocStsType.LOC_STS_TYPE_O.type)) { |
| | | throw new CoolException("目标站点不是O.空闲状态!!"); |
| | | } |
| | | } |
| | | } |
| | | /**移库参数*/ |
| | | if (task.getTaskType().equals(TaskType.TASK_TYPE_LOC_MOVE.type)) { |
| | | itemParam.setOriLoc(task.getOrgLoc()).setDestLoc(task.getTargLoc()); |
| | | } else if (task.getTaskType().equals(TaskType.TASK_TYPE_IN.type) |
| | | || task.getTaskType().equals(TaskType.TASK_TYPE_MERGE_IN.type) |
| | | || task.getTaskType().equals(TaskType.TASK_TYPE_EMPITY_IN.type)) { |
| | | /**全板入库参数*/ |
| | | itemParam.setDestLoc(task.getTargLoc()) |
| | | .setOriSta(task.getOrgSite()); |
| | | } else if (task.getTaskType().equals(TaskType.TASK_TYPE_CHECK_IN.type) || task.getTaskType().equals(TaskType.TASK_TYPE_PICK_IN.type)) { |
| | | /**拣料/盘点入库参数*/ |
| | | itemParam.setDestLoc(task.getTargLoc()) |
| | | .setOriSta(task.getTargSite()); |
| | | } else if (task.getTaskType().equals(TaskType.TASK_TYPE_OUT.type) |
| | |
| | | || task.getTaskType().equals(TaskType.TASK_TYPE_EMPITY_OUT.type) |
| | | || task.getTaskType().equals(TaskType.TASK_TYPE_CHECK_OUT.type) |
| | | || task.getTaskType().equals(TaskType.TASK_TYPE_MERGE_OUT.type)) { |
| | | |
| | | /**出库参数*/ |
| | | itemParam.setOriLoc(task.getOrgLoc()) |
| | | .setDestSta(task.getTargSite()); |
| | | } else if (task.getTaskType().equals(TaskType.TASK_TYPE_LOC_MOVE.type)) { |
| | | itemParam.setOriLoc(task.getOrgLoc()).setDestLoc(task.getTargLoc()); |
| | | } else { |
| | | /**站点间移库参数*/ |
| | | itemParam.setOriSta(task.getOrgSite()).setDestSta(task.getTargSite()); |
| | | |
| | | BasStation curSta = basStationService.getOne(new LambdaQueryWrapper<BasStation>().eq(BasStation::getStationName, task.getOrgSite())); |
| | | if (Objects.isNull(curSta)) { |
| | | throw new CoolException("站点不存在!!"); |
| | | } |
| | | if (curSta.getType().equals(StationTypeEnum.STATION_TYPE_NORMAL.type)) { |
| | | if (!curSta.getUseStatus().equals(LocStsType.LOC_STS_TYPE_F.type)) { |
| | | throw new CoolException("当前站点不是F.在库状态!!"); |
| | | } |
| | | } |
| | | if (station.getType().equals(StationTypeEnum.STATION_TYPE_NORMAL.type)) { |
| | | if (!station.getUseStatus().equals(LocStsType.LOC_STS_TYPE_O.type)) { |
| | | throw new CoolException("目标站点不是O.空闲状态!!"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | List<TaskItemParam> items = Arrays.asList(itemParam); |
| | |
| | | .set(Task::getTaskStatus, TaskStsType.WCS_EXECUTE_IN.id))) { |
| | | throw new CoolException("任务状态修改失败!!"); |
| | | } |
| | | /**排除移库功能*/ |
| | | if (!task.getTaskType().equals(TaskType.TASK_TYPE_LOC_MOVE.type)) { |
| | | /**如果是普通站点,修改站点状态为出库预约*/ |
| | | if (station.getType().equals(StationTypeEnum.STATION_TYPE_NORMAL.type)) { |
| | | station.setUseStatus(LocStsType.LOC_STS_TYPE_R.type); |
| | | if (!basStationService.updateById(station)) { |
| | | throw new CoolException("站点预约失败!!"); |
| | | } |
| | | } |
| | | } |
| | | } else if (task.getTaskType().equals(TaskType.TASK_TYPE_OUT.type) |
| | | || task.getTaskType().equals(TaskType.TASK_TYPE_CHECK_OUT.type) |
| | | || task.getTaskType().equals(TaskType.TASK_TYPE_MERGE_OUT.type) |
| | | || task.getTaskType().equals(TaskType.TASK_TYPE_EMPITY_OUT.type) |
| | | || task.getTaskType().equals(TaskType.TASK_TYPE_PICK_AGAIN_OUT.type) |
| | | ) { |
| | | || task.getTaskType().equals(TaskType.TASK_TYPE_PICK_AGAIN_OUT.type)) { |
| | | if (!taskService.update(new LambdaUpdateWrapper<Task>().eq(Task::getTaskCode, task.getTaskCode()) |
| | | .set(Task::getTaskStatus, TaskStsType.WCS_EXECUTE_OUT.id))) { |
| | | throw new CoolException("任务状态修改失败!!"); |
| | | } |
| | | /**如果是普通站点,修改站点状态为入库预约*/ |
| | | if (station.getType().equals(StationTypeEnum.STATION_TYPE_NORMAL.type)) { |
| | | station.setUseStatus(LocStsType.LOC_STS_TYPE_S.type); |
| | | if (!basStationService.updateById(station)) { |
| | | throw new CoolException("站点预约失败!!"); |
| | | } |
| | | } |
| | | } |
| | | } else { |
| | | throw new CoolException("任务下发失败!!"); |
| | |
| | | Map<String, Object> params = new HashMap<>(); |
| | | params.put("ids", longs); |
| | | waveService.waveToTask(params, loginUserId); |
| | | |
| | | } |
| | | |
| | | } |
| | |
| | | throw new CoolException("数据错误: 波次不存在!!"); |
| | | } |
| | | for (Wave wave : waves) { |
| | | if (wave.getExceStatus() >= WaveExceStatus.WAVE_EXCE_STATUS_EXCING.val) { |
| | | if (wave.getExceStatus() > WaveExceStatus.WAVE_EXCE_STATUS_EXCING.val) { |
| | | throw new CoolException("当前状态无法下发执行!!"); |
| | | } |
| | | |
| | |
| | | .set(Wave::getExceStatus, WaveExceStatus.WAVE_EXCE_STATUS_TASK.val) |
| | | .set(Wave::getWorkQty, taskItems.stream().mapToDouble(TaskItem::getAnfme).sum()) |
| | | .set(Wave::getUpdateBy, loginUserId) |
| | | .set(Wave::getMemo, null) |
| | | .set(Wave::getUpdateTime, new Date()) |
| | | .eq(Wave::getId, wave.getId()))) { |
| | | throw new CoolException("波次状态修改失败!!"); |
| | |
| | | public static List<LocItem> getFirstInFirstOutItemList(String matnrCode, String splrBatch, Double anfme) { |
| | | LambdaQueryWrapper<LocItem> locItemQueryWrapper = new LambdaQueryWrapper<>(); |
| | | locItemQueryWrapper.eq(LocItem::getMatnrCode, matnrCode); |
| | | locItemQueryWrapper.eq(LocItem::getBatch, splrBatch); |
| | | locItemQueryWrapper.eq(StringUtils.isNotEmpty(splrBatch), LocItem::getBatch, splrBatch); |
| | | locItemQueryWrapper.orderByAsc(LocItem::getCreateTime); |
| | | String applySql = String.format( |
| | | "EXISTS (SELECT 1 FROM man_loc ml " + |
| | |
| | | orderOutItemDto.setSiteNo(deviceSite.getSite()); |
| | | } |
| | | |
| | | orderOutItemDto.setSource(item.getItemId()).setSourceId(item.getWaveId()); |
| | | orderOutItemDto.setSource(item.getItemId()) |
| | | .setSourceId(item.getWaveId()); |
| | | |
| | | list.add(orderOutItemDto); |
| | | |
| | |
| | | # url: jdbc:mysql://47.76.147.249:3306/rsf?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai |
| | | # username: rsf |
| | | username: root |
| | | url: jdbc:mysql://10.10.10.200:3306/rsf?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai |
| | | password: xltys1995 |
| | | # url: jdbc:mysql://127.0.0.1:3306/rsf?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai |
| | | # password: 34821015 |
| | | # url: jdbc:mysql://10.10.10.200:3306/rsf?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai |
| | | # password: xltys1995 |
| | | url: jdbc:mysql://127.0.0.1:3306/rsf?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai |
| | | password: 34821015 |
| | | type: com.alibaba.druid.pool.DruidDataSource |
| | | druid: |
| | | initial-size: 5 |