Compare commits
2 Commits
192dce4357
...
78b1bdb2cc
| Author | SHA1 | Date | |
|---|---|---|---|
| 78b1bdb2cc | |||
| 228640df46 |
141
Reportapi/MyCode.Project.Domain/Message/Request/WMS/SaleOrder.cs
Normal file
141
Reportapi/MyCode.Project.Domain/Message/Request/WMS/SaleOrder.cs
Normal file
@@ -0,0 +1,141 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace MyCode.Project.Domain.Message.Request.WMS
|
||||||
|
{
|
||||||
|
public class SaleOrder
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 单据编号
|
||||||
|
/// </summary>
|
||||||
|
public string OrderNo { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 公司组织
|
||||||
|
/// </summary>
|
||||||
|
public string CompanyId { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 同步日期时间
|
||||||
|
/// </summary>
|
||||||
|
public string ReadTime { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 销售类型
|
||||||
|
/// </summary>
|
||||||
|
public string OrderType { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 客户编码
|
||||||
|
/// </summary>
|
||||||
|
public string CustAccount { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 单据日期
|
||||||
|
/// </summary>
|
||||||
|
public string OrderTime { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// WMS仓库
|
||||||
|
/// </summary>
|
||||||
|
public string WarehouseId { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 货主
|
||||||
|
/// </summary>
|
||||||
|
public string CustomerId { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 下发系统
|
||||||
|
/// </summary>
|
||||||
|
public string Channel { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 单据类型
|
||||||
|
/// </summary>
|
||||||
|
public string ItemType { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 单据总数量
|
||||||
|
/// </summary>
|
||||||
|
public int TotalQty { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 单据总金额
|
||||||
|
/// </summary>
|
||||||
|
public decimal TotalMount { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 备注
|
||||||
|
/// </summary>
|
||||||
|
public string Comment { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 单据创建日期时间
|
||||||
|
/// </summary>
|
||||||
|
public string CreateTime { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 订单明细
|
||||||
|
/// </summary>
|
||||||
|
public Line[] Lines { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Line
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 单据编号
|
||||||
|
/// </summary>
|
||||||
|
public string OrderNo { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 公司组织
|
||||||
|
/// </summary>
|
||||||
|
public string CompanyId { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 销售类型
|
||||||
|
/// </summary>
|
||||||
|
public string OrderType { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 行号
|
||||||
|
/// </summary>
|
||||||
|
public int LineNo { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 货主
|
||||||
|
/// </summary>
|
||||||
|
public string CustomerId { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// SKU
|
||||||
|
/// </summary>
|
||||||
|
public string Sku { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 条码
|
||||||
|
/// </summary>
|
||||||
|
public string Barcode { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 行数量
|
||||||
|
/// </summary>
|
||||||
|
public int OrderQty { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 单位
|
||||||
|
/// </summary>
|
||||||
|
public string OrderUnit { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 价格
|
||||||
|
/// </summary>
|
||||||
|
public decimal OrderPrice { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 物料编码
|
||||||
|
/// </summary>
|
||||||
|
public string ItemId { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 尺寸
|
||||||
|
/// </summary>
|
||||||
|
public string SizeType { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 颜色
|
||||||
|
/// </summary>
|
||||||
|
public string Color { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// ERP仓库
|
||||||
|
/// </summary>
|
||||||
|
public string LocationId { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 部门
|
||||||
|
/// </summary>
|
||||||
|
public string Comment { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 创建日期时间
|
||||||
|
/// </summary>
|
||||||
|
public string CreateTime { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -69,6 +69,7 @@
|
|||||||
<Compile Include="Message\Request\KingDee\BillSave.cs" />
|
<Compile Include="Message\Request\KingDee\BillSave.cs" />
|
||||||
<Compile Include="Message\Request\KingDee\SaveModel\SaleOrderModel.cs" />
|
<Compile Include="Message\Request\KingDee\SaveModel\SaleOrderModel.cs" />
|
||||||
<Compile Include="Message\Request\TimeRange.cs" />
|
<Compile Include="Message\Request\TimeRange.cs" />
|
||||||
|
<Compile Include="Message\Request\WMS\SaleOrder.cs" />
|
||||||
<Compile Include="Message\Response\Common\HeadFieldItem.cs" />
|
<Compile Include="Message\Response\Common\HeadFieldItem.cs" />
|
||||||
<Compile Include="Message\Response\Common\IdName.cs" />
|
<Compile Include="Message\Response\Common\IdName.cs" />
|
||||||
<Compile Include="Message\Response\Common\ItemResult.cs" />
|
<Compile Include="Message\Response\Common\ItemResult.cs" />
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<!--
|
<!--
|
||||||
For more information on how to configure your ASP.NET application, please visit
|
For more information on how to configure your ASP.NET application, please visit
|
||||||
https://go.microsoft.com/fwlink/?LinkId=301879
|
https://go.microsoft.com/fwlink/?LinkId=301879
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<configuration>
|
<configuration>
|
||||||
<runtime>
|
<runtime>
|
||||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using MyCode.Project.Domain.Message.Request.KingDee;
|
using MyCode.Project.Domain.Message.Request.KingDee;
|
||||||
using MyCode.Project.Domain.Message.Request.KingDee.SaveModel;
|
using MyCode.Project.Domain.Message.Request.KingDee.SaveModel;
|
||||||
|
using MyCode.Project.Domain.Message.Request.WMS;
|
||||||
using MyCode.Project.Domain.Message.Response.JackYun;
|
using MyCode.Project.Domain.Message.Response.JackYun;
|
||||||
using MyCode.Project.Domain.Model;
|
using MyCode.Project.Domain.Model;
|
||||||
using MyCode.Project.Domain.Repositories;
|
using MyCode.Project.Domain.Repositories;
|
||||||
@@ -10,6 +11,7 @@ using MyCode.Project.OutSideService;
|
|||||||
using MyCode.Project.Repositories;
|
using MyCode.Project.Repositories;
|
||||||
using MyCode.Project.Repositories.Common;
|
using MyCode.Project.Repositories.Common;
|
||||||
using MyCode.Project.Services.IServices;
|
using MyCode.Project.Services.IServices;
|
||||||
|
using RestSharp;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@@ -177,8 +179,55 @@ namespace MyCode.Project.Services.Implementation
|
|||||||
|
|
||||||
private string PushWMSSaleOrder(PushKingDeeOrder pushKingdeeOrder)
|
private string PushWMSSaleOrder(PushKingDeeOrder pushKingdeeOrder)
|
||||||
{
|
{
|
||||||
|
var itemList = _pushKingDeeOrderItemRepository
|
||||||
|
.Queryable()
|
||||||
|
.Where(t => pushKingdeeOrder.Id == t.PushKingDeeOrderId)
|
||||||
|
.ToList();
|
||||||
|
// 新建销售订单实例
|
||||||
|
var order = new SaleOrder();
|
||||||
|
// 赋值
|
||||||
|
order.CreateTime = pushKingdeeOrder.CreateTime?.ToString("yyyy/MM/dd");
|
||||||
|
order.OrderNo = pushKingdeeOrder.Id.ToString();
|
||||||
|
order.CompanyId = string.Empty; // 公司Id
|
||||||
|
order.OrderType = pushKingdeeOrder.TradeType == 8 ? "8" : "4"; // 订单类型
|
||||||
|
order.CustomerId = string.Empty; // 货主ID
|
||||||
|
order.WarehouseId = pushKingdeeOrder?.WarehouseId;
|
||||||
|
order.OrderTime = pushKingdeeOrder.ConsignTime?.ToString("yyyy/MM/dd");
|
||||||
|
order.Channel = string.Empty; // 下发系统
|
||||||
|
order.ItemType = string.Empty; // 单据类型
|
||||||
|
order.TotalQty = itemList.Sum(n => n.SellCount);
|
||||||
|
order.TotalMount = itemList.Sum(n => n.SellTotal);
|
||||||
|
order.CreateTime = pushKingdeeOrder.CreateTime?.ToString("yyyy/MM/dd");
|
||||||
|
order.ReadTime = DateTime.Now.ToString("yyyy/MM/dd");
|
||||||
|
order.Lines = itemList.Select(n => new Line()
|
||||||
|
{
|
||||||
|
OrderNo = pushKingdeeOrder.Id.ToString(),
|
||||||
|
CompanyId = string.Empty, // 公司Id
|
||||||
|
OrderType = pushKingdeeOrder.TradeType == 8 ? "8" : "4", // 订单类型
|
||||||
|
LineNo = itemList.IndexOf(n) + 1,
|
||||||
|
CustomerId = string.Empty, // 货主ID
|
||||||
|
Sku = n.Barcode,
|
||||||
|
Barcode = n.Barcode,
|
||||||
|
OrderQty = n.SellCount,
|
||||||
|
OrderPrice = Math.Round(n.DivideSellTotal / n.SellCount, 10),
|
||||||
|
ItemId = n.GoodsId, // 商品
|
||||||
|
}).ToArray();
|
||||||
|
|
||||||
return string.Empty;
|
var uri = "";
|
||||||
|
|
||||||
|
var requestString = JsonHelper.ToJson(order, false, false, true);
|
||||||
|
var client = new RestClient($"{uri}/sale/order/return");
|
||||||
|
client.Timeout = -1;
|
||||||
|
var request = new RestRequest(Method.POST);
|
||||||
|
request.AddHeader("Content-Type", "application/json");
|
||||||
|
request.AddParameter("application/json", requestString, ParameterType.RequestBody);
|
||||||
|
IRestResponse response = client.Execute(request);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var resultString = string.Empty;
|
||||||
|
LogHelper.Info(resultString);
|
||||||
|
return resultString;
|
||||||
}
|
}
|
||||||
|
|
||||||
private string PushKingdeeSaleOrder(PushKingDeeOrder pushKingdeeOrder)
|
private string PushKingdeeSaleOrder(PushKingDeeOrder pushKingdeeOrder)
|
||||||
@@ -206,7 +255,7 @@ namespace MyCode.Project.Services.Implementation
|
|||||||
FNUMBER = pushKingdeeOrder.TradeType == 8 ? "XSDD05_SYS" : "XSDD01_SYS"
|
FNUMBER = pushKingdeeOrder.TradeType == 8 ? "XSDD05_SYS" : "XSDD01_SYS"
|
||||||
},
|
},
|
||||||
FOrdertype = pushKingdeeOrder.TradeType == 8 ? "8" : "4",
|
FOrdertype = pushKingdeeOrder.TradeType == 8 ? "8" : "4",
|
||||||
FDate = pushKingdeeOrder.CreateTime?.ToString("yyyy/MM/dd"),
|
FDate = pushKingdeeOrder.ConsignTime?.ToString("yyyy/MM/dd"),
|
||||||
FSaleOrgId = new FSaleOrgId()
|
FSaleOrgId = new FSaleOrgId()
|
||||||
{
|
{
|
||||||
FNumber = "" // 固定组织
|
FNumber = "" // 固定组织
|
||||||
|
|||||||
@@ -74,6 +74,9 @@
|
|||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
<HintPath>..\Lib\Newtonsoft.Json.dll</HintPath>
|
<HintPath>..\Lib\Newtonsoft.Json.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
<Reference Include="RestSharp, Version=106.11.4.0, Culture=neutral, PublicKeyToken=598062e77f915f75, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\RestSharp.106.11.4\lib\net452\RestSharp.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
<Reference Include="System.ComponentModel.DataAnnotations" />
|
<Reference Include="System.ComponentModel.DataAnnotations" />
|
||||||
<Reference Include="System.Data.DataSetExtensions" />
|
<Reference Include="System.Data.DataSetExtensions" />
|
||||||
<Reference Include="System.IO.Compression" />
|
<Reference Include="System.IO.Compression" />
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
<package id="AutoMapper" version="6.1.1" targetFramework="net45" />
|
<package id="AutoMapper" version="6.1.1" targetFramework="net45" />
|
||||||
<package id="log4net" version="2.0.8" targetFramework="net45" />
|
<package id="log4net" version="2.0.8" targetFramework="net45" />
|
||||||
<package id="MiniExcel" version="1.30.0" targetFramework="net461" />
|
<package id="MiniExcel" version="1.30.0" targetFramework="net461" />
|
||||||
|
<package id="RestSharp" version="106.11.4" targetFramework="net48" />
|
||||||
<package id="Senparc.CO2NET" version="0.4.1" targetFramework="net461" />
|
<package id="Senparc.CO2NET" version="0.4.1" targetFramework="net461" />
|
||||||
<package id="Senparc.CO2NET.APM" version="0.2.0" targetFramework="net461" />
|
<package id="Senparc.CO2NET.APM" version="0.2.0" targetFramework="net461" />
|
||||||
<package id="Senparc.NeuChar" version="0.5.0" targetFramework="net461" />
|
<package id="Senparc.NeuChar" version="0.5.0" targetFramework="net461" />
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<?xml version="1.0"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<!--
|
<!--
|
||||||
For more information on how to configure your ASP.NET application, please visit
|
For more information on how to configure your ASP.NET application, please visit
|
||||||
https://go.microsoft.com/fwlink/?LinkId=301879
|
https://go.microsoft.com/fwlink/?LinkId=301879
|
||||||
|
|||||||
Reference in New Issue
Block a user