- ProductDto 增加 extJson 解析,从服务端读取货品编号 - ProductExtJson 类用于序列化/反序列化扩展属性 - 同步时优先使用本地货品编号,其次使用服务端的 - 新增"上传到服务端"按钮,批量上传货品编号 - 调用 /user/apiExtShopGoods/save 接口更新 extJsonStr 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
83 lines
2.9 KiB
C#
83 lines
2.9 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
using PackagingMallShipper.Models;
|
|
|
|
namespace PackagingMallShipper.Services
|
|
{
|
|
public interface IAuthService
|
|
{
|
|
Task<LoginResult> LoginAsync(string userName, string password, string captcha = null, string captchaKey = null);
|
|
string GetCaptchaUrl(string key);
|
|
string GetToken();
|
|
bool IsLoggedIn { get; }
|
|
LocalSession CurrentSession { get; }
|
|
void Logout();
|
|
}
|
|
|
|
public interface IOrderService
|
|
{
|
|
Task<List<Order>> GetOrdersAsync(int? status = null, string keyword = null);
|
|
Task<Order> GetOrderByIdAsync(int orderId);
|
|
Task<Order> GetOrderByNumberAsync(string orderNumber);
|
|
Task<int> GetOrderCountAsync(int? status = null);
|
|
}
|
|
|
|
public interface ISyncService
|
|
{
|
|
Task<SyncResult> SyncOrdersAsync(SyncMode mode = SyncMode.Incremental);
|
|
event Action<int, int> OnSyncProgress;
|
|
event Action<string> OnSyncMessage;
|
|
}
|
|
|
|
public interface IShipService
|
|
{
|
|
Task<ShipResult> ShipOrderAsync(ShipOrderRequest request);
|
|
Task<BatchShipResult> BatchShipOrdersAsync(
|
|
List<ShipOrderRequest> orders,
|
|
int concurrency = 3,
|
|
CancellationToken cancellationToken = default);
|
|
event Action<int, int> OnShipProgress;
|
|
}
|
|
|
|
public interface IExcelService
|
|
{
|
|
Task<int> ExportPendingOrdersAsync(string filePath);
|
|
Task<ImportShipResult> ImportAndShipAsync(string filePath);
|
|
}
|
|
|
|
public interface IProductService
|
|
{
|
|
Task<List<Product>> GetProductsAsync(int? status = null, string keyword = null);
|
|
Task<Product> GetProductByIdAsync(int productId);
|
|
Task<Product> GetProductByItemCodeAsync(string itemCode);
|
|
Task<Product> GetProductByBarCodeAsync(string barCode);
|
|
Task<bool> SaveProductAsync(Product product);
|
|
Task<bool> DeleteProductAsync(int productId);
|
|
Task<bool> UpdateItemCodeAsync(int productId, string itemCode);
|
|
Task<int> GetProductCountAsync(int? status = null);
|
|
Task<int> BatchUpdateItemCodesAsync(Dictionary<int, string> productItemCodes);
|
|
Task<Dictionary<int, string>> GetItemCodesByGoodsIdsAsync(List<int> goodsIds);
|
|
}
|
|
|
|
public interface IProductSyncService
|
|
{
|
|
Task<SyncResult> SyncProductsAsync(SyncMode mode = SyncMode.Incremental);
|
|
Task<UploadResult> UploadItemCodesToServerAsync(List<Product> products);
|
|
event Action<int, int> OnSyncProgress;
|
|
event Action<string> OnSyncMessage;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 上传结果
|
|
/// </summary>
|
|
public class UploadResult
|
|
{
|
|
public int TotalCount { get; set; }
|
|
public int SuccessCount { get; set; }
|
|
public int FailedCount { get; set; }
|
|
public List<string> Errors { get; set; } = new List<string>();
|
|
}
|
|
}
|