|
|
|
@ -23,6 +23,7 @@ using System.Windows.Forms;
|
|
|
|
|
using TradeData;
|
|
|
|
|
using NetLibrary.Data;
|
|
|
|
|
using NetLibrary.ReportPrint;
|
|
|
|
|
using TradeManageNew.APIClients.ShopifyAPI;
|
|
|
|
|
|
|
|
|
|
namespace TradeManageNew.OuterService
|
|
|
|
|
{
|
|
|
|
@ -1748,36 +1749,60 @@ namespace TradeManageNew.OuterService
|
|
|
|
|
|
|
|
|
|
if (orderUsedSalePlatform is null)
|
|
|
|
|
{
|
|
|
|
|
throw new Exception(
|
|
|
|
|
$"No barcode for {input.BarCode} to be shipped used sale item exists");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var product = db.HW_GoodsInfo.FirstOrDefault(x => x.GoodsId == orderUsedSalePlatform.ProductId);
|
|
|
|
|
//throw new Exception(
|
|
|
|
|
// $"No barcode for {input.BarCode} to be shipped used sale item exists");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
orderUsedSalePlatform= db.DT_OrderUsedSalePlatform.FirstOrDefault(x =>
|
|
|
|
|
x.BarCode == input.BarCode);
|
|
|
|
|
var product = db.HW_GoodsInfo.FirstOrDefault(x => x.GoodsId == orderUsedSalePlatform.ProductId);
|
|
|
|
|
|
|
|
|
|
var result = new GetPickupOrderUsedSalePlatformDto
|
|
|
|
|
var result = new GetPickupOrderUsedSalePlatformDto
|
|
|
|
|
{
|
|
|
|
|
Id = orderUsedSalePlatform.Id,
|
|
|
|
|
|
|
|
|
|
ProductDescription = product?.GoodsEnglisgName,
|
|
|
|
|
SkuId = orderUsedSalePlatform.SkuId,
|
|
|
|
|
SkuCode = orderUsedSalePlatform.SkuCode,
|
|
|
|
|
BarCode = orderUsedSalePlatform.BarCode,
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
md.Code = "100";
|
|
|
|
|
md.Result = "Success";
|
|
|
|
|
md.Data = JsonConvert.SerializeObject(result);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Id = orderUsedSalePlatform.Id,
|
|
|
|
|
ProductId = orderUsedSalePlatform.ProductId,
|
|
|
|
|
ProductCode = orderUsedSalePlatform.ProductCode,
|
|
|
|
|
ProductDescription = product?.GoodsEnglisgName,
|
|
|
|
|
SkuId = orderUsedSalePlatform.SkuId,
|
|
|
|
|
SkuCode = orderUsedSalePlatform.SkuCode,
|
|
|
|
|
BarCode = orderUsedSalePlatform.BarCode,
|
|
|
|
|
IsPrinted = orderUsedSalePlatform.IsPrinted,
|
|
|
|
|
Status = orderUsedSalePlatform.Status,
|
|
|
|
|
WarehouseLocation =orderUsedSalePlatform.WarehouseLocation,
|
|
|
|
|
WarehousePositionId = orderUsedSalePlatform.WarehousePositionId,
|
|
|
|
|
WarehousePositionCode = orderUsedSalePlatform.WarehousePositionCode,
|
|
|
|
|
ImageUrls = JsonConvert.DeserializeObject<List<string>>(orderUsedSalePlatform.ImageUrls),
|
|
|
|
|
ShippingMethod = orderUsedSalePlatform.ShippingMethod,
|
|
|
|
|
IsNew = orderUsedSalePlatform.IsNew,
|
|
|
|
|
CreationTime = orderUsedSalePlatform.CreationTime,
|
|
|
|
|
CreatorId = orderUsedSalePlatform.CreatorId
|
|
|
|
|
};
|
|
|
|
|
var product = db.HW_GoodsInfo.FirstOrDefault(x => x.GoodsId == orderUsedSalePlatform.ProductId);
|
|
|
|
|
|
|
|
|
|
var result = new GetPickupOrderUsedSalePlatformDto
|
|
|
|
|
{
|
|
|
|
|
Id = orderUsedSalePlatform.Id,
|
|
|
|
|
ProductId = orderUsedSalePlatform.ProductId,
|
|
|
|
|
ProductCode = orderUsedSalePlatform.ProductCode,
|
|
|
|
|
ProductDescription = product?.GoodsEnglisgName,
|
|
|
|
|
SkuId = orderUsedSalePlatform.SkuId,
|
|
|
|
|
SkuCode = orderUsedSalePlatform.SkuCode,
|
|
|
|
|
BarCode = orderUsedSalePlatform.BarCode,
|
|
|
|
|
IsPrinted = orderUsedSalePlatform.IsPrinted,
|
|
|
|
|
Status = orderUsedSalePlatform.Status,
|
|
|
|
|
WarehouseLocation = orderUsedSalePlatform.WarehouseLocation,
|
|
|
|
|
WarehousePositionId = orderUsedSalePlatform.WarehousePositionId,
|
|
|
|
|
WarehousePositionCode = orderUsedSalePlatform.WarehousePositionCode,
|
|
|
|
|
ImageUrls = JsonConvert.DeserializeObject<List<string>>(orderUsedSalePlatform.ImageUrls),
|
|
|
|
|
ShippingMethod = orderUsedSalePlatform.ShippingMethod,
|
|
|
|
|
IsNew = orderUsedSalePlatform.IsNew,
|
|
|
|
|
CreationTime = orderUsedSalePlatform.CreationTime,
|
|
|
|
|
CreatorId = orderUsedSalePlatform.CreatorId
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
md.Code = "100";
|
|
|
|
|
md.Result = "Success";
|
|
|
|
|
md.Data = JsonConvert.SerializeObject(result);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
md.Code = "100";
|
|
|
|
|
md.Result = "Success";
|
|
|
|
|
md.Data = JsonConvert.SerializeObject(result);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -2008,23 +2033,51 @@ namespace TradeManageNew.OuterService
|
|
|
|
|
if (Method == "SelfPickupOrderUsedSalePlatform")
|
|
|
|
|
{
|
|
|
|
|
var input = JsonConvert.DeserializeObject<SelfPickupOrderUsedSalePlatformInput>(ResponseContent);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
using (var db = new ErpDbContext())
|
|
|
|
|
{
|
|
|
|
|
var exPlatformList = db.DT_OrderUsedSalePlatform.Where(x =>
|
|
|
|
|
input.Ids.Contains(x.Id))
|
|
|
|
|
.ToList();
|
|
|
|
|
//如果传入的状态不是4,并且之前的状态是2则需要删除变体
|
|
|
|
|
foreach (var i in exPlatformList)
|
|
|
|
|
{
|
|
|
|
|
if (input.Status != 4 && (int)i.Status == 2)
|
|
|
|
|
{
|
|
|
|
|
var shopifyApiClient = new ShopifyAPIClient();
|
|
|
|
|
var productVariantRes = shopifyApiClient.DeleteProductVariantAsync(new Body3
|
|
|
|
|
{
|
|
|
|
|
ProductId = i.ProductId.ToString(),
|
|
|
|
|
Code = i.ProductCode,
|
|
|
|
|
}).ConfigureAwait(false)
|
|
|
|
|
.GetAwaiter()
|
|
|
|
|
.GetResult();
|
|
|
|
|
|
|
|
|
|
//if (productVariantRes.Success != true)
|
|
|
|
|
//{
|
|
|
|
|
// throw new Exception($"删除Shopify条码[{item.ProductCode}]变体失败,{productVariantRes.Message}");
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var orderUsedSalePlatformList = db.DT_OrderUsedSalePlatform.Where(x =>
|
|
|
|
|
input.Ids.Contains(x.Id)
|
|
|
|
|
&& x.Status == UsedSalePlatformStatus.PendingPickup)
|
|
|
|
|
&& x.Status == (UsedSalePlatformStatus)input.Status)
|
|
|
|
|
.ToList();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (orderUsedSalePlatformList.Any())
|
|
|
|
|
{
|
|
|
|
|
db.DT_OrderUsedSalePlatform.Where(x =>
|
|
|
|
|
input.Ids.Contains(x.Id)
|
|
|
|
|
&& x.Status == UsedSalePlatformStatus.PendingPickup)
|
|
|
|
|
&& x.Status == (UsedSalePlatformStatus)input.Status)
|
|
|
|
|
.Set(x => x.ShippingMethod, ShippingMethod.SelfPickup)
|
|
|
|
|
.Set(x => x.Status, UsedSalePlatformStatus.Sold)
|
|
|
|
|
.Set(x => x.Status, (UsedSalePlatformStatus)input.Status)
|
|
|
|
|
.Set(x => x.LastModifierId, input.UserId)
|
|
|
|
|
.Set(x => x.LastModificationTime, DateTime.Now)
|
|
|
|
|
.Set(x => x.imgList, input.imgList)
|
|
|
|
|
.Update();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|