From 43baedbcf347ab10c73d6e4fcda841a6719d31e1 Mon Sep 17 00:00:00 2001
From: 小飞侠 <8277136+liaoxujun@user.noreply.gitee.com>
Date: 星期五, 12 九月 2025 11:17:27 +0800
Subject: [PATCH] no message
---
cylsg/cylsg.Application/CyOS/CyOsDeliverManage.cs | 417 +++++++++++++++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 377 insertions(+), 40 deletions(-)
diff --git a/cylsg/cylsg.Application/CyOS/CyOsDeliverManage.cs b/cylsg/cylsg.Application/CyOS/CyOsDeliverManage.cs
index b330891..84d657c 100644
--- a/cylsg/cylsg.Application/CyOS/CyOsDeliverManage.cs
+++ b/cylsg/cylsg.Application/CyOS/CyOsDeliverManage.cs
@@ -5,12 +5,15 @@
using EzCoreNet.Redis;
using Furion.LinqBuilder;
using Models;
+using StackExchange.Profiling;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
+using TencentCloud.Iecp.V20210914.Models;
+using TencentCloud.Monitor.V20180724.Models;
namespace cylsg.Application.CyOS
{
@@ -32,12 +35,92 @@
_oAServices = oAServices;
_eZCoreNetRedisService = netRedisService;
}
- [HttpGet]
- [AllowAnonymous]
- public async Task<string> testc()
- {
- return await CreatDeliverPlanSn();
- }
+ //[HttpGet]
+ //[AllowAnonymous]
+ //public async Task<bool > TestCreat()
+ //{
+ // OaWorkPlan pram = new OaWorkPlan()
+ // {
+
+ // EvaluationContent = "",
+ // PlanDataType = 17,
+ // PlanType = 3,
+ // MemberId = _oAServices.firmId,
+ // SentStaffId = Guid.Empty,
+ // ReciveStaffId = Guid.Empty,
+ // DepartId = 0,
+ // PlanStartTime = DateTime.Now,
+ // RewardContent = "",
+ // LastUpdateTime = DateTime.Now,
+ // Operator = "",
+ // PlanTitle = "",
+ // PlanRunTime = DateTime.Now,
+ // PlanRemark = "",
+ // PlanPeople = "娴嬭瘯娴嬭瘯",
+ // PlanComplany = "",
+ // PlanStatus = PlanStatusType.unApproval,
+ // ApprovalStaffId = Guid.Empty,
+ // ApprovalStatus = PlanStatusType.unApproval,
+ // EvaluationStatus = BaoxiaoStausType.Unknown,
+ // FirmAccountId = 0,
+ // HoubufapiaoStatus = HoubufapiaoStatusType.Unknown,
+ // PlanMoney = 200,
+ // PlanContent = "娴嬭瘯鎵归噺",
+ // RewardResult = "10",
+
+ // ApprovalTime = DateTime.Now,
+ // ApprovalContent = "",
+ // EvaluationStaffId = Guid.Empty,
+ // EvaluationTime = DateTime.Now,
+ // RewardMoney = 0,
+ // RewardType = 1,
+ // Keyid = null,
+ // WorkPlanAttachments = new List<OaWorkPlanAttachment>()
+ // {
+ // new OaWorkPlanAttachment
+ // {
+ // AttachmentType=1,
+ // CreateTime=DateTime.Now,
+ // Operator="123213",
+ // PlanAttachment="hhttp://1.jpg"
+ // },
+ // new OaWorkPlanAttachment
+ // {
+ // AttachmentType=1,
+ // CreateTime=DateTime.Now,
+ // Operator="123213",
+ // PlanAttachment="hhttp://2.jpg"
+ // }
+ // ,
+ // new OaWorkPlanAttachment
+ // {
+ // AttachmentType=4,
+ // CreateTime=DateTime.Now,
+ // Operator="123213",
+ // PlanAttachment="hhttp://2.jpg"
+ // }
+ // }
+
+
+ // };
+ // return await _client.InsertNav(pram).Include(x => x.WorkPlanAttachments).ExecuteCommandAsync();
+
+
+
+ //}
+
+ ///// <summary>
+ /////
+ ///// </summary>
+ ///// <returns></returns>
+ //[HttpGet]
+ //[AllowAnonymous]
+ //public async Task<OA_DriverRecord> TestUpdata()
+ //{
+
+
+
+ //}
/// <summary>
/// 鑾峰彇棰勭害閰嶉�佷俊鎭�
@@ -114,12 +197,14 @@
}
/// <summary>
- /// 鍙楃悊
+ /// 鍙楃悊 寮冪敤锛岀敤 CreatDeliverPlan 浠f浛
/// </summary>
/// <param name="Param"></param>
/// <returns></returns>
+ [Obsolete]
public async Task<int> AcceptAppointmentDeliver(int KeiId)
{
+ throw Oops.Oh("宸茬粡寮冪敤");
if (!(KeiId > 0))
throw Oops.Oh("Keyid涓嶈兘涓虹┖");
@@ -150,20 +235,41 @@
/// <param name="Param"> 鍙渶瑕佷紶閫�</param>
/// <returns></returns>
[HttpPost]
- public async Task<int> CreatDeliverPlan(OA_DeliverPlan Param)
+ public async Task<int> CreatDeliverPlan(OA_DeliverPlanPaiche Param)
{
- OA_CarManage car = null;
- if (Param.DriverId != null)
- car = await _client.Queryable<OA_CarManage>().Where(x => x.StaffID == Param.DriverId && x.MemberID == _oAServices.firmId).FirstAsync();
+
if (!await CheckRols())
{
throw Oops.Oh("娌℃湁鏉冮檺");
}
+ OA_DeliverTixing? tixing=null;
+ if(Param.DeliverTixingId>0)
+ {
+ //鏄彁閱掕鍗曪紝闇�瑕佹墽琛屾彁閱掑崟 鐘舵�佸共鐓�
+ tixing = await _client.Queryable<OA_DeliverTixing>().Where(x => x.Keyid == Param.DeliverTixingId).FirstAsync();
+ if(tixing == null)
+ {
+ throw Oops.Oh("鎻愰啋鍗曚笉瀛樺湪浜�");
+ }
+ if(tixing.Chulistatus != AppointmentDeliverState.unAccept)
+ throw Oops.Oh("鎻愰啋鍗曞凡缁忓鐞嗕簡");
+ tixing.Chulistatus= AppointmentDeliverState.Accept;
+ tixing.ChuliTime = DateTime.Now;
+ tixing.ChuliRen=Permissions.MemberId;
+ tixing.LastUpdateTime = DateTime.Now;
+ tixing.Updater = Permissions.MemberId;
+
+ }
+ OA_CarManage car = null;
+ if (Param.CarId != null)
+ car = await _client.Queryable<OA_CarManage>().Where(x => x.Keyid == Param.CarId && x.MemberID == _oAServices.firmId).Includes(x=>x.Staff).FirstAsync();
+
+
OA_CorporateClients cor = null;
if (Param.BuyerId != null)
cor = await _client.Queryable<OA_CorporateClients>().Where(x => x.Keyid == Param.BuyerId).FirstAsync();
- OA_DeliverPlan DeliverPlan = new OA_DeliverPlan()
+ OA_DeliverPlanPaiche DeliverPlan = new OA_DeliverPlanPaiche()
{
Keyid = Guid.NewGuid(),
FirmId = _oAServices.firmId,
@@ -178,10 +284,10 @@
Transferstatus = 1,
- Sort = 1,
+ Sort = Param.Sort,
Creater = Param.Creater ?? Permissions.MemberId,
CreateTime = DateTime.Now,
- DriverId = Param.DriverId,
+ DriverId = car?.Staff?.Keyid??0,
SellerOrderId = await CreatDeliverPlanSn(),
Dianhua = Param.Dianhua,
Dizhi = Param.Dizhi,
@@ -192,7 +298,28 @@
Lianxiren = Param.Lianxiren,
Deliveredstatus = (int)DeliveredType.Undeliver,
CompanyName = Param.CompanyName,
- }; return await _client.Insertable(DeliverPlan).ExecuteCommandAsync();
+
+
+ };
+ try
+ {
+
+ if (tixing!=null)
+ {
+ tixing.DeliverPlanPaicheId = DeliverPlan.Keyid;
+ await _client.Updateable(tixing).ExecuteCommandAsync();
+ }
+
+ return await _client.Insertable(DeliverPlan).ExecuteCommandAsync();
+
+ }
+ catch (Exception)
+ {
+
+ throw;
+ }
+
+
}
@@ -210,13 +337,17 @@
throw Oops.Oh("娌℃湁鏉冮檺");
}
- Expression<Func<OA_DeliverPlan, bool>> SearchList = (x) => true;
+ Expression<Func<OA_DeliverPlanPaiche, bool>> SearchList = (x) => true;
SearchList = SearchList.And(x => x.FirmId == _oAServices.firmId);
//SearchList = SearchList.And(x => x.Creater == Permissions.MemberId);//鍙湅鑷繁
- SearchList = SearchList.And(x => x.ShifouDelivery != 2);//杩囨护鏈夋晥
+ SearchList = SearchList.And(x => x.ShifouDelivery != 2&&x.ShifouDelivery!=0);//杩囨护鏈夋晥
if (Param.DeliverKeyID != null)
{
SearchList = SearchList.And(x => x.DriverId == Param.DeliverKeyID);
+ }
+ if (Param.CarId != null)
+ {
+ SearchList = SearchList.And(x => x.CarId == Param.CarId);
}
//瀹㈡埛鍚嶇О
if (!string.IsNullOrEmpty(Param.CorporateClient))
@@ -225,11 +356,11 @@
}
if (Param.TimeStart != null)
{
- SearchList = SearchList.And(x => x.DeliverTime > Param.TimeStart);
+ SearchList = SearchList.And(x => x.DeliverTime >= Param.TimeStart.Value.Date);
}
if (Param.TimeEnd != null)
{
- SearchList = SearchList.And(x => x.DeliverTime < Param.TimeEnd.Value.AddDays(1));
+ SearchList = SearchList.And(x => x.DeliverTime < Param.TimeEnd.Value.Date.AddDays(1));
}
if (Param.DeliveredState != null)
{
@@ -245,8 +376,15 @@
//寮哄埗澧炲姞鍛樺伐杩囨护
RefAsync<int> totle = 0;
- var data = await _client.Queryable<OA_DeliverPlan>().Includes(x => x.Driver).Includes(x => x.SentStaff)
- .Where(SearchList).OrderBy(x => x.Dizhi).OrderBy(x => x.Sort).ToPageListAsync(Param.page.PageIndex, Param.page.PageSize, totle);
+ var data = await _client.Queryable<OA_DeliverPlanPaiche>().Includes(x => x.Car,car=>car.Staff).Includes(x => x.SentStaff).Includes(x=>x.DeliverPlans)
+ .Where(SearchList).OrderBy(x => x.DeliverTime).OrderBy(x => x.DriverId).Mapper(x =>
+ {
+ if (x.Car?.Staff != null)
+ {
+ x.Car.CarNumber = x.Car.CarNumber + "(" + x.Car.Staff.Name + ")";
+ x.Car.Staff = null;
+ }
+ }).ToPageListAsync(Param.page.PageIndex, Param.page.PageSize, totle);
Param.page.TotalCount = totle;
return new DeliverOderPageRet
@@ -265,7 +403,7 @@
/// </summary>
/// <param name="Param"></param>
/// <returns></returns>
- public async Task<bool> UpDataDeliverPlans(OA_DeliverPlan Param)
+ public async Task<bool> UpDataDeliverPlans(OA_DeliverPlanPaiche Param)
{
if (Param.Keyid == null)
@@ -274,14 +412,55 @@
{
throw Oops.Oh("娌℃湁鏉冮檺");
}
- var data = await _client.Queryable<OA_DeliverPlan>().Where(x => x.ShifouDelivery != 2 && x.Keyid == Param.Keyid).FirstAsync();
+ var data = await _client.Queryable<OA_DeliverPlanPaiche>().Includes(x=>x.DeliverPlans).Where(x => x.ShifouDelivery != 2 && x.Keyid == Param.Keyid).FirstAsync();
data.LastUpdateTime = DateTime.Now;
data.Updater = Permissions.MemberId;
- if (data.DriverId != Param.DriverId)
+
+ //浠ヨ溅杈嗛�夋嫨涓轰富 锛屼笉鍦ㄥ疄鐜板徃鏈洪�昏緫
+ //if (data.DriverId != Param.DriverId)
+ //{
+ // data.DriverId = Param.DriverId;
+ // var car = await _client.Queryable<OA_CarManage>().Where(x => x.StaffID == Param.DriverId && x.MemberID == _oAServices.firmId).FirstAsync();
+ // data.CarId = car == null ? 0 : car.Keyid;
+
+ // //foreach (var item in data.DeliverPlans)
+ // //{
+ // // item.DriverId = Param.DriverId;
+ // // item.CarId = car == null ? 0 : car.Keyid;
+ // // item.Updater = Permissions.MemberId;
+ // // item.LastUpdateTime = DateTime.Now;
+ // // item.DeliverTime = Param.DeliverTime;
+
+ // //}
+ //}
+ if (data.CarId != Param.CarId)
{
- data.DriverId = Param.DriverId;
- var car = await _client.Queryable<OA_CarManage>().Where(x => x.StaffID == Param.DriverId && x.MemberID == _oAServices.firmId).FirstAsync();
- data.CarId = car == null ? 0 : car.Keyid;
+
+ var car = await _client.Queryable<OA_CarManage>().Where(x => x.Keyid == Param.CarId && x.MemberID == _oAServices.firmId).Includes(x=>x.Staff).FirstAsync();
+ if(car == null)
+ {
+ throw Oops.Oh("娌℃湁鎵惧埌鏈夋晥杞﹁締淇℃伅");
+
+ }
+
+ data.CarId = Param.CarId;
+ if (car.Staff != null)
+ {
+ data.DriverId = car.Staff.Keyid;
+ }
+ else
+ data.DriverId = 0;
+ //data.CarId = car == null ? 0 : car.Keyid;
+
+ //foreach (var item in data.DeliverPlans)
+ //{
+ // item.DriverId = Param.DriverId;
+ // item.CarId = car == null ? 0 : car.Keyid;
+ // item.Updater = Permissions.MemberId;
+ // item.LastUpdateTime = DateTime.Now;
+ // item.DeliverTime = Param.DeliverTime;
+
+ //}
}
data.DeliverTime = Param.DeliverTime;
@@ -308,25 +487,89 @@
}
data.Attachments = Param.Attachments;
- return await _client.UpdateNav(data).Include(x => x.Attachments, new UpdateNavOptions()
- {
- OneToManyInsertOrUpdate = true,
- }).ExecuteCommandAsync();
+ return await _client.UpdateNav(data).Include(x => x.Attachments).ExecuteCommandAsync();
}
-
/// <summary>
- /// 淇敼璁㈠崟
+ /// 鎾ら攢璁㈠崟
+ /// </summary>
+ /// <param name="KeyId"></param>
+ /// <returns></returns>
+ public async Task<int > UndoDeliverPlans(Guid KeyId)
+ {
+ if (!await CheckRols())
+ {
+ throw Oops.Oh("娌℃湁鏉冮檺");
+ }
+ var data= await _client.Queryable<OA_DeliverPlanPaiche>().Includes(x=>x.DeliverPlans).Includes(x=>x.DelvceTiXing).Where(x=>x.Keyid == KeyId).FirstAsync();
+
+ if (data != null)
+ {
+ if (data.Deliveredstatus != DeliveredType.Delivered)
+ {
+ await _client.AsTenant().BeginTranAsync();
+ try
+ {
+ if (data.DelvceTiXing != null)
+ {
+ data.DelvceTiXing.Chulistatus = AppointmentDeliverState.unAccept;
+ data.DelvceTiXing.LastUpdateTime = DateTime.Now;
+ data.DelvceTiXing.Updater = Permissions.MemberId;
+ data.DelvceTiXing.ChuliTime = DateTime.Now;
+ data.DelvceTiXing.ChuliRen = Permissions.MemberId;
+ await _client.Updateable(data.DelvceTiXing).ExecuteCommandAsync();
+ }
+ if (data.DeliverPlans != null)
+ {
+ foreach (var item in data.DeliverPlans)
+ {
+ item.DriverId = 0;
+ item.CarId = 0;
+ item.DeliverPlanPaicheid = Guid.Empty;
+ item.Deliveredstatus = DeliveredType.Undeliver;
+ item.Updater = Permissions.MemberId;
+ item.LastUpdateTime = DateTime.Now;
+ }
+ await _client.Updateable(data.DeliverPlans).ExecuteCommandAsync();
+ }
+
+
+ var a = await _client.Deleteable(data).ExecuteCommandAsync();
+
+ await _client.AsTenant().CommitTranAsync();
+ return a;
+ }
+
+
+ catch (Exception)
+ {
+ await _client.AsTenant().RollbackTranAsync();
+ throw;
+ }
+ }
+ else
+
+ {
+ throw Oops.Oh("閰嶉�佸凡瀹屾垚锛屾棤娉曟挙閿�");
+ }
+
+ }
+ else
+ throw Oops.Oh("娌℃湁鎵惧埌璁㈠崟");
+ }
+ /// <summary>
+ /// 淇敼璁㈠崟 寮冪敤
/// </summary>
/// <param name="Param"></param>
/// <returns></returns>
+ [Obsolete]
public async Task<bool> SortDeliverPlans(SortPlanIn Param)
{
-
-
+ throw Oops.Oh("宸茬粡寮冪敤");
+
if (!await CheckRols())
{
@@ -349,15 +592,99 @@
/// </summary>
/// <param name="KeyId"></param>
/// <returns></returns>
- public async Task<OA_DeliverPlan> GetDeliverPlanInfo(Guid KeyId)
+ public async Task<OA_DeliverPlanPaiche> GetDeliverPlanInfo(Guid KeyId)
{
if (!await CheckRols())
{
throw Oops.Oh("娌℃湁鏉冮檺");
}
- return await _client.Queryable<OA_DeliverPlan>().Includes(x => x.SentStaff).Includes(x => x.Attachments).Includes(x => x.Driver).Includes(x => x.Manager)
- .Where(x => x.Keyid == KeyId && x.ShifouDelivery != 2).FirstAsync();
+ return await _client.Queryable<OA_DeliverPlanPaiche>().Includes(x => x.Attachments).Includes(x => x.Car, car => car.Staff).Includes(x => x.Manager).Includes(x=>x.DeliverPlans)
+ .Where(x => x.Keyid == KeyId && x.ShifouDelivery != 2).Mapper(x=>
+ {
+ if(x.Car?.Staff!=null)
+ {
+ x.Car.CarNumber = x.Car.CarNumber + "(" + x.Car.Staff.Name + ")";
+ x.Car.Staff = null;
+ }
+ }).FirstAsync();
+
+ }
+
+
+ /// <summary>
+ /// 鎵撳崱璁板綍璇︽儏
+ /// </summary>
+ public async Task<OA_DriverRecord> GetDriverRecordInfo(Guid Id)
+ {
+
+ if (!await CheckRols())
+ {
+ throw Oops.Oh("娌℃湁鏉冮檺");
+ }
+
+ var data = await _client.Queryable<OA_DriverRecord>()
+ .Includes(x=>x.Car)
+ .Includes(x => x.Attachments)
+ .Includes(x => x.CarConditionAttachments)
+ .Where(x => x.Id == Id).FirstAsync();
+ if (data == null)
+ throw Oops.Oh("娌℃湁鏉冮檺");
+ return data;
+
+ }
+ /// <summary>
+ /// 鑾峰彇杞﹁締鎵撳崱璁板綍
+ /// </summary>
+ /// <param name="Param"></param>
+ /// <returns></returns>
+ [HttpPost]
+ public async Task<DeliverRecordPageRet> GetDriverRecords(DeliverRecordSearchParam Param)
+ {
+ if (!await CheckRols())
+ {
+ throw Oops.Oh("娌℃湁鏉冮檺");
+ }
+
+ Expression<Func<OA_DriverRecord, bool>> SearchList = (x) => true;
+ SearchList = SearchList.And(x => x.ClockType != DriverClockType.RoughDraft);//涓嶇湅鑽夌
+ if (Param.CarID != null)
+ {
+ SearchList = SearchList.And(x => x.CarID == Param.CarID);
+ }
+
+ if (Param.TimeStart != null)
+ {
+ SearchList = SearchList.And(x => x.CreatTime >= Param.TimeStart.Value.Date);
+ }
+ if (Param.TimeEnd != null)
+ {
+ SearchList = SearchList.And(x => x.CreatTime < Param.TimeEnd.Value.Date.AddDays(1));
+ }
+ if (Param.ClockType != null)
+ {
+
+ SearchList = SearchList.And(x => x.ClockType == Param.ClockType);
+
+ }
+
+ //寮哄埗澧炲姞鍛樺伐杩囨护
+ RefAsync<int> totle = 0;
+ var data = await _client.Queryable<OA_DriverRecord>().Includes(x=>x.Car)
+ .Where(SearchList).OrderByDescending(x => x.CreatTime.Date).ToPageListAsync(Param.page.PageIndex, Param.page.PageSize, totle);
+
+ Param.page.TotalCount = totle;
+ // var count = await _client.Queryable<OA_DriverRecord>().Where(x => x.CreatTime.Date == DateTime.Now.Date).CountAsync();
+
+ return new DeliverRecordPageRet
+
+ {
+ Data = data,
+ page = Param.page
+
+
+ };
+
}
/// <summary>
@@ -382,6 +709,8 @@
return false;
}
+
+
/// <summary>
/// 鐢熸垚sn鍙�
/// </summary>
@@ -390,7 +719,7 @@
{
// var sn = await _client.Queryable<OA_DeliverPlan>().Where(x => x.CreateTime >= DateTime.Now.Date && x.CreateTime < DateTime.Now.AddDays(1).Date).OrderByDescending(x => x.SellerOrderId).Select(x => x.SellerOrderId).FirstAsync();
- var sn = await _client.Queryable<OA_DeliverPlan>().Where(x => x.CreateTime.Value.Date == DateTime.Now.Date).OrderByDescending(x => x.SellerOrderId).Select(x => x.SellerOrderId).FirstAsync();
+ var sn = await _client.Queryable<OA_DeliverPlanPaiche>().Where(x => x.CreateTime.Value.Date == DateTime.Now.Date).OrderByDescending(x => x.SellerOrderId).Select(x => x.SellerOrderId).FirstAsync();
if (sn != null)
{
try
@@ -464,7 +793,10 @@
/// 鍙告満KeyID
/// </summary>
public int? DeliverKeyID { get; set; }
-
+ /// <summary>
+ /// 杞﹁締鐨刱eyid
+ /// </summary>
+ public int? CarId { get; set; }
/// <summary>
/// 瀹㈡埛鍚嶇О
@@ -475,6 +807,11 @@
/// 閰嶉�佺姸鎬�
/// </summary>
public DeliveredType? DeliveredState { get; set; }
+
+ /// <summary>
+ /// 闂鍙嶉鐨勬槸鍚﹀畬缁撶姸鎬�
+ /// </summary>
+ public WanjieStatusType? WanjieStatus { get; set; }
/// <summary>
/// 椤甸潰鍙傛暟
/// </summary>
--
Gitblit v1.9.1