package thyyxxk.webserver.service.datamodify; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import thyyxxk.webserver.config.exception.ExceptionEnum; import thyyxxk.webserver.constants.Capacity; import thyyxxk.webserver.dao.his.datamodify.InOrOutOfWarehouseDao; import thyyxxk.webserver.entity.ResultVo; import thyyxxk.webserver.entity.datamodify.GetDropdownBox; import thyyxxk.webserver.entity.datamodify.InOrOutOfWarehousePojo; import thyyxxk.webserver.entity.datamodify.YpInDetl; import thyyxxk.webserver.entity.datamodify.YpOutDetl; import thyyxxk.webserver.utils.ResultVoUtil; import thyyxxk.webserver.utils.TokenUtil; import java.util.HashMap; import java.util.List; import java.util.Map; /** *

* 描述: 药品入库或出库 *

* * @author xc * @date 2021-06-01 14:07 */ @Service @Slf4j public class InOrOutOfWarehouseService { private final InOrOutOfWarehouseDao dao; @Autowired public InOrOutOfWarehouseService(InOrOutOfWarehouseDao dao) { this.dao = dao; } public ResultVo> queryRuKuXinXi(InOrOutOfWarehousePojo param) { IPage page = new Page<>(param.getCurrentPage(), param.getPageSize()); List list = dao.queryRuKuXinXi(page, param); if (list.size() > 0) { Map map = new HashMap<>(Capacity.TWO); map.put("data", list); map.put("total", page.getTotal()); return ResultVoUtil.success(map); } return ResultVoUtil.fail(ExceptionEnum.NO_DATA_EXIST); } public ResultVo> queryCode(String pyCode, Integer flag) { if (flag == 1) { //供应商 return ResultVoUtil.success(dao.queryCode("yp_zd_supply", pyCode.toUpperCase() + "%")); } else if (flag == 2) { //采购员 return ResultVoUtil.success(dao.queryCode("a_employee_mi", pyCode.toUpperCase() + "%")); } else if (flag == 3) { //生产厂家 return ResultVoUtil.success(dao.queryCode("yp_zd_manufactory", pyCode.toUpperCase() + "%")); } return ResultVoUtil.fail(ExceptionEnum.INTERNAL_SERVER_ERROR); } public ResultVo xiuGiRuKuXinXi(YpInDetl param) { dao.xiuGiRuKuXinXi(param); log.info("修改入库信息:{},修改人:{}", param, TokenUtil.getTokenUserId()); return ResultVoUtil.success(ExceptionEnum.SUCCESS_AND_NOTIFICATION, "修改成功"); } /* 出库的信息*/ public ResultVo> queryChuKuXinXi(InOrOutOfWarehousePojo param) { log.info("查询出库数据:{}", param); IPage page = new Page<>(param.getCurrentPage(), param.getPageSize()); List list = dao.queryChuKuXinXi(page, param); if (list.size() > 0) { Map map = new HashMap<>(Capacity.TWO); map.put("data", list); map.put("total", page.getTotal()); return ResultVoUtil.success(map); } return ResultVoUtil.fail(ExceptionEnum.NO_DATA_EXIST); } public ResultVo> queryDeptCode() { Map map = new HashMap<>(Capacity.TWO); map.put("deptCode", dao.queryDeptCode()); map.put("groupNo", dao.queryGroupNo()); return ResultVoUtil.success(map); } public ResultVo xiuGaiChuKuXinXi(YpOutDetl param) { log.info("修改出库信息:{},修改人:{}", param, TokenUtil.getTokenUserId()); dao.xiuGaiChuKu(param); return ResultVoUtil.success("修改成功"); } }