|
|
@@ -2,15 +2,28 @@
|
|
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
|
|
+use App\Batch;
|
|
|
+use App\CommodityBarcode;
|
|
|
use App\Components\AsyncResponse;
|
|
|
use App\Components\Database;
|
|
|
use App\Components\ErrorPush;
|
|
|
use App\Exceptions\Exception;
|
|
|
+use App\OracleDOCWaveDetails;
|
|
|
+use App\Order;
|
|
|
+use App\OrderBin;
|
|
|
+use App\OrderCommodity;
|
|
|
use App\Rejected;
|
|
|
use App\RejectedBill;
|
|
|
use App\RejectedBillItem;
|
|
|
+use App\Services\LogService;
|
|
|
+use App\Services\OracleDOCOrderHeaderService;
|
|
|
+use App\Services\OrderCommodityService;
|
|
|
+use App\Services\OrderService;
|
|
|
+use App\Services\WaveService;
|
|
|
use App\Services\WaybillService;
|
|
|
+use App\SortingStation;
|
|
|
use App\User;
|
|
|
+use App\UserToken;
|
|
|
use App\Waybill;
|
|
|
use Illuminate\Database\Eloquent\Collection;
|
|
|
use Illuminate\Http\Request;
|
|
|
@@ -18,6 +31,7 @@ use Illuminate\Support\Facades\Auth;
|
|
|
use Illuminate\Support\Facades\DB;
|
|
|
use Illuminate\Support\Facades\Hash;
|
|
|
use Illuminate\Support\Facades\Http;
|
|
|
+use Illuminate\Support\Str;
|
|
|
use Zttp\Zttp;
|
|
|
|
|
|
class TestController extends Controller
|
|
|
@@ -39,15 +53,61 @@ class TestController extends Controller
|
|
|
dd("方法不存在");
|
|
|
}
|
|
|
}
|
|
|
- public function test()
|
|
|
+ public function a1(){
|
|
|
+ dd(phpinfo());
|
|
|
+ dd(DB::table('BAS_CODES')->select('code', 'codename_c')->where('codeid', 'SO_STS')->orderBy('code', 'asc')->sql());
|
|
|
+ $response = Http::post("https://api.baoshi56.com/api/flux/getList", [
|
|
|
+ "sql" => "SELECT * FROM BAS_CODES WHERE CODEID = 'ABC'"
|
|
|
+ ]);
|
|
|
+ dd(json_decode($response->body(), true)->data);
|
|
|
+ }
|
|
|
+ public function test(Request $request)
|
|
|
+ {
|
|
|
+ dd(Hash::make("zhao123456"));
|
|
|
+ }
|
|
|
+
|
|
|
+ public function syncOrder($code)
|
|
|
{
|
|
|
- $url = config('api.java.base').config('api.java.device.picking.getContainerOfWave');
|
|
|
- $get = Http::get($url, ["container" => "JH028"]);
|
|
|
- $result = $get->json();
|
|
|
- if ($result["code"] != 200) {
|
|
|
- return response()->json(['result'=>'failure','fail_info'=>$result["message"]])->setEncodingOptions(JSON_UNESCAPED_UNICODE);
|
|
|
+ $orderHeaders = app(OracleDOCOrderHeaderService::class)->getQuery()->where('DOC_Order_Header.WaveNo',$code)->get();
|
|
|
+ app(OrderService::class)->syncOrderByWMSOrderHeaders($orderHeaders);
|
|
|
+ app(OrderCommodityService::class)->syncOrderCommodity($orderHeaders);
|
|
|
+ $this->syncOrderBin($code);
|
|
|
+ }
|
|
|
+ public function syncOrderBin($code)
|
|
|
+ {
|
|
|
+ $wave = DB::connection("oracle")->selectOne(DB::raw("select * from DOC_WAVE_HEADER where WAVENO = ?"), [$code]);
|
|
|
+ if (!$wave) return;
|
|
|
+ $owner = app("OwnerService")->codeGetOwner($wave->customerid);
|
|
|
+ $obj = [
|
|
|
+ "wms_status" => $this->wms_status($wave),
|
|
|
+ "wms_type" => $wave->descr,
|
|
|
+ "created_at" => date("Y-m-d H:i:s"),
|
|
|
+ "wms_created_at" => $wave->addtime,
|
|
|
+ "updated_at" => $wave->edittime,
|
|
|
+ "owner_id" => $owner->id,
|
|
|
+ ];
|
|
|
+ $batch = Batch::query()->where("code", $code)->first();
|
|
|
+ if (!$batch) {
|
|
|
+ $obj["code"] = $code;
|
|
|
+ $batch = Batch::query()->create($obj);
|
|
|
+ } else {
|
|
|
+ Batch::query()->where("code", $code)->update($obj);
|
|
|
}
|
|
|
- dd($result["data"]);
|
|
|
+ $order_nos = array_column(DB::connection("oracle")->select(DB::raw("select orderno from DOC_WAVE_DETAILS where WAVENO = ?"), [$code]), "orderno");
|
|
|
+
|
|
|
+ Order::query()->whereIn("code", $order_nos)->update(["batch_id" => $batch->id]);
|
|
|
+
|
|
|
+ Order::query()->with(["batch", "bin"])->whereIn("code", $order_nos)->get()->each(function ($order) {
|
|
|
+ if (!$order->bin) {
|
|
|
+ $bin = DB::connection("oracle")->selectOne(DB::raw("select seqno from DOC_WAVE_DETAILS where waveno = ? and orderno = ?"), [$order->batch->code, $order->code]);
|
|
|
+ if ($bin) {
|
|
|
+ OrderBin::query()->create([
|
|
|
+ 'order_id' => $order->id,
|
|
|
+ 'number' => $bin->seqno,
|
|
|
+ ]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
}
|
|
|
|