| | |
| | | import com.ruoyi.system.dto.*; |
| | | import com.ruoyi.system.importExcel.TErpGoodsExcel; |
| | | import com.ruoyi.system.model.*; |
| | | import com.ruoyi.system.query.TErpGoodsAdminQuery; |
| | | import com.ruoyi.system.query.TErpGoodsQuery; |
| | | import com.ruoyi.system.service.*; |
| | | import com.ruoyi.system.vo.TErpGoodsVO; |
| | |
| | | query.setSupplierClinicId(crmClinic.getId()); |
| | | } |
| | | return R.ok(erpGoodsService.pageList(query,user)); |
| | | } |
| | | |
| | | /** |
| | | * 获取erp问题上报管理列表 |
| | | */ |
| | | @ApiOperation(value = "平台获取商品分页列表") |
| | | @PostMapping(value = "/pageAdminList") |
| | | public R<PageInfo<TErpGoodsVO>> pageAdminList(@RequestBody TErpGoodsAdminQuery query) { |
| | | SysUser user = tokenService.getLoginUser().getUser(); |
| | | Integer roleType = user.getRoleType(); |
| | | if(roleType == 1){ |
| | | // 平台 |
| | | return R.ok(erpGoodsService.pageAdminList(query)); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | |
| | | return R.ok(erpGoodsService.updateById(goods)); |
| | | } |
| | | |
| | | @ApiOperation(value = "供应商商品详情") |
| | | @ApiOperation(value = "商品详情") |
| | | @GetMapping(value = "/detail/{id}") |
| | | public R<TErpGoods> detail( @PathVariable String id) { |
| | | TErpGoods goods = erpGoodsService.getById(id); |
| | |
| | | @ApiOperation(value = "获取erp问题上报分页列表") |
| | | @PostMapping(value = "/pageList") |
| | | public R<PageInfo<TErpIssueReportingVO>> pageList(@RequestBody TErpIssueReportingQuery query) { |
| | | Integer roleType = tokenService.getLoginUser().getUser().getRoleType(); |
| | | Long userId = tokenService.getLoginUser().getUserId(); |
| | | if(roleType == 4){ |
| | | query.setReportType(1); |
| | | TCrmSupplier crmSupplier = crmSupplierService.getOne(Wrappers.lambdaQuery(TCrmSupplier.class) |
| | | .eq(TCrmSupplier::getUserId, userId) |
| | | .last("LIMIT 1")); |
| | | query.setReportUserId(crmSupplier.getId()); |
| | | } |
| | | if(roleType == 5){ |
| | | query.setReportType(2); |
| | | TCrmClinic crmClinic = crmClinicService.getOne(Wrappers.lambdaQuery(TCrmClinic.class) |
| | | .eq(TCrmClinic::getUserId, userId) |
| | | .last("LIMIT 1")); |
| | | query.setReportUserId(crmClinic.getId()); |
| | | } |
| | | return R.ok(erpIssueReportingService.pageList(query)); |
| | | } |
| | | |
| | |
| | | |
| | | import javax.validation.Valid; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | private final TErpClinicWarehousingService erpClinicWarehousingService; |
| | | private final TErpClinicWarehousingBatchService erpClinicWarehousingBatchService; |
| | | private final TCrmSupplierService crmSupplierService; |
| | | private final TErpMaintenanceReminderService erpMaintenanceReminderService; |
| | | |
| | | |
| | | @Autowired |
| | | public TErpProcurementController(TErpProcurementService erpProcurementService, TokenService tokenService,TCrmClinicService crmClinicService,TErpProcurementGoodsService erpProcurementGoodsService |
| | | , TErpGoodsService erpGoodsService,TErpClinicWarehousingService erpClinicWarehousingService,TErpClinicWarehousingBatchService erpClinicWarehousingBatchService, |
| | | TCrmSupplierService crmSupplierService) { |
| | | TCrmSupplierService crmSupplierService,TErpMaintenanceReminderService erpMaintenanceReminderService) { |
| | | this.erpProcurementService = erpProcurementService; |
| | | this.tokenService = tokenService; |
| | | this.crmClinicService = crmClinicService; |
| | |
| | | this.erpClinicWarehousingService = erpClinicWarehousingService; |
| | | this.erpClinicWarehousingBatchService = erpClinicWarehousingBatchService; |
| | | this.crmSupplierService = crmSupplierService; |
| | | this.erpMaintenanceReminderService = erpMaintenanceReminderService; |
| | | } |
| | | |
| | | |
| | |
| | | tErpClinicWarehousingGoods.setSalesAmount(tErpProcurementGoods.getSalesAmount()); |
| | | erpClinicWarehousingBatchService.save(tErpClinicWarehousingGoods); |
| | | |
| | | |
| | | if(erpGoods.getMaintenanceInterval()!=null){ |
| | | TErpMaintenanceReminder tErpMaintenanceReminder = new TErpMaintenanceReminder(); |
| | | tErpMaintenanceReminder.setClinicSupplierId(clinicSupplierId); |
| | | tErpMaintenanceReminder.setMaintenanceType(2); |
| | | tErpMaintenanceReminder.setWarehousingBatchId(tErpClinicWarehousingGoods.getId()); |
| | | Integer day = Integer.valueOf(erpGoods.getMaintenanceInterval()); |
| | | // 当前时间+day天 |
| | | LocalDateTime time1 = LocalDateTime.now().plusDays(day); |
| | | tErpMaintenanceReminder.setMaintenanceTime(time1); |
| | | erpMaintenanceReminderService.save(tErpMaintenanceReminder); |
| | | } |
| | | |
| | | |
| | | } |
| | | return R.ok(); |
| | | } |
| | |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import com.ruoyi.system.model.TErpGoods; |
| | | import com.ruoyi.system.query.TErpGoodsAdminQuery; |
| | | import com.ruoyi.system.query.TErpGoodsInventoryQuery; |
| | | import com.ruoyi.system.query.TErpGoodsQuery; |
| | | import com.ruoyi.system.vo.TErpGoodsInventoryVO; |
| | |
| | | TErpGoods getGoodsById(@Param("goodsId") String goodsId); |
| | | |
| | | |
| | | List<TErpGoodsVO> pageAdminList(@Param("query") TErpGoodsAdminQuery query, @Param("pageInfo") PageInfo<TErpGoodsVO> pageInfo); |
| | | } |
| | |
| | | public interface TErpMaintenanceReminderMapper extends BaseMapper<TErpMaintenanceReminder> { |
| | | |
| | | List<TErpMaintenanceReminderListVo> pageList(@Param("page") PageInfo<TErpMaintenanceReminderListVo> page, @Param("query") TErpMaintenanceReminderQuery query, @Param("user") SysUser user, @Param("supplierClinicId") String supplierClinicId, @Param("tomorrow") LocalDateTime tomorrow ); |
| | | List<TErpMaintenanceReminderListVo> pageList1(@Param("page") PageInfo<TErpMaintenanceReminderListVo> page, @Param("query") TErpMaintenanceReminderQuery query, @Param("user") SysUser user, @Param("supplierClinicId") String supplierClinicId, @Param("tomorrow") LocalDateTime tomorrow ); |
| | | } |
New file |
| | |
| | | package com.ruoyi.system.query; |
| | | |
| | | import com.ruoyi.common.core.domain.BasePage; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @ApiModel(value = "erp商品平台查询参数query") |
| | | public class TErpGoodsAdminQuery extends BasePage { |
| | | |
| | | @ApiModelProperty(value = "供应商名称") |
| | | private String supplierName; |
| | | |
| | | @ApiModelProperty(value = "商品名称") |
| | | private String goodsName; |
| | | |
| | | @ApiModelProperty(value = "商品类型id") |
| | | private String typeId; |
| | | |
| | | @ApiModelProperty(value = "国药准字号") |
| | | private String quasiNumber; |
| | | |
| | | |
| | | @ApiModelProperty(value = "1启用 2禁用") |
| | | private Integer state; |
| | | |
| | | } |
| | |
| | | |
| | | @ApiModelProperty(value = "处理人") |
| | | private String handlerPerson; |
| | | private String reportUserId; |
| | | } |
| | |
| | | import com.ruoyi.system.dto.InventoryGoodsDto; |
| | | import com.ruoyi.system.model.TErpGoods; |
| | | import com.ruoyi.system.query.TClinicGoodsWarehouseQuery; |
| | | import com.ruoyi.system.query.TErpGoodsAdminQuery; |
| | | import com.ruoyi.system.query.TErpGoodsInventoryQuery; |
| | | import com.ruoyi.system.query.TErpGoodsQuery; |
| | | import com.ruoyi.system.vo.OutboundGoodsDetailVo; |
| | |
| | | PageInfo<TErpGoodsVO> pageList1(TErpGoodsQuery query, SysUser user); |
| | | |
| | | |
| | | PageInfo<TErpGoodsVO> pageAdminList(TErpGoodsAdminQuery query); |
| | | |
| | | |
| | | } |
| | |
| | | import com.ruoyi.system.mapper.*; |
| | | import com.ruoyi.system.model.*; |
| | | import com.ruoyi.system.query.*; |
| | | import com.ruoyi.system.service.TCrmSupplierService; |
| | | import com.ruoyi.system.service.TErpClinicWarehousingService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.system.vo.*; |
| | |
| | | @Resource |
| | | private TErpGoodsTypeMapper erpGoodsTypeMapper; |
| | | |
| | | @Resource |
| | | private TErpMaintenanceReminderMapper erpMaintenanceReminderMapper; |
| | | |
| | | @Resource |
| | | private TCrmSupplierMapper crmSupplierMapper; |
| | | |
| | | |
| | | @Override |
| | |
| | | TErpClinicWarehousing tErpSupplierWarehousing = erpClinicWarehousingMapper.selectById(tErpSupplierInventoryGood.getWarehousingId()); |
| | | String goodsId = tErpSupplierInventoryGood.getGoodsId(); |
| | | TErpGoods goods = erpGoodsMapper.selectById(goodsId); |
| | | |
| | | if(goods.getGoodsSource()==1){ |
| | | TCrmSupplier supplier = crmSupplierMapper.selectById(goods.getSupplierClinicId()); |
| | | if(supplier!=null){ |
| | | inventoryDetailVo.setSupplierName(supplier.getSupplierName()); |
| | | } |
| | | }else { |
| | | inventoryDetailVo.setSupplierName(goods.getSupplierName()); |
| | | } |
| | | |
| | | inventoryDetailVo.setGoodsName(goods.getGoodsName()); |
| | | TErpGoodsUnit tErpGoodsUnit = erpGoodsUnitMapper.selectById(goods.getPackingUnitId()); |
| | | inventoryDetailVo.setUnitName(tErpGoodsUnit.getUnitName()); |
| | |
| | | TErpClinicWarehousing tErpSupplierWarehousing = erpClinicWarehousingMapper.selectById(warehousingId); |
| | | String goodsId = tErpSupplierInventoryGood.getGoodsId(); |
| | | TErpGoods goods = erpGoodsMapper.selectById(goodsId); |
| | | if(goods.getGoodsSource()==1){ |
| | | TCrmSupplier supplier = crmSupplierMapper.selectById(goods.getSupplierClinicId()); |
| | | if(supplier!=null){ |
| | | inventoryDetailVo.setSupplierName(supplier.getSupplierName()); |
| | | } |
| | | }else { |
| | | inventoryDetailVo.setSupplierName(goods.getSupplierName()); |
| | | } |
| | | |
| | | inventoryDetailVo.setGoodsName(goods.getGoodsName()); |
| | | TErpGoodsUnit tErpGoodsUnit = erpGoodsUnitMapper.selectById(goods.getPackingUnitId()); |
| | | inventoryDetailVo.setUnitName(tErpGoodsUnit.getUnitName()); |
| | |
| | | tErpClinicWarehousingBatch.setPurchaseCount(dto.getPurchaseCount()); |
| | | erpClinicWarehousingBatchMapper.insert(tErpClinicWarehousingBatch); |
| | | |
| | | |
| | | if(goods.getMaintenanceInterval()!=null){ |
| | | TErpMaintenanceReminder tErpMaintenanceReminder = new TErpMaintenanceReminder(); |
| | | tErpMaintenanceReminder.setClinicSupplierId(supplierClinicId); |
| | | tErpMaintenanceReminder.setMaintenanceType(2); |
| | | tErpMaintenanceReminder.setWarehousingBatchId(tErpClinicWarehousingBatch.getId()); |
| | | Integer day = Integer.valueOf(goods.getMaintenanceInterval()); |
| | | // 当前时间+day天 |
| | | LocalDateTime time1 = LocalDateTime.now().plusDays(day); |
| | | tErpMaintenanceReminder.setMaintenanceTime(time1); |
| | | erpMaintenanceReminderMapper.insert(tErpMaintenanceReminder); |
| | | } |
| | | |
| | | |
| | | totalPrice = totalPrice.add(dto.getSalesAmount().multiply(new BigDecimal(dto.getPurchaseCount()))); |
| | | } |
| | | tErpClinicWarehousing.setTotalPrice(totalPrice); |
| | |
| | | import com.ruoyi.system.mapper.*; |
| | | import com.ruoyi.system.model.*; |
| | | import com.ruoyi.system.query.TClinicGoodsWarehouseQuery; |
| | | import com.ruoyi.system.query.TErpGoodsAdminQuery; |
| | | import com.ruoyi.system.query.TErpGoodsInventoryQuery; |
| | | import com.ruoyi.system.query.TErpGoodsQuery; |
| | | import com.ruoyi.system.service.TErpGoodsService; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public PageInfo<TErpGoodsVO> pageAdminList(TErpGoodsAdminQuery query) { |
| | | PageInfo<TErpGoodsVO> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize()); |
| | | List<TErpGoodsVO> list = this.baseMapper.pageAdminList(query, pageInfo); |
| | | if (list.isEmpty()) { |
| | | return pageInfo; |
| | | } |
| | | List<String> typeIds = list.stream().map(TErpGoods::getTypeId).collect(Collectors.toList()); |
| | | if (!typeIds.isEmpty()) { |
| | | List<TErpGoodsType> typeList = erpGoodsTypeMapper.selectBatchIds(typeIds); |
| | | for (TErpGoodsVO tErpGoodsVO : list) { |
| | | typeList.stream().filter(t -> t.getId().equals(tErpGoodsVO.getTypeId())).findFirst().ifPresent(t -> tErpGoodsVO.setTypeName(t.getTypeName())); |
| | | } |
| | | } |
| | | pageInfo.setRecords( list); |
| | | return pageInfo; |
| | | } |
| | | |
| | | @Override |
| | | public List<TErpGoodsVO> listExport(TErpGoodsQuery query, SysUser user) { |
| | | List<TErpGoodsVO> list = this.baseMapper.listExport(query, user); |
| | | if (list.isEmpty()) { |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.time.LocalDateTime; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | |
| | | // 获取明天的时间 |
| | | LocalDateTime tomorrow = LocalDateTime.now().plusDays(1); |
| | | |
| | | List<TErpMaintenanceReminderListVo> list=new ArrayList<>(); |
| | | if(roleType==4){ |
| | | list = baseMapper.pageList(page, query, user,supplierClinicId,tomorrow); |
| | | }else { |
| | | list = baseMapper.pageList1(page, query, user,supplierClinicId,tomorrow); |
| | | } |
| | | |
| | | List<TErpMaintenanceReminderListVo> list = baseMapper.pageList(page, query, user,supplierClinicId,tomorrow); |
| | | if(list.isEmpty()){ |
| | | return page; |
| | | } |
| | |
| | | @ApiModelProperty(value = "破损数量") |
| | | private Integer damagedCount; |
| | | |
| | | @ApiModelProperty(value = "供应商名称") |
| | | private String supplierName; |
| | | |
| | | |
| | | } |
| | |
| | | <select id="getGoodsById" resultType="com.ruoyi.system.model.TErpGoods"> |
| | | select <include refid="Base_Column_List"/> from t_erp_goods where id = #{goodsId} |
| | | </select> |
| | | <select id="pageAdminList" resultType="com.ruoyi.system.vo.TErpGoodsVO"> |
| | | select |
| | | t1.id |
| | | , t1.supplier_clinic_id, t1.goods_source, t1.goods_name, t1.goods_id_code, t1.quasi_number,t1.manufacturer, t1.formulation_spec, t1.packing_spec, t1.type_id, t1.goods_yards, |
| | | t1.maintenance_interval,t1.maintenance_interval_unit, t1.low_purchase_quantity, t1.low_unit_id, t1.is_prescription_drug, t1.goods_spec, t1.warning_inventory, |
| | | t1.sales_amount, t1.packing_unit_id, t1.instructions_use, t1.side_effect, t1.clinic_purchase_price, t1.platform_commission_price, t1.create_time, t1.update_time, t1.create_by, |
| | | t1.`state`, t1.update_by, t1.disabled, |
| | | t1.simplified_code, |
| | | t1.dosage_form, |
| | | t1.usage_classification, |
| | | t1.product_brand, |
| | | t1.place_of_origin, |
| | | t1.ingredient, |
| | | t1.trait, |
| | | t1.indication, |
| | | t1.taboo, |
| | | t1.precautions, |
| | | t1.interaction, |
| | | t1.storage, |
| | | t2.supplier_name |
| | | from t_erp_goods t1 left join t_crm_supplier t2 on t1.supplier_clinic_id = t2.id and t1.goods_source =1 |
| | | where t1.disabled = 0 and t1.goods_source =1 |
| | | <if test="query.supplierName != null and query.supplierName != ''"> |
| | | and t2.supplier_name like concat('%',#{query.supplierName},'%') |
| | | </if> |
| | | <if test="query.goodsName != null and query.goodsName != ''"> |
| | | and t1.goods_name like concat('%',#{query.goodsName},'%') |
| | | </if> |
| | | <if test="query.typeId != null and query.typeId != ''"> |
| | | and t1.type_id = #{query.typeId} |
| | | </if> |
| | | <if test="query.quasiNumber != null and query.quasiNumber != ''"> |
| | | and t1.quasi_number like concat('%',#{query.quasiNumber},'%') |
| | | </if> |
| | | <if test="query.state != null "> |
| | | and t1.state = #{query.state} |
| | | </if> |
| | | order by t1.create_time desc |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | <if test="query.status != null"> |
| | | AND status = #{query.status} |
| | | </if> |
| | | <if test="query.reportType != null"> |
| | | AND report_type = #{query.reportType} |
| | | <if test="query.reportType != null and query.query.reportUserId !=null"> |
| | | AND report_type = #{query.reportType} and report_user_id =#{query.reportUserId} |
| | | </if> |
| | | <if test="query.createBy != null and query.createBy != ''"> |
| | | AND create_by LIKE concat('%',#{query.createBy},'%') |
| | |
| | | and t1.`status` = #{query.status} |
| | | </if> |
| | | </select> |
| | | <select id="pageList1" resultType="com.ruoyi.system.vo.TErpMaintenanceReminderListVo"> |
| | | select t1.id, |
| | | t4.goods_name, |
| | | t4.type_id, |
| | | t2.batch_number, |
| | | t1.maintenance_person_id, |
| | | t1.maintenance_time, |
| | | t1.`status`, |
| | | t3.warehouse_no |
| | | from t_erp_maintenance_reminder t1 |
| | | LEFT JOIN t_erp_clinic_warehousing_batch t2 on t1.warehousing_batch_id = t2.id |
| | | left join t_erp_clinic_warehousing t3 on t2.warehousing_id = t3.id |
| | | left join t_erp_goods t4 on t2.goods_id = t4.id |
| | | where t1.disabled = 0 and #{tomorrow} >= t1.maintenance_time |
| | | <if test="user.roleType !=null and user.roleType==4"> |
| | | and t1.clinic_supplier_id = #{supplierClinicId} and t1.maintenance_type=1 |
| | | </if> |
| | | <if test="user.roleType !=null and user.roleType==5"> |
| | | and t1.clinic_supplier_id = #{supplierClinicId} and t1.maintenance_type=2 |
| | | </if> |
| | | <if test="query.warehouseNo != null and query.warehouseNo != ''"> |
| | | and t3.warehouse_no =#{query.warehouseNo} |
| | | </if> |
| | | <if test="query.goodsName != null and query.goodsName != ''"> |
| | | and t4.goods_name like concat('%',#{query.goodsName},'%') |
| | | </if> |
| | | <if test="query.typeId != null and query.typeId != '' "> |
| | | and t4.type_id = #{query.typeId} |
| | | </if> |
| | | <if test="query.batchNumber != null and query.batchNumber != ''"> |
| | | and t2.batch_number = #{query.batchNumber} |
| | | </if> |
| | | <if test="query.status != null "> |
| | | and t1.`status` = #{query.status} |
| | | </if> |
| | | </select> |
| | | |
| | | </mapper> |