This commit is contained in:
2025-07-21 17:25:29 +08:00
parent 0cc51644b2
commit 09cd61997d
5 changed files with 50 additions and 26 deletions

View File

@@ -2,6 +2,7 @@
using MyCode.Project.Domain.Repositories;
using MyCode.Project.Infrastructure.Common;
using MyCode.Project.Infrastructure.Enumeration;
using MyCode.Project.Infrastructure.Exceptions;
using MyCode.Project.Infrastructure.JackYun;
using System;
using System.Collections.Generic;
@@ -43,21 +44,21 @@ namespace MyCode.Project.Services.Implementation
return JsonHelper.ToObject<JackyunResponse>(strResponse);
}
public void TaskSendInventoryMovement(DateTime now)
public void TaskSendInventoryMovement(string sheet)
{
SendInStock(now);
SendInStock(sheet);
SendOutStock(now);
SendOutStock(sheet);
}
/// <summary>
/// 上传入库数据
/// </summary>
public void SendInStock(DateTime now)
public void SendInStock(string sheet)
{
var list = _wMStoJackyunInventoryMovementView1Repository.GetInventoryMovement();
//过滤入库数据
var InStockHead = list.Where(t => t.type == "+").Select(p => p.relDataId).Distinct().ToList();
var InStockHead = list.Where(t => t.type == "+" && t.relDataId == sheet).Select(p => p.relDataId).Distinct().ToList();
InStockHead.ForEach(relDataId =>
{
CreateAndStockinGetRequestBizData requestBizData = new CreateAndStockinGetRequestBizData();
@@ -87,6 +88,8 @@ namespace MyCode.Project.Services.Implementation
LogHelper.Info("上传入库数据报文:"+lggl);
Thread.Sleep(500);
JackyunResponse response = Call(EnumAttribute.GetAttribute(ApiEnum.CREATEANDSTOCKIN).Value, "1.0", requestBizData);
string ll = JsonHelper.ToJson(response);
LogHelper.Info("上传入库数据结果:" + ll);
//判断返回结果是否成功
if (response.code == "200")
{
@@ -94,21 +97,23 @@ namespace MyCode.Project.Services.Implementation
}
else
{
_wMStoJackyunInventoryMovementView1Repository.UpdateStatus(3, relDataId);
//_wMStoJackyunInventoryMovementView1Repository.UpdateStatus(3, relDataId);
string msg = response.msg;
throw new BaseException(msg);
}
string ll = JsonHelper.ToJson(response);
LogHelper.Info("上传入库数据结果:"+ll);
});
}
/// <summary>
/// 上传出库数据
/// </summary>
public void SendOutStock(DateTime now)
public void SendOutStock(string sheet)
{
var list = _wMStoJackyunInventoryMovementView1Repository.GetInventoryMovement();
//过滤出库数据
var OutStockHead = list.Where(t => t.type != "+").Select(p => p.relDataId).Distinct().ToList();
var OutStockHead = list.Where(t => t.type != "+" && t.relDataId==sheet).Select(p => p.relDataId).Distinct().ToList();
OutStockHead.ForEach(relDataId =>
{
@@ -139,6 +144,8 @@ namespace MyCode.Project.Services.Implementation
LogHelper.Info(lggl);
Thread.Sleep(500);
JackyunResponse response = Call(EnumAttribute.GetAttribute(ApiEnum.CREATEANDSTOCKOUT).Value, "1.0", requestBizData);
string ll = JsonHelper.ToJson(response);
LogHelper.Info(ll);
//判断返回结果是否成功
if (response.code == "200")
{
@@ -146,11 +153,14 @@ namespace MyCode.Project.Services.Implementation
}
else
{
_wMStoJackyunInventoryMovementView1Repository.UpdateStatus(3, relDataId);
string msg = response.msg;
throw new BaseException(msg);
//_wMStoJackyunInventoryMovementView1Repository.UpdateStatus(3, relDataId);
}
string ll = JsonHelper.ToJson(response);
LogHelper.Info(ll);
});
}
}
}