Merge remote-tracking branch 'origin/master'
# Conflicts:
# ruoyi-system/src/main/java/com/ruoyi/system/service/TErpProcurementService.java
| | |
| | | import com.ruoyi.common.utils.DateUtils; |
| | | import com.ruoyi.framework.web.service.TokenService; |
| | | import com.ruoyi.system.dto.AddProcurementDto; |
| | | import com.ruoyi.system.dto.DetailProcurementSendDto; |
| | | import com.ruoyi.system.dto.UpdateStatusProcurementDto; |
| | | import com.ruoyi.system.dto.UpdateStatusProcurementLastDto; |
| | | import com.ruoyi.system.model.*; |
| | |
| | | private final TCrmBranchService crmBranchService; |
| | | private final TCrmSalespersonService crmSalespersonService; |
| | | private final TErpProcurementCommissionService erpProcurementCommissionService; |
| | | private final TCrmWarehouseService crmWarehouseService; |
| | | |
| | | |
| | | |
| | | @Autowired |
| | | public TErpProcurementController(TErpProcurementService erpProcurementService, TokenService tokenService, TCrmClinicService crmClinicService, TErpProcurementGoodsService erpProcurementGoodsService |
| | | , TErpGoodsService erpGoodsService, TErpClinicWarehousingService erpClinicWarehousingService, TErpClinicWarehousingBatchService erpClinicWarehousingBatchService, |
| | | TCrmSupplierService crmSupplierService, TErpMaintenanceReminderService erpMaintenanceReminderService, TSysOtherConfigService sysOtherConfigService, TCrmClinicPointsService crmClinicPointsService, TCrmChangePointsService crmChangePointsService, TCrmBranchService crmBranchService, TCrmSalespersonService crmSalespersonService, TErpProcurementCommissionService erpProcurementCommissionService) { |
| | | TCrmSupplierService crmSupplierService, TErpMaintenanceReminderService erpMaintenanceReminderService, TSysOtherConfigService sysOtherConfigService, TCrmClinicPointsService crmClinicPointsService, TCrmChangePointsService crmChangePointsService, TCrmBranchService crmBranchService, TCrmSalespersonService crmSalespersonService, TErpProcurementCommissionService erpProcurementCommissionService, TCrmWarehouseService crmWarehouseService) { |
| | | this.erpProcurementService = erpProcurementService; |
| | | this.tokenService = tokenService; |
| | | this.crmClinicService = crmClinicService; |
| | |
| | | this.crmBranchService = crmBranchService; |
| | | this.crmSalespersonService = crmSalespersonService; |
| | | this.erpProcurementCommissionService = erpProcurementCommissionService; |
| | | |
| | | this.crmWarehouseService = crmWarehouseService; |
| | | |
| | | } |
| | | |
| | |
| | | |
| | | |
| | | @ApiOperation(value = "采购详情--发货(仓库角色)") |
| | | @PostMapping(value = "/detailProcurementSend/{id}") |
| | | public R<?> detailProcurementSend(@PathVariable String id) { |
| | | @PostMapping(value = "/detailProcurementSend") |
| | | public R<?> detailProcurementSend(@RequestBody DetailProcurementSendDto dto) { |
| | | SysUser user = tokenService.getLoginUser().getUser(); |
| | | Integer roleType = user.getRoleType(); |
| | | String clinicSupplierId=null; |
| | | if(roleType == 4){ |
| | | // 供应商 |
| | | TCrmSupplier crmSupplier = crmSupplierService.getOne(Wrappers.lambdaQuery(TCrmSupplier.class) |
| | | .eq(TCrmSupplier::getUserId, user.getUserId()) |
| | | List<String> clinicSupplierId=null; |
| | | if(roleType == 6){ |
| | | |
| | | TCrmWarehouse warehouse = crmWarehouseService.getOne(Wrappers.lambdaQuery(TCrmWarehouse.class) |
| | | .eq(TCrmWarehouse::getUserId, user.getUserId()) |
| | | .last("LIMIT 1")); |
| | | clinicSupplierId=crmSupplier.getId(); |
| | | |
| | | // 供应商 |
| | | clinicSupplierId = crmSupplierService.list(Wrappers.lambdaQuery(TCrmSupplier.class) |
| | | .eq(TCrmSupplier::getWarehouseId, warehouse.getId())).stream().map(TCrmSupplier::getId).collect(Collectors.toList()); |
| | | } |
| | | erpProcurementService.detailProcurementSend(clinicSupplierId, user, id); |
| | | erpProcurementService.detailProcurementSend(clinicSupplierId, user, dto.getId(),dto.getLogisticsNumber()); |
| | | return R.ok(); |
| | | } |
| | | |
| | |
| | | // 先退分账 在退订单 |
| | | // 查出采购单 算出价格 下单 算出应该分佣金额 应该分给谁 |
| | | TErpProcurement erpProcurement = erpProcurementService.getById(id); |
| | | if(erpProcurement.getStatus()==2){ |
| | | erpProcurement.setStatus(6); |
| | | erpProcurementService.updateById(erpProcurement); |
| | | return R.ok("操作成功"); |
| | | } |
| | | // 还未分账成功不能退款 |
| | | |
| | | if(erpProcurement.getStatus()==null || erpProcurement.getStatus()!=1){ |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.common.core.domain.BaseModel; |
| | | import com.ruoyi.common.core.domain.BasePage; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import com.ruoyi.framework.web.service.TokenService; |
| | | import com.ruoyi.system.dto.ExchangeGoodsDto; |
| | | import com.ruoyi.system.dto.TErpGoodsUpdateStatusDto; |
| | | import com.ruoyi.system.model.*; |
| | | import com.ruoyi.system.query.ExchangeGoodsRecordQuery; |
| | | import com.ruoyi.system.query.TSysGoodsExchangeQuery; |
| | | import com.ruoyi.system.query.TSysGoodsQuery; |
| | | import com.ruoyi.system.service.*; |
| | | import com.ruoyi.system.vo.ExchangeGoodsRecordDetailVo; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.validation.Valid; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | private final TokenService tokenService; |
| | | private final TCrmSupplierService crmSupplierService; |
| | | private final TSysGoodsExchangeService sysGoodsExchangeService; |
| | | private final TCrmClinicService crmClinicService; |
| | | private final TCrmClinicPointsService crmClinicPointsService; |
| | | private final TCrmChangePointsService crmChangePointsService; |
| | | |
| | | |
| | | @Autowired |
| | | public TSysGoodsController(TokenService tokenService, TSysGoodsService sysGoodsService, TCrmSupplierService crmSupplierService, TSysGoodsExchangeService sysGoodsExchangeService) { |
| | | public TSysGoodsController(TokenService tokenService, TSysGoodsService sysGoodsService, TCrmSupplierService crmSupplierService, TSysGoodsExchangeService sysGoodsExchangeService, TCrmClinicService crmClinicService, TCrmClinicPointsService crmClinicPointsService, TCrmChangePointsService crmChangePointsService) { |
| | | this.sysGoodsService = sysGoodsService; |
| | | this.tokenService = tokenService; |
| | | this.crmSupplierService = crmSupplierService; |
| | | this.sysGoodsExchangeService = sysGoodsExchangeService; |
| | | this.crmClinicService = crmClinicService; |
| | | this.crmClinicPointsService = crmClinicPointsService; |
| | | |
| | | this.crmChangePointsService = crmChangePointsService; |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 获取积分商品列表 |
| | | */ |
| | | @ApiOperation(value = "获取积分商品列表") |
| | | @ApiOperation(value = "获取积分商品列表--供应商") |
| | | @PostMapping(value = "/pageList") |
| | | public R<PageInfo<TSysGoods>> pageList(@RequestBody TSysGoodsQuery query) { |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | @ApiOperation(value = "添加积分商品") |
| | | @ApiOperation(value = "添加积分商品--供应商") |
| | | @PostMapping(value = "/add") |
| | | public R<String> add(@RequestBody TSysGoods goods) { |
| | | SysUser user = tokenService.getLoginUser().getUser(); |
| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | @ApiOperation(value = "编辑积分商品") |
| | | @ApiOperation(value = "编辑积分商品--供应商") |
| | | @PostMapping(value = "/update") |
| | | public R<String> update(@RequestBody TSysGoods goods) { |
| | | SysUser user = tokenService.getLoginUser().getUser(); |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | @ApiOperation(value = "删除积分商品") |
| | | @ApiOperation(value = "删除积分商品--供应商") |
| | | @DeleteMapping(value = "/delete/{id}") |
| | | public R<String> delete(@PathVariable String id) { |
| | | SysUser user = tokenService.getLoginUser().getUser(); |
| | |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "积分商品 上下架") |
| | | @ApiOperation(value = "积分商品 上下架--供应商") |
| | | @PostMapping(value = "/updateStatus") |
| | | public R<String> updateStatus(@RequestBody @Valid TErpGoodsUpdateStatusDto dto) { |
| | | SysUser user = tokenService.getLoginUser().getUser(); |
| | |
| | | |
| | | |
| | | // 获取兑换记录 |
| | | @ApiOperation(value = "获取兑换记录") |
| | | @ApiOperation(value = "获取兑换记录--供应商") |
| | | @PostMapping(value = "/getExchangeRecord") |
| | | public R<PageInfo<TSysGoodsExchange>> getExchangeRecord(@RequestBody @Valid TSysGoodsExchangeQuery query) { |
| | | PageInfo<TSysGoodsExchange> page = new PageInfo<>(query.getPageNum(), query.getPageSize()); |
| | |
| | | } |
| | | |
| | | // 获取兑换记录 |
| | | @ApiOperation(value = "发货") |
| | | @ApiOperation(value = "发货--供应商") |
| | | @PostMapping(value = "/sendGoods") |
| | | public R<?> sendGoods(@RequestBody @Valid TSysGoodsExchange exchange) { |
| | | TSysGoodsExchange exchange1 = sysGoodsExchangeService.getById(exchange.getId()); |
| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取积分商品列表 |
| | | */ |
| | | @ApiOperation(value = "获取积分商品列表--诊所") |
| | | @PostMapping(value = "/pageListClinic") |
| | | public R<HashMap<String, Object>> pageListClinic(@RequestBody TSysGoodsQuery query) { |
| | | PageInfo<TSysGoods> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize()); |
| | | LambdaQueryWrapper<TSysGoods> tSysGoodsLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | tSysGoodsLambdaQueryWrapper.eq(TSysGoods::getStatus, 1); |
| | | if (query.getGoodsName() != null && !query.getGoodsName().isEmpty()) { |
| | | tSysGoodsLambdaQueryWrapper.like(TSysGoods::getGoodsName, query.getGoodsName()); |
| | | } |
| | | tSysGoodsLambdaQueryWrapper.orderByDesc(BaseModel::getCreateTime); |
| | | |
| | | Page<TSysGoods> page = sysGoodsService.page(pageInfo, tSysGoodsLambdaQueryWrapper); |
| | | List<TSysGoods> records = page.getRecords(); |
| | | if (!records.isEmpty()) { |
| | | List<TSysGoodsExchange> list = sysGoodsExchangeService.list(new LambdaQueryWrapper<TSysGoodsExchange>().in(TSysGoodsExchange::getGoodsId, records.stream().map(TSysGoods::getId).collect(Collectors.toList()))); |
| | | records.forEach(item -> { |
| | | item.setExchangeQuantity(list.stream().filter(item1 -> item1.getGoodsId().equals(item.getId())).mapToInt(TSysGoodsExchange::getGoodsCount).sum()); |
| | | item.setSurplusQuantity(item.getGoodsTotal() - item.getExchangeQuantity()); |
| | | }); |
| | | } |
| | | pageInfo.setRecords(records); |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | map.put("data", pageInfo); |
| | | |
| | | // 获取我的可用积分 |
| | | map.put("total", sysGoodsService.count(tSysGoodsLambdaQueryWrapper)); |
| | | SysUser user = tokenService.getLoginUser().getUser(); |
| | | Integer roleType = user.getRoleType(); |
| | | if (roleType == 5) { |
| | | // 诊所 |
| | | TCrmClinic crmClinic = crmClinicService.getOne(Wrappers.lambdaQuery(TCrmClinic.class) |
| | | .eq(TCrmClinic::getUserId, user.getUserId()) |
| | | .last("LIMIT 1")); |
| | | List<TCrmClinicPoints> list = crmClinicPointsService.list(new LambdaQueryWrapper<TCrmClinicPoints>().eq(TCrmClinicPoints::getClinicId, crmClinic.getId()).ge(TCrmClinicPoints::getExpireTime, new Date()).last(" and points > use_points")); |
| | | map.put("myPoints", list.stream().mapToInt(item -> item.getPoints() - item.getUsePoints()).sum()); |
| | | } |
| | | return R.ok(map); |
| | | } |
| | | |
| | | /** |
| | | * 获取积分商品详情 |
| | | */ |
| | | @ApiOperation(value = "获取积分商品列表--详情") |
| | | @GetMapping(value = "/detail/{id}") |
| | | public R<TSysGoods> detail(@PathVariable String id) { |
| | | TSysGoods goods = sysGoodsService.getById(id); |
| | | return R.ok(goods); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 兑换商品 |
| | | */ |
| | | @ApiOperation(value = "兑换商品--诊所") |
| | | @PostMapping(value = "/exchangeGoods") |
| | | public R<?> exchangeGoods(@RequestBody @Valid ExchangeGoodsDto dto) { |
| | | SysUser user = tokenService.getLoginUser().getUser(); |
| | | Integer roleType = user.getRoleType(); |
| | | if (roleType == 5) { |
| | | // 诊所 |
| | | TCrmClinic crmClinic = crmClinicService.getOne(Wrappers.lambdaQuery(TCrmClinic.class) |
| | | .eq(TCrmClinic::getUserId, user.getUserId()) |
| | | .last("LIMIT 1")); |
| | | sysGoodsService.exchangeGoods(crmClinic, dto); |
| | | return R.ok(); |
| | | } |
| | | return R.fail("请选择正确的角色"); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 兑换商品记录 |
| | | */ |
| | | @ApiOperation(value = "兑换商品记录--诊所") |
| | | @PostMapping(value = "/exchangeGoodsRecord") |
| | | public R<?> exchangeGoodsRecord(@RequestBody ExchangeGoodsRecordQuery query) { |
| | | SysUser user = tokenService.getLoginUser().getUser(); |
| | | Integer roleType = user.getRoleType(); |
| | | if (roleType == 5) { |
| | | // 诊所 |
| | | TCrmClinic crmClinic = crmClinicService.getOne(Wrappers.lambdaQuery(TCrmClinic.class) |
| | | .eq(TCrmClinic::getUserId, user.getUserId()) |
| | | .last("LIMIT 1")); |
| | | |
| | | LambdaQueryWrapper<TSysGoodsExchange> eq = new LambdaQueryWrapper<TSysGoodsExchange>().eq(TSysGoodsExchange::getClinicId, crmClinic.getId()); |
| | | if (query.getName() != null && !query.getName().isEmpty()) { |
| | | eq.like(TSysGoodsExchange::getGoodsName, query.getName()); |
| | | } |
| | | eq.orderByDesc(BaseModel::getCreateTime); |
| | | |
| | | |
| | | PageInfo<TSysGoodsExchange> page = sysGoodsExchangeService.page(new PageInfo<>(query.getPageNum(), query.getPageSize()), eq); |
| | | return R.ok(page); |
| | | } |
| | | return R.fail("请选择正确的角色"); |
| | | } |
| | | |
| | | /** |
| | | * 兑换商品记录 |
| | | */ |
| | | @ApiOperation(value = "兑换商品记录详情--诊所") |
| | | @GetMapping(value = "/exchangeGoodsRecordDetail/{id}") |
| | | public R<ExchangeGoodsRecordDetailVo> exchangeGoodsRecord(@PathVariable String id) { |
| | | SysUser user = tokenService.getLoginUser().getUser(); |
| | | Integer roleType = user.getRoleType(); |
| | | if (roleType == 5) { |
| | | // 诊所 |
| | | TCrmClinic crmClinic = crmClinicService.getOne(Wrappers.lambdaQuery(TCrmClinic.class) |
| | | .eq(TCrmClinic::getUserId, user.getUserId()) |
| | | .last("LIMIT 1")); |
| | | TSysGoodsExchange exchangeServiceById = sysGoodsExchangeService.getById(id); |
| | | if (exchangeServiceById.getClinicId().equals(crmClinic.getId())) { |
| | | ExchangeGoodsRecordDetailVo vo = new ExchangeGoodsRecordDetailVo(); |
| | | BeanUtils.copyProperties(exchangeServiceById, vo); |
| | | |
| | | String goodsId = vo.getGoodsId(); |
| | | TSysGoods sysGoods = sysGoodsService.getById(goodsId); |
| | | vo.setGoodsDetail(sysGoods.getGoodsDetail()); |
| | | vo.setGoodsCover(sysGoods.getGoodsCover()); |
| | | |
| | | |
| | | return R.ok(vo); |
| | | } |
| | | } |
| | | return R.fail("请选择正确的角色"); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 兑换商品记录 |
| | | */ |
| | | @ApiOperation(value = "积分变更记录--诊所") |
| | | @PostMapping(value = "/pointsRecordDetail") |
| | | public R<PageInfo<TCrmChangePoints>> pointsRecordDetail(@RequestBody BasePage page) { |
| | | SysUser user = tokenService.getLoginUser().getUser(); |
| | | Integer roleType = user.getRoleType(); |
| | | if (roleType == 5) { |
| | | // 诊所 |
| | | TCrmClinic crmClinic = crmClinicService.getOne(Wrappers.lambdaQuery(TCrmClinic.class) |
| | | .eq(TCrmClinic::getUserId, user.getUserId()) |
| | | .last("LIMIT 1")); |
| | | |
| | | PageInfo<TCrmChangePoints> page1 = crmChangePointsService.page(new PageInfo<>(page.getPageNum(), page.getPageSize()), new LambdaQueryWrapper<TCrmChangePoints>().eq(TCrmChangePoints::getBranchSalespersonId, crmClinic.getId()).eq(TCrmChangePoints::getUserType, 3).orderByDesc(BaseModel::getCreateTime)); |
| | | |
| | | return R.ok(page1); |
| | | } |
| | | return R.fail("请选择正确的角色"); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| New file |
| | |
| | | package com.ruoyi.system.dto; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.NotBlank; |
| | | |
| | | @Data |
| | | @ApiModel("仓库发货dto") |
| | | public class DetailProcurementSendDto { |
| | | @ApiModelProperty("id") |
| | | @NotBlank(message = "id不能为空") |
| | | private String id; |
| | | |
| | | @ApiModelProperty("物流单号") |
| | | @NotBlank(message = "物流单号不能为空") |
| | | private String logisticsNumber; |
| | | } |
| New file |
| | |
| | | package com.ruoyi.system.dto; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.NotBlank; |
| | | import javax.validation.constraints.NotNull; |
| | | |
| | | |
| | | @Data |
| | | @ApiModel("诊所兑换商品dto") |
| | | public class ExchangeGoodsDto { |
| | | @ApiModelProperty("商品id") |
| | | @NotBlank(message = "商品id不能为空") |
| | | private String goodsId; |
| | | |
| | | @ApiModelProperty("数量") |
| | | @NotNull(message = "数量不能为空") |
| | | private Integer count; |
| | | } |
| | |
| | | List<TErpGoodsVO> inventoryNotEnoughList(@Param("user") SysUser user); |
| | | |
| | | |
| | | List<TErpProcurementVo> pageListWarehouse(@Param("query") TErpProcurementQuery query, @Param("pageInfo") PageInfo<TErpProcurementVo> pageInfo, @Param("user") SysUser user, @Param("sTime") String sTime, @Param("eTime") String eTime, @Param("supplierClinicId") String supplierClinicId); |
| | | List<TErpProcurementVo> pageListWarehouse(@Param("query") TErpProcurementQuery query, @Param("pageInfo") PageInfo<TErpProcurementVo> pageInfo, @Param("user") SysUser user, @Param("sTime") String sTime, @Param("eTime") String eTime, @Param("supplierClinicId") List<String> supplierClinicId); |
| | | |
| | | List<SupplierThirtyProcurementStatisticsVO> supplierThirtyProcurementStatistics(@Param("supplierAndClinicId")String supplierAndClinicId, |
| | | @Param("startTime")String startTime, |
| | |
| | | @TableField("total_price") |
| | | private BigDecimal totalPrice; |
| | | |
| | | @ApiModelProperty(value = "采购商品id") |
| | | @TableField("procurement_goods_id") |
| | | private String procurementGoodsId; |
| | | |
| | | } |
| | |
| | | @TableField("logistics_number") |
| | | private String logisticsNumber; |
| | | |
| | | @ApiModelProperty(value = "诊所id") |
| | | @TableField("clinic_id") |
| | | private String clinicId; |
| | | |
| | | } |
| New file |
| | |
| | | package com.ruoyi.system.query; |
| | | |
| | | import com.ruoyi.common.core.domain.BasePage; |
| | | import io.swagger.annotations.ApiModel; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @ApiModel("诊所兑换记录Query") |
| | | public class ExchangeGoodsRecordQuery extends BasePage { |
| | | private String name; |
| | | } |
| | |
| | | @ApiModel(value = "erp商品库存信息查询参数query") |
| | | public class TErpGoodsQuery extends BasePage { |
| | | |
| | | @ApiModelProperty(value = "供应商名称") |
| | | private String supplierName; |
| | | |
| | | @ApiModelProperty(value = "商品名称") |
| | | private String goodsName; |
| | | |
| | |
| | | |
| | | import javax.validation.Valid; |
| | | import java.math.BigDecimal; |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | |
| | | DetailProcurementVO detailProcurement(String clinicSupplierId, SysUser user, String id); |
| | | |
| | | void detailProcurementSend(String clinicSupplierId, SysUser user, String id); |
| | | |
| | | void detailProcurementSend(List<String> clinicSupplierId, SysUser user, String id,String logisticsNumber); |
| | | /** |
| | | * 供应商采购统计 |
| | | * @param supplierAndClinicId |
| | |
| | | package com.ruoyi.system.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.system.dto.ExchangeGoodsDto; |
| | | import com.ruoyi.system.model.TCrmClinic; |
| | | import com.ruoyi.system.model.TSysGoods; |
| | | |
| | | import javax.validation.Valid; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | */ |
| | | public interface TSysGoodsService extends IService<TSysGoods> { |
| | | |
| | | void exchangeGoods(TCrmClinic crmClinic, ExchangeGoodsDto dto); |
| | | |
| | | |
| | | } |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | List<String> collect = list.stream().map(PageInventoryListVo::getId).collect(Collectors.toList()); |
| | | List<TErpClinicInventoryGoods> tErpSupplierInventoryGoods = erpClinicInventoryGoodsMapper.selectList(new LambdaQueryWrapper<TErpClinicInventoryGoods>().in(TErpClinicInventoryGoods::getInventoryId,collect)); |
| | | for (PageInventoryListVo pageInventoryListVo : list) { |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | @Override |
| | | public PageInfo<ValidityPeriodWarningVo> validityPeriodWarning(ValidityPeriodWarningQuery query, SysUser user) { |
| | | Integer roleType = user.getRoleType(); |
| | |
| | | LocalDateTime nineMonthLater = LocalDateTime.now().plusMonths(9); |
| | | |
| | | PageInfo<ValidityPeriodWarningVo> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize()); |
| | | |
| | | |
| | | |
| | | return this.baseMapper.validityPeriodWarning(pageInfo,query,user,nineMonthLater,supplierClinicId); |
| | |
| | | pageInfo.setRecords(list); |
| | | return pageInfo; |
| | | } |
| | | |
| | | @Override |
| | | public List<TErpGoodsVO> pageList1(TErpGoodsQuery query, SysUser user) { |
| | | List<TErpGoodsVO> list = this.baseMapper.pageList1(query,user); |
| | |
| | | this.save(tErpClinicWarehousing); |
| | | |
| | | BigDecimal totalPrice = new BigDecimal(0); |
| | | ArrayList<String> names = new ArrayList<>(); |
| | | for (clinicWarehouseGoodsDto dto : dtos.getDtos()) { |
| | | TErpClinicWarehousingBatch tErpClinicWarehousingBatch = new TErpClinicWarehousingBatch(); |
| | | tErpClinicWarehousingBatch.setWarehousingId(tErpClinicWarehousing.getId()); |
| | |
| | | tErpClinicWarehousingBatch.setExpiryDate(dto.getExpiryDate().atStartOfDay()); |
| | | tErpClinicWarehousingBatch.setGoodsId(dto.getId()); |
| | | TErpGoods goods = erpGoodsMapper.selectById(dto.getId()); |
| | | String supplierName = goods.getSupplierName(); |
| | | names.add(supplierName); |
| | | tErpClinicWarehousingBatch.setGoodsName(goods.getGoodsName()); |
| | | tErpClinicWarehousingBatch.setQuasiNumber(goods.getQuasiNumber()); |
| | | tErpClinicWarehousingBatch.setUnitAmount(dto.getUnitAmount()); |
| | |
| | | totalPrice = totalPrice.add(dto.getSalesAmount().multiply(new BigDecimal(dto.getPurchaseCount()))); |
| | | } |
| | | tErpClinicWarehousing.setTotalPrice(totalPrice); |
| | | String name = names.stream().collect(Collectors.joining(",")); |
| | | tErpClinicWarehousing.setSupplierName(name); |
| | | this.updateById(tErpClinicWarehousing); |
| | | |
| | | // } |
| | |
| | | import java.math.RoundingMode; |
| | | import java.security.PrivateKey; |
| | | import java.security.cert.X509Certificate; |
| | | import java.time.LocalDateTime; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | @Resource |
| | | private TErpSupplierOutboundGoodsMapper erpSupplierOutboundGoodsMapper; |
| | | |
| | | @Resource |
| | | private TCrmWarehouseMapper crmWarehouseMapper; |
| | | |
| | | @Override |
| | | public PageInfo<TErpProcurementVo> pageList(TErpProcurementQuery query, SysUser user) { |
| | |
| | | |
| | | |
| | | Integer roleType = user.getRoleType(); |
| | | String supplierClinicId = null; |
| | | List<String> supplierClinicId = null; |
| | | if (roleType == 6) { |
| | | // 供应商 |
| | | TCrmSupplier crmSupplier = crmSupplierMapper.selectOne(Wrappers.lambdaQuery(TCrmSupplier.class) |
| | | .eq(TCrmSupplier::getUserId, user.getUserId()) |
| | | |
| | | TCrmWarehouse warehouse = crmWarehouseMapper.selectOne(Wrappers.lambdaQuery(TCrmWarehouse.class) |
| | | .eq(TCrmWarehouse::getUserId, user.getUserId()) |
| | | .last("LIMIT 1")); |
| | | supplierClinicId = crmSupplier.getId(); |
| | | |
| | | |
| | | // 供应商 |
| | | supplierClinicId = crmSupplierMapper.selectList(Wrappers.lambdaQuery(TCrmSupplier.class) |
| | | .eq(TCrmSupplier::getWarehouseId, warehouse.getId())).stream().map(TCrmSupplier::getId).collect(Collectors.toList()); |
| | | String sTime = null; |
| | | String eTime = null; |
| | | if (query.getTime() != null && !query.getTime().isEmpty()) { |
| | |
| | | BigDecimal all = BigDecimal.ZERO; |
| | | |
| | | for (AddProcurementDto addProcurementDto : value) { |
| | | BigDecimal multiply = addProcurementDto.getSalesAmount().multiply(BigDecimal.valueOf(addProcurementDto.getPurchaseCount())); |
| | | BigDecimal multiply = addProcurementDto.getGoodsSalesAmount().multiply(BigDecimal.valueOf(addProcurementDto.getPurchaseCount())); |
| | | all = all.add(multiply); |
| | | } |
| | | tErpProcurement.setPayMoney(all); |
| | |
| | | tErpProcurementGoods.setQuasiNumber(goods.getQuasiNumber()); |
| | | |
| | | TErpGoodsUnit tErpGoodsUnit = erpGoodsUnitMapper.selectById(goods.getPackingUnitId()); |
| | | if(tErpGoodsUnit!=null){ |
| | | tErpProcurementGoods.setUnitName(tErpGoodsUnit.getUnitName()); |
| | | } |
| | | tErpProcurementGoods.setPurchasePrice(dto.getGoodsSalesAmount()); |
| | | tErpProcurementGoods.setSalesAmount(dto.getSalesAmount()); |
| | | tErpProcurementGoods.setTotalPrice(dto.getGoodsSalesAmount().multiply(new BigDecimal(dto.getPurchaseCount()))); |
| | |
| | | detailProcurementNextVO.setTotalPrice(tErpProcurement.getPayMoney()); |
| | | detailProcurementNextVO.setId(tErpProcurementGoods.getId()); |
| | | detailProcurementNextVO.setPurchasePrice(tErpProcurementGoods.getPurchasePrice()); |
| | | |
| | | List<TErpSupplierOutboundGoods> tErpSupplierOutboundGoods = erpSupplierOutboundGoodsMapper.selectList(new LambdaQueryWrapper<TErpSupplierOutboundGoods>().eq(TErpSupplierOutboundGoods::getProcurementGoodsId, tErpProcurementGoods.getId())); |
| | | if(!tErpSupplierOutboundGoods.isEmpty()){ |
| | | ArrayList<DetailProcurementNextThreeVO> detailProcurementNextThreeVOS = new ArrayList<>(); |
| | | List<String> collect = tErpSupplierOutboundGoods.stream().map(TErpSupplierOutboundGoods::getWarehousingBatchId).collect(Collectors.toList()); |
| | | List<TErpSupplierWarehousingBatch> tErpSupplierWarehousingBatches = erpSupplierWarehousingBatchMapper.selectBatchIds(collect); |
| | | for (TErpSupplierOutboundGoods tErpSupplierOutboundGood : tErpSupplierOutboundGoods) { |
| | | List<TErpSupplierWarehousingBatch> collect1 = tErpSupplierWarehousingBatches.stream().filter(e -> e.getId().equals(tErpSupplierOutboundGood.getWarehousingBatchId())).collect(Collectors.toList()); |
| | | for (TErpSupplierWarehousingBatch tErpSupplierWarehousingBatch : collect1) { |
| | | DetailProcurementNextThreeVO detailProcurementNextThreeVO = new DetailProcurementNextThreeVO(); |
| | | detailProcurementNextThreeVO.setBatchNumber(tErpSupplierWarehousingBatch.getBatchNumber()); |
| | | detailProcurementNextThreeVO.setProductionDate(tErpSupplierWarehousingBatch.getProductionDate()); |
| | | detailProcurementNextThreeVO.setExpirationDate(tErpSupplierWarehousingBatch.getExpiryDate()); |
| | | detailProcurementNextThreeVO.setNum(tErpSupplierOutboundGood.getOutboundCount()); |
| | | detailProcurementNextThreeVOS.add(detailProcurementNextThreeVO); |
| | | } |
| | | } |
| | | detailProcurementNextVO.setDetailProcurementNextThreeVOS(detailProcurementNextThreeVOS); |
| | | } |
| | | detailProcurementNextVOS.add(detailProcurementNextVO); |
| | | } |
| | | detailProcurementVO.setList(detailProcurementNextVOS); |
| | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED) |
| | | public void detailProcurementSend(String clinicSupplierId, SysUser user, String id) { |
| | | public void detailProcurementSend(List<String> clinicSupplierId, SysUser user, String id,String logisticsNumber) { |
| | | // 查出这个采购的下级商品 |
| | | List<TErpProcurementGoods> list = erpProcurementGoodsService.list(new QueryWrapper<TErpProcurementGoods>().eq("procurement_id", id)); |
| | | List<TErpSupplierWarehousing> tErpSupplierWarehousings = erpSupplierWarehousingMapper.selectList(new LambdaQueryWrapper<TErpSupplierWarehousing>() |
| | | .eq(TErpSupplierWarehousing::getSupplierId, clinicSupplierId).in(TErpSupplierWarehousing::getGoodsId, list.stream().map(TErpProcurementGoods::getGoodsId).collect(Collectors.toList())) |
| | | .in(TErpSupplierWarehousing::getSupplierId, clinicSupplierId).in(TErpSupplierWarehousing::getGoodsId, list.stream().map(TErpProcurementGoods::getGoodsId).collect(Collectors.toList())) |
| | | .orderByAsc(BaseModel::getCreateTime)); |
| | | |
| | | if(tErpSupplierWarehousings.isEmpty()){ |
| | |
| | | if(count>=purchaseCount){ |
| | | // 添加出库记录 |
| | | TErpSupplierOutbound tErpSupplierOutbound= new TErpSupplierOutbound(); |
| | | tErpSupplierOutbound.setSupplierId(clinicSupplierId); |
| | | tErpSupplierOutbound.setSupplierId(tErpSupplierWarehousing.getSupplierId()); |
| | | tErpSupplierOutbound.setWarehouseId(tErpSupplierWarehousing.getWarehouseId()); |
| | | tErpSupplierOutbound.setOutboundType(7); |
| | | //TODO 确定这个是采购价还是销售价格 |
| | |
| | | tErpSupplierOutboundGoods.setWarehousingBatchId(warehousingBatch.getId()); |
| | | tErpSupplierOutboundGoods.setOutboundCount(purchaseCount); |
| | | tErpSupplierOutboundGoods.setTotalPrice(tErpProcurementGoods.getPurchasePrice().multiply(new BigDecimal(purchaseCount))); |
| | | tErpSupplierOutboundGoods.setProcurementGoodsId(tErpProcurementGoods.getId()); |
| | | erpSupplierOutboundGoodsMapper.insert(tErpSupplierOutboundGoods); |
| | | continue outer; |
| | | } |
| | |
| | | purchaseCount = purchaseCount - count; |
| | | // 添加出库记录 |
| | | TErpSupplierOutbound tErpSupplierOutbound= new TErpSupplierOutbound(); |
| | | tErpSupplierOutbound.setSupplierId(clinicSupplierId); |
| | | tErpSupplierOutbound.setSupplierId(tErpSupplierWarehousing.getSupplierId()); |
| | | tErpSupplierOutbound.setWarehouseId(tErpSupplierWarehousing.getWarehouseId()); |
| | | tErpSupplierOutbound.setOutboundType(7); |
| | | //TODO 确定这个是采购价还是销售价格 |
| | |
| | | tErpSupplierOutboundGoods.setWarehousingBatchId(warehousingBatch.getId()); |
| | | tErpSupplierOutboundGoods.setOutboundCount(purchaseCount); |
| | | tErpSupplierOutboundGoods.setTotalPrice(tErpProcurementGoods.getPurchasePrice().multiply(new BigDecimal(purchaseCount))); |
| | | tErpSupplierOutboundGoods.setProcurementGoodsId(tErpProcurementGoods.getId()); |
| | | erpSupplierOutboundGoodsMapper.insert(tErpSupplierOutboundGoods); |
| | | } |
| | | |
| | |
| | | |
| | | |
| | | } |
| | | TErpProcurement byId = this.getById(id); |
| | | byId.setStatus(4); |
| | | byId.setSendTime(LocalDateTime.now()); |
| | | byId.setLogisticsNumber(logisticsNumber); |
| | | this.updateById(byId); |
| | | |
| | | } |
| | | |
| | |
| | | package com.ruoyi.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.system.dto.ExchangeGoodsDto; |
| | | import com.ruoyi.system.mapper.TCrmChangePointsMapper; |
| | | import com.ruoyi.system.mapper.TCrmClinicPointsMapper; |
| | | import com.ruoyi.system.mapper.TSysGoodsExchangeMapper; |
| | | import com.ruoyi.system.mapper.TSysGoodsMapper; |
| | | import com.ruoyi.system.model.TSysGoods; |
| | | import com.ruoyi.system.model.*; |
| | | import com.ruoyi.system.service.TSysGoodsService; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.time.LocalDateTime; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @Service |
| | | public class TSysGoodsServiceImpl extends ServiceImpl<TSysGoodsMapper, TSysGoods> implements TSysGoodsService { |
| | | |
| | | @Resource |
| | | private TSysGoodsExchangeMapper sysGoodsExchangeMapper; |
| | | |
| | | @Resource |
| | | private TCrmClinicPointsMapper crmClinicPointsMapper; |
| | | |
| | | @Resource |
| | | private TCrmChangePointsMapper crmChangePointsMapper; |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void exchangeGoods(TCrmClinic crmClinic, ExchangeGoodsDto dto) { |
| | | // 盘点库存是否足够 判断积分是否足够 减积分 记录积分变更 添加购买记录 |
| | | TSysGoods tSysGoods = this.getById(dto.getGoodsId()); |
| | | int needPoints = tSysGoods.getRequiredPoints().intValue() * dto.getCount(); |
| | | |
| | | // 判断已经购买的了多少 |
| | | List<TSysGoodsExchange> list = sysGoodsExchangeMapper.selectList(new LambdaQueryWrapper<TSysGoodsExchange>().eq(TSysGoodsExchange::getGoodsId, dto.getGoodsId())); |
| | | int sum = list.stream().mapToInt(TSysGoodsExchange::getGoodsCount).sum(); |
| | | if(sum+dto.getCount()>tSysGoods.getGoodsTotal()){ |
| | | throw new RuntimeException("商品库存不足"); |
| | | } |
| | | if(sum+dto.getCount()>tSysGoods.getConvertibleQuantity()){ |
| | | throw new RuntimeException("可兑换数量不足"); |
| | | } |
| | | List<TCrmClinicPoints> points = crmClinicPointsMapper.selectList(new LambdaQueryWrapper<TCrmClinicPoints>().eq(TCrmClinicPoints::getClinicId, crmClinic.getId()).ge(TCrmClinicPoints::getExpireTime, new Date()).last(" and points > use_points").orderByAsc(TCrmClinicPoints::getCreateTime)); |
| | | // 可用积分 |
| | | int userPoints = points.stream().mapToInt(item -> item.getPoints() - item.getUsePoints()).sum(); |
| | | if(userPoints<needPoints){ |
| | | throw new RuntimeException("积分不足"); |
| | | } |
| | | |
| | | for (TCrmClinicPoints point : points) { |
| | | if(needPoints==0){ |
| | | break; |
| | | } |
| | | if(point.getPoints()-point.getUsePoints()>=needPoints){ |
| | | point.setUsePoints(point.getUsePoints()+needPoints); |
| | | crmClinicPointsMapper.updateById(point); |
| | | needPoints = 0; |
| | | }else { |
| | | point.setUsePoints(point.getPoints()); |
| | | crmClinicPointsMapper.updateById(point); |
| | | needPoints= needPoints - (point.getPoints() - point.getUsePoints()); |
| | | } |
| | | } |
| | | |
| | | // 添加兑换记录 |
| | | TSysGoodsExchange exchange = new TSysGoodsExchange(); |
| | | exchange.setClinicName(crmClinic.getClinicName()); |
| | | exchange.setGoodsName(tSysGoods.getGoodsName()); |
| | | exchange.setGoodsId(tSysGoods.getId()); |
| | | exchange.setGoodsCount(dto.getCount()); |
| | | exchange.setUsePoints(tSysGoods.getRequiredPoints().intValue() * dto.getCount()); |
| | | exchange.setExchangeTime(LocalDateTime.now()); |
| | | exchange.setClinicId(crmClinic.getId()); |
| | | sysGoodsExchangeMapper.insert(exchange); |
| | | |
| | | // 记录 |
| | | TCrmChangePoints tCrmChangePoints = new TCrmChangePoints(); |
| | | tCrmChangePoints.setBranchSalespersonId(crmClinic.getId()); |
| | | tCrmChangePoints.setExchangeId(exchange.getId()); |
| | | tCrmChangePoints.setUserType(3); |
| | | tCrmChangePoints.setChangeType(2); |
| | | tCrmChangePoints.setChangeReason(2); |
| | | tCrmChangePoints.setChangeValue(exchange.getUsePoints()); |
| | | crmChangePointsMapper.insert(tCrmChangePoints); |
| | | |
| | | } |
| | | } |
| New file |
| | |
| | | package com.ruoyi.system.vo; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Data |
| | | @ApiModel(value = "诊所采购详情三级Vo") |
| | | public class DetailProcurementNextThreeVO { |
| | | |
| | | @ApiModelProperty(value = "批次号") |
| | | private String batchNumber; |
| | | |
| | | @ApiModelProperty(value = "生产日期") |
| | | private LocalDateTime productionDate; |
| | | |
| | | @ApiModelProperty(value = "有效期") |
| | | private LocalDateTime expirationDate; |
| | | |
| | | |
| | | @ApiModelProperty(value = "入库数量") |
| | | private Integer num; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | @ApiModel(value = "诊所采购详情二级Vo") |
| | |
| | | @ApiModelProperty(value = "国药准字号") |
| | | private String quasiNumber; |
| | | |
| | | @ApiModelProperty(value = "数量") |
| | | private Integer num; |
| | | |
| | | @ApiModelProperty(value = "单位") |
| | | private String packingUnitName; |
| | | |
| | | @ApiModelProperty(value = "售价") |
| | | private BigDecimal salesAmount; |
| | | |
| | | @ApiModelProperty(value = "数量") |
| | | private Integer num; |
| | | |
| | | @ApiModelProperty(value = "状态") |
| | | private BigDecimal totalPrice=BigDecimal.ZERO; |
| | |
| | | private BigDecimal purchasePrice; |
| | | |
| | | |
| | | @ApiModelProperty(value = "采购三级") |
| | | private List<DetailProcurementNextThreeVO> detailProcurementNextThreeVOS; |
| | | |
| | | |
| | | |
| | | |
| | | |
| New file |
| | |
| | | package com.ruoyi.system.vo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Data |
| | | @ApiModel("兑换记录详情") |
| | | public class ExchangeGoodsRecordDetailVo { |
| | | @TableId(value = "id", type = IdType.ASSIGN_ID) |
| | | private String id; |
| | | |
| | | @ApiModelProperty(value = "诊所名称") |
| | | private String clinicName; |
| | | |
| | | @ApiModelProperty(value = "商品名称") |
| | | private String goodsName; |
| | | |
| | | @ApiModelProperty(value = "商品id") |
| | | private String goodsId; |
| | | |
| | | @ApiModelProperty(value = "商品数量") |
| | | private Integer goodsCount; |
| | | |
| | | @ApiModelProperty(value = "使用积分") |
| | | private Integer usePoints; |
| | | |
| | | @ApiModelProperty(value = "兑换时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private LocalDateTime exchangeTime; |
| | | |
| | | @ApiModelProperty(value = "状态 1=未发货 2=已发货") |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty(value = "物流单号") |
| | | private String logisticsNumber; |
| | | |
| | | @ApiModelProperty(value = "诊所id") |
| | | private String clinicId; |
| | | |
| | | @ApiModelProperty(value = "封面") |
| | | private String goodsCover; |
| | | |
| | | @ApiModelProperty(value = "商品详情") |
| | | private String goodsDetail; |
| | | |
| | | |
| | | } |
| | |
| | | private LocalDateTime maintenanceTime; |
| | | |
| | | |
| | | @ApiModelProperty(value = "维护完成时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private LocalDateTime successTime; |
| | | |
| | | |
| | | @ApiModelProperty(value = "状态 1=未维护 2=已维护") |
| | | private Integer status; |
| | | |
| | |
| | | |
| | | <select id="warehousePageList" resultType="com.ruoyi.system.vo.TErpClinicWarehousePageListVO"> |
| | | select t1.id,t1.warehouse_no, |
| | | case when t1.type =1 then t2.supplier_name else t4.supplier_name end as supplierName, |
| | | case when t1.type =1 then t2.supplier_name else t1.supplier_name end as supplierName, |
| | | t3.procurement_code, |
| | | case when t1.type =1 then t3.pay_money else t1.total_price end as allTotalPrice, |
| | | t1.create_time warehouseTime,t1.type |
| | | from t_erp_clinic_warehousing t1 left join t_erp_procurement t3 on t1.procurement_id = t3.id |
| | | from t_erp_clinic_warehousing t1 |
| | | left join t_erp_procurement t3 on t1.procurement_id = t3.id |
| | | left join t_crm_supplier t2 on t3.supplier_id = t2.id and t1.type =1 |
| | | left join t_crm_supplier t4 on t1.supplier_id = t4.id and t1.type !=1 |
| | | where t1.disabled = 0 and t1.clinic_id = #{supplierClinicId} |
| | | |
| | | where t1.disabled = 0 and t1.clinic_id = #{supplierClinicId} and t1.status =2 |
| | | <if test="query.warehouseNo != null and query.warehouseNo != ''"> |
| | | and t1.warehouse_no like concat('%',#{query.warehouseNo},'%') |
| | | </if> |
| | | <if test="query.supplierName != null and query.supplierName != ''"> |
| | | and (t2.supplier_name like concat('%',#{query.supplierName},'%') or t4.supplier_name like concat('%',#{query.supplierName},'%')) |
| | | and (t2.supplier_name like concat('%',#{query.supplierName},'%') or t1.supplier_name like concat('%',#{query.supplierName},'%')) |
| | | </if> |
| | | <if test="sTime != null"> |
| | | and t1.create_time between #{sTime} and #{eTime} |
| | |
| | | storage,supplier_name |
| | | |
| | | </sql> |
| | | |
| | | |
| | | <select id="pageList" resultType="com.ruoyi.system.vo.TErpGoodsVO"> |
| | | select |
| | | <include refid="Base_Column_List"/> |
| | | from t_erp_goods where disabled = 0 |
| | | <if test="query.goodsName != null and query.goodsName != ''"> |
| | | and goods_name like concat('%',#{query.goodsName},'%') |
| | | 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, |
| | | case t1.goods_source |
| | | when 1 then t2.supplier_name |
| | | when 2 then t1.supplier_name |
| | | end as supplierName |
| | | from t_erp_goods t1 left join t_crm_supplier t2 on t1.supplier_clinic_id = t2.id where t1.disabled = 0 |
| | | <if test="query.supplierName != null and query.supplierName != ''"> |
| | | and (t1.supplier_name like concat('%',#{query.supplierName},'%') or 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.goodsIdCode != null and query.goodsIdCode != ''"> |
| | | and goods_id_code like concat('%',#{query.goodsIdCode},'%') |
| | | and t1.goods_id_code like concat('%',#{query.goodsIdCode},'%') |
| | | </if> |
| | | <if test="query.typeId != null and query.typeId != ''"> |
| | | and type_id = #{query.typeId} |
| | | and t1.type_id = #{query.typeId} |
| | | </if> |
| | | <if test="query.quasiNumber != null and query.quasiNumber != ''"> |
| | | and quasi_number like concat('%',#{query.quasiNumber},'%') |
| | | and t1.quasi_number like concat('%',#{query.quasiNumber},'%') |
| | | </if> |
| | | <if test="query.state != null "> |
| | | and state = #{query.state} |
| | | and t1.state = #{query.state} |
| | | </if> |
| | | <if test="user.roleType != null and user.roleType == 4 "> |
| | | and goods_source =1 and supplier_clinic_id = #{query.supplierClinicId} |
| | | and t1.goods_source =1 and t1.supplier_clinic_id = #{query.supplierClinicId} |
| | | </if> |
| | | <if test="user.roleType != null and user.roleType == 5 "> |
| | | and ( (goods_source =2 and supplier_clinic_id = #{query.supplierClinicId} ) or (FIND_IN_SET(#{query.supplierClinicId},clinic_ids) and state =1)) |
| | | and ( ( t1.goods_source =2 and t1.supplier_clinic_id = #{query.supplierClinicId} ) or (FIND_IN_SET(#{query.supplierClinicId}, t1.clinic_ids) and t1.state =1)) |
| | | </if> |
| | | order by create_time desc |
| | | order by t1.create_time desc |
| | | </select> |
| | | |
| | | |
| | | <select id="listExport" resultType="com.ruoyi.system.vo.TErpGoodsVO"> |
| | | select |
| | | <include refid="Base_Column_List"/> |
| | |
| | | t1.maintenance_person_id, |
| | | t1.maintenance_time, |
| | | t1.`status`, |
| | | t3.warehouse_no |
| | | t3.warehouse_no, |
| | | t1.success_time as successTime |
| | | from t_erp_maintenance_reminder t1 |
| | | LEFT JOIN t_erp_supplier_warehousing_batch t2 on t1.warehousing_batch_id = t2.id |
| | | left join t_erp_supplier_warehousing t3 on t2.warehousing_id = t3.id |
| | |
| | | and t1.create_time between #{sTime} and #{eTime} |
| | | </if> |
| | | group by t1.id |
| | | order by t1.create_time desc |
| | | |
| | | </select> |
| | | <select id="inventoryNotEnoughList" resultType="com.ruoyi.system.vo.TErpGoodsVO"> |
| | |
| | | t1.status |
| | | from t_erp_procurement t1 |
| | | left JOIN t_crm_clinic t2 on t1.clinic_id = t2.id |
| | | where t1.disabled = 0 and t1.status in(3,4,5) and t1.supplier_id =#{supplierClinicId} |
| | | where t1.disabled = 0 and t1.status in(3,4,5) and t1.supplier_id in |
| | | <foreach collection="supplierClinicId" close=")" item="id" separator="," open="(" > |
| | | #{id} |
| | | </foreach> |
| | | <if test="query.procurementCode != null and query.procurementCode != ''"> |
| | | and t1.procurement_code = #{query.procurementCode} |
| | | </if> |
| | |
| | | |
| | | |
| | | <select id="validityPeriodWarning" resultType="com.ruoyi.system.vo.ValidityPeriodWarningVo"> |
| | | select t2.warehouse_id,t2.warehouse_no warehousingNo, t4.goods_name, t4.quasi_number, t1.batch_number, t1.id as batchId,t1.expiry_date, t4.id as goodsId,t5.type_name,t6.unit_name packingUnitName, |
| | | select * from (select t2.warehouse_id,t2.warehouse_no warehousingNo, t4.goods_name, t4.quasi_number, |
| | | t1.batch_number, t1.id as batchId,t1.expiry_date, t4.id as goodsId,t5.type_name,t6.unit_name packingUnitName, |
| | | case |
| | | when t3.id is null then t1.warehousing_number |
| | | else t1.warehousing_number -t3.outbound_count |
| | | end as num |
| | | end as num,t3.id as ogid |
| | | from t_erp_supplier_warehousing_batch t1 |
| | | left join t_erp_supplier_warehousing t2 on t1.warehousing_id = t2.id |
| | | LEFT JOIN t_erp_supplier_outbound_goods t3 on t3.warehousing_batch_id = t1.id |
| | |
| | | left join t_erp_goods_type t5 on t4.type_id = t5.id |
| | | left join t_erp_goods_unit t6 on t4.packing_unit_id = t6.id |
| | | where #{time} > t1.expiry_date |
| | | and (t1.warehousing_number - t3.outbound_count > 0 or t3.id is null) |
| | | <if test="user.roleType !=null and user.roleType ==4"> |
| | | and t2.supplier_id =#{supplierClinicId} |
| | | <if test="user.roleType !=null and user.roleType ==4"> and t2.supplier_id =#{supplierClinicId} |
| | | </if> |
| | | <if test="query.name != null and query.name != ''"> |
| | | and t4.goods_name like concat('%',#{query.goodsName},'%') |
| | |
| | | <if test="query.typeId != null and query.typeId != ''"> |
| | | and t4.type_id = #{query.typeId} |
| | | </if> |
| | | order by t1.expiry_date |
| | | group by t1.id |
| | | ) as o where (o.num > 0 or o.ogid is null) |
| | | order by o.expiry_date |
| | | |
| | | </select> |
| | | <select id="pageInventoryList" resultType="com.ruoyi.system.vo.PageInventoryListVo"> |