| | |
| | | import com.zy.common.model.OutLocDto; |
| | | import com.zy.common.model.StartupDto; |
| | | import com.zy.common.service.CommonService; |
| | | import com.zy.ints.entity.WaitMatchk; |
| | | import com.zy.ints.entity.WaitMatout; |
| | | import com.zy.ints.service.WaitMatchkService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | */ |
| | | @Service |
| | | public class WorkServiceImpl implements WorkService { |
| | | static int i =1; |
| | | |
| | | // 工作号生成规则默认类型 |
| | | private static final int DEFAULT_WORK_NO_TYPE = 0; |
| | |
| | | private WrkMastLogService wrkMastLogService; |
| | | @Autowired |
| | | private WrkDetlLogService wrkDetlLogService; |
| | | |
| | | @Autowired |
| | | private WaitMatchkService waitMatchkService; |
| | | |
| | | @Override |
| | | @Transactional |
| | |
| | | @Override |
| | | @Transactional |
| | | public void stockOut(BasDevp staNo, List<LocDetlDto> locDetlDtos, Integer ioType, Long userId) { |
| | | |
| | | // 合并同类项 |
| | | Set<String> locNos = new HashSet<>(); |
| | | locDetlDtos.forEach(dto -> locNos.add(dto.getLocDetl().getLocNo())); |
| | |
| | | LocDetlDto dto = iterator.next(); |
| | | if (locNo.equals(dto.getLocDetl().getLocNo())) { |
| | | list.add(dto); |
| | | iterator.remove(); |
| | | // iterator.remove(); |
| | | } |
| | | } |
| | | dtos.add(new OutLocDto(locNo, list)); |
| | | } |
| | | //生成盘点文档 |
| | | for (LocDetlDto locDetlDto : locDetlDtos) { |
| | | String replace = UUID.randomUUID().toString().replace("-", ""); |
| | | LocDetl locDetl = locDetlDto.getLocDetl(); |
| | | //生成盘点档 |
| | | WaitMatchk waitMatchk = new WaitMatchk(); |
| | | waitMatchk.setBillNo(replace);//订单编号 |
| | | waitMatchk.setLocNo(locDetl.getLocNo());//库位号 |
| | | waitMatchk.setStockQty(locDetl.getQty()); |
| | | waitMatchk.setMatNo(locDetl.getMatNo());//产品编号 |
| | | waitMatchk.setMatName(locDetl.getMatName());//铲平名称 |
| | | waitMatchk.setSeqNo(i); |
| | | waitMatchk.setIoTime(new Date()); |
| | | waitMatchk.setZpallet(locDetl.getZpallet()); |
| | | waitMatchk.setAppeUser(userId); // 操作人员数据 |
| | | waitMatchk.setAppeTime(new Date()); |
| | | waitMatchk.setModiUser(userId); |
| | | waitMatchk.setModiTime(new Date()); |
| | | if (!waitMatchkService.insert(waitMatchk)){ |
| | | throw new CoolException("保存盘点档失败"); |
| | | } |
| | | i++; |
| | | } |
| | | |
| | | // 生成工作档 |
| | | for (OutLocDto dto : dtos) { |
| | | |
| | | // 判断入出库类型:101.全板出库 or 103.拣料出库 |
| | | if (ioType == null) { |
| | | ioType = dto.isAll() ? 101 : 103; |
| | |
| | | } |
| | | // 生成工作号 |
| | | int workNo = commonService.getWorkNo(DEFAULT_WORK_NO_TYPE); |
| | | |
| | | |
| | | // 生成工作档 |
| | | WrkMast wrkMast = new WrkMast(); |
| | | wrkMast.setWrkNo(workNo); |