入库明细拆分
铁心库打码
This commit is contained in:
1 parent
fa7b5814ba
commit
d19f62e48b
21 files changed
+513
-93
No files matched your search
@@ -7,6 +7,7 @@ using WalkingTec.Mvvm.Core.Extensions;
|
||||
using HHWMS.Web;
|
||||
using HHWMS.Web.Models;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace HHWMS.Web.Controllers
|
||||
{
|
||||
@@ -137,7 +138,7 @@ namespace HHWMS.Web.Controllers
|
||||
}
|
||||
else
|
||||
{
|
||||
return FFResult().CloseDialog().RefreshGridRow(vm.Entity.ID);
|
||||
return FFResult().CloseDialog().RefreshGridRow((long)vm.Entity.ID);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -192,7 +193,7 @@ namespace HHWMS.Web.Controllers
|
||||
{
|
||||
if (!ModelState.IsValid || !vm.DoBatchEdit())
|
||||
{
|
||||
return PartialView("BatchEdit",vm);
|
||||
return PartialView("BatchEdit", vm);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -216,7 +217,7 @@ namespace HHWMS.Web.Controllers
|
||||
{
|
||||
if (!ModelState.IsValid || !vm.DoBatchDelete())
|
||||
{
|
||||
return PartialView("BatchDelete",vm);
|
||||
return PartialView("BatchDelete", vm);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -226,7 +227,7 @@ namespace HHWMS.Web.Controllers
|
||||
#endregion
|
||||
|
||||
#region Import
|
||||
[ActionDescription("Sys.Import")]
|
||||
[ActionDescription("Sys.Import")]
|
||||
public ActionResult Import()
|
||||
{
|
||||
var vm = Wtm.CreateVM<ReceiptDetail2ImportVM>();
|
||||
@@ -258,9 +259,64 @@ namespace HHWMS.Web.Controllers
|
||||
#endregion
|
||||
|
||||
[ActionDescription("Sys.Print")]
|
||||
public ActionResult Print()
|
||||
[FixConnection(CsName = "hangyong")]
|
||||
public ActionResult Print(string id)
|
||||
{
|
||||
return Ok();
|
||||
var dc = Wtm.CreateDC(cskey: "hangyong");
|
||||
Wtm.DC = dc;
|
||||
var vm = Wtm.CreateVM<ReceiptDetail2VM>(id);
|
||||
return PartialView(vm);
|
||||
}
|
||||
|
||||
[ActionDescription("Sys.SearchDetail")]
|
||||
[FixConnection(CsName = "hangyong")]
|
||||
public ActionResult SearchDetail(int id)
|
||||
{
|
||||
var dc = Wtm.CreateDC(cskey: "hangyong");
|
||||
Wtm.DC = dc;
|
||||
var data = dc.Set<ReceiptDetail2>().Where(x => x.ID == id);
|
||||
return JsonMore(data);
|
||||
}
|
||||
|
||||
[ActionDescription("Sys.ChaiDetail")]
|
||||
[FixConnection(CsName = "hangyong")]
|
||||
public ActionResult ChaiDetail(List<ReceiptDetail> data)
|
||||
{
|
||||
var dc = Wtm.CreateDC(cskey: "hangyong");
|
||||
Wtm.DC = dc;
|
||||
var _unit = new UnitWork(Wtm);
|
||||
|
||||
using (var tran = dc.BeginTransaction())
|
||||
{
|
||||
try
|
||||
{
|
||||
var receipt = _unit.FindSingle<ReceiptDetail2>(x =>
|
||||
x.MaterialCode == data.FirstOrDefault().MaterialCode
|
||||
&& x.Batch == data.FirstOrDefault().Batch);
|
||||
if (receipt != null)
|
||||
{
|
||||
receipt.Qty = data.FirstOrDefault().Qty;
|
||||
_unit.Update(receipt);
|
||||
|
||||
var ll = new List<ReceiptDetail2>();
|
||||
foreach (var item in data.Skip(1))
|
||||
{
|
||||
var re = receipt;
|
||||
re.ID = null;
|
||||
re.Qty = item.Qty;
|
||||
ll.Add(re);
|
||||
}
|
||||
_unit.BatchAdd(ll.ToArray());
|
||||
tran.Commit();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
tran.Rollback();
|
||||
return JsonMore(null, 500, ex.Message);
|
||||
}
|
||||
}
|
||||
return JsonMore(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user