Merge branch 'BaoMaKu' of http://8.130.121.29:3000/Develop/YunTongJackYunTask into BaoMaKu
This commit is contained in:
commit
a8c6c37db1
@ -1,4 +1,5 @@
|
|||||||
using System;
|
using MyCode.Project.Domain.Model;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
@ -6,97 +7,10 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace MyCode.Project.Domain.Message.Response.JackYun
|
namespace MyCode.Project.Domain.Message.Response.JackYun
|
||||||
{
|
{
|
||||||
public class BusiOrderGoodsDocInSummary
|
public class BusiOrderGoodsDocInSummary: PushKingDeeGoodsDocIn
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// 出入库日期
|
|
||||||
/// </summary>
|
|
||||||
public DateTime InOutDate2 { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 仓库编码
|
|
||||||
/// </summary>
|
|
||||||
public string WarehouseCode { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 仓库名称
|
|
||||||
/// </summary>
|
|
||||||
public string WarehouseName { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 商品编码
|
|
||||||
/// </summary>
|
|
||||||
public string GoodsNo { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 商品名称
|
|
||||||
/// </summary>
|
|
||||||
public string GoodsName { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 规格
|
|
||||||
/// </summary>
|
|
||||||
public string SkuName { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 单位
|
|
||||||
/// </summary>
|
|
||||||
public string UnitName { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 条码
|
|
||||||
/// </summary>
|
|
||||||
public string SkuBarcode { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 总数量
|
|
||||||
/// </summary>
|
|
||||||
public decimal Quantity { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 总入库金额
|
|
||||||
/// </summary>
|
|
||||||
public decimal BaceCurrencyCostAmount { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 总本币无税金额
|
|
||||||
/// </summary>
|
|
||||||
public decimal BaceCurrencyNoTaxAmount { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 总本币含税金额
|
|
||||||
/// </summary>
|
|
||||||
public decimal BaceCurrencyWithTaxAmount { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 总本币税额
|
|
||||||
/// </summary>
|
|
||||||
public decimal BaceCurrencyTaxAmount { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 总原币无税金额
|
|
||||||
/// </summary>
|
|
||||||
public decimal TransNoTaxAmount { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 总原币含税金额
|
|
||||||
/// </summary>
|
|
||||||
public decimal TransHasTaxAmount { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 总原币税额
|
|
||||||
/// </summary>
|
|
||||||
public decimal TransTaxAmount { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 入库单数
|
|
||||||
/// </summary>
|
|
||||||
public int OrderCount { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 明细行数
|
|
||||||
/// </summary>
|
|
||||||
public int DetailCount { get; set; }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -31,7 +31,7 @@ namespace MyCode.Project.Domain.Message.Response.JackYun
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 出库时间
|
/// 出库时间
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string InOutDate { get; set; }
|
public DateTime InOutDate { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 创建时间
|
/// 创建时间
|
||||||
|
|||||||
@ -541,5 +541,12 @@ namespace MyCode.Project.Domain.Model
|
|||||||
[SugarColumn(IsPrimaryKey=true)]
|
[SugarColumn(IsPrimaryKey=true)]
|
||||||
public Guid Id {get;set;}
|
public Guid Id {get;set;}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Desc:0=未处理 1=已合并 2=已推送
|
||||||
|
/// Default:0
|
||||||
|
/// Nullable:True
|
||||||
|
/// </summary>
|
||||||
|
public int? Status {get;set;}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -245,13 +245,5 @@ namespace MyCode.Project.Domain.Model
|
|||||||
[SugarColumn(ColumnName="F_PURCHASINGWAREHOUSECODE")]
|
[SugarColumn(ColumnName="F_PURCHASINGWAREHOUSECODE")]
|
||||||
public string FPURCHASINGWAREHOUSECODE {get;set;}
|
public string FPURCHASINGWAREHOUSECODE {get;set;}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Desc:采购组织ID
|
|
||||||
/// Default:
|
|
||||||
/// Nullable:True
|
|
||||||
/// </summary>
|
|
||||||
[SugarColumn(ColumnName="F_PURCHASEORGID")]
|
|
||||||
public int? FPURCHASEORGID {get;set;}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,11 +8,17 @@ using MyCode.Project.Domain;
|
|||||||
using MyCode.Project.Domain.Model;
|
using MyCode.Project.Domain.Model;
|
||||||
using MyCode.Project.Infrastructure.Common;
|
using MyCode.Project.Infrastructure.Common;
|
||||||
using MyCode.Project.Domain.Message;
|
using MyCode.Project.Domain.Message;
|
||||||
|
using MyCode.Project.Domain.Message.Response.JackYun;
|
||||||
|
|
||||||
namespace MyCode.Project.Domain.Repositories
|
namespace MyCode.Project.Domain.Repositories
|
||||||
{
|
{
|
||||||
public interface IBusiOrderGoodsDocInRepository : IRepository<BusiOrderGoodsDocIn>
|
public interface IBusiOrderGoodsDocInRepository : IRepository<BusiOrderGoodsDocIn>
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 获取合并后的吉客云采购入库单订单
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
List<BusiOrderGoodsDocInSummary> GetPushGoodsDocInOrder();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -19,68 +19,107 @@ namespace MyCode.Project.Repositories
|
|||||||
{ }
|
{ }
|
||||||
|
|
||||||
|
|
||||||
// SELECT
|
// SELECT
|
||||||
// -- 分组字段
|
// -- 分组字段
|
||||||
// CONVERT(date, InOutDate2) AS 出入库日期,
|
// CONVERT(date, InOutDate2) AS 出入库日期,
|
||||||
// WarehouseCode AS 仓库编码,
|
// WarehouseCode AS 仓库编码,
|
||||||
// WarehouseName AS 仓库名称,
|
// WarehouseName AS 仓库名称,
|
||||||
// GoodsNo AS 商品编码,
|
// GoodsNo AS 商品编码,
|
||||||
// GoodsName AS 商品名称,
|
// GoodsName AS 商品名称,
|
||||||
// SkuName AS 规格,
|
// SkuName AS 规格,
|
||||||
// UnitName AS 单位,
|
// UnitName AS 单位,
|
||||||
|
|
||||||
// -- 合计数据
|
// -- 合计数据
|
||||||
// SUM(Quantity) AS 总数量,
|
// SUM(Quantity) AS 总数量,
|
||||||
// SUM(BaceCurrencyCostAmount) AS 总入库金额,
|
// SUM(BaceCurrencyCostAmount) AS 总入库金额,
|
||||||
// SUM(BaceCurrencyNoTaxAmount) AS 总本币无税金额,
|
// SUM(BaceCurrencyNoTaxAmount) AS 总本币无税金额,
|
||||||
// SUM(BaceCurrencyWithTaxAmount) AS 总本币含税金额,
|
// SUM(BaceCurrencyWithTaxAmount) AS 总本币含税金额,
|
||||||
// SUM(BaceCurrencyTaxAmount) AS 总本币税额,
|
// SUM(BaceCurrencyTaxAmount) AS 总本币税额,
|
||||||
// SUM(TransNoTaxAmount) AS 总原币无税金额,
|
// SUM(TransNoTaxAmount) AS 总原币无税金额,
|
||||||
// SUM(TransHasTaxAmount) AS 总原币含税金额,
|
// SUM(TransHasTaxAmount) AS 总原币含税金额,
|
||||||
// SUM(TransTaxAmount) AS 总原币税额,
|
// SUM(TransTaxAmount) AS 总原币税额,
|
||||||
|
|
||||||
// -- 计数统计
|
// -- 计数统计
|
||||||
// COUNT(DISTINCT GoodsdocNo) AS 入库单数,
|
// COUNT(DISTINCT GoodsdocNo) AS 入库单数,
|
||||||
// COUNT(*) AS 明细行数
|
// COUNT(*) AS 明细行数
|
||||||
|
|
||||||
|
|
||||||
//FROM[dbo].[BusiOrderGoodsDocIn]
|
//FROM[dbo].[BusiOrderGoodsDocIn]
|
||||||
// WHERE Status IN(0) -- 根据业务需求调整状态筛选
|
// WHERE Status IN(0) -- 根据业务需求调整状态筛选
|
||||||
// GROUP BY
|
// GROUP BY
|
||||||
// CONVERT(date, InOutDate2),
|
// CONVERT(date, InOutDate2),
|
||||||
// WarehouseCode,
|
// WarehouseCode,
|
||||||
// WarehouseName,
|
// WarehouseName,
|
||||||
// GoodsNo,
|
// GoodsNo,
|
||||||
// GoodsName,
|
// GoodsName,
|
||||||
// SkuName,
|
// SkuName,
|
||||||
// UnitName
|
// UnitName
|
||||||
//ORDER BY
|
//ORDER BY
|
||||||
// CONVERT(date, InOutDate2) DESC,
|
// CONVERT(date, InOutDate2) DESC,
|
||||||
// WarehouseCode,
|
// WarehouseCode,
|
||||||
// GoodsNo;
|
// GoodsNo;
|
||||||
|
|
||||||
#region GetPushOrder(获取合并后的吉客云订单)
|
#region GetPushGoodsDocInOrder(获取合并后的吉客云采购入库单订单)
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取合并后的吉客云订单
|
/// 获取合并后的吉客云采购入库单订单
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public List<PushOrderListResp> GetPushReturnOrder()
|
public List<BusiOrderGoodsDocInSummary> GetPushGoodsDocInOrder()
|
||||||
{
|
{
|
||||||
string sql = $@"
|
string sql = $@"
|
||||||
SELECT [shopCode], [shopName], [shopId], [warehouseName], [warehouseCode],
|
SELECT
|
||||||
[status], CONVERT(NVARCHAR(30),[consignTime],23) [consignTime],
|
-- 分组字段
|
||||||
[goodsNo], [goodsId],SUM([sellTotal]*-1) [sellTotal],
|
CONVERT(date, InOutDate2) AS InOutDate2,
|
||||||
SUM([returnCount]*-1) [sellCount], SUM([ShareShouldReturnFee]*-1) AS [divideSellTotal],
|
WarehouseCode AS WarehouseCode,
|
||||||
[barcode], [TradeType] ,[warehouseId],Unit
|
WarehouseName AS WarehouseName,
|
||||||
FROM [JackOrders] a WITH (NOLOCK)
|
GoodsNo AS GoodsNo,
|
||||||
LEFT JOIN [dbo].[ReturnChangeGoodsDetail] b WITH (NOLOCK)
|
GoodsName AS GoodsName,
|
||||||
ON a.id = b.JackOrdersId
|
SkuName AS SkuName,
|
||||||
WHERE a.status = 0 and [TradeType]=8 and returnCount <> 0
|
UnitName AS UnitName,
|
||||||
GROUP BY [shopCode],[shopName], [shopId], [warehouseName], [warehouseCode], [status], CONVERT(NVARCHAR(30),[consignTime],23) ,[goodsNo],
|
SkuBarcode AS SkuBarcode,
|
||||||
[goodsId], [barcode] ,[warehouseId], [TradeType],Unit
|
[CurrencyCode]
|
||||||
ORDER BY [shopCode],[consignTime] desc,[TradeType]
|
,[CurrencyCodeName]
|
||||||
";
|
,[CurrencyRate]
|
||||||
var list = this.SelectList<PushOrderListResp>(sql);
|
,[CreateUserName]
|
||||||
|
,[CompanyName],VendCustomerName,VendCode ,[ApplyCompanyName],
|
||||||
|
[TaxRate]
|
||||||
|
,[TransNoTaxPrice]
|
||||||
|
,[TransHasTaxPrice],
|
||||||
|
-- 合计数据
|
||||||
|
SUM(Quantity) AS Quantity ,-- 总数量,
|
||||||
|
SUM(BaceCurrencyCostAmount) AS BaceCurrencyCostAmount,--总入库金额,
|
||||||
|
SUM(BaceCurrencyNoTaxAmount) AS BaceCurrencyNoTaxAmount,--总本币无税金额,
|
||||||
|
SUM(BaceCurrencyWithTaxAmount) AS BaceCurrencyWithTaxAmount,--总本币含税金额,
|
||||||
|
SUM(BaceCurrencyTaxAmount) AS BaceCurrencyTaxAmount,-- 总本币税额,
|
||||||
|
SUM(TransNoTaxAmount) AS TransNoTaxAmount,--总原币无税金额,
|
||||||
|
SUM(TransHasTaxAmount) AS TransHasTaxAmount,--总原币含税金额,
|
||||||
|
SUM(TransTaxAmount) AS TransTaxAmount,--总原币税额,
|
||||||
|
|
||||||
|
-- 计数统计
|
||||||
|
COUNT(DISTINCT GoodsdocNo) AS 入库单数,
|
||||||
|
COUNT(*) AS 明细行数
|
||||||
|
|
||||||
|
FROM [dbo].[BusiOrderGoodsDocIn]
|
||||||
|
WHERE Status IN (0) -- 根据业务需求调整状态筛选
|
||||||
|
GROUP BY
|
||||||
|
CONVERT(DATE, InOutDate2),
|
||||||
|
WarehouseCode,
|
||||||
|
WarehouseName,
|
||||||
|
GoodsNo,
|
||||||
|
GoodsName,
|
||||||
|
SkuName,
|
||||||
|
UnitName,SkuBarcode ,[CurrencyCode]
|
||||||
|
,[CurrencyCodeName]
|
||||||
|
,[CurrencyRate]
|
||||||
|
,[CreateUserName]
|
||||||
|
,[CompanyName],CompanyName,VendCustomerName,VendCode ,[ApplyCompanyName], [TaxRate]
|
||||||
|
,[TransNoTaxPrice]
|
||||||
|
,[TransHasTaxPrice]
|
||||||
|
ORDER BY
|
||||||
|
CONVERT(date, InOutDate2) DESC,
|
||||||
|
WarehouseCode,
|
||||||
|
GoodsNo;";
|
||||||
|
var list = this.SelectList<BusiOrderGoodsDocInSummary>(sql);
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@ -41,7 +41,7 @@ namespace MyCode.Project.Services
|
|||||||
List<BusiOrderGoodsDocInResponse> GetPurchaseInboundData(DateTime now);
|
List<BusiOrderGoodsDocInResponse> GetPurchaseInboundData(DateTime now);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取吉客云采购出库单
|
/// 获取吉客云采购退货出库单
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="now">截止日期</param>
|
/// <param name="now">截止日期</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
|
|||||||
@ -52,7 +52,12 @@ namespace MyCode.Project.Services
|
|||||||
/// <param name="now"></param>
|
/// <param name="now"></param>
|
||||||
void GetStorageGoodsDocOutV2(string now);
|
void GetStorageGoodsDocOutV2(string now);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 合并吉客云采购订单到新表
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
|
||||||
|
string GetAndMergePushGoodsDocInOrder(string now);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -21,7 +21,7 @@ namespace MyCode.Project.Services.Implementation
|
|||||||
_yTKJTShopParameterRepository = yTKJTShopParameterRepository;
|
_yTKJTShopParameterRepository = yTKJTShopParameterRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
DateTime startTime = DateTime.Parse("2025-08-01");
|
DateTime startTime = DateTime.Parse("2025-10-01");
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 请求开放平台服务
|
/// 请求开放平台服务
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -277,8 +277,6 @@ namespace MyCode.Project.Services.Implementation
|
|||||||
/// <exception cref="BaseException"></exception>
|
/// <exception cref="BaseException"></exception>
|
||||||
public List<BusiOrderGoodsDocInResponse> GetPurchaseInboundData(DateTime now)
|
public List<BusiOrderGoodsDocInResponse> GetPurchaseInboundData(DateTime now)
|
||||||
{
|
{
|
||||||
|
|
||||||
int total = 1;
|
|
||||||
var shopConfigs = _yTKJTShopParameterRepository.Queryable().Where(t => t.FDOCUMENTSTATUS == "C" && t.FPURCHASERECEIVING == "1").ToList();
|
var shopConfigs = _yTKJTShopParameterRepository.Queryable().Where(t => t.FDOCUMENTSTATUS == "C" && t.FPURCHASERECEIVING == "1").ToList();
|
||||||
|
|
||||||
BusiOrderGoodsDocInRequest requestBizData = new BusiOrderGoodsDocInRequest();
|
BusiOrderGoodsDocInRequest requestBizData = new BusiOrderGoodsDocInRequest();
|
||||||
@ -347,16 +345,22 @@ namespace MyCode.Project.Services.Implementation
|
|||||||
throw new BaseException(msg);
|
throw new BaseException(msg);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
//var shocodes = shopConfigs.Select(t => t.FPURCHASINGWAREHOUSECODE).ToList();
|
var warehouseCodes = shopConfigs.Select(t => t.FPURCHASINGWAREHOUSECODE).Distinct().ToList();
|
||||||
//trades = trades.Where(t => shocodes.Contains(t.warehouseCode)).ToList();
|
var guolv = shopConfigs.Select(t => new { t.FPURCHASINGWAREHOUSECODE, t.FPURCHASEDATE }).ToList();
|
||||||
|
trades = trades.Where(t => warehouseCodes.Contains(t.warehouseCode)).ToList();
|
||||||
|
foreach (var item in guolv)
|
||||||
|
{
|
||||||
|
trades.RemoveAll(t => item.FPURCHASINGWAREHOUSECODE == t.warehouseCode && item.FPURCHASEDATE > t.inOutDate2);
|
||||||
|
}
|
||||||
|
|
||||||
return trades;
|
return trades;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
#region 获取吉客云采购出库单
|
#region 获取吉客云采购退货出库单
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取吉客云采购出库单
|
/// 获取吉客云采购退货出库单
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="now">截止日期</param>
|
/// <param name="now">截止日期</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
@ -381,7 +385,9 @@ namespace MyCode.Project.Services.Implementation
|
|||||||
|
|
||||||
requestBizData.PageSize = 200;
|
requestBizData.PageSize = 200;
|
||||||
requestBizData.PageIndex = 0;
|
requestBizData.PageIndex = 0;
|
||||||
requestBizData.SelelctFields = "*"; //"RecId,GoodsdocNo,BillNo,InOutDate,GmtCreate,Inouttype,InouttypeName,VendCustomerName,CurrencyCode,CurrencyRate,UserName,WarehouseCode,WarehouseName,Comment,Memo,LogisticName,LogisticNo,CompanyId,CompanyName,LogisticType,LogisticCode,InOutReason,SourceBillNo,ChannelId,ChannelCode,ChannelName,RedStatus,Field1,Field2,Field3,Field4,Field5,FinanceBillStatus,VendCustomerId,ApplyDepartId,ApplyDepartName,OutBillNo,LogisticList,GmtModified,DepartCode,ApplyCompanyName,ApplyCompanyCode,ApplyCompanyId,ApplyUserId,ApplyUserName,CompanyCode,GoodsDocDetailList,SendCompanyName,Send,SendTel,SendPhone,SendEmail,SendCountryName,SendProvinceName,SendCityName,SendTownName,SendStreetName,SendAddress,ReceiveCompanyName,Receive,ReceiveTel,ReceivePhone,ReceiveEmail,ReceiveCountryName,ReceiveProvinceName,ReceiveCityName,ReceiveTownName,ReceiveStreetName,ReceiveAddress";
|
requestBizData.SelelctFields = "recId,goodsdocNo,billNo,inOutDate,gmtCreate,inouttype,inouttypeName,vendCustomerName,currencyCode,currencyRate,userName,warehouseCode,warehouseName,comment,memo,logisticName,logisticNo,companyId,companyName,logisticType,logisticCode,inOutReason,sourceBillNo,channelId,channelCode,channelName,redStatus,field1,field2,field3,field4,field5,financeBillStatus,vendCustomerId,applyDepartId,applyDepartName,outBillNo,logisticList,gmtModified,departCode,applyCompanyName,applyCompanyCode,applyCompanyId,applyUserId,applyUserName,companyCode,goodsDocDetailList,sendCompanyName,send,sendTel,sendPhone,sendEmail,sendCountryName,sendProvinceName,sendCityName,sendTownName,sendStreetName,sendAddress,receiveCompanyName,receive,receiveTel,receivePhone,receiveEmail,receiveCountryName,receiveProvinceName,receiveCityName,receiveTownName,receiveStreetName,receiveAddress" +
|
||||||
|
",goodsDocDetailList.recId,goodsDocDetailList.goodsId,goodsDocDetailList.goodsNo,goodsDocDetailList.goodsName,goodsDocDetailList.skuId,goodsDocDetailList.skuName,goodsDocDetailList.skuBarcode,goodsDocDetailList.unitName,goodsDocDetailList.cuPrice,goodsDocDetailList.cuValue,goodsDocDetailList.caseNumber,goodsDocDetailList.rowRemark,goodsDocDetailList.assistUnit,goodsDocDetailList.estCost,goodsDocDetailList.estTax,goodsDocDetailList.estPrice,goodsDocDetailList.estPriceNoTax,goodsDocDetailList.estCostNoTax,goodsDocDetailList.taxRate,goodsDocDetailList.batchNo,goodsDocDetailList.serialNo,goodsDocDetailList.productionDate,goodsDocDetailList.expirationDate,goodsDocDetailList.shelfLife,goodsDocDetailList.shelfLiftUnit,goodsDocDetailList.sourceDetailId,goodsDocDetailList.transNoTaxPrice,goodsDocDetailList.transNoTaxAmount,goodsDocDetailList.transHasTaxPrice,goodsDocDetailList.transHasTaxAmount" +
|
||||||
|
",goodsDocDetailList.transTaxAmount,goodsDocDetailList.detailField1,goodsDocDetailList.detailField2,goodsDocDetailList.detailField3,goodsDocDetailList.detailField4,goodsDocDetailList.detailField5,goodsDocDetailList.isCertified,goodsDocDetailList.registrationNumber,goodsDocDetailList.approvalDate,goodsDocDetailList.productionDepart,goodsDocDetailList.batchNumber,goodsDocDetailList.quantity,goodsDocDetailList.cateId,goodsDocDetailList.cateName,goodsDocDetailList.volume,goodsDocDetailList.skuWeight";
|
||||||
|
|
||||||
|
|
||||||
List<int> TradeTypeList = new List<int>();
|
List<int> TradeTypeList = new List<int>();
|
||||||
@ -395,7 +401,7 @@ namespace MyCode.Project.Services.Implementation
|
|||||||
LogHelper.Info(lggl);
|
LogHelper.Info(lggl);
|
||||||
JackyunResponse response = Call(EnumAttribute.GetAttribute(ApiEnum.ERPSTORAGEGOODSDOCOUTV2).Value, "1.0", requestBizData);
|
JackyunResponse response = Call(EnumAttribute.GetAttribute(ApiEnum.ERPSTORAGEGOODSDOCOUTV2).Value, "1.0", requestBizData);
|
||||||
string ll = JsonHelper.ToJson(response);
|
string ll = JsonHelper.ToJson(response);
|
||||||
LogHelper.Info(ll);
|
LogHelper.Info("采购退货单: "+ll);
|
||||||
|
|
||||||
if (response.code == "200")
|
if (response.code == "200")
|
||||||
{
|
{
|
||||||
@ -429,45 +435,14 @@ namespace MyCode.Project.Services.Implementation
|
|||||||
throw new BaseException(msg);
|
throw new BaseException(msg);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
//var shocodes = shopConfigs.Select(t => t.FSHOPCODE).ToList();
|
|
||||||
//trades = trades.Where(t => shocodes.Contains(t.ShopCode)).ToList();
|
|
||||||
////reslut = trades.Select(t => new TradesItem { tradeId = t.TradeId, couponFee = 0, realFee = 0, shopCode = t.ShopCode ,orderNo=t.ReturnChangeNo, tradeNo =t.TradeNo
|
|
||||||
////,isDelete=0, mainPostid=t.MainPostid,
|
|
||||||
//// companyName=t.CompanyName,
|
|
||||||
//// flagNames=t.FlagNames,
|
|
||||||
//// shopName=t.ShopName,
|
|
||||||
//// warehouseName=t.WarehouseName
|
|
||||||
////}).ToList();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//reslut = trades.Select(rc => new TradesItem
|
|
||||||
//{
|
|
||||||
// tradeId = rc.TradeAfterId.ToString(),
|
|
||||||
// couponFee = 0,
|
|
||||||
// realFee = 0,
|
|
||||||
// shopCode = rc.ShopCode,
|
|
||||||
// orderNo = rc.ReturnChangeNo,
|
|
||||||
// tradeNo = rc.TradeNo,
|
|
||||||
// isDelete = 0,
|
|
||||||
// mainPostid = rc.MainPostid,
|
|
||||||
// companyName = rc.CompanyName,
|
|
||||||
// flagNames = rc.FlagNames,
|
|
||||||
// shopName = rc.ShopName,
|
|
||||||
// warehouseName = rc.WarehouseName,
|
|
||||||
// warehouseCode = rc.WarehouseCode,
|
|
||||||
// logisticName = rc.LogisticName,
|
|
||||||
// shopId = rc.ShopId.ToString(),
|
|
||||||
// TradeType = 8, // 假设这是售后退货类型
|
|
||||||
// consignTime = !string.IsNullOrWhiteSpace(rc.DeliveryTime) ? (DateTime?)DateTime.Parse(rc.DeliveryTime) : null,
|
|
||||||
// payTime = null, // 可根据需要设置
|
|
||||||
// tradeStatus = int.Parse(rc.TradeAfterStatus), // 注意类型转换
|
|
||||||
// warehouseId = rc.WarehouseId.ToString(),
|
|
||||||
// shopTypeCode = "",
|
|
||||||
// apiType = -114, // 默认值
|
|
||||||
// ReturnChangeGoodsDetail = rc.ReturnChangeGoodsDetail
|
|
||||||
//}).ToList();
|
|
||||||
|
|
||||||
|
var warehouseCodes = shopConfigs.Select(t => t.FPURCHASINGWAREHOUSECODE).Distinct().ToList();
|
||||||
|
var guolv = shopConfigs.Select(t => new { t.FPURCHASINGWAREHOUSECODE, t.FPURCHASEDATE }).ToList();
|
||||||
|
trades = trades.Where(t => warehouseCodes.Contains(t.WarehouseCode)).ToList();
|
||||||
|
foreach (var item in guolv)
|
||||||
|
{
|
||||||
|
trades.RemoveAll(t => item.FPURCHASINGWAREHOUSECODE == t.WarehouseCode && item.FPURCHASEDATE > t.InOutDate);
|
||||||
|
}
|
||||||
|
|
||||||
return trades;
|
return trades;
|
||||||
|
|
||||||
|
|||||||
@ -23,6 +23,9 @@ namespace MyCode.Project.Services.Implementation
|
|||||||
private IYTKJTShopParameterRepository _yTKJTShopParameterRepository;
|
private IYTKJTShopParameterRepository _yTKJTShopParameterRepository;
|
||||||
private IReturnChangeGoodsDetailRepository _ReturnChangeGoodsDetailRepository;
|
private IReturnChangeGoodsDetailRepository _ReturnChangeGoodsDetailRepository;
|
||||||
private IBusiOrderGoodsDocInRepository _busiOrderGoodsDocInRepository;
|
private IBusiOrderGoodsDocInRepository _busiOrderGoodsDocInRepository;
|
||||||
|
private IPushKingDeeGoodsDocInRepository _PushKingDeeGoodsDocInRepository;
|
||||||
|
private IStorageGoodsDocOutHeadRepository _storageGoodsDocOutHeadRepository;
|
||||||
|
private IStorageGoodsDocOutDetailRepository _storageGoodsDocOutDetailRepository;
|
||||||
|
|
||||||
private IWorkProcessService _workProcessService;
|
private IWorkProcessService _workProcessService;
|
||||||
|
|
||||||
@ -33,6 +36,9 @@ namespace MyCode.Project.Services.Implementation
|
|||||||
, IYTKJTShopParameterRepository yTKJTShopParameterRepository
|
, IYTKJTShopParameterRepository yTKJTShopParameterRepository
|
||||||
, IReturnChangeGoodsDetailRepository returnChangeGoodsDetailRepository
|
, IReturnChangeGoodsDetailRepository returnChangeGoodsDetailRepository
|
||||||
, IBusiOrderGoodsDocInRepository busiOrderGoodsDocInRepository
|
, IBusiOrderGoodsDocInRepository busiOrderGoodsDocInRepository
|
||||||
|
, IPushKingDeeGoodsDocInRepository pushKingDeeGoodsDocInRepository
|
||||||
|
, IStorageGoodsDocOutDetailRepository storageGoodsDocOutDetailRepository
|
||||||
|
, IStorageGoodsDocOutHeadRepository storageGoodsDocOutHeadRepository
|
||||||
, IJackYunService jackYunService,
|
, IJackYunService jackYunService,
|
||||||
IWorkProcessService workProcessService)
|
IWorkProcessService workProcessService)
|
||||||
{
|
{
|
||||||
@ -43,7 +49,9 @@ namespace MyCode.Project.Services.Implementation
|
|||||||
_jackOrdersItemRepository = jackOrdersItemRepository;
|
_jackOrdersItemRepository = jackOrdersItemRepository;
|
||||||
_ReturnChangeGoodsDetailRepository = returnChangeGoodsDetailRepository;
|
_ReturnChangeGoodsDetailRepository = returnChangeGoodsDetailRepository;
|
||||||
_busiOrderGoodsDocInRepository = busiOrderGoodsDocInRepository;
|
_busiOrderGoodsDocInRepository = busiOrderGoodsDocInRepository;
|
||||||
|
_PushKingDeeGoodsDocInRepository = pushKingDeeGoodsDocInRepository;
|
||||||
|
_storageGoodsDocOutHeadRepository = storageGoodsDocOutHeadRepository;
|
||||||
|
_storageGoodsDocOutDetailRepository = storageGoodsDocOutDetailRepository;
|
||||||
_jackYunService = jackYunService;
|
_jackYunService = jackYunService;
|
||||||
_workProcessService = workProcessService;
|
_workProcessService = workProcessService;
|
||||||
}
|
}
|
||||||
@ -335,7 +343,7 @@ namespace MyCode.Project.Services.Implementation
|
|||||||
DateTime runTime = DateTime.Parse(now);
|
DateTime runTime = DateTime.Parse(now);
|
||||||
var list = _jackYunService.GetPurchaseInboundData(runTime);
|
var list = _jackYunService.GetPurchaseInboundData(runTime);
|
||||||
SetPurchaseInboundData(list);
|
SetPurchaseInboundData(list);
|
||||||
//_workProcessService.Add<IJackYunTaskService>(this.MerchantId, "GetAndMergeJackReturnYunOrder", "合并吉客云退货订单到新表", now, 1);
|
//_workProcessService.Add<IJackYunTaskService>(this.MerchantId, "GetAndMergePushGoodsDocInOrder", "合并吉客云采购订单到新表", now, 1);
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@ -376,20 +384,124 @@ namespace MyCode.Project.Services.Implementation
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
#region GetStorageGoodsDocOutV2(调度运行吉客云采购出库单)
|
#region GetStorageGoodsDocOutV2(调度运行吉客云采购退货出库单)
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 调度运行吉客云采购出库单
|
/// 调度运行吉客云采购退货出库单
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="now"></param>
|
/// <param name="now"></param>
|
||||||
public void GetStorageGoodsDocOutV2(string now)
|
public void GetStorageGoodsDocOutV2(string now)
|
||||||
{
|
{
|
||||||
DateTime runTime = DateTime.Parse(now);
|
DateTime runTime = DateTime.Parse(now);
|
||||||
var list = _jackYunService.GetStorageGoodsDocOutV2(runTime);
|
var list = _jackYunService.GetStorageGoodsDocOutV2(runTime);
|
||||||
//SetPurchaseInboundData(list);
|
SetStorageGoodsDocOutV2Order(list);
|
||||||
//_workProcessService.Add<IJackYunTaskService>(this.MerchantId, "GetAndMergeJackReturnYunOrder", "合并吉客云退货订单到新表", now, 1);
|
//_workProcessService.Add<IJackYunTaskService>(this.MerchantId, "GetAndMergeJackReturnYunOrder", "合并吉客云退货订单到新表", now, 1);
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region GetAndMergeJackGoodsDocInOrder(合并吉客云采购订单到新表)
|
||||||
|
/// <summary>
|
||||||
|
/// 合并吉客云采购订单到新表
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[TransactionCallHandler]
|
||||||
|
public string GetAndMergePushGoodsDocInOrder(string now)
|
||||||
|
{
|
||||||
|
var list = _busiOrderGoodsDocInRepository.GetPushGoodsDocInOrder();
|
||||||
|
List<string> mesg = new List<string>();
|
||||||
|
|
||||||
|
//var shopParemList = _yTKJTShopParameterRepository.Queryable().Where(t => t.FDOCUMENTSTATUS == "C" && t.FPURCHASERECEIVING=="1").ToList();
|
||||||
|
List<PushKingDeeGoodsDocIn> pushKingDeeOrders = new List<PushKingDeeGoodsDocIn>();
|
||||||
|
//var warehouseCodes = shopParemList.Select(t => t.FPURCHASINGWAREHOUSECODE).Distinct().ToList();
|
||||||
|
//list = list.Where(t => warehouseCodes.Contains(t.WarehouseCode)).ToList();
|
||||||
|
list.ForEach(sheet =>
|
||||||
|
{
|
||||||
|
|
||||||
|
PushKingDeeGoodsDocIn pushKingDeeOrder = new PushKingDeeGoodsDocIn();
|
||||||
|
pushKingDeeOrder = AutoMapperHelper.AutoMappToSingle<PushKingDeeGoodsDocIn, BusiOrderGoodsDocInSummary>(sheet);
|
||||||
|
pushKingDeeOrder.ID = Guid.NewGuid();
|
||||||
|
pushKingDeeOrder.CreateTime = DateTime.Now;
|
||||||
|
pushKingDeeOrder.UpdateTime = DateTime.Now;
|
||||||
|
pushKingDeeOrder.Status = 0;
|
||||||
|
pushKingDeeOrders.Add(pushKingDeeOrder);
|
||||||
|
|
||||||
|
});
|
||||||
|
if (pushKingDeeOrders.Count > 0)
|
||||||
|
{
|
||||||
|
var oldList = _busiOrderGoodsDocInRepository.Queryable().Where(t => t.Status == 0).ToList();
|
||||||
|
oldList.ForEach(t =>
|
||||||
|
{
|
||||||
|
if (pushKingDeeOrders.Count(h => h.WarehouseCode == t.WarehouseCode && t.InOutDate2.Value.ToString("yyyy-MM-dd") == h.InOutDate2.Value.ToString("yyyy-MM-dd")) > 0)
|
||||||
|
{
|
||||||
|
t.Status = 1;
|
||||||
|
t.UpdateTime = DateTime.Now;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
oldList = oldList.Where(t => t.Status == 1).ToList();
|
||||||
|
_busiOrderGoodsDocInRepository.Update(oldList);
|
||||||
|
_PushKingDeeGoodsDocInRepository.Add(pushKingDeeOrders);
|
||||||
|
|
||||||
|
}
|
||||||
|
//pushKingDeeOrders.ForEach(t =>
|
||||||
|
//{
|
||||||
|
// _workProcessService.Add<IOrderPushService>(this.MerchantId, "PushOrderToKingDee", "推送退货订单到云星空或者WMS", t.Id, 1);
|
||||||
|
// Thread.Sleep(300);
|
||||||
|
//});
|
||||||
|
|
||||||
|
return JsonHelper.ToJson(list);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region SetReturnOrder(把吉客云退货订单存进本地数据库)
|
||||||
|
/// <summarySetStorageGoodsDocOutV2Order
|
||||||
|
/// 把吉客云退货订单存进本地数据库
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="trades"></param>
|
||||||
|
[TransactionCallHandler]
|
||||||
|
public void SetStorageGoodsDocOutV2Order(List<ErpStorageGoodsDocOutV2ResponseBizData> trades)
|
||||||
|
{
|
||||||
|
var ids = trades.Select(t => t.RecId).Distinct().ToList();
|
||||||
|
ids = _storageGoodsDocOutHeadRepository.Queryable().Where(t => ids.Contains(t.RecId)).Select(t => t.RecId).Distinct().ToList();
|
||||||
|
if (ids.Count > 0)
|
||||||
|
trades = trades.Where(t => !ids.Contains(t.RecId)).ToList();
|
||||||
|
List<StorageGoodsDocOutHead> jackOrdersList = new List<StorageGoodsDocOutHead>();
|
||||||
|
List<StorageGoodsDocOutDetail> ordersItemList = new List<StorageGoodsDocOutDetail>();
|
||||||
|
var shopConfig = _yTKJTShopParameterRepository.Queryable().Where(t => t.FDOCUMENTSTATUS == "C").ToList();
|
||||||
|
var shopCodeList = shopConfig.Select(t => t.FSHOPCODE).ToList();
|
||||||
|
|
||||||
|
|
||||||
|
trades.ForEach(t =>
|
||||||
|
{
|
||||||
|
|
||||||
|
StorageGoodsDocOutHead jackOrders = new StorageGoodsDocOutHead();
|
||||||
|
jackOrders = AutoMapperHelper.AutoMappToSingle<StorageGoodsDocOutHead, ErpStorageGoodsDocOutV2ResponseBizData>(t);
|
||||||
|
jackOrders.Id = Guid.NewGuid();
|
||||||
|
jackOrders.Status = 0;
|
||||||
|
jackOrders.UpdateTime = DateTime.Now;
|
||||||
|
jackOrders.CreateTime = DateTime.Now;
|
||||||
|
if (t.GoodsDocDetailList != null)
|
||||||
|
{
|
||||||
|
var items = AutoMapperHelper.AutoMappToList<StorageGoodsDocOutDetail, GoodsDocDetailList>(t.GoodsDocDetailList);
|
||||||
|
items.ForEach(k =>
|
||||||
|
{
|
||||||
|
k.HeadId = jackOrders.Id;
|
||||||
|
k.CreateTime = DateTime.Now;
|
||||||
|
k.UpdateTime = DateTime.Now;
|
||||||
|
});
|
||||||
|
jackOrdersList.Add(jackOrders);
|
||||||
|
ordersItemList.AddRange(items);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
if (jackOrdersList.Count > 0)
|
||||||
|
{
|
||||||
|
_storageGoodsDocOutHeadRepository.Add(jackOrdersList);
|
||||||
|
_storageGoodsDocOutDetailRepository.Add(ordersItemList);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -284,6 +284,20 @@ namespace MyCode.Project.WebApi.Controllers
|
|||||||
_jackYunTaskService.GetStorageGoodsDocOutV2(now);
|
_jackYunTaskService.GetStorageGoodsDocOutV2(now);
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
#region 合并吉客云采购订单到新表
|
||||||
|
/// <summary>
|
||||||
|
/// 合并吉客云采购订单到新表
|
||||||
|
/// </summary>
|
||||||
|
[HttpGet]
|
||||||
|
[AllowAnonymous]
|
||||||
|
public string GetAndMergePushGoodsDocInOrder(string now)
|
||||||
|
{
|
||||||
|
return _jackYunTaskService.GetAndMergePushGoodsDocInOrder(now);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user