|
|
@@ -48,9 +48,9 @@ class PackageController extends Controller
|
|
|
if ($request->input('logistic_number')){
|
|
|
$packages=$this->preciseQuery('logistic_number',$request,$packages);
|
|
|
}
|
|
|
-/* if ($request->input('delivery_number')){
|
|
|
- $packages=$this->preciseQuery('delivery_number',$request,$packages);
|
|
|
- }*/
|
|
|
+ /* if ($request->input('delivery_number')){
|
|
|
+ $packages=$this->preciseQuery('delivery_number',$request,$packages);
|
|
|
+ }*/
|
|
|
if ($request->input('created_at_start')){
|
|
|
$created_at_start=$request->input('created_at_start')." 00:00:00";
|
|
|
$packages=$packages->where('created_at','>=',$created_at_start);
|
|
|
@@ -115,9 +115,27 @@ class PackageController extends Controller
|
|
|
$batch_number=strtoupper($request->input('batch_number'));
|
|
|
$order_code=$request->input('order_code');
|
|
|
$paper_box_id=$request->input('paper_box_id');
|
|
|
- $isSamePackBatch=$request->input('is_same_pack_batch');
|
|
|
+// $isSamePackBatch=$request->input('is_same_pack_batch');
|
|
|
if($logistic_number&&$batch_number)return redirect('package/create')->with('successError','录入失败!波次号和快递单号只能填一项!');
|
|
|
$package=null;
|
|
|
+ $successTip = '操作成功';
|
|
|
+
|
|
|
+ $accomplishToWMS=new Api\thirdPart\flux\PackageController();
|
|
|
+ if($batch_number){
|
|
|
+ $this->log(__METHOD__,'活动波次开始同步_'.__FUNCTION__,json_encode($package),Auth::user()['name']);
|
|
|
+// $this->syncBatch($package->batch_number,$weight,null,null,null,Carbon::now(),null);
|
|
|
+ if($package->isActivityBatch())
|
|
|
+ $package->unifyThisMeasureUnderBatch();
|
|
|
+ $result=$accomplishToWMS->markWMSOnBatch($batch_number,$weight);
|
|
|
+
|
|
|
+ if ($result['result']){
|
|
|
+ Controller::logS(__METHOD__,'SUCCESS_'.__FUNCTION__,'批量更改波次上传成功'.$batch_number);
|
|
|
+ return redirect('package/create')->with('successTip', $successTip);
|
|
|
+ }
|
|
|
+ Controller::logS(__METHOD__,'error_'.__FUNCTION__,'批量更改波次上传异常:'.$result['message'].$batch_number);
|
|
|
+ return redirect('package/create')->with('successError','录入失败!'.$result['message']);
|
|
|
+ }
|
|
|
+
|
|
|
if ($order_code){
|
|
|
$package=Package::where('order_code',$order_code)->first();
|
|
|
}else{
|
|
|
@@ -127,49 +145,26 @@ class PackageController extends Controller
|
|
|
$package=Package::where('logistic_number',$logistic_number)->first();
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- $accomplishToWMS=new Api\thirdPart\flux\PackageController();
|
|
|
- $result=$accomplishToWMS->markWMSOnBatch($batch_number,$weight);
|
|
|
- if ($result['result']){
|
|
|
- $newValues['status']='已上传';
|
|
|
- Controller::logS(__METHOD__,'SUCCESS_'.__FUNCTION__,'批量更改波次上传成功'.$batch_number);
|
|
|
- }else{
|
|
|
- $newValues['status']='上传异常';
|
|
|
- Controller::logS(__METHOD__,'error_'.__FUNCTION__,'批量更改波次上传异常:'.$result['message'].$batch_number);
|
|
|
- }
|
|
|
-
|
|
|
- if (!$result['result']){
|
|
|
- return redirect('package/create')->with('successError','录入失败!'.$result['message']);
|
|
|
- }
|
|
|
-
|
|
|
-// if (!$package && !$logistic_number)return redirect('package/create')->with('successError','录入失败!系统内没有对应波次的包裹!');
|
|
|
- $successTip = '操作成功';
|
|
|
+ if (!$package && !$logistic_number)return redirect('package/create')->with('successError','录入失败!系统内没有对应波次的包裹!');
|
|
|
if ($package){
|
|
|
- $accomplishToWMS=new Api\thirdPart\flux\PackageController();
|
|
|
- if ($isSamePackBatch||($package->batch_rule&&strstr($package->batch_rule,'组合'))){
|
|
|
- $this->log(__METHOD__,'活动波次开始同步_'.__FUNCTION__,json_encode($package),Auth::user()['name']);
|
|
|
- $this->syncBatch($package->batch_number,$weight,null,null,null,Carbon::now(),null);
|
|
|
+ if(!$package->batch_number)$package->batch_number=$batch_number;
|
|
|
+ if(!$package->order_code)$package->order_code=$order_code;
|
|
|
+ $package->fetchAllFromOracle();
|
|
|
+ $package->weight=$weight;
|
|
|
+ if(!$package->paper_box_id)$package->paper_box_id=$paper_box_id;
|
|
|
+ $result=$accomplishToWMS->accomplishToWMS($package);
|
|
|
+ if ($result['result']){
|
|
|
+ $package->status="已上传";
|
|
|
}else{
|
|
|
- if($batch_number){
|
|
|
- return redirect('package/create')->with('successError','录入失败!该波次不是组合提总!');
|
|
|
- }
|
|
|
- $package->weight=$weight;
|
|
|
- $package->paper_box_id=$paper_box_id;
|
|
|
- $package->batch_number=$batch_number;
|
|
|
- $package->order_code=$order_code;
|
|
|
- $result=$accomplishToWMS->accomplishToWMS($package);
|
|
|
- if ($result['result']){
|
|
|
- if ($package->status=="记录异常")$package->status="已上传异常";
|
|
|
- else $package->status="已上传";
|
|
|
- }else{
|
|
|
- $package->status="上传异常";
|
|
|
- }
|
|
|
+ $package->status="上传异常";
|
|
|
}
|
|
|
$package->save();
|
|
|
$this->log(__METHOD__,'create_'.__FUNCTION__,json_encode($package),Auth::user()['name']);
|
|
|
- event(new WeighedEvent($package));
|
|
|
+// event(new WeighedEvent($package));
|
|
|
}else{
|
|
|
- $this->syncBatch($batch_number,$weight,null,null,null,Carbon::now(),null);
|
|
|
+// $this->syncBatch($batch_number,$weight,null,null,null,Carbon::now(),null);
|
|
|
+ if($package->isActivityBatch())
|
|
|
+ $package->unifyThisMeasureUnderBatch();
|
|
|
$successTip = "批量录入波次成功!波次号:$batch_number";
|
|
|
}
|
|
|
return redirect('package/create')->with('successTip', $successTip);
|
|
|
@@ -364,47 +359,47 @@ class PackageController extends Controller
|
|
|
return $validator;
|
|
|
}
|
|
|
|
|
|
- public function syncBatch($batch_number,$weight,$max,$centre,$min,$date,$paperBox_id){
|
|
|
-// $accomplishToWMS=new Api\thirdPart\flux\PackageController();
|
|
|
-// $packageBatch=Package::where('batch_number',$batch_number)->first();
|
|
|
- $newValues = ['weight' => $weight];
|
|
|
- $newValues['batch_number']=$batch_number;
|
|
|
- if($max)$newValues['length']=$max;
|
|
|
- if($centre)$newValues['width']=$centre;
|
|
|
- if($min)$newValues['height']=$min;
|
|
|
- if($date)$newValues['weighed_at']=$date;
|
|
|
- if($paperBox_id)$newValues['paper_box_id']=$paperBox_id;
|
|
|
- if($max&&$centre&&$min){
|
|
|
- $newValues['bulk']=$max*$centre*$min;
|
|
|
- }
|
|
|
-// $weightChanged=$packageBatch['weight']!=$weight;
|
|
|
-// Package::where('batch_number',$batch_number)->update($newValues);
|
|
|
-// $packageBatch['forceUpload']=$weightChanged;
|
|
|
- Controller::logS(__METHOD__,__FUNCTION__,"批量更新时批次号传入:{$batch_number}");
|
|
|
-// $result=$accomplishToWMS->markWMSOnBatch($packageBatch['batch_number']);
|
|
|
-// if ($result['result']){
|
|
|
-// $newValues['status']='已上传';
|
|
|
-// Controller::logS(__METHOD__,'SUCCESS_'.__FUNCTION__,'批量更改波次上传成功'.json_encode($packageBatch));
|
|
|
-// }else{
|
|
|
-// $newValues['status']='上传异常';
|
|
|
-// Controller::logS(__METHOD__,'error_'.__FUNCTION__,'批量更改波次上传异常:'.$result['message'].json_encode($packageBatch));
|
|
|
-// }picktotraceid
|
|
|
- $packagesInOracle=OracleDOCWaveDetails::where('doc_wave_details.waveno',$batch_number)
|
|
|
- ->leftJoin('act_allocation_details','act_allocation_details.orderno','doc_wave_details.orderno')
|
|
|
- ->get();
|
|
|
- foreach ($packagesInOracle as $packageInOracle) {
|
|
|
- $newValues['logistic_number']=$packageInOracle['picktotraceid'];
|
|
|
- $package = Package::where('logistic_number', $packageInOracle['picktotraceid'])->first();
|
|
|
- if(!$package){
|
|
|
- Package::create($newValues);
|
|
|
- }else{
|
|
|
- $package->fill($newValues);
|
|
|
- $package->update();
|
|
|
- }
|
|
|
- }
|
|
|
-// Package::where('batch_number',$batch_number)->update($newValues);
|
|
|
-
|
|
|
- }
|
|
|
+// public function syncBatch($batch_number,$weight,$max,$centre,$min,$date,$paperBox_id){
|
|
|
+//// $accomplishToWMS=new Api\thirdPart\flux\PackageController();
|
|
|
+//// $packageBatch=Package::where('batch_number',$batch_number)->first();
|
|
|
+// $newValues = ['weight' => $weight];
|
|
|
+// $newValues['batch_number']=$batch_number;
|
|
|
+// if($max)$newValues['length']=$max;
|
|
|
+// if($centre)$newValues['width']=$centre;
|
|
|
+// if($min)$newValues['height']=$min;
|
|
|
+// if($date)$newValues['weighed_at']=$date;
|
|
|
+// if($paperBox_id)$newValues['paper_box_id']=$paperBox_id;
|
|
|
+// if($max&&$centre&&$min){
|
|
|
+// $newValues['bulk']=$max*$centre*$min;
|
|
|
+// }
|
|
|
+//// $weightChanged=$packageBatch['weight']!=$weight;
|
|
|
+//// Package::where('batch_number',$batch_number)->update($newValues);
|
|
|
+//// $packageBatch['forceUpload']=$weightChanged;
|
|
|
+// Controller::logS(__METHOD__,__FUNCTION__,"批量更新时批次号传入:{$batch_number}");
|
|
|
+//// $result=$accomplishToWMS->markWMSOnBatch($packageBatch['batch_number']);
|
|
|
+//// if ($result['result']){
|
|
|
+//// $newValues['status']='已上传';
|
|
|
+//// Controller::logS(__METHOD__,'SUCCESS_'.__FUNCTION__,'批量更改波次上传成功'.json_encode($packageBatch));
|
|
|
+//// }else{
|
|
|
+//// $newValues['status']='上传异常';
|
|
|
+//// Controller::logS(__METHOD__,'error_'.__FUNCTION__,'批量更改波次上传异常:'.$result['message'].json_encode($packageBatch));
|
|
|
+//// }picktotraceid
|
|
|
+// $packagesInOracle=OracleDOCWaveDetails::where('doc_wave_details.waveno',$batch_number)
|
|
|
+// ->leftJoin('act_allocation_details','act_allocation_details.orderno','doc_wave_details.orderno')
|
|
|
+// ->get();
|
|
|
+// foreach ($packagesInOracle as $packageInOracle) {
|
|
|
+// $newValues['logistic_number']=$packageInOracle['picktotraceid'];
|
|
|
+// $package = Package::where('logistic_number', $packageInOracle['picktotraceid'])->first();
|
|
|
+// if(!$package){
|
|
|
+// Package::create($newValues);
|
|
|
+// }else{
|
|
|
+// $package->fill($newValues);
|
|
|
+// $package->update();
|
|
|
+// }
|
|
|
+// }
|
|
|
+//// Package::where('batch_number',$batch_number)->update($newValues);
|
|
|
+//
|
|
|
+// }
|
|
|
|
|
|
public function statisticExport($packages,$owners,$logistics){
|
|
|
if (!$packages||!$owners||!$logistics) return;
|