3
This commit is contained in:
1 parent
e9f154bd06
commit
fa7b5814ba
22 files changed
+989
-168
No files matched your search
@@ -7,6 +7,7 @@ using WalkingTec.Mvvm.Core.Extensions;
|
||||
using HHWMS.Web.xwms.ViewModels.ReceiptHeader2VMs;
|
||||
using HHWMS.Web.Models;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace HHWMS.Web.Controllers
|
||||
{
|
||||
@@ -246,5 +247,60 @@ namespace HHWMS.Web.Controllers
|
||||
}
|
||||
#endregion
|
||||
|
||||
[HttpPost]
|
||||
[ActionDescription("Sys.Create")]
|
||||
[FixConnection(CsName = "hangyong")]
|
||||
public ActionResult CreateDetail3(string px,string pxName, string lot, int num)
|
||||
{
|
||||
var warehouseId = Wtm.LoginUserInfo.Groups.FirstOrDefault().GroupCode;
|
||||
var dc = Wtm.CreateDC(cskey: "hangyong");
|
||||
|
||||
using (var tran = dc.BeginTransaction())
|
||||
{
|
||||
try
|
||||
{
|
||||
Wtm.DC = dc;
|
||||
var _unit = new UnitWork(Wtm);
|
||||
var receipt = new ReceiptHeader2();
|
||||
receipt.WarehouseId = int.Parse(warehouseId);
|
||||
receipt.Code = _unitwork.GetSerialNumber("10");
|
||||
receipt.Type = "10";
|
||||
receipt.FirstStatus = 0;
|
||||
receipt.LastStatus = 0;
|
||||
|
||||
_unit.Add(receipt);
|
||||
|
||||
var detailList = new List<ReceiptDetail2>();
|
||||
while(num > 0)
|
||||
{
|
||||
var detail = new ReceiptDetail2();
|
||||
detail.WarehouseId = receipt.WarehouseId;
|
||||
detail.ReceiptId = receipt.ID;
|
||||
detail.ReceiptCode = receipt.Code;
|
||||
detail.MaterialName = pxName;
|
||||
detail.Lot = lot;
|
||||
detail.Project = $"{lot}--{px}";
|
||||
detail.Qty = 1;
|
||||
detail.Status = 0;
|
||||
detail.CreateTime = DateTime.Now;
|
||||
detailList.Add(detail);
|
||||
num--;
|
||||
}
|
||||
_unit.BatchAdd(detailList.ToArray());
|
||||
|
||||
receipt.TotalLines = detailList.Count();
|
||||
receipt.TotalQty = detailList.Sum(x => x.Qty);
|
||||
_unit.Update(receipt);
|
||||
|
||||
tran.Commit();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
tran.Rollback();
|
||||
return JsonMore(null, 500, ex.Message);
|
||||
}
|
||||
}
|
||||
return JsonMore(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user