Merge remote-tracking branch 'origin/htasrs0' into htasrs0
| | |
| | | import com.zy.asrs.service.*; |
| | | import com.zy.common.model.LocDetlDto; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.jdbc.core.JdbcTemplate; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.*; |
| | | |
| | |
| | | private BasDevpService basDevpService; |
| | | @Autowired |
| | | private WrkMastService wrkMastService; |
| | | @Autowired |
| | | private JdbcTemplate jdbcTemplate; |
| | | |
| | | @PostMapping("/stockOut/prew") |
| | | @Transactional |
| | |
| | | if (issued > 0) { |
| | | // 生成出库工作档 |
| | | |
| | | int priorCount = jdbcTemplate.queryForObject("select isnull(count(*),0) from man_prior where 1=1 and matnr = '" + param.getMatnr() + "'", Integer.class); |
| | | |
| | | // 全板 |
| | | if (issued>=locDetl.getAnfme()) { |
| | | BasDevp staNo = basDevpService.checkSiteStatus(103); |
| | |
| | | dto.setLocDetl(locDetl); |
| | | dto.setCount(issued>=locDetl.getAnfme()?locDetl.getAnfme():issued); |
| | | detlDtos.add(dto); |
| | | workService.stockOut(staNo, detlDtos, 101, 9527L, param.getAllotNo(), Cools.isEmpty(param.getAllotNo())); |
| | | workService.stockOut(staNo, detlDtos, 101, 9527L, param.getAllotNo(), Cools.isEmpty(param.getAllotNo()), null); |
| | | // 拣料 |
| | | } else { |
| | | BasDevp staNo = basDevpService.checkSiteStatus(107); |
| | | List<LocDetlDto> detlDtos = new ArrayList<>(); |
| | | LocDetlDto dto = new LocDetlDto(); |
| | | dto.setLocDetl(locDetl); |
| | | dto.setCount(issued>=locDetl.getAnfme()?locDetl.getAnfme():issued); |
| | | detlDtos.add(dto); |
| | | workService.stockOut(staNo, detlDtos, 103, 9527L, param.getAllotNo(), Cools.isEmpty(param.getAllotNo())); |
| | | |
| | | if (priorCount > 0) { |
| | | BasDevp staNo = basDevpService.checkSiteStatus(103); |
| | | List<LocDetlDto> detlDtos = new ArrayList<>(); |
| | | LocDetlDto dto = new LocDetlDto(); |
| | | dto.setLocDetl(locDetl); |
| | | dto.setCount(locDetl.getAnfme()); |
| | | detlDtos.add(dto); |
| | | workService.stockOut(staNo, detlDtos, 101, 9527L, param.getAllotNo(), Cools.isEmpty(param.getAllotNo()), locDetl.getAnfme()-issued); |
| | | } else { |
| | | BasDevp staNo = basDevpService.checkSiteStatus(113); |
| | | List<LocDetlDto> detlDtos = new ArrayList<>(); |
| | | LocDetlDto dto = new LocDetlDto(); |
| | | dto.setLocDetl(locDetl); |
| | | dto.setCount(issued>=locDetl.getAnfme()?locDetl.getAnfme():issued); |
| | | detlDtos.add(dto); |
| | | workService.stockOut(staNo, detlDtos, 103, 9527L, param.getAllotNo(), Cools.isEmpty(param.getAllotNo()), null); |
| | | } |
| | | |
| | | } |
| | | |
| | | PakoutVo pakoutVo = new PakoutVo(); |
| | |
| | | * @param locDetls 待出库物料 |
| | | * @param ioType 入出库类型 |
| | | */ |
| | | void stockOut(BasDevp staNo, List<LocDetlDto> locDetls, Integer ioType, Long userId, String allotNo, Boolean sell); |
| | | void stockOut(BasDevp staNo, List<LocDetlDto> locDetls, Integer ioType, Long userId, String allotNo, Boolean sell, Double more); |
| | | |
| | | /** |
| | | * 空板入库 |
| | |
| | | } |
| | | if (!locDetlDtos.isEmpty()) { |
| | | // 启动出库开始 101.出库 |
| | | stockOut(staNo, locDetlDtos, null, userId, null, false); |
| | | stockOut(staNo, locDetlDtos, null, userId, null, false, null); |
| | | } else { |
| | | throw new CoolException("库位物料不存在"); |
| | | } |
| | |
| | | |
| | | @Override |
| | | @Transactional |
| | | public void stockOut(BasDevp staNo, List<LocDetlDto> locDetlDtos, Integer ioType, Long userId, String allotNo, Boolean sell) { |
| | | public void stockOut(BasDevp staNo, List<LocDetlDto> locDetlDtos, Integer ioType, Long userId, String allotNo, Boolean sell, Double more) { |
| | | // 合并同类项 |
| | | Set<String> locNos = new HashSet<>(); |
| | | locDetlDtos.forEach(dto -> locNos.add(dto.getLocDetl().getLocNo())); |
| | |
| | | wrkMast.setLinkMis("N"); |
| | | wrkMast.setPacked(allotNo); // 平仓补仓单号 |
| | | wrkMast.setPdcType(sell?"Y":"N"); // ERP销售订单出库任务 |
| | | wrkMast.setRefWrkno(more==null?0.0D:more); |
| | | wrkMast.setAppeUser(userId); // 操作人员数据 |
| | | wrkMast.setAppeTime(new Date()); |
| | | wrkMast.setModiUser(userId); |
| | |
| | | } |
| | | if (!locDetlDtos.isEmpty()) { |
| | | // 启动出库开始 107.盘点出库 |
| | | stockOut(staNo, locDetlDtos, 107, userId, null, false); |
| | | stockOut(staNo, locDetlDtos, 107, userId, null, false, null); |
| | | } else { |
| | | throw new CoolException("库位物料不存在"); |
| | | } |
| | |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Optional; |
| | | |
| | | /** |
| | | * Created by vincent on 2020/7/6 |
| | |
| | | if (result.getCode() != 200) { |
| | | exceptionHandle("补货到平仓[workNo={0}]失败", wrkMast.getWrkNo()); |
| | | } |
| | | // 销售订单 |
| | | } else { |
| | | if (wrkMast.getIoType() == 101) { |
| | | Double more = Optional.ofNullable(wrkMast.getRefWrkno()).orElse(0.0D); |
| | | List<WrkDetl> wrkDetls = wrkDetlService.selectList(new EntityWrapper<WrkDetl>().eq("wrk_no", wrkMast.getWrkNo())); |
| | | if (more > 0 && !Cools.isEmpty(wrkDetls)) { |
| | | WrkDetl wrkDetl = wrkDetls.get(0); |
| | | ReplenishDto param = new ReplenishDto(); |
| | | param.setMatnr(wrkDetl.getMatnr()); |
| | | param.setCount(more); |
| | | List<ReplenishDto> replenishDtos = new ArrayList<>(); |
| | | replenishDtos.add(param); |
| | | Result result = wmsService.replenish(replenishDtos); |
| | | if (result.getCode() != 200) { |
| | | exceptionHandle("补货到平仓[workNo={0}]失败", wrkMast.getWrkNo()); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | @Value("${wms.url}") |
| | | private String wmsUrl; |
| | | |
| | | // // todo:luxiaotao |
| | | // public Result replenish(List<ReplenishDto> dtos) { |
| | | // return new Result(200, "操作成功", null); |
| | | // } |
| | | |
| | | public Result replenish(List<ReplenishDto> dtos) { |
| | | try { |
| | | ReplenishParam param = new ReplenishParam(); |