修改 更新处方平台商品 增加药店编码识别

This commit is contained in:
wucongxing 2023-12-07 14:03:28 +08:00
parent 1d16a1265b
commit a583a9fdda

View File

@ -43,7 +43,7 @@ class getProductCommand extends HyperfCommand
$page = 1; $page = 1;
$page_size = 100; $page_size = 100;
$result = $prescription->getProd(1, 100); $result = $prescription->getProd(1, 100);
if (!empty($result['rows'])){ if (!empty($result['rows'])) {
foreach ($result['rows'] as $item) { foreach ($result['rows'] as $item) {
// 执行入库 // 执行入库
$this->handleData($item); $this->handleData($item);
@ -55,7 +55,7 @@ class getProductCommand extends HyperfCommand
for ($i = 2; $i < $count; $i++) { for ($i = 2; $i < $count; $i++) {
try { try {
$result = $prescription->getProd($i, $page_size); $result = $prescription->getProd($i, $page_size);
if (!isset($result['rows'])){ if (!isset($result['rows'])) {
continue; continue;
} }
@ -63,7 +63,7 @@ class getProductCommand extends HyperfCommand
// 执行入库 // 执行入库
$this->handleData($item); $this->handleData($item);
} }
}catch (\Exception $e){ } catch (\Exception $e) {
$this->line("部分商品更新失败:" . $e->getMessage()); $this->line("部分商品更新失败:" . $e->getMessage());
} }
} }
@ -109,6 +109,23 @@ class getProductCommand extends HyperfCommand
return false; return false;
} }
if (empty($item['thirdCode'])) {
Db::rollBack();
// $this->line("商品更新失败,缺少药品价格" . json_encode($item, JSON_UNESCAPED_UNICODE));
return false;
}
$pharmacy_code = \Hyperf\Config\config("prescription_platform.pharmacy_code");
if (empty($pharmacy_code)) {
$pharmacy_code = "JG-10009";
}
// 非药店编码
if ($pharmacy_code != $item['thirdCode']) {
Db::rollBack();
return false;
}
// 查询是否存在 // 查询是否存在
$params = array(); $params = array();
$params['product_platform_code'] = $item['drugCode']; $params['product_platform_code'] = $item['drugCode'];
@ -254,7 +271,7 @@ class getProductCommand extends HyperfCommand
$data['product_platform_code'] = $item['drugCode']; $data['product_platform_code'] = $item['drugCode'];
// 第三方药店商品编码 // 第三方药店商品编码
if (isset($item['thirdDrugCode'])){ if (isset($item['thirdDrugCode'])) {
$data['product_pharmacy_code'] = $item['thirdDrugCode']; $data['product_pharmacy_code'] = $item['thirdDrugCode'];
} }