| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110 |
- <?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->debt = 0;
- $order->save();
- $cg->remainDebtPrice = 0;
- $cg->debt = 2;
- $cg->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";
- }
- }
- }
- //更新名称和封面 ssh 20230317
- public function actionUpdateName()
- {
- ini_set('memory_limit', '2045M');
- set_time_limit(0);
- $list = PurchaseItemClass::getAllByCondition(['id>' => 0], 'id DESC', '*', null, true);
- if (!empty($list)) {
- foreach ($list as $item) {
- $info = $item->itemInfo;
- if (!empty($info)) {
- $arr = json_decode($info, true);
- $name = $arr['itemName'] ?? '';
- $cover = $arr['itemCover'] ?? '';
- if (!empty($name)) {
- $item->name = $name;
- $item->cover = $cover;
- $item->save();
- }
- }
- }
- }
- }
- }
|