|
@@ -11,6 +11,7 @@ use App\CommodityBarcode;
|
|
|
use App\Events\CancelOrder;
|
|
use App\Events\CancelOrder;
|
|
|
use App\Log;
|
|
use App\Log;
|
|
|
use App\Logistic;
|
|
use App\Logistic;
|
|
|
|
|
+use App\LogisticTiming;
|
|
|
use App\OracleActAllocationDetails;
|
|
use App\OracleActAllocationDetails;
|
|
|
use App\OracleBasCode;
|
|
use App\OracleBasCode;
|
|
|
use App\OracleBasSKU;
|
|
use App\OracleBasSKU;
|
|
@@ -29,8 +30,11 @@ use App\Package;
|
|
|
use App\Process;
|
|
use App\Process;
|
|
|
use App\ProcessDaily;
|
|
use App\ProcessDaily;
|
|
|
use App\ProcessStatistic;
|
|
use App\ProcessStatistic;
|
|
|
|
|
+use App\Province;
|
|
|
use App\RejectedBill;
|
|
use App\RejectedBill;
|
|
|
use App\RejectedBillItem;
|
|
use App\RejectedBillItem;
|
|
|
|
|
+use App\Services\CityService;
|
|
|
|
|
+use App\Services\CommodityService;
|
|
|
use App\Services\common\BatchUpdateService;
|
|
use App\Services\common\BatchUpdateService;
|
|
|
use App\Services\common\DataHandlerService;
|
|
use App\Services\common\DataHandlerService;
|
|
|
use App\Services\InventoryCompareService;
|
|
use App\Services\InventoryCompareService;
|
|
@@ -104,10 +108,10 @@ class TestController extends Controller
|
|
|
{
|
|
{
|
|
|
/** @var OrderPackageService $orderPackageService */
|
|
/** @var OrderPackageService $orderPackageService */
|
|
|
$orderPackageService = app('orderPackageService');
|
|
$orderPackageService = app('orderPackageService');
|
|
|
- $ids = [741,739,738,736,735,733,732,731,730,729,728,725,724,723,721,720,719,718,717,715,714,713,712,711,710,705,703,702,701,700,699,698,696,694,693,692,691,690];
|
|
|
|
|
- $orderIssues = OrderIssue::query()->whereIn('id',$ids)->get();
|
|
|
|
|
- $order_ids = data_get($orderIssues,'*.order_id');
|
|
|
|
|
- $orders = Order::query()->whereIn('id',$order_ids)->get();
|
|
|
|
|
|
|
+ $ids = [741, 739, 738, 736, 735, 733, 732, 731, 730, 729, 728, 725, 724, 723, 721, 720, 719, 718, 717, 715, 714, 713, 712, 711, 710, 705, 703, 702, 701, 700, 699, 698, 696, 694, 693, 692, 691, 690];
|
|
|
|
|
+ $orderIssues = OrderIssue::query()->whereIn('id', $ids)->get();
|
|
|
|
|
+ $order_ids = data_get($orderIssues, '*.order_id');
|
|
|
|
|
+ $orders = Order::query()->whereIn('id', $order_ids)->get();
|
|
|
foreach ($orders as $item) {
|
|
foreach ($orders as $item) {
|
|
|
$orderPackageService->createdByOrder($item);
|
|
$orderPackageService->createdByOrder($item);
|
|
|
}
|
|
}
|
|
@@ -130,34 +134,36 @@ class TestController extends Controller
|
|
|
Cache::put('storedTest', $today);
|
|
Cache::put('storedTest', $today);
|
|
|
return "cacheing:'$today'<script>localStorage.setItem('storedTest','{$today}')</script>";
|
|
return "cacheing:'$today'<script>localStorage.setItem('storedTest','{$today}')</script>";
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
function getCache(Request $request)
|
|
function getCache(Request $request)
|
|
|
{
|
|
{
|
|
|
- $cache=Cache::get('storedTest');
|
|
|
|
|
|
|
+ $cache = Cache::get('storedTest');
|
|
|
return "cacheing get:'$cache'<script>document.write('<br>localStorage:'+localStorage.getItem('storedTest'))</script>";
|
|
return "cacheing get:'$cache'<script>document.write('<br>localStorage:'+localStorage.getItem('storedTest'))</script>";
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
function t1(Request $request)
|
|
function t1(Request $request)
|
|
|
{
|
|
{
|
|
|
{
|
|
{
|
|
|
- $username=config('database.connections.oracle.username');
|
|
|
|
|
- $password=config('database.connections.oracle.password');
|
|
|
|
|
- $host=config('database.connections.oracle.host');
|
|
|
|
|
- $service_name=config('database.connections.oracle.service_name');
|
|
|
|
|
- $conn=oci_connect($username,$password,$host.'/'.$service_name); //连接oracle数据库
|
|
|
|
|
- $IN_WarehouseID='';
|
|
|
|
|
- $IN_TraceID='' ;
|
|
|
|
|
- $IN_WavenNo='';
|
|
|
|
|
- $IN_UserID='';
|
|
|
|
|
- $IN_Language='';
|
|
|
|
|
- $OUT_Return_Code='';
|
|
|
|
|
- $sql_sp="begin SPCUS_EDI_WCS001(:IN_WarehouseID,:IN_Process_Action_C,:IN_Process_By_C,
|
|
|
|
|
|
|
+ $username = config('database.connections.oracle.username');
|
|
|
|
|
+ $password = config('database.connections.oracle.password');
|
|
|
|
|
+ $host = config('database.connections.oracle.host');
|
|
|
|
|
+ $service_name = config('database.connections.oracle.service_name');
|
|
|
|
|
+ $conn = oci_connect($username, $password, $host . '/' . $service_name); //连接oracle数据库
|
|
|
|
|
+ $IN_WarehouseID = '';
|
|
|
|
|
+ $IN_TraceID = '';
|
|
|
|
|
+ $IN_WavenNo = '';
|
|
|
|
|
+ $IN_UserID = '';
|
|
|
|
|
+ $IN_Language = '';
|
|
|
|
|
+ $OUT_Return_Code = '';
|
|
|
|
|
+ $sql_sp = "begin SPCUS_EDI_WCS001(:IN_WarehouseID,:IN_Process_Action_C,:IN_Process_By_C,
|
|
|
:IN_WaveNO_C,:IN_OrderNO_C,:IN_OrderLineNO_C,:IN_AllocationDetailsID,:IN_Language,:IN_UserID,:OUT_Return_Code); end;";
|
|
:IN_WaveNO_C,:IN_OrderNO_C,:IN_OrderLineNO_C,:IN_AllocationDetailsID,:IN_Language,:IN_UserID,:OUT_Return_Code); end;";
|
|
|
$stmt = oci_parse($conn, $sql_sp);
|
|
$stmt = oci_parse($conn, $sql_sp);
|
|
|
- oci_bind_by_name($stmt,':IN_Warehouse',$IN_WarehouseID);
|
|
|
|
|
- oci_bind_by_name($stmt,':IN_TraceID',$IN_TraceID);
|
|
|
|
|
- oci_bind_by_name($stmt,':IN_WavenNo',$IN_WavenNo);
|
|
|
|
|
- oci_bind_by_name($stmt,':IN_Language',$IN_Language);
|
|
|
|
|
- oci_bind_by_name($stmt,':IN_UserID',$IN_UserID);
|
|
|
|
|
- oci_bind_by_name($stmt,':OUT_Return_Code',$OUT_Return_Code);
|
|
|
|
|
|
|
+ oci_bind_by_name($stmt, ':IN_Warehouse', $IN_WarehouseID);
|
|
|
|
|
+ oci_bind_by_name($stmt, ':IN_TraceID', $IN_TraceID);
|
|
|
|
|
+ oci_bind_by_name($stmt, ':IN_WavenNo', $IN_WavenNo);
|
|
|
|
|
+ oci_bind_by_name($stmt, ':IN_Language', $IN_Language);
|
|
|
|
|
+ oci_bind_by_name($stmt, ':IN_UserID', $IN_UserID);
|
|
|
|
|
+ oci_bind_by_name($stmt, ':OUT_Return_Code', $OUT_Return_Code);
|
|
|
return oci_execute($stmt);
|
|
return oci_execute($stmt);
|
|
|
|
|
|
|
|
}
|
|
}
|
|
@@ -168,7 +174,7 @@ class TestController extends Controller
|
|
|
|
|
|
|
|
function packageT(Request $request)
|
|
function packageT(Request $request)
|
|
|
{
|
|
{
|
|
|
- $package=Package::where('created_at','<','2020-07-08')->whereNotNull('logistic_number')->first();
|
|
|
|
|
|
|
+ $package = Package::where('created_at', '<', '2020-07-08')->whereNotNull('logistic_number')->first();
|
|
|
$package->fetchLogistic();
|
|
$package->fetchLogistic();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -182,27 +188,29 @@ class TestController extends Controller
|
|
|
|
|
|
|
|
public function tj2(Request $request)
|
|
public function tj2(Request $request)
|
|
|
{
|
|
{
|
|
|
- $numbersesOfBatch=OracleDOCWaveDetails::select('picktotraceid as logistic_number','act_allocation_details.orderno')->where('doc_wave_details.waveno','W190630000042')
|
|
|
|
|
- ->leftJoin('act_allocation_details','doc_wave_details.orderno','act_allocation_details.orderno')->get();
|
|
|
|
|
-
|
|
|
|
|
- $oneIdxAsrsReceive=OracleDocOrderPackingSummary::where('traceid',$numbersesOfBatch[0]['logistic_number'])->first();
|
|
|
|
|
- if(!$oneIdxAsrsReceive){
|
|
|
|
|
- $inserts='';
|
|
|
|
|
- $values=[];
|
|
|
|
|
- foreach($numbersesOfBatch as $numbers){
|
|
|
|
|
|
|
+ $numbersesOfBatch = OracleDOCWaveDetails::select('picktotraceid as logistic_number', 'act_allocation_details.orderno')->where('doc_wave_details.waveno', 'W190630000042')
|
|
|
|
|
+ ->leftJoin('act_allocation_details', 'doc_wave_details.orderno', 'act_allocation_details.orderno')->get();
|
|
|
|
|
+
|
|
|
|
|
+ $oneIdxAsrsReceive = OracleDocOrderPackingSummary::where('traceid', $numbersesOfBatch[0]['logistic_number'])->first();
|
|
|
|
|
+ if (!$oneIdxAsrsReceive) {
|
|
|
|
|
+ $inserts = '';
|
|
|
|
|
+ $values = [];
|
|
|
|
|
+ foreach ($numbersesOfBatch as $numbers) {
|
|
|
$inserts .= " into doc_order_packing_summary (traceid,orderno,grossweight,addwho,addtime,editwho,edittime)values(?,?,?,?,?,?,?) ";
|
|
$inserts .= " into doc_order_packing_summary (traceid,orderno,grossweight,addwho,addtime,editwho,edittime)values(?,?,?,?,?,?,?) ";
|
|
|
- $values[] = $numbers['logistic_number']??'';
|
|
|
|
|
- $values[] = $numbers['orderno']??'';
|
|
|
|
|
|
|
+ $values[] = $numbers['logistic_number'] ?? '';
|
|
|
|
|
+ $values[] = $numbers['orderno'] ?? '';
|
|
|
$values[] = 12;
|
|
$values[] = 12;
|
|
|
$values[] = 'WAS';
|
|
$values[] = 'WAS';
|
|
|
$values[] = Carbon::now();
|
|
$values[] = Carbon::now();
|
|
|
$values[] = 'WAS';
|
|
$values[] = 'WAS';
|
|
|
$values[] = Carbon::now();
|
|
$values[] = Carbon::now();
|
|
|
}
|
|
}
|
|
|
- DB::connection('oracle')->insert("insert all {$inserts} select * from dual",$values);
|
|
|
|
|
- }else{
|
|
|
|
|
- $logisticNumbers=$numbersesOfBatch->map(function($numbers){return $numbers['logistic_number'];});
|
|
|
|
|
- OracleDocOrderPackingSummary::whereIn('traceid',$logisticNumbers)->update(['grossweight'=>32]);
|
|
|
|
|
|
|
+ DB::connection('oracle')->insert("insert all {$inserts} select * from dual", $values);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ $logisticNumbers = $numbersesOfBatch->map(function ($numbers) {
|
|
|
|
|
+ return $numbers['logistic_number'];
|
|
|
|
|
+ });
|
|
|
|
|
+ OracleDocOrderPackingSummary::whereIn('traceid', $logisticNumbers)->update(['grossweight' => 32]);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -217,49 +225,50 @@ class TestController extends Controller
|
|
|
'doc_order_header.customerid',
|
|
'doc_order_header.customerid',
|
|
|
'doc_order_header.Consigneename'
|
|
'doc_order_header.Consigneename'
|
|
|
];
|
|
];
|
|
|
- if(''){
|
|
|
|
|
- $resultOracleObj=OracleDOCOrderHeader::select($fields)->where('orderno','SO200603004708');
|
|
|
|
|
- }else{
|
|
|
|
|
- $resultOracleObj=OracleActAllocationDetails::select($fields);
|
|
|
|
|
- $resultOracleObj->where('picktotraceid','546152742096');
|
|
|
|
|
- $resultOracleObj->leftJoin('DOC_Order_Header','act_allocation_details.orderno','doc_order_header.orderno');
|
|
|
|
|
|
|
+ if ('') {
|
|
|
|
|
+ $resultOracleObj = OracleDOCOrderHeader::select($fields)->where('orderno', 'SO200603004708');
|
|
|
|
|
+ } else {
|
|
|
|
|
+ $resultOracleObj = OracleActAllocationDetails::select($fields);
|
|
|
|
|
+ $resultOracleObj->where('picktotraceid', '546152742096');
|
|
|
|
|
+ $resultOracleObj->leftJoin('DOC_Order_Header', 'act_allocation_details.orderno', 'doc_order_header.orderno');
|
|
|
}
|
|
}
|
|
|
- $_temOracleInfo=$resultOracleObj->first();
|
|
|
|
|
|
|
+ $_temOracleInfo = $resultOracleObj->first();
|
|
|
|
|
|
|
|
dd($_temOracleInfo);
|
|
dd($_temOracleInfo);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- public function mergerPackageData(){
|
|
|
|
|
- ini_set('max_execution_time',36000);
|
|
|
|
|
- ini_set('memory_limit','1526M');
|
|
|
|
|
|
|
+ public function mergerPackageData()
|
|
|
|
|
+ {
|
|
|
|
|
+ ini_set('max_execution_time', 36000);
|
|
|
|
|
+ ini_set('memory_limit', '1526M');
|
|
|
$number = 3000;
|
|
$number = 3000;
|
|
|
$start_at = 1;
|
|
$start_at = 1;
|
|
|
- $sum = Package::query()->where('id','>', $start_at)->count();
|
|
|
|
|
|
|
+ $sum = Package::query()->where('id', '>', $start_at)->count();
|
|
|
$len = ceil($sum / $number);
|
|
$len = ceil($sum / $number);
|
|
|
$id = $start_at;
|
|
$id = $start_at;
|
|
|
- for ($i = 1;$i <= $len; $i++){
|
|
|
|
|
- $packages = Package::query()->orderBy('id')->where('id','>',$id)->limit($number)->get();
|
|
|
|
|
|
|
+ for ($i = 1; $i <= $len; $i++) {
|
|
|
|
|
+ $packages = Package::query()->orderBy('id')->where('id', '>', $id)->limit($number)->get();
|
|
|
$error = [];
|
|
$error = [];
|
|
|
- foreach ($packages as $package){
|
|
|
|
|
|
|
+ foreach ($packages as $package) {
|
|
|
/** @var $service OrderPackageService */
|
|
/** @var $service OrderPackageService */
|
|
|
$service = app('orderPackageService');
|
|
$service = app('orderPackageService');
|
|
|
- $orderPackage = $service->firstOrCreate($package->logistic_number,
|
|
|
|
|
- ['batch_number'=>$package->batch_number,
|
|
|
|
|
- 'batch_rule'=>$package->batch_rule,
|
|
|
|
|
- 'bulk'=>$package->bulk,
|
|
|
|
|
- 'weight'=>$package->weight,
|
|
|
|
|
- 'length'=>$package->length,
|
|
|
|
|
- 'width'=>$package->width,
|
|
|
|
|
- 'height'=>$package->height,
|
|
|
|
|
- 'paper_box_id'=>$package->paper_box_id,
|
|
|
|
|
- 'measuring_machine_id'=>$package->measuring_machine_id,
|
|
|
|
|
- 'weighed_at'=>$package->weighed_at,
|
|
|
|
|
- 'status'=>$package->status]);
|
|
|
|
|
- if (!$orderPackage)array_push($error,$package->id);
|
|
|
|
|
|
|
+ $orderPackage = $service->firstOrCreate($package->logistic_number,
|
|
|
|
|
+ ['batch_number' => $package->batch_number,
|
|
|
|
|
+ 'batch_rule' => $package->batch_rule,
|
|
|
|
|
+ 'bulk' => $package->bulk,
|
|
|
|
|
+ 'weight' => $package->weight,
|
|
|
|
|
+ 'length' => $package->length,
|
|
|
|
|
+ 'width' => $package->width,
|
|
|
|
|
+ 'height' => $package->height,
|
|
|
|
|
+ 'paper_box_id' => $package->paper_box_id,
|
|
|
|
|
+ 'measuring_machine_id' => $package->measuring_machine_id,
|
|
|
|
|
+ 'weighed_at' => $package->weighed_at,
|
|
|
|
|
+ 'status' => $package->status]);
|
|
|
|
|
+ if (!$orderPackage) array_push($error, $package->id);
|
|
|
}
|
|
}
|
|
|
- LogService::log(__METHOD__,"同步时WMS中未找到这些订单",json_encode($error));
|
|
|
|
|
- $id = $packages[count($packages)-1]->id;
|
|
|
|
|
- echo $number.' a bunch done at:'.now()->toFormattedDateString().'<br>';
|
|
|
|
|
|
|
+ LogService::log(__METHOD__, "同步时WMS中未找到这些订单", json_encode($error));
|
|
|
|
|
+ $id = $packages[count($packages) - 1]->id;
|
|
|
|
|
+ echo $number . ' a bunch done at:' . now()->toFormattedDateString() . '<br>';
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -334,112 +343,117 @@ class TestController extends Controller
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- function test(){
|
|
|
|
|
|
|
+ function test()
|
|
|
|
|
+ {
|
|
|
$ids = [];
|
|
$ids = [];
|
|
|
- $logs = Log::query()->select('description')->where('type','同步时WMS中未找到这些订单')->get();
|
|
|
|
|
- foreach ($logs as $log){
|
|
|
|
|
|
|
+ $logs = Log::query()->select('description')->where('type', '同步时WMS中未找到这些订单')->get();
|
|
|
|
|
+ foreach ($logs as $log) {
|
|
|
$arr = [];
|
|
$arr = [];
|
|
|
- eval("\$arr = ".$log->description.'; ');
|
|
|
|
|
- if (count($arr) < 1)continue;
|
|
|
|
|
- $ids = array_merge($ids,$arr);
|
|
|
|
|
|
|
+ eval("\$arr = " . $log->description . '; ');
|
|
|
|
|
+ if (count($arr) < 1) continue;
|
|
|
|
|
+ $ids = array_merge($ids, $arr);
|
|
|
}
|
|
}
|
|
|
$ids = array_unique($ids);
|
|
$ids = array_unique($ids);
|
|
|
$error = [];
|
|
$error = [];
|
|
|
- foreach($ids as $id){
|
|
|
|
|
|
|
+ foreach ($ids as $id) {
|
|
|
$package = Package::query()->find($id);
|
|
$package = Package::query()->find($id);
|
|
|
/** @var OrderPackageService */
|
|
/** @var OrderPackageService */
|
|
|
- $orderPackage = app('orderPackageService')->firstOrCreate($package->logistic_number,
|
|
|
|
|
- ['batch_number'=>$package->batch_number,
|
|
|
|
|
- 'batch_rule'=>$package->batch_rule,
|
|
|
|
|
- 'bulk'=>$package->bulk,
|
|
|
|
|
- 'weight'=>$package->weight,
|
|
|
|
|
- 'length'=>$package->length,
|
|
|
|
|
- 'width'=>$package->width,
|
|
|
|
|
- 'height'=>$package->height,
|
|
|
|
|
- 'paper_box_id'=>$package->paper_box_id,
|
|
|
|
|
- 'measuring_machine_id'=>$package->measuring_machine_id,
|
|
|
|
|
- 'weighed_at'=>$package->weighed_at,
|
|
|
|
|
- 'status'=>$package->status]);
|
|
|
|
|
- if (!$orderPackage)array_push($error,$package->id);
|
|
|
|
|
|
|
+ $orderPackage = app('orderPackageService')->firstOrCreate($package->logistic_number,
|
|
|
|
|
+ ['batch_number' => $package->batch_number,
|
|
|
|
|
+ 'batch_rule' => $package->batch_rule,
|
|
|
|
|
+ 'bulk' => $package->bulk,
|
|
|
|
|
+ 'weight' => $package->weight,
|
|
|
|
|
+ 'length' => $package->length,
|
|
|
|
|
+ 'width' => $package->width,
|
|
|
|
|
+ 'height' => $package->height,
|
|
|
|
|
+ 'paper_box_id' => $package->paper_box_id,
|
|
|
|
|
+ 'measuring_machine_id' => $package->measuring_machine_id,
|
|
|
|
|
+ 'weighed_at' => $package->weighed_at,
|
|
|
|
|
+ 'status' => $package->status]);
|
|
|
|
|
+ if (!$orderPackage) array_push($error, $package->id);
|
|
|
}
|
|
}
|
|
|
- if (count($error) > 0)LogService::log(__METHOD__,"同步时WMS中未找到这些订单_two",json_encode($error));
|
|
|
|
|
|
|
+ if (count($error) > 0) LogService::log(__METHOD__, "同步时WMS中未找到这些订单_two", json_encode($error));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- function test1(){
|
|
|
|
|
|
|
+ function test1()
|
|
|
|
|
+ {
|
|
|
$statistics = ProcessStatistic::query()->whereNull('revenue')->get();
|
|
$statistics = ProcessStatistic::query()->whereNull('revenue')->get();
|
|
|
- $id = array_column($statistics->toArray(),'process_id');
|
|
|
|
|
- $processes = Process::query()->where(function (Builder $query){
|
|
|
|
|
- $query->where('status','待交接')->orWhere('status','交接完成');
|
|
|
|
|
- })->whereIn('id',$id)->get();
|
|
|
|
|
|
|
+ $id = array_column($statistics->toArray(), 'process_id');
|
|
|
|
|
+ $processes = Process::query()->where(function (Builder $query) {
|
|
|
|
|
+ $query->where('status', '待交接')->orWhere('status', '交接完成');
|
|
|
|
|
+ })->whereIn('id', $id)->get();
|
|
|
$sign_end = true;
|
|
$sign_end = true;
|
|
|
- foreach ($processes as $process){
|
|
|
|
|
- if (count($process->processDailies)>0){
|
|
|
|
|
- $completed_amount=0;
|
|
|
|
|
- foreach ($process->processDailies as $processDaily){
|
|
|
|
|
- $completed_amount=$completed_amount+($processDaily->output);
|
|
|
|
|
|
|
+ foreach ($processes as $process) {
|
|
|
|
|
+ if (count($process->processDailies) > 0) {
|
|
|
|
|
+ $completed_amount = 0;
|
|
|
|
|
+ foreach ($process->processDailies as $processDaily) {
|
|
|
|
|
+ $completed_amount = $completed_amount + ($processDaily->output);
|
|
|
}
|
|
}
|
|
|
- $process->completed_amount=$completed_amount;
|
|
|
|
|
|
|
+ $process->completed_amount = $completed_amount;
|
|
|
}
|
|
}
|
|
|
//统计:
|
|
//统计:
|
|
|
- $revenue=($process->unit_price)*($process->completed_amount); //收入合计
|
|
|
|
|
- $processDailies=ProcessDaily::with('processDailyParticipants')->where('process_id',$process->id)->where('output','>',0)->get();
|
|
|
|
|
- $duration_days=count($processDailies); //完成天数
|
|
|
|
|
- $duration_man_hours=0; //总工时
|
|
|
|
|
- $total_cost=0; //合计成本
|
|
|
|
|
- foreach ($processDailies as $processDailyOne){
|
|
|
|
|
- foreach ($processDailyOne->processDailyParticipants as $processDailyParticipant){
|
|
|
|
|
|
|
+ $revenue = ($process->unit_price) * ($process->completed_amount); //收入合计
|
|
|
|
|
+ $processDailies = ProcessDaily::with('processDailyParticipants')->where('process_id', $process->id)->where('output', '>', 0)->get();
|
|
|
|
|
+ $duration_days = count($processDailies); //完成天数
|
|
|
|
|
+ $duration_man_hours = 0; //总工时
|
|
|
|
|
+ $total_cost = 0; //合计成本
|
|
|
|
|
+ foreach ($processDailies as $processDailyOne) {
|
|
|
|
|
+ foreach ($processDailyOne->processDailyParticipants as $processDailyParticipant) {
|
|
|
if (!$processDailyParticipant->unit_price && !$processDailyParticipant->hour_price) continue;
|
|
if (!$processDailyParticipant->unit_price && !$processDailyParticipant->hour_price) continue;
|
|
|
$duration_man_hours += $processDailyParticipant->hour_count;
|
|
$duration_man_hours += $processDailyParticipant->hour_count;
|
|
|
- if ($processDailyParticipant->unit_count){
|
|
|
|
|
- $total_cost += ($processDailyParticipant->unit_count)*($processDailyParticipant->unit_price);
|
|
|
|
|
|
|
+ if ($processDailyParticipant->unit_count) {
|
|
|
|
|
+ $total_cost += ($processDailyParticipant->unit_count) * ($processDailyParticipant->unit_price);
|
|
|
continue;
|
|
continue;
|
|
|
}
|
|
}
|
|
|
- $total_cost += ($processDailyParticipant->hour_count)*($processDailyParticipant->hour_price);
|
|
|
|
|
|
|
+ $total_cost += ($processDailyParticipant->hour_count) * ($processDailyParticipant->hour_price);
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
- $processStatistic=ProcessStatistic::query()->find($process->id);
|
|
|
|
|
- $processStatistic->revenue=$revenue;
|
|
|
|
|
- $processStatistic->duration_days=$duration_days;
|
|
|
|
|
- $processStatistic->duration_man_hours=$duration_man_hours;
|
|
|
|
|
|
|
+ $processStatistic = ProcessStatistic::query()->find($process->id);
|
|
|
|
|
+ $processStatistic->revenue = $revenue;
|
|
|
|
|
+ $processStatistic->duration_days = $duration_days;
|
|
|
|
|
+ $processStatistic->duration_man_hours = $duration_man_hours;
|
|
|
if ($sign_end) $processStatistic->ended_at = date('Y-m-d H:i:s');
|
|
if ($sign_end) $processStatistic->ended_at = date('Y-m-d H:i:s');
|
|
|
- if (!$revenue || !$total_cost){
|
|
|
|
|
|
|
+ if (!$revenue || !$total_cost) {
|
|
|
$processStatistic->update();
|
|
$processStatistic->update();
|
|
|
continue;
|
|
continue;
|
|
|
}
|
|
}
|
|
|
- $gross_profit=$revenue-$total_cost; //毛利润
|
|
|
|
|
- if ($gross_profit!=0)$gross_profit_rate=$gross_profit/$revenue; //毛利率;
|
|
|
|
|
- else $gross_profit_rate=0;
|
|
|
|
|
- $processStatistic->total_cost=$total_cost;
|
|
|
|
|
- $processStatistic->gross_profit=$gross_profit;
|
|
|
|
|
- $processStatistic->gross_profit_rate=$gross_profit_rate;
|
|
|
|
|
|
|
+ $gross_profit = $revenue - $total_cost; //毛利润
|
|
|
|
|
+ if ($gross_profit != 0) $gross_profit_rate = $gross_profit / $revenue; //毛利率;
|
|
|
|
|
+ else $gross_profit_rate = 0;
|
|
|
|
|
+ $processStatistic->total_cost = $total_cost;
|
|
|
|
|
+ $processStatistic->gross_profit = $gross_profit;
|
|
|
|
|
+ $processStatistic->gross_profit_rate = $gross_profit_rate;
|
|
|
$processStatistic->update();
|
|
$processStatistic->update();
|
|
|
- $this->log(__METHOD__,"修改二次加工单统计单_".__FUNCTION__,json_encode($processStatistic),Auth::user()['id']);
|
|
|
|
|
|
|
+ $this->log(__METHOD__, "修改二次加工单统计单_" . __FUNCTION__, json_encode($processStatistic), Auth::user()['id']);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- private function cleanBarcode(){
|
|
|
|
|
|
|
+ private function cleanBarcode()
|
|
|
|
|
+ {
|
|
|
|
|
|
|
|
- $logCommodityBarcodes = CommodityBarcode::query()->where('code',"")->get();
|
|
|
|
|
- if (count($logCommodityBarcodes) > 0)LogService::log(__METHOD__,"纠正商品-删除空条码",json_encode($logCommodityBarcodes,JSON_UNESCAPED_UNICODE));
|
|
|
|
|
|
|
+ $logCommodityBarcodes = CommodityBarcode::query()->where('code', "")->get();
|
|
|
|
|
+ if (count($logCommodityBarcodes) > 0) LogService::log(__METHOD__, "纠正商品-删除空条码", json_encode($logCommodityBarcodes, JSON_UNESCAPED_UNICODE));
|
|
|
|
|
|
|
|
- CommodityBarcode::query()->where('code',"")->delete();
|
|
|
|
|
|
|
+ CommodityBarcode::query()->where('code', "")->delete();
|
|
|
$barcodes = DB::select(DB::raw('select * from commodity_barcodes c
|
|
$barcodes = DB::select(DB::raw('select * from commodity_barcodes c
|
|
|
where (c.code,c.commodity_id) in (select code,commodity_id from commodity_barcodes group by code,commodity_id having count(*) > 1) order by commodity_id'));
|
|
where (c.code,c.commodity_id) in (select code,commodity_id from commodity_barcodes group by code,commodity_id having count(*) > 1) order by commodity_id'));
|
|
|
$barcodeMap = [];
|
|
$barcodeMap = [];
|
|
|
$barcodeDelete = [];
|
|
$barcodeDelete = [];
|
|
|
- foreach ($barcodes as $barcode){
|
|
|
|
|
- if (isset($barcodeMap[$barcode->code.'_'.$barcode->commodity_id]))$barcodeDelete[] = $barcode->id;
|
|
|
|
|
- else $barcodeMap[$barcode->code.'_'.$barcode->commodity_id] = $barcode->id;
|
|
|
|
|
|
|
+ foreach ($barcodes as $barcode) {
|
|
|
|
|
+ if (isset($barcodeMap[$barcode->code . '_' . $barcode->commodity_id])) $barcodeDelete[] = $barcode->id;
|
|
|
|
|
+ else $barcodeMap[$barcode->code . '_' . $barcode->commodity_id] = $barcode->id;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- $logCommodityBarcodes = CommodityBarcode::query()->whereIn('id',$barcodeDelete)->get();
|
|
|
|
|
- if (count($logCommodityBarcodes) > 0)LogService::log(__METHOD__,"纠正商品-删除重复条码",json_encode($logCommodityBarcodes,JSON_UNESCAPED_UNICODE));
|
|
|
|
|
|
|
+ $logCommodityBarcodes = CommodityBarcode::query()->whereIn('id', $barcodeDelete)->get();
|
|
|
|
|
+ if (count($logCommodityBarcodes) > 0) LogService::log(__METHOD__, "纠正商品-删除重复条码", json_encode($logCommodityBarcodes, JSON_UNESCAPED_UNICODE));
|
|
|
|
|
|
|
|
CommodityBarcode::destroy($barcodeDelete);
|
|
CommodityBarcode::destroy($barcodeDelete);
|
|
|
}
|
|
}
|
|
|
- public function correctCommodity(){
|
|
|
|
|
- ini_set('max_execution_time',2500);
|
|
|
|
|
- ini_set('memory_limit','1526M');
|
|
|
|
|
|
|
+
|
|
|
|
|
+ public function correctCommodity()
|
|
|
|
|
+ {
|
|
|
|
|
+ ini_set('max_execution_time', 2500);
|
|
|
|
|
+ ini_set('memory_limit', '1526M');
|
|
|
//清理冗余条码
|
|
//清理冗余条码
|
|
|
$this->cleanBarcode();
|
|
$this->cleanBarcode();
|
|
|
|
|
|
|
@@ -451,58 +465,58 @@ where (commodities.owner_id,commodity_barcodes.code) in (select commodities.owne
|
|
|
$commodityMap = [];
|
|
$commodityMap = [];
|
|
|
//需要删除项
|
|
//需要删除项
|
|
|
$commodityDelete = [];
|
|
$commodityDelete = [];
|
|
|
- foreach ($commodities as $index => $commodity){
|
|
|
|
|
- $commodity->barcode_code=strtolower(trim($commodity->barcode_code));
|
|
|
|
|
|
|
+ foreach ($commodities as $index => $commodity) {
|
|
|
|
|
+ $commodity->barcode_code = strtolower(trim($commodity->barcode_code));
|
|
|
//货主+条码 为唯一key值 设想正常数据下同货主不应该有同条码
|
|
//货主+条码 为唯一key值 设想正常数据下同货主不应该有同条码
|
|
|
- $key = $commodity->owner_id.'_'.$commodity->barcode_code;
|
|
|
|
|
|
|
+ $key = $commodity->owner_id . '_' . $commodity->barcode_code;
|
|
|
//使用map池对比为重复数据
|
|
//使用map池对比为重复数据
|
|
|
- if(isset($commodityMap[$key])){
|
|
|
|
|
|
|
+ if (isset($commodityMap[$key])) {
|
|
|
//获取下标指针指向的源数据
|
|
//获取下标指针指向的源数据
|
|
|
$c = $commodities[$commodityMap[$key]];
|
|
$c = $commodities[$commodityMap[$key]];
|
|
|
//源数据不符合规范,当前数据替换掉它
|
|
//源数据不符合规范,当前数据替换掉它
|
|
|
- if (($c->sku == null || $c->sku == "") && ($commodity->sku != null && $commodity->sku != "")){
|
|
|
|
|
|
|
+ if (($c->sku == null || $c->sku == "") && ($commodity->sku != null && $commodity->sku != "")) {
|
|
|
$commodityDelete[] = $commodityMap[$key];
|
|
$commodityDelete[] = $commodityMap[$key];
|
|
|
$commodityMap[$key] = $index;
|
|
$commodityMap[$key] = $index;
|
|
|
- }else{
|
|
|
|
|
|
|
+ } else {
|
|
|
//当前数据比源数据更符合预期,替换掉
|
|
//当前数据比源数据更符合预期,替换掉
|
|
|
- if (($c->sku == $commodity->sku) && (strlen($c->name) < strlen($commodity->name))){
|
|
|
|
|
|
|
+ if (($c->sku == $commodity->sku) && (strlen($c->name) < strlen($commodity->name))) {
|
|
|
$commodityDelete[] = $commodityMap[$key];
|
|
$commodityDelete[] = $commodityMap[$key];
|
|
|
$commodityMap[$key] = $index;
|
|
$commodityMap[$key] = $index;
|
|
|
- }else{
|
|
|
|
|
|
|
+ } else {
|
|
|
//扔进处理池
|
|
//扔进处理池
|
|
|
$commodityDelete[] = $index;
|
|
$commodityDelete[] = $index;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- //第一次出现的新数据,val为下标,当作指针指向源数据
|
|
|
|
|
- }else $commodityMap[$key] = $index;
|
|
|
|
|
|
|
+ //第一次出现的新数据,val为下标,当作指针指向源数据
|
|
|
|
|
+ } else $commodityMap[$key] = $index;
|
|
|
}
|
|
}
|
|
|
$createBarcodes = []; //批量生成条码
|
|
$createBarcodes = []; //批量生成条码
|
|
|
$deleteCommodities = []; //批量删除商品及商品条码
|
|
$deleteCommodities = []; //批量删除商品及商品条码
|
|
|
|
|
|
|
|
$updateCommodities = [];
|
|
$updateCommodities = [];
|
|
|
- foreach ($commodityDelete as $index){
|
|
|
|
|
|
|
+ foreach ($commodityDelete as $index) {
|
|
|
//获取到被处理数据 与 目标数据
|
|
//获取到被处理数据 与 目标数据
|
|
|
$del = $commodities[$index];
|
|
$del = $commodities[$index];
|
|
|
- $target = $commodities[$commodityMap[$del->owner_id.'_'.$del->barcode_code]];
|
|
|
|
|
|
|
+ $target = $commodities[$commodityMap[$del->owner_id . '_' . $del->barcode_code]];
|
|
|
|
|
|
|
|
//记录ID删除商品与条码
|
|
//记录ID删除商品与条码
|
|
|
$deleteCommodities[] = $del->commodity_id;
|
|
$deleteCommodities[] = $del->commodity_id;
|
|
|
|
|
|
|
|
//有效条码合并
|
|
//有效条码合并
|
|
|
$barcodes = DB::select(DB::raw("select * from
|
|
$barcodes = DB::select(DB::raw("select * from
|
|
|
- (select * from commodity_barcodes where commodity_id = ".$del->commodity_id.")a
|
|
|
|
|
|
|
+ (select * from commodity_barcodes where commodity_id = " . $del->commodity_id . ")a
|
|
|
where (select count(1) as num from commodity_barcodes b
|
|
where (select count(1) as num from commodity_barcodes b
|
|
|
- where commodity_id = ".$target->commodity_id." and b.code = a.code) = 0"));
|
|
|
|
|
- if (count($barcodes) > 0){
|
|
|
|
|
- foreach ($barcodes as $barcode){
|
|
|
|
|
- $createBarcodes[] = ['code'=>$barcode->code, 'commodity_id'=>$target->commodity_id];
|
|
|
|
|
|
|
+ where commodity_id = " . $target->commodity_id . " and b.code = a.code) = 0"));
|
|
|
|
|
+ if (count($barcodes) > 0) {
|
|
|
|
|
+ foreach ($barcodes as $barcode) {
|
|
|
|
|
+ $createBarcodes[] = ['code' => $barcode->code, 'commodity_id' => $target->commodity_id];
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
$updateCommodities[$del->commodity_id] = $target->commodity_id;
|
|
$updateCommodities[$del->commodity_id] = $target->commodity_id;
|
|
|
}
|
|
}
|
|
|
- if (count($updateCommodities) > 0){
|
|
|
|
|
- $targets=array_chunk($updateCommodities,1000);
|
|
|
|
|
- foreach($targets as $targetCommodities){
|
|
|
|
|
|
|
+ if (count($updateCommodities) > 0) {
|
|
|
|
|
+ $targets = array_chunk($updateCommodities, 1000);
|
|
|
|
|
+ foreach ($targets as $targetCommodities) {
|
|
|
app('inventoryAccountMissionService')->batchUpdateItself('commodity_id', $targetCommodities);//批量更新库存盘点任务
|
|
app('inventoryAccountMissionService')->batchUpdateItself('commodity_id', $targetCommodities);//批量更新库存盘点任务
|
|
|
app('inventoryCompareService')->batchUpdateItself('commodity_id', $targetCommodities);//批量更新库存对比
|
|
app('inventoryCompareService')->batchUpdateItself('commodity_id', $targetCommodities);//批量更新库存对比
|
|
|
app('inventoryDailyLogService')->batchUpdateItself('commodity_id', $targetCommodities);//批量更新库存每日记录
|
|
app('inventoryDailyLogService')->batchUpdateItself('commodity_id', $targetCommodities);//批量更新库存每日记录
|
|
@@ -512,33 +526,28 @@ where (commodities.owner_id,commodity_barcodes.code) in (select commodities.owne
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- if (count($createBarcodes) > 0)LogService::log(__METHOD__,"纠正商品-录入合并条码",json_encode(data_get($createBarcodes,'*.id'),JSON_UNESCAPED_UNICODE));
|
|
|
|
|
|
|
+ if (count($createBarcodes) > 0) LogService::log(__METHOD__, "纠正商品-录入合并条码", json_encode(data_get($createBarcodes, '*.id'), JSON_UNESCAPED_UNICODE));
|
|
|
|
|
|
|
|
CommodityBarcode::query()->insert($createBarcodes);
|
|
CommodityBarcode::query()->insert($createBarcodes);
|
|
|
- $logCommodityBarcodes = CommodityBarcode::query()->whereIn('commodity_id',$deleteCommodities)->get();
|
|
|
|
|
- if (count($logCommodityBarcodes) > 0)LogService::log(__METHOD__,"纠正商品-删除无用商品条码",json_encode(data_get($logCommodityBarcodes,'*.id'),JSON_UNESCAPED_UNICODE));
|
|
|
|
|
|
|
+ $logCommodityBarcodes = CommodityBarcode::query()->whereIn('commodity_id', $deleteCommodities)->get();
|
|
|
|
|
+ if (count($logCommodityBarcodes) > 0) LogService::log(__METHOD__, "纠正商品-删除无用商品条码", json_encode(data_get($logCommodityBarcodes, '*.id'), JSON_UNESCAPED_UNICODE));
|
|
|
|
|
|
|
|
- CommodityBarcode::query()->whereIn('commodity_id',$deleteCommodities)->delete();
|
|
|
|
|
|
|
+ CommodityBarcode::query()->whereIn('commodity_id', $deleteCommodities)->delete();
|
|
|
|
|
|
|
|
// $logCommodities = Commodity::query()->whereIn('id',$deleteCommodities)->get();
|
|
// $logCommodities = Commodity::query()->whereIn('id',$deleteCommodities)->get();
|
|
|
- if (count($deleteCommodities) > 0)LogService::log(__METHOD__,"纠正商品-删除无用商品",json_encode($deleteCommodities,JSON_UNESCAPED_UNICODE));
|
|
|
|
|
|
|
+ if (count($deleteCommodities) > 0) LogService::log(__METHOD__, "纠正商品-删除无用商品", json_encode($deleteCommodities, JSON_UNESCAPED_UNICODE));
|
|
|
|
|
|
|
|
Commodity::destroy($deleteCommodities);
|
|
Commodity::destroy($deleteCommodities);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-
|
|
|
|
|
- public function test2(){
|
|
|
|
|
- $processes = Process::query()->where('status','交接完成')->get();
|
|
|
|
|
- $ids = array_column($processes->toArray(),'id');
|
|
|
|
|
- $processStatistics = ProcessStatistic::query()->whereIn('process_id',$ids)->whereNull('total_cost')->whereNull('gross_profit')->whereNull('gross_profit_rate')->get();
|
|
|
|
|
- LogService::log(__METHOD__,'更正成本利润',json_encode($processStatistics));
|
|
|
|
|
- foreach ($processStatistics as $p){
|
|
|
|
|
- $p->update([
|
|
|
|
|
- 'total_cost'=>0,
|
|
|
|
|
- 'gross_profit'=>$p->revenue,
|
|
|
|
|
- 'gross_profit_rate'=>1
|
|
|
|
|
- ]);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ public function test2()
|
|
|
|
|
+ {
|
|
|
|
|
+ $owner = Owner::where('name', 'B站')->first();
|
|
|
|
|
+ $commodities = Commodity::query()->where('owner_id', $owner->id)->get();
|
|
|
|
|
+ $comID = array_column($commodities->toArray(), 'id');
|
|
|
|
|
+ CommodityBarcode::query()->whereIn('commodity_id', $comID)->delete();
|
|
|
|
|
+ Commodity::destroy($comID);
|
|
|
|
|
+ return $comID;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/*1*/
|
|
/*1*/
|
|
@@ -566,7 +575,7 @@ where (commodities.owner_id,commodity_barcodes.code) in (select commodities.owne
|
|
|
$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
|
|
$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
|
|
|
if ($socket < 0) {
|
|
if ($socket < 0) {
|
|
|
echo "socket_create() failed: reason: " . socket_strerror($socket) . "\n";
|
|
echo "socket_create() failed: reason: " . socket_strerror($socket) . "\n";
|
|
|
- }else {
|
|
|
|
|
|
|
+ } else {
|
|
|
echo "OK.\n";
|
|
echo "OK.\n";
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -574,15 +583,15 @@ where (commodities.owner_id,commodity_barcodes.code) in (select commodities.owne
|
|
|
$result = socket_connect($socket, $ip, $port);
|
|
$result = socket_connect($socket, $ip, $port);
|
|
|
if ($result < 0) {
|
|
if ($result < 0) {
|
|
|
echo "socket_connect() failed.\nReason: ($result) " . socket_strerror($result) . "\n";
|
|
echo "socket_connect() failed.\nReason: ($result) " . socket_strerror($result) . "\n";
|
|
|
- }else {
|
|
|
|
|
|
|
+ } else {
|
|
|
echo "连接OK\n";
|
|
echo "连接OK\n";
|
|
|
}
|
|
}
|
|
|
$b = microtime(true);
|
|
$b = microtime(true);
|
|
|
- echo "连接耗时:".($b-$a)."\n";
|
|
|
|
|
|
|
+ echo "连接耗时:" . ($b - $a) . "\n";
|
|
|
$content = Commodity::query()->limit(200)->get();
|
|
$content = Commodity::query()->limit(200)->get();
|
|
|
|
|
|
|
|
- $c= microtime(true);
|
|
|
|
|
- echo "查询数据耗时:".($c-$b)."\n";
|
|
|
|
|
|
|
+ $c = microtime(true);
|
|
|
|
|
+ echo "查询数据耗时:" . ($c - $b) . "\n";
|
|
|
$content->toArray();
|
|
$content->toArray();
|
|
|
/*$chunks=$content->chunk(100);
|
|
/*$chunks=$content->chunk(100);
|
|
|
foreach ($chunks as $chunk){
|
|
foreach ($chunks as $chunk){
|
|
@@ -590,11 +599,11 @@ where (commodities.owner_id,commodity_barcodes.code) in (select commodities.owne
|
|
|
var_dump(mb_strlen($chunk->toJson()));
|
|
var_dump(mb_strlen($chunk->toJson()));
|
|
|
//socket_write($socket, $chunk->toJson(), mb_strlen($chunk->toJson()));
|
|
//socket_write($socket, $chunk->toJson(), mb_strlen($chunk->toJson()));
|
|
|
}*/
|
|
}*/
|
|
|
- $d= microtime(true);
|
|
|
|
|
- echo "发送数据耗时:".($d-$c)."\n";
|
|
|
|
|
|
|
+ $d = microtime(true);
|
|
|
|
|
+ echo "发送数据耗时:" . ($d - $c) . "\n";
|
|
|
socket_close($socket);
|
|
socket_close($socket);
|
|
|
- $e= microtime(true);
|
|
|
|
|
- echo "共耗时:".($e-$a)."\n";
|
|
|
|
|
|
|
+ $e = microtime(true);
|
|
|
|
|
+ echo "共耗时:" . ($e - $a) . "\n";
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@@ -610,14 +619,349 @@ where (commodities.owner_id,commodity_barcodes.code) in (select commodities.owne
|
|
|
->where('addTime', '>=', $startDate)
|
|
->where('addTime', '>=', $startDate)
|
|
|
->whereIn('customerID', data_get($owners, '*.code'))
|
|
->whereIn('customerID', data_get($owners, '*.code'))
|
|
|
->get();
|
|
->get();
|
|
|
-// $orderService->createByWmsOrder($orderHeaders);
|
|
|
|
|
-// $orderTrackingService->createByWmsOrderHeader($orderHeaders);
|
|
|
|
|
$orderService->updateByWmsOrders($orderHeaders);
|
|
$orderService->updateByWmsOrders($orderHeaders);
|
|
|
$orderTrackingService->updateByWmsOrderHeaders($orderHeaders);
|
|
$orderTrackingService->updateByWmsOrderHeaders($orderHeaders);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- public function usage(){
|
|
|
|
|
|
|
+ public function usage()
|
|
|
|
|
+ {
|
|
|
dd(Request::all());
|
|
dd(Request::all());
|
|
|
- $users=User::query();
|
|
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public function test11()
|
|
|
|
|
+ {
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public function addLogisticTiming()
|
|
|
|
|
+ {
|
|
|
|
|
+ $orderHeader =OracleDOCOrderHeader::query()->where('orderNo','SO201015004279')->first();
|
|
|
|
|
+ $orderHeader['c_city'] = '晋城';
|
|
|
|
|
+ $orderHeader['c_province'] = '山西';
|
|
|
|
|
+ $order = Order::query()->with('logistic')->where('code','SO201015004279')->first();
|
|
|
|
|
+ $params =app(OrderTrackingService::class)->getParamsByOrderHeaderAndOrder($orderHeader,$order);
|
|
|
|
|
+ dd($params['pick_up_at'],$orderHeader['lastshipmenttime']);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public function getMap()
|
|
|
|
|
+ {
|
|
|
|
|
+ return [['北京','北京','4','5'],
|
|
|
|
|
+ ['广东','广州','4','5'],
|
|
|
|
|
+ ['上海','上海','2','3'],
|
|
|
|
|
+ ['天津','天津','4','5'],
|
|
|
|
|
+ ['重庆','重庆','4','5'],
|
|
|
|
|
+ ['辽宁','沈阳','4','5'],
|
|
|
|
|
+ ['江苏','南京','2','3'],
|
|
|
|
|
+ ['湖北','武汉','4','5'],
|
|
|
|
|
+ ['四川','成都','5','6'],
|
|
|
|
|
+ ['陕西','西安','4','5'],
|
|
|
|
|
+ ['贵州','遵义','5','6'],
|
|
|
|
|
+ ['贵州','安顺','5','6'],
|
|
|
|
|
+ ['云南','泸水','5','6'],
|
|
|
|
|
+ ['云南','丽江','5','6'],
|
|
|
|
|
+ ['河北','邯郸','4','5'],
|
|
|
|
|
+ ['河北','石家庄','4','5'],
|
|
|
|
|
+ ['河北','保定','4','5'],
|
|
|
|
|
+ ['河北','张家口','4','5'],
|
|
|
|
|
+ ['河北','承德','4','5'],
|
|
|
|
|
+ ['河北','唐山','4','5'],
|
|
|
|
|
+ ['河北','廊坊','4','5'],
|
|
|
|
|
+ ['河北','沧州','4','5'],
|
|
|
|
|
+ ['河北','衡水','5','6'],
|
|
|
|
|
+ ['河北','邢台','4','5'],
|
|
|
|
|
+ ['河北','秦皇岛','4','5'],
|
|
|
|
|
+ ['山西','朔州','5','6'],
|
|
|
|
|
+ ['山西','忻州','4','5'],
|
|
|
|
|
+ ['山西','太原','4','5'],
|
|
|
|
|
+ ['山西','大同','4','5'],
|
|
|
|
|
+ ['山西','阳泉','4','5'],
|
|
|
|
|
+ ['山西','晋中','4','5'],
|
|
|
|
|
+ ['山西','长治','4','5'],
|
|
|
|
|
+ ['山西','晋城','4','5'],
|
|
|
|
|
+ ['山西','临汾','5','6'],
|
|
|
|
|
+ ['山西','吕梁','4','5'],
|
|
|
|
|
+ ['山西','运城','4','5'],
|
|
|
|
|
+ ['河南','商丘','3','4'],
|
|
|
|
|
+ ['河南','郑州','4','5'],
|
|
|
|
|
+ ['河南','安阳','4','5'],
|
|
|
|
|
+ ['河南','新乡','4','5'],
|
|
|
|
|
+ ['河南','许昌','4','5'],
|
|
|
|
|
+ ['河南','平顶山','4','5'],
|
|
|
|
|
+ ['河南','信阳','3','4'],
|
|
|
|
|
+ ['河南','南阳','4','5'],
|
|
|
|
|
+ ['河南','开封','4','5'],
|
|
|
|
|
+ ['河南','洛阳','4','5'],
|
|
|
|
|
+ ['河南','焦作','4','5'],
|
|
|
|
|
+ ['河南','鹤壁','4','5'],
|
|
|
|
|
+ ['河南','濮阳','4','5'],
|
|
|
|
|
+ ['河南','周口','3','4'],
|
|
|
|
|
+ ['河南','漯河','4','5'],
|
|
|
|
|
+ ['河南','驻马店','4','5'],
|
|
|
|
|
+ ['河南','三门峡','4','5'],
|
|
|
|
|
+ ['辽宁','大连','4','5'],
|
|
|
|
|
+ ['辽宁','鞍山','5','6'],
|
|
|
|
|
+ ['辽宁','本溪','5','6'],
|
|
|
|
|
+ ['辽宁','丹东','5','6'],
|
|
|
|
|
+ ['辽宁','锦州','4','5'],
|
|
|
|
|
+ ['辽宁','营口','5','6'],
|
|
|
|
|
+ ['辽宁','阜新','6','7'],
|
|
|
|
|
+ ['辽宁','辽阳','4','5'],
|
|
|
|
|
+ ['辽宁','朝阳','5','6'],
|
|
|
|
|
+ ['辽宁','盘锦','5','6'],
|
|
|
|
|
+ ['辽宁','葫芦岛','4','5'],
|
|
|
|
|
+ ['吉林','长春','4','5'],
|
|
|
|
|
+ ['吉林','吉林','5','6'],
|
|
|
|
|
+ ['吉林','延吉','5','6'],
|
|
|
|
|
+ ['吉林','四平','5','6'],
|
|
|
|
|
+ ['吉林','通化','5','6'],
|
|
|
|
|
+ ['吉林','白城','5','6'],
|
|
|
|
|
+ ['吉林','辽源','5','6'],
|
|
|
|
|
+ ['吉林','松原','5','6'],
|
|
|
|
|
+ ['吉林','白山','5','6'],
|
|
|
|
|
+ ['黑龙江','哈尔滨','5','6'],
|
|
|
|
|
+ ['黑龙江','齐齐哈尔','5','6'],
|
|
|
|
|
+ ['黑龙江','牡丹江','5','6'],
|
|
|
|
|
+ ['黑龙江','佳木斯','5','6'],
|
|
|
|
|
+ ['黑龙江','绥化','5','6'],
|
|
|
|
|
+ ['黑龙江','黑河','6','7'],
|
|
|
|
|
+ ['黑龙江','大兴安岭','6','7'],
|
|
|
|
|
+ ['黑龙江','伊春','5','6'],
|
|
|
|
|
+ ['黑龙江','大庆','5','6'],
|
|
|
|
|
+ ['黑龙江','七台河','5','6'],
|
|
|
|
|
+ ['黑龙江','鸡西','6','7'],
|
|
|
|
|
+ ['黑龙江','鹤岗','6','7'],
|
|
|
|
|
+ ['黑龙江','双鸭山','6','7'],
|
|
|
|
|
+ ['内蒙古','呼伦贝尔','6','7'],
|
|
|
|
|
+ ['内蒙古','呼和浩特','5','6'],
|
|
|
|
|
+ ['内蒙古','包头','5','6'],
|
|
|
|
|
+ ['内蒙古','乌海','5','6'],
|
|
|
|
|
+ ['内蒙古','乌兰察布','5','6'],
|
|
|
|
|
+ ['内蒙古','通辽','5','6'],
|
|
|
|
|
+ ['内蒙古','赤峰','4','5'],
|
|
|
|
|
+ ['内蒙古','鄂尔多斯','5','6'],
|
|
|
|
|
+ ['内蒙古','巴彦淖尔','5','6'],
|
|
|
|
|
+ ['内蒙古','锡林浩特','5','6'],
|
|
|
|
|
+ ['内蒙古','乌兰浩特','5','6'],
|
|
|
|
|
+ ['内蒙古','阿拉善','4','5'],
|
|
|
|
|
+ ['江苏','无锡','2','3'],
|
|
|
|
|
+ ['江苏','镇江','2','3'],
|
|
|
|
|
+ ['江苏','苏州','2','3'],
|
|
|
|
|
+ ['江苏','南通','2','3'],
|
|
|
|
|
+ ['江苏','扬州','2','3'],
|
|
|
|
|
+ ['江苏','盐城','2','3'],
|
|
|
|
|
+ ['江苏','徐州','2','3'],
|
|
|
|
|
+ ['江苏','淮安','2','3'],
|
|
|
|
|
+ ['江苏','连云港','2','3'],
|
|
|
|
|
+ ['江苏','常州','2','3'],
|
|
|
|
|
+ ['江苏','泰州','2','3'],
|
|
|
|
|
+ ['江苏','宿迁','2','3'],
|
|
|
|
|
+ ['山东','菏泽','4','5'],
|
|
|
|
|
+ ['山东','济南','4','5'],
|
|
|
|
|
+ ['山东','青岛','3','4'],
|
|
|
|
|
+ ['山东','淄博','4','5'],
|
|
|
|
|
+ ['山东','德州','4','5'],
|
|
|
|
|
+ ['山东','烟台','4','5'],
|
|
|
|
|
+ ['山东','潍坊','4','5'],
|
|
|
|
|
+ ['山东','济宁','3','4'],
|
|
|
|
|
+ ['山东','泰安','3','4'],
|
|
|
|
|
+ ['山东','临沂','3','4'],
|
|
|
|
|
+ ['山东','滨州','4','5'],
|
|
|
|
|
+ ['山东','东营','4','5'],
|
|
|
|
|
+ ['安徽','滁州','3','4'],
|
|
|
|
|
+ ['安徽','合肥','3','4'],
|
|
|
|
|
+ ['安徽','蚌埠','3','4'],
|
|
|
|
|
+ ['安徽','芜湖','3','4'],
|
|
|
|
|
+ ['安徽','淮南','3','4'],
|
|
|
|
|
+ ['安徽','马鞍山','3','4'],
|
|
|
|
|
+ ['安徽','安庆','3','4'],
|
|
|
|
|
+ ['安徽','宿州','3','4'],
|
|
|
|
|
+ ['安徽','阜阳','3','4'],
|
|
|
|
|
+ ['安徽','黄山','3','4'],
|
|
|
|
|
+ ['安徽','淮北','3','4'],
|
|
|
|
|
+ ['安徽','铜陵','3','4'],
|
|
|
|
|
+ ['安徽','宣城','3','4'],
|
|
|
|
|
+ ['安徽','六安','3','4'],
|
|
|
|
|
+ ['安徽','池州','3','4'],
|
|
|
|
|
+ ['浙江','衢州','2','3'],
|
|
|
|
|
+ ['浙江','杭州','2','3'],
|
|
|
|
|
+ ['浙江','湖州','2','3'],
|
|
|
|
|
+ ['浙江','嘉兴','2','3'],
|
|
|
|
|
+ ['浙江','宁波','2','3'],
|
|
|
|
|
+ ['浙江','绍兴','2','3'],
|
|
|
|
|
+ ['浙江','台州','2','3'],
|
|
|
|
|
+ ['浙江','温州','2','3'],
|
|
|
|
|
+ ['浙江','丽水','2','3'],
|
|
|
|
|
+ ['浙江','金华','2','3'],
|
|
|
|
|
+ ['浙江','舟山','2','3'],
|
|
|
|
|
+ ['福建','福州','3','4'],
|
|
|
|
|
+ ['福建','厦门','4','5'],
|
|
|
|
|
+ ['福建','宁德','3','4'],
|
|
|
|
|
+ ['福建','莆田','4','5'],
|
|
|
|
|
+ ['福建','泉州','4','5'],
|
|
|
|
|
+ ['福建','漳州','4','5'],
|
|
|
|
|
+ ['福建','龙岩','4','5'],
|
|
|
|
|
+ ['福建','三明','4','5'],
|
|
|
|
|
+ ['福建','南平','3','4'],
|
|
|
|
|
+ ['山东','威海','4','5'],
|
|
|
|
|
+ ['山东','枣庄','3','4'],
|
|
|
|
|
+ ['山东','日照','3','4'],
|
|
|
|
|
+ ['山东','聊城','4','5'],
|
|
|
|
|
+ ['广东','汕尾','4','5'],
|
|
|
|
|
+ ['广东','阳江','4','5'],
|
|
|
|
|
+ ['广东','揭阳','4','5'],
|
|
|
|
|
+ ['广东','茂名','6','7'],
|
|
|
|
|
+ ['云南','景洪','5','6'],
|
|
|
|
|
+ ['云南','瑞丽','6','7'],
|
|
|
|
|
+ ['江西','鹰潭','3','4'],
|
|
|
|
|
+ ['湖北','襄阳','4','5'],
|
|
|
|
|
+ ['湖北','鄂州','3','4'],
|
|
|
|
|
+ ['湖北','孝感','4','5'],
|
|
|
|
|
+ ['湖北','黄冈','3','4'],
|
|
|
|
|
+ ['湖北','黄石','3','4'],
|
|
|
|
|
+ ['湖北','咸宁','4','5'],
|
|
|
|
|
+ ['湖北','荆州','4','5'],
|
|
|
|
|
+ ['湖北','宜昌','4','5'],
|
|
|
|
|
+ ['湖北','恩施','4','5'],
|
|
|
|
|
+ ['湖北','十堰','4','5'],
|
|
|
|
|
+ ['湖北','随州','4','5'],
|
|
|
|
|
+ ['湖北','荆门','4','5'],
|
|
|
|
|
+ ['湖北','仙桃','4','5'],
|
|
|
|
|
+ ['湖南','岳阳','4','5'],
|
|
|
|
|
+ ['湖南','长沙','4','5'],
|
|
|
|
|
+ ['湖南','湘潭','4','5'],
|
|
|
|
|
+ ['湖南','株洲','4','5'],
|
|
|
|
|
+ ['湖南','衡阳','4','5'],
|
|
|
|
|
+ ['湖南','郴州','4','5'],
|
|
|
|
|
+ ['湖南','常德','4','5'],
|
|
|
|
|
+ ['湖南','益阳','4','5'],
|
|
|
|
|
+ ['湖南','娄底','4','5'],
|
|
|
|
|
+ ['湖南','邵阳','4','5'],
|
|
|
|
|
+ ['湖南','吉首','4','5'],
|
|
|
|
|
+ ['湖南','张家界','4','5'],
|
|
|
|
|
+ ['湖南','怀化','4','5'],
|
|
|
|
|
+ ['湖南','永州','4','5'],
|
|
|
|
|
+ ['广东','江门','4','5'],
|
|
|
|
|
+ ['广东','韶关','4','5'],
|
|
|
|
|
+ ['广东','惠州','4','5'],
|
|
|
|
|
+ ['广东','梅州','5','6'],
|
|
|
|
|
+ ['广东','汕头/汕尾','4','5'],
|
|
|
|
|
+ ['广东','深圳','4','5'],
|
|
|
|
|
+ ['广东','珠海','4','5'],
|
|
|
|
|
+ ['广东','佛山','4','5'],
|
|
|
|
|
+ ['广东','肇庆','4','5'],
|
|
|
|
|
+ ['广东','湛江','5','6'],
|
|
|
|
|
+ ['广东','中山','4','5'],
|
|
|
|
|
+ ['广东','河源','4','5'],
|
|
|
|
|
+ ['广东','清远','4','5'],
|
|
|
|
|
+ ['广东','云浮','4','5'],
|
|
|
|
|
+ ['广东','潮州','4','5'],
|
|
|
|
|
+ ['广东','东莞','4','5'],
|
|
|
|
|
+ ['广西','防城港','5','6'],
|
|
|
|
|
+ ['广西','南宁','5','6'],
|
|
|
|
|
+ ['广西','来宾','5','6'],
|
|
|
|
|
+ ['广西','桂林','5','6'],
|
|
|
|
|
+ ['广西','贺州','5','6'],
|
|
|
|
|
+ ['广西','贵港','5','6'],
|
|
|
|
|
+ ['广西','百色','5','6'],
|
|
|
|
|
+ ['广西','钦州','5','6'],
|
|
|
|
|
+ ['广西','河池','4','5'],
|
|
|
|
|
+ ['广西','北海','5','6'],
|
|
|
|
|
+ ['江西','新余','4','5'],
|
|
|
|
|
+ ['江西','南昌','3','4'],
|
|
|
|
|
+ ['江西','九江','3','4'],
|
|
|
|
|
+ ['江西','上饶','3','4'],
|
|
|
|
|
+ ['江西','抚州','3','4'],
|
|
|
|
|
+ ['江西','宜春','4','5'],
|
|
|
|
|
+ ['江西','吉安','4','5'],
|
|
|
|
|
+ ['江西','赣州','4','5'],
|
|
|
|
|
+ ['江西','景德镇','3','4'],
|
|
|
|
|
+ ['江西','萍乡','4','5'],
|
|
|
|
|
+ ['四川','攀枝花','5','6'],
|
|
|
|
|
+ ['四川','自贡','5','6'],
|
|
|
|
|
+ ['四川','绵阳','5','6'],
|
|
|
|
|
+ ['四川','南充','5','6'],
|
|
|
|
|
+ ['四川','达州','4','5'],
|
|
|
|
|
+ ['四川','遂宁','5','6'],
|
|
|
|
|
+ ['四川','广安','5','6'],
|
|
|
|
|
+ ['四川','巴中','5','6'],
|
|
|
|
|
+ ['四川','泸州','5','6'],
|
|
|
|
|
+ ['四川','宜宾','5','6'],
|
|
|
|
|
+ ['四川','内江','5','6'],
|
|
|
|
|
+ ['四川','乐山','5','6'],
|
|
|
|
|
+ ['四川','西昌','5','6'],
|
|
|
|
|
+ ['四川','雅安','5','6'],
|
|
|
|
|
+ ['四川','康定','4','5'],
|
|
|
|
|
+ ['四川','阿坝藏族羌族州','5','6'],
|
|
|
|
|
+ ['四川','德阳','5','6'],
|
|
|
|
|
+ ['四川','广元','5','6'],
|
|
|
|
|
+ ['贵州','贵阳','4','5'],
|
|
|
|
|
+ ['贵州','都匀','4','5'],
|
|
|
|
|
+ ['贵州','凯里','4','5'],
|
|
|
|
|
+ ['贵州','铜仁','5','6'],
|
|
|
|
|
+ ['贵州','毕节','5','6'],
|
|
|
|
|
+ ['贵州','六盘水','5','6'],
|
|
|
|
|
+ ['贵州','兴义','5','6'],
|
|
|
|
|
+ ['云南','昭通','5','6'],
|
|
|
|
|
+ ['云南','昆明','5','6'],
|
|
|
|
|
+ ['云南','大理','5','6'],
|
|
|
|
|
+ ['云南','红河哈尼族彝族州','5','6'],
|
|
|
|
|
+ ['云南','曲靖','5','6'],
|
|
|
|
|
+ ['云南','保山','5','6'],
|
|
|
|
|
+ ['云南','文山','5','6'],
|
|
|
|
|
+ ['云南','玉溪','5','6'],
|
|
|
|
|
+ ['云南','楚雄','5','6'],
|
|
|
|
|
+ ['云南','普洱','5','6'],
|
|
|
|
|
+ ['云南','临沧','5','6'],
|
|
|
|
|
+ ['云南','香格里拉','5','6'],
|
|
|
|
|
+ ['海南','海口','5','6'],
|
|
|
|
|
+ ['新疆','乌苏','6','7'],
|
|
|
|
|
+ ['新疆','哈密','6','7'],
|
|
|
|
|
+ ['新疆','和田市','6','7'],
|
|
|
|
|
+ ['新疆','阿勒泰市','6','7'],
|
|
|
|
|
+ ['新疆','阿图什市','6','7'],
|
|
|
|
|
+ ['新疆','博尔塔拉蒙古州','6','7'],
|
|
|
|
|
+ ['陕西','延安','4','5'],
|
|
|
|
|
+ ['陕西','榆林','4','5'],
|
|
|
|
|
+ ['陕西','渭南','4','5'],
|
|
|
|
|
+ ['陕西','商洛','4','5'],
|
|
|
|
|
+ ['陕西','安康','4','5'],
|
|
|
|
|
+ ['陕西','汉中','4','5'],
|
|
|
|
|
+ ['陕西','宝鸡','4','5'],
|
|
|
|
|
+ ['陕西','铜川','4','5'],
|
|
|
|
|
+ ['甘肃','临夏','4','5'],
|
|
|
|
|
+ ['甘肃','兰州','5','6'],
|
|
|
|
|
+ ['甘肃','定西','5','6'],
|
|
|
|
|
+ ['甘肃','平凉','5','6'],
|
|
|
|
|
+ ['甘肃','庆阳','4','5'],
|
|
|
|
|
+ ['甘肃','武威','5','6'],
|
|
|
|
|
+ ['甘肃','张掖','5','6'],
|
|
|
|
|
+ ['甘肃','酒泉','5','6'],
|
|
|
|
|
+ ['甘肃','天水','4','5'],
|
|
|
|
|
+ ['甘肃','陇南','5','6'],
|
|
|
|
|
+ ['甘肃','合作','5','6'],
|
|
|
|
|
+ ['甘肃','白银','5','6'],
|
|
|
|
|
+ ['宁夏','银川','5','6'],
|
|
|
|
|
+ ['宁夏','石嘴山','5','6'],
|
|
|
|
|
+ ['宁夏','吴忠','5','6'],
|
|
|
|
|
+ ['宁夏','固原','5','6'],
|
|
|
|
|
+ ['宁夏','中卫','5','6'],
|
|
|
|
|
+ ['青海','海北藏族自治州','5','6'],
|
|
|
|
|
+ ['青海','西宁','5','6'],
|
|
|
|
|
+ ['青海','海东','5','6'],
|
|
|
|
|
+ ['青海','同仁县','5','6'],
|
|
|
|
|
+ ['青海','共和县','5','6'],
|
|
|
|
|
+ ['青海','玛訫县','5','6'],
|
|
|
|
|
+ ['青海','德令哈','5','6'],
|
|
|
|
|
+ ['青海','格尔木','5','6'],
|
|
|
|
|
+ ['新疆','克拉玛依','6','7'],
|
|
|
|
|
+ ['新疆','乌鲁木齐','6','7'],
|
|
|
|
|
+ ['新疆','奎屯','6','7'],
|
|
|
|
|
+ ['新疆','石河子','6','7'],
|
|
|
|
|
+ ['新疆','昌吉州','6','7'],
|
|
|
|
|
+ ['新疆','吐鲁番','6','7'],
|
|
|
|
|
+ ['新疆','库尔勒','6','7'],
|
|
|
|
|
+ ['新疆','阿克苏市','6','7'],
|
|
|
|
|
+ ['新疆','喀什市','6','7'],
|
|
|
|
|
+ ['新疆','伊犁哈萨克州','6','7']];
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|