| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- <?php
- namespace console\controllers;
- use bizGhs\order\classes\OrderClass;
- use bizGhs\order\classes\PurchaseOrderItemClass;
- use bizHd\purchase\classes\PurchaseClass;
- use bizHd\purchase\classes\PurchaseItemClass;
- use yii\console\Controller;
- use Yii;
- class CgController extends Controller
- {
- public function actionDebt()
- {
- ini_set('memory_limit', '2045M');
- set_time_limit(0);
- $list = OrderClass::getAllByCondition(['customId' => 16, 'debt' => 1], null, '*', null, true);
- foreach ($list as $order) {
- $xsdDebt = $order->remainDebtPrice ?? 0;
- $xsDOrderSn = $order->orderSn ?? '';
- $purchaseId = $order->purchaseId ?? 0;
- $cg = PurchaseClass::getById($purchaseId, true);
- $cgDebt = $cg->remainDebtPrice ?? 0;
- $cgOrderSn = $cg->orderSn ?? '';
- if (floatval($xsdDebt) != floatval($cgDebt)) {
- echo $xsDOrderSn . " 欠款有问题 " . floatval($xsdDebt) . ' ' . floatval($cgDebt) . ' ' . $cgOrderSn . "\n";
- }
- $order->remainDebtPrice = 0;
- $order->save();
- }
- }
- // ./yii cg/update
- public function actionUpdate()
- {
- ini_set('memory_limit', '2045M');
- set_time_limit(0);
- $list = PurchaseClass::getAllByCondition(['status' => 4], null, '*', null, true);
- if (!empty($list)) {
- foreach ($list as $order) {
- $orderSn = $order->orderSn ?? '';
- $ghsId = $order->ghsId ?? 0;
- $payTime = $order->payTime;
- $addTime = $order->addTime ?? '';
- if ($payTime == '0000-00-00 00:00:00') {
- $order->payTime = $addTime;
- $order->save();
- $payTime = $addTime;
- echo $orderSn . "确认时间设置为:" . $payTime . "\n";
- }
- PurchaseItemClass::updateByCondition(['orderSn' => $orderSn], ['payTime' => $payTime, 'ghsId' => $ghsId]);
- }
- }
- }
- //供货商 ./yii cg/ghs-cg-update
- public function actionGhsCgUpdate()
- {
- $list = PurchaseOrderItemClass::getAllByCondition([], null, '*', null, true);
- if (!empty($list)) {
- foreach ($list as $key => $val) {
- $itemInfo = $val->itemInfo ?? '';
- if (empty($itemInfo)) {
- continue;
- }
- $arr = json_decode($itemInfo, true);
- $name = $arr['itemName'] ?? '';
- $cover = $arr['itemCover'] ?? '';
- $num = $val->itemNum ?? 0;
- $bigPrice = $val->bigPrice ?? 0;
- $totalPrice = bcmul($bigPrice, $num, 2);
- $val->name = $name;
- $val->cover = $cover;
- $val->totalPrice = $totalPrice;
- $val->save();
- echo "id:" . $val->id . "\n";
- }
- }
- }
- }
|