| | |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.core.common.Cools; |
| | | import com.core.common.DateUtils; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.entity.OrderDetl; |
| | | import com.zy.asrs.entity.Pla; |
| | |
| | | @Autowired |
| | | private PlaQtyService plaQtyService; |
| | | |
| | | public Pla selectByBatchAndPackageNo(String batch, Integer packageNo) { |
| | | return this.selectOne(new EntityWrapper<Pla>().eq("batch",batch).eq("package_no",packageNo)); |
| | | public Pla selectByBatchAndPackageNo(String batch, Integer packageNo, String brand) { |
| | | return this.selectOne(new EntityWrapper<Pla>().eq("batch",batch).eq("package_no",packageNo).eq("brand",brand).eq(false,"status","全部出库")); |
| | | } |
| | | |
| | | @Override |
| | |
| | | plaQtyService.insert(plaQtyReturned); |
| | | |
| | | //直接更新pla的库存 |
| | | Pla pla = this.selectByBatchAndPackageNo(plaQty.getBatch(), plaQty.getPackageNo()); |
| | | Pla pla = this.selectByBatchAndPackageNo(plaQty.getBatch(), plaQty.getPackageNo(),plaQty.getBrand()); |
| | | //pla.setStatus(GlobleParameter.PLA_STATUS_0); |
| | | pla.setModifyTime(new Date()); |
| | | |
| | |
| | | pla.setStatus(GlobleParameter.PLA_STATUS_1); |
| | | this.updateById(pla); |
| | | |
| | | SaasUtils.insertLog(0,pla.getLocNo(),pla.getBrand(),plaQty.getOrderWeight(),user.getUsername(),null,pla.getBatch(),pla.getPackageNo()); |
| | | SaasUtils.insertLog(0,pla.getLocNo(),pla.getBrand(),plaQty.getOrderWeight(),user.getUsername(), |
| | | null,pla.getBatch(),pla.getPackageNo(),pla.getOwner(),pla.getWorkshop()); |
| | | |
| | | }); |
| | | } |
| | |
| | | @Override |
| | | public Page<Pla> getStockStatisAll(Page<Pla> page) { |
| | | |
| | | if(Cools.isEmpty(page.getCondition().get("brand"))){ |
| | | page.setRecords(baseMapper.getStockStatisAll()); |
| | | }else { |
| | | page.setRecords(baseMapper.getStockStatisAllByBrand(page.getCondition().get("brand").toString())); |
| | | List<Pla> plaList; |
| | | Date stime = null; |
| | | Date etime = null; |
| | | Object create_time = page.getCondition().get("create_time"); |
| | | Object brand = page.getCondition().get("brand"); |
| | | Object status = page.getCondition().get("status"); |
| | | String createTime = create_time == null ? null : create_time.toString(); |
| | | if(!Cools.isEmpty(createTime)){ |
| | | String[] dates = createTime.split(" - "); |
| | | stime = DateUtils.convert(dates[0]); |
| | | etime = DateUtils.convert(dates[1]); |
| | | } |
| | | plaList=baseMapper.getStockStatisAll(brand == null ? null:brand.toString(), status == null ? null:status.toString(), stime,etime); |
| | | |
| | | double weightSum = plaList.stream().mapToDouble(Pla::getWeight).sum(); |
| | | |
| | | // 最后一条记录仅供合计重量信息展示 |
| | | Pla pla = new Pla(); |
| | | pla.setBrand("合计"); |
| | | pla.setMatnr(""); |
| | | pla.setWeight(weightSum); |
| | | plaList.add(pla); |
| | | |
| | | page.setRecords(plaList); |
| | | page.setTotal(0); |
| | | return page; |
| | | } |