| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.vincent.rsf.framework.common.Cools; |
| | | import com.vincent.rsf.server.api.controller.params.TaskInParam; |
| | | import com.vincent.rsf.server.api.controller.erp.params.TaskInParam; |
| | | import com.vincent.rsf.server.api.entity.dto.InTaskMsgDto; |
| | | import com.vincent.rsf.server.api.service.WcsService; |
| | | import com.vincent.rsf.server.common.constant.Constants; |
| | |
| | | |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | import java.util.stream.Stream; |
| | | |
| | | @Service("taskService") |
| | | public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements TaskService { |
| | |
| | | //保存入出库流水 |
| | | saveStockItems(taskItems, task, null, null, taskItem.getWkType(), taskItem.getOrderType(), loginUserId); |
| | | |
| | | if (!locItemWorkingService.remove(new LambdaQueryWrapper<LocItemWorking>().eq(LocItemWorking::getTaskId, task.getId()))) { |
| | | throw new CoolException("作业中库存删除失败!!"); |
| | | } |
| | | locItemWorkingService.remove(new LambdaQueryWrapper<LocItemWorking>().eq(LocItemWorking::getTaskId, task.getId())); |
| | | |
| | | task.setTaskStatus(TaskStsType.UPDATED_IN.id).setUpdateTime(new Date()).setUpdateBy(loginUserId); |
| | | if (!taskService.updateById(task)) { |
| | |
| | | } catch (Exception e) { |
| | | throw new CoolException(e.getMessage()); |
| | | } |
| | | } else if (task.getResource().equals(TaskResouceType.TASK_RESOUCE_ORDER_TYPE.val) |
| | | || task.getResource().equals(TaskResouceType.TASK_RESOUCE_CHECK_TYPE.val)) { |
| | | } else if (task.getResource().equals(TaskResouceType.TASK_RESOUCE_ORDER_TYPE.val)) { |
| | | WkOrderItem orderItem = asnOrderItemService.getById(key); |
| | | if (Objects.isNull(orderItem)) { |
| | | throw new CoolException("单据明细不存在!!"); |
| | | } |
| | | try { |
| | | saveOutStockItem(maps.get(key), orderItem, null, null, loginUserId); |
| | | saveOutStockItem(maps.get(key), orderItem, loginUserId); |
| | | } catch (Exception e) { |
| | | throw new CoolException(e.getMessage()); |
| | | } |
| | | } else if (task.getResource().equals(TaskResouceType.TASK_RESOUCE_CHECK_TYPE.val)) { |
| | | WkOrderItem orderItem = asnOrderItemService.getById(key); |
| | | if (Objects.isNull(orderItem)) { |
| | | throw new CoolException("单据明细不存在!!"); |
| | | } |
| | | try { |
| | | saveOutStockItem(maps.get(key), null, null, orderItem, loginUserId); |
| | | } catch (Exception e) { |
| | | throw new CoolException(e.getMessage()); |
| | | } |
| | |
| | | * @version 1.0 |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void saveOutStockItem(List<TaskItem> taskItems, CheckDiffItem diffItem, Long loginUserId) { |
| | | public void saveOutStockItem(List<TaskItem> taskItems, WkOrderItem diffItem, Long loginUserId) { |
| | | try { |
| | | saveOutStockItem(taskItems, null, null, diffItem, loginUserId); |
| | | } catch (Exception e) { |
| | |
| | | * @version 1.0 |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void saveOutStockItem(List<TaskItem> taskItems, WkOrderItem orderItem, WaveItem waveItem, CheckDiffItem diffItem, Long loginUserId) throws Exception { |
| | | public void saveOutStockItem(List<TaskItem> taskItems, WkOrderItem orderItem, WaveItem waveItem, WkOrderItem diffItem, Long loginUserId) throws Exception { |
| | | Stock stock = new Stock(); |
| | | String ruleCode = SerialRuleUtils.generateRuleCode(SerialRuleCode.SYS_STOCK_CODE, null); |
| | | if (StringUtils.isBlank(ruleCode)) { |