|
|
@@ -5,6 +5,7 @@ namespace App\Http\Controllers;
|
|
|
use App\Authority;
|
|
|
use App\Batch;
|
|
|
use App\Commodity;
|
|
|
+use App\CommodityBarcode;
|
|
|
use App\CommodityMaterialBoxModel;
|
|
|
use App\Components\AsyncResponse;
|
|
|
use App\Components\Database;
|
|
|
@@ -12,6 +13,7 @@ use App\Components\ErrorPush;
|
|
|
use App\ErrorTemp;
|
|
|
use App\Feature;
|
|
|
use App\Http\ApiControllers\LoginController;
|
|
|
+use App\Http\Controllers\api\thirdPart\haochuang\SortingController;
|
|
|
use App\Http\Controllers\api\thirdPart\syrius\beans\StorageTypeCell;
|
|
|
use App\Http\Controllers\api\thirdPart\syrius\beans\StorageTypeRelation;
|
|
|
use App\Http\Controllers\api\thirdPart\syrius\beans\Task;
|
|
|
@@ -23,7 +25,6 @@ use App\Http\Requests\AndroidGateRequest;
|
|
|
use App\Http\Requests\OrderDelivering;
|
|
|
use App\Jobs\BatchTaskJob;
|
|
|
use App\Jobs\CacheShelfTaskJob;
|
|
|
-use App\Jobs\LogisticYDSync;
|
|
|
use App\Jobs\OrderCreateInstantBill;
|
|
|
use App\Jobs\OrderCreateWaybill;
|
|
|
use App\Jobs\SettlementBillReportJob;
|
|
|
@@ -40,13 +41,16 @@ use App\Notifications\RoutineNotification;
|
|
|
use App\OracleDOCASNHeader;
|
|
|
use App\OracleDOCOrderHeader;
|
|
|
use App\OracleDocOrderPackingSummary;
|
|
|
+use App\OracleDOCWaveDetails;
|
|
|
use App\Order;
|
|
|
use App\OrderBin;
|
|
|
+use App\OrderCommodity;
|
|
|
use App\OrderIssue;
|
|
|
use App\OrderIssueProcessLog;
|
|
|
use App\OrderPackage;
|
|
|
use App\Owner;
|
|
|
use App\OwnerAreaReport;
|
|
|
+use App\OwnerBillReport;
|
|
|
use App\OwnerFeeDetail;
|
|
|
use App\OwnerFeeDetailLogistic;
|
|
|
use App\OwnerFeeExpress;
|
|
|
@@ -57,16 +61,18 @@ use App\OwnerFeeStorage;
|
|
|
use App\OwnerPriceExpress;
|
|
|
use App\OwnerPriceOperation;
|
|
|
use App\OrderPackageCountingRecord;
|
|
|
-use App\OwnerUserWorkgroupArchive;
|
|
|
+use App\OwnerReport;
|
|
|
use App\ProcurementCheckSheet;
|
|
|
use App\RejectedBill;
|
|
|
use App\SeeLog;
|
|
|
use App\Services\AuthorityService;
|
|
|
use App\Services\BatchService;
|
|
|
use App\Services\CacheShelfService;
|
|
|
+use App\Services\common\BatchUpdateService;
|
|
|
use App\Services\ForeignHaiRoboticsService;
|
|
|
use App\Services\ForeignZhenCangService;
|
|
|
use App\Services\LogisticService;
|
|
|
+use App\Services\LogService;
|
|
|
use App\Services\NotificationService;
|
|
|
use App\Services\OracleDOCOrderHeaderService;
|
|
|
use App\Services\OrderPackageCommoditiesService;
|
|
|
@@ -76,6 +82,7 @@ use App\Services\OrderService;
|
|
|
use App\Services\OwnerFeeTotalService;
|
|
|
use App\Services\OwnerLogisticFeeReportService;
|
|
|
use App\Services\OwnerPriceOperationService;
|
|
|
+use App\Services\OwnerService;
|
|
|
use App\Services\OwnerStoreFeeReportService;
|
|
|
use App\Services\OwnerStoreOutFeeReportService;
|
|
|
use App\Services\ReviewService;
|
|
|
@@ -83,6 +90,7 @@ use App\Services\StationService;
|
|
|
use App\Services\StorageService;
|
|
|
use App\Services\StoreService;
|
|
|
use App\Services\SyriusTaskService;
|
|
|
+use App\SortingStation;
|
|
|
use App\Station;
|
|
|
use App\StationTask;
|
|
|
use App\StationTaskMaterialBox;
|
|
|
@@ -100,6 +108,7 @@ use Carbon\Carbon;
|
|
|
use Carbon\CarbonPeriod;
|
|
|
use Decimal\Decimal;
|
|
|
use Doctrine\DBAL\Exception;
|
|
|
+use Firebase\JWT\ExpiredException;
|
|
|
use Firebase\JWT\JWT;
|
|
|
use Illuminate\Database\Eloquent\Builder;
|
|
|
use Illuminate\Database\Eloquent\Collection;
|
|
|
@@ -289,9 +298,92 @@ class TestController extends Controller
|
|
|
}
|
|
|
use Signature;
|
|
|
private static $delayedHour = 48;
|
|
|
+ function process(Request $request): array
|
|
|
+ {
|
|
|
+ $station_id = $request->input('station_id');
|
|
|
+ $batch_id = $request->input('batch_id');
|
|
|
+ $childIndex = null;
|
|
|
+ $arr = explode('-',$batch_id);
|
|
|
+ if (count($arr)==2){
|
|
|
+ $batch_id = $arr[0];
|
|
|
+ $childIndex = (int)$arr[1];
|
|
|
+ }
|
|
|
+
|
|
|
+ $s = new SortingController();
|
|
|
+ // 同步orderCommodity
|
|
|
+ $s->syncOrder($batch_id);
|
|
|
+
|
|
|
+ /** @var Batch|\stdClass $batch */
|
|
|
+ $batch=Batch::query()->where('code',$batch_id)->orderBy('id','desc')->first();
|
|
|
+ $data=[
|
|
|
+ 'result'=>'success',
|
|
|
+ 'station_id'=>$station_id,
|
|
|
+ 'batch_id'=>$batch_id,
|
|
|
+ 'orders'=>[]
|
|
|
+ ];
|
|
|
+ if ($childIndex!==null && $batch->split_size){
|
|
|
+ $start = (($childIndex-1)*$batch->split_size)+1;
|
|
|
+ $end = $childIndex*$batch->split_size;
|
|
|
+ $sql = <<<SQL
|
|
|
+SELECT ORDERNO
|
|
|
+FROM (SELECT T.ORDERNO, ROWNUM AS NO
|
|
|
+FROM (SELECT ORDERNO FROM DOC_WAVE_DETAILS WHERE WAVENO = '{$batch_id}' ORDER BY SEQNO) T)
|
|
|
+WHERE NO BETWEEN {$start} AND {$end}
|
|
|
+SQL;
|
|
|
+ $waves = DB::connection("oracle")->select(DB::raw($sql));
|
|
|
+ $codes = array_column($waves,'orderno');
|
|
|
+ $orders = Order::query()->whereIn("code",$codes)->get();
|
|
|
+ }else $orders = $batch->orders()->get();
|
|
|
+
|
|
|
+ $ordersSorted=$orders->sortBy(function(Order $order){
|
|
|
+ return $order->bin()->first()['number'];
|
|
|
+ });
|
|
|
+ $ordersSorted->each(function(Order $order)use(&$data,$request){
|
|
|
+ if($order['status']=='取消')return;
|
|
|
+ $orderData=[
|
|
|
+ 'order_id'=>$order['code'],
|
|
|
+ 'owner'=>$order->owner()->first()['code'],
|
|
|
+ 'status'=>$order['status']=='未处理'?'available':$order['status'],
|
|
|
+ 'created_at'=>$order['created_at']->toDateTimeString(),
|
|
|
+ 'bin'=>(function()use($order){
|
|
|
+ $bin=$order->bin()->first()['number']??'';
|
|
|
+ if(!$bin){
|
|
|
+ $bin=OracleDOCWaveDetails::query()->where('orderno', 'SO201230003574')->get('seqno')->first()['seqno']??'';
|
|
|
+ dump('BIN 缺失');
|
|
|
+ return $bin;
|
|
|
+ }
|
|
|
+ return $bin;
|
|
|
+ })(),
|
|
|
+ 'barcodes'=>[]
|
|
|
+ ];
|
|
|
+ $order->orderCommodities()->each(function(OrderCommodity $orderCommodity)use(&$orderData,$request){
|
|
|
+ $commodity=$orderCommodity->commodity()->first();
|
|
|
+ if(!$commodity){
|
|
|
+ dump("没订单");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ $barcodeStr=$commodity->barcodes()->get()->map(function(CommodityBarcode $barcode){
|
|
|
+ return $barcode['code'];
|
|
|
+ })->filter(function($code){
|
|
|
+ return $code&&(!preg_match('/[\x{4e00}-\x{9fa5}]/u',$code));
|
|
|
+ })->join(',');
|
|
|
+ $orderData['barcodes'][]=[
|
|
|
+ 'id'=>$orderCommodity['id']??'',
|
|
|
+ 'barcode_id'=>$barcodeStr??'',
|
|
|
+ 'name'=>$commodity['name']??'',
|
|
|
+ 'sku'=>$commodity['sku']??'',
|
|
|
+ 'amount'=>$orderCommodity['amount']??'',
|
|
|
+ 'location'=>$orderCommodity['location']??'',
|
|
|
+ ];
|
|
|
+ });
|
|
|
+ $data['orders'][]=$orderData;
|
|
|
+ });
|
|
|
+ return $data;
|
|
|
+ }
|
|
|
public function test(Request $request)
|
|
|
{
|
|
|
-
|
|
|
+ $request->offsetSet("station_id",'123456789');
|
|
|
+ dd($this->process($request));
|
|
|
echo 'Now memory_get_usage: ' . memory_get_usage() . '<br />';
|
|
|
$t1 = microtime(true);
|
|
|
// ... 执行代码 ...
|
|
|
@@ -770,9 +862,4 @@ sql;
|
|
|
$foreignZhenCangService=app('ForeignZhenCangService');;
|
|
|
$foreignZhenCangService->broadcastBatch($batches);
|
|
|
}
|
|
|
-
|
|
|
- public function clear_logistic_yd_sync_register_cache_flag()
|
|
|
- {
|
|
|
- Cache::tags([LogisticYDSync::TAG])->flush();
|
|
|
- }
|
|
|
}
|