master
wufan 2 months ago
parent d92e954cb6
commit 19c45a2bb2

@ -0,0 +1,22 @@
namespace TradeManageNew.Models.Shage
{
public class GetOrderUsedSalePlatformDto
{
/// <summary>
/// 产品编码
/// </summary>
public string ProductCode { get; set; }
/// <summary>
/// 产品描述
/// </summary>
public string ProductDescription { get; set; }
public int SkuId { get; set; }
/// <summary>
/// sku编码
/// </summary>
public string SkuCode { get; set; }
}
}

@ -0,0 +1,7 @@
namespace TradeManageNew.Models.Shage
{
public class GetOrderUsedSalePlatformInput
{
public string SkuCode { get; set; }
}
}

@ -0,0 +1,21 @@
using System.Collections.Generic;
namespace TradeManageNew.Models.Shage
{
public class OrderUsedSalePlatformInput
{
public int SkuId { get; set; }
/// <summary>
/// 库位编码
/// </summary>
public string WarehousePositionCode { get; set; }
/// <summary>
/// 图片信息
/// </summary>
public List<string> ImageUrls { get; set; }
public int UserId { get; set; }
}
}

@ -7,7 +7,6 @@ using NetLibrary.Log;
using System.IO;
using TradeModel;
using NetLibrary;
using Org.BouncyCastle.Utilities.Encoders;
using System.Drawing;
using LinqToDB;
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)

@ -2916,8 +2916,11 @@
<Compile Include="MicrosoftExcelNew.cs" />
<Compile Include="ModelNew.cs" />
<Compile Include="Models\Shage\GetOrderUsedSaleDto.cs" />
<Compile Include="Models\Shage\GetOrderUsedSalePlatformDto.cs" />
<Compile Include="Models\Shage\OrderUsedSaleEntryInput.cs" />
<Compile Include="Models\Shage\GetOrderUsedSaleInput.cs" />
<Compile Include="Models\Shage\GetOrderUsedSalePlatformInput.cs" />
<Compile Include="Models\Shage\OrderUsedSalePlatformInput.cs" />
<Compile Include="OrderAPI.ashx.cs">
<DependentUpon>OrderAPI.ashx</DependentUpon>
</Compile>

@ -27,5 +27,6 @@ namespace TradeUsedSale.Repositories
public ITable<DT_OrderUsedSaleEntry> DT_OrderUsedSaleEntry => this.GetTable<DT_OrderUsedSaleEntry>();
public ITable<DT_OrderUsedSalePlatform> DT_OrderUsedSalePlatform => this.GetTable<DT_OrderUsedSalePlatform>();
public ITable<JC_Shop> JC_Shop => this.GetTable<JC_Shop>();
public ITable<JC_UserInfo> JC_UserInfo => this.GetTable<JC_UserInfo>();
}
}

@ -8,18 +8,51 @@ namespace TradeUsedSale.Repositories.Models
{
[PrimaryKey, Identity] public int Id { get; set; }
public int OrderUsedSaleId { get; set; }
/// <summary>
/// 产品Id
/// </summary>
public int ProductId { get; set; }
/// <summary>
/// 产品编码
/// </summary>
public string ProductCode { get; set; }
/// <summary>
/// SKU ID
/// </summary>
public int SkuId { get; set; }
/// <summary>
/// SKU Code
/// </summary>
public string SkuCode { get; set; }
/// <summary>
/// 打印条码
/// </summary>
public string BarCode { get; set; }
/// <summary>
/// 是否已推送
/// </summary>
public bool IsPublished { get; set; }
/// <summary>
/// 仓库
/// </summary>
public WarehouseLocation WarehouseLocation { get; set; }
/// <summary>
/// 库位编码
/// </summary>
public string WarehousePositionCode { get; set; }
/// <summary>
/// 图片信息
/// </summary>
public string ImageUrls { get; set; }
/// <summary>
/// 交易方式
/// </summary>

@ -0,0 +1,65 @@
using System;
using LinqToDB.Mapping;
namespace TradeUsedSale.Repositories.Models
{
public class JC_UserInfo
{
[PrimaryKey, Identity] public int UserId { get; set; }
public string Name { get; set; }
public string SpellName { get; set; }
public string EnglishName { get; set; }
public string Sex { get; set; }
public string UserName { get; set; }
public string Password { get; set; }
public string UserType { get; set; }
public int? State { get; set; }
public int? CompanyId { get; set; }
public string UserCode { get; set; }
public int? LoginCount { get; set; }
public DateTime? LastLoginTime { get; set; }
public string LastLoginIp { get; set; }
public string Photo { get; set; }
public DateTime? UpdateDate { get; set; }
public string Duty { get; set; }
public string Mobile1 { get; set; }
public string Mobile2 { get; set; }
public string Mobile3 { get; set; }
public string UserCard { get; set; }
public DateTime? InDate { get; set; }
public string DeptName { get; set; }
public string IDCard { get; set; }
public string SchoolLevel { get; set; }
public string School { get; set; }
public DateTime? BornDate { get; set; }
public string BornAddr { get; set; }
public DateTime? ContractDate { get; set; }
public DateTime? JoinDate { get; set; }
public DateTime? FormalDate { get; set; }
public string IsMarry { get; set; }
public string IsBaby { get; set; }
public string HuKou { get; set; }
public string HuKouAddr { get; set; }
public string NowAddr { get; set; }
public int? IsRoom { get; set; }
public string RoomAddr { get; set; }
public string Political { get; set; }
public int? DeptId { get; set; }
public string Traffic { get; set; }
public string QQ { get; set; }
public string Email { get; set; }
public string EmployeeType { get; set; }
public int? Holidays { get; set; }
public int? IsLogin { get; set; }
public string WorkDesc { get; set; }
public int? AnnualDay { get; set; }
public int? MoodDay { get; set; }
public string GroupName { get; set; }
public int? guserid { get; set; }
/// <summary>
/// 1能登陆erpoms
/// </summary>
public int? isoms { get; set; }
}
}

@ -59,6 +59,7 @@
<Compile Include="Repositories\Models\HW_GoodsDetail.cs" />
<Compile Include="Repositories\Models\HW_GoodsInfo.cs" />
<Compile Include="Repositories\Models\JC_Shop.cs" />
<Compile Include="Repositories\Models\JC_UserInfo.cs" />
<Compile Include="Repositories\Utils\ExpressionExtensions.cs" />
<Compile Include="Repositories\Utils\LinqToDbExtensions.cs" />
<Compile Include="Repositories\Utils\ParameterRebinder.cs" />

Loading…
Cancel
Save