对接ERP2.7

部分页面修改
This commit is contained in:
zhougf committed 2026-02-07 14:23:08 +08:00
1 parent 22bfe9d015
commit 59f2af943b
17 files changed
+770 -887

No files matched your search

@@ -1,5 +1,6 @@
using System;
using System.Linq;
using System.Threading.Tasks;
using AutoMapper;
using HHWMS.Web.Models;
using Microsoft.AspNetCore.Mvc;
@@ -134,7 +135,7 @@ namespace HHWMS.Web.Controllers
}
[HttpPost]
public ActionResult AddInventory([FromBody] SimpleReceiptInModel model)
public async Task<ActionResult> AddInventory([FromBody] SimpleReceiptInModel model)
{
try
{
@@ -183,7 +184,8 @@ namespace HHWMS.Web.Controllers
MaterialSpec = material.MaterialSpec,
MaterialUnit = material.MaterialUnit,
CompanyCode = model.CompanyCode,
SourceCode = model.OrderId,
SourceCode = model.BillCode,// 客户订单
ProduceCode = model.OrderId,// 生产订单
ReceiptDetailId = model.SourceCode, // 优先使用 OrderId
SupplierCode = material.SupplierCode,
Batch = model.Batch,
@@ -198,9 +200,13 @@ namespace HHWMS.Web.Controllers
// 创建入库交易记录
var invTran = _mapper.Map<InventoryTransaction>(inventory);
invTran.BillCode = inventory.ID.ToString();
invTran.Type = InventoryTranType.入库;
_unitWork.Add(invTran);
var invVM = Wtm.CreateVM<InventoryVM>();
await invVM.ProcessErpFinishIn(inventory, TaskTypeEnum.入库);
return JsonMore(new { Id = inventory.ID });
}
@@ -320,7 +326,7 @@ namespace HHWMS.Web.Controllers
}
[HttpPost]
public ActionResult DeleteInventory(int id)
public async Task<ActionResult> DeleteInventory(int id)
{
try
{
@@ -334,13 +340,17 @@ namespace HHWMS.Web.Controllers
// 创建出库交易记录
var invTran = _mapper.Map<InventoryTransaction>(inventory);
invTran.BillCode = inventory.ID.ToString();
invTran.Type = InventoryTranType.出库;
_unitWork.Add(invTran);
// var invVM = Wtm.CreateVM<InventoryVM>();
// await invVM.ProcessErpFinishIn(inventory, TaskTypeEnum.出库);
// 删除库存记录
_unitWork.Delete(inventory);
return JsonMore(null);
}
catch (Exception ex)
@@ -350,7 +360,7 @@ namespace HHWMS.Web.Controllers
}
[HttpPost]
public ActionResult UpdateInventory(int id, decimal qty)
public async Task<ActionResult> UpdateInventory(int id, decimal qty)
{
try
{
@@ -370,21 +380,32 @@ namespace HHWMS.Web.Controllers
// 创建出库交易记录(原数量)
var invOutTran = _mapper.Map<InventoryTransaction>(inventory);
invOutTran.Type = InventoryTranType.出库;
invOutTran.Qty -= qty;
invOutTran.BillCode = inventory.ID.ToString();
invOutTran.CreateTime = DateTime.Now;
_unitWork.Add(invOutTran);
// 创建入库交易记录(新数量)
var invInTran = _mapper.Map<InventoryTransaction>(inventory);
invInTran.Qty = qty;
invInTran.Type = InventoryTranType.入库;
_unitWork.Add(invInTran);
// var invInTran = _mapper.Map<InventoryTransaction>(inventory);
// invInTran.Qty = qty;
// invInTran.BillCode = inventory.ID.ToString();
// invInTran.Type = InventoryTranType.入库;
// invInTran.CreateTime = DateTime.Now;
//
// _unitWork.Add(invInTran);
// 出库数量
// inventory.Qty -= qty;
// var invVM = Wtm.CreateVM<InventoryVM>();
// await invVM.ProcessErpFinishIn(inventory, TaskTypeEnum.出库);
// 更新库存数量
inventory.Qty = qty;
inventory.UpdateTime = DateTime.Now;
inventory.UpdateBy = Wtm?.LoginUserInfo?.ITCode ?? "WMS";
_unitWork.Update(inventory);
return JsonMore(null);
}
@@ -586,6 +607,12 @@ namespace HHWMS.Web.Controllers
/// 订单号(上游单号)
/// </summary>
public string SourceCode { get; set; }
/// <summary>
/// 生产订单号
/// </summary>
public string BillCode { get; set; }
public string OrderId { get; set; }
/// <summary>