| | |
| | | import com.core.common.Cools; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.entity.BasDevp; |
| | | import com.zy.asrs.entity.LocMast; |
| | | import com.zy.asrs.entity.MatCodeCountDto; |
| | | import com.zy.asrs.entity.WrkMast; |
| | | import com.zy.asrs.entity.param.FullStoreParam; |
| | | import com.zy.asrs.service.BasDevpService; |
| | | import com.zy.asrs.service.WorkService; |
| | | import com.zy.asrs.service.WrkMastService; |
| | | import com.zy.asrs.service.*; |
| | | import com.zy.common.model.StartupDto; |
| | | import com.zy.common.service.CommonService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * Created by vincent on 2020/6/11 |
| | |
| | | private BasDevpService basDevpService; |
| | | @Autowired |
| | | private CommonService commonService; |
| | | @Autowired |
| | | private WrkDetlService wrkDetlService; |
| | | @Autowired |
| | | private LocMastService locMastService; |
| | | |
| | | @Override |
| | | @Transactional |
| | |
| | | throw new CoolException(BaseRes.PARAM); |
| | | } |
| | | // 源站点状态检测 |
| | | BasDevp staNo = basDevpService.checkSiteStatus(param.getDevpNo()); |
| | | BasDevp sourceStaNo = basDevpService.checkSiteStatus(param.getDevpNo()); |
| | | // 生成工作号 |
| | | int workNo = commonService.getWorkNo(0); |
| | | if (workNo == 0) { |
| | |
| | | wrkMast.setExitMk("N"); // 退出 |
| | | wrkMast.setEmptyMk("N"); // 空板 |
| | | wrkMast.setLinkMis("N"); |
| | | wrkMast.setCtnType(staNo.getCtnType()); // 容器类型 |
| | | wrkMast.setCtnType(sourceStaNo.getCtnType()); // 容器类型 |
| | | // 操作人员数据 |
| | | wrkMast.setAppeUser(userId); |
| | | wrkMast.setAppeTime(new Date()); |
| | |
| | | wrkMast.setModiTime(new Date()); |
| | | boolean res = wrkMastService.insert(wrkMast); |
| | | if (!res) { |
| | | throw new CoolException("注入sql失败"); |
| | | throw new CoolException("保存工作档失败"); |
| | | } |
| | | |
| | | // 生成工作档明细 |
| | | |
| | | List<MatCodeCountDto> matDtos = new ArrayList<>(); |
| | | param.getList().forEach(elem -> { |
| | | matDtos.add(new MatCodeCountDto(elem.getMatNo(), elem.getCount())); |
| | | }); |
| | | wrkDetlService.createWorkDetail(workNo, matDtos, userId); |
| | | // 更新源站点信息 |
| | | sourceStaNo.setWrkNo(workNo); |
| | | sourceStaNo.setModiUser(userId); |
| | | sourceStaNo.setModiTime(new Date()); |
| | | if (!basDevpService.updateById(sourceStaNo)){ |
| | | throw new CoolException("更新源站失败"); |
| | | } |
| | | // 更新目标库位状态 |
| | | LocMast locMast = locMastService.selectById(dto.getLocNo()); |
| | | if (locMast.getLocType().equals("O")){ |
| | | locMast.setLocType("S"); // S.入库预约 |
| | | locMast.setModiUser(userId); |
| | | locMast.setModiTime(new Date()); |
| | | if (!locMastService.updateById(locMast)){ |
| | | throw new CoolException("改变库位状态失败"); |
| | | } |
| | | } else { |
| | | throw new CoolException(dto.getLocNo()+"目标库位已被占用"); |
| | | } |
| | | } |
| | | |
| | | } |