|
|
@@ -72,6 +72,7 @@ use App\Services\OrderPackageService;
|
|
|
use App\Services\OrderService;
|
|
|
use App\Services\OrderTrackingService;
|
|
|
use App\Services\OwnerLogisticFeeDetailService;
|
|
|
+use App\Services\OwnerLogisticFeeReportService;
|
|
|
use App\Services\RejectedBillService;
|
|
|
use App\Services\StoreService;
|
|
|
use App\Services\SupplierService;
|
|
|
@@ -128,11 +129,17 @@ class TestController extends Controller
|
|
|
{
|
|
|
return call_user_func([$this, $method], $request);
|
|
|
}
|
|
|
+
|
|
|
public function test()
|
|
|
{
|
|
|
ini_set('max_execution_time', 2500);
|
|
|
$model = MaterialBoxModel::query()->create([
|
|
|
"code" => "common"
|
|
|
+ StationTask::destroy([1278, 1279, 1280, 1282, 1283]);
|
|
|
+ StationTaskMaterialBox::destroy([18405, 18406, 18407, 18409, 18410]);
|
|
|
+ dd("OK");
|
|
|
+ $s = Station::query()->select("id")->where("parent_id", 6)->whereNotIn("code", [
|
|
|
+ "HAIB1-01-01", "HAIB1-03-01", "HAIB1-03-03"
|
|
|
]);
|
|
|
$sql = <<<sql
|
|
|
select * from INV_LOT_LOC_ID where traceid = '*' and locationid like 'IDE%'
|
|
|
@@ -159,7 +166,15 @@ sql;
|
|
|
"amount" => $inv->qty,
|
|
|
]);
|
|
|
}
|
|
|
+ dd($s->get());
|
|
|
+ $t = StationTask::query()->select("id")->where("status", '待处理')
|
|
|
+ ->whereIn("station_id", $s);
|
|
|
+ StationTask::query()->where("status", '待处理')
|
|
|
+ ->whereIn("station_id", $s)->update(["status" => "完成"]);
|
|
|
+ StationTaskMaterialBox::query()->whereIn("station_task_id", $t)->update(["status" => "完成"]);
|
|
|
+ dd("OK");
|
|
|
}
|
|
|
+
|
|
|
public function orderCreateBill()
|
|
|
{
|
|
|
$order = Order::query()->find(\request("id"));
|
|
|
@@ -167,25 +182,26 @@ sql;
|
|
|
$ser->createInstantBill($order);
|
|
|
dd("order create bill success");
|
|
|
}
|
|
|
+
|
|
|
public function supplementMarchOwnerReport()
|
|
|
{
|
|
|
- $ows = OwnerAreaReport::query()->select("owner_id")->where("counting_month",'like',"2021-03%")->get();
|
|
|
- $owners = Owner::query()->whereNotIn("id",array_column($ows->toArray(),"owner_id"))->get();
|
|
|
+ $ows = OwnerAreaReport::query()->select("owner_id")->where("counting_month", 'like', "2021-03%")->get();
|
|
|
+ $owners = Owner::query()->whereNotIn("id", array_column($ows->toArray(), "owner_id"))->get();
|
|
|
$createOwnerAreaReport = [];
|
|
|
- foreach ($owners as $owner){
|
|
|
- if (!$owner->ownerStoragePriceModels)continue;
|
|
|
- foreach ($owner->ownerStoragePriceModels as $model){
|
|
|
- $key = $owner->id."_".$model->id;
|
|
|
+ foreach ($owners as $owner) {
|
|
|
+ if (!$owner->ownerStoragePriceModels) continue;
|
|
|
+ foreach ($owner->ownerStoragePriceModels as $model) {
|
|
|
+ $key = $owner->id . "_" . $model->id;
|
|
|
if (!isset($sign[$key])) $createOwnerAreaReport[] = [
|
|
|
- "owner_id" => $owner->id,
|
|
|
- "counting_month" => "2021-03-01",
|
|
|
- "user_owner_group_id" => $owner->user_owner_group_id,
|
|
|
- "created_at" => "2021-04-15 00:00:00",
|
|
|
- "owner_storage_price_model_id" => $model->id,
|
|
|
+ "owner_id" => $owner->id,
|
|
|
+ "counting_month" => "2021-03-01",
|
|
|
+ "user_owner_group_id" => $owner->user_owner_group_id,
|
|
|
+ "created_at" => "2021-04-15 00:00:00",
|
|
|
+ "owner_storage_price_model_id" => $model->id,
|
|
|
];
|
|
|
}
|
|
|
}
|
|
|
- if ($createOwnerAreaReport)DB::table("owner_area_reports")->insert($createOwnerAreaReport);
|
|
|
+ if ($createOwnerAreaReport) DB::table("owner_area_reports")->insert($createOwnerAreaReport);
|
|
|
}
|
|
|
|
|
|
public function assignBatch()
|
|
|
@@ -358,11 +374,11 @@ sql;
|
|
|
public function tj2(Request $request)
|
|
|
{
|
|
|
|
|
|
- dd((function (){
|
|
|
- try{
|
|
|
+ dd((function () {
|
|
|
+ try {
|
|
|
throw new Exception();
|
|
|
return 1;
|
|
|
- }catch (\Exception $e){
|
|
|
+ } catch (\Exception $e) {
|
|
|
return 2;
|
|
|
}
|
|
|
})());
|
|
|
@@ -661,9 +677,9 @@ sql;
|
|
|
|
|
|
public function testImp()
|
|
|
{
|
|
|
- $batch=Batch::query()->first();
|
|
|
+ $batch = Batch::query()->first();
|
|
|
dump($batch->created_at);
|
|
|
- dump($batch->created_at<Carbon::now()->subDay());
|
|
|
+ dump($batch->created_at < Carbon::now()->subDay());
|
|
|
dump(Carbon::now()->subDay());
|
|
|
}
|
|
|
|
|
|
@@ -889,14 +905,15 @@ sql;
|
|
|
|
|
|
public function ld2()
|
|
|
{
|
|
|
- $r=new \Illuminate\Support\Collection();
|
|
|
+ $r = new \Illuminate\Support\Collection();
|
|
|
$sb = StationTaskBatch::query()->limit(3)->get();
|
|
|
- dump(data_get($sb,'*.id'));
|
|
|
+ dump(data_get($sb, '*.id'));
|
|
|
foreach ($sb as $s) {
|
|
|
$r->push($s);
|
|
|
}
|
|
|
- dump(data_get($sb,'*.id'));
|
|
|
+ dump(data_get($sb, '*.id'));
|
|
|
}
|
|
|
+
|
|
|
public function y111()
|
|
|
{
|
|
|
$controller = new SendEmailsController();
|
|
|
@@ -966,6 +983,7 @@ sql;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
public function addProcurementData()
|
|
|
{
|
|
|
$this->syncUserDetail();
|
|
|
@@ -974,23 +992,25 @@ sql;
|
|
|
$this->addProcurementQuotation();
|
|
|
$this->addProcurementCheckSheet();
|
|
|
}
|
|
|
+
|
|
|
public function syncUserDetail()
|
|
|
{
|
|
|
- $sql=DB::raw('SELECT * from user where supplierid is not null');
|
|
|
+ $sql = DB::raw('SELECT * from user where supplierid is not null');
|
|
|
$params = DB::connection('erp')->select($sql);
|
|
|
- $user_Details=UserDetail::query()->where('created_at','like','2021-04-12%')->get();
|
|
|
+ $user_Details = UserDetail::query()->where('created_at', 'like', '2021-04-12%')->get();
|
|
|
$dataHandlerService = app(DataHandlerService::class);
|
|
|
$user_Details_map = $dataHandlerService->dataHeader(['mobile_phone'], $user_Details);
|
|
|
- foreach ($params as $param){
|
|
|
+ foreach ($params as $param) {
|
|
|
$user_detail = $dataHandlerService->getKeyValue(['mobile_phone' => $param->mobile], $user_Details_map);
|
|
|
if (!$user_detail) continue;
|
|
|
- $user_detail->update(['procurement_wechat_open_id'=>$param->openid]);
|
|
|
+ $user_detail->update(['procurement_wechat_open_id' => $param->openid]);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public function addProcurementDeliver(){
|
|
|
+ public function addProcurementDeliver()
|
|
|
+ {
|
|
|
//送货单
|
|
|
- $sql=DB::raw('SELECT
|
|
|
+ $sql = DB::raw('SELECT
|
|
|
deliver.id id,request.id procurement_id,deliver.delivernum amount,deliver.status status,deliver.accepttime signed_at,
|
|
|
deliver.createtime created_at,deliver.createtime updated_at,deliver.confirmnum receipt_amount
|
|
|
from deliver
|
|
|
@@ -999,17 +1019,17 @@ LEFT JOIN ask on purch.askid=ask.id
|
|
|
LEFT JOIN request on ask.requestid=request.id
|
|
|
where purch.islower=1');
|
|
|
$params = DB::connection('erp')->select($sql);
|
|
|
- $insert=[];
|
|
|
- foreach ($params as $param){
|
|
|
- $insert[]=[
|
|
|
- 'id'=>$param->id,
|
|
|
- 'procurement_id'=>$param->procurement_id,
|
|
|
- 'amount'=>$param->amount,
|
|
|
- 'status'=>$param->status?$param->status-1:$param->status,
|
|
|
- 'signed_at'=>Carbon::parse($param->signed_at)->toDateString(),
|
|
|
- 'created_at'=>Carbon::parse($param->created_at)->toDateTimeString(),
|
|
|
- 'updated_at'=>Carbon::parse($param->updated_at)->toDateTimeString(),
|
|
|
- 'receipt_amount'=>$param->receipt_amount,
|
|
|
+ $insert = [];
|
|
|
+ foreach ($params as $param) {
|
|
|
+ $insert[] = [
|
|
|
+ 'id' => $param->id,
|
|
|
+ 'procurement_id' => $param->procurement_id,
|
|
|
+ 'amount' => $param->amount,
|
|
|
+ 'status' => $param->status ? $param->status - 1 : $param->status,
|
|
|
+ 'signed_at' => Carbon::parse($param->signed_at)->toDateString(),
|
|
|
+ 'created_at' => Carbon::parse($param->created_at)->toDateTimeString(),
|
|
|
+ 'updated_at' => Carbon::parse($param->updated_at)->toDateTimeString(),
|
|
|
+ 'receipt_amount' => $param->receipt_amount,
|
|
|
];
|
|
|
}
|
|
|
ProcurementDeliverie::query()->insert($insert);
|
|
|
@@ -1019,7 +1039,7 @@ where purch.islower=1');
|
|
|
{
|
|
|
|
|
|
//采购单
|
|
|
- $sql=DB::raw('select request.id id,
|
|
|
+ $sql = DB::raw('select request.id id,
|
|
|
request.number code,request.type type,request.resourceid owner_material_id,purch.supplierid supplier_id,request.num quantity, request.sellnum amount,
|
|
|
request.price unit_price,purch.acceptprice cost_price,request.status status,request.createtime created_at,request.createtime updated_at,
|
|
|
purch.accepttime deadline
|
|
|
@@ -1028,151 +1048,155 @@ LEFT JOIN ask on purch.askid= ask.id
|
|
|
LEFT JOIN request on ask.requestid=request.id
|
|
|
where purch.islower=1 and request.type=3 ORDER BY request.id ASC');
|
|
|
$params = DB::connection('erp')->select($sql);
|
|
|
- $insert=[];
|
|
|
- foreach ($params as $param){
|
|
|
- if (!$param->status)continue;
|
|
|
- if ($param->status==0)$status=10;
|
|
|
- if ($param->status==1)$status=0;
|
|
|
- if ($param->status==2)$status=1;
|
|
|
- if ($param->status==3)$status=2;
|
|
|
- if ($param->status==4)$status=11;
|
|
|
- if ($param->status==5)$status=4;
|
|
|
- if ($param->status==6)$status=5;
|
|
|
- if ($param->status==7)$status=6;
|
|
|
- if ($param->status==8)$status=8;
|
|
|
- if ($param->status==9)$status=9;
|
|
|
- $key=$param->id;
|
|
|
- $insert[$key]=[
|
|
|
- 'id'=>$param->id,
|
|
|
- 'code'=>$param->code,
|
|
|
- 'type'=>0,
|
|
|
- 'owner_material_id'=>$param->owner_material_id,
|
|
|
- 'supplier_id'=>$param->supplier_id,
|
|
|
- 'quantity'=>$param->quantity,
|
|
|
- 'amount'=>$param->amount,
|
|
|
- 'unit_price'=>$param->unit_price,
|
|
|
- 'cost_price'=>$param->cost_price,
|
|
|
- 'initiator'=>0,
|
|
|
- 'status'=>$status,
|
|
|
- 'created_at'=>Carbon::parse($param->created_at)->toDateTimeString(),
|
|
|
- 'updated_at'=>Carbon::parse($param->updated_at)->toDateTimeString(),
|
|
|
- 'deadline'=>Carbon::parse($param->deadline)->toDateTimeString(),
|
|
|
+ $insert = [];
|
|
|
+ foreach ($params as $param) {
|
|
|
+ if (!$param->status) continue;
|
|
|
+ if ($param->status == 0) $status = 10;
|
|
|
+ if ($param->status == 1) $status = 0;
|
|
|
+ if ($param->status == 2) $status = 1;
|
|
|
+ if ($param->status == 3) $status = 2;
|
|
|
+ if ($param->status == 4) $status = 11;
|
|
|
+ if ($param->status == 5) $status = 4;
|
|
|
+ if ($param->status == 6) $status = 5;
|
|
|
+ if ($param->status == 7) $status = 6;
|
|
|
+ if ($param->status == 8) $status = 8;
|
|
|
+ if ($param->status == 9) $status = 9;
|
|
|
+ $key = $param->id;
|
|
|
+ $insert[$key] = [
|
|
|
+ 'id' => $param->id,
|
|
|
+ 'code' => $param->code,
|
|
|
+ 'type' => 0,
|
|
|
+ 'owner_material_id' => $param->owner_material_id,
|
|
|
+ 'supplier_id' => $param->supplier_id,
|
|
|
+ 'quantity' => $param->quantity,
|
|
|
+ 'amount' => $param->amount,
|
|
|
+ 'unit_price' => $param->unit_price,
|
|
|
+ 'cost_price' => $param->cost_price,
|
|
|
+ 'initiator' => 0,
|
|
|
+ 'status' => $status,
|
|
|
+ 'created_at' => Carbon::parse($param->created_at)->toDateTimeString(),
|
|
|
+ 'updated_at' => Carbon::parse($param->updated_at)->toDateTimeString(),
|
|
|
+ 'deadline' => Carbon::parse($param->deadline)->toDateTimeString(),
|
|
|
];
|
|
|
}
|
|
|
Procurement::query()->insert($insert);
|
|
|
|
|
|
//打样 或者 询价
|
|
|
- $procurement_ids=Procurement::query()->select('id')->get();
|
|
|
- $ids = $procurement_ids->map(function($procurement){
|
|
|
+ $procurement_ids = Procurement::query()->select('id')->get();
|
|
|
+ $ids = $procurement_ids->map(function ($procurement) {
|
|
|
return $procurement['id'];
|
|
|
});
|
|
|
$idSql = "(''";
|
|
|
- foreach ($ids as $id)$idSql.=",".$id;
|
|
|
+ foreach ($ids as $id) $idSql .= "," . $id;
|
|
|
$idSql .= ")";
|
|
|
- $sql=DB::raw('select * from request where id not in '.$idSql);
|
|
|
- $params=DB::connection('erp')->select($sql);
|
|
|
- $insert=[];
|
|
|
- foreach ($params as $param){
|
|
|
- if (!$param->status)continue;
|
|
|
- if (!$param->type)continue;
|
|
|
- if ($param->status==0)$status=10;
|
|
|
- if ($param->status==1)$status=0;
|
|
|
- if ($param->status==2)$status=1;
|
|
|
- if ($param->status==3)$status=2;
|
|
|
- if ($param->status==4)$status=11;
|
|
|
- if ($param->status==5)$status=4;
|
|
|
- if ($param->status==6)$status=5;
|
|
|
- if ($param->status==7)$status=6;
|
|
|
- if ($param->status==8)$status=8;
|
|
|
- if ($param->status==9)$status=9;
|
|
|
- if ($param->type==3){
|
|
|
- $type=0;
|
|
|
- }else{
|
|
|
- $type=$param->type;
|
|
|
+ $sql = DB::raw('select * from request where id not in ' . $idSql);
|
|
|
+ $params = DB::connection('erp')->select($sql);
|
|
|
+ $insert = [];
|
|
|
+ foreach ($params as $param) {
|
|
|
+ if (!$param->status) continue;
|
|
|
+ if (!$param->type) continue;
|
|
|
+ if ($param->status == 0) $status = 10;
|
|
|
+ if ($param->status == 1) $status = 0;
|
|
|
+ if ($param->status == 2) $status = 1;
|
|
|
+ if ($param->status == 3) $status = 2;
|
|
|
+ if ($param->status == 4) $status = 11;
|
|
|
+ if ($param->status == 5) $status = 4;
|
|
|
+ if ($param->status == 6) $status = 5;
|
|
|
+ if ($param->status == 7) $status = 6;
|
|
|
+ if ($param->status == 8) $status = 8;
|
|
|
+ if ($param->status == 9) $status = 9;
|
|
|
+ if ($param->type == 3) {
|
|
|
+ $type = 0;
|
|
|
+ } else {
|
|
|
+ $type = $param->type;
|
|
|
}
|
|
|
- $insert[$param->id]=[
|
|
|
- 'id'=>$param->id,
|
|
|
- 'code'=>$param->number,
|
|
|
- 'type'=>$type,
|
|
|
- 'owner_material_id'=>$param->resourceid,
|
|
|
- 'quantity'=>$param->num,
|
|
|
- 'amount'=>$param->sellnum,
|
|
|
- 'unit_price'=>$param->price,
|
|
|
- 'initiator'=>0,
|
|
|
- 'status'=>$status,
|
|
|
- 'created_at'=>Carbon::parse($param->createtime)->toDateTimeString(),
|
|
|
- 'updated_at'=>Carbon::parse($param->createtime)->toDateTimeString(),
|
|
|
- 'deadline'=>Carbon::parse($param->createtime)->subHours(-4)->toDateTimeString(),
|
|
|
+ $insert[$param->id] = [
|
|
|
+ 'id' => $param->id,
|
|
|
+ 'code' => $param->number,
|
|
|
+ 'type' => $type,
|
|
|
+ 'owner_material_id' => $param->resourceid,
|
|
|
+ 'quantity' => $param->num,
|
|
|
+ 'amount' => $param->sellnum,
|
|
|
+ 'unit_price' => $param->price,
|
|
|
+ 'initiator' => 0,
|
|
|
+ 'status' => $status,
|
|
|
+ 'created_at' => Carbon::parse($param->createtime)->toDateTimeString(),
|
|
|
+ 'updated_at' => Carbon::parse($param->createtime)->toDateTimeString(),
|
|
|
+ 'deadline' => Carbon::parse($param->createtime)->subHours(-4)->toDateTimeString(),
|
|
|
];
|
|
|
}
|
|
|
Procurement::query()->insert($insert);
|
|
|
|
|
|
//删除没有项目耗材的采购记录
|
|
|
- $OwnerMaterialIds=OwnerMaterial::query()->select('id')->get();
|
|
|
- $Procurements=Procurement::query()->whereNotIn('owner_material_id',$OwnerMaterialIds)->get();
|
|
|
- $data=[];
|
|
|
- foreach ($Procurements as $procurement){
|
|
|
- $data[]=$procurement->owner_material_id;
|
|
|
+ $OwnerMaterialIds = OwnerMaterial::query()->select('id')->get();
|
|
|
+ $Procurements = Procurement::query()->whereNotIn('owner_material_id', $OwnerMaterialIds)->get();
|
|
|
+ $data = [];
|
|
|
+ foreach ($Procurements as $procurement) {
|
|
|
+ $data[] = $procurement->owner_material_id;
|
|
|
$procurement->delete();
|
|
|
}
|
|
|
}
|
|
|
- public function addProcurementQuotation(){
|
|
|
+
|
|
|
+ public function addProcurementQuotation()
|
|
|
+ {
|
|
|
//报价单
|
|
|
- $procurement_ids=Procurement::query()->select('id')->get();
|
|
|
- $ids = $procurement_ids->map(function($procurement){
|
|
|
+ $procurement_ids = Procurement::query()->select('id')->get();
|
|
|
+ $ids = $procurement_ids->map(function ($procurement) {
|
|
|
return $procurement['id'];
|
|
|
});
|
|
|
$idSql = "(''";
|
|
|
- foreach ($ids as $id)$idSql.=",".$id;
|
|
|
+ foreach ($ids as $id) $idSql .= "," . $id;
|
|
|
$idSql .= ")";
|
|
|
- $sql=DB::raw('SELECT purch.id id,request.id procurement_id,purch.supplierid supplier_id,
|
|
|
+ $sql = DB::raw('SELECT purch.id id,request.id procurement_id,purch.supplierid supplier_id,
|
|
|
purch.acceptprice offer,purch.accepttime quoted_at,purch.status status,
|
|
|
purch.accepttime created_at,purch.accepttime updated_at
|
|
|
FROM purch
|
|
|
LEFT JOIN ask on purch.askid=ask.id
|
|
|
LEFT JOIN request on ask.requestid=request.id
|
|
|
-where request.id in'.$idSql);
|
|
|
- $params=DB::connection('erp')->select($sql);
|
|
|
- foreach ($params as $param){
|
|
|
- $key=$param->id;
|
|
|
- $insert[$key]=[
|
|
|
- 'id'=>$param->id,
|
|
|
- 'procurement_id'=>$param->procurement_id,
|
|
|
- 'supplier_id'=>$param->supplier_id,
|
|
|
- 'offer'=>$param->offer,
|
|
|
- 'status'=>$param->status,
|
|
|
- 'quoted_at'=>Carbon::parse($param->quoted_at)->toDateTimeString(),
|
|
|
- 'created_at'=>Carbon::parse($param->created_at)->toDateTimeString(),
|
|
|
- 'updated_at'=>Carbon::parse($param->updated_at)->toDateTimeString(),
|
|
|
+where request.id in' . $idSql);
|
|
|
+ $params = DB::connection('erp')->select($sql);
|
|
|
+ foreach ($params as $param) {
|
|
|
+ $key = $param->id;
|
|
|
+ $insert[$key] = [
|
|
|
+ 'id' => $param->id,
|
|
|
+ 'procurement_id' => $param->procurement_id,
|
|
|
+ 'supplier_id' => $param->supplier_id,
|
|
|
+ 'offer' => $param->offer,
|
|
|
+ 'status' => $param->status,
|
|
|
+ 'quoted_at' => Carbon::parse($param->quoted_at)->toDateTimeString(),
|
|
|
+ 'created_at' => Carbon::parse($param->created_at)->toDateTimeString(),
|
|
|
+ 'updated_at' => Carbon::parse($param->updated_at)->toDateTimeString(),
|
|
|
];
|
|
|
}
|
|
|
ProcurementQuotation::query()->insert($insert);
|
|
|
}
|
|
|
- public function addProcurementCheckSheet(){
|
|
|
+
|
|
|
+ public function addProcurementCheckSheet()
|
|
|
+ {
|
|
|
//对账单
|
|
|
- $procurement_delivers=ProcurementDeliverie::query()->get();
|
|
|
+ $procurement_delivers = ProcurementDeliverie::query()->get();
|
|
|
$dataHandlerService = app(DataHandlerService::class);
|
|
|
$procurement_delivers_map = $dataHandlerService->dataHeader(['procurement_id'], $procurement_delivers);
|
|
|
- $sql=DB::raw('select request.id procurement_id,billdetail.billno invoice_number,billdetail.status status,purch.acceptnum amount,purch.acceptprice price,
|
|
|
+ $sql = DB::raw('select request.id procurement_id,billdetail.billno invoice_number,billdetail.status status,purch.acceptnum amount,purch.acceptprice price,
|
|
|
purch.accepttime created_at,purch.accepttime updated_at
|
|
|
FROM billdetail
|
|
|
LEFT JOIN purch on purch.id=billdetail.purchid
|
|
|
LEFT JOIN ask on purch.askid=ask.id
|
|
|
LEFT JOIN request on ask.requestid=request.id
|
|
|
where purch.islower=1');
|
|
|
- $params=DB::connection('erp')->select($sql);
|
|
|
+ $params = DB::connection('erp')->select($sql);
|
|
|
|
|
|
- $insert=[];
|
|
|
- foreach ($params as $param){
|
|
|
+ $insert = [];
|
|
|
+ foreach ($params as $param) {
|
|
|
$procurement_deliver = $dataHandlerService->getKeyValue(['procurement_id' => $param->procurement_id], $procurement_delivers_map);
|
|
|
if (!$procurement_deliver) continue;
|
|
|
- $insert[$param->procurement_id]=[
|
|
|
- 'procurement_delivery_id'=>$procurement_deliver->id,
|
|
|
- 'invoice_number'=>$param->invoice_number??null,
|
|
|
- 'account_payable'=>$param->amount*$param->price,
|
|
|
- 'status'=>$param->status,
|
|
|
- 'created_at'=>$param->created_at,
|
|
|
- 'updated_at'=>$param->updated_at,
|
|
|
+ $insert[$param->procurement_id] = [
|
|
|
+ 'procurement_delivery_id' => $procurement_deliver->id,
|
|
|
+ 'invoice_number' => $param->invoice_number ?? null,
|
|
|
+ 'account_payable' => $param->amount * $param->price,
|
|
|
+ 'status' => $param->status,
|
|
|
+ 'created_at' => $param->created_at,
|
|
|
+ 'updated_at' => $param->updated_at,
|
|
|
];
|
|
|
}
|
|
|
ProcurementCheckSheet::query()->insert($insert);
|
|
|
@@ -1180,111 +1204,115 @@ where purch.islower=1');
|
|
|
|
|
|
public function order_packages_exception_type_sync()
|
|
|
{
|
|
|
- $count = OrderPackage::query()->where('status', '派送异常')->update(['exception_type' => '派件异常','exception' => '是']);
|
|
|
- dump('更新了: '.$count);
|
|
|
+ $count = OrderPackage::query()->where('status', '派送异常')->update(['exception_type' => '派件异常', 'exception' => '是']);
|
|
|
+ dump('更新了: ' . $count);
|
|
|
}
|
|
|
|
|
|
public function order_packages_exception_type_and_exception_update()
|
|
|
{
|
|
|
$count_1 = OrderPackage::query()
|
|
|
- ->whereIn('exception_type', ['疑似库内丢件','揽件异常'])
|
|
|
+ ->whereIn('exception_type', ['疑似库内丢件', '揽件异常'])
|
|
|
->whereNotNull('transfer_status')
|
|
|
- ->update(['exception_type' => '无','exception' => '否']);
|
|
|
- $count_2 = OrderPackage::query()
|
|
|
- ->where('status','已收件')
|
|
|
- ->update(['exception_type' => '无','exception' => '否']);
|
|
|
- dump('更新了: '.($count_1 + $count_2));
|
|
|
+ ->update(['exception_type' => '无', 'exception' => '否']);
|
|
|
+ $count_2 = OrderPackage::query()
|
|
|
+ ->where('status', '已收件')
|
|
|
+ ->update(['exception_type' => '无', 'exception' => '否']);
|
|
|
+ dump('更新了: ' . ($count_1 + $count_2));
|
|
|
}
|
|
|
+
|
|
|
public function addProcurementDeliverAndCheckMeet()
|
|
|
{
|
|
|
- $id=ProcurementDeliverie::query()->orderByDesc('id')->value('id');
|
|
|
- $sql=DB::raw('SELECT
|
|
|
+ $id = ProcurementDeliverie::query()->orderByDesc('id')->value('id');
|
|
|
+ $sql = DB::raw('SELECT
|
|
|
deliver.id id,request.id procurement_id,deliver.delivernum amount,deliver.status status,deliver.accepttime signed_at,
|
|
|
deliver.createtime created_at,deliver.createtime updated_at,deliver.confirmnum receipt_amount
|
|
|
from deliver
|
|
|
LEFT JOIN purch on deliver.purchid=purch.id
|
|
|
LEFT JOIN ask on purch.askid=ask.id
|
|
|
LEFT JOIN request on ask.requestid=request.id
|
|
|
-where purch.islower=1 and deliver.id>'.$id);
|
|
|
+where purch.islower=1 and deliver.id>' . $id);
|
|
|
$params = DB::connection('erp')->select($sql);
|
|
|
- $insert=[];
|
|
|
- foreach ($params as $param){
|
|
|
- $insert[]=[
|
|
|
- 'id'=>$param->id,
|
|
|
- 'procurement_id'=>$param->procurement_id,
|
|
|
- 'amount'=>$param->amount,
|
|
|
- 'status'=>$param->status?$param->status-1:$param->status,
|
|
|
- 'signed_at'=>Carbon::parse($param->signed_at)->toDateString(),
|
|
|
- 'created_at'=>Carbon::parse($param->created_at)->toDateTimeString(),
|
|
|
- 'updated_at'=>Carbon::parse($param->updated_at)->toDateTimeString(),
|
|
|
- 'receipt_amount'=>$param->receipt_amount,
|
|
|
+ $insert = [];
|
|
|
+ foreach ($params as $param) {
|
|
|
+ $insert[] = [
|
|
|
+ 'id' => $param->id,
|
|
|
+ 'procurement_id' => $param->procurement_id,
|
|
|
+ 'amount' => $param->amount,
|
|
|
+ 'status' => $param->status ? $param->status - 1 : $param->status,
|
|
|
+ 'signed_at' => Carbon::parse($param->signed_at)->toDateString(),
|
|
|
+ 'created_at' => Carbon::parse($param->created_at)->toDateTimeString(),
|
|
|
+ 'updated_at' => Carbon::parse($param->updated_at)->toDateTimeString(),
|
|
|
+ 'receipt_amount' => $param->receipt_amount,
|
|
|
];
|
|
|
}
|
|
|
ProcurementDeliverie::query()->insert($insert);
|
|
|
|
|
|
- $procurement_delivers=ProcurementDeliverie::query()->where('id','>',$id)->get();
|
|
|
+ $procurement_delivers = ProcurementDeliverie::query()->where('id', '>', $id)->get();
|
|
|
$dataHandlerService = app(DataHandlerService::class);
|
|
|
$procurement_delivers_map = $dataHandlerService->dataHeader(['procurement_id'], $procurement_delivers);
|
|
|
- $sql=DB::raw('SELECT deliver.id id,request.id procurement_id,
|
|
|
+ $sql = DB::raw('SELECT deliver.id id,request.id procurement_id,
|
|
|
deliver.createtime created_at,deliver.createtime updated_at,purch.acceptnum amount,purch.acceptprice price
|
|
|
from deliver
|
|
|
LEFT JOIN purch on deliver.purchid=purch.id
|
|
|
LEFT JOIN ask on purch.askid=ask.id
|
|
|
LEFT JOIN request on ask.requestid=request.id
|
|
|
-where purch.islower=1 and deliver.id>'.$id);
|
|
|
- $params=DB::connection('erp')->select($sql);
|
|
|
- $insert_=[];
|
|
|
- foreach ($params as $param){
|
|
|
+where purch.islower=1 and deliver.id>' . $id);
|
|
|
+ $params = DB::connection('erp')->select($sql);
|
|
|
+ $insert_ = [];
|
|
|
+ foreach ($params as $param) {
|
|
|
$procurement_deliver = $dataHandlerService->getKeyValue(['procurement_id' => $param->procurement_id], $procurement_delivers_map);
|
|
|
if (!$procurement_deliver) continue;
|
|
|
- $insert_[$param->procurement_id]=[
|
|
|
- 'procurement_delivery_id'=>$procurement_deliver->id,
|
|
|
- 'account_payable'=>$param->amount*$param->price,
|
|
|
- 'status'=>0,
|
|
|
- 'created_at'=>$param->created_at,
|
|
|
- 'updated_at'=>$param->updated_at,
|
|
|
+ $insert_[$param->procurement_id] = [
|
|
|
+ 'procurement_delivery_id' => $procurement_deliver->id,
|
|
|
+ 'account_payable' => $param->amount * $param->price,
|
|
|
+ 'status' => 0,
|
|
|
+ 'created_at' => $param->created_at,
|
|
|
+ 'updated_at' => $param->updated_at,
|
|
|
];
|
|
|
}
|
|
|
ProcurementCheckSheet::query()->insert($insert_);
|
|
|
}
|
|
|
+
|
|
|
public function updateProcurementCheckSheet()
|
|
|
{
|
|
|
- $pro=ProcurementDeliverie::query()->find(515);
|
|
|
+ $pro = ProcurementDeliverie::query()->find(515);
|
|
|
$pro->update([
|
|
|
- 'signed_at'=>'2021-04-02',
|
|
|
- 'created_at'=>'2021-04-02 08:34:51',
|
|
|
- 'updated_at'=>'2021-04-02 08:34:51',
|
|
|
+ 'signed_at' => '2021-04-02',
|
|
|
+ 'created_at' => '2021-04-02 08:34:51',
|
|
|
+ 'updated_at' => '2021-04-02 08:34:51',
|
|
|
]);
|
|
|
- $pro=$pro->loadMissing('procurement');
|
|
|
+ $pro = $pro->loadMissing('procurement');
|
|
|
ProcurementCheckSheet::query()->create([
|
|
|
- 'procurement_delivery_id'=>$pro['id'],
|
|
|
- 'account_payable'=>$pro['procurement']['cost_price']*$pro['receipt_amount'],
|
|
|
- 'created_at'=>$pro['created_at'],
|
|
|
- 'updated_at'=>$pro['updated_at'],
|
|
|
+ 'procurement_delivery_id' => $pro['id'],
|
|
|
+ 'account_payable' => $pro['procurement']['cost_price'] * $pro['receipt_amount'],
|
|
|
+ 'created_at' => $pro['created_at'],
|
|
|
+ 'updated_at' => $pro['updated_at'],
|
|
|
]);
|
|
|
- $collect=ProcurementDeliverie::query()->with('procurement')->where('id','>=',517)
|
|
|
- ->where('id','<=',528)->get();
|
|
|
- $insert=[];
|
|
|
-
|
|
|
- foreach ($collect as $item){
|
|
|
- if ($item['receipt_amount']==0){
|
|
|
- $receipt_amount=$item['amount'];
|
|
|
- }else{
|
|
|
- $receipt_amount=$item['receipt_amount'];
|
|
|
+ $collect = ProcurementDeliverie::query()->with('procurement')->where('id', '>=', 517)
|
|
|
+ ->where('id', '<=', 528)->get();
|
|
|
+ $insert = [];
|
|
|
+
|
|
|
+ foreach ($collect as $item) {
|
|
|
+ if ($item['receipt_amount'] == 0) {
|
|
|
+ $receipt_amount = $item['amount'];
|
|
|
+ } else {
|
|
|
+ $receipt_amount = $item['receipt_amount'];
|
|
|
}
|
|
|
- $insert[]=[
|
|
|
- 'procurement_delivery_id'=>$item['id'],
|
|
|
- 'account_payable'=>$item['procurement']['cost_price']*$receipt_amount,
|
|
|
- 'created_at'=>$item['created_at'],
|
|
|
- 'updated_at'=>$item['updated_at'],
|
|
|
+ $insert[] = [
|
|
|
+ 'procurement_delivery_id' => $item['id'],
|
|
|
+ 'account_payable' => $item['procurement']['cost_price'] * $receipt_amount,
|
|
|
+ 'created_at' => $item['created_at'],
|
|
|
+ 'updated_at' => $item['updated_at'],
|
|
|
];
|
|
|
}
|
|
|
ProcurementCheckSheet::query()->insert($insert);
|
|
|
}
|
|
|
- public function testPro(){
|
|
|
- /**@var SupplierService $supplierService*/
|
|
|
- $supplierService=app(SupplierService::class);
|
|
|
- $supplier_ids=$supplierService->screenSupplierIds();
|
|
|
+
|
|
|
+ public function testPro()
|
|
|
+ {
|
|
|
+ /**@var SupplierService $supplierService */
|
|
|
+ $supplierService = app(SupplierService::class);
|
|
|
+ $supplier_ids = $supplierService->screenSupplierIds();
|
|
|
// $status=0;
|
|
|
// $procurements=Procurement::query()
|
|
|
// ->withCount('procurementQuotations')
|
|
|
@@ -1307,23 +1335,23 @@ where purch.islower=1 and deliver.id>'.$id);
|
|
|
// }
|
|
|
// $procurements = $procurements->diffKeys($keys);
|
|
|
// dd($procurements);
|
|
|
- $status=0;//0:待报价,2:待接单
|
|
|
- $procurements=Procurement::query()
|
|
|
+ $status = 0;//0:待报价,2:待接单
|
|
|
+ $procurements = Procurement::query()
|
|
|
->withCount('procurementQuotations')
|
|
|
- ->with(['ownerMaterial.material','procurementQuotations'])
|
|
|
- ->where('status',$status)
|
|
|
+ ->with(['ownerMaterial.material', 'procurementQuotations'])
|
|
|
+ ->where('status', $status)
|
|
|
->get();
|
|
|
dd($procurements);
|
|
|
$keys = [];
|
|
|
- foreach ($procurements as $key=>$procurement){
|
|
|
- if ($procurement->procurement_quotations_count>0 ){
|
|
|
- foreach ($procurement->procurementQuotations as $procurementQuotation){
|
|
|
- if (in_array($procurementQuotation->supplier_id,$supplier_ids))$keys[]= $key;
|
|
|
+ foreach ($procurements as $key => $procurement) {
|
|
|
+ if ($procurement->procurement_quotations_count > 0) {
|
|
|
+ foreach ($procurement->procurementQuotations as $procurementQuotation) {
|
|
|
+ if (in_array($procurementQuotation->supplier_id, $supplier_ids)) $keys[] = $key;
|
|
|
}
|
|
|
}
|
|
|
- if ($procurement->type==2 && $procurement->supplier_id )$keys[]= $key;
|
|
|
- if (Carbon::parse($procurement->deadline)->gt(Carbon::now())) $procurement->deadline=Carbon::parse($procurement->deadline)->diffInMilliseconds();
|
|
|
- else $procurement->deadline=0;
|
|
|
+ if ($procurement->type == 2 && $procurement->supplier_id) $keys[] = $key;
|
|
|
+ if (Carbon::parse($procurement->deadline)->gt(Carbon::now())) $procurement->deadline = Carbon::parse($procurement->deadline)->diffInMilliseconds();
|
|
|
+ else $procurement->deadline = 0;
|
|
|
}
|
|
|
$procurements = $procurements->diffKeys($keys);
|
|
|
dd($procurements);
|
|
|
@@ -1331,7 +1359,7 @@ where purch.islower=1 and deliver.id>'.$id);
|
|
|
|
|
|
public function pushToWmsWeight()
|
|
|
{
|
|
|
- $orderPackages = OrderPackage::query()->where('measuring_machine_id',12)->where('uploaded_to_wms','!=','是')->whereNotNull('weight')->get();
|
|
|
+ $orderPackages = OrderPackage::query()->where('measuring_machine_id', 12)->where('uploaded_to_wms', '!=', '是')->whereNotNull('weight')->get();
|
|
|
$packageController = new WeightBaseController();
|
|
|
foreach ($orderPackages as $orderPackage) {
|
|
|
$packageController->activityWaveNoProcessing($orderPackage);
|
|
|
@@ -1339,13 +1367,12 @@ where purch.islower=1 and deliver.id>'.$id);
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
public function syncOrderTracking()
|
|
|
{
|
|
|
- $orderNos = ['OSSO21040013','OSSO21040012'];
|
|
|
+ $orderNos = ['OSSO21040013', 'OSSO21040012'];
|
|
|
$service = new OrderTrackingService();
|
|
|
$orderHeaderService = new OracleDOCOrderHeaderService();
|
|
|
- $orderHeaders = $orderHeaderService->getQuery()->whereIn('DOC_Order_Header.SoReference1',$orderNos)->get();
|
|
|
+ $orderHeaders = $orderHeaderService->getQuery()->whereIn('DOC_Order_Header.SoReference1', $orderNos)->get();
|
|
|
$service->createByWmsOrderHeader($orderHeaders);
|
|
|
$service->updateByWmsOrderHeaders($orderHeaders);
|
|
|
}
|
|
|
@@ -1361,9 +1388,9 @@ where purch.islower=1 and deliver.id>'.$id);
|
|
|
</form>
|
|
|
TEXT;
|
|
|
$input = $request->input('boxes');
|
|
|
- if($input){
|
|
|
- $input=preg_replace('/[\n\r]/',',',trim($input));
|
|
|
- $boxes=explode(',',$input);
|
|
|
+ if ($input) {
|
|
|
+ $input = preg_replace('/[\n\r]/', ',', trim($input));
|
|
|
+ $boxes = explode(',', $input);
|
|
|
dd($boxes);
|
|
|
}
|
|
|
}
|
|
|
@@ -1399,25 +1426,25 @@ TEXT;
|
|
|
$orderService = app(OrderService::class);
|
|
|
$orderHeaderService = app(OracleDOCOrderHeaderService::class);
|
|
|
|
|
|
- $orderPackages = OrderPackage::query()->selectRaw('count(1) counts,logistic_number')->where('created_at','>=','2020-01-01')->groupBy('logistic_number')->having('counts','>','1')->get();
|
|
|
+ $orderPackages = OrderPackage::query()->selectRaw('count(1) counts,logistic_number')->where('created_at', '>=', '2020-01-01')->groupBy('logistic_number')->having('counts', '>', '1')->get();
|
|
|
|
|
|
$updateParams = [];
|
|
|
$deleteParams = [];
|
|
|
foreach ($orderPackages as $orderPackage) {
|
|
|
- $items = OrderPackage::query()->with('order')->where('logistic_number',$orderPackage['logistic_number'])->with('order')->get();
|
|
|
- $actAllocationDetails = OracleActAllocationDetails::query()->selectRaw('orderno')->where('PICKTOTRACEID',$orderPackage['logistic_number'])->get();
|
|
|
+ $items = OrderPackage::query()->with('order')->where('logistic_number', $orderPackage['logistic_number'])->with('order')->get();
|
|
|
+ $actAllocationDetails = OracleActAllocationDetails::query()->selectRaw('orderno')->where('PICKTOTRACEID', $orderPackage['logistic_number'])->get();
|
|
|
|
|
|
- $oracleOrderNos = array_unique(data_get($actAllocationDetails,'*.orderno'));
|
|
|
- $diffOrderNos = array_diff($oracleOrderNos,data_get($items,'*.order.code'));
|
|
|
- if(count($diffOrderNos) != 0){
|
|
|
- $orderHeaders = $orderHeaderService->getQuery()->whereIn('DOC_Order_Header.OrderNo',$diffOrderNos)->get();
|
|
|
+ $oracleOrderNos = array_unique(data_get($actAllocationDetails, '*.orderno'));
|
|
|
+ $diffOrderNos = array_diff($oracleOrderNos, data_get($items, '*.order.code'));
|
|
|
+ if (count($diffOrderNos) != 0) {
|
|
|
+ $orderHeaders = $orderHeaderService->getQuery()->whereIn('DOC_Order_Header.OrderNo', $diffOrderNos)->get();
|
|
|
$orderService->syncOrderInfo($orderHeaders);
|
|
|
}
|
|
|
|
|
|
- $items = OrderPackage::query()->with('order')->where('logistic_number',$orderPackage['logistic_number'])->with('order')->get();
|
|
|
- if($order = Order::query()->whereIn('id',data_get($items,'*.id'))->where('wms_status','!=','订单取消')->first()){
|
|
|
- $saveOrderPackage = OrderPackage::query()->where('order_id',$order['id'])->where('logistic_number',$orderPackage['logistic_number'])->first();
|
|
|
- }else{
|
|
|
+ $items = OrderPackage::query()->with('order')->where('logistic_number', $orderPackage['logistic_number'])->with('order')->get();
|
|
|
+ if ($order = Order::query()->whereIn('id', data_get($items, '*.id'))->where('wms_status', '!=', '订单取消')->first()) {
|
|
|
+ $saveOrderPackage = OrderPackage::query()->where('order_id', $order['id'])->where('logistic_number', $orderPackage['logistic_number'])->first();
|
|
|
+ } else {
|
|
|
$saveOrderPackage = $items->first();
|
|
|
}
|
|
|
|
|
|
@@ -1437,22 +1464,28 @@ TEXT;
|
|
|
$saveOrderPackage['status'] = $item['status'] != '无' ? $item['status'] : $saveOrderPackage['transfer_status'];
|
|
|
$saveOrderPackage['uploaded_to_wms'] = $item['uploaded_to_wms'] != '否' ? $item['uploaded_to_wms'] : $saveOrderPackage['uploaded_to_wms'];
|
|
|
}
|
|
|
- $orderPackages_filter = $items->filter(function($item)use($saveOrderPackage){
|
|
|
- if($saveOrderPackage['id'] === $item['id'])return false;
|
|
|
+ $orderPackages_filter = $items->filter(function ($item) use ($saveOrderPackage) {
|
|
|
+ if ($saveOrderPackage['id'] === $item['id']) return false;
|
|
|
return true;
|
|
|
});
|
|
|
- $ids = $orderPackages_filter->map(function($item){
|
|
|
+ $ids = $orderPackages_filter->map(function ($item) {
|
|
|
return $item['id'];
|
|
|
});
|
|
|
- LogService::log('order_packages','order_packages_logistic_number_unique_delete',json_encode($orderPackages_filter));
|
|
|
- OrderPackage::query()->whereIn('id',$ids)->delete();
|
|
|
+ LogService::log('order_packages', 'order_packages_logistic_number_unique_delete', json_encode($orderPackages_filter));
|
|
|
+ OrderPackage::query()->whereIn('id', $ids)->delete();
|
|
|
$updateParams[] = $saveOrderPackage;
|
|
|
- $deleteParams[] = $orderPackages_filter;
|
|
|
+ $deleteParams[] = $orderPackages_filter;
|
|
|
$saveOrderPackage->save();
|
|
|
}
|
|
|
dd('任务完成');
|
|
|
+ dd($updateParams, $deleteParams);
|
|
|
}
|
|
|
|
|
|
+ public function endStationTask()
|
|
|
+ {
|
|
|
+ $stationTask = StationTask::query()->where('id', 711)->first();
|
|
|
+ $stationTask->update(['status' => '完成']);
|
|
|
+ }
|
|
|
|
|
|
public function order_package_exception_type_counting_record_init()
|
|
|
{
|
|
|
@@ -1462,44 +1495,45 @@ TEXT;
|
|
|
$service = app('OrderPackageExceptionTypeCountingRecordService');
|
|
|
$service->updateOrCreate(30);
|
|
|
}
|
|
|
+
|
|
|
public function testForeignZhenCang($batches)
|
|
|
{
|
|
|
|
|
|
- $batches=Batch::query()
|
|
|
+ $batches = Batch::query()
|
|
|
->with(['orders.orderCommodities.commodity.barcodes'])
|
|
|
->find(111953);
|
|
|
- $body=[];
|
|
|
- $body['id']=$batches->code;
|
|
|
+ $body = [];
|
|
|
+ $body['id'] = $batches->code;
|
|
|
$body['orders'] = [];
|
|
|
- foreach ($batches->orders as $order){
|
|
|
+ foreach ($batches->orders as $order) {
|
|
|
$orderArr = [];
|
|
|
- $orderArr['id']=$order->code??'';
|
|
|
- $orderArr['createdAt']=Carbon::parse($order->created_at)->toDateTimeString()??'';
|
|
|
+ $orderArr['id'] = $order->code ?? '';
|
|
|
+ $orderArr['createdAt'] = Carbon::parse($order->created_at)->toDateTimeString() ?? '';
|
|
|
$orderArr['barcodes'] = [];
|
|
|
- foreach ($order->orderCommodities as $orderCommodity){
|
|
|
- $barcode=[];
|
|
|
- $barcode['id']=$orderCommodity->id;
|
|
|
- $barcode['barcode']=$orderCommodity->commodity ? ($orderCommodity->commodity->barcodes?$orderCommodity->commodity->barcodes->first()['code']:'') : '';
|
|
|
- $barcode['name']=$orderCommodity->commodity->name??'';
|
|
|
- $barcode['sku']=$orderCommodity->commodity->sku??'';
|
|
|
- $barcode['amount']=$orderCommodity->amount??'';
|
|
|
- $barcode['location']=$orderCommodity->location??'';
|
|
|
- $orderArr['barcodes'][]=$barcode;
|
|
|
+ foreach ($order->orderCommodities as $orderCommodity) {
|
|
|
+ $barcode = [];
|
|
|
+ $barcode['id'] = $orderCommodity->id;
|
|
|
+ $barcode['barcode'] = $orderCommodity->commodity ? ($orderCommodity->commodity->barcodes ? $orderCommodity->commodity->barcodes->first()['code'] : '') : '';
|
|
|
+ $barcode['name'] = $orderCommodity->commodity->name ?? '';
|
|
|
+ $barcode['sku'] = $orderCommodity->commodity->sku ?? '';
|
|
|
+ $barcode['amount'] = $orderCommodity->amount ?? '';
|
|
|
+ $barcode['location'] = $orderCommodity->location ?? '';
|
|
|
+ $orderArr['barcodes'][] = $barcode;
|
|
|
}
|
|
|
$body['orders'][] = $orderArr;
|
|
|
}
|
|
|
$response = Http::withHeaders([
|
|
|
'Host' => 'zc-it.com',
|
|
|
- ])->post('http://1.116.164.201:8080/api/createBatch',$body);
|
|
|
+ ])->post('http://1.116.164.201:8080/api/createBatch', $body);
|
|
|
dd(json_decode($response->body()));
|
|
|
}
|
|
|
|
|
|
public function updateBulk()
|
|
|
{
|
|
|
- $orderPackages=OrderPackage::query()->where('measuring_machine_id',16)->get();
|
|
|
- foreach ($orderPackages as $orderPackage){
|
|
|
+ $orderPackages = OrderPackage::query()->where('measuring_machine_id', 16)->get();
|
|
|
+ foreach ($orderPackages as $orderPackage) {
|
|
|
$orderPackage->update([
|
|
|
- 'bulk'=>$orderPackage['length']*$orderPackage['width']*$orderPackage['height']
|
|
|
+ 'bulk' => $orderPackage['length'] * $orderPackage['width'] * $orderPackage['height']
|
|
|
]);
|
|
|
}
|
|
|
}
|
|
|
@@ -1517,9 +1551,9 @@ TEXT;
|
|
|
"printerName" => "打印机5",
|
|
|
];
|
|
|
$post = Http::post("http://127.0.0.1:3000", $content);
|
|
|
- $body = json_decode($post->body(),true);
|
|
|
- $body['msg'] = json_decode($body['msg'],true);
|
|
|
- dd(json_decode($post->body()),$post->body(),$body);
|
|
|
+ $body = json_decode($post->body(), true);
|
|
|
+ $body['msg'] = json_decode($body['msg'], true);
|
|
|
+ dd(json_decode($post->body()), $post->body(), $body);
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -1560,7 +1594,7 @@ TEXT;
|
|
|
* @var $services OwnerLogisticFeeDetailService
|
|
|
*/
|
|
|
$services = app('OwnerLogisticFeeDetailService');
|
|
|
- $result = $services->getDetails('12','2021-05-30','2021-05-31');
|
|
|
+ $result = $services->getDetails('12', '2021-05-30', '2021-05-31', 50);
|
|
|
dd($result);
|
|
|
}
|
|
|
|
|
|
@@ -1579,9 +1613,17 @@ TEXT;
|
|
|
public function order_counting_records_init()
|
|
|
{
|
|
|
\App\OrderCountingRecord::query()->truncate();
|
|
|
- $start = '2021-05-14';
|
|
|
- $end = '2021-06-07';
|
|
|
+ $start = now()->subMonths(1)->toDateString();
|
|
|
+ $end = now()->subDay()->toDateString();
|
|
|
$service = app('NewOrderCountingRecordService');
|
|
|
$service->recordByDay($start, $end, '日');
|
|
|
}
|
|
|
+
|
|
|
+ public function OwnerLogisticFeeReportService_test()
|
|
|
+ {
|
|
|
+ /* @var $service OwnerLogisticFeeReportService */
|
|
|
+ $service = app('OwnerLogisticFeeReportService');
|
|
|
+ $result= $service->get(['owner_id' =>3,'date'=>'2021-05-01']);
|
|
|
+ dd($result);
|
|
|
+ }
|
|
|
}
|