request->get(); try { validate(Page::class)->check($page); }catch (ValidateException $e){ return $this->JsonError($e->getError()); } return $this->JsonSucess(ProductBatchService::getProductBatchList($page,getQydm())); } /** * @Apidoc\Title("获取所有批次信息") * @Apidoc\Tag("列表信息") * @Apidoc\Method ("GET") * @Apidoc\Author ("yang") * @Route("getProductBatchAllInfo",method="GET") * @Middleware({"jwt"}) */ public function getProductBatchAllInfo(): Json { $page = $this->request->get(); try { return $this->JsonSucess(ProductBatchService::getProductBatchAll(getQydm())); }catch (ValidateException $e){ return $this->JsonError($e->getError()); } } /** * @Apidoc\Title("建档出证列表信息") * @Apidoc\Tag("列表信息") * @Apidoc\Method ("GET") * @Apidoc\Author ("yang") * @Route("selectProductBatchList",method="GET") * @Middleware({"jwt"}) */ public function selectProductBatchList(): Json { $page = $this->request->get(); try { validate(Page::class)->check($page); }catch (ValidateException $e){ return $this->JsonError($e->getError()); } return $this->JsonSucess(ProductBatchService::getProductList($page,getQydm())); } /** * @Apidoc\Title("建档出证企业基础信息获取") * @Apidoc\Tag("基础信息") * @Apidoc\Method ("GET") * @Apidoc\Author ("yang") * @Route("getEnterprisesBaseInfo",method="GET") * @Middleware({"jwt"}) */ public function getEnterprisesBaseInfo(): Json { $result = ProductBatchService::findEnterprisesBaseInfo(getQydm()); return $this->JsonSucess($result); } /** * @Apidoc\Title("建档出证产品信息获取") * @Apidoc\Tag("基础信息") * @Apidoc\Method ("GET") * @Apidoc\Author ("yang") * @Route("getProductBaseInfo",method="GET") * @Middleware({"jwt"}) */ public function getProductBaseInfo(): Json { $result = ProductBatchService::selectProductBaseInfo(getQydm()); return $this->JsonSucess($result); } /** * @Apidoc\Title("建档出证产品产地信息获取") * @Apidoc\Tag("基础信息") * @Apidoc\Method ("GET") * @Apidoc\Author ("yang") * @Route("getChandiBaseInfo",method="GET") * @Middleware({"jwt"}) */ public function getchandiBaseInfo(): Json { $result = ProductBatchService::selectChandiBaseInfo(getQydm()); return $this->JsonSucess($result); } /** * @Apidoc\Title("添加产品批次信息") * @Apidoc\Tag("产品批次") * @Apidoc\Method ("POST") * @Apidoc\Author ("yang") * @Route("addProductBatch",method="POST") * @Middleware({"jwt"}) */ public function addProductBatch(): Json { $info = $this->request->post(); try { validate(\app\validate\ProductBatch::class)->check($info); } catch (ValidateException $e) { $this->JsonError($e->getError()); } $info['batch_id'] = date('mdhis', time()); $info['creation_time'] = date('Y-m-d h:i:s', time()); return $this->JsonSucess(ProductBatchService::addProductBatch($info)); } /** * @Apidoc\Title("产品批次信息ByID") * @Apidoc\Tag("产品批次信息") * @Apidoc\Method ("GET") * @Apidoc\Author ("yang") * @Route("getProductBatchInfo",method="GET") * @Middleware({"jwt"}) */ public function getProductBatchInfo(): Json { $id = $this->request->get(); try { validate(Id::class)->check($id); }catch (ValidateException $e){ return $this->JsonError($e->getError()); } return $this->JsonSucess(ProductBatchService::getProductBatchInfoById($id["id"])); } /** * @Apidoc\Title("更新产品批次信息") * @Apidoc\Tag("产品批次信息") * @Apidoc\Method ("POST") * @Apidoc\Author ("yang") * @Route("editProductBatch",method="POST") * @Middleware({"jwt"}) */ public function editProductBatch(): Json { $info = $this->request->post(); try { validate(\app\validate\ProductBatch::class)->check($info); } catch (ValidateException $e) { $this->JsonError($e->getError()); } return $this->JsonSucess(ProductBatchService::editProductBatch($info,$info["id"])); } /** * @Apidoc\Author("ihavoc") * @throws ModelNotFoundException * @throws DataNotFoundException * @throws DbException * @Apidoc\Title("根据产品id获取批次号信息") * @Apidoc\Tag("批次号") * @Apidoc\Method ("POST") * @Route("/getPchByProductId",method="POST") * @Middleware({"jwt"}) */ public function getPchByProductId(){ $id = $this->request->get(); try { validate(Id::class)->check($id); }catch (ValidateException $e){ return $this->JsonError($e->getError()); } return $this->JsonSucess(ProductBatchService::getPchByProId($id["id"])); } }