feature:
成品入库页面分配库存弹窗字段完善
This commit is contained in:
1 parent
c76e7bb681
commit
b6c3ef8b2c
10 files changed
+441
-56
No files matched your search
@@ -343,6 +343,79 @@ namespace HHWMS.Web
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>平库材料出库上报的仓库编码,固定值</summary>
|
||||
private const string RdRecord11WhCode = "yl";
|
||||
|
||||
/// <summary>
|
||||
/// 回传 ERP 平库材料出库单(AddRdRecord11):同一 BillCode 的多条流水合并为一张出库单
|
||||
/// </summary>
|
||||
public async Task<bool> ProcessErpRdRecord11(List<InventoryTransaction> transactions)
|
||||
{
|
||||
transactions = transactions?
|
||||
.Where(x => x.Type == InventoryTranType.出库
|
||||
&& x.BillType == InventoryTransaction.ErpRdRecord11BillType)
|
||||
.ToList();
|
||||
if (transactions == null || transactions.Count == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var first = transactions.OrderBy(x => x.ID).First();
|
||||
var maker = unitWork.FindSingle<FrameworkUser>(x => x.ITCode == first.CreateBy)?.Name
|
||||
?? first.CreateBy
|
||||
?? "WMS";
|
||||
var request = new AddRdRecord11Request
|
||||
{
|
||||
Main = new AddRdRecord11Main
|
||||
{
|
||||
ErpCode = "003",
|
||||
BillCode = first.BillCode,
|
||||
BillDate = (first.CreateTime ?? DateTime.Now).ToString("yyyy-MM-dd"),
|
||||
WhCode = RdRecord11WhCode,
|
||||
DepCode = null,
|
||||
Maker = maker
|
||||
},
|
||||
Details = transactions
|
||||
.GroupBy(x => x.MaterialCode)
|
||||
.Select(g => new AddRdRecord11Detail
|
||||
{
|
||||
InvCode = g.Key,
|
||||
Qty = g.Sum(x => x.Qty ?? 0)
|
||||
})
|
||||
.ToList()
|
||||
};
|
||||
|
||||
try
|
||||
{
|
||||
var apiResult = await Wtm.CallAPI<FinishInResponse>("ERP", "AddRdRecord11",
|
||||
HttpMethodEnum.POST, request);
|
||||
var success = apiResult?.Data != null && apiResult.Data.Result;
|
||||
foreach (var transaction in transactions)
|
||||
{
|
||||
transaction.UploadErpFlag = success ? 1 : 0;
|
||||
unitWork.Update(transaction);
|
||||
}
|
||||
if (!success)
|
||||
{
|
||||
Wtm.DoLog("ERP平库出库上报失败", ActionLogTypesEnum.Normal, "AddRdRecord11",
|
||||
request: $"{request.Main.BillCode}|{string.Join(",", request.Details.Select(d => $"{d.InvCode}:{d.Qty}"))}",
|
||||
result: apiResult?.Data?.Message ?? apiResult?.ErrorMsg ?? "ERP返回失败");
|
||||
}
|
||||
return success;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
foreach (var transaction in transactions)
|
||||
{
|
||||
transaction.UploadErpFlag = 0;
|
||||
unitWork.Update(transaction);
|
||||
}
|
||||
Wtm.DoLog("ERP平库出库上报异常", ActionLogTypesEnum.Normal, "AddRdRecord11",
|
||||
request: first.BillCode, result: ex.Message);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateSaleOutShipmentStatus(List<int> shipmentHeaderIds)
|
||||
{
|
||||
foreach (var headerId in shipmentHeaderIds)
|
||||
|
||||
Reference in new issue
Block a user