|
|
@@ -35,6 +35,8 @@ use biz\stat\classes\StatStockOutMonthClass;
|
|
|
use biz\stat\classes\StatWastClass;
|
|
|
use biz\stat\classes\StatWastMonthClass;
|
|
|
use bizGhs\cg\classes\CgClass;
|
|
|
+use bizGhs\clear\classes\ClearClass;
|
|
|
+use bizGhs\clear\models\Clear;
|
|
|
use bizGhs\custom\classes\CustomClass;
|
|
|
use bizGhs\item\classes\ItemClass;
|
|
|
use bizGhs\item\classes\ItemClassClass;
|
|
|
@@ -717,4 +719,30 @@ class InitController extends Controller
|
|
|
|
|
|
}
|
|
|
|
|
|
+ //结账单补数据
|
|
|
+ public function actionClear()
|
|
|
+ {
|
|
|
+ $query = new \yii\db\Query();
|
|
|
+ $query->from(Clear::tableName());
|
|
|
+ $query->where(['>', 'id', 0]);
|
|
|
+ $query->orderBy('addTime ASC');
|
|
|
+ foreach ($query->batch() as $clearBatch) {
|
|
|
+ $batchGhsId = array_column($clearBatch, 'ghsId');
|
|
|
+ $batchCustomId = array_column($clearBatch, 'customId');
|
|
|
+ $batchGhsId = array_unique(array_filter($batchGhsId));
|
|
|
+ $batchCustomId = array_unique(array_filter($batchCustomId));
|
|
|
+ $customInfo = CustomClass::getByIds($batchCustomId, null, 'id');
|
|
|
+ $ghsInfo = GhsClass::getByIds($batchGhsId, null, 'id');
|
|
|
+ foreach ($clearBatch as $clear) {
|
|
|
+ $id = $clear['id'];
|
|
|
+ $customId = $clear['customId'] ?? 0;
|
|
|
+ $ghsId = $clear['ghsId'] ?? 0;
|
|
|
+ $customShopId = $customInfo[$customId]['shopId'] ?? 0;
|
|
|
+ $ghsShopId = $ghsInfo[$ghsId]['shopId'] ?? 0;
|
|
|
+ $params = ['customShopId' => $customShopId, 'ghsShopId' => $ghsShopId];
|
|
|
+ ClearClass::updateById($id, $params);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|