| | |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.core.common.Cools; |
| | | import com.core.common.R; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.entity.*; |
| | | import com.zy.asrs.entity.param.StockOutParam; |
| | |
| | | private LocNormalService locNormalService; |
| | | @Autowired |
| | | private JdbcTemplate jdbcTemplate; |
| | | @Autowired |
| | | private OutStockService outStockService; |
| | | |
| | | @Override |
| | | public Page<OutStockBillEntry> queryOutStock(Page<OutStockBillEntry> page) { |
| | |
| | | if (jdbcTemplate.update(sql) > 0) { |
| | | sql = "select * from OutStockbillEntry where 1=1 and Fnumber = ''{0}'' and FInterID = {1,number,#}"; |
| | | sql = MessageFormat.format(sql, Fnumber, FInterID); |
| | | List<OutStockBillEntry> select = jdbcTemplate.queryForList(sql, OutStockBillEntry.class); |
| | | List<OutStockBillEntry> select = this.selectList(new EntityWrapper<OutStockBillEntry>().eq("Fnumber", Fnumber).eq("FInterID", FInterID)); |
| | | OutStockBillEntry outStockBillEntry = select.get(0); |
| | | boolean complete = false; |
| | | if (outStockBillEntry.getFQty().compareTo(BigDecimal.ZERO) == 1) { |
| | |
| | | @Override |
| | | @Transactional |
| | | public void startupFullTakeStore(StockOutParam param, Long userId) { |
| | | //判断出库熟练是否大于库存数量 |
| | | for (StockOutParam.LocDetl detl : param.getLocDetls()) { |
| | | // LocDetl locDetl = locDetlService.selectById(detl.getLocNo()); |
| | | LocDetl locDetl = locDetlService.selectOne(new EntityWrapper<LocDetl>().eq("loc_no",detl.getLocNo())); |
| | | if(locDetl != null){ |
| | | if(detl.getCount() > locDetl.getAnfme()){ |
| | | throw new CoolException("出库数量超过了库存数量[locNo=" + detl.getLocNo() + "]"); |
| | | } |
| | | } |
| | | } |
| | | //判断出库数量是否大于通知档数量 |
| | | Integer FInterI = outStockService.queryOutStockFInterID(param.getFbillNo()); // 获取出库单主表主键 |
| | | List<OutStockBillEntry> entryList = outStockService.selectList(new EntityWrapper<OutStockBillEntry>().eq("FInterID",FInterI)); |
| | | for(OutStockBillEntry one : entryList){ |
| | | String Fnumber = one.getFnumber(); |
| | | BigDecimal qty = new BigDecimal(0); |
| | | for (StockOutParam.LocDetl detl : param.getLocDetls()) { |
| | | if(detl.getMatnr().equals(Fnumber)){ |
| | | qty = qty.add(BigDecimal.valueOf(detl.getCount())); |
| | | } |
| | | } |
| | | if(qty.compareTo(one.getFQty()) == 1){ |
| | | throw new CoolException("出库数量大于通知档数量[FInterID=" + FInterI + ",Fnumber=" + Fnumber + "]"); |
| | | } |
| | | } |
| | | |
| | | // 目标站点状态检测 |
| | | BasDevp staNo = basDevpService.checkSiteStatus(param.getOutSite()); |
| | | // 获取库位明细 |
| | |
| | | if (!wrkDetlService.insert(wrkDetl)) { |
| | | throw new CoolException("保存工作档明细失败"); |
| | | } |
| | | |
| | | //更新出库通知档Famount字段,防止重复下发任务 2021-09-28 TQS ADD |
| | | Integer FInterI = outStockService.queryOutStockFInterID(fbillNo); // 获取出库单主表主键 |
| | | Wrapper wrapper1 = new EntityWrapper<OutStockBillEntry>().eq("FInterID",FInterI).eq("Fnumber",detlDto.getLocDetl().getMatnr()); |
| | | OutStockBillEntry outStockBillEntry = outStockService.selectOne(wrapper1); |
| | | outStockBillEntry.setFAmount(outStockBillEntry.getFAmount().add(BigDecimal.valueOf(anfme))); //借用amount字段,控制下发出库任务数量 |
| | | if(!outStockService.update(outStockBillEntry,wrapper1)){ |
| | | throw new CoolException("更新出库通知档明细FAmount失败[FInterID="+FInterI+",Fnumber="+detlDto.getLocDetl().getMatnr()+"]"); |
| | | } |
| | | } |
| | | // 修改库位状态: F.在库 ====>>> R.出库预约/P.拣料/盘点/并板出库中 |
| | | locMast = locMastService.selectById(dto.getLocNo()); |