This commit is contained in:
tongfei
2024-03-22 16:36:41 +08:00
parent 5987c971d0
commit 17378dafb5
3 changed files with 34 additions and 23 deletions

View File

@@ -718,30 +718,39 @@ namespace WMS.Web.Domain.Services
erpDetails.Add(item);
}
foreach (var s in erpDetails)
try
{
var erp_details = entity.ErpDetails
.Where(w => w.SourceBillNo.Equals(s)).Select(s => s.ErpDetailId).ToList();
var erpDto = new ErpPushDto()
foreach (var s in erpDetails)
{
RuleId = "PUR_PurchaseOrder-STK_InStock",//转换规则内码 采购订单下推采购入库单
FormId = FormIdParam.PUR_PurchaseOrder.ToString(),
TargetFormId = FormIdParam.STK_InStock.ToString(),
DetailsId = s.ErpDetailId.ToString(),
IsDraftWhenSaveFail=true
};
//下推金蝶
var res = await this.Push(erpDto, s, entity.BillNo, sc_erpService);
if (res.result.IsSuccess)
entity.SyncSuccess(s.ErpDetailId, loginInfo?.UserInfo?.StaffId ?? 0, res.erpBillNo);
else
entity.SyncFail(res.result.Message, s.ErpDetailId, loginInfo?.UserInfo?.StaffId ?? 0, res.syncStatus);
var erp_details = entity.ErpDetails
.Where(w => w.SourceBillNo.Equals(s)).Select(s => s.ErpDetailId).ToList();
var erpDto = new ErpPushDto()
{
RuleId = "PUR_PurchaseOrder-STK_InStock",//转换规则内码 采购订单下推采购入库单
FormId = FormIdParam.PUR_PurchaseOrder.ToString(),
TargetFormId = FormIdParam.STK_InStock.ToString(),
DetailsId = s.ErpDetailId.ToString(),
IsDraftWhenSaveFail = true
};
//下推金蝶
var res = await this.Push(erpDto, s, entity.BillNo, sc_erpService);
if (res.result.IsSuccess)
entity.SyncSuccess(s.ErpDetailId, loginInfo?.UserInfo?.StaffId ?? 0, res.erpBillNo);
else
entity.SyncFail(res.result.Message, s.ErpDetailId, loginInfo?.UserInfo?.StaffId ?? 0, res.syncStatus);
}
//最好一条一条执行,否则执行失败 但是金蝶那边又同步成功 就会造成数据比价乱
var isSuccess = await sc_InStockRepositories.Update(entity, true);
if (entity == null) return Result.ReFailure(ResultCodes.DateWriteError);
return Result.ReSuccess();
}
//最好一条一条执行,否则执行失败 但是金蝶那边又同步成功 就会造成数据比价乱
var isSuccess = await sc_InStockRepositories.Update(entity, true);
if (entity == null) return Result.ReFailure(ResultCodes.DateWriteError);
return Result.ReSuccess();
catch (Exception ex)
{
_logger.LogInformation($"采购下推-同步:错误:{JsonConvert.SerializeObject(entity)} 操作人:{loginInfo.UserInfo.StaffId}");
return Result.ReFailure(ResultCodes.ErpSynsError);
}
}
/// <summary>

View File

@@ -172,8 +172,9 @@ namespace WMS.Web.Domain.Services.Public
loginInfo.UserInfo = r.UserInfo;
loginInfo.TokenInfo = token;
var ops_login_time = token.Expired.AddDays(1) - DateTime.Now;//用于正式
_redisClientService.SetStringKey<LoginInDto>($"wms_login_{token.Token}", loginInfo, ops_login_time);
//var ops_login_time = token.Expired.AddDays(1) - DateTime.Now;//用于正式
_redisClientService.SetStringKey<LoginInDto>($"wms_login_{token.Token}", loginInfo, token.Expired.TimeOfDay);
_logger.LogInformation($"登录信息:用户人员信息->{staffName}{r.UserInfo.StaffId}),公司名称->{r.UserInfo.CompanyName}"+",过期时间:"+token.Expired.ToString("yyyy-MM-dd HH:mm:ss"));

View File

@@ -29,6 +29,7 @@ namespace WMS.Web.Domain.Values
/// </summary>
public static ValueTuple<int, string> NoRoot = (40005, "没有菜单权限,无法登录");
public static ValueTuple<int, string> ErpSyns = (40006, "正在同步金蝶数据,请稍候再试!");
public static ValueTuple<int, string> ErpSynsError = (40006, "同步金蝶数据失败!");
//出库任务单
public static ValueTuple<int, string> MergeStatusError = (70000, "请选择出库状态为”待出库”且出库类型为”销售出库”发货组织和收货客户以及发货仓库一致的数据");
public static ValueTuple<int, string> OutStockQtyError = (70001, "可出库数量不足");