|
|
@@ -182,7 +182,10 @@ class OrderController extends Controller
|
|
|
public function freezeAll(Request $request){
|
|
|
if(!Gate::allows('订单管理-编辑')){ return redirect(url('/')); }
|
|
|
$checkData=$request->input('checkData')??'';
|
|
|
- $orders=OracleDOCOrderHeader::whereIn('orderno',$checkData)->get();
|
|
|
+ //冻结条件只局限于 分配完成sostatus=40 创建订单sostatus=00 拣货完成sostatus=60 播种完成sostatus=61
|
|
|
+ $sostatus=['40','00','60','61'];
|
|
|
+ $orders=OracleDOCOrderHeader::select('OrderNo','SoStatus')->whereIn('orderno',$checkData)->whereIn('SoStatus',$sostatus)->get();
|
|
|
+ if(count($checkData)!=count($orders))return ['success'=>false,'fail_info'=>"勾选订单有不可冻结订单"];
|
|
|
foreach ($orders as $order){
|
|
|
$is_freeze=OracleDOCOrderHeader::where('orderno',$order->orderno)->update(['releasestatus'=>'H','waveno'=>'*']);
|
|
|
$this->log(__METHOD__,'批量冻结修改'.__FUNCTION__,json_encode($request->toArray()),Auth::user()['id']);
|
|
|
@@ -191,7 +194,7 @@ class OrderController extends Controller
|
|
|
OracleDOCWaveDetails::where('waveno',$waveno)->where('orderno',$order->orderno)->delete();
|
|
|
$this->log(__METHOD__,'批量冻结删除波次号'.__FUNCTION__,json_encode($request->toArray()),Auth::user()['id']);
|
|
|
}
|
|
|
- if (!$is_freeze)return ['success'=>'false','fail_info'=>"数据 {$order['orderno']} 更新失败"];
|
|
|
+ if (!$is_freeze)return ['success'=>false,'fail_info'=>"数据 {$order['orderno']} 更新失败"];
|
|
|
}
|
|
|
return ['success'=>true];
|
|
|
}
|
|
|
@@ -199,11 +202,13 @@ class OrderController extends Controller
|
|
|
public function deAllocationAll(Request $request){
|
|
|
if(!Gate::allows('订单管理-编辑')){ return redirect(url('/')); }
|
|
|
$checkData=$request->input('checkData')??'';
|
|
|
+ //取消分配条件只局限于 分配完成sostatus=40 和 部分分配sostatus=30
|
|
|
$sostatus=['30','40'];
|
|
|
// $orders=OracleDOCOrderHeader::select('OrderNo','SoStatus')->whereIn('orderno',$checkData)->where(function($query){
|
|
|
// $query->orWhere('SoStatus','30')->orWhere('SoStatus','40');
|
|
|
// })->toSql();
|
|
|
$orders=OracleDOCOrderHeader::select('OrderNo','SoStatus')->whereIn('orderno',$checkData)->whereIn('SoStatus',$sostatus)->get();
|
|
|
+ if(count($checkData)!=count($orders))return ['success'=>false,'fail_info'=>"勾选订单有不可取消分配订单"];
|
|
|
foreach ($orders as $order){
|
|
|
$is_deAllocation=$this->isDeAllocation($order->orderno);
|
|
|
$deAllocation=OracleDOCOrderHeader::where('orderno',$order->orderno)->update(['sostatus'=>'00','waveno'=>'*']);
|
|
|
@@ -213,7 +218,7 @@ class OrderController extends Controller
|
|
|
OracleDOCWaveDetails::where('waveno',$waveno)->where('orderno',$order->orderno)->delete();
|
|
|
$this->log(__METHOD__,'批量取消分配删除波次号'.__FUNCTION__,json_encode($request->toArray()),Auth::user()['id']);
|
|
|
}
|
|
|
- if (!$is_deAllocation||!$deAllocation)return ['success'=>'false','fail_info'=>"数据 {$order['orderno']} 更新失败"];
|
|
|
+ if (!$is_deAllocation||!$deAllocation)return ['success'=>false,'fail_info'=>"数据 {$order['orderno']} 更新失败"];
|
|
|
}
|
|
|
return ['success'=>true];
|
|
|
}
|