|
|
@@ -143,31 +143,34 @@ class TestController extends Controller
|
|
|
|
|
|
public function bindOrder()
|
|
|
{
|
|
|
- ini_set('max_execution_time',2500);
|
|
|
- ini_set('memory_limit','1526M');
|
|
|
- $models = Waybill::query()->whereNotNull("wms_bill_number")->whereNotIn("status",['已完结','无模型'])->get();
|
|
|
- foreach ($models as $model){
|
|
|
- $order = Order::query()->where("code",$model->wms_bill_number)->first();
|
|
|
- if ($order)$model->update(["order_id"=>$order->id]);
|
|
|
+ ini_set('max_execution_time', 2500);
|
|
|
+ ini_set('memory_limit', '1526M');
|
|
|
+ $models = Waybill::query()->whereNotNull("wms_bill_number")->whereNotIn("status", ['已完结', '无模型'])->get();
|
|
|
+ foreach ($models as $model) {
|
|
|
+ $order = Order::query()->where("code", $model->wms_bill_number)->first();
|
|
|
+ if ($order) $model->update(["order_id" => $order->id]);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
public function delRegion()
|
|
|
{
|
|
|
- dd(Region::query()->where("id",">=",404)->where("id","<=",432)->delete());
|
|
|
+ dd(Region::query()->where("id", ">=", 404)->where("id", "<=", 432)->delete());
|
|
|
}
|
|
|
public function tt1(){
|
|
|
dd(config('database.redis.options.prefix'));
|
|
|
}
|
|
|
- public function zzd(){
|
|
|
- ini_set('max_execution_time',2500);
|
|
|
- ini_set('memory_limit','1526M');
|
|
|
+
|
|
|
+ public function zzd()
|
|
|
+ {
|
|
|
+ ini_set('max_execution_time', 2500);
|
|
|
+ ini_set('memory_limit', '1526M');
|
|
|
$menus = [
|
|
|
- "A管理"=>[
|
|
|
- "A二级"=>[
|
|
|
+ "A管理" => [
|
|
|
+ "A二级" => [
|
|
|
"A三级"
|
|
|
]
|
|
|
],
|
|
|
- "B管理"=>[]
|
|
|
+ "B管理" => []
|
|
|
];
|
|
|
/*$authorities = [
|
|
|
"A管理"=>[
|
|
|
@@ -183,10 +186,10 @@ class TestController extends Controller
|
|
|
public function syncWeight()
|
|
|
{
|
|
|
$pack = OrderPackageCountingRecord::query()->get();
|
|
|
- foreach ($pack as $p){
|
|
|
+ foreach ($pack as $p) {
|
|
|
$yesterday = $p->targeted_at;
|
|
|
- Cache::pull("weight.".$yesterday);
|
|
|
- OrderPackageCountingRecord::query()->where("targeted_at",$yesterday)->delete();
|
|
|
+ Cache::pull("weight." . $yesterday);
|
|
|
+ OrderPackageCountingRecord::query()->where("targeted_at", $yesterday)->delete();
|
|
|
$sql = <<<sql
|
|
|
SELECT DATE_FORMAT(order_packages.created_at,'%Y-%m-%d') date,
|
|
|
SUM(CASE WHEN order_packages.weighed_at IS NOT NULL THEN 1 ELSE 0 END) AS count,
|
|
|
@@ -194,47 +197,47 @@ COUNT(1) total FROM order_packages LEFT JOIN orders ON order_packages.order_id=o
|
|
|
AND order_packages.created_at BETWEEN '{$yesterday} 00:00:00' AND '{$yesterday} 23:59:59' GROUP BY date
|
|
|
sql;
|
|
|
$result = DB::selectOne(DB::raw($sql));
|
|
|
- if (!$result)$obj = [
|
|
|
- "targeted_at" => $yesterday,
|
|
|
+ if (!$result) $obj = [
|
|
|
+ "targeted_at" => $yesterday,
|
|
|
"un_weigh_count" => 0,
|
|
|
- "total_count" => 0
|
|
|
+ "total_count" => 0
|
|
|
]; else $obj = [
|
|
|
- "targeted_at" => $result->date,
|
|
|
+ "targeted_at" => $result->date,
|
|
|
"un_weigh_count" => $result->count,
|
|
|
- "total_count" => $result->total,
|
|
|
+ "total_count" => $result->total,
|
|
|
];
|
|
|
/** @var \stdClass $model */
|
|
|
$model = OrderPackageCountingRecord::query()->create($obj);
|
|
|
- Cache::put("weight.".$yesterday,[
|
|
|
- "date"=>$yesterday,
|
|
|
- "total"=>$model->total_count,
|
|
|
- "count"=>$model->un_weigh_count,
|
|
|
- "value"=>$model->total_count ? intval(($model->un_weigh_count/$model->total_count)*100) : 0
|
|
|
+ Cache::put("weight." . $yesterday, [
|
|
|
+ "date" => $yesterday,
|
|
|
+ "total" => $model->total_count,
|
|
|
+ "count" => $model->un_weigh_count,
|
|
|
+ "value" => $model->total_count ? intval(($model->un_weigh_count / $model->total_count) * 100) : 0
|
|
|
]);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public function sync()
|
|
|
{
|
|
|
- ini_set('max_execution_time',2500);
|
|
|
- ini_set('memory_limit','1526M');
|
|
|
- foreach (Batch::query()->with("orders")->where("created_at",">","2021-01-20 15:00:00")->get() as $batch){
|
|
|
+ ini_set('max_execution_time', 2500);
|
|
|
+ ini_set('memory_limit', '1526M');
|
|
|
+ foreach (Batch::query()->with("orders")->where("created_at", ">", "2021-01-20 15:00:00")->get() as $batch) {
|
|
|
$order = [];
|
|
|
$map = [];
|
|
|
- foreach ($batch->orders as $o){
|
|
|
+ foreach ($batch->orders as $o) {
|
|
|
$order[] = $o->code;
|
|
|
$map[$o->code] = $o->id;
|
|
|
}
|
|
|
$sql = <<<sql
|
|
|
SELECT ORDERNO,WAVENO,SEQNO,EDITTIME FROM DOC_WAVE_DETAILS WHERE WAVENO = ? AND ORDERNO IN (''
|
|
|
sql;
|
|
|
- foreach($order as $o){
|
|
|
- $sql .= ",'".$o."'";
|
|
|
+ foreach ($order as $o) {
|
|
|
+ $sql .= ",'" . $o . "'";
|
|
|
}
|
|
|
$sql .= ")";
|
|
|
- $re = DB::connection("oracle")->select(DB::raw($sql),[$batch->code]);
|
|
|
- foreach ($re as $r){
|
|
|
- OrderBin::query()->firstOrCreate([
|
|
|
+ $re = DB::connection("oracle")->select(DB::raw($sql), [$batch->code]);
|
|
|
+ foreach ($re as $r) {
|
|
|
+ OrderBin::query()->firstOrCreate([
|
|
|
'order_id' => $map[$r->orderno],
|
|
|
'number' => $r->seqno,
|
|
|
]);
|
|
|
@@ -355,7 +358,7 @@ sql;
|
|
|
function t1(Request $request)
|
|
|
{
|
|
|
|
|
|
- $re=OracleDOCWaveDetails::query()->where('orderno', 'SO201230003574')->get('seqno')->first()['seqno'];
|
|
|
+ $re = OracleDOCWaveDetails::query()->where('orderno', 'SO201230003574')->get('seqno')->first()['seqno'];
|
|
|
dd($re);
|
|
|
}
|
|
|
|
|
|
@@ -1079,7 +1082,7 @@ where (commodities.owner_id,commodity_barcodes.code) in (select commodities.owne
|
|
|
|
|
|
public function reNewBatches3()
|
|
|
{
|
|
|
- $batches = Batch::query()->where('id','>', 84301)->get('code');
|
|
|
+ $batches = Batch::query()->where('id', '>', 84301)->get('code');
|
|
|
$batchCodes = $batches->map(function ($batch) {
|
|
|
return $batch['code'];
|
|
|
})->toArray();
|
|
|
@@ -1124,7 +1127,6 @@ where (commodities.owner_id,commodity_barcodes.code) in (select commodities.owne
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
public function testSyncOrderTask()
|
|
|
{
|
|
|
Cache::flush();
|
|
|
@@ -1160,8 +1162,6 @@ where (commodities.owner_id,commodity_barcodes.code) in (select commodities.owne
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
public function testUpdateSkuNameBarcodeToCommodity_id()
|
|
|
{
|
|
|
$amount = 1000;
|
|
|
@@ -1229,7 +1229,7 @@ where (commodities.owner_id,commodity_barcodes.code) in (select commodities.owne
|
|
|
// dump('hendle...');
|
|
|
dump((string)Carbon::now());
|
|
|
// dump(memory_get_usage() / 1024 / 1024);
|
|
|
- $task=new WasSyncWmsAsnInformation();
|
|
|
+ $task = new WasSyncWmsAsnInformation();
|
|
|
$task->handle();
|
|
|
dump((string)Carbon::now());
|
|
|
// dump('hendle...end');
|
|
|
@@ -1240,8 +1240,8 @@ where (commodities.owner_id,commodity_barcodes.code) in (select commodities.owne
|
|
|
|
|
|
public function editOrderSyncAt()
|
|
|
{
|
|
|
- ValueStore::query()->where('name','order_last_created_sync_at')->update(['value'=>'2020-12-22 09:00:00']);
|
|
|
- ValueStore::query()->where('name','order_last_updated_sync_at')->update(['value'=>'2020-12-22 09:00:00']);
|
|
|
+ ValueStore::query()->where('name', 'order_last_created_sync_at')->update(['value' => '2020-12-22 09:00:00']);
|
|
|
+ ValueStore::query()->where('name', 'order_last_updated_sync_at')->update(['value' => '2020-12-22 09:00:00']);
|
|
|
}
|
|
|
|
|
|
public function syncOrderTrackingTask()
|
|
|
@@ -1252,7 +1252,7 @@ where (commodities.owner_id,commodity_barcodes.code) in (select commodities.owne
|
|
|
$orderNos = OracleDOCOrderHeader::query()->selectRaw('orderno')
|
|
|
->where('addTime', '>=', $start_data)
|
|
|
->where('addTime', '<=', $end_data)
|
|
|
- ->get()->map(function($orderHeader){
|
|
|
+ ->get()->map(function ($orderHeader) {
|
|
|
return $orderHeader->orderno;
|
|
|
});
|
|
|
$order_no_list = $orderNos->chunk(3000);
|
|
|
@@ -1288,7 +1288,7 @@ where (commodities.owner_id,commodity_barcodes.code) in (select commodities.owne
|
|
|
$orderNos = OracleDOCOrderHeader::query()->selectRaw('orderno')
|
|
|
->where('addTime', '>=', $start_data)
|
|
|
->where('addTime', '<=', $end_data)
|
|
|
- ->get()->map(function($orderHeader){
|
|
|
+ ->get()->map(function ($orderHeader) {
|
|
|
return $orderHeader->orderno;
|
|
|
});
|
|
|
$order_no_list = $orderNos->chunk(3000);
|
|
|
@@ -1332,18 +1332,18 @@ where (commodities.owner_id,commodity_barcodes.code) in (select commodities.owne
|
|
|
foreach ($orderIssue_delete as $key => $order_issue) {
|
|
|
if ($order_issue->id == $order_issue_unique->id) continue;
|
|
|
$ids[] = $order_issue->id;
|
|
|
- if($order_issue['logistic_number_return'])$order_issue_unique['logistic_number_return'] =$order_issue['logistic_number_return'];
|
|
|
- if($order_issue['rejecting_status']!='未退回')$order_issue_unique['rejecting_status'] =$order_issue['rejecting_status'];
|
|
|
- if($order_issue['is_new_rejecting']!='无')$order_issue_unique['is_new_rejecting'] =$order_issue['is_new_rejecting'];
|
|
|
- if($order_issue['user_workgroup_id'])$order_issue_unique['user_workgroup_id'] =$order_issue['user_workgroup_id'];
|
|
|
- if($order_issue['imported_status']!='正常')$order_issue_unique['imported_status'] =$order_issue['imported_status'];
|
|
|
- if($order_issue['custom_code'])$order_issue_unique['custom_code'] =$order_issue['custom_code'];
|
|
|
+ if ($order_issue['logistic_number_return']) $order_issue_unique['logistic_number_return'] = $order_issue['logistic_number_return'];
|
|
|
+ if ($order_issue['rejecting_status'] != '未退回') $order_issue_unique['rejecting_status'] = $order_issue['rejecting_status'];
|
|
|
+ if ($order_issue['is_new_rejecting'] != '无') $order_issue_unique['is_new_rejecting'] = $order_issue['is_new_rejecting'];
|
|
|
+ if ($order_issue['user_workgroup_id']) $order_issue_unique['user_workgroup_id'] = $order_issue['user_workgroup_id'];
|
|
|
+ if ($order_issue['imported_status'] != '正常') $order_issue_unique['imported_status'] = $order_issue['imported_status'];
|
|
|
+ if ($order_issue['custom_code']) $order_issue_unique['custom_code'] = $order_issue['custom_code'];
|
|
|
}
|
|
|
$order_issue_unique->save();
|
|
|
app('LogService')->log(__METHOD__, __FUNCTION__, '修改OrderIssue:' . json_encode($order_issue_unique));
|
|
|
- $orderIssues = OrderIssue::query()->whereIn('id',$ids)->get();
|
|
|
- $bool = OrderIssue::query()->whereIn('id',$ids)->forceDelete();
|
|
|
- if($bool)app('LogService')->log(__METHOD__, __FUNCTION__, '删除OrderIssue:' . json_encode($orderIssues));
|
|
|
+ $orderIssues = OrderIssue::query()->whereIn('id', $ids)->get();
|
|
|
+ $bool = OrderIssue::query()->whereIn('id', $ids)->forceDelete();
|
|
|
+ if ($bool) app('LogService')->log(__METHOD__, __FUNCTION__, '删除OrderIssue:' . json_encode($orderIssues));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -1351,49 +1351,50 @@ where (commodities.owner_id,commodity_barcodes.code) in (select commodities.owne
|
|
|
{
|
|
|
/** @var OrderTrackingService $service */
|
|
|
$service = app(OrderTrackingService::class);
|
|
|
- $maxId= \App\OrderTracking::query()->orderByDesc('id')->first();
|
|
|
- $orderTracking_min = \App\OrderTracking::query()->where('logistic_id',0)->orderBy('id')->first();
|
|
|
- if(!$maxId)return;
|
|
|
+ $maxId = \App\OrderTracking::query()->orderByDesc('id')->first();
|
|
|
+ $orderTracking_min = \App\OrderTracking::query()->where('logistic_id', 0)->orderBy('id')->first();
|
|
|
+ if (!$maxId) return;
|
|
|
$maxId = $maxId->id;
|
|
|
- $minId= $orderTracking_min->id;
|
|
|
- $logistic = \App\Logistic::query()->where('name','新杰物流')->first();
|
|
|
- $logistic_zt = \App\Logistic::query()->where('name','自提')->first();
|
|
|
- for ($i=$minId;$i<= $maxId;$i+=100){
|
|
|
+ $minId = $orderTracking_min->id;
|
|
|
+ $logistic = \App\Logistic::query()->where('name', '新杰物流')->first();
|
|
|
+ $logistic_zt = \App\Logistic::query()->where('name', '自提')->first();
|
|
|
+ for ($i = $minId; $i <= $maxId; $i += 100) {
|
|
|
$orderTrackings = \App\OrderTracking::query()
|
|
|
- ->where('id','>=',$i)
|
|
|
- ->where('id','<=',$i+100)
|
|
|
- ->where('logistic_id','=',0)
|
|
|
- ->where('created_at','!=','0000-00-00 00:00:00')
|
|
|
+ ->where('id', '>=', $i)
|
|
|
+ ->where('id', '<=', $i + 100)
|
|
|
+ ->where('logistic_id', '=', 0)
|
|
|
+ ->where('created_at', '!=', '0000-00-00 00:00:00')
|
|
|
->get();
|
|
|
- if($orderTrackings->count() ==0) continue;
|
|
|
- $update_params = [['id','logistic_id']];
|
|
|
- $orderTrackings->each(function($orderTracking)use($logistic_zt,$logistic,&$update_params){
|
|
|
- $order =$orderTracking->commodities->package->order;
|
|
|
+ if ($orderTrackings->count() == 0) continue;
|
|
|
+ $update_params = [['id', 'logistic_id']];
|
|
|
+ $orderTrackings->each(function ($orderTracking) use ($logistic_zt, $logistic, &$update_params) {
|
|
|
+ $order = $orderTracking->commodities->package->order;
|
|
|
$logistic_id = $order->logistic_id;
|
|
|
- if($logistic_id!=null){
|
|
|
- if($order->logistic_id == $logistic_zt->id)$logistic_id = $logistic->id;
|
|
|
- if($logistic_id==0)dd($order,$logistic_id);
|
|
|
+ if ($logistic_id != null) {
|
|
|
+ if ($order->logistic_id == $logistic_zt->id) $logistic_id = $logistic->id;
|
|
|
+ if ($logistic_id == 0) dd($order, $logistic_id);
|
|
|
$update_params[] = [
|
|
|
'id' => $orderTracking->id,
|
|
|
'logistic_id' => $logistic_id,
|
|
|
];
|
|
|
}
|
|
|
});
|
|
|
- if(count($update_params) > 1){
|
|
|
+ if (count($update_params) > 1) {
|
|
|
$service->batchUpdate($update_params);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public function testHz(){
|
|
|
- dump('start'.Carbon::now()->toDateTimeString());
|
|
|
- $ownerAreaReportTask=new CreateOwnerAreaReport();
|
|
|
+ public function testHz()
|
|
|
+ {
|
|
|
+ dump('start' . Carbon::now()->toDateTimeString());
|
|
|
+ $ownerAreaReportTask = new CreateOwnerAreaReport();
|
|
|
$ownerAreaReportTask->handle();
|
|
|
- $ownerBillReportTask= new CreateOwnerBillReport();
|
|
|
+ $ownerBillReportTask = new CreateOwnerBillReport();
|
|
|
$ownerBillReportTask->handle();
|
|
|
- $ownerReportTask= new CreateOwnerReport();
|
|
|
+ $ownerReportTask = new CreateOwnerReport();
|
|
|
$ownerReportTask->handle();
|
|
|
- dump('end'.Carbon::now()->toDateTimeString());
|
|
|
+ dump('end' . Carbon::now()->toDateTimeString());
|
|
|
}
|
|
|
|
|
|
public function testGetLogisticNumbers(): array
|
|
|
@@ -1425,8 +1426,8 @@ where (commodities.owner_id,commodity_barcodes.code) in (select commodities.owne
|
|
|
public function logistic_route_sync_ZT()
|
|
|
{
|
|
|
$service = new LogisticZopService();
|
|
|
- $result = $service->get([]);
|
|
|
- dd($result);
|
|
|
+ $result = $service->get([]);
|
|
|
+ dd($result);
|
|
|
}
|
|
|
|
|
|
public function testCancelOrder()
|
|
|
@@ -1448,9 +1449,9 @@ where (commodities.owner_id,commodity_barcodes.code) in (select commodities.owne
|
|
|
|
|
|
public function processOrderIssueRejectedBill()
|
|
|
{
|
|
|
- OrderIssue::query()->withTrashed()->whereNotNull('logistic_number_return')->chunkById(200,function($orderIssues){
|
|
|
- $orderIssues->each(function($orderIssue){
|
|
|
- if($orderIssue->logistic_number_return)
|
|
|
+ OrderIssue::query()->withTrashed()->whereNotNull('logistic_number_return')->chunkById(200, function ($orderIssues) {
|
|
|
+ $orderIssues->each(function ($orderIssue) {
|
|
|
+ if ($orderIssue->logistic_number_return)
|
|
|
$orderIssue->rejectedBills()->syncWithoutDetaching([trim($orderIssue->logistic_number_return)]);
|
|
|
});
|
|
|
});
|
|
|
@@ -1478,40 +1479,40 @@ where (commodities.owner_id,commodity_barcodes.code) in (select commodities.owne
|
|
|
$orderHeaderService = new OracleDOCOrderHeaderService();
|
|
|
$orderTrackingService = new OrderTrackingService();
|
|
|
$query = $orderHeaderService->getQuery();
|
|
|
- $orderHeaders = $query->whereIn('Doc_Order_Header.customerid',['ONKYO','RUIHUO'])
|
|
|
- ->where('Doc_Order_Header.AddTime','>=',$start_at)
|
|
|
- ->where('Doc_Order_Header.AddTime','<=',$end_at)
|
|
|
+ $orderHeaders = $query->whereIn('Doc_Order_Header.customerid', ['ONKYO', 'RUIHUO'])
|
|
|
+ ->where('Doc_Order_Header.AddTime', '>=', $start_at)
|
|
|
+ ->where('Doc_Order_Header.AddTime', '<=', $end_at)
|
|
|
->get();
|
|
|
$orderTrackingService->updateByWmsOrderHeaders($orderHeaders);
|
|
|
}
|
|
|
|
|
|
public function updateOrderTracking()
|
|
|
{
|
|
|
- OrderTracking::query()->with(['commodities'=>function($query){
|
|
|
- $query->with(['commodity','package.order']);
|
|
|
+ OrderTracking::query()->with(['commodities' => function ($query) {
|
|
|
+ $query->with(['commodity', 'package.order']);
|
|
|
}])->whereNotNull('client')
|
|
|
- ->where('created_at','>=','2021-01-01')
|
|
|
- ->where('created_at','<=','2021-01-07')
|
|
|
- ->where('created_at','!=','0000-00-00 00:00:00')
|
|
|
- ->chunkById('200',function($orderTrackings){
|
|
|
+ ->where('created_at', '>=', '2021-01-01')
|
|
|
+ ->where('created_at', '<=', '2021-01-07')
|
|
|
+ ->where('created_at', '!=', '0000-00-00 00:00:00')
|
|
|
+ ->chunkById('200', function ($orderTrackings) {
|
|
|
/**
|
|
|
* @var DataHandlerService $dataService
|
|
|
*/
|
|
|
$service = new OrderTrackingService();
|
|
|
$update = [];
|
|
|
- $update[] = ['id','order_client_code_wms'];
|
|
|
+ $update[] = ['id', 'order_client_code_wms'];
|
|
|
foreach ($orderTrackings as $orderTracking) {
|
|
|
- if($orderTracking->commodities->order ?? false){
|
|
|
+ if ($orderTracking->commodities->order ?? false) {
|
|
|
$update = [
|
|
|
'id' => $orderTracking->id,
|
|
|
'order_client_code_wms' => $orderTracking->commodities->order->client_code
|
|
|
];
|
|
|
}
|
|
|
}
|
|
|
- if(count($update) > 1){
|
|
|
+ if (count($update) > 1) {
|
|
|
$service->batchUpdate($update);
|
|
|
}
|
|
|
- });
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
public function deleteOrderTracking()
|
|
|
@@ -1519,23 +1520,23 @@ where (commodities.owner_id,commodity_barcodes.code) in (select commodities.owne
|
|
|
$deleteId_arr = [];
|
|
|
$deleteCommoditiesId_arr = [];
|
|
|
OrderTracking::query()->with(['commodities.package'])
|
|
|
- ->where('created_at','!=','0000-00-00 00:00:00')
|
|
|
- ->chunkById('200',function($orderTrackings)use(&$deleteId_arr,&$deleteCommoditiesId_arr){
|
|
|
+ ->where('created_at', '!=', '0000-00-00 00:00:00')
|
|
|
+ ->chunkById('200', function ($orderTrackings) use (&$deleteId_arr, &$deleteCommoditiesId_arr) {
|
|
|
$deleteIds = [];
|
|
|
$deleteCommoditiesId = [];
|
|
|
foreach ($orderTrackings as $orderTracking) {
|
|
|
- if(!($orderTracking->commodities->package ?? false)){
|
|
|
- $deleteIds[] = $orderTracking->id;
|
|
|
- if($orderTracking->commodities){
|
|
|
+ if (!($orderTracking->commodities->package ?? false)) {
|
|
|
+ $deleteIds[] = $orderTracking->id;
|
|
|
+ if ($orderTracking->commodities) {
|
|
|
$deleteCommoditiesId[] = $orderTracking->commodities->id;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- if($deleteIds){
|
|
|
+ if ($deleteIds) {
|
|
|
$deleteId_arr[] = $deleteIds;
|
|
|
$deleteCommoditiesId_arr[] = $deleteCommoditiesId;
|
|
|
- OrderTracking::query()->whereIn('id',$deleteIds)->delete();
|
|
|
- OrderPackageCommodities::query()->whereIn('id',$deleteCommoditiesId)->delete();
|
|
|
+ OrderTracking::query()->whereIn('id', $deleteIds)->delete();
|
|
|
+ OrderPackageCommodities::query()->whereIn('id', $deleteCommoditiesId)->delete();
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
@@ -1556,38 +1557,38 @@ where (commodities.owner_id,commodity_barcodes.code) in (select commodities.owne
|
|
|
|
|
|
public function updateRejectBillCheckedStatus()
|
|
|
{
|
|
|
- $time=Carbon::parse("2021-01-22 00:00:00")->subDays(15)->toDateTimeString();
|
|
|
- $asnHeaders=OracleDOCASNHeader::query()
|
|
|
- ->where('addtime','>=',$time)
|
|
|
- ->select('asnno','addtime','edittime','customerid','notes','asnreference3')
|
|
|
+ $time = Carbon::parse("2021-01-22 00:00:00")->subDays(15)->toDateTimeString();
|
|
|
+ $asnHeaders = OracleDOCASNHeader::query()
|
|
|
+ ->where('addtime', '>=', $time)
|
|
|
+ ->select('asnno', 'addtime', 'edittime', 'customerid', 'notes', 'asnreference3')
|
|
|
->get();
|
|
|
- $chunks=$asnHeaders->chunk(1000);
|
|
|
+ $chunks = $asnHeaders->chunk(1000);
|
|
|
foreach ($chunks as $chunk) {
|
|
|
- /** @var RejectedBillService $rejectedBillService */
|
|
|
- $rejectedBillService=app(RejectedBillService::class);
|
|
|
- $updates = $rejectedBillService->getNeedUpdateCheckedStatusByWms($chunk);
|
|
|
- app(BatchUpdateService::class)->batchUpdate('rejected_bills', $updates);
|
|
|
+ /** @var RejectedBillService $rejectedBillService */
|
|
|
+ $rejectedBillService = app(RejectedBillService::class);
|
|
|
+ $updates = $rejectedBillService->getNeedUpdateCheckedStatusByWms($chunk);
|
|
|
+ app(BatchUpdateService::class)->batchUpdate('rejected_bills', $updates);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public function clearCancelledOrder()
|
|
|
{
|
|
|
- $wave_nos = ['W210129000248','W210202000216','W210202000251','W210202000216','W210202000282'];
|
|
|
- $order_nos = ['SO210129004112' , 'SO210202003333','SO210202003333','SO210202003236','SO210202003247','SO210202003719'];
|
|
|
+ $wave_nos = ['W210129000248', 'W210202000216', 'W210202000251', 'W210202000216', 'W210202000282'];
|
|
|
+ $order_nos = ['SO210129004112', 'SO210202003333', 'SO210202003333', 'SO210202003236', 'SO210202003247', 'SO210202003719'];
|
|
|
try {
|
|
|
- OracleDOCWaveDetails::query()->whereIn('WaveNo',$wave_nos)->whereIn('OrderNo', $order_nos)->delete();
|
|
|
- app('LogService')->log(__CLASS__, __METHOD__, 'Delete OracleDOCWaveDetails' . ' ' . json_encode($order_nos).json_encode($wave_nos));
|
|
|
+ OracleDOCWaveDetails::query()->whereIn('WaveNo', $wave_nos)->whereIn('OrderNo', $order_nos)->delete();
|
|
|
+ app('LogService')->log(__CLASS__, __METHOD__, 'Delete OracleDOCWaveDetails' . ' ' . json_encode($order_nos) . json_encode($wave_nos));
|
|
|
} catch (Exception $e) {
|
|
|
- app('LogService')->log(__CLASS__, __METHOD__,'Error clearCancelledOrder'.json_encode($order_nos).json_encode($wave_nos));
|
|
|
+ app('LogService')->log(__CLASS__, __METHOD__, 'Error clearCancelledOrder' . json_encode($order_nos) . json_encode($wave_nos));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public function syncOrderByWaveNo(Request $request)
|
|
|
{
|
|
|
$input = $request->input('wave');
|
|
|
- if(!$input){
|
|
|
- echo 'no wave code!';}
|
|
|
- else {
|
|
|
+ if (!$input) {
|
|
|
+ echo 'no wave code!';
|
|
|
+ } else {
|
|
|
echo 'syncing ' . $input;
|
|
|
return;
|
|
|
}
|
|
|
@@ -1595,27 +1596,28 @@ where (commodities.owner_id,commodity_barcodes.code) in (select commodities.owne
|
|
|
$orderService = new OrderService();
|
|
|
$waveNos = [$input];
|
|
|
$orderHeaders = OracleDOCOrderHeader::query()
|
|
|
- ->selectRaw(implode(',',OracleDOCOrderHeaderService::$columns))
|
|
|
- ->whereIn('WaveNo',$waveNos)
|
|
|
+ ->selectRaw(implode(',', OracleDOCOrderHeaderService::$columns))
|
|
|
+ ->whereIn('WaveNo', $waveNos)
|
|
|
->get();
|
|
|
$orderHeaderList = $orderHeaders->chunk(2000);
|
|
|
foreach ($orderHeaderList as $item) {
|
|
|
$item = $oracleDOCOrderHeaderService->loadMissing($item);
|
|
|
// $last_order = $item->first(); // 时间点靠后的
|
|
|
// $newest_orders = $item->where('addtime',$last_order->addtime);
|
|
|
- if( count($orderHeaders) >0){
|
|
|
+ if (count($orderHeaders) > 0) {
|
|
|
$orderService->syncOrder($item); // 同步订单
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
public function syncOrderByWaveNo2(Request $request)
|
|
|
{
|
|
|
$oracleDOCOrderHeaderService = new OracleDOCOrderHeaderService();
|
|
|
$orderService = new OrderService();
|
|
|
- $waveNos = ['W210220000010','W210220000009'];
|
|
|
+ $waveNos = ['W210220000010', 'W210220000009'];
|
|
|
$orderHeaders = OracleDOCOrderHeader::query()
|
|
|
- ->selectRaw(implode(',',OracleDOCOrderHeaderService::$columns))
|
|
|
- ->whereIn('WaveNo',$waveNos)
|
|
|
+ ->selectRaw(implode(',', OracleDOCOrderHeaderService::$columns))
|
|
|
+ ->whereIn('WaveNo', $waveNos)
|
|
|
->get();
|
|
|
$orderHeaderList = $orderHeaders->chunk(2000);
|
|
|
foreach ($orderHeaderList as $item) {
|
|
|
@@ -1626,15 +1628,29 @@ where (commodities.owner_id,commodity_barcodes.code) in (select commodities.owne
|
|
|
|
|
|
public function testUser()
|
|
|
{
|
|
|
- $procurementQuotations=ProcurementQuotation::query()
|
|
|
+ $procurementQuotations = ProcurementQuotation::query()
|
|
|
->with('procurement.ownerMaterial.material')
|
|
|
- ->where('status',0)
|
|
|
+ ->where('status', 0)
|
|
|
->whereNull('offer')
|
|
|
//->where('created_at','>=',Carbon::parse($now)->subHours(4))
|
|
|
//->where('created_at','<=',$now)
|
|
|
->get();
|
|
|
dd($procurementQuotations->toJson());
|
|
|
+ }
|
|
|
|
|
|
-
|
|
|
+ public function cleanLaborsCache()
|
|
|
+ {
|
|
|
+ $beginDate = now()->subYears(1)->startOfDay();
|
|
|
+ $now = now()->startOfDay();
|
|
|
+ $dateList = $beginDate->daysUntil($now, 1);
|
|
|
+ $count = 0;
|
|
|
+ foreach ($dateList as $date) {
|
|
|
+ $key = 'laborReportsCountingRecords_' . $date->toDateString() . '_' . '日';
|
|
|
+ $bool = Cache::forget($key);
|
|
|
+ if ($bool) {
|
|
|
+ $count++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return $count;
|
|
|
}
|
|
|
}
|