Commit 903ac684 authored by hangjun83's avatar hangjun83

openapi 震坤行

parent b7f8eba4
......@@ -45,6 +45,9 @@ class ZhenkhJob extends Job
case 'getDeliveryOrderDetail' :
$service->getDeliveryOrderPdf($this->params);
break;
case 'orderNoRollBack' :
$service->orderNoRollBack();
break;
default:
}
}
......
......@@ -23,6 +23,28 @@ class RhawnOrdersService
$this->dataEntries = app(PlatformDataEntriesService::class);
}
/**
* @恢复orderNo
* @param $offset
* @param int $pageSize
* @return false|void
*/
public function rollBackOrderNo($offset,$pageSize = 1000)
{
$dbConnect = DB::connection('rhawn_mysql');
$rows = $dbConnect->table('sorders')
->where('so_no','20220826-1090846')
->offset($offset)
->limit($pageSize)
->get()->toArray();
if(!$rows) return false;
foreach($rows as $row){
$orderNo = 1000000 + $row->so_id;
$orderNo = date('Ymd',$row->so_ctime).'-'.$orderNo;
$dbConnect->table('sorders')->where('so_id',$row->so_id)->update(['so_no' => $orderNo]);
}
}
public function getSorderDetail($orderNo)
{
$sOrder = app(RhawnSordersRepository::class)->getSorderFromOrderCusPo($orderNo);
......@@ -61,9 +83,18 @@ class RhawnOrdersService
return $returnItem;
}
public function getSorderDeliveryDetail()
public function getSorderDeliveryDetail($dpdId)
{
$dbConnect = DB::connection('rhawn_mysql');
$dpdetail = $dbConnect->table('dpdetail')
->join('dispatch','dispatch.dp_id','dpdetail.dp_id')
->where('dpd_id',$dpdId)
->get()->toArray();
if($dpdetail){
$dpdetail = current($dpdetail);
return $dpdetail;
}
return null;
}
/**
......@@ -146,7 +177,9 @@ class RhawnOrdersService
$so_no = 1000000 + $orderId;
$so_no = date('Ymd',time()).'-'.$so_no;
$dbConnect->table('sorders')->update(['so_no' => $so_no]);
$dbConnect->table('sorders')
->where('so_id',$orderId)
->update(['so_no' => $so_no]);
$data['express'] = $orderDetail['totalFreight'];
$tempSku = [];
......@@ -181,6 +214,7 @@ class RhawnOrdersService
$orderItemsArray['si_nodes'] = '';
$orderItemsArray['si_notes'] = '';
$orderItemsArray['si_sales_note'] = '';
$orderItemsArray['si_cus_note'] = '';
$dbConnect->table('soitems')->insert($orderItemsArray);
}
......
......@@ -17,6 +17,17 @@ class ZhenKhService
$this->rhawnOrderService = app(RhawnOrdersService::class);
}
public function orderNoRollBack()
{
$page = 1;
$limit = 10000;
while(true){
$result = $this->rhawnOrderService->rollBackOrderNo($page * $limit, $limit);
if(!$result) break;
$page ++;
}
}
/**
* @上报商品的价格及库存
* @param $params
......@@ -214,8 +225,7 @@ class ZhenKhService
public function sendDeliveryOrder($deliveryId)
{
try{
$order = $this->rhawnOrderService->getSorderDeliveryDetail($deliveryId);
$orderDelivery = $this->rhawnOrderService->getSorderDeliveryDetail($deliveryId);
$expressArray = $this->apiService->getPlatformDataEntries('zkh_order_express','data_values');
if(empty($expressArray)){
$expressList = $this->apiService->expressLogistics($this->getToken());
......@@ -237,9 +247,9 @@ class ZhenKhService
//$deliveryOrderPost['deliveryTime']
//获取发货单的详情
$deliveryOrder = $this->apiService->sendDeliveryOrder($orderNo,$this->getToken());
//$deliveryOrder = $this->apiService->sendDeliveryOrder($orderNo,$this->getToken());
//确认发货
$this->apiService->ackDeliveryOrder($order,$deliveryOrder,$this->getToken());
//$this->apiService->ackDeliveryOrder($order,$deliveryOrder,$this->getToken());
}catch(\Throwable $exception){
SimpleLogs::writeLog($exception->getMessage(),'sendDeliveryOrder', 'error');
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment