修改拉取商品

This commit is contained in:
wucongxing 2023-12-08 16:39:28 +08:00
parent be0acc304f
commit af9be7a127

View File

@ -94,27 +94,29 @@ class getProductCommand extends HyperfCommand
*/ */
protected function handleData(array $item): bool protected function handleData(array $item): bool
{ {
if (empty($item['drugCode'])) {
return false;
}
if (empty($item['drugPrice'])) {
return false;
}
if (empty($item['thirdCode'])) {
return false;
}
if (empty($item['thirdDrugCode'])) {
return false;
}
if (empty($item['approvalNumber'])) {
return false;
}
try { try {
Db::beginTransaction(); Db::beginTransaction();
if (empty($item['drugCode'])) {
Db::rollBack();
// $this->line("商品更新失败,缺少平台药品编码" . json_encode($item, JSON_UNESCAPED_UNICODE));
return false;
}
if (empty($item['drugPrice'])) {
Db::rollBack();
// $this->line("商品更新失败,缺少药品价格" . json_encode($item, JSON_UNESCAPED_UNICODE));
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"); $pharmacy_code = \Hyperf\Config\config("prescription_platform.pharmacy_code");
if (empty($pharmacy_code)) { if (empty($pharmacy_code)) {
$pharmacy_code = "JG-10009"; $pharmacy_code = "JG-10009";
@ -129,6 +131,8 @@ class getProductCommand extends HyperfCommand
// 查询是否存在 // 查询是否存在
$params = array(); $params = array();
$params['product_platform_code'] = $item['drugCode']; $params['product_platform_code'] = $item['drugCode'];
$params['product_pharmacy_code'] = $item['thirdDrugCode'];
$params['license_number'] = $item['approvalNumber'];
$product_platform = ProductPlatform::getOne($params); $product_platform = ProductPlatform::getOne($params);
if (!empty($product_platform)) { if (!empty($product_platform)) {
// 已存在,更新 // 已存在,更新
@ -173,14 +177,6 @@ class getProductCommand extends HyperfCommand
} }
} }
// 批准文号
if (isset($item['approvalNumber'])) {
if ($product_platform['license_number'] != $item['approvalNumber']) {
$product_platform_data['license_number'] = $item['approvalNumber'];
$product_data['license_number'] = $item['approvalNumber'];
}
}
// 生产厂家 // 生产厂家
if (isset($item['manufacturer'])) { if (isset($item['manufacturer'])) {
if ($product_platform['manufacturer'] != $item['manufacturer']) { if ($product_platform['manufacturer'] != $item['manufacturer']) {
@ -197,14 +193,6 @@ class getProductCommand extends HyperfCommand
} }
} }
// 第三方药店商品编码
if (isset($item['thirdDrugCode'])) {
if ($product_platform['product_pharmacy_code'] != $item['thirdDrugCode']) {
$product_platform_data['product_pharmacy_code'] = $item['thirdDrugCode'];
$product_data['product_pharmacy_code'] = $item['thirdDrugCode'];
}
}
// 基本包装数量 // 基本包装数量
if (isset($item['basicPackingCount'])) { if (isset($item['basicPackingCount'])) {
if ($product_platform['packaging_count'] != $item['basicPackingCount']) { if ($product_platform['packaging_count'] != $item['basicPackingCount']) {
@ -271,9 +259,7 @@ class getProductCommand extends HyperfCommand
$data['product_platform_code'] = $item['drugCode']; $data['product_platform_code'] = $item['drugCode'];
// 第三方药店商品编码 // 第三方药店商品编码
if (isset($item['thirdDrugCode'])) { $data['product_pharmacy_code'] = $item['thirdDrugCode'];
$data['product_pharmacy_code'] = $item['thirdDrugCode'];
}
// 商品规格 // 商品规格
if (isset($item['specifications'])) { if (isset($item['specifications'])) {
@ -281,9 +267,7 @@ class getProductCommand extends HyperfCommand
} }
// 批准文号 // 批准文号
if (isset($item['approvalNumber'])) { $data['license_number'] = $item['approvalNumber'];
$data['license_number'] = $item['approvalNumber'];
}
// 生产厂家 // 生产厂家
if (isset($item['manufacturer'])) { if (isset($item['manufacturer'])) {