|
|
@@ -2,6 +2,8 @@
|
|
|
|
|
|
namespace console\controllers;
|
|
|
|
|
|
+use bizGhs\cg\classes\CgOrderClass;
|
|
|
+use bizGhs\order\classes\PurchaseOrderClass;
|
|
|
use common\components\noticeUtil;
|
|
|
use yii\console\Controller;
|
|
|
use Yii;
|
|
|
@@ -9,6 +11,7 @@ use Yii;
|
|
|
class BookController extends Controller
|
|
|
{
|
|
|
|
|
|
+ //全部待入库采购单重新分配货位 ssh 20240711
|
|
|
public function actionAssignSeat()
|
|
|
{
|
|
|
ini_set('memory_limit', '2045M');
|
|
|
@@ -18,19 +21,30 @@ class BookController extends Controller
|
|
|
if ($num <= 0) {
|
|
|
return false;
|
|
|
}
|
|
|
- if ($num > 20) {
|
|
|
- noticeUtil::push("assign seat all 已经超过20家了,请及时解决", '15280215347');
|
|
|
+ if ($num > 15) {
|
|
|
+ noticeUtil::push("assign seat all 已经超过15家了,请及时解决", '15280215347');
|
|
|
}
|
|
|
$list = Yii::$app->redis->executeCommand('SMEMBERS', [$cacheKey]);
|
|
|
if (empty($list)) {
|
|
|
return false;
|
|
|
}
|
|
|
- foreach ($list as $key => $val) {
|
|
|
- //$mainId . '_' . $bookSn
|
|
|
- $arr = explode('_', $val);
|
|
|
- $mainId = $arr[0];
|
|
|
- $bookSn = $arr[1];
|
|
|
- echo $mainId . ' ' . $bookSn . "\n";
|
|
|
+ Yii::$app->redis->executeCommand('DEL', [$cacheKey]);
|
|
|
+ Yii::$app->params['errorReport'] = 1;
|
|
|
+ foreach ($list as $key => $bookSn) {
|
|
|
+ $cgList = CgOrderClass::getAllByCondition(['book' => $bookSn, 'status' => 3], null, '*', null, true);
|
|
|
+ if (empty($cgList)) {
|
|
|
+ foreach ($cgList as $cg) {
|
|
|
+ $connection = Yii::$app->db;
|
|
|
+ $transaction = $connection->beginTransaction();
|
|
|
+ try {
|
|
|
+ PurchaseOrderClass::assign($cg);
|
|
|
+ $transaction->commit();
|
|
|
+ } catch (\Exception $exception) {
|
|
|
+ $transaction->rollBack();
|
|
|
+ noticeUtil::push("部分门店待入库采购单,重新分配货位出错,原因:" . $exception->getMessage(), '15280215347');
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|