|
|
@@ -158,93 +158,12 @@ class TestController extends Controller
|
|
|
dd("方法不存在");
|
|
|
}
|
|
|
}
|
|
|
- function process(Request $request){
|
|
|
- $token = trim($request->input('token'));
|
|
|
- $station_id = 'test';
|
|
|
- $batch_id = 'W211111001514-6';
|
|
|
-
|
|
|
- $childIndex = null;
|
|
|
- $arr = explode('-',$batch_id);
|
|
|
- if (count($arr)==2){
|
|
|
- $batch_id = $arr[0];
|
|
|
- $childIndex = (int)$arr[1];
|
|
|
- $request->offsetSet("batch_id",$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;
|
|
|
- dd($sql);
|
|
|
- $waves = DB::connection("oracle")->select(DB::raw($sql));
|
|
|
- $codes = array_column($waves,'orderno');
|
|
|
- $orders = Order::query()->with(["bin","owner","orderCommodities.commodity.barcodes"])->whereIn("code",$codes)->get();
|
|
|
- }else $orders = $batch->orders()->with(["bin","owner","orderCommodities.commodity.barcodes"])->get();
|
|
|
-
|
|
|
- $ordersSorted=$orders->sortBy(function(Order $order){
|
|
|
- return $order->bin->number;
|
|
|
- });
|
|
|
- $ordersSorted->each(function(Order $order)use(&$data,$request,$childIndex,$batch){
|
|
|
- if($order['status']=='取消')return;
|
|
|
- $orderData=[
|
|
|
- 'order_id'=>$order['code'],
|
|
|
- 'owner'=>$order->owner->code,
|
|
|
- 'status'=>$order['status']=='未处理'?'available':$order['status'],
|
|
|
- 'created_at'=>$order['created_at']->toDateTimeString(),
|
|
|
- 'bin'=>(function()use($order,$childIndex,$batch){
|
|
|
- $bin=$order->bin->number??'';
|
|
|
- if(!$bin){
|
|
|
- $bin=OracleDOCWaveDetails::query()->where('orderno', 'SO201230003574')->get('seqno')->first()['seqno']??'';
|
|
|
- LogService::log(__METHOD__,__FUNCTION__,'bin缺失补查:'.$bin.'. order:'.$order->toJson());
|
|
|
- return $childIndex!==null ? $bin-(($childIndex-1)*$batch->split_size) : $bin;
|
|
|
- }
|
|
|
- return $childIndex!==null ? $bin-(($childIndex-1)*$batch->split_size) : $bin;
|
|
|
- })(),
|
|
|
- 'barcodes'=>[]
|
|
|
- ];
|
|
|
- $order->orderCommodities->each(function(OrderCommodity $orderCommodity)use(&$orderData,$request){
|
|
|
- $commodity=$orderCommodity->commodity;
|
|
|
- if(!$commodity){
|
|
|
- app('LogService')->log(__METHOD__, 'error' . __FUNCTION__, '播种位数据准备出错,找不到订单对应的Commodity id的对象'.$orderCommodity['commodity_id'].',是否表数据在波次生成后丢失?'.json_encode($request->all()));
|
|
|
- return;
|
|
|
- }
|
|
|
- $barcodeStr=$commodity->barcodes->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)
|
|
|
{
|
|
|
return view("equipment.index");
|
|
|
$path = '';
|
|
|
- $id = 109;
|
|
|
+ $id = 181;
|
|
|
|
|
|
$file = fopen($path, "r");
|
|
|
$user=array();
|
|
|
@@ -270,470 +189,4 @@ SQL;
|
|
|
]);
|
|
|
}
|
|
|
}
|
|
|
- public function test1()
|
|
|
- {
|
|
|
- $a = new \App\Http\Controllers\api\thirdPart\syrius\producer\OrderController();
|
|
|
- dd($a->createOrder($this->t2())->body());
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- public function init_labor_company_dispatch()
|
|
|
- {
|
|
|
- $dispatches = LaborCompanyDispatch::all();
|
|
|
- foreach ($dispatches as $dispatch) {
|
|
|
- $dispatch->warehouse_id = $dispatch->laborCompany->warehouse_id ?? null;
|
|
|
- $dispatch->save();
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- private function t2()
|
|
|
- {
|
|
|
- $task = new Task();
|
|
|
- $task->id = "TEST0004";
|
|
|
- #$task->batchId = "WTEST0001";
|
|
|
- $task->warehouseId = "101";
|
|
|
- $task->type = Task::PUTAWAY;
|
|
|
- $task->attributes = [
|
|
|
- "customer" => "幼岚",
|
|
|
- ];
|
|
|
- $task->storages = [["serialNo"=>"1635055429594424"]];
|
|
|
- $task->items = [
|
|
|
- $this->p1(),
|
|
|
- $this->p2(),
|
|
|
- ];
|
|
|
- return $task->get();
|
|
|
- }
|
|
|
- private function p1()
|
|
|
- {
|
|
|
- $taskItem = new TaskItem();
|
|
|
- $taskItem->name = "测试衣服商品名2";
|
|
|
- $taskItem->barcode = "TEST-013";
|
|
|
- $taskItem->quantity = (int)1;
|
|
|
- $taskItem->binLocations = [
|
|
|
- "G11-133-1",
|
|
|
- ];
|
|
|
- $taskItem->attributes = [
|
|
|
- "storageSerialNo"=>"1635055429594424",
|
|
|
- "orderLineNo" => "1",
|
|
|
- "skuLineNo" => "1",
|
|
|
- "sku" => "TEST1",
|
|
|
- "lotNum" => "LOT179201",
|
|
|
- "logisticNumber"=> "圆通",
|
|
|
- ];
|
|
|
- return (array)$taskItem->get();
|
|
|
- }
|
|
|
- private function p2()
|
|
|
- {
|
|
|
- $taskItem = new TaskItem();
|
|
|
- $taskItem->name = "测试衣服 商品名";
|
|
|
- $taskItem->barcode = "TEST-012";
|
|
|
- $taskItem->quantity = (int)1;
|
|
|
- $taskItem->binLocations = [
|
|
|
- "G11-099-1",
|
|
|
- ];
|
|
|
- $taskItem->attributes = [
|
|
|
- "storageSerialNo"=>"1635055429594424",
|
|
|
- "orderLineNo" => "1",
|
|
|
- "skuLineNo" => "1",
|
|
|
- "sku" => "TEST",
|
|
|
- "lotNum" => "LOT17920",
|
|
|
- "logisticNumber"=> "顺丰",
|
|
|
- ];
|
|
|
- return (array)$taskItem->get();
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- public function update_order_packages_is_manual_update()
|
|
|
- {
|
|
|
- $descriptions = Log::query()
|
|
|
- ->select('description')
|
|
|
- ->whereBetween('created_at', ['2021-08-31 10:30:00', '2021-08-31 10:35:00'])
|
|
|
- ->where('class', 'like', 'https://was.baoshi56.com/package/logistic/batchUpdate%')->pluck('description');
|
|
|
- foreach ($descriptions as $description) {
|
|
|
- $description = substr($description, 9);
|
|
|
- $description = \Illuminate\Support\Str::before($description, "}");
|
|
|
- $obj = json_decode($description . '}', true);
|
|
|
- OrderPackage::query()
|
|
|
- ->whereIn('logistic_number', $obj['logistic_numbers'])
|
|
|
- ->update([
|
|
|
- 'status' => '无',
|
|
|
- 'is_manual_update' => false,
|
|
|
- ]);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- public function testUpdateInv()
|
|
|
- {
|
|
|
- ini_set('max_execution_time', 0);
|
|
|
- ini_set('memory_limit', '4096M');
|
|
|
- $sql = <<<sql
|
|
|
-select FMLOTNUM,FMLOCATION,PLANTOLOCATION,CREATE_TRANSACTIONID,SKU,CUSTOMERID from TSK_TASKLISTS
|
|
|
-where CUSTOMERID=?
|
|
|
- AND FMLOCATION= ?
|
|
|
- AND OPENWHO = ?
|
|
|
- AND TASKPROCESS = ?
|
|
|
- AND DOCTYPE = ?
|
|
|
- AND TASKTYPE = ?
|
|
|
- AND LOTATT05=?
|
|
|
- AND LOTATT08=?
|
|
|
- AND PLANTOID = ?
|
|
|
- and OPENTIME>=TO_DATE(?,'yyyy-mm-dd hh24:mi:ss')
|
|
|
- and OPENTIME<=TO_DATE(?,'yyyy-mm-dd hh24:mi:ss')
|
|
|
-sql;
|
|
|
- $CUSTOMERID = 'JIANSHANG';
|
|
|
- $FMLOCATION = 'STAGEWH02';
|
|
|
- $OPENWHO = 'WCS';
|
|
|
- $TASKPROCESS = '00';
|
|
|
- $DOCTYPE = 'ASN';
|
|
|
- $TASKTYPE = 'PA';
|
|
|
- $LOTATT05 = 'MJ-CP';
|
|
|
- $LOTATT08 = 'ZP';
|
|
|
- $PLANTOID = '*';
|
|
|
- $traceid = 'JIANSHANG03';
|
|
|
- $start = '2021-09-02 23:59:59';
|
|
|
- $end = '2021-09-03 11:10:00';
|
|
|
- $res = DB::connection("oracle")->select(DB::raw($sql),
|
|
|
- [$CUSTOMERID, $FMLOCATION, $OPENWHO, $TASKPROCESS, $DOCTYPE, $TASKTYPE, $LOTATT05, $LOTATT08, $PLANTOID, $start, $end]);
|
|
|
- $resItems = array_chunk($res, 200);
|
|
|
- foreach ($resItems as $res) {
|
|
|
- DB::connection("oracle")->beginTransaction();
|
|
|
- try {
|
|
|
- foreach ($res as $re) {
|
|
|
- DB::connection("oracle")->table('INV_LOT_LOC_ID')
|
|
|
- ->where([
|
|
|
- 'LOTNUM' => $re->fmlotnum,
|
|
|
- 'LOCATIONID' => $re->fmlocation,
|
|
|
- 'CUSTOMERID' => $re->customerid,
|
|
|
- 'sku' => $re->sku,
|
|
|
- 'TRACEID' => '*',
|
|
|
- ])
|
|
|
- ->update([
|
|
|
- 'TRACEID' => $traceid,
|
|
|
- 'EDITWHO' => 'WCS_',
|
|
|
- ]);
|
|
|
- if ($re->fmlocation != $re->plantolocation) {
|
|
|
- DB::connection("oracle")->table('INV_LOT_LOC_ID')
|
|
|
- ->where([
|
|
|
- 'LOTNUM' => $re->fmlotnum,
|
|
|
- 'LOCATIONID' => $re->plantolocation,
|
|
|
- 'CUSTOMERID' => $re->customerid,
|
|
|
- 'sku' => $re->sku,
|
|
|
- 'TRACEID' => '*',
|
|
|
- ])
|
|
|
- ->update([
|
|
|
- 'TRACEID' => $traceid,
|
|
|
- 'EDITWHO' => 'WCS_',
|
|
|
- ]);
|
|
|
- }
|
|
|
- DB::connection("oracle")->commit();
|
|
|
- }
|
|
|
- dd(true);
|
|
|
- } catch (\Exception $e) {
|
|
|
- DB::connection("oracle")->rollBack();
|
|
|
- dd($e->getMessage());
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 重置15天内的数据
|
|
|
- */
|
|
|
- public function order_packages_init()
|
|
|
- {
|
|
|
- OrderPackage::query()
|
|
|
- ->whereBetween('created_at', [now()->subDays(15), now()])
|
|
|
- ->update([
|
|
|
- 'is_delay_deliver' => 0,
|
|
|
- 'sync_routes_flag' => 0,
|
|
|
- 'status' => 1,
|
|
|
- 'exception_status' => 0,
|
|
|
- ]);
|
|
|
- OrderPackage::query()
|
|
|
- ->whereBetween('created_at', [now()->subDays(15), now()])
|
|
|
- ->whereNotNull('received_at')
|
|
|
- ->update([
|
|
|
- 'status' => 7,
|
|
|
- ]);
|
|
|
- }
|
|
|
-
|
|
|
- public function syncOrderPackage(){
|
|
|
- ini_set('memory_limit','500M');
|
|
|
- ini_set('max_execution_time', 0);
|
|
|
- $orderPackingSummary = OracleDocOrderPackingSummary::query()
|
|
|
- ->where('editTime','>=','2021-09-11 12:00:00')
|
|
|
- ->where('editTime','<=','2021-09-12 12:40:00')
|
|
|
- ->get();
|
|
|
-
|
|
|
- $orderPackingSummary_chunk = $orderPackingSummary->chunk(200);
|
|
|
- foreach ($orderPackingSummary_chunk as $orderPackingSummarys) {
|
|
|
- foreach ($orderPackingSummarys as $orderPackingSummary) {
|
|
|
- $orderPackage = OrderPackage::query()->where('logistic_number',$orderPackingSummary->traceid)->first();
|
|
|
- $orderPackage->update([
|
|
|
- 'uploaded_to_wms'=> true,
|
|
|
- 'weight'=>$orderPackingSummary->grossweight,
|
|
|
- 'length'=>$orderPackingSummary->length,
|
|
|
- 'width'=>$orderPackingSummary->width,
|
|
|
- 'height'=>$orderPackingSummary->height,
|
|
|
- 'weighed_at'=>$orderPackingSummary->edittime
|
|
|
- ]);
|
|
|
- dispatch(new WeightUpdateInstantBill($orderPackage));
|
|
|
- }
|
|
|
- }
|
|
|
- return ['success' => true];
|
|
|
- }
|
|
|
-
|
|
|
- public function collectUpload()
|
|
|
- {
|
|
|
- /** @var OrderPackageService $service */
|
|
|
- $service = app('OrderPackageService');
|
|
|
- return $service->collectUpload([
|
|
|
- '75601803541125'
|
|
|
- ]);
|
|
|
- }
|
|
|
-
|
|
|
- public function init_在途异常()
|
|
|
- {
|
|
|
- $logistic_numbers = OrderPackage::query()
|
|
|
- ->select('logistic_number')
|
|
|
- ->where('exception_status', 5)
|
|
|
- ->where('created_at', '>=', now()->subDays(20)->toDateTimeString())
|
|
|
- ->pluck('logistic_number');
|
|
|
- /** @var OrderPackageReceivedSyncService $service */
|
|
|
- $service = app('OrderPackageReceivedSyncService');
|
|
|
- $service->syncLogisticRoute(false, $logistic_numbers);
|
|
|
-
|
|
|
-
|
|
|
-// $logistic_numbers = OrderPackage::query()
|
|
|
-// ->select(['logistic_number', 'order_id', 'id'])
|
|
|
-// ->whereIn('order_id', function ($query) {
|
|
|
-// $query->from('orders')->selectRaw('id')->whereIn('logistic_id', function ($builder) {
|
|
|
-// $builder->from('logistics')->selectRaw('id')->where('type', '=', '快递')->whereNotIn('belong_company', ['顺丰', '中通', '韵达', '圆通', '京东']);
|
|
|
-// });
|
|
|
-// })
|
|
|
-// ->where('exception_status', 5)
|
|
|
-// ->where('created_at', '>=', now()->subDays(20)->toDateTimeString())
|
|
|
-// ->pluck('logistic_number');
|
|
|
-// $service->syncLogisticRouteByAliJiSu($logistic_numbers);
|
|
|
- }
|
|
|
-
|
|
|
- public function store()
|
|
|
- {
|
|
|
- ini_set('max_execution_time', 0);
|
|
|
- ini_set('memory_limit', '1024M');
|
|
|
-// $now = Carbon::now();
|
|
|
-// $startDate = $this->getDate();
|
|
|
- $startDate = '2021-09-25 13:23:14';
|
|
|
- $diffDay = 1; // 天数
|
|
|
- for($i = 0;$i<=$diffDay;$i++){
|
|
|
- $endDate = Carbon::parse($startDate)->addDays(1)->toDateTimeString();
|
|
|
- $doc_asn_headers = $this->getDocAsnHeader($startDate,$endDate);
|
|
|
-// if (count($doc_asn_headers)>0){
|
|
|
-// $this->syncStores($doc_asn_headers);
|
|
|
-// $this->syncDate($endDate);
|
|
|
-// }
|
|
|
- dump($startDate,$endDate);
|
|
|
- $startDate = $endDate;
|
|
|
- }
|
|
|
- $this->clearCache();
|
|
|
-// ValueStore::query()->updateOrCreate([
|
|
|
-// 'name' => 'last_asn_sync_task_end_at',
|
|
|
-// ], [
|
|
|
-// 'name' => 'last_asn_sync_task_end_at',
|
|
|
-// 'value' => $now,
|
|
|
-// ]);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- public function getDocAsnHeader($startDate,$endDate)
|
|
|
- {
|
|
|
- return OracleDOCASNHeader::query()
|
|
|
- ->with(['asnType', 'asnStatus'])
|
|
|
- ->select('asnno','asnstatus','asntype','addtime','edittime','customerid','notes','warehouseid','asnreference3','asnreference2')
|
|
|
- ->where('EditTime', '>=', $startDate)
|
|
|
- ->where('EditTime', '<=', $endDate)
|
|
|
- ->whereColumn('EditTime', '<>', 'addTime')
|
|
|
- ->orderByDesc('EditTime')
|
|
|
- ->get();
|
|
|
- }
|
|
|
-
|
|
|
- public function getDate(){
|
|
|
- return ValueStore::query()->where('name','asn_last_updated_sync_at')->value('value');
|
|
|
- }
|
|
|
-
|
|
|
- public function syncStores($doc_asn_headers){
|
|
|
- $service = new StoreService();
|
|
|
- $service->createStore($doc_asn_headers,"update");
|
|
|
- $service->updateStore($doc_asn_headers);
|
|
|
- $service->createStoreRejected($doc_asn_headers);
|
|
|
- unset($doc_asn_headers);
|
|
|
- }
|
|
|
-
|
|
|
- public function syncDate($date)
|
|
|
- {
|
|
|
- // 同步更新时间
|
|
|
- ValueStore::query()->updateOrCreate([
|
|
|
- 'name' => 'asn_last_updated_sync_at',
|
|
|
- ], [
|
|
|
- 'name' => 'asn_last_updated_sync_at',
|
|
|
- 'value' => $date,
|
|
|
- ]);
|
|
|
- }
|
|
|
- public function clearCache()
|
|
|
- {
|
|
|
- $service = new StoreService();
|
|
|
- $update_set = config('sync.asn_sync.cache_prefix.update_set');
|
|
|
- $update_keys = config('sync.asn_sync.cache_prefix.update_keys');
|
|
|
- $service->deleteCacheKey($update_set, $update_keys);
|
|
|
- // 清空保存 ans 号的栈
|
|
|
- // 清除 更新时间 开始 结束
|
|
|
- }
|
|
|
- public function updateStoreItem()
|
|
|
- {
|
|
|
- ini_set('max_execution_time', 0);
|
|
|
- ini_set('memory_limit', '1024M');
|
|
|
- $storeIds = Store::query()
|
|
|
- ->where('updated_at', '>=', '2021-09-25 13:21:26')
|
|
|
- ->whereColumn('updated_at', '<>', 'created_at')
|
|
|
- ->pluck('id');
|
|
|
-
|
|
|
- $storeItemMaxIds = StoreItem::query()
|
|
|
- ->selectRaw('max(id) as max_id')
|
|
|
- ->whereIn('store_id', $storeIds)
|
|
|
- ->groupBy(['store_id', 'asn_line_code'])
|
|
|
- ->get();
|
|
|
-// dd($storeItemMaxIds->count());
|
|
|
- $storeItems = StoreItem::query()
|
|
|
- ->whereIn('store_id', $storeIds)
|
|
|
- ->whereNotIn('id', $storeItemMaxIds)
|
|
|
- ->delete();
|
|
|
- }
|
|
|
-
|
|
|
- public function init_SettlementBillReportTask()
|
|
|
- {
|
|
|
- $this->dispatch(new SettlementBillReportJob('2021-09-01',[]));
|
|
|
- }
|
|
|
- public function test2(){
|
|
|
- $source_file ="E:\OneDrive\桌面\工作目录\文件库\\5.jpg";
|
|
|
-
|
|
|
- $img = ImageCreateFromJpeg($source_file);
|
|
|
- imagecolortransparent($img);//将某个颜色设置成透明色
|
|
|
- imagecolorstotal($img);
|
|
|
- header('Content-type:image/jpeg');
|
|
|
- imagejpeg($img);
|
|
|
- //dd($this->run('E:\OneDrive\桌面\工作目录\文件库\5.jpg', 'E:\OneDrive\桌面\工作目录\文件库\6.jpg'));
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- const FILE_NOT_FOUND = '-1';
|
|
|
- const FILE_EXTNAME_ILLEGAL = '-2';
|
|
|
-
|
|
|
- public function run($src1, $src2) {
|
|
|
- if(!is_file($src1) || !is_file($src2)) exit(self::FILE_NOT_FOUND);
|
|
|
- $hash1 = $this->getHashValue($src1);
|
|
|
- $hash2 = $this->getHashValue($src2);
|
|
|
- if(strlen($hash1) !== strlen($hash2)) return false;
|
|
|
- $count = 0;
|
|
|
- $len = strlen($hash1);
|
|
|
- for($i = 0; $i < $len; $i++) if($hash1[$i] !== $hash2[$i]){
|
|
|
- $count++;
|
|
|
- }
|
|
|
- dd($count);
|
|
|
- return $count <= 10 ? true : false;
|
|
|
- }
|
|
|
-
|
|
|
- public function getImage($file) {
|
|
|
- $extname = pathinfo($file, PATHINFO_EXTENSION);
|
|
|
- if(!in_array($extname, ['jpg','jpeg','png','gif'])) exit(self::FILE_EXTNAME_ILLEGAL);
|
|
|
- $img = call_user_func('imagecreatefrom'. ( $extname == 'jpg' ? 'jpeg' : $extname ) , $file);
|
|
|
- return $img;
|
|
|
- }
|
|
|
- public function getHashValue($file) {
|
|
|
- $w = 32;
|
|
|
- $h = 32;
|
|
|
- $img = imagecreatetruecolor($w, $h);
|
|
|
- list($src_w, $src_h) = getimagesize($file);
|
|
|
- $src = $this->getImage($file);
|
|
|
- imagecopyresampled($img, $src, 0, 0, 0, 0, $w, $h, $src_w, $src_h);
|
|
|
- imagedestroy($src);
|
|
|
- $total = 0;
|
|
|
- $array = array();
|
|
|
- for( $y = 0; $y < $h; $y++) {
|
|
|
- for ($x = 0; $x < $w; $x++) {
|
|
|
- $rgb = imagecolorat($img, $x, $y);
|
|
|
- $gray = $rgb & 0xFF;
|
|
|
- /*dump([
|
|
|
- ($rgb >> 8) & 0xFF,
|
|
|
- ($rgb >> 16) & 0xFF,
|
|
|
- $rgb & 0xFF,
|
|
|
- ]);*/
|
|
|
- if(!isset($array[$y])) $array[$y] = array();
|
|
|
- $array[$y][$x] = $gray;
|
|
|
- $total += $gray;
|
|
|
- }
|
|
|
- }
|
|
|
- imagedestroy($img);
|
|
|
- $average = intval($total / ($w * $h * 2));
|
|
|
- $hash = '';
|
|
|
- for($y = 0; $y < $h; $y++) {
|
|
|
- for($x = 0; $x < $w; $x++) {
|
|
|
- $hash .= ($array[$y][$x] >= $average) ? '1' : '0';
|
|
|
- }
|
|
|
- }
|
|
|
- dump($hash);
|
|
|
- return $hash;
|
|
|
- }
|
|
|
-
|
|
|
- public function sortTransferStatus()
|
|
|
- {
|
|
|
- $orderPackage = OrderPackage::query()->where('logistic_number','75601831068018')->first();
|
|
|
- app('OrderPackageService')->sortOrderPackageTransferStatus($orderPackage);
|
|
|
- dd($orderPackage);
|
|
|
- }
|
|
|
-
|
|
|
- public function clear_work_space()
|
|
|
- {
|
|
|
- \App\LaborApply::query()->truncate();
|
|
|
-
|
|
|
- LaborCompanyDispatch::query()->truncate();
|
|
|
-
|
|
|
- \App\LaborCompanyDispatchDetail::query()->truncate();
|
|
|
- }
|
|
|
-
|
|
|
- public function testChange()
|
|
|
- {
|
|
|
- $last_start_key = config('sync.order_sync.cache_prefix.last_start_at');
|
|
|
- $last_end_key = config('sync.order_sync.cache_prefix.last_end_at');
|
|
|
- Cache::put($last_start_key,Carbon::make('2021-10-12 06:23:37'));
|
|
|
- Cache::put($last_end_key,Carbon::make('2021-10-12 06:23:38'));
|
|
|
- ValueStore::query()->where('name','order_last_created_sync_at')->update(['value' => '2021-10-12 06:23:37']);
|
|
|
- ValueStore::query()->where('name','order_last_updated_sync_at')->update(['value' => '2021-10-12 06:23:37']);
|
|
|
- ValueStore::query()->where('name','last_order_sync_task_start_at')->update(['value' => '2021-10-12 06:23:37']);
|
|
|
- ValueStore::query()->where('name','last_order_sync_task_end_at')->update(['value' => '2021-10-12 06:23:38']);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- public function syncOrder()
|
|
|
- {
|
|
|
- $code = \request("code");
|
|
|
- $service = new OracleDOCOrderHeaderService();
|
|
|
- $orderService = new OrderService();
|
|
|
- $orderHeaders = $service->getQuery()->where('DOC_Order_Header.WaveNo',$code)->get();
|
|
|
- $orderService->syncOrderByWMSOrderHeaders($orderHeaders);
|
|
|
- app("OrderCommodityService")->syncOrderCommodity($orderHeaders);
|
|
|
- dd('同步完成');
|
|
|
- }
|
|
|
-
|
|
|
- public function test_sddgdfg()
|
|
|
- {
|
|
|
- /** @var OwnerStoreOutFeeReportService $service */
|
|
|
- $service = app('OwnerStoreOutFeeReportService');
|
|
|
- $service->recordReport(null, [2]);
|
|
|
- }
|
|
|
-
|
|
|
- public function testZhenCang()
|
|
|
- {
|
|
|
- $batches=Batch::query()->where('id',161071)->get();
|
|
|
- BroadcastBatchToZhengCangJob::dispatch($batches);
|
|
|
- }
|
|
|
}
|