diff --git a/TradeManageNew/Models/Shage/GetOrderUsedSaleDto.cs b/TradeManageNew/Models/Shage/GetOrderUsedSaleDto.cs
new file mode 100644
index 0000000..9b78ccd
--- /dev/null
+++ b/TradeManageNew/Models/Shage/GetOrderUsedSaleDto.cs
@@ -0,0 +1,42 @@
+using System.Collections.Generic;
+
+namespace TradeManageNew.Models.Shage
+{
+ public class GetOrderUsedSaleDto
+ {
+ public int OrderId { get; set; }
+
+ ///
+ /// 订单号
+ ///
+ public string OrderCode { get; set; }
+
+ ///
+ /// sku明细
+ ///
+ public List Items { get; set; } = new List();
+ }
+
+ public class GetOrderUsedSaleItemDto
+ {
+ ///
+ /// 产品编码
+ ///
+ public string ProductCode { get; set; }
+
+ ///
+ /// 产品描述
+ ///
+ public string ProductDescription { get; set; }
+
+ ///
+ /// SKU ID
+ ///
+ public int GoodsDetailId { get; set; }
+
+ ///
+ /// sku编码
+ ///
+ public string SkuCode { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/TradeManageNew/Models/Shage/GetOrderUsedSale.cs b/TradeManageNew/Models/Shage/GetOrderUsedSaleInput.cs
similarity index 81%
rename from TradeManageNew/Models/Shage/GetOrderUsedSale.cs
rename to TradeManageNew/Models/Shage/GetOrderUsedSaleInput.cs
index e54711a..e274819 100644
--- a/TradeManageNew/Models/Shage/GetOrderUsedSale.cs
+++ b/TradeManageNew/Models/Shage/GetOrderUsedSaleInput.cs
@@ -1,6 +1,6 @@
namespace TradeManageNew.Models.Shage
{
- public class GetOrderUsedSale
+ public class GetOrderUsedSaleInput
{
///
/// 跟踪号
diff --git a/TradeManageNew/OuterService/ShageService.ashx.cs b/TradeManageNew/OuterService/ShageService.ashx.cs
index 02968d4..7ecacdc 100644
--- a/TradeManageNew/OuterService/ShageService.ashx.cs
+++ b/TradeManageNew/OuterService/ShageService.ashx.cs
@@ -1371,7 +1371,7 @@ namespace TradeManageNew.OuterService
md.Data = null;
}
}
- if (Method == "OrderUsedSaleEntry")
+ if (Method == "PostOrderUsedSaleEntry")
{
var input = JsonConvert.DeserializeObject(ResponseContent);
var validatedSuccess = true;
@@ -1442,7 +1442,7 @@ namespace TradeManageNew.OuterService
$"There is no product information with ID {orderItem.DetailId}");
}
- //检查是否存在相同跟踪号不同订单号的订单
+ //检查是否存在相同跟踪号不同订单的情况
var repeatTrackingCodeOrderIds = db.DT_OrderUsedSaleEntry
.Where(x => x.TrackingCode == input.TrackingCode)
.Select(x => x.OrderId)
@@ -1458,7 +1458,7 @@ namespace TradeManageNew.OuterService
{
OrderId = order.OrderId,
OrderCode = order.OrderCode,
- GoodsId = sku.DetailId,
+ GoodsDetailId = sku.DetailId,
GoodsCode = sku.SKU1,
Quantity = input.Quantity,
TrackingCode = input.TrackingCode,
@@ -1478,7 +1478,7 @@ namespace TradeManageNew.OuterService
if (Method == "GetOrderUsedSale")
{
- var input = JsonConvert.DeserializeObject(ResponseContent);
+ var input = JsonConvert.DeserializeObject(ResponseContent);
if (string.IsNullOrWhiteSpace(input.TrackingCode))
{
md.Code = "400";
@@ -1488,174 +1488,61 @@ namespace TradeManageNew.OuterService
else
{
input.TrackingCode = input.TrackingCode.Trim();
+ //可能需要处理扫描面单匹配的问题
+
using (var db = new ErpDbContext())
{
+ //此前已校验过一个跟踪号只能匹配相同的订单号
var orderUsedSaleEntryList = db.DT_OrderUsedSaleEntry
.Where(x => x.TrackingCode == input.TrackingCode)
.ToList();
- var groupOrderUsedSaleEntry = orderUsedSaleEntryList.GroupBy(x => x.GoodsId)
+ if (!orderUsedSaleEntryList.Any())
+ {
+ throw new Exception($"Tracking number {input.TrackingCode} has no data");
+ }
+
+ var groupOrderUsedSaleEntry = orderUsedSaleEntryList.GroupBy(x => x.GoodsDetailId)
.Select(o => new
{
o.Key,
Quantity = o.Sum(x => x.Quantity)
}).ToList();
+
+ var goodsDetailIds = groupOrderUsedSaleEntry.Select(x => x.Key).ToList();
+ var skus = db.HW_GoodsDetail.Where(x => goodsDetailIds.Contains(x.DetailId)).ToList();
+
+ var spuIds = skus.Select(x => x.GoodsId).Distinct().ToList();
+ var spus = db.HW_GoodsInfo.Where(x => spuIds.Contains(x.GoodsId));
+
+ var order = db.DT_OrderInfo.FirstOrDefault(x =>
+ x.OrderId == orderUsedSaleEntryList.First().OrderId);
+
+ var result = new GetOrderUsedSaleDto
+ {
+ OrderId = order.OrderId,
+ OrderCode = order.OrderCode,
+ Items = skus.Select(o =>
+ {
+ var spu = spus.FirstOrDefault(x => x.GoodsId == o.GoodsId);
+
+ return new GetOrderUsedSaleItemDto
+ {
+ ProductCode = spu?.GoodsCode,
+ ProductDescription = spu?.GoodsEnglisgName,
+ GoodsDetailId = o.DetailId,
+ SkuCode = o.SKU1
+ };
+ }).ToList()
+ };
+
+ md.Code = "100";
+ md.Result = "Success";
+ md.Data = JsonConvert.SerializeObject(result);
}
}
}
- // if (Method == "ReturnUsedSale")
- // {
- // var input = JsonConvert.DeserializeObject(ResponseContent);
- // var validatedSuccess = true;
- // if (string.IsNullOrEmpty(input.StoreCode))
- // {
- // md.Code = "400";
- // md.Result = "Please enter storage Location";
- // md.Data = null;
- // validatedSuccess = false;
- // }
- // if (string.IsNullOrEmpty(input.TrackCode))
- // {
- // md.Code = "400";
- // md.Result = "Please enter tracking code";
- // md.Data = null;
- // validatedSuccess = false;
- // }
- // if (string.IsNullOrEmpty(input.OrderCode))
- // {
- // md.Code = "400";
- // md.Result = "Please enter order no";
- // md.Data = null;
- // validatedSuccess = false;
- // }
- // if (input.GoodsList==null || !input.GoodsList.Any())
- // {
- // md.Code = "400";
- // md.Result = "Please enter goods information";
- // md.Data = null;
- // validatedSuccess = false;
- // }
- //
- // if (validatedSuccess)
- // {
- // var detailIds = input.GoodsList.Select(x => x.GoodsId).ToList();
- // using (var db = new ErpDbContext())
- // {
- // var orderReturns = db.DT_OrderReturn.Where(x =>
- // x.tracking_id == input.TrackCode &&
- // x.ordercode==input.OrderCode &&
- // (string.IsNullOrEmpty(x.InType) || x.InType == "6") &&
- // (string.IsNullOrEmpty(x.ScanState) || x.ScanState == "1") &&
- // x.detailid != null && detailIds.Contains(x.detailid.Value))
- // .ToList();
- //
- // var orderReturnIds = orderReturns.Select(x => x.id).ToList();
- //
- // if (!orderReturnIds.Any())
- // {
- // throw new Exception("Return order information not obtained");
- // }
- //
- // //二手平台上架信息
- // var orderReturnUsedSales = db.DT_OrderReturnUsedSale
- // .Where(x => orderReturnIds.Contains(x.OrderReturnId))
- // .ToList();
- //
- // foreach (var inputItem in input.GoodsList)
- // {
- // var returnItem = orderReturns.FirstOrDefault(x => x.detailid == inputItem.GoodsId);
- //
- // if (returnItem is null)
- // {
- // throw new Exception(
- // $"Return order information not obtained. tracking id {input.TrackCode},order no {input.OrderCode},sku {inputItem.GoodsId}");
- // }
- //
- // //已上架二手平台的数量
- // var usedSalesQuantity = orderReturnUsedSales
- // .Where(x => x.OrderReturnId == returnItem.id)
- // .Sum(x => x.Quantity);
- //
- // //剩余可以上架二手平台的数量
- // var remainingQuantity = returnItem.return_quantity - usedSalesQuantity;
- //
- // if (inputItem.GoodsNum > remainingQuantity)
- // {
- // throw new Exception(
- // $"sku {returnItem.merchant_sku} submitted quantity {inputItem.GoodsNum} exceeds the remaining submittable quantity {remainingQuantity}");
- // }
- // }
- //
- // db.BeginTransaction();
- //
- // try
- // {
- // #region 插入二手商品信息
- //
- // foreach (var inputItem in input.GoodsList)
- // {
- // var returnItem = orderReturns.First(x => x.detailid == inputItem.GoodsId);
- //
- // //更新退货订单表数据
- // db.DT_OrderReturn.Where(x => x.id == returnItem.id)
- // .Set(x => x.InType, "6")
- // .Set(x => x.ScanState, "1")
- // .Set(x => x.ScanDate, DateTime.Now)
- // .Set(x => x.ScanUserId, input.UserId)
- // .Set(x => x.PostionCode, input.StoreCode)
- // .Set(x => x.ImgUrl, input.Photo1)
- // .Set(x => x.ImgUrl2, input.Photo2)
- // .Set(x => x.ImgUrl3, input.Photo3)
- // .Set(x => x.ImgUrl4, input.Photo4)
- // .Set(x => x.ImgUrl5, input.Photo5)
- // .Update();
- //
- // var newOrderReturnUsedSale =
- // new TradeUsedSale.Repositories.Models.DT_OrderReturnUsedSale
- // {
- // OrderReturnId = returnItem.id,
- // OrderId = returnItem.orderid,
- // OrderCode = returnItem.ordercode,
- // GoodsId = returnItem.detailid.Value,
- // MerchantSku = returnItem.merchant_sku,
- // Quantity = inputItem.GoodsNum,
- // CreationTime = DateTime.Now,
- // CreatorId = input.UserId
- // };
- //
- // var newOrderReturnUsedSaleId =
- // db.InsertWithInt32Identity(newOrderReturnUsedSale);
- //
- // for (var i = 1; i <= inputItem.GoodsNum; i++)
- // {
- // var newOrderReturnUsedSaleItem =
- // new TradeUsedSale.Repositories.Models.DT_OrderReturnUsedSaleItem
- // {
- // OrderReturnUsedSaleId = newOrderReturnUsedSaleId,
- // IsPublished = false,
- // CreationTime = DateTime.Now,
- // CreatorId = input.UserId,
- // };
- //
- // db.InsertWithInt32Identity(newOrderReturnUsedSaleItem);
- // }
- // }
- //
- // #endregion
- //
- // db.CommitTransaction();
- // }
- // catch (Exception ex)
- // {
- // db.RollbackTransaction();
- // throw;
- // }
- // }
- // }
- //
- // }
-
}
}
catch (Exception ex)
diff --git a/TradeManageNew/TradeManageNew.csproj b/TradeManageNew/TradeManageNew.csproj
index 6396918..0d6938b 100644
--- a/TradeManageNew/TradeManageNew.csproj
+++ b/TradeManageNew/TradeManageNew.csproj
@@ -2915,8 +2915,9 @@
+
-
+
OrderAPI.ashx
diff --git a/TradeUsedSale/Repositories/ErpDbContext.cs b/TradeUsedSale/Repositories/ErpDbContext.cs
index 72fd9a2..c3f46c7 100644
--- a/TradeUsedSale/Repositories/ErpDbContext.cs
+++ b/TradeUsedSale/Repositories/ErpDbContext.cs
@@ -19,6 +19,7 @@ namespace TradeUsedSale.Repositories
}
public ITable DT_OrderInfo => this.GetTable();
public ITable DT_OrderGoods => this.GetTable();
+ public ITable HW_GoodsInfo => this.GetTable();
public ITable HW_GoodsDetail => this.GetTable();
public ITable DT_OrderReturn => this.GetTable();
public ITable DT_OrderUsedSale => this.GetTable();
diff --git a/TradeUsedSale/Repositories/Models/DT_OrderUsedSaleEntry.cs b/TradeUsedSale/Repositories/Models/DT_OrderUsedSaleEntry.cs
index 8343f09..898f8f2 100644
--- a/TradeUsedSale/Repositories/Models/DT_OrderUsedSaleEntry.cs
+++ b/TradeUsedSale/Repositories/Models/DT_OrderUsedSaleEntry.cs
@@ -24,7 +24,7 @@ namespace TradeUsedSale.Repositories.Models
///
/// SKU ID
///
- public int GoodsId { get; set; }
+ public int GoodsDetailId { get; set; }
///
/// SKU Code
diff --git a/TradeUsedSale/Repositories/Models/HW_GoodsInfo.cs b/TradeUsedSale/Repositories/Models/HW_GoodsInfo.cs
new file mode 100644
index 0000000..da0d7ab
--- /dev/null
+++ b/TradeUsedSale/Repositories/Models/HW_GoodsInfo.cs
@@ -0,0 +1,247 @@
+using System;
+
+namespace TradeUsedSale.Repositories.Models
+{
+ public class HW_GoodsInfo
+ {
+ public int GoodsId { get; set; }
+
+ ///
+ /// 货物编码
+ ///
+ public string GoodsCode { get; set; }
+
+ ///
+ /// 货物编码字母
+ ///
+ public string GoodsEg { get; set; }
+
+ ///
+ /// 货物编号序号
+ ///
+ public int? GoodsNo { get; set; }
+
+ ///
+ /// 货物原编码(在供应商那边的编码)
+ ///
+ public string GoodsOldCode { get; set; }
+
+ ///
+ /// 类别id
+ ///
+ public int? SortId { get; set; }
+
+ ///
+ /// 分类名称
+ ///
+ public string SortName { get; set; }
+
+ ///
+ /// 供应商id
+ ///
+ public string SupplierId { get; set; }
+
+ ///
+ /// 货物名称
+ ///
+ public string GoodsName { get; set; }
+
+ ///
+ /// 货物英文名称
+ ///
+ public string GoodsEnglisgName { get; set; }
+
+ public int? GoodsNum { get; set; }
+ public int? GoodsLockNum { get; set; }
+
+ ///
+ /// 商品价格(第一批价格)
+ ///
+ public decimal? InPrice { get; set; }
+
+ ///
+ /// 商品价格(最近批次价格)
+ ///
+ public decimal? NowPrice { get; set; }
+
+ ///
+ /// 货物重量
+ ///
+ public decimal? Weight { get; set; }
+
+ ///
+ /// 重量单位
+ ///
+ public string WeightUnit { get; set; }
+
+ ///
+ /// 货物体积
+ ///
+ public decimal? Solid { get; set; }
+
+ ///
+ /// 体积单位
+ ///
+ public string SolidUnit { get; set; }
+
+ ///
+ /// 库位id
+ ///
+ public int? Position { get; set; }
+
+ public DateTime? InDate { get; set; }
+ public DateTime? UpdateDate { get; set; }
+ public string FirstImgUrl { get; set; }
+ public string GoodsImageIds { get; set; }
+ public int? CompanyId { get; set; }
+
+ ///
+ /// 货物计划购买数量
+ ///
+ public int? GoodsPlanNum { get; set; }
+
+ ///
+ /// 海外仓数量
+ ///
+ public int? GoodsOutNum { get; set; }
+
+ ///
+ /// 购买途中数量
+ ///
+ public int? GoodsInNum { get; set; }
+
+ ///
+ /// 安全库存
+ ///
+ public int? SafeNum { get; set; }
+
+ ///
+ /// 海关编码
+ ///
+ public string HGCode { get; set; }
+
+ ///
+ /// 海关单位编码
+ ///
+ public string HGCompanyCode { get; set; }
+
+ ///
+ /// 海关单位编码
+ ///
+ public string UpdateName { get; set; }
+
+ public string GoodsRemark { get; set; }
+ public int? AutoPlan { get; set; }
+
+ ///
+ /// 无货
+ ///
+ public int? NoGoods { get; set; }
+
+ ///
+ /// 平均到货天数
+ ///
+ public decimal? AvgTime { get; set; }
+
+ ///
+ /// 1正常0删除
+ ///
+ public int? State { get; set; }
+
+ public int? Supplier { get; set; }
+
+ ///
+ /// 事业部提醒备注
+ ///
+ public string DeptRemark { get; set; }
+
+ ///
+ /// 异常定期提醒0表示不提醒,其它表示几天后提醒
+ ///
+ public int? NoticeDays { get; set; }
+
+ public string GoodsInfo { get; set; }
+ public string DefaultCity { get; set; }
+ public decimal? PageFee { get; set; }
+ public decimal? PostPrice { get; set; }
+ public string GoodsSupplyCode { get; set; }
+ public decimal? BGPrice { get; set; }
+ public string GoodNote { get; set; }
+ public string NoticeShop { get; set; }
+ public int? GoodsHJNum { get; set; }
+ public int? GoodsHJNum2 { get; set; }
+ public decimal? NetWeight { get; set; }
+ public decimal? Long { get; set; }
+ public decimal? Width { get; set; }
+ public decimal? Height { get; set; }
+ public int? BoxRate { get; set; }
+ public string Cert { get; set; }
+ public int? UpOff { get; set; }
+ public decimal? FeeRate { get; set; }
+ public decimal? JYPrice { get; set; }
+ public decimal? Long2 { get; set; }
+ public decimal? Width2 { get; set; }
+ public decimal? Height2 { get; set; }
+ public decimal? Weight2 { get; set; }
+ public int? GoodsInNum2 { get; set; }
+ public DateTime? LastOrderDate { get; set; }
+ public int? IsSure { get; set; }
+ public string IsBox { get; set; }
+ public int? BoxNum { get; set; }
+ public string BoxStoreCode { get; set; }
+ public int? IsEnd { get; set; }
+ public int? JHDays { get; set; }
+ public string KFName { get; set; }
+ public decimal? tcrate { get; set; }
+ public string KFName2 { get; set; }
+ public int? DonePlanNum { get; set; }
+ public decimal? SalePrice { get; set; }
+ public int? SortId1 { get; set; }
+ public string SortId2 { get; set; }
+ public string JYSales { get; set; }
+ public decimal? CKG { get; set; }
+ public string mname { get; set; }
+ public int? muserid { get; set; }
+ public DateTime? DHDate { get; set; }
+ public string groupname { get; set; }
+ public int? guserid { get; set; }
+ public string groupname_ebay { get; set; }
+ public string groupname_wlmart { get; set; }
+ public int? guserid_ebay { get; set; }
+ public int? guserid_wlmart { get; set; }
+ public string LeaveWord { get; set; }
+ public decimal? GoodsMonthHJPrice { get; set; }
+ public int? GoodsWeekHJNum { get; set; }
+ public decimal? GoodsWeekHJPrice { get; set; }
+ public int? GoodsHJNum3 { get; set; }
+ public int? GoodsHJNum4 { get; set; }
+ public int? guserid_shopify { get; set; }
+ public int? guserid_wayfair { get; set; }
+ public int? guserid_sheIn { get; set; }
+ public string groupname_shopify { get; set; }
+ public string groupname_wayfair { get; set; }
+ public string groupname_sheIn { get; set; }
+ public string LeaveWord_cg { get; set; }
+ public int? IsExamine { get; set; }
+ public string LeaveWord_ebay { get; set; }
+ public string LeaveWord_walmart { get; set; }
+ public string LeaveWord_shopify { get; set; }
+ public string LeaveWord_shein { get; set; }
+ public string LeaveWord_wayfair { get; set; }
+ public int? PlanCount { get; set; }
+ public int? IsYC { get; set; }
+ public int? EditPlanCount { get; set; }
+
+ ///
+ /// 公司为该产品卖出每个的补贴费用
+ ///
+ public decimal? SubsidyFee { get; set; }
+
+ public int? guserid_tiktok { get; set; }
+ public string groupname_tiktok { get; set; }
+ public int? guserid_temu { get; set; }
+ public string groupname_temu { get; set; }
+ public string LeaveWord_tiktok { get; set; }
+ public string LeaveWord_temu { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/TradeUsedSale/TradeUsedSale.csproj b/TradeUsedSale/TradeUsedSale.csproj
index 0a7447e..f3e683e 100644
--- a/TradeUsedSale/TradeUsedSale.csproj
+++ b/TradeUsedSale/TradeUsedSale.csproj
@@ -56,6 +56,7 @@
+