| | |
| | | @PostMapping(value = "/saveDataInfo") |
| | | public R<Boolean> saveDataInfo(@RequestBody @Valid TErpGoodsInfoSaveDto 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()) |
| | | .last("LIMIT 1")); |
| | | clinicSupplierId = crmSupplier.getId(); |
| | | } |
| | | if(roleType == 5){ |
| | | // 诊所 |
| | | TCrmClinic crmClinic = crmClinicService.getOne(Wrappers.lambdaQuery(TCrmClinic.class) |
| | | .eq(TCrmClinic::getUserId, user.getUserId()) |
| | | .last("LIMIT 1")); |
| | | clinicSupplierId =crmClinic.getId(); |
| | | } |
| | | |
| | | TErpGoods goods = erpGoodsService.getById(dto.getId()); |
| | | BeanUtils.copyProperties(dto,goods); |
| | | if(goods.getMaintenanceInterval()!=null){ |
| | |
| | | if (tErpSupplierWarehousingBatch.getWarehousingNumber()-sum>0) { |
| | | // 生成保养单 |
| | | TErpMaintenanceReminder tErpMaintenanceReminder = new TErpMaintenanceReminder(); |
| | | tErpMaintenanceReminder.setClinicSupplierId(user.getUserId().toString()); |
| | | tErpMaintenanceReminder.setClinicSupplierId(clinicSupplierId); |
| | | tErpMaintenanceReminder.setMaintenanceType(1); |
| | | tErpMaintenanceReminder.setWarehousingBatchId(tErpSupplierWarehousingBatch.getId()); |
| | | Integer day = Integer.valueOf(goods.getMaintenanceInterval()); |
| | |
| | | public void listExport(@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()); |
| | | } |
| | | |
| | | List<TErpGoodsVO> pageList = erpGoodsService.listExport(query,user); |
| | | Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), TErpGoodsVO.class, pageList); |
| | | HttpServletResponse response = WebUtils.response(); |
| | |
| | | if (collect.size() != carAnnuallyImportExcels.size()) { |
| | | return AjaxResult.error("导入数据中商品标识码重复"); |
| | | } |
| | | Integer roleType = user.getRoleType(); |
| | | for (TErpGoodsExcel erpGoodsExcel : carAnnuallyImportExcels) { |
| | | TErpGoods goods = new TErpGoods(); |
| | | goods.setSupplierClinicId(user.getUserId().toString()); |
| | | goods.setGoodsSource(1); |
| | | |
| | | if(roleType == 4){ |
| | | // 供应商 |
| | | TCrmSupplier crmSupplier = crmSupplierService.getOne(Wrappers.lambdaQuery(TCrmSupplier.class) |
| | | .eq(TCrmSupplier::getUserId, user.getUserId()) |
| | | .last("LIMIT 1")); |
| | | goods.setSupplierClinicId(crmSupplier.getId()); |
| | | goods.setGoodsSource(1); |
| | | } |
| | | if(roleType == 5){ |
| | | // 诊所 |
| | | TCrmClinic crmClinic = crmClinicService.getOne(Wrappers.lambdaQuery(TCrmClinic.class) |
| | | .eq(TCrmClinic::getUserId, user.getUserId()) |
| | | .last("LIMIT 1")); |
| | | goods.setSupplierClinicId(crmClinic.getId()); |
| | | goods.setGoodsSource(2); |
| | | } |
| | | |
| | | // 判空 |
| | | if(erpGoodsExcel.getGoodsName()==null || erpGoodsExcel.getGoodsName().isEmpty()){ |
| | |
| | | package com.ruoyi.web.controller.api; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.lkl.laop.sdk.request.V3LabsTransPreorderRequest; |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.common.core.domain.R; |
| | |
| | | import com.ruoyi.system.dto.InventoryDto; |
| | | import com.ruoyi.system.dto.InventoryGoodsDto; |
| | | import com.ruoyi.system.dto.WarehousingGoodsDto; |
| | | import com.ruoyi.system.model.TCrmClinic; |
| | | import com.ruoyi.system.model.TCrmSupplier; |
| | | import com.ruoyi.system.query.*; |
| | | import com.ruoyi.system.service.TCrmClinicService; |
| | | import com.ruoyi.system.service.TCrmSupplierService; |
| | | import com.ruoyi.system.service.TErpGoodsService; |
| | | import com.ruoyi.system.service.TErpSupplierWarehousingService; |
| | | import com.ruoyi.system.vo.*; |
| | |
| | | private final TErpSupplierWarehousingService erpSupplierWarehousingService; |
| | | private final TErpGoodsService erpGoodsService; |
| | | private final TokenService tokenService; |
| | | private final TCrmClinicService crmClinicService; |
| | | private final TCrmSupplierService crmSupplierService; |
| | | |
| | | @Autowired |
| | | public TErpSupplierWarehousingController(TErpSupplierWarehousingService erpSupplierWarehousingService, TErpGoodsService erpGoodsService, TokenService tokenService) { |
| | | public TErpSupplierWarehousingController(TErpSupplierWarehousingService erpSupplierWarehousingService, TErpGoodsService erpGoodsService, TokenService tokenService, |
| | | TCrmClinicService crmClinicService,TCrmSupplierService crmSupplierService) { |
| | | this.erpSupplierWarehousingService = erpSupplierWarehousingService; |
| | | this.erpGoodsService = erpGoodsService; |
| | | this.tokenService = tokenService; |
| | | this.crmClinicService = crmClinicService; |
| | | this.crmSupplierService = crmSupplierService; |
| | | } |
| | | |
| | | |
| | |
| | | request.setTermNo(LakalaAlipayConfig.TermNo); |
| | | |
| | | 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(erpSupplierWarehousingService.pageList(query,user)); |
| | | } |
| | | |
| | |
| | | |
| | | List<TErpGoodsVO> listExport(@Param("query") TErpGoodsQuery query, @Param("user") SysUser user); |
| | | |
| | | List<TErpGoodsInventoryVO> pageInventoryGoodsPageList(@Param("query") TErpGoodsInventoryQuery query, @Param("pageInfo") PageInfo<TErpGoodsInventoryVO> pageInfo, @Param("user") SysUser user); |
| | | List<TErpGoodsInventoryVO> pageInventoryGoodsPageList(@Param("query") TErpGoodsInventoryQuery query, @Param("pageInfo") PageInfo<TErpGoodsInventoryVO> pageInfo, @Param("user") SysUser user, @Param("supplierClinicId") String supplierClinicId); |
| | | } |
| | |
| | | */ |
| | | public interface TErpMaintenanceReminderMapper extends BaseMapper<TErpMaintenanceReminder> { |
| | | |
| | | List<TErpMaintenanceReminderListVo> pageList(@Param("page") PageInfo<TErpMaintenanceReminderListVo> page, @Param("query") TErpMaintenanceReminderQuery query, @Param("user") SysUser user); |
| | | List<TErpMaintenanceReminderListVo> pageList(@Param("page") PageInfo<TErpMaintenanceReminderListVo> page, @Param("query") TErpMaintenanceReminderQuery query, @Param("user") SysUser user, @Param("supplierClinicId") String supplierClinicId); |
| | | } |
| | |
| | | */ |
| | | public interface TErpProcurementMapper extends BaseMapper<TErpProcurement> { |
| | | |
| | | List<TErpProcurementVo> pageList(@Param("query") TErpProcurementQuery query, @Param("pageInfo") PageInfo<TErpProcurementVo> pageInfo, @Param("user") SysUser user, @Param("sTime") String sTime, @Param("eTime") String eTime); |
| | | List<TErpProcurementVo> pageList(@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<TErpGoodsWarehouseRecordLastVO> pageWarehouseList(@Param("query") TErpGoodsWarehouseQuery query, @Param("pageInfo") PageInfo<TErpGoodsWarehouseRecordLastVO> pageInfo, @Param("user") SysUser user, @Param("sTime") String sTime, @Param("eTime") String eTime); |
| | | |
| | | PageInfo<ValidityPeriodWarningVo> validityPeriodWarning(@Param("pageInfo") PageInfo<ValidityPeriodWarningVo> pageInfo, @Param("query") ValidityPeriodWarningQuery query, @Param("user") SysUser user, @Param("time") LocalDateTime nineMonthLater); |
| | | PageInfo<ValidityPeriodWarningVo> validityPeriodWarning(@Param("pageInfo") PageInfo<ValidityPeriodWarningVo> pageInfo, @Param("query") ValidityPeriodWarningQuery query, @Param("user") SysUser user, @Param("time") LocalDateTime nineMonthLater, @Param("supplierClinicId") String supplierClinicId); |
| | | |
| | | |
| | | List<PageInventoryListVo> pageInventoryList(@Param("pageInfo") PageInfo<PageInventoryListVo> pageInfo, @Param("query") TErpInventoryQuery query, @Param("user") SysUser user, @Param("sTime") String sTime, @Param("eTime") String eTime); |
| | | List<PageInventoryListVo> pageInventoryList(@Param("pageInfo") PageInfo<PageInventoryListVo> pageInfo, @Param("query") TErpInventoryQuery query, @Param("user") SysUser user, @Param("sTime") String sTime, @Param("eTime") String eTime, @Param("supplierClinicId") String supplierClinicId); |
| | | |
| | | } |
| | |
| | | @NotBlank(message = "商品id不能为空") |
| | | private String goodsId; |
| | | |
| | | private String supplierClinicId; |
| | | |
| | | } |
| | |
| | | package com.ruoyi.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | |
| | | |
| | | @Resource |
| | | private TErpSupplierOutboundGoodsMapper erpSupplierOutboundGoodsMapper; |
| | | |
| | | @Resource |
| | | private TCrmClinicMapper crmClinicMapper; |
| | | |
| | | @Resource |
| | | private TCrmSupplierMapper crmSupplierMapper; |
| | | |
| | | |
| | | @Override |
| | |
| | | |
| | | @Override |
| | | public PageInfo<TErpGoodsInventoryVO> pageInventoryGoodsPageList(TErpGoodsInventoryQuery query, SysUser user) { |
| | | Integer roleType = user.getRoleType(); |
| | | String supplierClinicId = null; |
| | | if(roleType == 4){ |
| | | // 供应商 |
| | | TCrmSupplier crmSupplier = crmSupplierMapper.selectOne(Wrappers.lambdaQuery(TCrmSupplier.class) |
| | | .eq(TCrmSupplier::getUserId, user.getUserId()) |
| | | .last("LIMIT 1")); |
| | | supplierClinicId =crmSupplier.getId(); |
| | | } |
| | | if(roleType == 5){ |
| | | // 诊所 |
| | | TCrmClinic crmClinic = crmClinicMapper.selectOne(Wrappers.lambdaQuery(TCrmClinic.class) |
| | | .eq(TCrmClinic::getUserId, user.getUserId()) |
| | | .last("LIMIT 1")); |
| | | supplierClinicId =crmClinic.getId(); |
| | | } |
| | | PageInfo<TErpGoodsInventoryVO> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize()); |
| | | List<TErpGoodsInventoryVO> list = this.baseMapper.pageInventoryGoodsPageList(query, pageInfo, user); |
| | | List<TErpGoodsInventoryVO> list = this.baseMapper.pageInventoryGoodsPageList(query, pageInfo, user,supplierClinicId); |
| | | if (list.isEmpty()) { |
| | | return pageInfo; |
| | | } |
| | |
| | | |
| | | @Override |
| | | public void inventoryGoods(InventoryDto dto, SysUser user) { |
| | | Integer roleType = user.getRoleType(); |
| | | String supplierClinicId = null; |
| | | if(roleType == 4){ |
| | | // 供应商 |
| | | TCrmSupplier crmSupplier = crmSupplierMapper.selectOne(Wrappers.lambdaQuery(TCrmSupplier.class) |
| | | .eq(TCrmSupplier::getUserId, user.getUserId()) |
| | | .last("LIMIT 1")); |
| | | supplierClinicId =crmSupplier.getId(); |
| | | } |
| | | if(roleType == 5){ |
| | | // 诊所 |
| | | TCrmClinic crmClinic = crmClinicMapper.selectOne(Wrappers.lambdaQuery(TCrmClinic.class) |
| | | .eq(TCrmClinic::getUserId, user.getUserId()) |
| | | .last("LIMIT 1")); |
| | | supplierClinicId =crmClinic.getId(); |
| | | } |
| | | TErpSupplierInventory tErpSupplierInventory = new TErpSupplierInventory(); |
| | | String s = DateUtils.dateTimeNow(); |
| | | tErpSupplierInventory.setInventoryNumber("P" + s); |
| | | tErpSupplierInventory.setWarehouseId(dto.getWarehouseId()); |
| | | tErpSupplierInventory.setSupplierId(String.valueOf(user.getUserId())); |
| | | tErpSupplierInventory.setSupplierId(supplierClinicId); |
| | | erpSupplierInventoryMapper.insert(tErpSupplierInventory); |
| | | |
| | | List<InventoryGoodsDto> dtos = dto.getDtos(); |
| | |
| | | if (inventoryGoodsDto.getNum() < inventoryGoodsDto.getInventoryCount()) { |
| | | // 添加入库信息 |
| | | tErpSupplierWarehousing.setWarehouseId(dto.getWarehouseId()); |
| | | tErpSupplierWarehousing.setSupplierId(String.valueOf(user.getUserId())); |
| | | tErpSupplierWarehousing.setSupplierId(supplierClinicId); |
| | | tErpSupplierWarehousing.setGoodsId(tErpSupplierWarehousing1.getGoodsId()); |
| | | tErpSupplierWarehousing.setGoodsName(erpGoods.getGoodsName()); |
| | | tErpSupplierWarehousing.setGoodsCount(inventoryGoodsDto.getInventoryCount() - inventoryGoodsDto.getNum()); |
| | |
| | | |
| | | TErpSupplierOutbound tErpSupplierOutbound = new TErpSupplierOutbound(); |
| | | tErpSupplierOutbound.setWarehouseId(dto.getWarehouseId()); |
| | | tErpSupplierOutbound.setSupplierId(String.valueOf(user.getUserId())); |
| | | tErpSupplierOutbound.setSupplierId(supplierClinicId); |
| | | tErpSupplierOutbound.setGoodsId(tErpSupplierWarehousing1.getGoodsId()); |
| | | tErpSupplierOutbound.setOutboundType(6); |
| | | tErpSupplierOutbound.setOutboundNumber("G" + s); |
| | |
| | | package com.ruoyi.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import com.ruoyi.system.mapper.*; |
| | |
| | | @Resource |
| | | private TErpSupplierOutboundGoodsMapper erpSupplierOutboundGoodsMapper; |
| | | |
| | | @Resource |
| | | private TCrmClinicMapper crmClinicMapper; |
| | | |
| | | @Resource |
| | | private TCrmSupplierMapper crmSupplierMapper; |
| | | |
| | | @Override |
| | | public PageInfo<TErpMaintenanceReminderListVo> pageList(TErpMaintenanceReminderQuery query, SysUser user) { |
| | | Integer roleType = user.getRoleType(); |
| | | String supplierClinicId = null; |
| | | if(roleType == 4){ |
| | | // 供应商 |
| | | TCrmSupplier crmSupplier = crmSupplierMapper.selectOne(Wrappers.lambdaQuery(TCrmSupplier.class) |
| | | .eq(TCrmSupplier::getUserId, user.getUserId()) |
| | | .last("LIMIT 1")); |
| | | supplierClinicId =crmSupplier.getId(); |
| | | } |
| | | if(roleType == 5){ |
| | | // 诊所 |
| | | TCrmClinic crmClinic = crmClinicMapper.selectOne(Wrappers.lambdaQuery(TCrmClinic.class) |
| | | .eq(TCrmClinic::getUserId, user.getUserId()) |
| | | .last("LIMIT 1")); |
| | | supplierClinicId =crmClinic.getId(); |
| | | } |
| | | PageInfo<TErpMaintenanceReminderListVo> page = new PageInfo<>(query.getPageNum(), query.getPageSize()); |
| | | List<TErpMaintenanceReminderListVo> list = baseMapper.pageList(page, query, user); |
| | | List<TErpMaintenanceReminderListVo> list = baseMapper.pageList(page, query, user,supplierClinicId); |
| | | if(list.isEmpty()){ |
| | | return page; |
| | | } |
| | |
| | | |
| | | TErpMaintenanceReminderDetailVo tErpMaintenanceReminderDetailVo = new TErpMaintenanceReminderDetailVo(); |
| | | TErpMaintenanceReminder tErpMaintenanceReminder = baseMapper.selectById(id); |
| | | if(tErpMaintenanceReminder == null || tErpMaintenanceReminder.getMaintenanceType()!=1 || !tErpMaintenanceReminder.getClinicSupplierId().equals(user.getUserId().toString())){ |
| | | return tErpMaintenanceReminderDetailVo; |
| | | } |
| | | tErpMaintenanceReminderDetailVo.setId(tErpMaintenanceReminder.getId()); |
| | | tErpMaintenanceReminderDetailVo.setMaintenanceTime(tErpMaintenanceReminder.getMaintenanceTime()); |
| | | tErpMaintenanceReminderDetailVo.setMaintenanceRecord(tErpMaintenanceReminder.getMaintenanceRecord()); |
| | |
| | | package com.ruoyi.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import com.ruoyi.system.mapper.*; |
| | |
| | | private TSysCommissionMapper sysCommissionMapper; |
| | | |
| | | @Resource |
| | | private TCrmClinicMapper crmClinicMapper; |
| | | private TCrmClinicMapper crmClinicMapper; |
| | | |
| | | @Resource |
| | | private TCrmSupplierMapper crmSupplierMapper; |
| | | |
| | | @Resource |
| | | private SysUserMapper sysUserMapper; |
| | | |
| | | @Override |
| | | public PageInfo<TErpProcurementVo> pageList(TErpProcurementQuery query, SysUser user) { |
| | | |
| | | |
| | | Integer roleType = user.getRoleType(); |
| | | String supplierClinicId = null; |
| | | if(roleType == 4){ |
| | | // 供应商 |
| | | TCrmSupplier crmSupplier = crmSupplierMapper.selectOne(Wrappers.lambdaQuery(TCrmSupplier.class) |
| | | .eq(TCrmSupplier::getUserId, user.getUserId()) |
| | | .last("LIMIT 1")); |
| | | supplierClinicId =crmSupplier.getId(); |
| | | } |
| | | if(roleType == 5){ |
| | | // 诊所 |
| | | TCrmClinic crmClinic = crmClinicMapper.selectOne(Wrappers.lambdaQuery(TCrmClinic.class) |
| | | .eq(TCrmClinic::getUserId, user.getUserId()) |
| | | .last("LIMIT 1")); |
| | | supplierClinicId =crmClinic.getId(); |
| | | } |
| | | |
| | | String sTime=null; |
| | | String eTime =null; |
| | | if(query.getTime()!=null && !query.getTime().isEmpty()){ |
| | |
| | | eTime = split[1] + " 23:59:59"; |
| | | } |
| | | PageInfo<TErpProcurementVo> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize()); |
| | | List<TErpProcurementVo> list = this.baseMapper.pageList(query,pageInfo,user,sTime,eTime); |
| | | List<TErpProcurementVo> list = this.baseMapper.pageList(query,pageInfo,user,sTime,eTime,supplierClinicId); |
| | | if(list.isEmpty()){ |
| | | return pageInfo; |
| | | } |
| | | List<String> ids = list.stream().map(TErpProcurementVo::getId).collect(Collectors.toList()); |
| | | List<TErpProcurementGoods> tErpProcurementGoods = erpProcurementGoodsMapper.selectList(new LambdaQueryWrapper<TErpProcurementGoods>().in(TErpProcurementGoods::getProcurementId, ids).eq(TErpProcurementGoods::getSupplierId, user.getUserId())); |
| | | List<TErpProcurementGoods> tErpProcurementGoods = erpProcurementGoodsMapper.selectList |
| | | (new LambdaQueryWrapper<TErpProcurementGoods>().in(TErpProcurementGoods::getProcurementId, ids).eq(TErpProcurementGoods::getSupplierId, supplierClinicId)); |
| | | List<TSysCommission> tSysCommissions =new ArrayList<>(); |
| | | if(!tErpProcurementGoods.isEmpty()){ |
| | | List<String> collect = tErpProcurementGoods.stream().map(TErpProcurementGoods::getId).collect(Collectors.toList()); |
| | |
| | | |
| | | @Override |
| | | public TErpProcurementDetailVo detail(String id, SysUser user, String goodsName) { |
| | | |
| | | Integer roleType = user.getRoleType(); |
| | | String supplierClinicId = null; |
| | | if(roleType == 4){ |
| | | // 供应商 |
| | | TCrmSupplier crmSupplier = crmSupplierMapper.selectOne(Wrappers.lambdaQuery(TCrmSupplier.class) |
| | | .eq(TCrmSupplier::getUserId, user.getUserId()) |
| | | .last("LIMIT 1")); |
| | | supplierClinicId =crmSupplier.getId(); |
| | | } |
| | | if(roleType == 5){ |
| | | // 诊所 |
| | | TCrmClinic crmClinic = crmClinicMapper.selectOne(Wrappers.lambdaQuery(TCrmClinic.class) |
| | | .eq(TCrmClinic::getUserId, user.getUserId()) |
| | | .last("LIMIT 1")); |
| | | supplierClinicId =crmClinic.getId(); |
| | | } |
| | | |
| | | TErpProcurementDetailVo tErpProcurementVo = new TErpProcurementDetailVo(); |
| | | |
| | | TErpProcurement tErpProcurement = this.getById(id); |
| | |
| | | tErpProcurementVo.setStatus(tErpProcurement.getStatus()); |
| | | tErpProcurementVo.setSendTime(tErpProcurement.getSendTime()); |
| | | |
| | | List<TErpProcurementGoods> tErpProcurementGoods = erpProcurementGoodsMapper.selectList(new LambdaQueryWrapper<TErpProcurementGoods>().eq(TErpProcurementGoods::getProcurementId, id).like(goodsName != null && !goodsName.isEmpty(), TErpProcurementGoods::getGoodsName, goodsName).eq(TErpProcurementGoods::getSupplierId, user.getUserId())); |
| | | List<TErpProcurementGoods> tErpProcurementGoods = erpProcurementGoodsMapper.selectList |
| | | (new LambdaQueryWrapper<TErpProcurementGoods>().eq(TErpProcurementGoods::getProcurementId, id) |
| | | .like(goodsName != null && !goodsName.isEmpty(), TErpProcurementGoods::getGoodsName, goodsName) |
| | | .eq(TErpProcurementGoods::getSupplierId, supplierClinicId)); |
| | | if(tErpProcurementGoods.isEmpty()){ |
| | | return tErpProcurementVo; |
| | | } |
| | |
| | | package com.ruoyi.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import com.ruoyi.common.utils.DateUtils; |
| | |
| | | import com.ruoyi.system.query.TErpGoodsWarehouseQuery; |
| | | import com.ruoyi.system.query.TErpInventoryQuery; |
| | | import com.ruoyi.system.query.ValidityPeriodWarningQuery; |
| | | import com.ruoyi.system.service.TCrmClinicService; |
| | | import com.ruoyi.system.service.TCrmSupplierService; |
| | | import com.ruoyi.system.service.TErpSupplierWarehousingService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.system.vo.*; |
| | |
| | | @Resource |
| | | private TErpGoodsUnitMapper erpGoodsUnitMapper; |
| | | |
| | | @Resource |
| | | private TCrmClinicMapper crmClinicMapper; |
| | | |
| | | @Resource |
| | | private TCrmSupplierMapper crmSupplierMapper; |
| | | |
| | | @Override |
| | | public PageInfo<TErpGoodsVO> pageList(TErpGoodsQuery query, SysUser user) { |
| | |
| | | |
| | | @Override |
| | | public List<TErpGoodsWarehouseLastVO> detail(String id, String warehouseName, SysUser user) { |
| | | Integer roleType = user.getRoleType(); |
| | | String supplierClinicId = null; |
| | | if(roleType == 4){ |
| | | // 供应商 |
| | | TCrmSupplier crmSupplier = crmSupplierMapper.selectOne(Wrappers.lambdaQuery(TCrmSupplier.class) |
| | | .eq(TCrmSupplier::getUserId, user.getUserId()) |
| | | .last("LIMIT 1")); |
| | | supplierClinicId =crmSupplier.getId(); |
| | | } |
| | | if(roleType == 5){ |
| | | // 诊所 |
| | | TCrmClinic crmClinic = crmClinicMapper.selectOne(Wrappers.lambdaQuery(TCrmClinic.class) |
| | | .eq(TCrmClinic::getUserId, user.getUserId()) |
| | | .last("LIMIT 1")); |
| | | supplierClinicId =crmClinic.getId(); |
| | | } |
| | | |
| | | |
| | | |
| | | TErpGoods goods = erpGoodsMapper.selectById(id); |
| | |
| | | if(tCrmWarehouses.isEmpty()){ |
| | | return Collections.emptyList(); |
| | | } |
| | | List<TErpSupplierWarehousing> tErpSupplierWarehousings = erpSupplierWarehousingMapper.selectList(new LambdaQueryWrapper<TErpSupplierWarehousing>().in(TErpSupplierWarehousing::getWarehouseId, tCrmWarehouses.stream().map(TCrmWarehouse::getId).collect(Collectors.toList())).eq(TErpSupplierWarehousing::getSupplierId, user.getUserId()).eq(TErpSupplierWarehousing::getGoodsId, id)); |
| | | List<TErpSupplierWarehousing> tErpSupplierWarehousings = erpSupplierWarehousingMapper.selectList(new LambdaQueryWrapper<TErpSupplierWarehousing>().in(TErpSupplierWarehousing::getWarehouseId, tCrmWarehouses.stream().map(TCrmWarehouse::getId).collect(Collectors.toList())).eq(TErpSupplierWarehousing::getSupplierId, supplierClinicId).eq(TErpSupplierWarehousing::getGoodsId, id)); |
| | | if(tErpSupplierWarehousings.isEmpty()){ |
| | | return Collections.emptyList(); |
| | | } |
| | |
| | | |
| | | @Override |
| | | public PageInfo<TErpGoodsWarehouseRecordLastVO> pageWarehouseList(TErpGoodsWarehouseQuery query, SysUser user) { |
| | | |
| | | Integer roleType = user.getRoleType(); |
| | | String supplierClinicId = null; |
| | | if(roleType == 4){ |
| | | // 供应商 |
| | | TCrmSupplier crmSupplier = crmSupplierMapper.selectOne(Wrappers.lambdaQuery(TCrmSupplier.class) |
| | | .eq(TCrmSupplier::getUserId, user.getUserId()) |
| | | .last("LIMIT 1")); |
| | | supplierClinicId =crmSupplier.getId(); |
| | | } |
| | | if(roleType == 5){ |
| | | // 诊所 |
| | | TCrmClinic crmClinic = crmClinicMapper.selectOne(Wrappers.lambdaQuery(TCrmClinic.class) |
| | | .eq(TCrmClinic::getUserId, user.getUserId()) |
| | | .last("LIMIT 1")); |
| | | supplierClinicId =crmClinic.getId(); |
| | | } |
| | | query.setSupplierClinicId(supplierClinicId); |
| | | |
| | | |
| | | |
| | | TErpGoods goods = erpGoodsMapper.selectById(query.getGoodsId()); |
| | | |
| | | PageInfo<TErpGoodsWarehouseRecordLastVO> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize()); |
| | |
| | | |
| | | @Override |
| | | public void warehousingGoods(List<WarehousingGoodsDto> dtos, SysUser user) { |
| | | Integer roleType = user.getRoleType(); |
| | | String supplierClinicId = null; |
| | | if(roleType == 4){ |
| | | // 供应商 |
| | | TCrmSupplier crmSupplier = crmSupplierMapper.selectOne(Wrappers.lambdaQuery(TCrmSupplier.class) |
| | | .eq(TCrmSupplier::getUserId, user.getUserId()) |
| | | .last("LIMIT 1")); |
| | | supplierClinicId =crmSupplier.getId(); |
| | | } |
| | | if(roleType == 5){ |
| | | // 诊所 |
| | | TCrmClinic crmClinic = crmClinicMapper.selectOne(Wrappers.lambdaQuery(TCrmClinic.class) |
| | | .eq(TCrmClinic::getUserId, user.getUserId()) |
| | | .last("LIMIT 1")); |
| | | supplierClinicId =crmClinic.getId(); |
| | | } |
| | | for (WarehousingGoodsDto dto : dtos) { |
| | | TErpSupplierWarehousing tErpSupplierWarehousing = new TErpSupplierWarehousing(); |
| | | // 当前年月日时分秒 |
| | | String time = DateUtils.dateTimeNow(); |
| | | tErpSupplierWarehousing.setWarehouseNo("G"+time); |
| | | tErpSupplierWarehousing.setSupplierId(user.getUserId().toString()); |
| | | tErpSupplierWarehousing.setSupplierId(supplierClinicId); |
| | | tErpSupplierWarehousing.setWarehouseId(dto.getWarehouseId()); |
| | | tErpSupplierWarehousing.setGoodsId(dto.getGoodsId()); |
| | | TErpGoods goods = erpGoodsMapper.selectById(dto.getGoodsId()); |
| | |
| | | |
| | | if(goods.getMaintenanceInterval()!=null){ |
| | | TErpMaintenanceReminder tErpMaintenanceReminder = new TErpMaintenanceReminder(); |
| | | tErpMaintenanceReminder.setClinicSupplierId(user.getUserId().toString()); |
| | | tErpMaintenanceReminder.setClinicSupplierId(supplierClinicId); |
| | | tErpMaintenanceReminder.setMaintenanceType(1); |
| | | tErpMaintenanceReminder.setWarehousingBatchId(tErpSupplierWarehousingBatch.getId()); |
| | | Integer day = Integer.valueOf(goods.getMaintenanceInterval()); |
| | |
| | | |
| | | @Override |
| | | public PageInfo<ValidityPeriodWarningVo> validityPeriodWarning(ValidityPeriodWarningQuery query, SysUser user) { |
| | | Integer roleType = user.getRoleType(); |
| | | String supplierClinicId = null; |
| | | if(roleType == 4){ |
| | | // 供应商 |
| | | TCrmSupplier crmSupplier = crmSupplierMapper.selectOne(Wrappers.lambdaQuery(TCrmSupplier.class) |
| | | .eq(TCrmSupplier::getUserId, user.getUserId()) |
| | | .last("LIMIT 1")); |
| | | supplierClinicId =crmSupplier.getId(); |
| | | } |
| | | if(roleType == 5){ |
| | | // 诊所 |
| | | TCrmClinic crmClinic = crmClinicMapper.selectOne(Wrappers.lambdaQuery(TCrmClinic.class) |
| | | .eq(TCrmClinic::getUserId, user.getUserId()) |
| | | .last("LIMIT 1")); |
| | | supplierClinicId =crmClinic.getId(); |
| | | } |
| | | // 获取当前时间后9个月的时间 |
| | | LocalDateTime nineMonthLater = LocalDateTime.now().plusMonths(9); |
| | | |
| | | PageInfo<ValidityPeriodWarningVo> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize()); |
| | | return this.baseMapper.validityPeriodWarning(pageInfo,query,user,nineMonthLater); |
| | | |
| | | |
| | | |
| | | return this.baseMapper.validityPeriodWarning(pageInfo,query,user,nineMonthLater,supplierClinicId); |
| | | |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public PageInfo<PageInventoryListVo> pageInventoryList(TErpInventoryQuery query, SysUser user) { |
| | | Integer roleType = user.getRoleType(); |
| | | String supplierClinicId = null; |
| | | if(roleType == 4){ |
| | | // 供应商 |
| | | TCrmSupplier crmSupplier = crmSupplierMapper.selectOne(Wrappers.lambdaQuery(TCrmSupplier.class) |
| | | .eq(TCrmSupplier::getUserId, user.getUserId()) |
| | | .last("LIMIT 1")); |
| | | supplierClinicId =crmSupplier.getId(); |
| | | } |
| | | if(roleType == 5){ |
| | | // 诊所 |
| | | TCrmClinic crmClinic = crmClinicMapper.selectOne(Wrappers.lambdaQuery(TCrmClinic.class) |
| | | .eq(TCrmClinic::getUserId, user.getUserId()) |
| | | .last("LIMIT 1")); |
| | | supplierClinicId =crmClinic.getId(); |
| | | } |
| | | String sTime=null; |
| | | String eTime =null; |
| | | if(query.getTime()!=null && !query.getTime().isEmpty()){ |
| | |
| | | eTime = split[1] + " 23:59:59"; |
| | | } |
| | | PageInfo<PageInventoryListVo> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize()); |
| | | List<PageInventoryListVo> list = this.baseMapper.pageInventoryList(pageInfo,query,user,sTime,eTime); |
| | | List<PageInventoryListVo> list = this.baseMapper.pageInventoryList(pageInfo,query,user,sTime,eTime,supplierClinicId); |
| | | if(list.isEmpty()){ |
| | | return pageInfo; |
| | | } |
| | |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.ruoyi.system.model.TErpGoods"> |
| | | <id column="id" property="id" /> |
| | | <result column="supplier_clinic_id" property="supplierClinicId" /> |
| | | <result column="goods_source" property="goodsSource" /> |
| | | <result column="clinic_id" property="clinicId" /> |
| | | <result column="goods_name" property="goodsName" /> |
| | | <result column="goods_id_code" property="goodsIdCode" /> |
| | | <result column="quasi_number" property="quasiNumber" /> |
| | | <result column="manufacturer" property="manufacturer" /> |
| | | <result column="formulation_spec" property="formulationSpec" /> |
| | | <result column="packing_spec" property="packingSpec" /> |
| | | <result column="type_id" property="typeId" /> |
| | | <result column="goods_yards" property="goodsYards" /> |
| | | <result column="maintenance_interval" property="maintenanceInterval" /> |
| | | <result column="low_purchase_quantity" property="lowPurchaseQuantity" /> |
| | | <result column="low_unit_id" property="lowUnitId" /> |
| | | <result column="is_prescription_drug" property="isPrescriptionDrug" /> |
| | | <result column="goods_spec" property="goodsSpec" /> |
| | | <result column="warning_inventory" property="warningInventory" /> |
| | | <result column="sales_amount" property="salesAmount" /> |
| | | <result column="packing_unit_id" property="packingUnitId" /> |
| | | <result column="instructions_use" property="instructionsUse" /> |
| | | <result column="side_effect" property="sideEffect" /> |
| | | <result column="clinic_purchase_price" property="clinicPurchasePrice" /> |
| | | <result column="platform_commission_price" property="platformCommissionPrice" /> |
| | | <result column="create_time" property="createTime" /> |
| | | <result column="update_time" property="updateTime" /> |
| | | <result column="create_by" property="createBy" /> |
| | | <result column="update_by" property="updateBy" /> |
| | | <result column="disabled" property="disabled" /> |
| | | <id column="id" property="id"/> |
| | | <result column="supplier_clinic_id" property="supplierClinicId"/> |
| | | <result column="goods_source" property="goodsSource"/> |
| | | <result column="clinic_id" property="clinicId"/> |
| | | <result column="goods_name" property="goodsName"/> |
| | | <result column="goods_id_code" property="goodsIdCode"/> |
| | | <result column="quasi_number" property="quasiNumber"/> |
| | | <result column="manufacturer" property="manufacturer"/> |
| | | <result column="formulation_spec" property="formulationSpec"/> |
| | | <result column="packing_spec" property="packingSpec"/> |
| | | <result column="type_id" property="typeId"/> |
| | | <result column="goods_yards" property="goodsYards"/> |
| | | <result column="maintenance_interval" property="maintenanceInterval"/> |
| | | <result column="low_purchase_quantity" property="lowPurchaseQuantity"/> |
| | | <result column="low_unit_id" property="lowUnitId"/> |
| | | <result column="is_prescription_drug" property="isPrescriptionDrug"/> |
| | | <result column="goods_spec" property="goodsSpec"/> |
| | | <result column="warning_inventory" property="warningInventory"/> |
| | | <result column="sales_amount" property="salesAmount"/> |
| | | <result column="packing_unit_id" property="packingUnitId"/> |
| | | <result column="instructions_use" property="instructionsUse"/> |
| | | <result column="side_effect" property="sideEffect"/> |
| | | <result column="clinic_purchase_price" property="clinicPurchasePrice"/> |
| | | <result column="platform_commission_price" property="platformCommissionPrice"/> |
| | | <result column="create_time" property="createTime"/> |
| | | <result column="update_time" property="updateTime"/> |
| | | <result column="create_by" property="createBy"/> |
| | | <result column="update_by" property="updateBy"/> |
| | | <result column="disabled" property="disabled"/> |
| | | </resultMap> |
| | | |
| | | <!-- 通用查询结果列 --> |
| | | <sql id="Base_Column_List"> |
| | | id, supplier_clinic_id, goods_source, goods_name, goods_id_code, quasi_number, manufacturer, formulation_spec, packing_spec, type_id, goods_yards, maintenance_interval, low_purchase_quantity, low_unit_id, is_prescription_drug, goods_spec, warning_inventory, sales_amount, packing_unit_id, instructions_use, side_effect, clinic_purchase_price, platform_commission_price, create_time, update_time, create_by,`state`, update_by, disabled, |
| | | id |
| | | , supplier_clinic_id, goods_source, goods_name, goods_id_code, quasi_number, manufacturer, formulation_spec, packing_spec, type_id, goods_yards, maintenance_interval, low_purchase_quantity, low_unit_id, is_prescription_drug, goods_spec, warning_inventory, sales_amount, packing_unit_id, instructions_use, side_effect, clinic_purchase_price, platform_commission_price, create_time, update_time, create_by,`state`, update_by, disabled, |
| | | simplified_code, |
| | | dosage_form, |
| | | usage_classification, |
| | |
| | | |
| | | </sql> |
| | | <select id="pageList" resultType="com.ruoyi.system.vo.TErpGoodsVO"> |
| | | select <include refid="Base_Column_List"/> |
| | | from t_erp_goods where disabled = 0 |
| | | 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},'%') |
| | | </if> |
| | |
| | | order by create_time desc |
| | | </select> |
| | | <select id="listExport" resultType="com.ruoyi.system.vo.TErpGoodsVO"> |
| | | select <include refid="Base_Column_List"/> |
| | | 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},'%') |
| | |
| | | and state = #{query.state} |
| | | </if> |
| | | <if test="user.roleType != null and user.roleType == 4 "> |
| | | and goods_source =1 and supplier_clinic_id =#{user.userId} |
| | | and goods_source =1 and supplier_clinic_id =#{query.supplierClinicId} |
| | | </if> |
| | | <if test="user.roleType != null and user.roleType == 5 "> |
| | | and goods_source =2 and supplier_clinic_id =#{user.userId} |
| | | and goods_source =2 and supplier_clinic_id =#{query.supplierClinicId} |
| | | </if> |
| | | order by create_time desc |
| | | </select> |
| | | |
| | | |
| | | <select id="pageInventoryGoodsPageList" resultType="com.ruoyi.system.vo.TErpGoodsInventoryVO"> |
| | | select * from ( |
| | | select * from ( |
| | | SELECT t1.id,t2.warehouse_no, |
| | | t3.goods_name, |
| | | t4.supplier_name, |
| | | t3.type_id, |
| | | t3.packing_unit_id, |
| | | t3.quasi_number, |
| | | t3.goods_id_code, |
| | | t1.batch_number, |
| | | coalesce(sum(t5.outbound_count),0) as outbound_count, |
| | | t1.warehousing_number, |
| | | t2.create_time, |
| | | t1.warehousing_number - coalesce(sum(t5.outbound_count),0) as num, |
| | | t3.sales_amount, |
| | | t1.expiry_date |
| | | t3.goods_name, |
| | | t4.supplier_name, |
| | | t3.type_id, |
| | | t3.packing_unit_id, |
| | | t3.quasi_number, |
| | | t3.goods_id_code, |
| | | t1.batch_number, |
| | | coalesce(sum(t5.outbound_count),0) as outbound_count, |
| | | t1.warehousing_number, |
| | | t2.create_time, |
| | | t1.warehousing_number - coalesce(sum(t5.outbound_count),0) as num, |
| | | t3.sales_amount, |
| | | t1.expiry_date |
| | | from t_erp_supplier_warehousing_batch t1 |
| | | LEFT JOIN t_erp_supplier_warehousing t2 on t1.warehousing_id = t2.id |
| | | LEFT JOIN t_erp_goods t3 on t2.goods_id = t3.id |
| | | LEFT JOIN t_crm_supplier t4 on t3.supplier_clinic_id = t4.id |
| | | LEFT JOIN t_erp_supplier_outbound_goods t5 on t5.warehousing_batch_id =t1.id |
| | | LEFT JOIN t_erp_supplier_warehousing t2 on t1.warehousing_id = t2.id |
| | | LEFT JOIN t_erp_goods t3 on t2.goods_id = t3.id |
| | | LEFT JOIN t_crm_supplier t4 on t3.supplier_clinic_id = t4.id |
| | | LEFT JOIN t_erp_supplier_outbound_goods t5 on t5.warehousing_batch_id =t1.id |
| | | where t2.disabled = 0 and t2.warehouse_id = #{query.warehouseId} |
| | | <if test="query.goodsName != null and query.goodsName != ''"> |
| | | and t3.goods_name like concat('%',#{query.goodsName},'%') |
| | | </if> |
| | | <if test="user.roleType ==4"> |
| | | and t3.supplier_clinic_id =#{user.userId} |
| | | <if test="user.roleType !=null and user.roleType ==4"> |
| | | and t3.supplier_clinic_id =#{supplierClinicId} and t3.goods_source=1 |
| | | </if> |
| | | <if test="user.roleType !=null and user.roleType ==5"> |
| | | and t3.supplier_clinic_id =#{supplierClinicId} and t3.goods_source=2 |
| | | </if> |
| | | <if test="query.supplierName != null and query.supplierName != ''"> |
| | | and t4.supplier_name like concat('%',#{query.supplierName},'%') |
| | |
| | | <if test="query.warehouseNo != null and query.warehouseNo != ''"> |
| | | and t2.warehouse_no = #{query.warehouseNo} |
| | | </if> |
| | | ) as o |
| | | where (o.warehousing_number -o.outbound_count) >0 |
| | | order by o.create_time desc |
| | | ) as o |
| | | where (o.warehousing_number -o.outbound_count) >0 |
| | | order by o.create_time desc |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | 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 |
| | | left join t_erp_goods t4 on t3.goods_id = t4.id |
| | | where t1.disabled = 0 and t1.maintenance_type =1 and t1.clinic_supplier_id =#{user.userId} |
| | | where t1.disabled = 0 |
| | | <if test="user.roleType !=null and user.roleType==4"> |
| | | and t1.clinic_supplier_id = #{user.supplierClinicId} and t1.maintenance_type=1 |
| | | </if> |
| | | <if test="user.roleType !=null and user.roleType==5"> |
| | | and t1.clinic_supplier_id = #{user.supplierClinicId} and t1.maintenance_type=2 |
| | | </if> |
| | | <if test="query.warehouseNo != null and query.warehouseNo != ''"> |
| | | and t3.warehouse_no =#{query.warehouseNo} |
| | | </if> |
| | |
| | | |
| | | <select id="pageList" resultType="com.ruoyi.system.vo.TErpProcurementVo"> |
| | | select t1.id, |
| | | t1.procurement_code, |
| | | t1.clinic_id, |
| | | t3.clinic_name, |
| | | sum(t2.total_price) as totalPrice, |
| | | t1.create_time, |
| | | t2.id tErpProcurementGoodsId, |
| | | t4.user_name, |
| | | t1.status |
| | | t1.procurement_code, |
| | | t1.clinic_id, |
| | | t3.clinic_name, |
| | | sum(t2.total_price) as totalPrice, |
| | | t1.create_time, |
| | | t2.id tErpProcurementGoodsId, |
| | | t4.user_name, |
| | | t1.status |
| | | from t_erp_procurement t1 |
| | | left JOIN t_erp_procurement_goods t2 on t1.id = t2.procurement_id |
| | | LEFT JOIN t_crm_clinic t3 on t1.clinic_id = t3.id |
| | | left JOIN sys_user t4 on t1.create_id = t4.user_id |
| | | where t1.disabled = 0 and t2.supplier_id =#{user.userId} |
| | | left JOIN t_erp_procurement_goods t2 on t1.id = t2.procurement_id |
| | | LEFT JOIN t_crm_clinic t3 on t1.clinic_id = t3.id |
| | | left JOIN sys_user t4 on t1.create_id = t4.user_id |
| | | where t1.disabled = 0 |
| | | <if test="user.roleType !=null and user.roleType==4"> |
| | | and t2.supplier_id =#{supplierClinicId} |
| | | </if> |
| | | <if test="query.procurementCode != null and query.procurementCode != ''"> |
| | | and t1.procurement_code = #{query.procurementCode} |
| | | </if> |
| | |
| | | and t1.state = #{query.state} |
| | | </if> |
| | | <if test="user.roleType != null and user.roleType == 4 "> |
| | | and t1.goods_source =1 and t1.supplier_clinic_id =#{user.userId} |
| | | and t1.goods_source =1 and t1.supplier_clinic_id =#{query.supplierClinicId} |
| | | </if> |
| | | <if test="user.roleType != null and user.roleType == 5 "> |
| | | and t1.goods_source =2 and t1.supplier_clinic_id =#{user.userId} |
| | | and t1.goods_source =2 and t1.supplier_clinic_id =#{query.supplierClinicId} |
| | | </if> |
| | | ) o where 1=1 |
| | | <if test="query.type != null and query.type ==1"> |
| | |
| | | select * from ( |
| | | select t1.id,t1.warehouse_id houseId,t2.warehouse_name houseName,t1.total_price allTotalPrice,t1.type,1 category,null as outboundReason,t1.create_time operationTime |
| | | from t_erp_supplier_warehousing t1 left join t_crm_warehouse t2 on t1.warehouse_id = t2.id |
| | | where t1.disabled = 0 and t1.goods_id = #{query.goodsId} and t1.supplier_id =#{user.userId} |
| | | where t1.disabled = 0 and t1.goods_id = #{query.goodsId} |
| | | <if test="user.roleType != null and user.roleType == 4 "> |
| | | and t1.supplier_id =#{query.supplierClinicId} |
| | | </if> |
| | | <if test="query.warehouseName != null and query.warehouseName != ''"> |
| | | and t2.warehouse_name =#{query.warehouseName} |
| | | </if> |
| | |
| | | |
| | | select t1.id,t1.warehouse_id houseId,t2.warehouse_name houseName,t1.total_money allTotalPrice,t1.outbound_type as type,2 category,t1.outbound_reason as outboundReason,t1.create_time operationTime |
| | | from t_erp_supplier_outbound t1 left join t_crm_warehouse t2 on t1.warehouse_id = t2.id |
| | | where t1.disabled = 0 and t1.goods_id = #{query.goodsId} and t1.supplier_id =#{user.userId} |
| | | where t1.disabled = 0 and t1.goods_id = #{query.goodsId} |
| | | <if test="user.roleType != null and user.roleType == 4 "> |
| | | and t1.supplier_id =#{query.supplierClinicId} |
| | | </if> |
| | | |
| | | <if test="query.warehouseName != null and query.warehouseName != ''"> |
| | | and t2.warehouse_name =#{query.warehouseName} |
| | | </if> |
| | |
| | | LEFT JOIN t_erp_goods t4 on t2.goods_id = t4.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 t2.supplier_id =#{user.userId} |
| | | 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> |
| | | <if test="query.name != null and query.name != ''"> |
| | | and t4.goods_name like concat('%',#{query.goodsName},'%') |
| | | </if> |
| | |
| | | select t1.id,t1.create_time,t2.user_name createBy,t3.warehouse_name |
| | | from t_erp_supplier_inventory t1 left join sys_user t2 on t1.create_id = t2.user_id |
| | | left join t_crm_warehouse t3 on t1.warehouse_id =t3.id |
| | | where t1.disabled = 0 and t1.supplier_id = #{user.userId} |
| | | where t1.disabled = 0 |
| | | <if test="user.roleType !=null and user.roleType ==4"> |
| | | and t1.supplier_id = #{supplierClinicId} |
| | | </if> |
| | | <if test="query.warehouseId != null and query.warehouseId != ''"> |
| | | and t1.warehouse_id = #{query.warehouseId} |
| | | </if> |