Commit b864540e by 杨树贤

数据修复

parent 8fa1cfa0
Showing with 16 additions and 7 deletions
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
namespace App\Http\Services; namespace App\Http\Services;
//后台用户相关信息服务 //后台用户相关信息服务
use App\Http\Models\StockInModel;
use App\Http\Transformers\SupplierContactTransformer; use App\Http\Transformers\SupplierContactTransformer;
use App\Http\Transformers\SupplierTransformer; use App\Http\Transformers\SupplierTransformer;
use App\Model\BigData\DataManageModel; use App\Model\BigData\DataManageModel;
...@@ -12,6 +11,7 @@ use App\Model\IntracodeModel; ...@@ -12,6 +11,7 @@ use App\Model\IntracodeModel;
use App\Model\LogModel; use App\Model\LogModel;
use App\Model\Purchase\PurchaseOrderModel; use App\Model\Purchase\PurchaseOrderModel;
use App\Model\Purchase\StockInItemModel; use App\Model\Purchase\StockInItemModel;
use App\Model\Purchase\StockInModel;
use App\Model\RedisModel; use App\Model\RedisModel;
use App\Model\SkuUploadLogModel; use App\Model\SkuUploadLogModel;
use App\Model\StandardBrandModel; use App\Model\StandardBrandModel;
...@@ -1215,14 +1215,22 @@ class DataService ...@@ -1215,14 +1215,22 @@ class DataService
public function getDeletedSZStockInItemList() public function getDeletedSZStockInItemList()
{ {
$todayTime = Carbon::now()->startOfDay()->timestamp; $todayTime = Carbon::now()->startOfDay()->timestamp;
//->where('item_status',-3)
$stockInItems = StockInItemModel::where('create_time','>',$todayTime)->where('item_status',-3)->whereHas('stock_in', function ($q) { $stockInItems = StockInItemModel::where('create_time','>',$todayTime)->where('item_status',-3)->whereHas('stock_in', function ($q) {
$q->whereIn('stock_in_type', [3]); $q->whereIn('stock_in_type', [3]);
}) })->get()->toArray();
->get()->toArray(); dd(count($stockInItems));
foreach ($stockInItems as $stockInItem) { foreach ($stockInItems as $stockInItem) {
$stockIn = \DB::connection('purchase')->table('stock_in')->where('stock_in_id',$stockInItem['stock_in_id'])->first()->toArray(); $first = $stockInItem['stock_in_item_id'];
dump($stockInItem); dd($first,$stockInItem['stock_in_id']);
StockInItemModel::where('stock_in_item_id',$first)->update([
'item_status' => 1
]);
StockInModel::where('stock_in_id',$stockInItem['stock_in_id'])->update([
'erp_stock_in_sn'=> '',
'status' => 1
]);
} }
dd(array_column($stockInItems,'stock_in_item_id')); dd(count((array_column($stockInItems,'stock_in_item_id'))));
} }
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment