Merge remote-tracking branch 'origin/master'
| | |
| | | package com.ruoyi.web.controller.api; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | 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.R; |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import com.ruoyi.framework.web.service.TokenService; |
| | | import com.ruoyi.system.dto.ClinicOutboundGoodsDto; |
| | | import com.ruoyi.system.dto.InventoryDto; |
| | | import com.ruoyi.system.dto.WarehouseGoodsDto; |
| | | import com.ruoyi.system.dto.clinicWarehouseGoodsDto; |
| | | import com.ruoyi.system.model.TCrmClinic; |
| | | import com.ruoyi.system.model.TCrmSupplier; |
| | | import com.ruoyi.system.model.TErpClinicOutbound; |
| | | import com.ruoyi.system.model.TErpGoods; |
| | | import com.ruoyi.system.model.*; |
| | | import com.ruoyi.system.query.*; |
| | | import com.ruoyi.system.service.*; |
| | | import com.ruoyi.system.vo.*; |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.validation.Valid; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | |
| | | private final TokenService tokenService; |
| | | private final TCrmClinicService crmClinicService; |
| | | private final TCrmSupplierService crmSupplierService; |
| | | private final TErpClinicWarehousingBatchService erpClinicWarehousingBatchService; |
| | | private final TErpGoodsUnitService erpGoodsUnitService; |
| | | |
| | | |
| | | @Autowired |
| | | public TErpClinicWarehousingController(TErpClinicWarehousingService erpClinicWarehousingService, TErpGoodsService erpGoodsService, TokenService tokenService, |
| | | TCrmClinicService crmClinicService,TCrmSupplierService crmSupplierService) { |
| | | TCrmClinicService crmClinicService,TCrmSupplierService crmSupplierService,TErpClinicWarehousingBatchService erpClinicWarehousingBatchService, |
| | | TErpGoodsUnitService erpGoodsUnitService) { |
| | | this.erpClinicWarehousingService = erpClinicWarehousingService; |
| | | this.erpGoodsService = erpGoodsService; |
| | | this.tokenService = tokenService; |
| | | this.crmClinicService = crmClinicService; |
| | | this.crmSupplierService = crmSupplierService; |
| | | this.erpClinicWarehousingBatchService = erpClinicWarehousingBatchService; |
| | | this.erpGoodsUnitService = erpGoodsUnitService; |
| | | |
| | | } |
| | | |
| | |
| | | /** |
| | | * 获取erp问题上报管理列表 |
| | | */ |
| | | @ApiOperation(value = "展示获取库存分页列表") |
| | | @ApiOperation(value = "诊所 获取库存分页列表") |
| | | @PostMapping(value = "/pageList") |
| | | public R<PageInfo<TErpGoodsVO>> pageList(@RequestBody TErpGoodsQuery query) { |
| | | |
| | |
| | | } |
| | | |
| | | return R.ok(erpClinicWarehousingService.pageList(query,user)); |
| | | } |
| | | |
| | | /** |
| | | * 获取erp问题上报管理列表 |
| | | */ |
| | | @ApiOperation(value = "诊所 获取库存库存不足") |
| | | @PostMapping(value = "/pageNotInventoryGoodsList") |
| | | public R<List<TErpGoodsVO>> pageNotInventoryGoodsList(@RequestBody TErpGoodsQuery query) { |
| | | |
| | | SysUser user = tokenService.getLoginUser().getUser(); |
| | | Integer roleType = user.getRoleType(); |
| | | if(roleType == 4){ |
| | | // 供应商 |
| | | TCrmSupplier crmSupplier = crmSupplierService.getOne(Wrappers.lambdaQuery(TCrmSupplier.class) |
| | | .eq(TCrmSupplier::getUserId, user.getUserId()) |
| | | .last("LIMIT 1")); |
| | | query.setSupplierClinicId(crmSupplier.getId()); |
| | | } |
| | | if(roleType == 5){ |
| | | // 诊所 |
| | | TCrmClinic crmClinic = crmClinicService.getOne(Wrappers.lambdaQuery(TCrmClinic.class) |
| | | .eq(TCrmClinic::getUserId, user.getUserId()) |
| | | .last("LIMIT 1")); |
| | | query.setSupplierClinicId(crmClinic.getId()); |
| | | } |
| | | |
| | | return R.ok(erpClinicWarehousingService.pageList1(query,user)); |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | return R.ok(erpGoodsService.warehouseGoodsPageList(query,user,supplierClinicId)); |
| | | } |
| | | |
| | | |
| | | |
| | | @ApiOperation(value = "诊所 入库商品详情") |
| | | @GetMapping(value = "/warehouseGoodsDetail/{id}") |
| | | public R<WarehouseGoodsDetailVo> warehouseGoodsDetail(@PathVariable String id) { |
| | |
| | | |
| | | @ApiOperation(value = "诊所 入库商品操作") |
| | | @PostMapping(value = "/warehouseGoods") |
| | | public R<?> warehouseGoods(@RequestBody @Valid List<clinicWarehouseGoodsDto> dtos) { |
| | | public R<?> warehouseGoods(@RequestBody @Valid WarehouseGoodsDto dto) { |
| | | SysUser user = tokenService.getLoginUser().getUser(); |
| | | Integer roleType = user.getRoleType(); |
| | | String supplierClinicId =null; |
| | |
| | | .last("LIMIT 1")); |
| | | supplierClinicId = crmClinic.getId(); |
| | | } |
| | | erpClinicWarehousingService.warehouseGoods(dtos,user,supplierClinicId); |
| | | erpClinicWarehousingService.warehouseGoods(dto,user,supplierClinicId); |
| | | return R.ok(); |
| | | } |
| | | @ApiOperation(value = "诊所 获取草稿") |
| | | @GetMapping(value = "/getWarehouseGoodsDraft") |
| | | public R<List<TErpClinicWarehousingBatch>> getWarehouseGoodsDraft() { |
| | | SysUser user = tokenService.getLoginUser().getUser(); |
| | | Integer roleType = user.getRoleType(); |
| | | String supplierClinicId =null; |
| | | ArrayList<TErpClinicWarehousingBatch> clinicWarehouseGoodsDtos = new ArrayList<>(); |
| | | if(roleType == 5){ |
| | | // 诊所 |
| | | TCrmClinic crmClinic = crmClinicService.getOne(Wrappers.lambdaQuery(TCrmClinic.class) |
| | | .eq(TCrmClinic::getUserId, user.getUserId()) |
| | | .last("LIMIT 1")); |
| | | supplierClinicId = crmClinic.getId(); |
| | | List<TErpClinicWarehousing> list = erpClinicWarehousingService.list(new LambdaQueryWrapper<TErpClinicWarehousing>().eq(TErpClinicWarehousing::getClinicId, supplierClinicId).eq(TErpClinicWarehousing::getStatus, 1).orderByDesc(BaseModel::getCreateTime)); |
| | | if(list.isEmpty()){ |
| | | return R.ok(clinicWarehouseGoodsDtos); |
| | | } |
| | | List<TErpClinicWarehousingBatch> list1 = erpClinicWarehousingBatchService.list(new LambdaQueryWrapper<TErpClinicWarehousingBatch>().eq(TErpClinicWarehousingBatch::getWarehousingId, list.get(0).getId())); |
| | | for (TErpClinicWarehousingBatch tErpClinicWarehousingBatch : list1) { |
| | | String goodsId = tErpClinicWarehousingBatch.getGoodsId(); |
| | | TErpGoods tErpGoods = erpGoodsService.getOne(new LambdaQueryWrapper<TErpGoods>().eq(TErpGoods::getId, goodsId)); |
| | | TErpGoodsUnit byId = erpGoodsUnitService.getById(tErpGoods.getPackingUnitId()); |
| | | tErpClinicWarehousingBatch.setUnitName(byId.getUnitName()); |
| | | } |
| | | return R.ok(list1); |
| | | } |
| | | return R.ok(clinicWarehouseGoodsDtos); |
| | | } |
| | | |
| | | |
| | | |
| | |
| | | } |
| | | return R.ok(erpGoodsService.pageList(query,user)); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取erp问题上报管理列表 |
| | | */ |
| | | @ApiOperation(value = "诊所 一键获取商品分页列表") |
| | | @PostMapping(value = "/pageAddList") |
| | | public R<Page<TErpGoods>> pageAddList(BasePage query) { |
| | | public R<Page<TErpGoods>> pageAddList(@RequestBody BasePage query) { |
| | | SysUser user = tokenService.getLoginUser().getUser(); |
| | | Integer roleType = user.getRoleType(); |
| | | String clinicSupplierId=null; |
| | |
| | | } |
| | | Page<TErpGoods> tErpGoodsPage = new Page<>(query.getPageNum(), query.getPageSize()); |
| | | |
| | | Page<TErpGoods> page = erpGoodsService.page(tErpGoodsPage, new LambdaQueryWrapper<TErpGoods>().eq(TErpGoods::getGoodsSource, 1).eq(BaseModel::getDisabled, 0).isNotNull(TErpGoods::getPlatformCommissionPrice).last("and (NOT FIND_IN_SET(" + clinicSupplierId + ",clinic_ids) or clinic_ids is null)")); |
| | | Page<TErpGoods> page = erpGoodsService.page(tErpGoodsPage, new LambdaQueryWrapper<TErpGoods>().eq(TErpGoods::getGoodsSource, 1).eq(TErpGoods::getState,1).eq(BaseModel::getDisabled, 0).isNotNull(TErpGoods::getPlatformCommissionPrice).last("and (NOT FIND_IN_SET(" + clinicSupplierId + ",clinic_ids) or clinic_ids is null)")); |
| | | for (TErpGoods record : page.getRecords()) { |
| | | TCrmSupplier byId = crmSupplierService.getById(record.getSupplierClinicId()); |
| | | record.setSupplierName(byId.getSupplierName()); |
| | |
| | | |
| | | } |
| | | return R.ok(page); |
| | | } |
| | | |
| | | /** |
| | | * 获取erp问题上报管理列表 |
| | | */ |
| | | @ApiOperation(value = "诊所 一键获取商品 获取全部") |
| | | @PostMapping(value = "/getAllGoodsList") |
| | | public R<?> getAllGoodsList() { |
| | | SysUser user = tokenService.getLoginUser().getUser(); |
| | | Integer roleType = user.getRoleType(); |
| | | String clinicSupplierId=null; |
| | | if(roleType == 5){ |
| | | // 诊所 |
| | | TCrmClinic crmClinic = crmClinicService.getOne(Wrappers.lambdaQuery(TCrmClinic.class) |
| | | .eq(TCrmClinic::getUserId, user.getUserId()) |
| | | .last("LIMIT 1")); |
| | | clinicSupplierId = crmClinic.getId(); |
| | | } |
| | | |
| | | List<TErpGoods> list = erpGoodsService.list(new LambdaQueryWrapper<TErpGoods>().eq(TErpGoods::getGoodsSource, 1).eq(TErpGoods::getState,1).eq(BaseModel::getDisabled, 0).isNotNull(TErpGoods::getPlatformCommissionPrice).last("and (NOT FIND_IN_SET(" + clinicSupplierId + ",clinic_ids) or clinic_ids is null)")); |
| | | for (TErpGoods goods : list) { |
| | | String clinicIds = goods.getClinicIds(); |
| | | if(clinicIds == null || clinicIds.isEmpty()){ |
| | | goods.setClinicIds(clinicSupplierId); |
| | | }else { |
| | | String[] split = clinicIds.split(","); |
| | | ArrayList<String> split1 = new ArrayList<>(); |
| | | for (String s : split) { |
| | | split1.add(s); |
| | | } |
| | | if(!split1.contains(clinicSupplierId)){ |
| | | split1.add(clinicSupplierId); |
| | | goods.setClinicIds(String.join(",",split1)); |
| | | } |
| | | } |
| | | |
| | | } |
| | | erpGoodsService.updateBatchById(list); |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | |
| | | } |
| | | goods.setCreateId(user.getUserId().toString()); |
| | | goods.setGoodsIdCode(dto.getGoodsIdCode()); |
| | | goods.setClinicPurchasePrice(dto.getSalesAmount()); |
| | | return R.ok(erpGoodsService.save(goods)); |
| | | } |
| | | |
| | |
| | | |
| | | @ApiOperation(value = "诊所 一键添加商品") |
| | | @PostMapping(value = "/addSupplierGoods") |
| | | public R<Boolean> addSupplierGoods(String goodsIds) { |
| | | List<String> split = Arrays.asList(goodsIds.split(",")); |
| | | List<TErpGoods> list = erpGoodsService.list(new LambdaQueryWrapper<TErpGoods>().in(TErpGoods::getId, split)); |
| | | public R<Boolean> addSupplierGoods(@RequestBody AddSupplierGoodsDto dto) { |
| | | // List<String> split = Arrays.asList(goodsIds.split(",")); |
| | | List<TErpGoods> list = erpGoodsService.list(new LambdaQueryWrapper<TErpGoods>().in(TErpGoods::getId, dto.getGoodsIds())); |
| | | SysUser user = tokenService.getLoginUser().getUser(); |
| | | String cid = null; |
| | | |
| | |
| | | cid = crmClinic.getId(); |
| | | for (TErpGoods goods : list) { |
| | | String clinicIds = goods.getClinicIds(); |
| | | List<String> split1 = Arrays.asList(clinicIds.split(",")); |
| | | if(!split1.contains(cid)){ |
| | | split1.add(cid); |
| | | goods.setClinicIds(String.join(",",split1)); |
| | | if(clinicIds==null || clinicIds.isEmpty()){ |
| | | goods.setClinicIds( cid); |
| | | }else { |
| | | String[] split = clinicIds.split(","); |
| | | List<String> split1 = new ArrayList<>(); |
| | | for (String s : split) { |
| | | split1.add(s); |
| | | } |
| | | if(!split1.contains(cid)){ |
| | | split1.add(cid); |
| | | goods.setClinicIds(String.join(",",split1)); |
| | | } |
| | | } |
| | | |
| | | } |
| | | erpGoodsService.updateBatchById(list); |
| | | } |
New file |
| | |
| | | package com.ruoyi.system.dto; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class AddSupplierGoodsDto { |
| | | private List<String> goodsIds; |
| | | } |
New file |
| | |
| | | package com.ruoyi.system.dto; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | @ApiModel("诊所入库操作") |
| | | public class WarehouseGoodsDto { |
| | | @ApiModelProperty("1草稿") |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty("商品信息") |
| | | private List<clinicWarehouseGoodsDto> dtos; |
| | | } |
| | |
| | | import javax.validation.constraints.NotBlank; |
| | | import javax.validation.constraints.NotNull; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Data |
| | |
| | | |
| | | @ApiModelProperty(value = "生产日期") |
| | | @NotNull(message = "生产日期不能为空") |
| | | private LocalDateTime productionDate; |
| | | private LocalDate productionDate; |
| | | |
| | | @ApiModelProperty(value = "有效日期") |
| | | @NotNull(message = "有效日期不能为空") |
| | | private LocalDateTime expiryDate; |
| | | private LocalDate expiryDate; |
| | | |
| | | @ApiModelProperty(value = "供应商id") |
| | | @NotBlank(message = "供应商id不能为空") |
| | | // @NotBlank(message = "供应商id不能为空") |
| | | private String supplierId; |
| | | |
| | | } |
| | |
| | | |
| | | List<TErpClinicOutboundPageListVO> outboundPageList(@Param("query") TClinicOutboundQuery query, @Param("pageInfo") PageInfo<TErpClinicOutboundPageListVO> pageInfo, @Param("user") SysUser user, @Param("supplierClinicId") String supplierClinicId, @Param("sTime") String sTime, @Param("eTime") String eTime); |
| | | |
| | | |
| | | List<TErpGoodsVO> pageList1(@Param("query") TErpGoodsQuery query, @Param("user") SysUser user); |
| | | |
| | | } |
| | |
| | | @ApiModelProperty(value = "盘点id") |
| | | @TableField("inventory_id") |
| | | private String inventoryId; |
| | | |
| | | @ApiModelProperty(value = "入库状态 1=草稿 2=正常") |
| | | private Integer status; |
| | | } |
| | |
| | | @ApiModelProperty(value = "库存管理条件 不足传1") |
| | | private Integer type; |
| | | |
| | | @ApiModelProperty(value = "1入库 其他不传") |
| | | private Integer category; |
| | | |
| | | @ApiModelProperty(value = "供应商id/诊所id") |
| | | private String supplierClinicId; |
| | | } |
| | |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import com.ruoyi.system.dto.ClinicOutboundGoodsDto; |
| | | import com.ruoyi.system.dto.WarehouseGoodsDto; |
| | | import com.ruoyi.system.dto.clinicWarehouseGoodsDto; |
| | | import com.ruoyi.system.model.TErpClinicWarehousing; |
| | | import com.ruoyi.system.model.TErpGoods; |
| | |
| | | PageInfo<TErpClinicOutboundPageListVO> outboundPageList(TClinicOutboundQuery query, SysUser user, String supplierClinicId); |
| | | |
| | | |
| | | void warehouseGoods(@Valid List<clinicWarehouseGoodsDto> dtos, SysUser user, String supplierClinicId); |
| | | void warehouseGoods(@Valid WarehouseGoodsDto dto, SysUser user, String supplierClinicId); |
| | | |
| | | void outboundGoods(@Valid ClinicOutboundGoodsDto dto, SysUser user, String supplierClinicId); |
| | | |
| | | |
| | | List<TErpGoodsVO> pageList1(TErpGoodsQuery query, SysUser user); |
| | | |
| | | |
| | | } |
| | |
| | | OutboundGoodsDetailVo outboundGoodsDetail(String id); |
| | | |
| | | |
| | | PageInfo<TErpGoodsVO> pageList1(TErpGoodsQuery query, SysUser user); |
| | | |
| | | |
| | | } |
| | |
| | | import com.ruoyi.common.utils.DateUtils; |
| | | import com.ruoyi.system.dto.ClinicOutboundGoodsDto; |
| | | import com.ruoyi.system.dto.OutboundGoodsNextDto; |
| | | import com.ruoyi.system.dto.WarehouseGoodsDto; |
| | | import com.ruoyi.system.dto.clinicWarehouseGoodsDto; |
| | | import com.ruoyi.system.mapper.*; |
| | | import com.ruoyi.system.model.*; |
| | |
| | | pageInfo.setRecords(list); |
| | | return pageInfo; |
| | | } |
| | | @Override |
| | | public List<TErpGoodsVO> pageList1(TErpGoodsQuery query, SysUser user) { |
| | | List<TErpGoodsVO> list = this.baseMapper.pageList1(query,user); |
| | | if(list.isEmpty()){ |
| | | return list; |
| | | } |
| | | |
| | | |
| | | 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())); |
| | | tErpGoodsVO.setTypeName(tErpGoodsVO.getTypeName()); |
| | | } |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | @Override |
| | | public PageInfo<TErpClinicWarehousePageListVO> warehousePageList(TClinicWarehouseQuery query, SysUser user, String supplierClinicId) { |
| | |
| | | } |
| | | |
| | | @Override |
| | | public void warehouseGoods(List<clinicWarehouseGoodsDto> dtos, SysUser user, String supplierClinicId) { |
| | | public void warehouseGoods(WarehouseGoodsDto dtos, SysUser user, String supplierClinicId) { |
| | | |
| | | // dtos根据供应商分组 |
| | | Map<String, List<clinicWarehouseGoodsDto>> collect = dtos.stream().collect(Collectors.groupingBy(clinicWarehouseGoodsDto::getSupplierId)); |
| | | // Map<String, List<clinicWarehouseGoodsDto>> collect = dtos.stream().collect(Collectors.groupingBy(clinicWarehouseGoodsDto::getSupplierId)); |
| | | |
| | | for (Map.Entry<String, List<clinicWarehouseGoodsDto>> stringListEntry : collect.entrySet()) { |
| | | String key = stringListEntry.getKey(); |
| | | List<clinicWarehouseGoodsDto> value = stringListEntry.getValue(); |
| | | // for (Map.Entry<String, List<clinicWarehouseGoodsDto>> stringListEntry : collect.entrySet()) { |
| | | TErpClinicWarehousing tErpClinicWarehousing = new TErpClinicWarehousing(); |
| | | tErpClinicWarehousing.setClinicId(supplierClinicId); |
| | | tErpClinicWarehousing.setCreateId(user.getUserId().toString()); |
| | | tErpClinicWarehousing.setWarehouseNo("G"+ DateUtils.dateTimeNow()); |
| | | tErpClinicWarehousing.setCreateTime(LocalDateTime.now()); |
| | | tErpClinicWarehousing.setSupplierId(key); |
| | | tErpClinicWarehousing.setType(3); |
| | | tErpClinicWarehousing.setStatus(dtos.getStatus()); |
| | | this.save(tErpClinicWarehousing); |
| | | |
| | | BigDecimal totalPrice = new BigDecimal(0); |
| | | for (clinicWarehouseGoodsDto dto : value) { |
| | | for (clinicWarehouseGoodsDto dto : dtos.getDtos()) { |
| | | TErpClinicWarehousingBatch tErpClinicWarehousingBatch = new TErpClinicWarehousingBatch(); |
| | | tErpClinicWarehousingBatch.setWarehousingId(tErpClinicWarehousing.getId()); |
| | | tErpClinicWarehousingBatch.setWarehousingNumber(dto.getPurchaseCount()); |
| | | tErpClinicWarehousingBatch.setBatchNumber(dto.getBatchNumber()); |
| | | tErpClinicWarehousingBatch.setProductionDate(dto.getProductionDate()); |
| | | tErpClinicWarehousingBatch.setExpiryDate(dto.getExpiryDate()); |
| | | tErpClinicWarehousingBatch.setProductionDate(dto.getProductionDate().atStartOfDay()); |
| | | tErpClinicWarehousingBatch.setExpiryDate(dto.getExpiryDate().atStartOfDay()); |
| | | tErpClinicWarehousingBatch.setGoodsId(dto.getId()); |
| | | TErpGoods goods = erpGoodsMapper.selectById(dto.getId()); |
| | | tErpClinicWarehousingBatch.setGoodsName(goods.getGoodsName()); |
| | |
| | | tErpClinicWarehousing.setTotalPrice(totalPrice); |
| | | this.updateById(tErpClinicWarehousing); |
| | | |
| | | } |
| | | // } |
| | | |
| | | } |
| | | |
| | |
| | | typeList.stream().filter(t -> t.getId().equals(tErpGoodsVO.getTypeId())).findFirst().ifPresent(t -> tErpGoodsVO.setTypeName(t.getTypeName())); |
| | | } |
| | | } |
| | | List<String> collect = list.stream().filter(e -> e.getGoodsSource() == 1).map(TErpGoods::getSupplierClinicId).collect(Collectors.toList()); |
| | | if (!collect.isEmpty()) { |
| | | List<TCrmSupplier> crmClinics = crmSupplierMapper.selectBatchIds(collect); |
| | | for (TErpGoodsVO tErpGoodsVO : list) { |
| | | crmClinics.stream().filter(t -> t.getId().equals(tErpGoodsVO.getSupplierClinicId())).findFirst().ifPresent(t -> tErpGoodsVO.setSupplierName(t.getSupplierName())); |
| | | } |
| | | } |
| | | |
| | | pageInfo.setRecords(list); |
| | | return pageInfo; |
| | | } |
| | | @Override |
| | | public PageInfo<TErpGoodsVO> pageList1(TErpGoodsQuery query, SysUser user) { |
| | | PageInfo<TErpGoodsVO> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize()); |
| | | List<TErpGoodsVO> list = this.baseMapper.pageList(query, pageInfo, user); |
| | | 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 boolean isExit(String goodsIdCode, String quasiNumber,String id) { |
| | | Long size = this.baseMapper.selectCount(new LambdaQueryWrapper<>(TErpGoods.class).ne(id!=null,TErpGoods::getId, id).eq(TErpGoods::getGoodsIdCode, goodsIdCode).or().eq(TErpGoods::getQuasiNumber, quasiNumber)); |
| | | Long size = this.baseMapper.selectCount(new LambdaQueryWrapper<>(TErpGoods.class).ne(id!=null,TErpGoods::getId, id).and(q -> q.eq(TErpGoods::getGoodsIdCode, goodsIdCode).or().eq(TErpGoods::getQuasiNumber, quasiNumber))); |
| | | if (size > 0) { |
| | | return true; |
| | | } |
| | |
| | | } |
| | | wrapper.orderByDesc(BaseModel::getCreateTime); |
| | | Page<TErpGoods> page = this.page(new Page<>(query.getPageNum(), query.getPageSize()), wrapper); |
| | | List<TErpGoods> records = page.getRecords(); |
| | | if(records.isEmpty()){ |
| | | return page; |
| | | } |
| | | List<String> packingUnitId = records.stream().map(TErpGoods::getPackingUnitId).collect(Collectors.toList()); |
| | | if(!packingUnitId.isEmpty()){ |
| | | List<TErpGoodsUnit> tErpGoodsUnits = erpGoodsUnitMapper.selectBatchIds(packingUnitId); |
| | | for (TErpGoods tErpGoods : records) { |
| | | tErpGoodsUnits.stream().filter(t -> t.getId().equals(tErpGoods.getPackingUnitId())).findFirst().ifPresent(t -> tErpGoods.setPackingUnitName(t.getUnitName())); |
| | | } |
| | | } |
| | | page.setRecords( records); |
| | | return page; |
| | | } |
| | | |
| | |
| | | } |
| | | List<String> supplierClinicId = list.stream().filter(e->e.getGoodsSource()==1).map(TErpGoods::getSupplierClinicId).collect(Collectors.toList()); |
| | | if(!supplierClinicId.isEmpty()){ |
| | | List<TCrmClinic> crmClinics = crmClinicMapper.selectBatchIds(supplierClinicId); |
| | | List<TCrmSupplier> crmClinics = crmSupplierMapper.selectBatchIds(supplierClinicId); |
| | | for (TErpGoods tErpGoodsVO : list) { |
| | | crmClinics.stream().filter(t -> t.getId().equals(tErpGoodsVO.getSupplierClinicId())).findFirst().ifPresent(t -> tErpGoodsVO.setSupplierName(t.getClinicName())); |
| | | crmClinics.stream().filter(t -> t.getId().equals(tErpGoodsVO.getSupplierClinicId())).findFirst().ifPresent(t -> tErpGoodsVO.setSupplierName(t.getSupplierName())); |
| | | } |
| | | } |
| | | pageInfo.setRecords( list); |
| | |
| | | @Override |
| | | public List<TErpGoodsVO> inventoryNotEnoughList(SysUser user) { |
| | | List<TErpGoodsVO> list = this.baseMapper.inventoryNotEnoughList(user); |
| | | List<String> typeIds = list.stream().map(TErpGoodsVO::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())); |
| | | } |
| | | } |
| | | List<String> supplierClinicId = list.stream().filter(e->e.getGoodsSource()==1).map(TErpGoodsVO::getSupplierClinicId).collect(Collectors.toList()); |
| | | if(!supplierClinicId.isEmpty()){ |
| | | List<TCrmSupplier> crmSuppliers = crmSupplierMapper.selectBatchIds(supplierClinicId); |
| | | for (TErpGoodsVO tErpGoodsVO : list) { |
| | | crmSuppliers.stream().filter(t -> t.getId().equals(tErpGoodsVO.getSupplierClinicId())).findFirst().ifPresent(t -> tErpGoodsVO.setSupplierName(t.getSupplierName())); |
| | | } |
| | | } |
| | | |
| | | return list; |
| | | } |
| | | |
| | |
| | | |
| | | tErpProcurement.setTermNo(supplier.getTermNo()); |
| | | tErpProcurement.setMerchantNo(supplier.getRecvMerchantNo()); |
| | | tErpProcurement.setPayMoney(value.stream().map(AddProcurementDto::getSalesAmount).reduce(BigDecimal.ZERO, BigDecimal::add)); |
| | | tErpProcurement.setCreateId(user.getUserId().toString()); |
| | | |
| | | BigDecimal all = BigDecimal.ZERO; |
| | | |
| | | for (AddProcurementDto addProcurementDto : value) { |
| | | BigDecimal multiply = addProcurementDto.getSalesAmount().multiply(BigDecimal.valueOf(addProcurementDto.getPurchaseCount())); |
| | | all = all.add(multiply); |
| | | } |
| | | tErpProcurement.setPayMoney(all); |
| | | AddProcurementDto addProcurementDto = value.get(0); |
| | | if(addProcurementDto.getState()!=null && addProcurementDto.getState()==1){ |
| | | tErpProcurement.setStatus(1); |
| | |
| | | if(tErpProcurementGoods.getSupplierMoney().doubleValue()<0){ |
| | | throw new RuntimeException("平台抽成不能大于售卖价格"); |
| | | } |
| | | add = add.add(dto.getPlatformCommissionPrice()); |
| | | add = add.add(dto.getPlatformCommissionPrice().multiply(BigDecimal.valueOf(dto.getPurchaseCount()))); |
| | | tErpProcurementGoods1.add(tErpProcurementGoods); |
| | | } |
| | | BigDecimal bigDecimal = tErpProcurement.getPayMoney().multiply(BigDecimal.valueOf(0.0038)).setScale(2, RoundingMode.HALF_UP); |
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; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Data |
| | | @ApiModel("诊所 商品入库vo") |
| | | public class WarehouseGoodsVo { |
| | | @ApiModelProperty(value = "商品id") |
| | | private String id; |
| | | |
| | | @ApiModelProperty(value = "单价") |
| | | private BigDecimal unitAmount; |
| | | |
| | | @ApiModelProperty(value = "销售价格") |
| | | private BigDecimal salesAmount; |
| | | |
| | | @ApiModelProperty(value = "采购数量") |
| | | @NotNull(message = "采购数量不能为空") |
| | | private Integer purchaseCount; |
| | | |
| | | @ApiModelProperty(value = "批次号") |
| | | @NotBlank(message = "批次号不能为空") |
| | | private String batchNumber; |
| | | |
| | | @ApiModelProperty(value = "生产日期") |
| | | @NotNull(message = "生产日期不能为空") |
| | | private LocalDateTime productionDate; |
| | | |
| | | @ApiModelProperty(value = "有效日期") |
| | | @NotNull(message = "有效日期不能为空") |
| | | private LocalDateTime expiryDate; |
| | | |
| | | @ApiModelProperty(value = "供应商id") |
| | | // @NotBlank(message = "供应商id不能为空") |
| | | private String supplierId; |
| | | |
| | | @ApiModelProperty(value = "商品名称") |
| | | private String goodsName; |
| | | |
| | | @ApiModelProperty(value = "国药准字号") |
| | | private String quasiNumber; |
| | | |
| | | |
| | | } |
| | |
| | | <if test="user.roleType != null and user.roleType == 4 "> |
| | | and t1.goods_source =1 and t1.supplier_clinic_id =#{query.supplierClinicId} |
| | | </if> |
| | | <if test="user.roleType != null and user.roleType == 5 "> |
| | | <if test="user.roleType != null and user.roleType == 5"> |
| | | and ( ( t1.goods_source =2 and t1.supplier_clinic_id =#{query.supplierClinicId} ) or find_in_set(#{query.supplierClinicId},t1.clinic_ids) ) |
| | | </if> |
| | | GROUP BY t1.id |
| | |
| | | </select> |
| | | |
| | | <select id="warehousePageList" resultType="com.ruoyi.system.vo.TErpClinicWarehousePageListVO"> |
| | | select t1.id,t1.warehouse_no,t2.supplier_name,t3.procurement_code,t3.pay_money allTotalPrice,t1.create_time warehouseTime,t1.type |
| | | select t1.id,t1.warehouse_no, |
| | | case when t1.type =1 then t2.supplier_name else t4.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 |
| | | left join t_crm_supplier t2 on t3.supplier_id = t2.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} |
| | | <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},'%') |
| | | and (t2.supplier_name like concat('%',#{query.supplierName},'%') or t4.supplier_name like concat('%',#{query.supplierName},'%')) |
| | | </if> |
| | | <if test="sTime != null"> |
| | | and t1.create_time between #{sTime} and #{eTime} |
| | |
| | | </if> |
| | | order by t1.create_time desc |
| | | </select> |
| | | <select id="pageList1" resultType="com.ruoyi.system.vo.TErpGoodsVO"> |
| | | select * from ( |
| | | select <include refid="Base_Column_List1"/> |
| | | COALESCE(sum(t2.purchase_count), 0) - COALESCE(sum(t3.outbound_count), 0) as allNum, |
| | | SUM(t2.unit_amount * (t2.purchase_count - COALESCE(t3.outbound_count, 0))) as allTotalPrice, |
| | | |
| | | COALESCE(sum(t3.outbound_count), 0) as outNum |
| | | from t_erp_goods t1 left join t_erp_clinic_warehousing_batch t2 on t1.id = t2.goods_id |
| | | left join t_erp_clinic_outbound_goods t3 on t2.id = t3.warehousing_id |
| | | where t1.disabled = 0 and t2.id is not null |
| | | and t1.goods_source =2 and t1.supplier_clinic_id =#{query.supplierClinicId} |
| | | GROUP BY t1.id |
| | | ) o where 1=1 |
| | | <if test="query.type != null and query.type ==1"> |
| | | and o.warning_inventory > (o.allNum-o.outNum) |
| | | </if> |
| | | order by o.create_time desc |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | taboo, |
| | | precautions, |
| | | interaction, |
| | | storage |
| | | storage,supplier_name |
| | | |
| | | </sql> |
| | | <select id="pageList" resultType="com.ruoyi.system.vo.TErpGoodsVO"> |