Merge remote-tracking branch 'origin/master'
| | |
| | | package com.ruoyi.web.controller.api; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | 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.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.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.query.*; |
| | | import com.ruoyi.system.service.*; |
| | | import com.ruoyi.system.vo.*; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.validation.Valid; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/t-erp-clinic-warehousing") |
| | | @Api(tags = "诊所库存管理") |
| | | public class TErpClinicWarehousingController { |
| | | |
| | | private final TErpClinicWarehousingService erpClinicWarehousingService; |
| | | private final TErpGoodsService erpGoodsService; |
| | | private final TokenService tokenService; |
| | | private final TCrmClinicService crmClinicService; |
| | | private final TCrmSupplierService crmSupplierService; |
| | | |
| | | @Autowired |
| | | public TErpClinicWarehousingController(TErpClinicWarehousingService erpClinicWarehousingService, TErpGoodsService erpGoodsService, TokenService tokenService, |
| | | TCrmClinicService crmClinicService,TCrmSupplierService crmSupplierService) { |
| | | this.erpClinicWarehousingService = erpClinicWarehousingService; |
| | | this.erpGoodsService = erpGoodsService; |
| | | this.tokenService = tokenService; |
| | | this.crmClinicService = crmClinicService; |
| | | this.crmSupplierService = crmSupplierService; |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取erp问题上报管理列表 |
| | | */ |
| | | @ApiOperation(value = "展示获取库存分页列表") |
| | | @PostMapping(value = "/pageList") |
| | | public R<PageInfo<TErpGoodsVO>> pageList(@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.pageList(query,user)); |
| | | } |
| | | |
| | | |
| | | |
| | | @ApiOperation(value = "诊所 盘点") |
| | | @PostMapping(value = "/pageInventoryList") |
| | | public R<PageInfo<PageInventoryListVo>> pageInventoryList(@RequestBody TErpInventoryQuery query) { |
| | | SysUser user = tokenService.getLoginUser().getUser(); |
| | | return R.ok(erpClinicWarehousingService.pageInventoryList(query,user)); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @ApiOperation(value = "诊所 盘点详情") |
| | | @GetMapping(value = "/detailInventory/{id}") |
| | | public R<List<InventoryDetailVo>> detailInventory(@PathVariable String id) { |
| | | SysUser user = tokenService.getLoginUser().getUser(); |
| | | return R.ok(erpClinicWarehousingService.detailInventory(id,user)); |
| | | } |
| | | |
| | | |
| | | |
| | | @ApiOperation(value = "诊所 盘点 出库 商品选择") |
| | | @PostMapping(value = "/pageInventoryGoodsPageList") |
| | | public R<PageInfo<TErpGoodsInventoryVO>> pageInventoryGoodsPageList(@RequestBody @Valid TErpGoodsInventoryQuery query) { |
| | | SysUser user = tokenService.getLoginUser().getUser(); |
| | | return R.ok(erpGoodsService.pageInventoryGoodsPageList1(query,user)); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @ApiOperation(value = "诊所 有效期预警商品选择") |
| | | @GetMapping(value = "/pageInventoryGoodsList") |
| | | public R<List<TErpGoodsInventoryVO>> pageInventoryGoodsList(String warehouseId,@RequestParam(required = false)String batchId) { |
| | | SysUser user = tokenService.getLoginUser().getUser(); |
| | | List<TErpGoodsInventoryVO> tErpGoodsInventoryVOS = erpGoodsService.pageInventoryGoodsList1(warehouseId, user); |
| | | if(batchId!=null && !"".equals(batchId)){ |
| | | tErpGoodsInventoryVOS = tErpGoodsInventoryVOS.stream().filter(e->e.getId().equals(batchId)).collect(Collectors.toList()); |
| | | } |
| | | return R.ok(tErpGoodsInventoryVOS); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @ApiOperation(value = "诊所 确认盘点") |
| | | @PostMapping(value = "/inventoryGoods") |
| | | public R<?> inventoryGoods(@RequestBody @Valid InventoryDto dto) { |
| | | SysUser user = tokenService.getLoginUser().getUser(); |
| | | erpGoodsService.inventoryGoods1(dto,user); |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @ApiOperation(value = "诊所 有效期预警") |
| | | @PostMapping(value = "/validityPeriodWarning") |
| | | public R<PageInfo<ValidityPeriodWarningVo>> validityPeriodWarning(@RequestBody ValidityPeriodWarningQuery query) { |
| | | SysUser user = tokenService.getLoginUser().getUser(); |
| | | PageInfo<ValidityPeriodWarningVo> pageInfo =erpClinicWarehousingService.validityPeriodWarning(query,user); |
| | | return R.ok(pageInfo); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取erp问题上报管理列表 |
| | | */ |
| | | @ApiOperation(value = "诊所 入库列表") |
| | | @PostMapping(value = "/warehousePageList") |
| | | public R<PageInfo<TErpClinicWarehousePageListVO>> warehousePageList(@RequestBody TClinicWarehouseQuery query) { |
| | | |
| | | SysUser user = tokenService.getLoginUser().getUser(); |
| | | Integer roleType = user.getRoleType(); |
| | | String supplierClinicId =null; |
| | | if(roleType == 5){ |
| | | // 诊所 |
| | | TCrmClinic crmClinic = crmClinicService.getOne(Wrappers.lambdaQuery(TCrmClinic.class) |
| | | .eq(TCrmClinic::getUserId, user.getUserId()) |
| | | .last("LIMIT 1")); |
| | | supplierClinicId = crmClinic.getId(); |
| | | } |
| | | |
| | | return R.ok(erpClinicWarehousingService.warehousePageList(query,user,supplierClinicId)); |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "诊所 入库商品列表") |
| | | @PostMapping(value = "/warehouseGoodsPageList") |
| | | public R<Page<TErpGoods>> warehouseGoodsPageList(@RequestBody TClinicGoodsWarehouseQuery query) { |
| | | |
| | | SysUser user = tokenService.getLoginUser().getUser(); |
| | | Integer roleType = user.getRoleType(); |
| | | String supplierClinicId =null; |
| | | if(roleType == 5){ |
| | | // 诊所 |
| | | TCrmClinic crmClinic = crmClinicService.getOne(Wrappers.lambdaQuery(TCrmClinic.class) |
| | | .eq(TCrmClinic::getUserId, user.getUserId()) |
| | | .last("LIMIT 1")); |
| | | supplierClinicId = crmClinic.getId(); |
| | | } |
| | | |
| | | return R.ok(erpGoodsService.warehouseGoodsPageList(query,user,supplierClinicId)); |
| | | } |
| | | @ApiOperation(value = "诊所 入库商品详情") |
| | | @GetMapping(value = "/warehouseGoodsDetail/{id}") |
| | | public R<WarehouseGoodsDetailVo> warehouseGoodsDetail(@PathVariable String id) { |
| | | SysUser user = tokenService.getLoginUser().getUser(); |
| | | Integer roleType = user.getRoleType(); |
| | | String supplierClinicId =null; |
| | | if(roleType == 5){ |
| | | // 诊所 |
| | | TCrmClinic crmClinic = crmClinicService.getOne(Wrappers.lambdaQuery(TCrmClinic.class) |
| | | .eq(TCrmClinic::getUserId, user.getUserId()) |
| | | .last("LIMIT 1")); |
| | | supplierClinicId = crmClinic.getId(); |
| | | } |
| | | |
| | | return R.ok(erpGoodsService.warehouseGoodsDetail(id)); |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "诊所 出库商品详情") |
| | | @GetMapping(value = "/outboundGoodsDetail/{id}") |
| | | public R<OutboundGoodsDetailVo> outboundGoodsDetail(@PathVariable String id) { |
| | | SysUser user = tokenService.getLoginUser().getUser(); |
| | | Integer roleType = user.getRoleType(); |
| | | String supplierClinicId =null; |
| | | if(roleType == 5){ |
| | | // 诊所 |
| | | TCrmClinic crmClinic = crmClinicService.getOne(Wrappers.lambdaQuery(TCrmClinic.class) |
| | | .eq(TCrmClinic::getUserId, user.getUserId()) |
| | | .last("LIMIT 1")); |
| | | supplierClinicId = crmClinic.getId(); |
| | | } |
| | | |
| | | return R.ok(erpGoodsService.outboundGoodsDetail(id)); |
| | | } |
| | | |
| | | @ApiOperation(value = "诊所 入库商品操作") |
| | | @PostMapping(value = "/warehouseGoods") |
| | | public R<?> warehouseGoods(@RequestBody @Valid List<clinicWarehouseGoodsDto> dtos) { |
| | | SysUser user = tokenService.getLoginUser().getUser(); |
| | | Integer roleType = user.getRoleType(); |
| | | String supplierClinicId =null; |
| | | if(roleType == 5){ |
| | | // 诊所 |
| | | TCrmClinic crmClinic = crmClinicService.getOne(Wrappers.lambdaQuery(TCrmClinic.class) |
| | | .eq(TCrmClinic::getUserId, user.getUserId()) |
| | | .last("LIMIT 1")); |
| | | supplierClinicId = crmClinic.getId(); |
| | | } |
| | | erpClinicWarehousingService.warehouseGoods(dtos,user,supplierClinicId); |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取erp问题上报管理列表 |
| | | */ |
| | | @ApiOperation(value = "诊所 出库列表") |
| | | @PostMapping(value = "/outboundPageList") |
| | | public R<PageInfo<TErpClinicOutboundPageListVO>> outboundPageList(@RequestBody TClinicOutboundQuery query) { |
| | | SysUser user = tokenService.getLoginUser().getUser(); |
| | | Integer roleType = user.getRoleType(); |
| | | String supplierClinicId =null; |
| | | if(roleType == 5){ |
| | | // 诊所 |
| | | TCrmClinic crmClinic = crmClinicService.getOne(Wrappers.lambdaQuery(TCrmClinic.class) |
| | | .eq(TCrmClinic::getUserId, user.getUserId()) |
| | | .last("LIMIT 1")); |
| | | supplierClinicId = crmClinic.getId(); |
| | | } |
| | | |
| | | return R.ok(erpClinicWarehousingService.outboundPageList(query,user,supplierClinicId)); |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "诊所 出库商品操作") |
| | | @PostMapping(value = "/outboundGoods") |
| | | public R<?> outboundGoods(@RequestBody @Valid ClinicOutboundGoodsDto dto) { |
| | | SysUser user = tokenService.getLoginUser().getUser(); |
| | | Integer roleType = user.getRoleType(); |
| | | String supplierClinicId =null; |
| | | if(roleType == 5){ |
| | | // 诊所 |
| | | TCrmClinic crmClinic = crmClinicService.getOne(Wrappers.lambdaQuery(TCrmClinic.class) |
| | | .eq(TCrmClinic::getUserId, user.getUserId()) |
| | | .last("LIMIT 1")); |
| | | supplierClinicId = crmClinic.getId(); |
| | | } |
| | | erpClinicWarehousingService.outboundGoods(dto,user,supplierClinicId); |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | 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.AjaxResult; |
| | | 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.common.core.exception.ServiceException; |
| | | import com.ruoyi.common.utils.WebUtils; |
| | | import com.ruoyi.framework.web.service.TokenService; |
| | | import com.ruoyi.system.dto.TErpGoodsAddDto; |
| | | import com.ruoyi.system.dto.TErpGoodsInfoSaveDto; |
| | | import com.ruoyi.system.dto.TErpGoodsUpdateStatusDto; |
| | | import com.ruoyi.system.dto.*; |
| | | import com.ruoyi.system.importExcel.TErpGoodsExcel; |
| | | import com.ruoyi.system.model.*; |
| | | import com.ruoyi.system.query.TErpGoodsQuery; |
| | |
| | | import java.net.URLEncoder; |
| | | import java.time.LocalDateTime; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | import java.util.stream.Collectors; |
| | |
| | | /** |
| | | * 获取erp问题上报管理列表 |
| | | */ |
| | | @ApiOperation(value = "供应商获取商品分页列表") |
| | | @ApiOperation(value = "供应商 诊所 获取商品分页列表") |
| | | @PostMapping(value = "/pageList") |
| | | public R<PageInfo<TErpGoodsVO>> pageList(@RequestBody TErpGoodsQuery query) { |
| | | SysUser user = tokenService.getLoginUser().getUser(); |
| | |
| | | } |
| | | return R.ok(erpGoodsService.pageList(query,user)); |
| | | } |
| | | /** |
| | | * 获取erp问题上报管理列表 |
| | | */ |
| | | @ApiOperation(value = "诊所 一键获取商品分页列表") |
| | | @PostMapping(value = "/pageAddList") |
| | | public R<Page<TErpGoods>> pageAddList(BasePage query) { |
| | | 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(); |
| | | } |
| | | 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)")); |
| | | for (TErpGoods record : page.getRecords()) { |
| | | TCrmSupplier byId = crmSupplierService.getById(record.getSupplierClinicId()); |
| | | record.setSupplierName(byId.getSupplierName()); |
| | | |
| | | |
| | | TErpGoodsType byId1 = erpGoodsTypeService.getById(record.getTypeId()); |
| | | record.setTypeName(byId1.getTypeName()); |
| | | |
| | | } |
| | | return R.ok(page); |
| | | } |
| | | |
| | | |
| | | |
| | |
| | | @PostMapping(value = "/add") |
| | | public R<Boolean> add(@Validated @RequestBody TErpGoodsAddDto dto) { |
| | | SysUser user = tokenService.getLoginUser().getUser(); |
| | | if (erpGoodsService.isExit(dto.getGoodsIdCode(), dto.getQuasiNumber())) { |
| | | if (erpGoodsService.isExit(dto.getGoodsIdCode(), dto.getQuasiNumber(),null)) { |
| | | return R.fail("erp商品已存在"); |
| | | } |
| | | Integer roleType = user.getRoleType(); |
| | |
| | | goods.setGoodsName(dto.getGoodsName()); |
| | | return R.ok(erpGoodsService.save(goods)); |
| | | } |
| | | @ApiOperation(value = "诊所添加商品") |
| | | @PostMapping(value = "/clinicAdd") |
| | | public R<Boolean> clinicAdd(@Validated @RequestBody TErpClinicGoodsAddDto dto) { |
| | | SysUser user = tokenService.getLoginUser().getUser(); |
| | | if (erpGoodsService.isExit(dto.getGoodsIdCode(), dto.getQuasiNumber(),null)) { |
| | | return R.fail("erp商品已存在"); |
| | | } |
| | | Integer roleType = user.getRoleType(); |
| | | TErpGoods goods = new TErpGoods(); |
| | | BeanUtils.copyProperties(dto,goods); |
| | | 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); |
| | | } |
| | | goods.setCreateId(user.getUserId().toString()); |
| | | goods.setGoodsIdCode(dto.getGoodsIdCode()); |
| | | return R.ok(erpGoodsService.save(goods)); |
| | | } |
| | | |
| | | @ApiOperation(value = "供应商删除商品") |
| | | @ApiOperation(value = "诊所编辑商品") |
| | | @PostMapping(value = "/clinicUpdate") |
| | | public R<Boolean> clinicUpdate(@Validated @RequestBody TErpClinicGoodsUpdateDto dto) { |
| | | SysUser user = tokenService.getLoginUser().getUser(); |
| | | if (erpGoodsService.isExit(dto.getGoodsIdCode(), dto.getQuasiNumber(),dto.getId())) { |
| | | return R.fail("erp商品已存在"); |
| | | } |
| | | Integer roleType = user.getRoleType(); |
| | | TErpGoods goods = new TErpGoods(); |
| | | BeanUtils.copyProperties(dto,goods); |
| | | 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); |
| | | } |
| | | goods.setCreateId(user.getUserId().toString()); |
| | | goods.setGoodsIdCode(dto.getGoodsIdCode()); |
| | | goods.setId(dto.getId()); |
| | | return R.ok(erpGoodsService.updateById(goods)); |
| | | } |
| | | |
| | | @ApiOperation(value = "供应商/诊所 删除商品") |
| | | @DeleteMapping(value = "/delete/{id}") |
| | | public R<Boolean> delete(@PathVariable String id) { |
| | | return R.ok(erpGoodsService.removeById(id)); |
| | | TErpGoods goods = erpGoodsService.getById(id); |
| | | SysUser user = tokenService.getLoginUser().getUser(); |
| | | String cid = null; |
| | | |
| | | if(user.getRoleType() == 5){ |
| | | // 诊所 |
| | | TCrmClinic crmClinic = crmClinicService.getOne(Wrappers.lambdaQuery(TCrmClinic.class) |
| | | .eq(TCrmClinic::getUserId, user.getUserId()) |
| | | .last("LIMIT 1")); |
| | | cid = crmClinic.getId(); |
| | | if(goods.getGoodsSource()==1){ |
| | | String clinicIds = goods.getClinicIds(); |
| | | String[] split = clinicIds.split(","); |
| | | // clinicIds 移除cid |
| | | ArrayList<String> strings = new ArrayList<>(); |
| | | for (String s : split) { |
| | | if(!s.equals(cid)){ |
| | | strings.add(s); |
| | | } |
| | | } |
| | | goods.setClinicIds(String.join(",",strings)); |
| | | erpGoodsService.updateById(goods); |
| | | }else { |
| | | erpGoodsService.removeById(id); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | erpGoodsService.removeById(id); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @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)); |
| | | SysUser user = tokenService.getLoginUser().getUser(); |
| | | String cid = null; |
| | | |
| | | if(user.getRoleType() == 5){ |
| | | TCrmClinic crmClinic = crmClinicService.getOne(Wrappers.lambdaQuery(TCrmClinic.class) |
| | | .eq(TCrmClinic::getUserId, user.getUserId()) |
| | | .last("LIMIT 1")); |
| | | 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)); |
| | | } |
| | | } |
| | | erpGoodsService.updateBatchById(list); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | |
| | | List<TErpGoodsExcel> carAnnuallyImportExcels = ExcelImportUtil.importExcel(inputStream, TErpGoodsExcel.class, params); |
| | | Set<String> collect = carAnnuallyImportExcels.stream().map(TErpGoodsExcel::getGoodsIdCode).collect(Collectors.toSet()); |
| | | if (collect.size() != carAnnuallyImportExcels.size()) { |
| | | return AjaxResult.error("导入数据中商品标识码重复"); |
| | | return AjaxResult.error("导入数据中商品条码重复"); |
| | | } |
| | | Integer roleType = user.getRoleType(); |
| | | for (TErpGoodsExcel erpGoodsExcel : carAnnuallyImportExcels) { |
| | |
| | | } |
| | | goods.setGoodsName(erpGoodsExcel.getGoodsName()); |
| | | // 判断数据是否正确 |
| | | // 判断标识码是否重复 |
| | | // 判断条码是否重复 |
| | | long count = erpGoodsService.count(new QueryWrapper<TErpGoods>().eq("goods_id_code", erpGoodsExcel.getGoodsIdCode())); |
| | | if(count>0){ |
| | | names.add(erpGoodsExcel.getGoodsName() + " :标识码重复"); |
| | | names.add(erpGoodsExcel.getGoodsName() + " :条码重复"); |
| | | continue; |
| | | } |
| | | goods.setGoodsIdCode(erpGoodsExcel.getGoodsIdCode()); |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @ApiOperation(value = "平台设置分佣") |
| | | @PostMapping(value = "/setCommission") |
| | | public R<Boolean> setCommission(@RequestBody @Valid TErpGoodsSetCommissionDto dto) { |
| | | |
| | | SysUser user = tokenService.getLoginUser().getUser(); |
| | | if(user.getRoleType()==1){ |
| | | TErpGoods goods = erpGoodsService.getById(dto.getId()); |
| | | goods.setClinicPurchasePrice(BigDecimal.valueOf(dto.getClinicPurchasePrice()).setScale(2,RoundingMode.HALF_UP)); |
| | | goods.setPlatformCommissionPrice(BigDecimal.valueOf(dto.getPlatformCommissionPrice()).setScale(2,RoundingMode.HALF_UP)); |
| | | erpGoodsService.updateById( goods); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | } |
| | | |
| | |
| | | package com.ruoyi.web.controller.api; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | 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.BaseModel; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import com.ruoyi.common.utils.DateUtils; |
| | | import com.ruoyi.framework.web.service.TokenService; |
| | | import com.ruoyi.system.dto.AddProcurementDto; |
| | | import com.ruoyi.system.model.TCrmClinic; |
| | | import com.ruoyi.system.model.TCrmSupplier; |
| | | import com.ruoyi.system.model.TErpGoods; |
| | | import com.ruoyi.system.dto.UpdateStatusProcurementDto; |
| | | import com.ruoyi.system.dto.UpdateStatusProcurementLastDto; |
| | | import com.ruoyi.system.model.*; |
| | | import com.ruoyi.system.query.TErpGoodsQuery; |
| | | import com.ruoyi.system.query.TErpProcurementQuery; |
| | | import com.ruoyi.system.service.TCrmClinicService; |
| | | import com.ruoyi.system.service.TErpProcurementService; |
| | | import com.ruoyi.system.service.TErpSupplierWarehousingService; |
| | | import com.ruoyi.system.vo.TErpGoodsVO; |
| | | import com.ruoyi.system.vo.TErpProcurementDetailVo; |
| | | import com.ruoyi.system.vo.TErpProcurementVo; |
| | | import com.ruoyi.system.service.*; |
| | | import com.ruoyi.system.vo.*; |
| | | import com.ruoyi.web.core.config.LakalaConfig; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.poi.ss.formula.functions.T; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.validation.Valid; |
| | | import java.math.BigDecimal; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | private final TErpProcurementService erpProcurementService; |
| | | private final TokenService tokenService; |
| | | private final TCrmClinicService crmClinicService; |
| | | private final TErpProcurementGoodsService erpProcurementGoodsService; |
| | | private final TErpGoodsService erpGoodsService; |
| | | private final TErpClinicWarehousingService erpClinicWarehousingService; |
| | | private final TErpClinicWarehousingBatchService erpClinicWarehousingBatchService; |
| | | private final TCrmSupplierService crmSupplierService; |
| | | |
| | | |
| | | @Autowired |
| | | public TErpProcurementController(TErpProcurementService erpProcurementService, TokenService tokenService,TCrmClinicService crmClinicService) { |
| | | public TErpProcurementController(TErpProcurementService erpProcurementService, TokenService tokenService,TCrmClinicService crmClinicService,TErpProcurementGoodsService erpProcurementGoodsService |
| | | , TErpGoodsService erpGoodsService,TErpClinicWarehousingService erpClinicWarehousingService,TErpClinicWarehousingBatchService erpClinicWarehousingBatchService, |
| | | TCrmSupplierService crmSupplierService) { |
| | | this.erpProcurementService = erpProcurementService; |
| | | this.tokenService = tokenService; |
| | | this.crmClinicService = crmClinicService; |
| | | this.erpProcurementGoodsService = erpProcurementGoodsService; |
| | | this.erpGoodsService = erpGoodsService; |
| | | this.erpClinicWarehousingService = erpClinicWarehousingService; |
| | | this.erpClinicWarehousingBatchService = erpClinicWarehousingBatchService; |
| | | this.crmSupplierService = crmSupplierService; |
| | | } |
| | | |
| | | |
| | |
| | | .last("LIMIT 1")); |
| | | clinicSupplierId = crmClinic.getId(); |
| | | } |
| | | return R.ok(erpProcurementService.addProcurement(clinicSupplierId,user,dtos)); |
| | | erpProcurementService.addProcurement(clinicSupplierId, user, dtos); |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @ApiOperation(value = "采购详情") |
| | | @GetMapping(value = "/detailProcurement/{id}") |
| | | public R<DetailProcurementVO> detailProcurement(@PathVariable String id) { |
| | | 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(); |
| | | } |
| | | |
| | | return R.ok( erpProcurementService.detailProcurement(clinicSupplierId, user, id)); |
| | | } |
| | | @ApiOperation(value = "采购草稿") |
| | | @GetMapping(value = "/getProcurementDraft") |
| | | public R<ArrayList<DetailProcurementNextVO>> getProcurementDraft() { |
| | | 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(); |
| | | } |
| | | ArrayList<DetailProcurementNextVO> detailProcurementNextVOS = new ArrayList<>(); |
| | | List<TErpProcurement> list1 = erpProcurementService.list(new LambdaQueryWrapper<TErpProcurement>().eq(TErpProcurement::getStatus, 1).orderByDesc(BaseModel::getCreateTime)); |
| | | if(list1.isEmpty()){ |
| | | return R.ok(detailProcurementNextVOS); |
| | | } |
| | | String id = list1.get(0).getId(); |
| | | List<TErpProcurementGoods> list = erpProcurementGoodsService.list(new LambdaQueryWrapper<TErpProcurementGoods>().eq(TErpProcurementGoods::getProcurementId, id)); |
| | | |
| | | for (TErpProcurementGoods tErpProcurementGoods : list) { |
| | | DetailProcurementNextVO detailProcurementNextVO = new DetailProcurementNextVO(); |
| | | detailProcurementNextVO.setId(tErpProcurementGoods.getId()); |
| | | detailProcurementNextVO.setGoodsName(tErpProcurementGoods.getGoodsName()); |
| | | detailProcurementNextVO.setQuasiNumber(tErpProcurementGoods.getQuasiNumber()); |
| | | detailProcurementNextVO.setPackingUnitName(tErpProcurementGoods.getUnitName()); |
| | | detailProcurementNextVO.setSalesAmount(tErpProcurementGoods.getSalesAmount()); |
| | | detailProcurementNextVO.setNum(tErpProcurementGoods.getPurchaseCount()); |
| | | detailProcurementNextVO.setTotalPrice(tErpProcurementGoods.getTotalPrice()); |
| | | detailProcurementNextVO.setSupplierName(tErpProcurementGoods.getSupplierName()); |
| | | detailProcurementNextVO.setUnitName(tErpProcurementGoods.getUnitName()); |
| | | detailProcurementNextVO.setPurchasePrice(tErpProcurementGoods.getPurchasePrice()); |
| | | detailProcurementNextVOS.add(detailProcurementNextVO); |
| | | } |
| | | return R.ok(detailProcurementNextVOS); |
| | | } |
| | | |
| | | @ApiOperation(value = "采购详情入库") |
| | | @PostMapping(value = "/updateStatusProcurement") |
| | | public R<DetailProcurementVO> updateStatusProcurement(@RequestParam @Valid UpdateStatusProcurementLastDto dto) { |
| | | 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(); |
| | | } |
| | | TErpProcurement erpProcurement = erpProcurementService.getById(dto.getId()); |
| | | if(!erpProcurement.getClinicId().equals(clinicSupplierId)){ |
| | | return R.fail("无权限操作"); |
| | | } |
| | | if(erpProcurement.getStatus()!=4){ |
| | | return R.fail("目前状态无法入库"); |
| | | } |
| | | erpProcurement.setStatus(5); |
| | | erpProcurementService.updateById(erpProcurement); |
| | | |
| | | List<String> collect = dto.getList().stream().map(UpdateStatusProcurementDto::getId).collect(Collectors.toList()); |
| | | |
| | | List<TErpProcurementGoods> list = erpProcurementGoodsService.list(new LambdaQueryWrapper<TErpProcurementGoods>().in(TErpProcurementGoods::getId, collect)); |
| | | TErpClinicWarehousing tErpClinicWarehousing = new TErpClinicWarehousing(); |
| | | tErpClinicWarehousing.setClinicId(erpProcurement.getClinicId()); |
| | | tErpClinicWarehousing.setProcurementId(erpProcurement.getId()); |
| | | // tErpClinicWarehousing.setGoodsId(erpGoods.getId()); |
| | | // tErpClinicWarehousing.setGoodsName(erpGoods.getGoodsName()); |
| | | TCrmSupplier byId = crmSupplierService.getById(erpProcurement.getSupplierId()); |
| | | tErpClinicWarehousing.setSupplierName(byId.getSupplierName()); |
| | | // tErpClinicWarehousing.setQuasiNumber(erpGoods.getQuasiNumber()); |
| | | // tErpClinicWarehousing.setSalesAmount(tErpProcurementGoods.getSalesAmount()); |
| | | // tErpClinicWarehousing.setPurchaseCount(updateStatusProcurementDto.getPurchaseCount()); |
| | | tErpClinicWarehousing.setTotalPrice(erpProcurement.getPayMoney()); |
| | | // tErpClinicWarehousing.setUnitAmount(tErpProcurementGoods.getSalesAmount()); |
| | | tErpClinicWarehousing.setWarehousingType(1); |
| | | tErpClinicWarehousing.setType(1); |
| | | tErpClinicWarehousing.setWarehouseNo("G"+ DateUtils.dateTimeNow()); |
| | | erpClinicWarehousingService.save(tErpClinicWarehousing); |
| | | // goodsId分组 |
| | | for (UpdateStatusProcurementDto updateStatusProcurementDto : dto.getList()) { |
| | | TErpProcurementGoods tErpProcurementGoods = list.stream().filter(t -> t.getId().equals(updateStatusProcurementDto.getId())).findFirst().get(); |
| | | |
| | | TErpGoods erpGoods = erpGoodsService.getById(tErpProcurementGoods.getGoodsId()); |
| | | TErpClinicWarehousingBatch tErpClinicWarehousingGoods = new TErpClinicWarehousingBatch(); |
| | | tErpClinicWarehousingGoods.setWarehousingId(tErpClinicWarehousing.getId()); |
| | | tErpClinicWarehousingGoods.setWarehousingNumber(updateStatusProcurementDto.getPurchaseCount()); |
| | | tErpClinicWarehousingGoods.setBatchNumber(updateStatusProcurementDto.getBatchNumber()); |
| | | tErpClinicWarehousingGoods.setProductionDate(updateStatusProcurementDto.getProductionDate()); |
| | | tErpClinicWarehousingGoods.setExpiryDate(updateStatusProcurementDto.getExpiryDate()); |
| | | tErpClinicWarehousingGoods.setGoodsId(erpGoods.getId()); |
| | | tErpClinicWarehousingGoods.setGoodsName(erpGoods.getGoodsName()); |
| | | tErpClinicWarehousingGoods.setQuasiNumber(erpGoods.getQuasiNumber()); |
| | | tErpClinicWarehousingGoods.setSalesAmount(tErpProcurementGoods.getSalesAmount()); |
| | | erpClinicWarehousingBatchService.save(tErpClinicWarehousingGoods); |
| | | |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | |
| | | String amount = String.valueOf(erpProcurement.getPayMoney().multiply(new BigDecimal("100")).intValue()); |
| | | |
| | | TCrmSupplier supplier = crmSupplierService.getById(erpProcurement.getSupplierId()); |
| | | String trans_type ="41"; |
| | | if("WECHAT".equals(type)){ |
| | | trans_type= "51"; |
| | | } |
| | | |
| | | |
| | | String apiPath = "sit/api/v3/labs/trans/preorder"; |
| | |
| | | "\t\t\"settle_type\": \"1\",\n" + |
| | | "\t\t\"total_amount\": " + amount + ",\n" + |
| | | "\t\t\"account_type\": \"" + type + "\",\n" + |
| | | "\t\t\"trans_type\": \"41\"\n" + |
| | | "\t\t\"trans_type\": \""+trans_type+"\"\n" + |
| | | "\t}\n" + |
| | | "}"; |
| | | String authorization = getAuthorization(body); |
| | |
| | | erpProcurement.setStatus(2); |
| | | erpProcurement.setTermNo(supplier.getTermNo()); |
| | | erpProcurement.setAccountType(type); |
| | | erpProcurement.setTransType("41"); |
| | | erpProcurement.setTransType(trans_type); |
| | | erpProcurementService.updateById(erpProcurement); |
| | | |
| | | return R.ok(responseStr); |
| | |
| | | } |
| | | HashMap<String, Object> map1 = new HashMap<>(); |
| | | //TODO hzt |
| | | map1.put("recv_no", "822641048160MMJ"); |
| | | map1.put("recv_no", "SR2024000144253"); |
| | | // 手续费 |
| | | BigDecimal bigDecimal = allMoney.multiply(new BigDecimal("0.038")).setScale(2, RoundingMode.HALF_UP); |
| | | payMoney = payMoney.subtract(bigDecimal); |
| | |
| | | return jsonObject; |
| | | } |
| | | } |
| | | |
| | | return null; |
| | | } |
| | | |
| | |
| | | @ApiOperation(value = "退款") |
| | | @PostMapping(value = "/refundOrder") |
| | | @SneakyThrows |
| | | public R<?> refundOrder(@RequestParam String id, String type, HttpServletRequest request) { |
| | | public R<?> refundOrder(@RequestParam String id, HttpServletRequest request) { |
| | | SysUser user = tokenService.getLoginUser().getUser(); |
| | | try { |
| | | // 先退分账 在退订单 |
| | |
| | | // } |
| | | HashMap<String, Object> map1 = new HashMap<>(); |
| | | // TODO hzt |
| | | map1.put("recv_no", "dsadasda"); |
| | | map1.put("recv_no", "SR2024000144253"); |
| | | map1.put("amt", erpProcurement.getMoney().multiply(BigDecimal.valueOf(100)).intValue() + ""); |
| | | objects.add(map1); |
| | | map.put("total_amt",erpProcurement.getMoney().multiply(BigDecimal.valueOf(100)).intValue() + ""); |
| | |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return R.fail(500, "调用支付宝支付预下单接口错误"); |
| | | return R.fail(500, "退款失败请联系平台管理员"); |
| | | } |
| | | |
| | | |
| | |
| | | package com.ruoyi.system.dto; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | |
| | | |
| | | @ApiModelProperty("状态 1草稿") |
| | | private Integer state; |
| | | |
| | | |
| | | private BigDecimal platformCommissionPrice; |
| | | |
| | | } |
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.util.List; |
| | | |
| | | @Data |
| | | @ApiModel(value = "诊所商品出库dto") |
| | | public class ClinicOutboundGoodsDto { |
| | | |
| | | |
| | | @ApiModelProperty(value = "出库原因") |
| | | @NotBlank(message = "出库原因不能为空") |
| | | private String outboundReason; |
| | | |
| | | @ApiModelProperty(value = "出库类型 1=报损 2=到期 3=失效 4=召回 5=其他") |
| | | @NotNull(message = "出库类型不能为空") |
| | | private Integer outboundType; |
| | | |
| | | @ApiModelProperty("种类数") |
| | | @NotNull(message = "种类数不能为空") |
| | | private Integer typeNum; |
| | | |
| | | @ApiModelProperty("总价") |
| | | @NotNull(message = "总价不能为空") |
| | | private BigDecimal totalPrice; |
| | | |
| | | |
| | | @ApiModelProperty(value = "商品出库二级dto") |
| | | private List<OutboundGoodsNextDto> outboundGoodsNextDtos; |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | public class InventoryDto { |
| | | |
| | | @ApiModelProperty(value = "仓库id") |
| | | @NotBlank(message = "仓库id不能为空") |
| | | private String warehouseId; |
| | | |
| | | @ApiModelProperty(value = "商品信息") |
New file |
| | |
| | | package com.ruoyi.system.dto; |
| | | |
| | | import cn.afterturn.easypoi.excel.annotation.Excel; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | 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; |
| | | |
| | | @Data |
| | | @ApiModel(value = "erp诊所商品添加DTO") |
| | | public class TErpClinicGoodsAddDto { |
| | | |
| | | @ApiModelProperty(value = "商品名称") |
| | | @NotBlank ( message = "商品名称不能为空") |
| | | private String goodsName; |
| | | |
| | | |
| | | @ApiModelProperty(value = "供应商名称") |
| | | @NotBlank ( message = "供应商名称不能为空") |
| | | private String supplierName; |
| | | |
| | | |
| | | @ApiModelProperty(value = "国药准字号") |
| | | @NotBlank ( message = "国药准字号不能为空") |
| | | private String quasiNumber; |
| | | |
| | | @ApiModelProperty(value = "生产厂家") |
| | | @NotBlank ( message = "生产厂家不能为空") |
| | | private String manufacturer; |
| | | |
| | | @ApiModelProperty(value = "制剂规格") |
| | | @NotBlank ( message = "制剂规格不能为空") |
| | | private String formulationSpec; |
| | | |
| | | @ApiModelProperty(value = "包装规格") |
| | | @NotBlank ( message = "包装规格不能为空") |
| | | private String packingSpec; |
| | | |
| | | |
| | | @ApiModelProperty(value = "商品类型id") |
| | | @NotBlank ( message = "商品类型id不能为空") |
| | | private String typeId; |
| | | |
| | | @ApiModelProperty(value = "商品条码") |
| | | @NotBlank ( message = "商品条码不能为空") |
| | | private String goodsIdCode; |
| | | |
| | | |
| | | @ApiModelProperty(value = "保养周期") |
| | | private String maintenanceInterval; |
| | | |
| | | @ApiModelProperty(value = "保养周期单位") |
| | | private String maintenanceIntervalUnit; |
| | | |
| | | |
| | | |
| | | @ApiModelProperty(value = "是否为处方药 1=是 2=否") |
| | | private Integer isPrescriptionDrug; |
| | | |
| | | |
| | | @ApiModelProperty(value = "商品规格") |
| | | @NotBlank ( message = "商品规格不能为空") |
| | | private String goodsSpec; |
| | | |
| | | |
| | | |
| | | @ApiModelProperty(value = "预警库存") |
| | | @NotNull(message = "预警库存不能为空") |
| | | private Integer warningInventory; |
| | | |
| | | @ApiModelProperty(value = "包装单位,单位id") |
| | | @NotBlank ( message = "包装单位,单位id不能为空") |
| | | private String packingUnitId; |
| | | |
| | | |
| | | @ApiModelProperty(value = "商品售价") |
| | | @NotNull(message = "商品售价不能为空") |
| | | private BigDecimal salesAmount; |
| | | |
| | | |
| | | |
| | | @ApiModelProperty(value = "使用说明") |
| | | private String instructionsUse; |
| | | |
| | | |
| | | |
| | | @ApiModelProperty(value = "副作用") |
| | | private String sideEffect; |
| | | |
| | | |
| | | |
| | | @ApiModelProperty(value = "拼音简码") |
| | | private String simplifiedCode; |
| | | |
| | | @ApiModelProperty(value = "剂型") |
| | | private String dosageForm; |
| | | |
| | | @ApiModelProperty(value = "用途分类") |
| | | private String usageClassification; |
| | | |
| | | @ApiModelProperty(value = "商品品牌名") |
| | | private String productBrand; |
| | | |
| | | @ApiModelProperty(value = "产地") |
| | | private String placeOfOrigin; |
| | | |
| | | @ApiModelProperty(value = "成分") |
| | | private String ingredient; |
| | | |
| | | @ApiModelProperty(value = "性状") |
| | | private String trait; |
| | | |
| | | @ApiModelProperty(value = "适应症") |
| | | private String indication; |
| | | |
| | | @ApiModelProperty(value = "禁忌") |
| | | private String taboo; |
| | | |
| | | @ApiModelProperty(value = "注意事项") |
| | | private String precautions; |
| | | |
| | | @ApiModelProperty(value = "相互作用") |
| | | private String interaction; |
| | | |
| | | |
| | | |
| | | |
| | | } |
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; |
| | | |
| | | @Data |
| | | @ApiModel(value = "erp诊所商品编辑DTO") |
| | | public class TErpClinicGoodsUpdateDto { |
| | | |
| | | @ApiModelProperty(value = "商品id") |
| | | @NotNull(message = "商品id不能为空") |
| | | private String id; |
| | | @ApiModelProperty(value = "商品名称") |
| | | @NotBlank ( message = "商品名称不能为空") |
| | | private String goodsName; |
| | | |
| | | |
| | | @ApiModelProperty(value = "供应商名称") |
| | | @NotBlank ( message = "供应商名称不能为空") |
| | | private String supplierName; |
| | | |
| | | |
| | | @ApiModelProperty(value = "国药准字号") |
| | | @NotBlank ( message = "国药准字号不能为空") |
| | | private String quasiNumber; |
| | | |
| | | @ApiModelProperty(value = "生产厂家") |
| | | @NotBlank ( message = "生产厂家不能为空") |
| | | private String manufacturer; |
| | | |
| | | @ApiModelProperty(value = "制剂规格") |
| | | @NotBlank ( message = "制剂规格不能为空") |
| | | private String formulationSpec; |
| | | |
| | | @ApiModelProperty(value = "包装规格") |
| | | @NotBlank ( message = "包装规格不能为空") |
| | | private String packingSpec; |
| | | |
| | | |
| | | @ApiModelProperty(value = "商品类型id") |
| | | @NotBlank ( message = "商品类型id不能为空") |
| | | private String typeId; |
| | | |
| | | @ApiModelProperty(value = "商品条码") |
| | | @NotBlank ( message = "商品条码不能为空") |
| | | private String goodsIdCode; |
| | | |
| | | |
| | | @ApiModelProperty(value = "保养周期") |
| | | private String maintenanceInterval; |
| | | |
| | | @ApiModelProperty(value = "保养周期单位") |
| | | private String maintenanceIntervalUnit; |
| | | |
| | | |
| | | |
| | | @ApiModelProperty(value = "是否为处方药 1=是 2=否") |
| | | private Integer isPrescriptionDrug; |
| | | |
| | | |
| | | @ApiModelProperty(value = "商品规格") |
| | | @NotBlank ( message = "商品规格不能为空") |
| | | private String goodsSpec; |
| | | |
| | | |
| | | |
| | | @ApiModelProperty(value = "预警库存") |
| | | @NotNull(message = "预警库存不能为空") |
| | | private Integer warningInventory; |
| | | |
| | | @ApiModelProperty(value = "包装单位,单位id") |
| | | @NotBlank ( message = "包装单位,单位id不能为空") |
| | | private String packingUnitId; |
| | | |
| | | |
| | | @ApiModelProperty(value = "商品售价") |
| | | @NotNull(message = "商品售价不能为空") |
| | | private BigDecimal salesAmount; |
| | | |
| | | |
| | | |
| | | @ApiModelProperty(value = "使用说明") |
| | | private String instructionsUse; |
| | | |
| | | |
| | | |
| | | @ApiModelProperty(value = "副作用") |
| | | private String sideEffect; |
| | | |
| | | |
| | | |
| | | @ApiModelProperty(value = "拼音简码") |
| | | private String simplifiedCode; |
| | | |
| | | @ApiModelProperty(value = "剂型") |
| | | private String dosageForm; |
| | | |
| | | @ApiModelProperty(value = "用途分类") |
| | | private String usageClassification; |
| | | |
| | | @ApiModelProperty(value = "商品品牌名") |
| | | private String productBrand; |
| | | |
| | | @ApiModelProperty(value = "产地") |
| | | private String placeOfOrigin; |
| | | |
| | | @ApiModelProperty(value = "成分") |
| | | private String ingredient; |
| | | |
| | | @ApiModelProperty(value = "性状") |
| | | private String trait; |
| | | |
| | | @ApiModelProperty(value = "适应症") |
| | | private String indication; |
| | | |
| | | @ApiModelProperty(value = "禁忌") |
| | | private String taboo; |
| | | |
| | | @ApiModelProperty(value = "注意事项") |
| | | private String precautions; |
| | | |
| | | @ApiModelProperty(value = "相互作用") |
| | | private String interaction; |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | @NotBlank(message = "商品名称不能为空") |
| | | private String goodsName; |
| | | |
| | | @ApiModelProperty(value = "商品标识码") |
| | | @NotBlank(message = "商品标识码不能为空") |
| | | @ApiModelProperty(value = "商品条码") |
| | | @NotBlank(message = "商品条码不能为空") |
| | | private String goodsIdCode; |
| | | |
| | | |
| | | @ApiModelProperty(value = "国药准字号") |
| | | @NotBlank(message = "国药准字号不能为空") |
| | |
| | | @NotBlank(message = "商品类型id不能为空") |
| | | private String typeId; |
| | | |
| | | @ApiModelProperty(value = "商品69码") |
| | | @ApiModelProperty(value = "商品标识码") |
| | | private String goodsYards; |
| | | |
| | | @ApiModelProperty(value = "保养周期") |
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; |
| | | |
| | | @Data |
| | | @ApiModel(value = "商品设置分佣DTO") |
| | | public class TErpGoodsSetCommissionDto { |
| | | @ApiModelProperty(value = "商品id") |
| | | @NotBlank(message = "商品id不能为空") |
| | | private String id; |
| | | @ApiModelProperty(value = "采购价") |
| | | @NotNull(message = "采购价不能为空") |
| | | private Double clinicPurchasePrice; |
| | | @ApiModelProperty(value = "平台分佣金额") |
| | | @NotNull(message = "平台分佣金额不能为空") |
| | | private Double platformCommissionPrice; |
| | | } |
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.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Data |
| | | @ApiModel("诊所采购入库二级dto") |
| | | public class UpdateStatusProcurementDto { |
| | | @ApiModelProperty("采购二级id") |
| | | @NotBlank(message = "采购二级id不能为空") |
| | | private String id; |
| | | |
| | | @ApiModelProperty("数量") |
| | | @NotNull(message = "数量不能为空") |
| | | private Integer purchaseCount; |
| | | |
| | | @ApiModelProperty("批次号") |
| | | @NotBlank(message = "批次号不能为空") |
| | | private String batchNumber; |
| | | |
| | | |
| | | @ApiModelProperty(value = "生产日期") |
| | | @NotNull(message = "生产日期不能为空") |
| | | private LocalDateTime productionDate; |
| | | |
| | | @ApiModelProperty(value = "有效日期") |
| | | @NotNull(message = "有效日期不能为空") |
| | | private LocalDateTime expiryDate; |
| | | |
| | | |
| | | |
| | | } |
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.time.LocalDate; |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | @ApiModel("诊所采购入库一级dto") |
| | | public class UpdateStatusProcurementLastDto { |
| | | @ApiModelProperty("采购id") |
| | | @NotBlank(message = "采购id不能为空") |
| | | private String id; |
| | | |
| | | |
| | | |
| | | @ApiModelProperty("采购二级dto") |
| | | private List<UpdateStatusProcurementDto> list; |
| | | |
| | | |
| | | } |
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("诊所 商品入库dto") |
| | | public class clinicWarehouseGoodsDto { |
| | | @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; |
| | | |
| | | } |
| | |
| | | @Excel(width = 30,name = "*商品名称") |
| | | private String goodsName; |
| | | |
| | | @Excel(width = 30,name = "*商品标识码") |
| | | @Excel(width = 30,name = "*商品条码") |
| | | private String goodsIdCode; |
| | | |
| | | @Excel(width = 30,name = "*国药准字号") |
| | |
| | | private String packingSpec; |
| | | |
| | | |
| | | @Excel(width = 30,name = "商品69码") |
| | | @Excel(width = 30,name = "商品标识码") |
| | | private String goodsYards; |
| | | |
| | | @Excel(width = 30,name = "保养周期(天)") |
| | |
| | | package com.ruoyi.system.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import com.ruoyi.system.model.TErpClinicWarehousing; |
| | | import com.ruoyi.system.query.*; |
| | | import com.ruoyi.system.vo.*; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | */ |
| | | public interface TErpClinicWarehousingMapper extends BaseMapper<TErpClinicWarehousing> { |
| | | |
| | | 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); |
| | | |
| | | |
| | | PageInfo<ValidityPeriodWarningVo> validityPeriodWarning(@Param("pageInfo") PageInfo<ValidityPeriodWarningVo> pageInfo, @Param("query") ValidityPeriodWarningQuery query, @Param("user") SysUser user, @Param("nineMonthLater") LocalDateTime nineMonthLater, @Param("supplierClinicId") String supplierClinicId); |
| | | |
| | | |
| | | List<TErpGoodsVO> pageList(@Param("query") TErpGoodsQuery query, @Param("pageInfo") PageInfo<TErpGoodsVO> pageInfo, @Param("user") SysUser user); |
| | | |
| | | List<TErpClinicWarehousePageListVO> warehousePageList(@Param("query") TClinicWarehouseQuery query, @Param("pageInfo") PageInfo<TErpClinicWarehousePageListVO> pageInfo, @Param("user") SysUser user, @Param("supplierClinicId") String supplierClinicId, @Param("sTime") String sTime, @Param("eTime") String eTime); |
| | | |
| | | 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<TErpGoodsInventoryVO> pageInventoryGoodsList(@Param("warehouseId") String warehouseId, @Param("user") SysUser user, @Param("supplierClinicId") String supplierClinicId, @Param("endDate") Date endDate); |
| | | |
| | | |
| | | List<TErpGoodsInventoryVO> pageInventoryGoodsList1(@Param("warehouseId") String warehouseId, @Param("user") SysUser user, @Param("supplierClinicId") String supplierClinicId, @Param("endDate") Date endDate); |
| | | |
| | | List<TErpGoodsInventoryVO> pageInventoryGoodsPageList1(@Param("query") TErpGoodsInventoryQuery query, @Param("pageInfo") PageInfo<TErpGoodsInventoryVO> pageInfo, @Param("user") SysUser user, @Param("supplierClinicId") String supplierClinicId, @Param("endDate") Date endDate); |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | @TableField("inventory_type") |
| | | private Integer inventoryType; |
| | | |
| | | @ApiModelProperty(value = "商品id") |
| | | @TableField("goods_id") |
| | | private String goodsId; |
| | | |
| | | } |
| | |
| | | @TableField("outbound_reason") |
| | | private String outboundReason; |
| | | |
| | | @ApiModelProperty(value = "盘点id") |
| | | @TableField("inventory_id") |
| | | private String inventoryId; |
| | | |
| | | @ApiModelProperty(value = "种类数") |
| | | @TableField("type_num") |
| | | private Integer typeNum; |
| | | |
| | | |
| | | } |
| | |
| | | @TableField("total_price") |
| | | private BigDecimal totalPrice; |
| | | |
| | | @ApiModelProperty(value = "商品id") |
| | | @TableField("goods_id") |
| | | private String goodsId; |
| | | |
| | | |
| | | } |
| | |
| | | @TableField("clinic_id") |
| | | private String clinicId; |
| | | |
| | | @ApiModelProperty(value = "商品id") |
| | | @TableField("goods_id") |
| | | private String goodsId; |
| | | |
| | | @ApiModelProperty(value = "商品名称") |
| | | @TableField("goods_name") |
| | | private String goodsName; |
| | | |
| | | @ApiModelProperty(value = "供应商名称") |
| | | @TableField("supplier_name") |
| | | private String supplierName; |
| | | |
| | | @ApiModelProperty(value = "国药准字号") |
| | | @TableField("quasi_number") |
| | | private String quasiNumber; |
| | | |
| | | @ApiModelProperty(value = "售价") |
| | | @TableField("sales_amount") |
| | | private BigDecimal salesAmount; |
| | | |
| | | @ApiModelProperty(value = "所需数量(采购数量)") |
| | | @TableField("purchase_count") |
| | | private Integer purchaseCount; |
| | | |
| | | @ApiModelProperty(value = "总价") |
| | | @TableField("total_price") |
| | |
| | | @TableField("warehousing_type") |
| | | private Integer warehousingType; |
| | | |
| | | @ApiModelProperty(value = "入库单号") |
| | | @TableField("warehouse_no") |
| | | private String warehouseNo; |
| | | |
| | | @ApiModelProperty(value = "1采购 2盘点 3手动") |
| | | private Integer type; |
| | | |
| | | @ApiModelProperty(value = "供应商id") |
| | | @TableField("supplier_id") |
| | | private String supplierId; |
| | | |
| | | @ApiModelProperty(value = "盘点id") |
| | | @TableField("inventory_id") |
| | | private String inventoryId; |
| | | } |
| | |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | |
| | | private LocalDateTime expiryDate; |
| | | |
| | | |
| | | @ApiModelProperty(value = "商品id") |
| | | @TableField("goods_id") |
| | | private String goodsId; |
| | | |
| | | @ApiModelProperty(value = "商品名称") |
| | | @TableField("goods_name") |
| | | private String goodsName; |
| | | |
| | | @ApiModelProperty(value = "国药准字号") |
| | | @TableField("quasi_number") |
| | | private String quasiNumber; |
| | | |
| | | @ApiModelProperty(value = "单价") |
| | | @TableField("unit_amount") |
| | | private BigDecimal unitAmount; |
| | | |
| | | @ApiModelProperty(value = "所需数量(采购数量)") |
| | | @TableField("purchase_count") |
| | | private Integer purchaseCount; |
| | | |
| | | @ApiModelProperty(value = "售价") |
| | | @TableField("sales_amount") |
| | | private BigDecimal salesAmount; |
| | | |
| | | @ApiModelProperty(value = "单位") |
| | | @TableField(exist = false) |
| | | private String unitName; |
| | | |
| | | |
| | | } |
| | |
| | | @Excel(name = "*商品名称") |
| | | private String goodsName; |
| | | |
| | | @ApiModelProperty(value = "商品标识码") |
| | | @ApiModelProperty(value = "商品条码") |
| | | @TableField("goods_id_code") |
| | | @Excel(name = "*商品标识码") |
| | | @Excel(name = "*商品条码") |
| | | private String goodsIdCode; |
| | | |
| | | @ApiModelProperty(value = "国药准字号") |
| | |
| | | @TableField("type_id") |
| | | private String typeId; |
| | | |
| | | @ApiModelProperty(value = "商品69码") |
| | | @ApiModelProperty(value = "商品标识码") |
| | | @TableField("goods_yards") |
| | | @Excel(name = "商品69码") |
| | | @Excel(name = "商品标识码") |
| | | private String goodsYards; |
| | | |
| | | @Excel(name = "保养周期(天)") |
| | |
| | | private String storage; |
| | | |
| | | |
| | | @ApiModelProperty(value = "商品条码") |
| | | private String barcode; |
| | | |
| | | @ApiModelProperty(value = "诊所添加供应商") |
| | | @TableField("supplier_name") |
| | | private String supplierName; |
| | | |
| | | |
| | | @ApiModelProperty(value = "诊所id") |
| | | @TableField("clinic_ids") |
| | | private String clinicIds; |
| | | |
| | | |
| | | } |
| | |
| | | @TableField("outbound_reason") |
| | | private String outboundReason; |
| | | |
| | | // @ApiModelProperty(value = "商品id") |
| | | // @TableField("goods_id") |
| | | // private String goodsId; |
| | | |
| | | |
| | | } |
| | |
| | | @ApiModelProperty(value = "入库单号") |
| | | @TableField("warehouse_no") |
| | | private String warehouseNo; |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | @TableField("expiry_date") |
| | | private LocalDateTime expiryDate; |
| | | |
| | | private String goodsId; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.system.query; |
| | | |
| | | import com.ruoyi.common.core.domain.BasePage; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @ApiModel(value = "erp诊所入库商品查询参数query") |
| | | public class TClinicGoodsWarehouseQuery extends BasePage { |
| | | |
| | | @ApiModelProperty(value = "商品名称") |
| | | private String goodsName; |
| | | |
| | | @ApiModelProperty(value = "条码") |
| | | private String goodsIdCode; |
| | | |
| | | |
| | | @ApiModelProperty(value = "国药准字号") |
| | | private String quasiNumber; |
| | | |
| | | @ApiModelProperty(value = "商品类型id ") |
| | | private String typeId; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.system.query; |
| | | |
| | | import com.ruoyi.common.core.domain.BasePage; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @ApiModel(value = "erp诊所出库查询参数query") |
| | | public class TClinicOutboundQuery extends BasePage { |
| | | |
| | | @ApiModelProperty(value = "出库单号") |
| | | private String outboundNumber; |
| | | |
| | | @ApiModelProperty(value = "操作人") |
| | | private String userName; |
| | | |
| | | @ApiModelProperty(value = "出库时间 2020-02-02 - 2029-02-02") |
| | | private String time; |
| | | |
| | | @ApiModelProperty(value = " 1=报损 2=到期 3=失效 4=召回 5=其他 6=盘点出库 7=购买出库") |
| | | private Integer type; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.system.query; |
| | | |
| | | import com.ruoyi.common.core.domain.BasePage; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @ApiModel(value = "erp诊所入库查询参数query") |
| | | public class TClinicWarehouseQuery extends BasePage { |
| | | |
| | | @ApiModelProperty(value = "入库单号") |
| | | private String warehouseNo; |
| | | |
| | | @ApiModelProperty(value = "供应商") |
| | | private String supplierName; |
| | | |
| | | @ApiModelProperty(value = "入库时间 2020-02-02 - 2029-02-02") |
| | | private String time; |
| | | |
| | | @ApiModelProperty(value = "1采购入库 2盘点入库 ") |
| | | private Integer type; |
| | | |
| | | |
| | | } |
| | |
| | | private String batchNumber; |
| | | |
| | | @ApiModelProperty(value = "仓库id") |
| | | @NotBlank(message = "仓库id不能为空") |
| | | // @NotBlank(message = "仓库id不能为空") |
| | | private String warehouseId; |
| | | |
| | | @ApiModelProperty(value = "有效期预警 出库使用 条件1 其他不传") |
| | |
| | | @ApiModelProperty(value = "商品名称") |
| | | private String goodsName; |
| | | |
| | | @ApiModelProperty(value = "商品标识码") |
| | | @ApiModelProperty(value = "商品条码") |
| | | private String goodsIdCode; |
| | | |
| | | @ApiModelProperty(value = "商品类型id") |
| | |
| | | package com.ruoyi.system.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | 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.clinicWarehouseGoodsDto; |
| | | import com.ruoyi.system.model.TErpClinicWarehousing; |
| | | import com.ruoyi.system.model.TErpGoods; |
| | | import com.ruoyi.system.query.*; |
| | | import com.ruoyi.system.vo.*; |
| | | |
| | | import javax.validation.Valid; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | */ |
| | | public interface TErpClinicWarehousingService extends IService<TErpClinicWarehousing> { |
| | | |
| | | PageInfo<PageInventoryListVo> pageInventoryList(TErpInventoryQuery query, SysUser user); |
| | | |
| | | List<InventoryDetailVo> detailInventory(String id, SysUser user); |
| | | |
| | | PageInfo<ValidityPeriodWarningVo> validityPeriodWarning(ValidityPeriodWarningQuery query, SysUser user); |
| | | |
| | | PageInfo<TErpGoodsVO> pageList(TErpGoodsQuery query, SysUser user); |
| | | |
| | | PageInfo<TErpClinicWarehousePageListVO> warehousePageList(TClinicWarehouseQuery query, SysUser user, String supplierClinicId); |
| | | |
| | | |
| | | PageInfo<TErpClinicOutboundPageListVO> outboundPageList(TClinicOutboundQuery query, SysUser user, String supplierClinicId); |
| | | |
| | | |
| | | void warehouseGoods(@Valid List<clinicWarehouseGoodsDto> dtos, SysUser user, String supplierClinicId); |
| | | |
| | | void outboundGoods(@Valid ClinicOutboundGoodsDto dto, SysUser user, String supplierClinicId); |
| | | |
| | | |
| | | } |
| | |
| | | package com.ruoyi.system.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import com.ruoyi.system.dto.InventoryDto; |
| | | import com.ruoyi.system.dto.InventoryGoodsDto; |
| | | import com.ruoyi.system.model.TErpGoods; |
| | | import com.ruoyi.system.query.TClinicGoodsWarehouseQuery; |
| | | import com.ruoyi.system.query.TErpGoodsInventoryQuery; |
| | | import com.ruoyi.system.query.TErpGoodsQuery; |
| | | import com.ruoyi.system.vo.OutboundGoodsDetailVo; |
| | | import com.ruoyi.system.vo.TErpGoodsInventoryVO; |
| | | import com.ruoyi.system.vo.TErpGoodsVO; |
| | | import com.ruoyi.system.vo.WarehouseGoodsDetailVo; |
| | | |
| | | import javax.validation.Valid; |
| | | import javax.validation.constraints.NotBlank; |
| | |
| | | */ |
| | | List<TErpGoodsVO> listExport(TErpGoodsQuery query, SysUser user); |
| | | |
| | | boolean isExit(String goodsIdCode,String quasiNumber); |
| | | boolean isExit(String goodsIdCode,String quasiNumber,String id); |
| | | |
| | | |
| | | PageInfo<TErpGoodsInventoryVO> pageInventoryGoodsPageList(@Valid TErpGoodsInventoryQuery query, SysUser user); |
| | |
| | | List<TErpGoodsInventoryVO> pageInventoryGoodsList(@Valid String warehouseId, SysUser user); |
| | | |
| | | |
| | | PageInfo<TErpGoodsInventoryVO> pageInventoryGoodsPageList1(@Valid TErpGoodsInventoryQuery query, SysUser user); |
| | | |
| | | void inventoryGoods1(@Valid InventoryDto dto, SysUser user); |
| | | |
| | | List<TErpGoodsInventoryVO> pageInventoryGoodsList1(String warehouseId, SysUser user); |
| | | |
| | | |
| | | Page<TErpGoods> warehouseGoodsPageList(TClinicGoodsWarehouseQuery query, SysUser user, String supplierClinicId); |
| | | |
| | | |
| | | WarehouseGoodsDetailVo warehouseGoodsDetail(String id); |
| | | |
| | | |
| | | OutboundGoodsDetailVo outboundGoodsDetail(String id); |
| | | |
| | | |
| | | } |
| | |
| | | import com.ruoyi.system.model.TErpProcurement; |
| | | import com.ruoyi.system.query.TErpGoodsQuery; |
| | | import com.ruoyi.system.query.TErpProcurementQuery; |
| | | import com.ruoyi.system.vo.DetailProcurementVO; |
| | | import com.ruoyi.system.vo.TErpGoodsVO; |
| | | import com.ruoyi.system.vo.TErpProcurementDetailVo; |
| | | import com.ruoyi.system.vo.TErpProcurementVo; |
| | |
| | | List<TErpGoodsVO> inventoryNotEnoughList(SysUser user); |
| | | |
| | | |
| | | String addProcurement(String clinicSupplierId, SysUser user, @Valid List<AddProcurementDto> dtos); |
| | | void addProcurement(String clinicSupplierId, SysUser user, @Valid List<AddProcurementDto> dtos); |
| | | |
| | | DetailProcurementVO detailProcurement(String clinicSupplierId, SysUser user, String id); |
| | | } |
| | |
| | | package com.ruoyi.system.service.impl; |
| | | |
| | | import com.ruoyi.system.model.TErpClinicWarehousing; |
| | | import com.ruoyi.system.mapper.TErpClinicWarehousingMapper; |
| | | 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.entity.SysUser; |
| | | import com.ruoyi.common.utils.DateUtils; |
| | | import com.ruoyi.system.dto.ClinicOutboundGoodsDto; |
| | | import com.ruoyi.system.dto.OutboundGoodsNextDto; |
| | | import com.ruoyi.system.dto.clinicWarehouseGoodsDto; |
| | | import com.ruoyi.system.mapper.*; |
| | | import com.ruoyi.system.model.*; |
| | | import com.ruoyi.system.query.*; |
| | | import com.ruoyi.system.service.TErpClinicWarehousingService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.system.vo.*; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | import java.util.ArrayList; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @Service |
| | | public class TErpClinicWarehousingServiceImpl extends ServiceImpl<TErpClinicWarehousingMapper, TErpClinicWarehousing> implements TErpClinicWarehousingService { |
| | | |
| | | |
| | | @Resource |
| | | private TCrmClinicMapper crmClinicMapper; |
| | | |
| | | @Resource |
| | | private TErpClinicInventoryGoodsMapper erpClinicInventoryGoodsMapper; |
| | | |
| | | @Resource |
| | | private TErpGoodsMapper erpGoodsMapper; |
| | | |
| | | @Resource |
| | | private TErpClinicWarehousingMapper erpClinicWarehousingMapper; |
| | | |
| | | @Resource |
| | | private TErpClinicWarehousingBatchMapper erpClinicWarehousingBatchMapper; |
| | | |
| | | @Resource |
| | | private TErpClinicOutboundGoodsMapper erpClinicOutboundGoodsMapper; |
| | | |
| | | |
| | | @Resource |
| | | private TErpClinicOutboundMapper erpClinicOutboundMapper; |
| | | |
| | | @Resource |
| | | private TErpGoodsUnitMapper erpGoodsUnitMapper; |
| | | |
| | | |
| | | @Resource |
| | | private TErpGoodsTypeMapper erpGoodsTypeMapper; |
| | | |
| | | |
| | | |
| | | @Override |
| | | public PageInfo<PageInventoryListVo> pageInventoryList(TErpInventoryQuery query, SysUser user) { |
| | | Integer roleType = user.getRoleType(); |
| | | String supplierClinicId = null; |
| | | 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()){ |
| | | String[] split = query.getTime().split(" - "); |
| | | sTime = split[0] + " 00:00:00"; |
| | | 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,supplierClinicId); |
| | | if(list.isEmpty()){ |
| | | return pageInfo; |
| | | } |
| | | |
| | | |
| | | |
| | | 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) { |
| | | // 盘盈 |
| | | BigDecimal add = BigDecimal.ZERO; |
| | | |
| | | // 盘亏 |
| | | BigDecimal subtract = BigDecimal.ZERO; |
| | | List<TErpClinicInventoryGoods> tErpSupplierInventoryGoodsList = tErpSupplierInventoryGoods.stream().filter(t -> t.getInventoryId().equals(pageInventoryListVo.getId())).collect(Collectors.toList()); |
| | | for (TErpClinicInventoryGoods tErpSupplierInventoryGoods1 : tErpSupplierInventoryGoodsList) { |
| | | |
| | | |
| | | if(tErpSupplierInventoryGoods1!=null){ |
| | | // 盘盈 查入库 |
| | | if(tErpSupplierInventoryGoods1.getInventoryType()==1){ |
| | | TErpClinicWarehousing tErpSupplierWarehousing = erpClinicWarehousingMapper.selectById(tErpSupplierInventoryGoods1.getWarehousingId()); |
| | | // List<TErpSupplierWarehousingBatch> tErpSupplierWarehousingBatches = erpSupplierWarehousingBatchMapper.selectList(new LambdaQueryWrapper<TErpSupplierWarehousingBatch>().eq(TErpSupplierWarehousingBatch::getWarehousingId, tErpSupplierWarehousing.getId())); |
| | | // int sum = tErpSupplierWarehousingBatches.stream().mapToInt(TErpSupplierWarehousingBatch::getWarehousingNumber).sum(); |
| | | String goodsId = tErpSupplierInventoryGoods1.getGoodsId(); |
| | | TErpGoods goods = erpGoodsMapper.selectById(goodsId); |
| | | int count = tErpSupplierInventoryGoods1.getInventoryCount() - tErpSupplierInventoryGoods1.getDamagedCount(); |
| | | BigDecimal multiply = goods.getSalesAmount().multiply(new BigDecimal(count)); |
| | | add = add.add(multiply); |
| | | }else { |
| | | // 盘亏 查出库 |
| | | TErpClinicOutbound tErpSupplierOutbound = erpClinicOutboundMapper.selectById(tErpSupplierInventoryGoods1.getWarehousingId()); |
| | | |
| | | List<TErpClinicOutboundGoods> tErpSupplierOutboundGoods = erpClinicOutboundGoodsMapper.selectList(new LambdaQueryWrapper<TErpClinicOutboundGoods>().eq(TErpClinicOutboundGoods::getOutboundId, tErpSupplierOutbound.getId())); |
| | | for (TErpClinicOutboundGoods tErpSupplierOutboundGood : tErpSupplierOutboundGoods) { |
| | | TErpClinicWarehousing tErpSupplierWarehousing = erpClinicWarehousingMapper.selectById(tErpSupplierOutboundGood.getWarehousingId()); |
| | | String goodsId = tErpSupplierInventoryGoods1.getGoodsId(); |
| | | TErpGoods goods = erpGoodsMapper.selectById(goodsId); |
| | | int count = tErpSupplierInventoryGoods1.getInventoryCount() - tErpSupplierInventoryGoods1.getDamagedCount(); |
| | | BigDecimal multiply = goods.getSalesAmount().multiply(new BigDecimal(count)); |
| | | add = add.add(multiply); |
| | | } |
| | | // int sum = tErpSupplierOutboundGoods.stream().mapToInt(TErpSupplierOutboundGoods::getOutboundCount).sum(); |
| | | // String goodsId = tErpSupplierOutbound.getGoodsId(); |
| | | // TErpGoods goods = erpGoodsMapper.selectById(goodsId); |
| | | // BigDecimal multiply = goods.getSalesAmount().multiply(new BigDecimal(sum)); |
| | | // subtract = subtract.add(multiply); |
| | | } |
| | | } |
| | | } |
| | | int size = tErpSupplierInventoryGoodsList.stream().map(TErpClinicInventoryGoods::getGoodsId).collect(Collectors.toSet()).size(); |
| | | pageInventoryListVo.setNum(size); |
| | | pageInventoryListVo.setTotalPrice(add); |
| | | |
| | | } |
| | | |
| | | pageInfo.setRecords(list); |
| | | return pageInfo; |
| | | } |
| | | |
| | | @Override |
| | | public List<InventoryDetailVo> detailInventory(String id, SysUser user) { |
| | | ArrayList<InventoryDetailVo> inventoryDetailVos = new ArrayList<>(); |
| | | |
| | | List<TErpClinicInventoryGoods> tErpSupplierInventoryGoods = erpClinicInventoryGoodsMapper.selectList(new LambdaQueryWrapper<TErpClinicInventoryGoods>().eq(TErpClinicInventoryGoods::getInventoryId, id)); |
| | | if(tErpSupplierInventoryGoods!=null && !tErpSupplierInventoryGoods.isEmpty()){ |
| | | for (TErpClinicInventoryGoods tErpSupplierInventoryGood : tErpSupplierInventoryGoods) { |
| | | InventoryDetailVo inventoryDetailVo = new InventoryDetailVo(); |
| | | if(tErpSupplierInventoryGood.getInventoryType()==1){ |
| | | TErpClinicWarehousing tErpSupplierWarehousing = erpClinicWarehousingMapper.selectById(tErpSupplierInventoryGood.getWarehousingId()); |
| | | String goodsId = tErpSupplierInventoryGood.getGoodsId(); |
| | | TErpGoods goods = erpGoodsMapper.selectById(goodsId); |
| | | inventoryDetailVo.setGoodsName(goods.getGoodsName()); |
| | | TErpGoodsUnit tErpGoodsUnit = erpGoodsUnitMapper.selectById(goods.getPackingUnitId()); |
| | | inventoryDetailVo.setUnitName(tErpGoodsUnit.getUnitName()); |
| | | inventoryDetailVo.setWarehouseNo(tErpSupplierWarehousing.getWarehouseNo()); |
| | | TErpClinicWarehousingBatch tErpSupplierWarehousingBatch = erpClinicWarehousingBatchMapper.selectById(tErpSupplierInventoryGood.getWarehousingBatchId()); |
| | | inventoryDetailVo.setBatchNumber(tErpSupplierWarehousingBatch.getBatchNumber()); |
| | | |
| | | List<TErpClinicWarehousingBatch> tErpSupplierWarehousingBatches = erpClinicWarehousingBatchMapper.selectList(new LambdaQueryWrapper<TErpClinicWarehousingBatch>().eq(TErpClinicWarehousingBatch::getBatchNumber, tErpSupplierWarehousingBatch.getBatchNumber())); |
| | | int sum = tErpSupplierWarehousingBatches.stream().mapToInt(TErpClinicWarehousingBatch::getWarehousingNumber).sum(); |
| | | List<String> collect = tErpSupplierWarehousingBatches.stream().map(TErpClinicWarehousingBatch::getId).collect(Collectors.toList()); |
| | | if(!collect.isEmpty()){ |
| | | List<TErpClinicOutboundGoods> tErpSupplierOutboundGoods = erpClinicOutboundGoodsMapper.selectList(new LambdaQueryWrapper<TErpClinicOutboundGoods>().eq(TErpClinicOutboundGoods::getWarehousingBatchId, collect)); |
| | | int sum1 = tErpSupplierOutboundGoods.stream().mapToInt(TErpClinicOutboundGoods::getOutboundCount).sum(); |
| | | sum = sum-sum1; |
| | | } |
| | | |
| | | // sum = 剩余库存 |
| | | inventoryDetailVo.setNowCount(sum); |
| | | inventoryDetailVo.setInventoryCount(tErpSupplierInventoryGood.getInventoryCount()); |
| | | inventoryDetailVo.setInventoryType(tErpSupplierInventoryGood.getInventoryType()); |
| | | inventoryDetailVo.setDamagedCount(tErpSupplierInventoryGood.getDamagedCount()); |
| | | } |
| | | inventoryDetailVos.add(inventoryDetailVo); |
| | | |
| | | } |
| | | |
| | | return inventoryDetailVos; |
| | | |
| | | } |
| | | |
| | | |
| | | return Collections.emptyList(); |
| | | } |
| | | |
| | | |
| | | |
| | | @Override |
| | | public PageInfo<ValidityPeriodWarningVo> validityPeriodWarning(ValidityPeriodWarningQuery query, SysUser user) { |
| | | Integer roleType = user.getRoleType(); |
| | | String supplierClinicId = null; |
| | | 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,supplierClinicId); |
| | | } |
| | | |
| | | @Override |
| | | public PageInfo<TErpGoodsVO> pageList(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())); |
| | | tErpGoodsVO.setTypeName(tErpGoodsVO.getTypeName()); |
| | | } |
| | | } |
| | | pageInfo.setRecords(list); |
| | | return pageInfo; |
| | | } |
| | | |
| | | @Override |
| | | public PageInfo<TErpClinicWarehousePageListVO> warehousePageList(TClinicWarehouseQuery query, SysUser user, String supplierClinicId) { |
| | | String time = query.getTime(); |
| | | String sTime =null; |
| | | String eTime = null; |
| | | if(time!=null && !time.isEmpty()){ |
| | | String[] split = time.split(" - "); |
| | | sTime = split[0] + " 00:00:00"; |
| | | eTime = split[1] + " 23:59:59"; |
| | | } |
| | | PageInfo<TErpClinicWarehousePageListVO> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize()); |
| | | List<TErpClinicWarehousePageListVO> list = this.baseMapper.warehousePageList(query,pageInfo,user,supplierClinicId,sTime,eTime); |
| | | if(list.isEmpty()){ |
| | | return pageInfo; |
| | | } |
| | | List<String> collect = list.stream().map(TErpClinicWarehousePageListVO::getId).collect(Collectors.toList()); |
| | | List<TErpClinicWarehousingBatch> tErpClinicWarehousingBatches = erpClinicWarehousingBatchMapper.selectList(new LambdaQueryWrapper<TErpClinicWarehousingBatch>().in(TErpClinicWarehousingBatch::getWarehousingId, collect)); |
| | | |
| | | for (TErpClinicWarehousePageListVO tErpClinicWarehousePageListVO : list) { |
| | | int size = tErpClinicWarehousingBatches.stream().filter(e -> e.getWarehousingId().equals(tErpClinicWarehousePageListVO.getId())).map(TErpClinicWarehousingBatch::getGoodsId).collect(Collectors.toSet()).size(); |
| | | tErpClinicWarehousePageListVO.setTypeNum(size); |
| | | } |
| | | pageInfo.setRecords(list); |
| | | return pageInfo; |
| | | } |
| | | |
| | | @Override |
| | | public PageInfo<TErpClinicOutboundPageListVO> outboundPageList(TClinicOutboundQuery query, SysUser user, String supplierClinicId) { |
| | | String time = query.getTime(); |
| | | String sTime =null; |
| | | String eTime = null; |
| | | if(time!=null && !time.isEmpty()){ |
| | | String[] split = time.split(" - "); |
| | | sTime = split[0] + " 00:00:00"; |
| | | eTime = split[1] + " 23:59:59"; |
| | | } |
| | | PageInfo<TErpClinicOutboundPageListVO> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize()); |
| | | List<TErpClinicOutboundPageListVO> list = this.baseMapper.outboundPageList(query,pageInfo,user,supplierClinicId,sTime,eTime); |
| | | pageInfo.setRecords(list); |
| | | return pageInfo; |
| | | } |
| | | |
| | | @Override |
| | | public void warehouseGoods(List<clinicWarehouseGoodsDto> dtos, SysUser user, String supplierClinicId) { |
| | | |
| | | // dtos根据供应商分组 |
| | | 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(); |
| | | 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); |
| | | this.save(tErpClinicWarehousing); |
| | | |
| | | BigDecimal totalPrice = new BigDecimal(0); |
| | | for (clinicWarehouseGoodsDto dto : value) { |
| | | 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.setGoodsId(dto.getId()); |
| | | TErpGoods goods = erpGoodsMapper.selectById(dto.getId()); |
| | | tErpClinicWarehousingBatch.setGoodsName(goods.getGoodsName()); |
| | | tErpClinicWarehousingBatch.setQuasiNumber(goods.getQuasiNumber()); |
| | | tErpClinicWarehousingBatch.setUnitAmount(dto.getUnitAmount()); |
| | | tErpClinicWarehousingBatch.setSalesAmount(dto.getSalesAmount()); |
| | | if(dto.getSalesAmount()==null){ |
| | | tErpClinicWarehousingBatch.setSalesAmount(goods.getClinicPurchasePrice()); |
| | | } |
| | | tErpClinicWarehousingBatch.setPurchaseCount(dto.getPurchaseCount()); |
| | | erpClinicWarehousingBatchMapper.insert(tErpClinicWarehousingBatch); |
| | | |
| | | totalPrice = totalPrice.add(dto.getSalesAmount().multiply(new BigDecimal(dto.getPurchaseCount()))); |
| | | } |
| | | tErpClinicWarehousing.setTotalPrice(totalPrice); |
| | | this.updateById(tErpClinicWarehousing); |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void outboundGoods(ClinicOutboundGoodsDto dto, SysUser user, String supplierClinicId) { |
| | | TErpClinicOutbound tErpClinicOutbound = new TErpClinicOutbound(); |
| | | tErpClinicOutbound.setClinicId(supplierClinicId); |
| | | tErpClinicOutbound.setCreateId(user.getUserId().toString()); |
| | | tErpClinicOutbound.setOutboundNumber("G"+ DateUtils.dateTimeNow()); |
| | | tErpClinicOutbound.setCreateTime(LocalDateTime.now()); |
| | | tErpClinicOutbound.setOutboundType(dto.getOutboundType()); |
| | | tErpClinicOutbound.setTotalMoney(dto.getTotalPrice()); |
| | | tErpClinicOutbound.setOutboundReason(dto.getOutboundReason()); |
| | | tErpClinicOutbound.setTypeNum(dto.getTypeNum()); |
| | | erpClinicOutboundMapper.insert(tErpClinicOutbound); |
| | | |
| | | List<TErpClinicOutboundGoods> tErpClinicOutboundGoods = new ArrayList<>(); |
| | | for (OutboundGoodsNextDto outboundGoodsNextDto : dto.getOutboundGoodsNextDtos()) { |
| | | TErpClinicOutboundGoods tErpClinicOutboundGoods1 = new TErpClinicOutboundGoods(); |
| | | tErpClinicOutboundGoods1.setOutboundId(tErpClinicOutbound.getId()); |
| | | String batchId = outboundGoodsNextDto.getBatchId(); |
| | | TErpClinicWarehousingBatch tErpClinicWarehousingBatch = erpClinicWarehousingBatchMapper.selectById(batchId); |
| | | tErpClinicOutboundGoods1.setWarehousingId(tErpClinicWarehousingBatch.getWarehousingId()); |
| | | tErpClinicOutboundGoods1.setWarehousingBatchId(batchId); |
| | | tErpClinicOutboundGoods1.setOutboundCount(outboundGoodsNextDto.getNum()); |
| | | tErpClinicOutboundGoods1.setTotalPrice(tErpClinicWarehousingBatch.getUnitAmount().multiply(BigDecimal.valueOf(outboundGoodsNextDto.getNum()))); |
| | | tErpClinicOutboundGoods1.setGoodsId(tErpClinicWarehousingBatch.getGoodsId()); |
| | | tErpClinicOutboundGoods.add(tErpClinicOutboundGoods1); |
| | | erpClinicOutboundGoodsMapper.insert(tErpClinicOutboundGoods1); |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | 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.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.common.core.domain.BaseModel; |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import com.ruoyi.common.utils.DateUtils; |
| | | import com.ruoyi.common.utils.uuid.IdUtils; |
| | |
| | | import com.ruoyi.system.dto.InventoryGoodsDto; |
| | | import com.ruoyi.system.mapper.*; |
| | | import com.ruoyi.system.model.*; |
| | | import com.ruoyi.system.query.TClinicGoodsWarehouseQuery; |
| | | import com.ruoyi.system.query.TErpGoodsInventoryQuery; |
| | | import com.ruoyi.system.query.TErpGoodsQuery; |
| | | import com.ruoyi.system.service.TErpGoodsService; |
| | | import com.ruoyi.system.service.TErpSupplierInventoryGoodsService; |
| | | import com.ruoyi.system.vo.TErpGoodsInventoryVO; |
| | | import com.ruoyi.system.vo.TErpGoodsVO; |
| | | import com.ruoyi.system.vo.*; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | import java.util.ArrayList; |
| | | import java.util.Collections; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | |
| | | private TErpGoodsTypeMapper erpGoodsTypeMapper; |
| | | |
| | | @Resource |
| | | private TErpGoodsMapper erpGoodsMapper; |
| | | |
| | | @Resource |
| | | private TErpGoodsUnitMapper erpGoodsUnitMapper; |
| | | |
| | | @Resource |
| | | private TErpSupplierInventoryMapper erpSupplierInventoryMapper; |
| | | @Resource |
| | | private TErpClinicInventoryMapper erpClinicInventoryMapper; |
| | | |
| | | @Resource |
| | | private TErpSupplierInventoryGoodsMapper erpSupplierInventoryGoodsMapper; |
| | | @Resource |
| | | private TErpClinicInventoryGoodsMapper erpClinicInventoryGoodsMapper; |
| | | |
| | | @Resource |
| | | private TErpSupplierWarehousingMapper erpSupplierWarehousingMapper; |
| | | @Resource |
| | | private TErpClinicWarehousingMapper erpClinicWarehousingMapper; |
| | | |
| | | @Resource |
| | | private TErpSupplierWarehousingBatchMapper erpSupplierWarehousingBatchMapper; |
| | | @Resource |
| | | private TErpClinicWarehousingBatchMapper erpClinicWarehousingBatchMapper; |
| | | |
| | | @Resource |
| | | private TErpSupplierOutboundMapper erpSupplierOutboundMapper; |
| | | @Resource |
| | | private TErpClinicOutboundMapper erpClinicOutboundMapper; |
| | | |
| | | @Resource |
| | | private TErpSupplierOutboundGoodsMapper erpSupplierOutboundGoodsMapper; |
| | | @Resource |
| | | private TErpClinicOutboundGoodsMapper erpClinicOutboundGoodsMapper; |
| | | |
| | | @Resource |
| | | private TCrmClinicMapper crmClinicMapper; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public boolean isExit(String goodsIdCode, String quasiNumber) { |
| | | Long size = this.baseMapper.selectCount(new LambdaQueryWrapper<>(TErpGoods.class).eq(TErpGoods::getGoodsIdCode, goodsIdCode).or().eq(TErpGoods::getQuasiNumber, quasiNumber)); |
| | | 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)); |
| | | if (size > 0) { |
| | | return true; |
| | | } |
| | | |
| | | return false; |
| | | } |
| | | |
| | |
| | | |
| | | PageInfo<TErpGoodsInventoryVO> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize()); |
| | | List<TErpGoodsInventoryVO> list = this.baseMapper.pageInventoryGoodsPageList(query, pageInfo, user,supplierClinicId,endDate); |
| | | if (list.isEmpty()) { |
| | | return pageInfo; |
| | | } |
| | | List<String> typeIds = list.stream().map(TErpGoodsInventoryVO::getTypeId).collect(Collectors.toList()); |
| | | if (!typeIds.isEmpty()) { |
| | | List<TErpGoodsType> typeList = erpGoodsTypeMapper.selectBatchIds(typeIds); |
| | | for (TErpGoodsInventoryVO tErpGoodsVO : list) { |
| | | typeList.stream().filter(t -> t.getId().equals(tErpGoodsVO.getTypeId())).findFirst().ifPresent(t -> tErpGoodsVO.setTypeName(t.getTypeName())); |
| | | tErpGoodsVO.setTypeName(tErpGoodsVO.getTypeName()); |
| | | } |
| | | } |
| | | List<String> packingUnitId = list.stream().map(TErpGoodsInventoryVO::getPackingUnitId).collect(Collectors.toList()); |
| | | if (!packingUnitId.isEmpty()) { |
| | | List<TErpGoodsUnit> tErpGoodsUnits = erpGoodsUnitMapper.selectBatchIds(packingUnitId); |
| | | for (TErpGoodsInventoryVO tErpGoodsVO : list) { |
| | | tErpGoodsUnits.stream().filter(t -> t.getId().equals(tErpGoodsVO.getPackingUnitId())).findFirst().ifPresent(t -> tErpGoodsVO.setPackingUnitName(t.getUnitName())); |
| | | } |
| | | } |
| | | pageInfo.setRecords(list); |
| | | return pageInfo; |
| | | } |
| | | @Override |
| | | public PageInfo<TErpGoodsInventoryVO> pageInventoryGoodsPageList1(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(); |
| | | } |
| | | |
| | | // 当前时间一个月后 |
| | | Date endDate = DateUtils.addMonths(DateUtils.getNowDate(), 1); |
| | | |
| | | PageInfo<TErpGoodsInventoryVO> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize()); |
| | | List<TErpGoodsInventoryVO> list = this.baseMapper.pageInventoryGoodsPageList1(query, pageInfo, user,supplierClinicId,endDate); |
| | | if (list.isEmpty()) { |
| | | return pageInfo; |
| | | } |
| | |
| | | } |
| | | } |
| | | return list; |
| | | } |
| | | @Override |
| | | public List<TErpGoodsInventoryVO> pageInventoryGoodsList1(String warehouseId, SysUser user) { |
| | | Integer roleType = user.getRoleType(); |
| | | String supplierClinicId = null; |
| | | if(roleType == 4){ |
| | | // 供应商 |
| | | TCrmSupplier crmSupplier = crmSupplierMapper.selectOne(Wrappers.lambdaQuery(TCrmSupplier.class) |
| | | .eq(TCrmSupplier::getUserId, user.getUserId()) |
| | | .last("LIMIT 1")); |
| | | supplierClinicId =crmSupplier.getId(); |
| | | } |
| | | if(roleType == 5){ |
| | | // 诊所 |
| | | TCrmClinic crmClinic = crmClinicMapper.selectOne(Wrappers.lambdaQuery(TCrmClinic.class) |
| | | .eq(TCrmClinic::getUserId, user.getUserId()) |
| | | .last("LIMIT 1")); |
| | | supplierClinicId =crmClinic.getId(); |
| | | } |
| | | |
| | | // 当前时间一个月后 |
| | | Date endDate = DateUtils.addMonths(DateUtils.getNowDate(), 1); |
| | | |
| | | List<TErpGoodsInventoryVO> list = this.baseMapper.pageInventoryGoodsList1(warehouseId, user,supplierClinicId,endDate); |
| | | if (list.isEmpty()) { |
| | | return list; |
| | | } |
| | | List<String> typeIds = list.stream().map(TErpGoodsInventoryVO::getTypeId).collect(Collectors.toList()); |
| | | if (!typeIds.isEmpty()) { |
| | | List<TErpGoodsType> typeList = erpGoodsTypeMapper.selectBatchIds(typeIds); |
| | | for (TErpGoodsInventoryVO tErpGoodsVO : list) { |
| | | typeList.stream().filter(t -> t.getId().equals(tErpGoodsVO.getTypeId())).findFirst().ifPresent(t -> tErpGoodsVO.setTypeName(t.getTypeName())); |
| | | tErpGoodsVO.setTypeName(tErpGoodsVO.getTypeName()); |
| | | } |
| | | } |
| | | List<String> packingUnitId = list.stream().map(TErpGoodsInventoryVO::getPackingUnitId).collect(Collectors.toList()); |
| | | if (!packingUnitId.isEmpty()) { |
| | | List<TErpGoodsUnit> tErpGoodsUnits = erpGoodsUnitMapper.selectBatchIds(packingUnitId); |
| | | for (TErpGoodsInventoryVO tErpGoodsVO : list) { |
| | | tErpGoodsUnits.stream().filter(t -> t.getId().equals(tErpGoodsVO.getPackingUnitId())).findFirst().ifPresent(t -> tErpGoodsVO.setPackingUnitName(t.getUnitName())); |
| | | } |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | @Override |
| | | public Page<TErpGoods> warehouseGoodsPageList(TClinicGoodsWarehouseQuery query, SysUser user, String supplierClinicId) { |
| | | LambdaQueryWrapper<TErpGoods> wrapper = new LambdaQueryWrapper<>(); |
| | | wrapper.eq(BaseModel::getDisabled,0); |
| | | wrapper.eq(TErpGoods::getSupplierClinicId,supplierClinicId).eq(TErpGoods::getGoodsSource,2); |
| | | if(query.getGoodsName()!=null && !query.getGoodsName().isEmpty()){ |
| | | wrapper.like(TErpGoods::getGoodsName,query.getGoodsName()); |
| | | } |
| | | if(query.getGoodsIdCode()!=null && !query.getGoodsIdCode().isEmpty()){ |
| | | wrapper.eq(TErpGoods::getGoodsIdCode,query.getGoodsIdCode()); |
| | | } |
| | | if(query.getQuasiNumber()!=null && !query.getQuasiNumber().isEmpty()){ |
| | | wrapper.eq(TErpGoods::getQuasiNumber,query.getQuasiNumber()); |
| | | } |
| | | if(query.getTypeId()!=null && !query.getTypeId().isEmpty()){ |
| | | wrapper.eq(TErpGoods::getTypeId,query.getTypeId()); |
| | | } |
| | | wrapper.orderByDesc(BaseModel::getCreateTime); |
| | | Page<TErpGoods> page = this.page(new Page<>(query.getPageNum(), query.getPageSize()), wrapper); |
| | | return page; |
| | | } |
| | | |
| | | @Override |
| | | public WarehouseGoodsDetailVo warehouseGoodsDetail(String id) { |
| | | WarehouseGoodsDetailVo warehouseGoodsDetailVo = new WarehouseGoodsDetailVo(); |
| | | TErpClinicWarehousing tErpClinicWarehousing = erpClinicWarehousingMapper.selectById(id); |
| | | warehouseGoodsDetailVo.setCreateTime(tErpClinicWarehousing.getCreateTime()); |
| | | warehouseGoodsDetailVo.setCreateBy(tErpClinicWarehousing.getCreateBy()); |
| | | if(tErpClinicWarehousing.getType()==1){ |
| | | TErpClinicInventory tErpClinicInventory = erpClinicInventoryMapper.selectById(tErpClinicWarehousing.getInventoryId()); |
| | | warehouseGoodsDetailVo.setInventoryNumber(tErpClinicInventory.getInventoryNumber()); |
| | | } |
| | | |
| | | List<TErpClinicWarehousingBatch> tErpClinicWarehousingBatches = erpClinicWarehousingBatchMapper.selectList(new LambdaQueryWrapper<TErpClinicWarehousingBatch>().eq(TErpClinicWarehousingBatch::getWarehousingId, id)); |
| | | for (TErpClinicWarehousingBatch tErpClinicWarehousingBatch : tErpClinicWarehousingBatches) { |
| | | String goodsId = tErpClinicWarehousingBatch.getGoodsId(); |
| | | TErpGoods tErpGoods = erpGoodsMapper.selectById(goodsId); |
| | | String packingUnitId = tErpGoods.getPackingUnitId(); |
| | | TErpGoodsUnit tErpGoodsUnit = erpGoodsUnitMapper.selectById(packingUnitId); |
| | | tErpClinicWarehousingBatch.setUnitName(tErpGoodsUnit.getUnitName()); |
| | | |
| | | } |
| | | |
| | | warehouseGoodsDetailVo.setList(tErpClinicWarehousingBatches); |
| | | return warehouseGoodsDetailVo; |
| | | } |
| | | |
| | | @Override |
| | | public OutboundGoodsDetailVo outboundGoodsDetail(String id) { |
| | | OutboundGoodsDetailVo outboundGoodsDetailVo = new OutboundGoodsDetailVo(); |
| | | TErpClinicOutbound tErpClinicOutbound = erpClinicOutboundMapper.selectById(id); |
| | | outboundGoodsDetailVo.setCreateTime(tErpClinicOutbound.getCreateTime()); |
| | | outboundGoodsDetailVo.setCreateBy(tErpClinicOutbound.getCreateBy()); |
| | | outboundGoodsDetailVo.setOutboundType(tErpClinicOutbound.getOutboundType()); |
| | | outboundGoodsDetailVo.setOrderNumber(tErpClinicOutbound.getOrderNumber()); |
| | | if(tErpClinicOutbound.getOutboundType()==6){ |
| | | TErpClinicInventory tErpClinicInventory = erpClinicInventoryMapper.selectById(tErpClinicOutbound.getInventoryId()); |
| | | outboundGoodsDetailVo.setInventoryNumber(tErpClinicInventory.getInventoryNumber()); |
| | | } |
| | | ArrayList<OutboundGoodsDetailNextVo> tErpClinicOutboundGoods1 = new ArrayList<>(); |
| | | List<TErpClinicOutboundGoods> tErpClinicOutboundGoods = erpClinicOutboundGoodsMapper.selectList(new LambdaQueryWrapper<TErpClinicOutboundGoods>().eq(TErpClinicOutboundGoods::getOutboundId, id)); |
| | | for (TErpClinicOutboundGoods outboundGoods : tErpClinicOutboundGoods) { |
| | | TErpClinicWarehousing tErpClinicWarehousing = erpClinicWarehousingMapper.selectById(outboundGoods.getWarehousingId()); |
| | | TErpClinicWarehousingBatch tErpClinicWarehousingBatch = erpClinicWarehousingBatchMapper.selectById(outboundGoods.getWarehousingBatchId()); |
| | | |
| | | OutboundGoodsDetailNextVo outboundGoodsDetailNextVo = new OutboundGoodsDetailNextVo(); |
| | | outboundGoodsDetailNextVo.setWarehouseNo(tErpClinicWarehousing.getWarehouseNo()); |
| | | |
| | | outboundGoodsDetailNextVo.setGoodsId(outboundGoods.getGoodsId()); |
| | | TErpGoods goods = erpGoodsMapper.selectById(outboundGoods.getGoodsId()); |
| | | outboundGoodsDetailNextVo.setGoodsName(goods.getGoodsName()); |
| | | |
| | | outboundGoodsDetailNextVo.setTypeId(goods.getTypeId()); |
| | | TErpGoodsType tErpGoodsType = erpGoodsTypeMapper.selectById(goods.getTypeId()); |
| | | outboundGoodsDetailNextVo.setTypeName(tErpGoodsType.getTypeName()); |
| | | outboundGoodsDetailNextVo.setQuasiNumber(goods.getQuasiNumber()); |
| | | outboundGoodsDetailNextVo.setBatchNumber(tErpClinicWarehousingBatch.getBatchNumber()); |
| | | TErpGoodsUnit tErpGoodsUnit = erpGoodsUnitMapper.selectById(goods.getPackingUnitId()); |
| | | outboundGoodsDetailNextVo.setUnitName(tErpGoodsUnit.getUnitName()); |
| | | |
| | | |
| | | List<TErpClinicOutboundGoods> tErpClinicOutboundGoods2 = erpClinicOutboundGoodsMapper.selectList(new LambdaQueryWrapper<TErpClinicOutboundGoods>().eq(TErpClinicOutboundGoods::getWarehousingBatchId, outboundGoods.getWarehousingBatchId())); |
| | | int sum = tErpClinicOutboundGoods2.stream().mapToInt(TErpClinicOutboundGoods::getOutboundCount).sum(); |
| | | |
| | | int count = tErpClinicWarehousingBatch.getPurchaseCount() - sum; |
| | | outboundGoodsDetailNextVo.setSurplusCount(count); |
| | | |
| | | outboundGoodsDetailNextVo.setUnitAmount(tErpClinicWarehousingBatch.getUnitAmount()); |
| | | outboundGoodsDetailNextVo.setOutboundCount(outboundGoods.getOutboundCount()); |
| | | outboundGoodsDetailNextVo.setExpiryDate(tErpClinicWarehousingBatch.getExpiryDate()); |
| | | outboundGoodsDetailNextVo.setTotalAmount(outboundGoodsDetailNextVo.getUnitAmount().multiply(new BigDecimal(outboundGoods.getOutboundCount()))); |
| | | tErpClinicOutboundGoods1.add(outboundGoodsDetailNextVo); |
| | | |
| | | } |
| | | outboundGoodsDetailVo.setList(tErpClinicOutboundGoods1); |
| | | return outboundGoodsDetailVo; |
| | | } |
| | | |
| | | @Override |
| | |
| | | |
| | | |
| | | } |
| | | @Override |
| | | public void inventoryGoods1(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(); |
| | | } |
| | | TErpClinicInventory tErpSupplierInventory = new TErpClinicInventory(); |
| | | String s = DateUtils.dateTimeNow(); |
| | | tErpSupplierInventory.setInventoryNumber("P" + s); |
| | | tErpSupplierInventory.setClinicId(supplierClinicId); |
| | | erpClinicInventoryMapper.insert(tErpSupplierInventory); |
| | | |
| | | List<InventoryGoodsDto> dtos = dto.getDtos(); |
| | | for (InventoryGoodsDto inventoryGoodsDto : dtos) { |
| | | // 根据入库批次id查询入库信息 |
| | | TErpClinicWarehousing tErpSupplierWarehousing = new TErpClinicWarehousing(); |
| | | TErpClinicWarehousingBatch tErpSupplierWarehousingBatch = erpClinicWarehousingBatchMapper.selectById(inventoryGoodsDto.getId()); |
| | | String warehousingId = tErpSupplierWarehousingBatch.getWarehousingId(); |
| | | TErpClinicWarehousing tErpSupplierWarehousing1 = erpClinicWarehousingMapper.selectById(warehousingId); |
| | | TErpGoods erpGoods = this.getById(tErpSupplierWarehousingBatch.getGoodsId()); |
| | | |
| | | // 盘点是盘亏盘盈 赢 |
| | | if (inventoryGoodsDto.getNum() < inventoryGoodsDto.getInventoryCount()) { |
| | | // 添加入库信息 |
| | | tErpSupplierWarehousing.setClinicId(supplierClinicId); |
| | | // tErpSupplierWarehousing.setGoodsId(tErpSupplierWarehousing1.getGoodsId()); |
| | | // tErpSupplierWarehousing.setGoodsName(erpGoods.getGoodsName()); |
| | | // tErpSupplierWarehousing.setPurchaseCount(inventoryGoodsDto.getInventoryCount() - inventoryGoodsDto.getNum()); |
| | | // tErpSupplierWarehousing.setUnitAmount(erpGoods.getSalesAmount()); |
| | | tErpSupplierWarehousing.setTotalPrice(erpGoods.getSalesAmount().multiply(new BigDecimal(inventoryGoodsDto.getInventoryCount() - inventoryGoodsDto.getNum()))); |
| | | // 当前年月日时分秒 |
| | | String time = DateUtils.dateTimeNow(); |
| | | tErpSupplierWarehousing.setWarehouseNo("G" + time); |
| | | tErpSupplierWarehousing.setType(2); |
| | | tErpSupplierWarehousing.setInventoryId(tErpSupplierInventory.getId()); |
| | | erpClinicWarehousingMapper.insert(tErpSupplierWarehousing); |
| | | |
| | | // 添加批次信息 |
| | | TErpClinicWarehousingBatch tErpSupplierWarehousingBatch1 = new TErpClinicWarehousingBatch(); |
| | | tErpSupplierWarehousingBatch1.setWarehousingId(tErpSupplierWarehousing.getId()); |
| | | tErpSupplierWarehousingBatch1.setWarehousingNumber(inventoryGoodsDto.getInventoryCount() - inventoryGoodsDto.getNum()); |
| | | tErpSupplierWarehousingBatch1.setBatchNumber(tErpSupplierWarehousingBatch.getBatchNumber()); |
| | | tErpSupplierWarehousingBatch1.setProductionDate(tErpSupplierWarehousingBatch.getProductionDate()); |
| | | tErpSupplierWarehousingBatch1.setExpiryDate(tErpSupplierWarehousingBatch.getExpiryDate()); |
| | | tErpSupplierWarehousingBatch1.setGoodsId(tErpSupplierWarehousingBatch.getGoodsId()); |
| | | tErpSupplierWarehousingBatch1.setQuasiNumber(tErpSupplierWarehousingBatch.getQuasiNumber()); |
| | | tErpSupplierWarehousingBatch1.setPurchaseCount(tErpSupplierWarehousingBatch.getPurchaseCount()); |
| | | tErpSupplierWarehousingBatch1.setSalesAmount(tErpSupplierWarehousingBatch.getSalesAmount()); |
| | | tErpSupplierWarehousingBatch1.setUnitAmount(tErpSupplierWarehousingBatch.getUnitAmount()); |
| | | erpClinicWarehousingBatchMapper.insert(tErpSupplierWarehousingBatch1); |
| | | |
| | | |
| | | // 添加盘点信息 |
| | | TErpClinicInventoryGoods tErpSupplierInventoryGoods = new TErpClinicInventoryGoods(); |
| | | tErpSupplierInventoryGoods.setInventoryId(tErpSupplierInventory.getId()); |
| | | tErpSupplierInventoryGoods.setWarehousingId(tErpSupplierWarehousing.getId()); |
| | | tErpSupplierInventoryGoods.setWarehousingBatchId(tErpSupplierWarehousingBatch1.getId()); |
| | | tErpSupplierInventoryGoods.setInventoryCount(inventoryGoodsDto.getInventoryCount()); |
| | | tErpSupplierInventoryGoods.setDamagedCount(inventoryGoodsDto.getDamagedCount()); |
| | | tErpSupplierInventoryGoods.setInventoryType(1); |
| | | tErpSupplierInventoryGoods.setGoodsId(tErpSupplierWarehousingBatch.getGoodsId()); |
| | | erpClinicInventoryGoodsMapper.insert(tErpSupplierInventoryGoods); |
| | | |
| | | } else { |
| | | |
| | | |
| | | TErpClinicOutbound tErpSupplierOutbound = new TErpClinicOutbound(); |
| | | // tErpSupplierOutbound.setWarehouseId(dto.getWarehouseId()); |
| | | // tErpSupplierOutbound.setSupplierId(supplierClinicId); |
| | | tErpSupplierOutbound.setOutboundType(6); |
| | | tErpSupplierOutbound.setOutboundNumber("G" + s); |
| | | int count = inventoryGoodsDto.getNum() - inventoryGoodsDto.getInventoryCount(); |
| | | tErpSupplierOutbound.setTotalMoney(erpGoods.getSalesAmount().multiply(new BigDecimal(count))); |
| | | tErpSupplierOutbound.setInventoryId(tErpSupplierInventory.getId()); |
| | | erpClinicOutboundMapper.insert(tErpSupplierOutbound); |
| | | |
| | | |
| | | TErpClinicOutboundGoods tErpSupplierOutboundGoods = new TErpClinicOutboundGoods(); |
| | | tErpSupplierOutboundGoods.setOutboundId(tErpSupplierOutbound.getId()); |
| | | tErpSupplierOutboundGoods.setWarehousingId(tErpSupplierWarehousing1.getId()); |
| | | tErpSupplierOutboundGoods.setWarehousingBatchId(tErpSupplierWarehousingBatch.getId()); |
| | | tErpSupplierOutboundGoods.setOutboundCount(count); |
| | | tErpSupplierOutboundGoods.setTotalPrice(erpGoods.getSalesAmount().multiply(new BigDecimal(count))); |
| | | erpClinicOutboundGoodsMapper.insert(tErpSupplierOutboundGoods); |
| | | |
| | | |
| | | // 添加盘点信息 |
| | | TErpClinicInventoryGoods tErpSupplierInventoryGoods = new TErpClinicInventoryGoods(); |
| | | tErpSupplierInventoryGoods.setInventoryId(tErpSupplierInventory.getId()); |
| | | tErpSupplierInventoryGoods.setWarehousingId(tErpSupplierOutbound.getId()); |
| | | tErpSupplierInventoryGoods.setWarehousingBatchId(tErpSupplierOutboundGoods.getId()); |
| | | tErpSupplierInventoryGoods.setInventoryCount(inventoryGoodsDto.getInventoryCount()); |
| | | tErpSupplierInventoryGoods.setDamagedCount(inventoryGoodsDto.getDamagedCount()); |
| | | tErpSupplierInventoryGoods.setInventoryType(2); |
| | | tErpSupplierInventoryGoods.setGoodsId(tErpSupplierWarehousingBatch.getGoodsId()); |
| | | erpClinicInventoryGoodsMapper.insert(tErpSupplierInventoryGoods); |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.common.core.domain.BaseModel; |
| | |
| | | import com.ruoyi.system.query.TErpGoodsQuery; |
| | | import com.ruoyi.system.query.TErpProcurementQuery; |
| | | import com.ruoyi.system.service.TErpGoodsService; |
| | | import com.ruoyi.system.service.TErpProcurementGoodsService; |
| | | import com.ruoyi.system.service.TErpProcurementService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.system.vo.*; |
| | |
| | | import org.apache.http.conn.ssl.SSLSocketFactory; |
| | | import org.apache.http.entity.StringEntity; |
| | | import org.apache.http.impl.client.DefaultHttpClient; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Propagation; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.net.ssl.SSLContext; |
| | |
| | | import java.io.FileInputStream; |
| | | import java.io.IOException; |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.security.PrivateKey; |
| | | import java.security.cert.X509Certificate; |
| | | import java.util.ArrayList; |
| | |
| | | @Resource |
| | | private TErpGoodsUnitMapper erpGoodsUnitMapper; |
| | | |
| | | @Autowired |
| | | private TErpProcurementGoodsService erpProcurementGoodsService; |
| | | |
| | | |
| | | |
| | | @Override |
| | |
| | | } |
| | | 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, supplierClinicId)); |
| | | (new LambdaQueryWrapper<TErpProcurementGoods>().in(TErpProcurementGoods::getProcurementId, ids)); |
| | | List<TSysCommission> tSysCommissions =new ArrayList<>(); |
| | | if(!tErpProcurementGoods.isEmpty()){ |
| | | List<String> collect = tErpProcurementGoods.stream().map(TErpProcurementGoods::getId).collect(Collectors.toList()); |
| | |
| | | tErpGoodsVO.setTypeName(tErpGoodsVO.getTypeName()); |
| | | } |
| | | } |
| | | 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); |
| | | for (TErpGoods tErpGoodsVO : list) { |
| | | crmClinics.stream().filter(t -> t.getId().equals(tErpGoodsVO.getSupplierClinicId())).findFirst().ifPresent(t -> tErpGoodsVO.setSupplierName(t.getClinicName())); |
| | | } |
| | | } |
| | | pageInfo.setRecords( list); |
| | | return pageInfo; |
| | | } |
| | |
| | | @Override |
| | | public List<TErpGoodsVO> inventoryNotEnoughList(SysUser user) { |
| | | List<TErpGoodsVO> list = this.baseMapper.inventoryNotEnoughList(user); |
| | | |
| | | return null; |
| | | return list; |
| | | } |
| | | |
| | | @Override |
| | | public String addProcurement(String clinicSupplierId, SysUser user, List<AddProcurementDto> dtos) { |
| | | @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED) |
| | | public void addProcurement(String clinicSupplierId, SysUser user, List<AddProcurementDto> dtos) { |
| | | List<String> goodsIds = dtos.stream().map(AddProcurementDto::getGoodsId).collect(Collectors.toList()); |
| | | List<TErpGoods> tErpGoods = erpGoodsMapper.selectBatchIds(goodsIds); |
| | | for (AddProcurementDto dto : dtos) { |
| | | TErpGoods tErpGoodsVO = tErpGoods.stream().filter(t -> t.getId().equals(dto.getGoodsId())).findFirst().get(); |
| | | dto.setPlatformCommissionPrice(tErpGoodsVO.getPlatformCommissionPrice()); |
| | | dto.setSupplierId(tErpGoodsVO.getSupplierClinicId()); |
| | | dto.setGoodsSalesAmount(tErpGoodsVO.getSalesAmount()); |
| | | dto.setGoodsSalesAmount(tErpGoodsVO.getClinicPurchasePrice()); |
| | | if(dto.getSalesAmount()==null){ |
| | | dto.setSalesAmount(tErpGoodsVO.getClinicPurchasePrice()); |
| | | } |
| | | } |
| | | // 供应商分组 |
| | | Map<String, List<AddProcurementDto>> supplierClinicIdListMap = dtos.stream().collect(Collectors.groupingBy(AddProcurementDto::getSupplierId)); |
| | |
| | | }else { |
| | | tErpProcurement.setStatus(2); |
| | | } |
| | | this.save(tErpProcurement); |
| | | ArrayList<TErpProcurementGoods> tErpProcurementGoods1 = new ArrayList<>(); |
| | | |
| | | BigDecimal add =BigDecimal.ZERO; |
| | | |
| | | for (AddProcurementDto dto : value) { |
| | | TErpProcurementGoods tErpProcurementGoods = new TErpProcurementGoods(); |
| | | tErpProcurementGoods.setProcurementId(tErpProcurement.getId()); |
| | |
| | | tErpProcurementGoods.setUnitName(tErpGoodsUnit.getUnitName()); |
| | | tErpProcurementGoods.setPurchasePrice(dto.getGoodsSalesAmount()); |
| | | tErpProcurementGoods.setSalesAmount(dto.getSalesAmount()); |
| | | tErpProcurementGoods.setTotalPrice(dto.getSalesAmount().multiply(new BigDecimal(dto.getPurchaseCount()))); |
| | | |
| | | tErpProcurementGoods.setPurchaseCount(dto.getPurchaseCount()); |
| | | tErpProcurementGoods.setSupplierId(supplierClinicId); |
| | | tErpProcurementGoods.setRecvMerchantNo(supplier.getRecvMerchantNo()); |
| | | tErpProcurementGoods.setSupplierMoney(dto.getSalesAmount().subtract(dto.getPlatformCommissionPrice())); |
| | | if(tErpProcurementGoods.getSupplierMoney().doubleValue()<0){ |
| | | throw new RuntimeException("平台抽成不能大于售卖价格"); |
| | | } |
| | | add = add.add(dto.getPlatformCommissionPrice()); |
| | | tErpProcurementGoods1.add(tErpProcurementGoods); |
| | | } |
| | | BigDecimal bigDecimal = tErpProcurement.getPayMoney().multiply(BigDecimal.valueOf(0.0038)).setScale(2, RoundingMode.HALF_UP); |
| | | |
| | | tErpProcurement.setMoney(add.subtract(bigDecimal)); |
| | | if(tErpProcurement.getMoney().doubleValue()<0){ |
| | | throw new RuntimeException("金额设置错误,请联系平台管理员"); |
| | | } |
| | | this.save(tErpProcurement); |
| | | tErpProcurementGoods1.forEach(e->e.setProcurementId(tErpProcurement.getId())); |
| | | erpProcurementGoodsService.saveBatch(tErpProcurementGoods1); |
| | | } |
| | | |
| | | return ""; |
| | | } |
| | | |
| | | @Override |
| | | public DetailProcurementVO detailProcurement(String clinicSupplierId, SysUser user, String id) { |
| | | DetailProcurementVO detailProcurementVO = new DetailProcurementVO(); |
| | | TErpProcurement tErpProcurement = this.getById(id); |
| | | detailProcurementVO.setStatus(tErpProcurement.getStatus()); |
| | | detailProcurementVO.setCreateTime(tErpProcurement.getCreateTime()); |
| | | detailProcurementVO.setSendTime(tErpProcurement.getSendTime()); |
| | | TCrmSupplier supplier = crmSupplierMapper.selectById(tErpProcurement.getSupplierId()); |
| | | detailProcurementVO.setSupplierName(supplier.getSupplierName()); |
| | | detailProcurementVO.setUserName(sysUserMapper.selectUserById(Long.valueOf(tErpProcurement.getCreateId())).getUserName()); |
| | | List<TErpProcurementGoods> list = erpProcurementGoodsService.list(new QueryWrapper<TErpProcurementGoods>().eq("procurement_id", id)); |
| | | ArrayList<DetailProcurementNextVO> detailProcurementNextVOS = new ArrayList<>(); |
| | | for (TErpProcurementGoods tErpProcurementGoods : list) { |
| | | DetailProcurementNextVO detailProcurementNextVO = new DetailProcurementNextVO(); |
| | | detailProcurementNextVO.setGoodsName(tErpProcurementGoods.getGoodsName()); |
| | | detailProcurementNextVO.setQuasiNumber(tErpProcurementGoods.getQuasiNumber()); |
| | | detailProcurementNextVO.setPackingUnitName(tErpProcurementGoods.getUnitName()); |
| | | detailProcurementNextVO.setSalesAmount(tErpProcurementGoods.getSalesAmount()); |
| | | detailProcurementNextVO.setNum(tErpProcurementGoods.getPurchaseCount()); |
| | | detailProcurementNextVO.setTotalPrice(tErpProcurement.getPayMoney()); |
| | | detailProcurementNextVO.setId(tErpProcurementGoods.getId()); |
| | | detailProcurementNextVOS.add(detailProcurementNextVO); |
| | | } |
| | | detailProcurementVO.setList(detailProcurementNextVOS); |
| | | return detailProcurementVO; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.system.vo; |
| | | |
| | | import cn.afterturn.easypoi.excel.annotation.Excel; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | 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 DetailProcurementNextVO { |
| | | |
| | | @ApiModelProperty(value = "采购二级id") |
| | | private String id; |
| | | |
| | | @ApiModelProperty("商品id") |
| | | private String goodsId; |
| | | |
| | | @ApiModelProperty(value = "商品名称") |
| | | private String goodsName; |
| | | |
| | | @ApiModelProperty(value = "国药准字号") |
| | | private String quasiNumber; |
| | | |
| | | @ApiModelProperty(value = "单位") |
| | | private String packingUnitName; |
| | | |
| | | @ApiModelProperty(value = "售价") |
| | | private BigDecimal salesAmount; |
| | | |
| | | @ApiModelProperty(value = "数量") |
| | | private Integer num; |
| | | |
| | | @ApiModelProperty(value = "状态") |
| | | private BigDecimal totalPrice=BigDecimal.ZERO; |
| | | |
| | | @ApiModelProperty(value = "供应商名称") |
| | | private String supplierName; |
| | | |
| | | @ApiModelProperty(value = "单位名称") |
| | | private String unitName; |
| | | |
| | | @ApiModelProperty(value = "采购价") |
| | | private BigDecimal purchasePrice; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.system.vo; |
| | | |
| | | import com.ruoyi.system.model.TErpGoods; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | @ApiModel(value = "诊所采购详情Vo") |
| | | public class DetailProcurementVO{ |
| | | @ApiModelProperty(value = "状态 1=草稿 2=待支付 3=待发货 4=已发货 5=已入库 6=已取消") |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty(value = "供应商名称") |
| | | private String supplierName; |
| | | |
| | | @ApiModelProperty(value = "发起人") |
| | | private String userName; |
| | | |
| | | @ApiModelProperty(value = "发起时间") |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty(value = "发货时间") |
| | | private LocalDateTime sendTime; |
| | | |
| | | @ApiModelProperty(value = "采购二级详情") |
| | | private List<DetailProcurementNextVO> list; |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.system.vo; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.system.model.TErpClinicWarehousingBatch; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | @ApiModel(value = "诊所 入库商品详情二级VO") |
| | | public class OutboundGoodsDetailNextVo { |
| | | |
| | | @ApiModelProperty("入库单号") |
| | | private String warehouseNo ; |
| | | |
| | | @ApiModelProperty("商品名称") |
| | | private String goodsName; |
| | | |
| | | @ApiModelProperty("商品id") |
| | | private String goodsId; |
| | | |
| | | @ApiModelProperty("商品类型") |
| | | private String typeName; |
| | | |
| | | |
| | | @ApiModelProperty("商品类型id") |
| | | private String typeId; |
| | | |
| | | @ApiModelProperty("国药准字号") |
| | | private String quasiNumber; |
| | | |
| | | @ApiModelProperty("批次号") |
| | | private String batchNumber; |
| | | |
| | | @ApiModelProperty("单位") |
| | | private String unitName; |
| | | |
| | | @ApiModelProperty("剩余数量") |
| | | private Integer surplusCount; |
| | | @ApiModelProperty("单价") |
| | | private BigDecimal unitAmount; |
| | | @ApiModelProperty("出库数量") |
| | | private Integer outboundCount; |
| | | @ApiModelProperty("有效期至") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private LocalDateTime expiryDate; |
| | | |
| | | |
| | | @ApiModelProperty("总价") |
| | | private BigDecimal totalAmount; |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.system.vo; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.system.model.TErpClinicWarehousingBatch; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | @ApiModel(value = "诊所 入库商品详情VO") |
| | | public class OutboundGoodsDetailVo { |
| | | |
| | | @ApiModelProperty("出库类型 1=报损 2=到期 3=失效 4=召回 5=其他 6=盘点出库 7=购买出库") |
| | | private Integer outboundType; |
| | | |
| | | |
| | | @ApiModelProperty(value = "发起人") |
| | | private String createBy; |
| | | |
| | | @ApiModelProperty(value = "操作时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty(value = "盘点单号") |
| | | private String inventoryNumber; |
| | | |
| | | |
| | | @ApiModelProperty(value = "订单号") |
| | | private String orderNumber; |
| | | |
| | | @ApiModelProperty(value = "出库商品") |
| | | private List<OutboundGoodsDetailNextVo> list; |
| | | } |
New file |
| | |
| | | package com.ruoyi.system.vo; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Data |
| | | @ApiModel(value = "诊所erp出库列表VO") |
| | | public class TErpClinicOutboundPageListVO { |
| | | |
| | | @ApiModelProperty(value = "出库id") |
| | | private String id; |
| | | |
| | | @ApiModelProperty(value = "出库单号") |
| | | private String outboundNumber; |
| | | |
| | | @ApiModelProperty(value = "订单编号") |
| | | private String orderNumber; |
| | | |
| | | @ApiModelProperty("品种数") |
| | | private Integer typeNum; |
| | | |
| | | |
| | | @ApiModelProperty(value = "总价") |
| | | private Double allTotalPrice; |
| | | |
| | | |
| | | @ApiModelProperty(value = "操作人") |
| | | private String userName; |
| | | |
| | | |
| | | |
| | | |
| | | @ApiModelProperty(value = "出库时间") |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty(value = "出库类型 1=报损 2=到期 3=失效 4=召回 5=其他 6=盘点出库 7=购买出库") |
| | | private Integer outboundType; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.system.vo; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | @ApiModel(value = "诊所erp入库列表VO") |
| | | public class TErpClinicWarehousePageListVO { |
| | | |
| | | @ApiModelProperty(value = "入库id") |
| | | private String id; |
| | | |
| | | @ApiModelProperty(value = "入库单号") |
| | | private String warehouseNo; |
| | | |
| | | private String supplierId; |
| | | |
| | | @ApiModelProperty(value = "供应商名称") |
| | | private String supplierName; |
| | | |
| | | |
| | | @ApiModelProperty(value = "采购单号") |
| | | private String procurementCode; |
| | | |
| | | @ApiModelProperty("品种数") |
| | | private Integer typeNum; |
| | | |
| | | @ApiModelProperty(value = "总价") |
| | | private Double allTotalPrice; |
| | | |
| | | @ApiModelProperty(value = "入库时间") |
| | | private LocalDateTime warehouseTime; |
| | | |
| | | @ApiModelProperty(value = "入库类型 1采购 2盘点") |
| | | private Integer type; |
| | | |
| | | |
| | | } |
| | |
| | | @ApiModelProperty(value = "国药准字号") |
| | | private String quasiNumber; |
| | | |
| | | @ApiModelProperty(value = "商品标识码") |
| | | @ApiModelProperty(value = "商品条码") |
| | | private String goodsIdCode; |
| | | |
| | | @ApiModelProperty(value = "批次号") |
| | |
| | | private LocalDateTime expiryDate; |
| | | |
| | | |
| | | private Integer goodsSource; |
| | | |
| | | @ApiModelProperty(value = "供应商id") |
| | | private String supplierId; |
| | | |
| | | |
| | | } |
| | |
| | | @ApiModelProperty(value = "国药准字号") |
| | | private String quasiNumber; |
| | | |
| | | @ApiModelProperty("商品标识码") |
| | | @ApiModelProperty("商品条码") |
| | | @TableField("goods_id_code") |
| | | private String goodsIdCode; |
| | | |
| | |
| | | @ApiModelProperty(value = "诊所名称") |
| | | private String clinicName; |
| | | |
| | | @ApiModelProperty(value = "供应商名称") |
| | | private String supplierName; |
| | | |
| | | @ApiModelProperty(value = "品种数") |
| | | private Integer typeNum; |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.system.vo; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.system.model.TErpClinicWarehousingBatch; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | @ApiModel(value = "诊所 入库商品详情VO") |
| | | public class WarehouseGoodsDetailVo { |
| | | @ApiModelProperty(value = "发起人") |
| | | private String createBy; |
| | | |
| | | @ApiModelProperty(value = "发起时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty(value = "盘点单号") |
| | | private String inventoryNumber; |
| | | |
| | | @ApiModelProperty(value = "入库商品") |
| | | private List<TErpClinicWarehousingBatch> list; |
| | | } |
| | |
| | | * |
| | | * @author lihen |
| | | */ |
| | | @Configuration |
| | | //@Configuration |
| | | public class WxConfig { |
| | | |
| | | private final WeixinPayProperties weixinPayProperties; |
| | |
| | | <sql id="Base_Column_List"> |
| | | id, procurement_id, clinic_id, goods_id, goods_name, supplier_name, quasi_number, sales_amount, purchase_count, total_price, warehousing_type, create_time, update_time, create_by, update_by, disabled |
| | | </sql> |
| | | <select id="pageInventoryList" resultType="com.ruoyi.system.vo.PageInventoryListVo"> |
| | | select t1.id,t1.create_time,t2.user_name createBy,t3.warehouse_name |
| | | from t_erp_clinic_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 |
| | | <if test="user.roleType !=null and user.roleType ==5"> |
| | | and t1.clinic_id = #{supplierClinicId} |
| | | </if> |
| | | <if test="query.createBy != null and query.createBy != ''"> |
| | | and t2.user_name like concat('%',#{query.createBy},'%') |
| | | </if> |
| | | <if test="sTime != null and eTime !=null "> |
| | | and t1.create_time between #{sTime} and #{eTime} |
| | | </if> |
| | | order by t1.create_time desc |
| | | </select> |
| | | |
| | | |
| | | <select id="validityPeriodWarning" resultType="com.ruoyi.system.vo.ValidityPeriodWarningVo"> |
| | | select 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 |
| | | from t_erp_clinic_warehousing_batch t1 |
| | | left join t_erp_clinic_warehousing t2 on t1.warehousing_id = t2.id |
| | | LEFT JOIN t_erp_clinic_outbound_goods t3 on t3.warehousing_batch_id = t1.id |
| | | 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 (t1.warehousing_number - t3.outbound_count > 0 or t3.id is null) |
| | | <if test="user.roleType !=null and user.roleType ==5"> |
| | | and t2.clinic_id =#{supplierClinicId} |
| | | </if> |
| | | <if test="query.name != null and query.name != ''"> |
| | | and t4.goods_name like concat('%',#{query.goodsName},'%') |
| | | </if> |
| | | <if test="query.quasiNumber != null and query.quasiNumber != ''"> |
| | | and t4.quasi_number like concat('%',#{query.quasiNumber},'%') |
| | | </if> |
| | | <if test="query.batchNumber != null and query.batchNumber != ''"> |
| | | and t1.batch_number like concat('%',#{query.batchNumber},'%') |
| | | </if> |
| | | <if test="query.typeId != null and query.typeId != ''"> |
| | | and t4.type_id = #{query.typeId} |
| | | </if> |
| | | order by t1.expiry_date |
| | | |
| | | </select> |
| | | |
| | | <sql id="Base_Column_List1"> |
| | | 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.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, |
| | | </sql> |
| | | <select id="pageList" 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 |
| | | <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 t1.goods_id_code like concat('%',#{query.goodsIdCode},'%') |
| | | </if> |
| | | <if test="query.typeId != null and query.typeId != ''"> |
| | | and t1.type_id = #{query.typeId} |
| | | </if> |
| | | <if test="query.quasiNumber != null and query.quasiNumber != ''"> |
| | | and t1.quasi_number like concat('%',#{query.quasiNumber},'%') |
| | | </if> |
| | | <if test="query.state != null "> |
| | | and t1.state = #{query.state} |
| | | </if> |
| | | <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 "> |
| | | 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 |
| | | ) 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> |
| | | |
| | | <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 |
| | | 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 |
| | | 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},'%') |
| | | </if> |
| | | <if test="sTime != null"> |
| | | and t1.create_time between #{sTime} and #{eTime} |
| | | </if> |
| | | <if test="query.type != null"> |
| | | and t1.type = #{query.type} |
| | | </if> |
| | | order by t1.create_time desc |
| | | |
| | | </select> |
| | | <select id="outboundPageList" resultType="com.ruoyi.system.vo.TErpClinicOutboundPageListVO"> |
| | | select t1.id,t1.outbound_number,t1.order_number,t1.total_money allTotalPrice,t1.create_time ,t1.outbound_type,t2.user_name,t1.type_num |
| | | from t_erp_clinic_outbound t1 left join sys_user t2 on t1.create_by = t2.user_id |
| | | where t1.disabled = 0 and t1.clinic_id = #{query.supplierClinicId} |
| | | <if test="query.outboundNumber != null and query.outboundNumber != ''"> |
| | | and t1.outbound_number like concat('%',#{query.outboundNumber},'%') |
| | | </if> |
| | | <if test="sTime != null"> |
| | | and t1.create_time between #{sTime} and #{eTime} |
| | | </if> |
| | | <if test="query.userName != null and query.userName !=''"> |
| | | and t2.user_name like concat('%',#{query.userName},'%') |
| | | </if> |
| | | <if test="type != null"> |
| | | and t1.outbound_type = #{query.type} |
| | | </if> |
| | | order by t1.create_time desc |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | 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 = #{query.supplierClinicId} |
| | | and ( (goods_source =2 and supplier_clinic_id = #{query.supplierClinicId} ) or (FIND_IN_SET(#{query.supplierClinicId},clinic_ids) and state =1)) |
| | | </if> |
| | | order by create_time desc |
| | | </select> |
| | |
| | | where (o.warehousing_number -o.outbound_count) >0 |
| | | order by o.create_time desc |
| | | </select> |
| | | <select id="pageInventoryGoodsPageList1" resultType="com.ruoyi.system.vo.TErpGoodsInventoryVO"> |
| | | select * from ( |
| | | SELECT t1.id,t2.warehouse_no, |
| | | t3.goods_name,t3.goods_source, |
| | | t4.supplier_name, |
| | | t3.type_id, |
| | | t3.packing_unit_id, |
| | | t3.quasi_number, |
| | | t3.goods_id_code, |
| | | t1.batch_number, |
| | | coalesce(sum(t5.outbound_count),0) as outbound_count, |
| | | t1.warehousing_number, |
| | | t2.create_time, |
| | | t1.warehousing_number - coalesce(sum(t5.outbound_count),0) as num, |
| | | t2.unit_amount as sales_amount, |
| | | t1.expiry_date |
| | | from t_erp_clinic_warehousing_batch t1 |
| | | LEFT JOIN t_erp_clinic_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_clinic_outbound_goods t5 on t5.warehousing_batch_id =t1.id |
| | | where t2.disabled = 0 and t2.clinic_id =#{supplierClinicId} |
| | | <if test="query.type != null and query.type ==1"> |
| | | and #{time} > t1.expiry_date |
| | | </if> |
| | | <if test="query.goodsName != null and query.goodsName != ''"> |
| | | and t3.goods_name like concat('%',#{query.goodsName},'%') |
| | | </if> |
| | | <if test="query.supplierName != null and query.supplierName != ''"> |
| | | and (t4.supplier_name like concat('%',#{query.supplierName},'%') or t3.supplierName like concat('%',#{query.supplierName},'%')) |
| | | </if> |
| | | |
| | | <if test="query.typeId != null and query.typeId != ''"> |
| | | and t3.type_id = #{query.typeId} |
| | | </if> |
| | | <if test="query.quasiNumber != null and query.quasiNumber != ''"> |
| | | and t3.quasi_number =#{query.quasiNumber} |
| | | </if> |
| | | <if test="query.batchNumber != null and query.batchNumber != ''"> |
| | | and t1.batch_number =#{query.batchNumber} |
| | | </if> |
| | | <if test="query.warehouseNo != null and query.warehouseNo != ''"> |
| | | and t2.warehouse_no = #{query.warehouseNo} |
| | | </if> |
| | | GROUP BY t1.id |
| | | ) as o |
| | | where (o.warehousing_number -o.outbound_count) >0 |
| | | order by o.create_time desc |
| | | </select> |
| | | <select id="pageInventoryGoodsList" resultType="com.ruoyi.system.vo.TErpGoodsInventoryVO"> |
| | | select * from ( |
| | | SELECT t1.id,t2.warehouse_no, |
| | |
| | | where (o.warehousing_number -o.outbound_count) >0 |
| | | order by o.create_time desc |
| | | </select> |
| | | <select id="pageInventoryGoodsList1" resultType="com.ruoyi.system.vo.TErpGoodsInventoryVO"> |
| | | select * from ( |
| | | SELECT t1.id,t2.warehouse_no, |
| | | t3.goods_name, |
| | | t4.supplier_name, |
| | | t3.type_id, |
| | | t3.packing_unit_id, |
| | | t3.quasi_number, |
| | | t3.goods_id_code, |
| | | t1.batch_number, |
| | | coalesce(sum(t5.outbound_count),0) as outbound_count, |
| | | t1.warehousing_number, |
| | | t2.create_time, |
| | | t1.warehousing_number - coalesce(sum(t5.outbound_count),0) as num, |
| | | t2.unit_amount as sales_amount, |
| | | t1.expiry_date |
| | | from t_erp_clinic_warehousing_batch t1 |
| | | LEFT JOIN t_erp_clinic_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 #{endDate} > t1.expiry_date |
| | | <if test="user.roleType !=null and user.roleType ==4"> |
| | | and t3.supplier_clinic_id =#{supplierClinicId} and t3.goods_source=1 |
| | | </if> |
| | | <if test="user.roleType !=null and user.roleType ==5"> |
| | | and t3.supplier_clinic_id =#{supplierClinicId} and t3.goods_source=2 |
| | | </if> |
| | | |
| | | GROUP BY t1.id |
| | | ) as o |
| | | where (o.warehousing_number -o.outbound_count) >0 |
| | | order by o.create_time desc |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | select t1.id, |
| | | t1.procurement_code, |
| | | t1.clinic_id, |
| | | t3.clinic_name, |
| | | t3.supplier_name, |
| | | sum(t2.total_price) as totalPrice, |
| | | t1.create_time, |
| | | t2.id tErpProcurementGoodsId, |
| | |
| | | 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 t_crm_supplier t3 on t1.supplier_id = t3.id |
| | | left JOIN sys_user t4 on t1.create_id = t4.user_id |
| | | where t1.disabled = 0 |
| | | where t1.disabled = 0 and t1.status !=1 |
| | | <if test="user.roleType !=null and user.roleType==4"> |
| | | and t2.supplier_id =#{supplierClinicId} |
| | | </if> |
| | |
| | | and t1.procurement_code = #{query.procurementCode} |
| | | </if> |
| | | <if test="query.clinicName != null and query.clinicName != ''"> |
| | | and t3.clinic_name like concat('%',#{query.clinicName},'%') |
| | | and t3.supplier_name like concat('%',#{query.clinicName},'%') |
| | | </if> |
| | | <if test="query.userName != null and query.userName != ''"> |
| | | and t4.user_name like concat('%',#{query.userName},'%') |
| | |
| | | <if test="sTime != null"> |
| | | and t1.create_time between #{sTime} and #{eTime} |
| | | </if> |
| | | group by t1.id |
| | | |
| | | </select> |
| | | <select id="inventoryNotEnoughList" resultType="com.ruoyi.system.vo.TErpGoodsVO"> |