卷料打印
This commit is contained in:
1 parent
99bf79a30d
commit
7f5b5bc521
13 files changed
+469
-26
No files matched your search
@@ -8,6 +8,7 @@ using HHWMS.Web.xwms.ViewModels.ReceiptHeader2VMs;
|
||||
using HHWMS.Web.Models;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
using NPOI.SS.Formula;
|
||||
|
||||
namespace HHWMS.Web.Controllers
|
||||
{
|
||||
@@ -319,13 +320,12 @@ namespace HHWMS.Web.Controllers
|
||||
{
|
||||
var warehouseId = Wtm.LoginUserInfo.Groups.FirstOrDefault().GroupCode;
|
||||
var dc = Wtm.CreateDC(cskey: "hangyong");
|
||||
|
||||
Wtm.DC = dc;
|
||||
var _unit = new UnitWork(Wtm);
|
||||
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");
|
||||
@@ -368,5 +368,92 @@ namespace HHWMS.Web.Controllers
|
||||
}
|
||||
return JsonMore(null);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[ActionDescription("Sys.Create4")]
|
||||
[FixConnection(CsName = "hangyong")]
|
||||
public ActionResult CreateDetail4(List<receipt4> data)
|
||||
{
|
||||
var warehouseId = Wtm.LoginUserInfo.Groups.FirstOrDefault().GroupCode;
|
||||
var dc = Wtm.CreateDC(cskey: "hangyong");
|
||||
Wtm.DC = dc;
|
||||
var _unit = new UnitWork(Wtm);
|
||||
using (var tran = dc.BeginTransaction())
|
||||
{
|
||||
try
|
||||
{
|
||||
var receipt = new ReceiptHeader2();
|
||||
receipt.WarehouseId = int.Parse(warehouseId);
|
||||
receipt.Code = _unitwork.GetSerialNumber("410");
|
||||
receipt.Type = "10";
|
||||
receipt.FirstStatus = 0;
|
||||
receipt.LastStatus = 0;
|
||||
|
||||
_unit.Add(receipt);
|
||||
|
||||
var detailList = new List<ReceiptDetail2>();
|
||||
var matList = new List<Material>();
|
||||
foreach(var item in data)
|
||||
{
|
||||
var detail = new ReceiptDetail2();
|
||||
detail.WarehouseId = receipt.WarehouseId;
|
||||
detail.ReceiptId = receipt.ID;
|
||||
detail.ReceiptCode = receipt.Code;
|
||||
detail.MaterialCode = item.JH;
|
||||
detail.MaterialName = item.JH;
|
||||
detail.Lot = item.Lot;
|
||||
detail.Sn = item.Sn;
|
||||
detail.Qty = item.Qty;
|
||||
detail.Project = item.JH;
|
||||
detail.InventoryStatus = "1";
|
||||
detail.UserDef1 = item.Lot;
|
||||
detail.UserDef2 = item.PH;
|
||||
detail.Status = 0;
|
||||
detail.CreateTime = DateTime.Now;
|
||||
detailList.Add(detail);
|
||||
|
||||
matList.Add(new Material
|
||||
{
|
||||
UniqueCode = item.JH,
|
||||
MaterialSpec = item.Lot,
|
||||
MaterialType = item.Sn,
|
||||
Qty = item.Qty,
|
||||
Batch = item.PH,
|
||||
CreateTime = DateTime.Now,
|
||||
});
|
||||
}
|
||||
_unitwork.BatchAdd(matList.ToArray());
|
||||
_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);
|
||||
}
|
||||
}
|
||||
|
||||
public class receipt4
|
||||
{
|
||||
/// <summary>
|
||||
/// 卷号
|
||||
/// </summary>
|
||||
public string JH { get; set; }
|
||||
public decimal Qty { get; set; }
|
||||
public decimal Len { get; set; }
|
||||
public string Lot { get; set; }
|
||||
public string Sn { get; set;}
|
||||
/// <summary>
|
||||
/// 片厚
|
||||
/// </summary>
|
||||
public string PH { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user