调度运行获取吉客云采购入库

This commit is contained in:
2025-11-04 11:11:40 +08:00
parent cdcac3a2f9
commit 8d0542953e
9 changed files with 685 additions and 128 deletions

View File

@@ -6,6 +6,7 @@ using MyCode.Project.Infrastructure.Exceptions;
using MyCode.Project.Infrastructure.JackYun;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading;
@@ -264,6 +265,129 @@ namespace MyCode.Project.Services.Implementation
return reslut;
}
#endregion
#region
/// <summary>
/// 获取吉客云采购入库
/// </summary>
/// <param name="now">截止日期</param>
/// <returns></returns>
/// <exception cref="BaseException"></exception>
public List<BusiOrderGoodsDocInResponse> GetPurchaseInboundData(DateTime now)
{
int total = 1;
var shopConfigs = _yTKJTShopParameterRepository.Queryable().Where(t => t.FDOCUMENTSTATUS == "C" && t.FPURCHASERECEIVING == "1").ToList();
BusiOrderGoodsDocInRequest requestBizData = new BusiOrderGoodsDocInRequest();
//string value = "2025-06-15 00:00:00";// DateTime.Now.Date.AddDays(-5).ToString("yyyy-MM-dd HH:mm:ss") ;
//string value1 = "2025-06-20 00:00:00";//DateTime.Now.Date.ToString("yyyy-MM-dd HH:mm:ss");
string value = now.Date.AddDays(-7).ToString("yyyy-MM-dd");
string value1 = now.Date.ToString("yyyy-MM-dd");
if (now.Date.AddDays(-7) < startTime)
{
value = startTime.ToString("yyyy-MM-dd");
}
//101-采购入库
requestBizData.Inouttypes = "101";
requestBizData.InOutDateStart = value;
requestBizData.InOutDateEnd = value1;
requestBizData.PageSize = 200;
requestBizData.PageIndex = 0;
requestBizData.Cols = "goodsdocNo,inOutDate,gmtCreate,inouttypeName,warehouseName,billNo,sourceBillNo,deliveryNo,currencyCode,currencyCodeName,currencyRate,createUserName,companyName,vendCustomerName,goodsdocRemark,receiveGoodsRemark,callbackStatus,applyCompanyName,applyDepartName,applyUserName,goodsNo,goodsName,skuName,skuBarcode,unitName,quantity,baceCurrencyCostPrice,baceCurrencyCostAmount,baceCurrencyNoTaxPrice,baceCurrencyNoTaxAmount,baceCurrencyWithTaxPrice,baceCurrencyWithTaxAmount,baceCurrencyTaxAmount,taxRate,transNoTaxPrice,transNoTaxAmount,transHasTaxPrice,transHasTaxAmount,transTaxAmount,isCertified,goodsDetailRemark,batchNo,serialNo,vendCode,warehouseCode,channelCode,serialSourceId,outBillNo,trackInOutNo,logisticName,logisticNo";
List<int> TradeTypeList = new List<int>();
TradeTypeList.Add(1005);
List<BusiOrderGoodsDocInResponse> reslut = new List<BusiOrderGoodsDocInResponse>();
List<BusiOrderGoodsDocInResponse> trades = new List<BusiOrderGoodsDocInResponse>();
TradeTypeList.ForEach(ty =>
{
string lggl = JsonHelper.ToJson(requestBizData);
LogHelper.Info(lggl);
JackyunResponse response = Call(EnumAttribute.GetAttribute(ApiEnum.STORAGEGOODSDOCINCOUNTS).Value, "1.0", requestBizData);
string ll = JsonHelper.ToJson(response);
LogHelper.Info(ll);
if (response.code == "200")
{
var orderjson = JsonHelper.ToJson(response.result);
var list1 = JsonHelper.ToObject<List<BusiOrderGoodsDocInResponse>>(orderjson);
//int pageIndex = 1;
//int TotalResults =;
//while (requestBizData.PageIndex * requestBizData.PageSize < TotalResults)
//{
// //list1.data.returnChangeList.ForEach(h => h.TradeType = ty);
// trades.AddRange(list1.data);
// requestBizData.PageIndex = pageIndex;
// pageIndex++;
// Thread.Sleep(100);
// response = Call(EnumAttribute.GetAttribute(ApiEnum.STORAGEGOODSDOCINCOUNTS).Value, "1.0", requestBizData);
// if (response.code == "200")
// {
// orderjson = JsonHelper.ToJson(response.result);
// list1 = JsonHelper.ToObject<TradeFullinfogetResp<ReturnChangeData>>(orderjson);
// }
//}
}
else
{
string msg = response.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();
//return reslut;
return new List<BusiOrderGoodsDocInResponse>();
}
#endregion
}