You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
436 lines
14 KiB
436 lines
14 KiB
using BBWY.Client.Helpers;
|
|
using BBWY.Client.Models;
|
|
using BBWY.Client.Models.APIModel.Request;
|
|
using BBWY.Client.Models.APIModel.Response.PackTask;
|
|
using BBWY.Client.Models.PackTask;
|
|
using BBWY.Common.Http;
|
|
using BBWY.Common.Models;
|
|
using Newtonsoft.Json;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Net.Http;
|
|
using System.Runtime.Serialization;
|
|
using System.Windows.Documents;
|
|
|
|
namespace BBWY.Client.APIServices
|
|
{
|
|
public class PackTaskService : BaseApiService, IDenpendency
|
|
{
|
|
|
|
|
|
|
|
public PackTaskService(RestApiService restApiService, GlobalContext globalContext) : base(restApiService, globalContext)
|
|
{
|
|
}
|
|
|
|
|
|
|
|
public ApiResponse<PackTaskResultResponse> GetOrderList( string skuId = null, string taskId = null,
|
|
DateTime? startTime = null,
|
|
DateTime? endTime = null,
|
|
TaskState? availability = null,
|
|
int? taskStatus = null,
|
|
int pageIndex = 1,
|
|
int pageSize = 10
|
|
|
|
)
|
|
{
|
|
return SendRequest<PackTaskResultResponse>(globalContext.QKApiHost, "api/PackTask/SearchNewPackTaskList", new
|
|
{
|
|
|
|
SkuId = skuId,
|
|
TaskId = taskId,
|
|
StartTime = startTime,
|
|
EndTime = endTime,
|
|
Availability = availability,
|
|
TaskStatus = taskStatus,
|
|
PageIndex = pageIndex,
|
|
PageSize = pageSize,
|
|
ShopId = globalContext.User.Shop.ShopId.ToString()
|
|
}, null, HttpMethod.Post);
|
|
}
|
|
public ApiResponse<PackTaskResultResponse> GetWareHouseList(int? isWorry=null,string departmentName = null, string skuId = null, string taskId = null,
|
|
DateTime? startTime = null,
|
|
DateTime? endTime = null,
|
|
TaskState? availability = null,
|
|
int? taskStatus = null,
|
|
int pageIndex = 1,
|
|
int pageSize = 10
|
|
|
|
)
|
|
{
|
|
return SendRequest<PackTaskResultResponse>(globalContext.QKApiHost, "api/PackTask/SearchNewPackTaskList", new
|
|
{
|
|
IsWorry=isWorry,
|
|
DepartmentName = departmentName,
|
|
SkuId = skuId,
|
|
TaskId = taskId,
|
|
StartTime = startTime,
|
|
EndTime = endTime,
|
|
Availability = availability,
|
|
TaskStatus = taskStatus,
|
|
PageIndex = pageIndex,
|
|
PageSize = pageSize
|
|
}, null, HttpMethod.Post);
|
|
}
|
|
|
|
|
|
|
|
|
|
public ApiResponse<ProductSkuCountsResponse> GetAllCount()
|
|
{
|
|
return SendRequest<ProductSkuCountsResponse>(globalContext.QKApiHost, "api/PackTask/GetProductSkuCount",
|
|
new { ShopId = globalContext.User.Shop.ShopId.ToString() }
|
|
, null, HttpMethod.Get);
|
|
}
|
|
public ApiResponse<ProductSkuCountsResponse> GetWareAllCount()
|
|
{
|
|
return SendRequest<ProductSkuCountsResponse>(globalContext.QKApiHost, "api/PackTask/GetProductSkuCount",
|
|
null
|
|
, null, HttpMethod.Get);
|
|
}
|
|
|
|
|
|
public ApiResponse<ProductSkuResponse> GetProductSku(string skuId)
|
|
{
|
|
HttpClientHelper helper = new HttpClientHelper(globalContext.QKApiHost);
|
|
|
|
string url = $"{globalContext.QKApiHost}/api/PackTask/SearchProduct?skuId={skuId}&ShopId={globalContext.User.Shop.ShopId}";
|
|
var data = helper.Get(url);
|
|
|
|
return JsonConvert.DeserializeObject<ApiResponse<ProductSkuResponse>>(data);
|
|
}
|
|
public ApiResponse<CertificateModel> GetSpuCer(string spuId)
|
|
{
|
|
HttpClientHelper helper = new HttpClientHelper(globalContext.QKApiHost);
|
|
|
|
string url = $"{globalContext.QKApiHost}/api/PackTask/GetSpuCer?spuId={spuId}";
|
|
var data = helper.Get(url);
|
|
|
|
return JsonConvert.DeserializeObject<ApiResponse<CertificateModel>>(data);
|
|
}
|
|
|
|
public ApiResponse<object> UpdateTask(CreateTaskRequest createTaskRequest)
|
|
{
|
|
return SendRequest<object>(globalContext.QKApiHost, "api/PackTask/UpdatePackTask",
|
|
createTaskRequest
|
|
, null, HttpMethod.Post);
|
|
}
|
|
|
|
|
|
public ApiResponse<object> DeletedTask(long taskId)
|
|
{
|
|
return SendRequest<object>(globalContext.QKApiHost, "api/PackTask/DeletedPackTask",
|
|
new {
|
|
TaskId = taskId,
|
|
UserId = globalContext.User.Id.ToString()
|
|
}
|
|
, null, HttpMethod.Post);
|
|
}
|
|
|
|
|
|
public ApiResponse<object> CreateTask(CreateTaskRequest createTaskRequest)
|
|
{
|
|
return SendRequest<object>(globalContext.QKApiHost, "api/PackTask/CreatePackTask",
|
|
createTaskRequest
|
|
, null, HttpMethod.Post);
|
|
}
|
|
|
|
public ApiResponse<object> UpdateTaskStatus(long id, int taskStatus,string orderId)
|
|
{
|
|
return SendRequest<object>(globalContext.QKApiHost, "api/PackTask/UpdatePackTaskStatus", new
|
|
{
|
|
id,
|
|
taskStatus,
|
|
orderId
|
|
}
|
|
, null, HttpMethod.Post);
|
|
}
|
|
|
|
public ApiResponse<long> SaveBarCode(BarCodeRequest barCodeModel)
|
|
{
|
|
return SendRequest<long>(globalContext.QKApiHost, "api/PackTask/CommitBarCode", barCodeModel
|
|
, null, HttpMethod.Post);
|
|
}
|
|
|
|
public ApiResponse<long> SaveCer(CerRequest cerRequest)
|
|
{
|
|
return SendRequest<long>(globalContext.QKApiHost, "api/PackTask/CommitCer", cerRequest
|
|
, null, HttpMethod.Post);
|
|
}
|
|
public ApiResponse<long> SaveSpuCer(CerRequest cerRequest)
|
|
{
|
|
return SendRequest<long>(globalContext.QKApiHost, "api/PackTask/CommitSpuCer", cerRequest
|
|
, null, HttpMethod.Post);
|
|
}
|
|
|
|
public ApiResponse<PackUser[]> GetPackMembers()
|
|
{
|
|
|
|
return SendRequest<PackUser[]>(globalContext.QKApiHost, "api/PackTask/SearchPackMembers", null
|
|
, null, HttpMethod.Get);
|
|
|
|
}
|
|
/// <summary>
|
|
/// 获取任务的服务
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public ApiResponse<PackServiceResponse> GetTaskService(long taskId)
|
|
{
|
|
return SendRequest<PackServiceResponse>(globalContext.QKApiHost, "api/PackTask/GetTaskService", new { TaskId = taskId }
|
|
, null, HttpMethod.Get);
|
|
}
|
|
/// <summary>
|
|
/// 上传 更新任务的服务数据
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public ApiResponse<object> UploadService(UploadServiceRequest uploadService)
|
|
{
|
|
return SendRequest<object>(globalContext.QKApiHost, "api/PackTask/UploadService", uploadService
|
|
, null, HttpMethod.Post);
|
|
}
|
|
|
|
|
|
public ApiResponse<ShopTotalResponse> ShopTotal(string skuId = null, string taskId = null,
|
|
DateTime? startTime = null,
|
|
DateTime? endTime = null,
|
|
string ShopName = null,
|
|
string DepartmentName = null,
|
|
int pageIndex = 1,
|
|
int pageSize = 10
|
|
|
|
)
|
|
{
|
|
return SendRequest<ShopTotalResponse>(globalContext.QKApiHost, "api/PackTask/ShopTotal", new
|
|
{
|
|
|
|
SkuId = skuId,
|
|
TaskId = taskId,
|
|
StartTime = startTime,
|
|
EndTime = endTime,
|
|
DepartmentName,
|
|
ShopName,
|
|
PageIndex = pageIndex,
|
|
PageSize = pageSize
|
|
|
|
}, null, HttpMethod.Post);
|
|
}
|
|
public ApiResponse<ShopTotalResponse> BatchSettle(params long[] taskIds)
|
|
{
|
|
return SendRequest<ShopTotalResponse>(globalContext.QKApiHost, "api/PackTask/BatchSettle", new
|
|
{
|
|
taskIds= taskIds,
|
|
userId= globalContext.User.Id.ToString(),
|
|
|
|
}, null, HttpMethod.Post);
|
|
}
|
|
}
|
|
|
|
public class AddConsumableRequest
|
|
{
|
|
public long TaskId { get; set; }
|
|
public long[] ConsumableIds { get; set; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// 上传服务
|
|
/// </summary>
|
|
public class UploadServiceRequest
|
|
{
|
|
|
|
/// <summary>
|
|
/// 折扣
|
|
/// </summary>
|
|
public decimal Discount { get; set; } = 1;
|
|
|
|
/// <summary>
|
|
/// 任务id
|
|
/// </summary>
|
|
public long TaskId { get; set; }
|
|
/// <summary>
|
|
/// 耗材ids
|
|
/// </summary>
|
|
public string ConsumableIds { get; set; }
|
|
/// <summary>
|
|
/// 耗材数量
|
|
/// </summary>
|
|
public string ConsumableNos { get; set; }
|
|
/// <summary>
|
|
/// 工序ids
|
|
/// </summary>
|
|
public string WorkProcessIds { get; set; }
|
|
/// <summary>
|
|
/// 工序数量
|
|
/// </summary>
|
|
public string WorkProcessNos { get; set; }
|
|
/// <summary>
|
|
/// 增值服务ids
|
|
/// </summary>
|
|
public string IncreateServiceIds { get; set; }
|
|
/// <summary>
|
|
/// 增值服务数量
|
|
/// </summary>
|
|
public string IncreateServiceNos { get; set; }
|
|
|
|
public string PackServiceIds { get; set; }
|
|
public string PackServiceNos { get; set; }
|
|
/// <summary>
|
|
/// 任务单件费用
|
|
/// </summary>
|
|
public decimal SingleFees { get; set; }
|
|
/// <summary>
|
|
/// 任务总费用
|
|
/// </summary>
|
|
public decimal AllFees { get; set; }
|
|
|
|
/// <summary>
|
|
/// 增加数据
|
|
/// </summary>
|
|
public List<PersonTaskModel> AddPackServices { get; set; }
|
|
/// <summary>
|
|
/// 删除的数据
|
|
/// </summary>
|
|
public List<long> DeletedPackServices { get; set; }
|
|
|
|
//public PersonTaskModel[] PersonTaskModels { get; set; }
|
|
|
|
//public IncreateMemberModel[] IncreateMembers { get; set; }
|
|
|
|
//public ProcessMemberModel[] ProcessMembers { get; set; }
|
|
|
|
public decimal? IncreaseFees { get; set; }
|
|
|
|
public decimal? PackFees { get; set; }
|
|
|
|
public decimal? ConsumableFees { get; set; }
|
|
|
|
public decimal? DiscountPrice { get; set; }
|
|
|
|
public string OrderId { get; set; }
|
|
|
|
public string SkuId { get; set; }
|
|
}
|
|
|
|
public class PersonTaskModel
|
|
{
|
|
/// <summary>
|
|
/// 任务id
|
|
/// </summary>
|
|
public long TaskId { get; set; }
|
|
|
|
/// <summary>
|
|
/// 打包人
|
|
/// </summary>
|
|
public string PackUserId { get; set; }
|
|
|
|
/// <summary>
|
|
/// 服务id
|
|
/// </summary>
|
|
public long ServiceId { get; set; }
|
|
/// <summary>
|
|
/// 服务数量
|
|
/// </summary>
|
|
public int ServiceCount { get; set; }
|
|
///// <summary>
|
|
///// 增值服务ids
|
|
///// </summary>
|
|
//public string IncreateServiceIds { get; set; }
|
|
///// <summary>
|
|
///// 增值服务数量
|
|
///// </summary>
|
|
//public string IncreateServiceNos { get; set; }
|
|
///// <summary>
|
|
///// 工序ids
|
|
///// </summary>
|
|
//public string WorkProcessIds { get; set; }
|
|
///// <summary>
|
|
///// 工序数量
|
|
///// </summary>
|
|
//public string WorkProcessNos { get; set; }
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
public bool IsDeleted { get; set; }
|
|
/// <summary>
|
|
/// 折扣
|
|
/// </summary>
|
|
public decimal Discount { get; set; } = 1;
|
|
/// <summary>
|
|
/// 总费用
|
|
/// </summary>
|
|
public decimal AllFees { get; set; }
|
|
/// <summary>
|
|
/// 时间
|
|
/// </summary>
|
|
public DateTime CreateTime { get; set; } = DateTime.Now;
|
|
|
|
public ServiceType ServiceType { get; set; }
|
|
}
|
|
|
|
|
|
|
|
public class ConsumableTaskModel
|
|
{
|
|
public decimal Price { get; set; }
|
|
/// <summary>
|
|
/// 耗材服务id
|
|
/// </summary>
|
|
public long ConsumableId { get; set; }
|
|
/// <summary>
|
|
/// 耗材服务数量
|
|
/// </summary>
|
|
public int ConsumableCount { get; set; }
|
|
}
|
|
|
|
|
|
public class PackServiceMemberModel
|
|
{
|
|
public decimal Price { get; set; }
|
|
|
|
public string UserId { get; set; }
|
|
/// <summary>
|
|
/// 增值服务Id
|
|
/// </summary>
|
|
public long PackServiceId { get; set; }
|
|
/// <summary>
|
|
/// 数量
|
|
/// </summary>
|
|
public int PackServiceCount { get; set; }
|
|
|
|
public ServiceType ServiceType { get; set; }
|
|
}
|
|
|
|
//public class IncreateMemberModel
|
|
//{
|
|
// public decimal Price { get; set; }
|
|
|
|
// public string UserId { get; set; }
|
|
// /// <summary>
|
|
// /// 增值服务Id
|
|
// /// </summary>
|
|
// public long IncreateId { get; set; }
|
|
// /// <summary>
|
|
// /// 数量
|
|
// /// </summary>
|
|
// public int IncreateCount { get; set; }
|
|
|
|
//}
|
|
//public class ProcessMemberModel
|
|
//{
|
|
// public decimal Price { get; set; }
|
|
// public string UserId { get; set; }
|
|
// /// <summary>
|
|
// /// 工序服务Id
|
|
// /// </summary>
|
|
// public long ProcessId { get; set; }
|
|
|
|
// /// <summary>
|
|
// /// 工序服务数量
|
|
// /// </summary>
|
|
// public int ProcessCount { get; set; }
|
|
//}
|
|
|
|
|
|
|
|
}
|
|
|