| | |
| | | import com.vincent.rsf.framework.common.Cools; |
| | | import com.vincent.rsf.framework.common.R; |
| | | import com.vincent.rsf.server.common.constant.Constants; |
| | | import com.vincent.rsf.server.common.domain.BaseParam; |
| | | import com.vincent.rsf.server.common.domain.PageParam; |
| | | import com.vincent.rsf.server.common.utils.FieldsUtils; |
| | | import com.vincent.rsf.server.manager.controller.params.LocToTaskParams; |
| | | import com.vincent.rsf.server.manager.entity.DeviceSite; |
| | | import com.vincent.rsf.server.manager.entity.LocItem; |
| | | import com.vincent.rsf.server.manager.enums.LocStsType; |
| | | import com.vincent.rsf.server.manager.enums.TaskResouceType; |
| | | import com.vincent.rsf.server.manager.service.DeviceSiteService; |
| | | import com.vincent.rsf.server.manager.service.LocItemService; |
| | | import com.vincent.rsf.server.system.controller.BaseController; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | |
| | | param.setType(Constants.TASK_TYPE_OUT_STOCK); |
| | | |
| | | try { |
| | | locItemService.generateTask(param, getLoginUserId()); |
| | | locItemService.generateTask(TaskResouceType.TASK_RESOUCE_STOCK_TYPE.val, param, getLoginUserId()); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | |
| | | package com.vincent.rsf.server.common.config; |
| | | |
| | | import com.vincent.rsf.server.common.constant.Constants; |
| | | import com.vincent.rsf.server.common.interceptor.severlet.DynamicFieldsInterceptor; |
| | | import com.vincent.rsf.server.common.utils.Http; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | |
| | | registry.addInterceptor(getAsyncHandlerInterceptor()) |
| | | .addPathPatterns("/**") |
| | | .excludePathPatterns("/swagger-resources/**", "/webjars/**","/erp/**", "/v2/**","/v3/**","/doc.html/**", "/swagger-ui.html/**"); |
| | | |
| | | registry.addInterceptor(dynamicFieldsInterceptor()) |
| | | .addPathPatterns("/**") |
| | | .excludePathPatterns("/swagger-resources/**", |
| | | "/webjars/**", |
| | | "/erp/**", |
| | | "/v2/**", |
| | | "/v3/**", |
| | | "/doc.html/**", |
| | | "/swagger-ui.html/**"); |
| | | } |
| | | |
| | | @Bean |
| | | public DynamicFieldsInterceptor dynamicFieldsInterceptor() { |
| | | return new DynamicFieldsInterceptor(); |
| | | } |
| | | |
| | | @Bean |
| | | public AsyncHandlerInterceptor getAsyncHandlerInterceptor() { |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.vincent.rsf.framework.common.Cools; |
| | | import com.vincent.rsf.framework.common.R; |
| | | import com.vincent.rsf.server.api.utils.LocUtils; |
| | | import com.vincent.rsf.server.common.constant.Constants; |
| | | import com.vincent.rsf.server.common.utils.ExcelUtil; |
| | | import com.vincent.rsf.server.common.annotation.OperationLog; |
| | |
| | | import com.vincent.rsf.server.common.utils.FieldsUtils; |
| | | import com.vincent.rsf.server.manager.controller.params.LocToTaskParams; |
| | | import com.vincent.rsf.server.manager.entity.LocItem; |
| | | import com.vincent.rsf.server.manager.enums.TaskResouceType; |
| | | import com.vincent.rsf.server.manager.service.LocItemService; |
| | | import com.vincent.rsf.server.manager.service.LocService; |
| | | import com.vincent.rsf.server.system.controller.BaseController; |
| | |
| | | param.setType(Constants.TASK_TYPE_OUT_STOCK); |
| | | |
| | | try { |
| | | locItemService.generateTask(param, getLoginUserId()); |
| | | locItemService.generateTask(TaskResouceType.TASK_RESOUCE_STOCK_TYPE.val, param, getLoginUserId()); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | |
| | | map.setType(Constants.TASK_TYPE_OUT_CHECK); |
| | | |
| | | try { |
| | | locItemService.generateTask(map, getLoginUserId()); |
| | | locItemService.generateTask(TaskResouceType.TASK_RESOUCE_CHECK_TYPE.val, map, getLoginUserId()); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | |
| | | @ApiModelProperty(value= "任务号") |
| | | private String taskCode; |
| | | |
| | | @ApiModelProperty("任务来源") |
| | | private Short resource; |
| | | |
| | | /** |
| | | * 任务状态 |
| | | */ |
New file |
| | |
| | | package com.vincent.rsf.server.manager.enums; |
| | | |
| | | /** |
| | | * 任务生成来源类型 |
| | | */ |
| | | public enum TaskResouceType { |
| | | |
| | | //订单类型 |
| | | TASK_RESOUCE_WAVE_TYPE("1", "波次任务"), |
| | | |
| | | TASK_RESOUCE_STOCK_TYPE("2", "库存出库任务"), |
| | | |
| | | TASK_RESOUCE_PAKIN_TYPE("3", "组拖任务"), |
| | | |
| | | TASK_RESOUCE_ORDER_TYPE("4", "单据出库任务"), |
| | | |
| | | TASK_RESOUCE_CHECK_TYPE("4", "盘点出库任务"), |
| | | |
| | | |
| | | ; |
| | | TaskResouceType(String val, String desc) { |
| | | this.val = Short.parseShort(val); |
| | | this.desc = desc; |
| | | } |
| | | |
| | | public Short val; |
| | | |
| | | public String desc; |
| | | } |
| | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void taskLogUpdate() { |
| | | LambdaQueryWrapper<Task> queryWrapper = new LambdaQueryWrapper<Task>(); |
| | | Config config = configService.getOne(new LambdaQueryWrapper<Config>().eq(Config::getFlag, GlobalConfigCode.ORDER_INOF_REPORT_PLAT)); |
| | | Config config = configService.getOne(new LambdaQueryWrapper<Config>().eq(Config::getFlag, GlobalConfigCode.ORDER_INOF_REPORT_PLAT));//是否上报平台 |
| | | if (!Objects.isNull(config)) { |
| | | if (Boolean.parseBoolean(config.getVal())) { |
| | | queryWrapper.in(Task::getTaskStatus, TaskStsType.REPORT_IN.id); |
| | |
| | | package com.vincent.rsf.server.manager.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.vincent.rsf.framework.common.R; |
| | | import com.vincent.rsf.server.manager.controller.params.LocToTaskParams; |
| | | import com.vincent.rsf.server.manager.entity.LocItem; |
| | | import com.vincent.rsf.server.manager.entity.Task; |
| | | |
| | | public interface LocItemService extends IService<LocItem> { |
| | | |
| | | void generateTask(LocToTaskParams map, Long loginUserId) throws Exception; |
| | | void generateTask(Short resouce, LocToTaskParams map, Long loginUserId) throws Exception; |
| | | |
| | | Task genMoveTask(LocToTaskParams map, Long loginUserId); |
| | | |
| | |
| | | package com.vincent.rsf.server.manager.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.vincent.rsf.framework.common.R; |
| | | import com.vincent.rsf.framework.exception.CoolException; |
| | | import com.vincent.rsf.server.api.controller.params.TaskInParam; |
| | | import com.vincent.rsf.server.api.entity.dto.InTaskMsgDto; |
| | |
| | | * 库存出库生成出库任务 |
| | | * type: check 盘点, stock: 库存出库 |
| | | * |
| | | * @param resouce |
| | | * @param map |
| | | * @param loginUserId |
| | | * @return |
| | |
| | | @Override |
| | | @Synchronized |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void generateTask(LocToTaskParams map, Long loginUserId) throws Exception { |
| | | public void generateTask(Short resouce, LocToTaskParams map, Long loginUserId) throws Exception { |
| | | if (Objects.isNull(map.getSiteNo())) { |
| | | throw new CoolException("站点不能为空!"); |
| | | } |
| | |
| | | String ruleCode = SerialRuleUtils.generateRuleCode(SerialRuleCode.SYS_TASK_CODE, null); |
| | | task.setOrgLoc(loc.getCode()) |
| | | .setTaskCode(ruleCode) |
| | | .setResource(resouce) |
| | | .setTargSite(siteNo) |
| | | .setSort(Constants.TASK_SORT_DEFAULT_VALUE) |
| | | .setUpdateBy(loginUserId) |
| | |
| | | .setSiteNo(param.getSiteNo()); |
| | | try { |
| | | //生成出库任务 |
| | | locItemService.generateTask(taskParams, loginUserId); |
| | | locItemService.generateTask(TaskResouceType.TASK_RESOUCE_ORDER_TYPE.val, taskParams, loginUserId); |
| | | } catch (Exception e) { |
| | | logger.error("UNK", e); |
| | | throw new CoolException(e.getMessage()); |
| | |
| | | task.setTaskCode(ruleCode) |
| | | .setTaskStatus(TaskStsType.GENERATE_IN.id) |
| | | .setTaskType(TaskType.TASK_TYPE_IN.type) |
| | | .setResource(TaskResouceType.TASK_RESOUCE_PAKIN_TYPE.val) |
| | | .setTargLoc(targetLoc) |
| | | .setBarcode(pakin.getBarcode()) |
| | | .setOrgSite(deviceSite.getSite()) |
| | |
| | | if (Objects.isNull(list) || list.isEmpty()) { |
| | | Map<Long, List<TaskItem>> maps = taskItems.stream().collect(Collectors.groupingBy(TaskItem::getSource)); |
| | | maps.keySet().forEach(key -> { |
| | | if (task.getResource().equals(TaskResouceType.TASK_RESOUCE_WAVE_TYPE.val)) { |
| | | WaveItem waveItem = waveItemService.getById(key); |
| | | if (Objects.isNull(waveItem)) { |
| | | throw new CoolException("波次明细不存在!!"); |
| | | } |
| | | try { |
| | | saveOutStockItem(maps.get(key), waveItem, loginUserId); |
| | | saveOutStockItem(maps.get(key), null, waveItem, loginUserId); |
| | | } catch (Exception e) { |
| | | throw new CoolException(e.getMessage()); |
| | | } |
| | | } else if (task.getResource().equals(TaskResouceType.TASK_RESOUCE_ORDER_TYPE.val)) { |
| | | AsnOrderItem orderItem = asnOrderItemService.getById(key); |
| | | if (Objects.isNull(orderItem)) { |
| | | throw new CoolException("单据明细不存在!!"); |
| | | } |
| | | |
| | | try { |
| | | saveOutStockItem(maps.get(key), orderItem, null, loginUserId); |
| | | } catch (Exception e) { |
| | | throw new CoolException(e.getMessage()); |
| | | } |
| | | } else { |
| | | |
| | | } |
| | | }); |
| | | } else { |
| | | try { |
| | | saveOutStockItem(taskItems, null, loginUserId); |
| | | saveOutStockItem(taskItems, null, null, loginUserId); |
| | | } catch (Exception e) { |
| | | throw new CoolException(e.getMessage()); |
| | | } |
| | |
| | | * @version 1.0 |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void saveOutStockItem(List<TaskItem> taskItems, WaveItem waveItem, Long loginUserId) throws Exception { |
| | | public void saveOutStockItem(List<TaskItem> taskItems, AsnOrderItem orderItem, WaveItem waveItem, Long loginUserId) throws Exception { |
| | | Stock stock = new Stock(); |
| | | String ruleCode = SerialRuleUtils.generateRuleCode(SerialRuleCode.SYS_STOCK_CODE, null); |
| | | if (StringUtils.isBlank(ruleCode)) { |
| | |
| | | .setAnfme(sum); |
| | | if (Objects.isNull(waveItem)) { |
| | | stock.setWkType(Short.parseShort(OrderWorkType.ORDER_WORK_TYPE_STOCK_OUT.type)) |
| | | .setMemo("出库单出库,无单据信息!!") |
| | | .setMemo("库存出库,无单据信息!!") |
| | | .setType(OrderType.ORDER_OUT.type); |
| | | } else if (!Objects.isNull(orderItem) && StringUtils.isNotBlank(orderItem.getId() + "")) { |
| | | AsnOrder asnOrder = asnOrderService.getById(orderItem.getAsnId()); |
| | | stock.setWkType(Short.parseShort(asnOrder.getWkType())) |
| | | .setType(OrderType.ORDER_OUT.type); |
| | | } else { |
| | | //TODO 生成波次时需要将波次号写入单据,通过物料,批次,动态字段等唯一值反查单据信息 |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.vincent.rsf.framework.common.R; |
| | | import com.vincent.rsf.framework.exception.CoolException; |
| | | import com.vincent.rsf.server.manager.enums.TaskStsType; |
| | | import com.vincent.rsf.server.manager.enums.TaskType; |
| | | import com.vincent.rsf.server.manager.enums.*; |
| | | import com.vincent.rsf.server.manager.entity.*; |
| | | import com.vincent.rsf.server.manager.enums.AsnExceStatus; |
| | | import com.vincent.rsf.server.manager.enums.WaveExceStatus; |
| | | import com.vincent.rsf.server.manager.mapper.WaveMapper; |
| | | import com.vincent.rsf.server.manager.service.*; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | |
| | | task.setTaskCode(ruleCode) |
| | | .setTaskType(TaskType.TASK_TYPE_OUT.type) |
| | | .setTaskStatus(TaskStsType.GENERATE_OUT.id) |
| | | .setResource(TaskResouceType.TASK_RESOUCE_WAVE_TYPE.val) |
| | | .setBarcode(loc.getBarcode()) |
| | | .setOrgLoc(loc.getCode()) |
| | | .setCreateBy(loginUserId) |