|
|
@ -7,7 +7,6 @@ using NetLibrary.Log;
|
|
|
|
using System.IO;
|
|
|
|
using System.IO;
|
|
|
|
using TradeModel;
|
|
|
|
using TradeModel;
|
|
|
|
using NetLibrary;
|
|
|
|
using NetLibrary;
|
|
|
|
using Org.BouncyCastle.Utilities.Encoders;
|
|
|
|
|
|
|
|
using System.Drawing;
|
|
|
|
using System.Drawing;
|
|
|
|
using LinqToDB;
|
|
|
|
using LinqToDB;
|
|
|
|
using TradeManageNew.Models.Shage;
|
|
|
|
using TradeManageNew.Models.Shage;
|
|
|
@ -1568,6 +1567,124 @@ namespace TradeManageNew.OuterService
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (Method == "GetOrderUsedSalePlatform")
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var input = JsonConvert.DeserializeObject<GetOrderUsedSalePlatformInput>(ResponseContent);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (string.IsNullOrWhiteSpace(input.SkuCode))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
md.Code = "400";
|
|
|
|
|
|
|
|
md.Result = "Please enter sku code";
|
|
|
|
|
|
|
|
md.Data = null;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
input.SkuCode = input.SkuCode.Trim();
|
|
|
|
|
|
|
|
using (var db = new ErpDbContext())
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var sku = db.HW_GoodsDetail.FirstOrDefault(x => x.SKU1 == input.SkuCode ||
|
|
|
|
|
|
|
|
x.SKU2 == input.SkuCode ||
|
|
|
|
|
|
|
|
x.SKU3 == input.SkuCode ||
|
|
|
|
|
|
|
|
x.SKU4 == input.SkuCode ||
|
|
|
|
|
|
|
|
x.SKU5 == input.SkuCode);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (sku is null)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
throw new Exception($"There is no SKU encoded as {input.SkuCode}");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var product = db.HW_GoodsInfo.FirstOrDefault(x => x.GoodsId == sku.GoodsId);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var result = new GetOrderUsedSalePlatformDto
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
ProductCode = product?.GoodsCode,
|
|
|
|
|
|
|
|
ProductDescription = product?.GoodsEnglisgName,
|
|
|
|
|
|
|
|
SkuId = sku.DetailId,
|
|
|
|
|
|
|
|
SkuCode = sku.SKU1
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
md.Code = "100";
|
|
|
|
|
|
|
|
md.Result = "Success";
|
|
|
|
|
|
|
|
md.Data = JsonConvert.SerializeObject(result);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (Method == "PostOrderUsedSalePlatform")
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var input = JsonConvert.DeserializeObject<OrderUsedSalePlatformInput>(ResponseContent);
|
|
|
|
|
|
|
|
var validatedSuccess = true;
|
|
|
|
|
|
|
|
if (input.SkuId<=0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
md.Code = "400";
|
|
|
|
|
|
|
|
md.Result = "Please enter sku code";
|
|
|
|
|
|
|
|
md.Data = null;
|
|
|
|
|
|
|
|
validatedSuccess = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (string.IsNullOrWhiteSpace(input.WarehousePositionCode))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
md.Code = "400";
|
|
|
|
|
|
|
|
md.Result = "Please enter the storage location";
|
|
|
|
|
|
|
|
md.Data = null;
|
|
|
|
|
|
|
|
validatedSuccess = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (input.ImageUrls is null || !input.ImageUrls.Any())
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
md.Code = "400";
|
|
|
|
|
|
|
|
md.Result = "Please upload photos";
|
|
|
|
|
|
|
|
md.Data = null;
|
|
|
|
|
|
|
|
validatedSuccess = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (validatedSuccess)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
using (var db = new ErpDbContext())
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var user = db.JC_UserInfo.FirstOrDefault(x => x.UserId == input.UserId);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (user is null || (user.WorkDesc != "西仓" && user.WorkDesc != "东仓"))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
throw new Exception("Non warehouse staff");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var sku = db.HW_GoodsDetail.FirstOrDefault(x => x.DetailId==input.SkuId);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (sku is null)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
throw new Exception($"There is no SKU with ID {input.SkuId}");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var product = db.HW_GoodsInfo.FirstOrDefault(x => x.GoodsId == sku.GoodsId);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var newOrderUsedSalePlatform =
|
|
|
|
|
|
|
|
new TradeUsedSale.Repositories.Models.DT_OrderUsedSalePlatform
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
ProductId = product.GoodsId,
|
|
|
|
|
|
|
|
ProductCode = product.GoodsCode,
|
|
|
|
|
|
|
|
SkuId = sku.DetailId,
|
|
|
|
|
|
|
|
SkuCode = sku.SKU1,
|
|
|
|
|
|
|
|
BarCode = null,
|
|
|
|
|
|
|
|
IsPublished = false,
|
|
|
|
|
|
|
|
WarehouseLocation = user.WorkDesc == "东仓"
|
|
|
|
|
|
|
|
? WarehouseLocation.East
|
|
|
|
|
|
|
|
: WarehouseLocation.West,
|
|
|
|
|
|
|
|
WarehousePositionCode = input.WarehousePositionCode,
|
|
|
|
|
|
|
|
ImageUrls = JsonConvert.SerializeObject(input.ImageUrls),
|
|
|
|
|
|
|
|
CreationTime = DateTime.Now,
|
|
|
|
|
|
|
|
CreatorId = input.UserId,
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var newOrderUsedSalePlatformId = db.InsertWithInt32Identity(newOrderUsedSalePlatform);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
md.Code = "100";
|
|
|
|
|
|
|
|
md.Result = "Success";
|
|
|
|
|
|
|
|
md.Data = JsonConvert.SerializeObject(newOrderUsedSalePlatform);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (Exception ex)
|
|
|
|
catch (Exception ex)
|
|
|
|