|
|
@@ -296,6 +296,16 @@ class InitController extends Controller
|
|
|
$sql = 'UPDATE xhCg SET debtPrice=actPrice,remainDebtPrice=actPrice WHERE debt=1;';
|
|
|
Yii::$app->db->createCommand($sql)->execute();
|
|
|
|
|
|
+ $map = [];
|
|
|
+ $allShop = ShopClass::getAllByCondition(['id>' => 0], null, '*', null, true);
|
|
|
+ if (!empty($allShop)) {
|
|
|
+ foreach ($allShop as $single) {
|
|
|
+ $mainId = $single->mainId ?? 0;
|
|
|
+ $shopId = $single->id ?? 0;
|
|
|
+ $map[$shopId] = $mainId;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
//供应商的销售单 和 零售的退款单,老字段数据要迁到新字段数据上
|
|
|
$ghsSaleRefund = [];
|
|
|
@@ -305,6 +315,10 @@ class InitController extends Controller
|
|
|
foreach ($refundList as $key => $refund) {
|
|
|
$orderSn = $refund->orderSn ?? '';
|
|
|
$relateOrderSn = $refund->relateOrderSn ?? '';
|
|
|
+ $shopId = $refund->shopId ?? 0;
|
|
|
+ $mainId = $map[$shopId] ?? 0;
|
|
|
+ $refund->mainId = $mainId;
|
|
|
+ $refund->save();
|
|
|
if (empty($orderSn)) {
|
|
|
continue;
|
|
|
}
|
|
|
@@ -316,6 +330,7 @@ class InitController extends Controller
|
|
|
$refundItem->xhUnitType = 0;
|
|
|
$refundItem->xhUnitPrice = $refundItem->itemPrice;
|
|
|
$refundItem->xhPrice = bcmul($refundItem->itemPrice, $refundItem->itemNum, 2);
|
|
|
+ $refundItem->mainId = $mainId;
|
|
|
$refundItem->save();
|
|
|
$productId = $refundItem->productId ?? 0;
|
|
|
$ghsSaleRefund[$relateOrderSn][$productId] = floatval($refundItem->itemNum);
|
|
|
@@ -328,6 +343,10 @@ class InitController extends Controller
|
|
|
foreach ($cgRefundList as $cgRefund) {
|
|
|
$orderSn = $cgRefund->orderSn ?? '';
|
|
|
$cgId = $cgRefund->cgId ?? 0;
|
|
|
+ $shopId = $cgRefund->shopId ?? 0;
|
|
|
+ $mainId = $map[$shopId] ?? 0;
|
|
|
+ $cgRefund->mainId = $mainId;
|
|
|
+ $cgRefund->save();
|
|
|
if (empty($orderSn)) {
|
|
|
continue;
|
|
|
}
|
|
|
@@ -339,6 +358,7 @@ class InitController extends Controller
|
|
|
$cgItem->xhUnitType = 0;
|
|
|
$cgItem->xhUnitPrice = $cgItem->itemPrice;
|
|
|
$cgItem->xhPrice = bcmul($cgItem->itemPrice, $cgItem->itemNum, 2);
|
|
|
+ $cgItem->mainId = $mainId;
|
|
|
$cgItem->save();
|
|
|
$productId = $cgItem->productId ?? 0;
|
|
|
$hdCgRefund[$cgId][$productId] = floatval($cgItem->itemNum);
|
|
|
@@ -440,23 +460,13 @@ class InitController extends Controller
|
|
|
self::migrationDel();
|
|
|
|
|
|
//客户和供应商的中央化
|
|
|
- self::ghsCustomMain();
|
|
|
+ self::ghsCustomMain($map);
|
|
|
|
|
|
}
|
|
|
|
|
|
//客户和供应商的中央化 ssh 20220506
|
|
|
- public static function ghsCustomMain()
|
|
|
+ public static function ghsCustomMain($map)
|
|
|
{
|
|
|
- $map = [];
|
|
|
- $allShop = ShopClass::getAllByCondition(['id>' => 0], null, '*', null, true);
|
|
|
- if (!empty($allShop)) {
|
|
|
- foreach ($allShop as $single) {
|
|
|
- $mainId = $single->mainId ?? 0;
|
|
|
- $shopId = $single->id ?? 0;
|
|
|
- $map[$shopId] = $mainId;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
$customList = CustomClass::getAllByCondition(['id>' => 0], null, '*', null, true);
|
|
|
if (!empty($customList)) {
|
|
|
foreach ($customList as $custom) {
|