| | |
| | | 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.manager.entity.Loc; |
| | | import com.vincent.rsf.server.manager.entity.Task; |
| | | import com.vincent.rsf.server.manager.entity.TaskItem; |
| | | import com.vincent.rsf.server.manager.entity.*; |
| | | import com.vincent.rsf.server.manager.enums.*; |
| | | import com.vincent.rsf.server.manager.mapper.LocItemMapper; |
| | | import com.vincent.rsf.server.manager.entity.LocItem; |
| | | import com.vincent.rsf.server.manager.service.LocItemService; |
| | | import com.vincent.rsf.server.manager.service.*; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.vincent.rsf.server.manager.service.LocService; |
| | | import com.vincent.rsf.server.manager.service.TaskItemService; |
| | | import com.vincent.rsf.server.manager.service.TaskService; |
| | | import com.vincent.rsf.server.system.constant.SerialRuleCode; |
| | | import com.vincent.rsf.server.system.utils.SerialRuleUtils; |
| | | import lombok.Synchronized; |
| | |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | import java.lang.reflect.Array; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Service("locItemService") |
| | |
| | | private TaskItemService taskItemService; |
| | | @Autowired |
| | | private LocItemService locItemService; |
| | | @Autowired |
| | | private DeviceSiteService deviceSiteService; |
| | | |
| | | |
| | | /** |
| | |
| | | throw new CoolException("托盘任务执行中,不能重复创建!"); |
| | | } |
| | | |
| | | List<Integer> list = Arrays.asList(TaskType.TASK_TYPE_CHECK_OUT.type, TaskType.TASK_TYPE_PICK_AGAIN_OUT.type); |
| | | |
| | | if (type.equals("stock")) { |
| | | Double useQty = Math.round((outQty + workQty) * 10000) / 10000.0; |
| | | if (orgQty.compareTo(useQty) > 0) { |
| | | //拣料出库 |
| | | task.setTaskType(TaskType.TASK_TYPE_PICK_AGAIN_OUT.type); |
| | | |
| | | DeviceSite deviceSite = deviceSiteService.getOne(new LambdaQueryWrapper<DeviceSite>() |
| | | .eq(DeviceSite::getSite, loc.getCode()).eq(DeviceSite::getType, TaskType.TASK_TYPE_PICK_AGAIN_OUT.type) ); |
| | | if (Objects.isNull(deviceSite)) { |
| | | throw new CoolException("站点支持拣料出库!!"); |
| | | } |
| | | } else { |
| | | //全板出库 |
| | | task.setTaskType(TaskType.TASK_TYPE_OUT.type); |
| | | DeviceSite deviceSite = deviceSiteService.getOne(new LambdaQueryWrapper<DeviceSite>() |
| | | .eq(DeviceSite::getSite, loc.getCode()).eq(DeviceSite::getType, TaskType.TASK_TYPE_OUT.type) ); |
| | | if (Objects.isNull(deviceSite)) { |
| | | throw new CoolException("站点支持全板出库!!"); |
| | | } |
| | | } |
| | | } else if (type.equals("check")) { |
| | | //盘点出库 |
| | | task.setTaskType(TaskType.TASK_TYPE_CHECK_OUT.type); |
| | | DeviceSite deviceSite = deviceSiteService.getOne(new LambdaQueryWrapper<DeviceSite>() |
| | | .eq(DeviceSite::getSite, loc.getCode()).eq(DeviceSite::getType, TaskType.TASK_TYPE_CHECK_OUT.type) ); |
| | | if (Objects.isNull(deviceSite)) { |
| | | throw new CoolException("站点支持盘点出库!!"); |
| | | } |
| | | } |
| | | |
| | | |
| | | if (!taskService.save(task)) { |
| | | throw new CoolException("任务创建失败!!"); |
| | | } |
| | |
| | | throw new CoolException("库存信息不存在!"); |
| | | } |
| | | |
| | | if (item.getOutQty().compareTo(0.0) < 0) { |
| | | throw new CoolException("出库数里不能小于0!!"); |
| | | } |
| | | |
| | | if (locItem.getAnfme().compareTo(qty) < 0) { |
| | | Double minusQty = Math.round((locItem.getAnfme() - locItem.getWorkQty()) * 10000) / 10000.0; |
| | | item.setWorkQty(minusQty); |