线边对接ERP
This commit is contained in:
1 parent
e3002cabf6
commit
287453691b
8 files changed
+253
-29
No files matched your search
@@ -3,6 +3,7 @@ using Microsoft.AspNetCore.Mvc;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text.Json;
|
||||
using System.Threading.Tasks;
|
||||
using WalkingTec.Mvvm.Core;
|
||||
using WalkingTec.Mvvm.Mvc;
|
||||
@@ -544,6 +545,10 @@ namespace HHWMS.Web.Controllers
|
||||
{
|
||||
return FFResult().Alert("所选库存存在任务,请检查后重试!").RefreshGrid();
|
||||
}
|
||||
if (string.IsNullOrEmpty(inv.SourceCode))
|
||||
{
|
||||
return FFResult().Alert("所选库存没关联订单,无需回传!").RefreshGrid();
|
||||
}
|
||||
|
||||
// 构建ERP请求
|
||||
// 字段映射参照 ReceiptInController:
|
||||
@@ -557,12 +562,13 @@ namespace HHWMS.Web.Controllers
|
||||
{
|
||||
Main = new FinishInMain
|
||||
{
|
||||
ErpCode = "001", // 账套号
|
||||
InCode = inv.SourceCode, // 报工单号(上游单号)
|
||||
ErpCode = "999", // 账套号
|
||||
InCode = $"{inv.SourceCode}-{DateTime.Now.Ticks}", // 报工单号(上游单号)
|
||||
InDate = (inv.CreateTime ?? DateTime.Now).ToString("yyyy-MM-dd"), // 报工日期
|
||||
StepCode = inv.BatchCode, // 工序(批次编码)
|
||||
WorkerCode = inv.CreateBy, // 工人编码(创建人)
|
||||
Maker = inv.ReceiptCode // 制单人(校验员)
|
||||
Maker = _unitWork.FindSingle<FrameworkUser>(x =>
|
||||
x.ITCode == inv.CreateBy).Name // 制单人(校验员)
|
||||
},
|
||||
Details = new List<FinishInDetail>()
|
||||
};
|
||||
@@ -574,11 +580,10 @@ namespace HHWMS.Web.Controllers
|
||||
InvCode = inv.MaterialCode, // 物料号
|
||||
Qty = inv.Qty ?? 0 // 完工数量
|
||||
});
|
||||
|
||||
// 调用ERP接口
|
||||
var apiResult = await Wtm.CallAPI<FinishInResponse>("ERP", "FinishIn", HttpMethodEnum.POST, request);
|
||||
|
||||
if (apiResult.Data != null)
|
||||
|
||||
if (apiResult.Data != null && apiResult.Data.Result)
|
||||
{
|
||||
inv.UploadErpFlag = 1;
|
||||
_unitWork.Update(inv);
|
||||
@@ -588,7 +593,8 @@ namespace HHWMS.Web.Controllers
|
||||
{
|
||||
inv.UploadErpFlag = 0;
|
||||
_unitWork.Update(inv);
|
||||
return FFResult().Alert(apiResult.ErrorMsg?? "调用ERP接口失败").RefreshGrid();
|
||||
return FFResult().Alert($"调用ERP接口失败 {(apiResult.Data != null ? apiResult.Data.Message : apiResult.ErrorMsg)}")
|
||||
.RefreshGrid();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
||||
Reference in new issue
Block a user