|
|
@@ -37,34 +37,37 @@ class BookController extends Controller
|
|
|
foreach ($list as $key => $bookSn) {
|
|
|
$cgList = CgOrderClass::getAllByCondition(['bookSn' => $bookSn, 'status' => 3], null, '*', null, true);
|
|
|
if (empty($cgList)) {
|
|
|
- foreach ($cgList as $cg) {
|
|
|
- $connection = Yii::$app->db;
|
|
|
- $transaction = $connection->beginTransaction();
|
|
|
- try {
|
|
|
- $respond = PurchaseOrderClass::assign($cg);
|
|
|
- $transaction->commit();
|
|
|
- $hasChange = $respond['hasChange'] ?? 0;
|
|
|
- if ($hasChange == 1) {
|
|
|
- //通知采购单页要刷新货位
|
|
|
- $cacheKey = 'ghs_cg_order_staff_refresh_seat_' . $bookSn;
|
|
|
- $mainId = $order->mainId ?? 0;
|
|
|
- $staffList = ShopAdminClass::getAllByCondition(['mainId' => $mainId], null, '*', null, true);
|
|
|
- if (!empty($staffList)) {
|
|
|
- foreach ($staffList as $staff) {
|
|
|
- $staffId = $staff->id ?? 0;
|
|
|
- $params = $cgId . '-' . $staffId;
|
|
|
- Yii::$app->redis->executeCommand('SADD', [$cacheKey, $params]);
|
|
|
- }
|
|
|
+ noticeUtil::push("bookSn:{$bookSn} 没有采购单需要分配货位", '15280215347');
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ foreach ($cgList as $cg) {
|
|
|
+ $connection = Yii::$app->db;
|
|
|
+ $transaction = $connection->beginTransaction();
|
|
|
+ try {
|
|
|
+ $respond = PurchaseOrderClass::assign($cg);
|
|
|
+ $transaction->commit();
|
|
|
+ $hasChange = $respond['hasChange'] ?? 0;
|
|
|
+ if ($hasChange == 1) {
|
|
|
+ //通知采购单页要刷新货位
|
|
|
+ $cacheKey = 'ghs_cg_order_staff_refresh_seat_' . $bookSn;
|
|
|
+ $mainId = $order->mainId ?? 0;
|
|
|
+ $staffList = ShopAdminClass::getAllByCondition(['mainId' => $mainId], null, '*', null, true);
|
|
|
+ if (!empty($staffList)) {
|
|
|
+ foreach ($staffList as $staff) {
|
|
|
+ $staffId = $staff->id ?? 0;
|
|
|
+ $params = $cgId . '-' . $staffId;
|
|
|
+ Yii::$app->redis->executeCommand('SADD', [$cacheKey, $params]);
|
|
|
}
|
|
|
- $cacheKey = 'ghs_cg_order_guest_refresh_seat_' . $bookSn;
|
|
|
- Yii::$app->redis->executeCommand('SADD', [$cacheKey, $cgId]);
|
|
|
}
|
|
|
- } catch (\Exception $exception) {
|
|
|
- $transaction->rollBack();
|
|
|
- noticeUtil::push("部分门店待入库采购单,重新分配货位出错,原因:" . $exception->getMessage(), '15280215347');
|
|
|
+ $cacheKey = 'ghs_cg_order_guest_refresh_seat_' . $bookSn;
|
|
|
+ Yii::$app->redis->executeCommand('SADD', [$cacheKey, $cgId]);
|
|
|
}
|
|
|
+ } catch (\Exception $exception) {
|
|
|
+ $transaction->rollBack();
|
|
|
+ noticeUtil::push("部分门店待入库采购单,重新分配货位出错,原因:" . $exception->getMessage(), '15280215347');
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
|