| | |
| | | |
| | | import javax.validation.Valid; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | SysUser user = tokenService.getLoginUser().getUser(); |
| | | return R.ok(erpGoodsService.pageInventoryGoodsPageList(query,user)); |
| | | } |
| | | @ApiOperation(value = "有效期预警商品选择") |
| | | @GetMapping(value = "/pageInventoryGoodsList") |
| | | public R<List<TErpGoodsInventoryVO>> pageInventoryGoodsList(@RequestParam String warehouseId,@RequestParam(required = false)String batchNumber) { |
| | | SysUser user = tokenService.getLoginUser().getUser(); |
| | | List<TErpGoodsInventoryVO> tErpGoodsInventoryVOS = erpGoodsService.pageInventoryGoodsList(warehouseId, user); |
| | | if(batchNumber!=null && !"".equals(batchNumber)){ |
| | | tErpGoodsInventoryVOS = tErpGoodsInventoryVOS.stream().filter(e->e.getBatchNumber().equals(batchNumber)).collect(Collectors.toList()); |
| | | } |
| | | return R.ok(tErpGoodsInventoryVOS); |
| | | } |
| | | |
| | | @ApiOperation(value = "供应商 确认盘点") |
| | | @PostMapping(value = "/inventoryGoods") |
| | |
| | | List<TErpGoodsVO> listExport(@Param("query") TErpGoodsQuery query, @Param("user") SysUser user); |
| | | |
| | | List<TErpGoodsInventoryVO> pageInventoryGoodsPageList(@Param("query") TErpGoodsInventoryQuery query, @Param("pageInfo") PageInfo<TErpGoodsInventoryVO> pageInfo, @Param("user") SysUser user, @Param("supplierClinicId") String supplierClinicId, @Param("time") Date time); |
| | | |
| | | List<TErpGoodsInventoryVO> pageInventoryGoodsList(@Param("warehouseId") String warehouseId, @Param("user") SysUser user, @Param("supplierClinicId") String supplierClinicId, @Param("endDate") Date endDate); |
| | | |
| | | } |
| | |
| | | void inventoryGoods(InventoryDto dto, SysUser user); |
| | | |
| | | |
| | | List<TErpGoodsInventoryVO> pageInventoryGoodsList(@Valid String warehouseId, SysUser user); |
| | | |
| | | |
| | | } |
| | |
| | | pageInfo.setRecords(list); |
| | | return pageInfo; |
| | | } |
| | | @Override |
| | | public List<TErpGoodsInventoryVO> pageInventoryGoodsList(String warehouseId, SysUser user) { |
| | | Integer roleType = user.getRoleType(); |
| | | String supplierClinicId = null; |
| | | if(roleType == 4){ |
| | | // 供应商 |
| | | TCrmSupplier crmSupplier = crmSupplierMapper.selectOne(Wrappers.lambdaQuery(TCrmSupplier.class) |
| | | .eq(TCrmSupplier::getUserId, user.getUserId()) |
| | | .last("LIMIT 1")); |
| | | supplierClinicId =crmSupplier.getId(); |
| | | } |
| | | if(roleType == 5){ |
| | | // 诊所 |
| | | TCrmClinic crmClinic = crmClinicMapper.selectOne(Wrappers.lambdaQuery(TCrmClinic.class) |
| | | .eq(TCrmClinic::getUserId, user.getUserId()) |
| | | .last("LIMIT 1")); |
| | | supplierClinicId =crmClinic.getId(); |
| | | } |
| | | |
| | | // 当前时间一个月后 |
| | | Date endDate = DateUtils.addMonths(DateUtils.getNowDate(), 1); |
| | | |
| | | List<TErpGoodsInventoryVO> list = this.baseMapper.pageInventoryGoodsList(warehouseId, user,supplierClinicId,endDate); |
| | | if (list.isEmpty()) { |
| | | return list; |
| | | } |
| | | List<String> typeIds = list.stream().map(TErpGoodsInventoryVO::getTypeId).collect(Collectors.toList()); |
| | | if (!typeIds.isEmpty()) { |
| | | List<TErpGoodsType> typeList = erpGoodsTypeMapper.selectBatchIds(typeIds); |
| | | for (TErpGoodsInventoryVO tErpGoodsVO : list) { |
| | | typeList.stream().filter(t -> t.getId().equals(tErpGoodsVO.getTypeId())).findFirst().ifPresent(t -> tErpGoodsVO.setTypeName(t.getTypeName())); |
| | | tErpGoodsVO.setTypeName(tErpGoodsVO.getTypeName()); |
| | | } |
| | | } |
| | | List<String> packingUnitId = list.stream().map(TErpGoodsInventoryVO::getPackingUnitId).collect(Collectors.toList()); |
| | | if (!packingUnitId.isEmpty()) { |
| | | List<TErpGoodsUnit> tErpGoodsUnits = erpGoodsUnitMapper.selectBatchIds(packingUnitId); |
| | | for (TErpGoodsInventoryVO tErpGoodsVO : list) { |
| | | tErpGoodsUnits.stream().filter(t -> t.getId().equals(tErpGoodsVO.getPackingUnitId())).findFirst().ifPresent(t -> tErpGoodsVO.setPackingUnitName(t.getUnitName())); |
| | | } |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | @Override |
| | | public void inventoryGoods(InventoryDto dto, SysUser user) { |
| | |
| | | where (o.warehousing_number -o.outbound_count) >0 |
| | | order by o.create_time desc |
| | | </select> |
| | | <select id="pageInventoryGoodsList" resultType="com.ruoyi.system.vo.TErpGoodsInventoryVO"> |
| | | select * from ( |
| | | SELECT t1.id,t2.warehouse_no, |
| | | t3.goods_name, |
| | | t4.supplier_name, |
| | | t3.type_id, |
| | | t3.packing_unit_id, |
| | | t3.quasi_number, |
| | | t3.goods_id_code, |
| | | t1.batch_number, |
| | | coalesce(sum(t5.outbound_count),0) as outbound_count, |
| | | t1.warehousing_number, |
| | | t2.create_time, |
| | | t1.warehousing_number - coalesce(sum(t5.outbound_count),0) as num, |
| | | t2.unit_amount as sales_amount, |
| | | t1.expiry_date |
| | | from t_erp_supplier_warehousing_batch t1 |
| | | LEFT JOIN t_erp_supplier_warehousing t2 on t1.warehousing_id = t2.id |
| | | LEFT JOIN t_erp_goods t3 on t2.goods_id = t3.id |
| | | LEFT JOIN t_crm_supplier t4 on t3.supplier_clinic_id = t4.id |
| | | LEFT JOIN t_erp_supplier_outbound_goods t5 on t5.warehousing_batch_id =t1.id |
| | | where t2.disabled = 0 and t2.warehouse_id = #{warehouseId} |
| | | and #{time} > t1.expiry_date |
| | | <if test="user.roleType !=null and user.roleType ==4"> |
| | | and t3.supplier_clinic_id =#{supplierClinicId} and t3.goods_source=1 |
| | | </if> |
| | | <if test="user.roleType !=null and user.roleType ==5"> |
| | | and t3.supplier_clinic_id =#{supplierClinicId} and t3.goods_source=2 |
| | | </if> |
| | | |
| | | GROUP BY t1.id |
| | | ) as o |
| | | where (o.warehousing_number -o.outbound_count) >0 |
| | | order by o.create_time desc |
| | | </select> |
| | | |
| | | </mapper> |