入库单批量新增 主子表
新增物料表
This commit is contained in:
1 parent
f8ee359644
commit
f4505ff18d
31 files changed
+949
-9
No files matched your search
@@ -3,6 +3,8 @@ using Microsoft.AspNetCore.Mvc;
|
||||
using WalkingTec.Mvvm.Core;
|
||||
using WalkingTec.Mvvm.Mvc;
|
||||
using WalkingTec.Mvvm.Core.Extensions;
|
||||
using HHWMS.Web.Models;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace HHWMS.Web.Controllers
|
||||
{
|
||||
@@ -39,6 +41,15 @@ namespace HHWMS.Web.Controllers
|
||||
}
|
||||
}
|
||||
|
||||
[ActionDescription("Sys.Search")]
|
||||
[HttpPost]
|
||||
public string Search2(ReceiptDetailListVM2 vm)
|
||||
{
|
||||
vm.Searcher.Page = vm.FC.GetValue<int>("Page");
|
||||
vm.Searcher.Limit = vm.FC.GetValue<int>("Limit");
|
||||
return vm.GetJson(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Create
|
||||
@@ -71,6 +82,67 @@ namespace HHWMS.Web.Controllers
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[ActionDescription("Sys.Create")]
|
||||
public ActionResult Create2(int id)
|
||||
{
|
||||
var vm = Wtm.CreateVM<ReceiptDetailVM>(passInit: true);
|
||||
vm.Entity.ReceiptHeaderId = id;
|
||||
vm.Entity.ReceiptHeader = new ReceiptHeader();
|
||||
//vm.Entity.ReceiptHeader.Code = vm.DC.Set<ReceiptHeader>().Find(id).Code;
|
||||
return PartialView(vm);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[ActionDescription("Sys.Create")]
|
||||
public ActionResult Create2(ReceiptDetailVM vm)
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return PartialView(vm);
|
||||
}
|
||||
else
|
||||
{
|
||||
vm.DoAdd();
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
vm.DoReInit();
|
||||
return PartialView(vm);
|
||||
}
|
||||
else
|
||||
{
|
||||
return FFResult().CloseDialog().RefreshGrid(index: 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[ActionDescription("Sys.Create")]
|
||||
public ActionResult CreateDetails(int id)
|
||||
{
|
||||
var vm = Wtm.CreateVM<ReceiptDetailVM>(passInit: true);
|
||||
vm.Entity.ReceiptHeaderId = id;
|
||||
vm.Entity.ReceiptHeader = new ReceiptHeader();
|
||||
//vm.Entity.ReceiptHeader.Code = vm.DC.Set<ReceiptHeader>().Find(id).Code;
|
||||
return PartialView(vm);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[ActionDescription("Sys.Create")]
|
||||
public ActionResult CreateDetails(ReceiptDetailVM vm)
|
||||
{
|
||||
var materialCodeList = vm.Entity.MaterialCode.Split("\n");
|
||||
var detailList = new List<ReceiptDetail>();
|
||||
foreach(var item in materialCodeList)
|
||||
{
|
||||
detailList.Add(new ReceiptDetail
|
||||
{
|
||||
MaterialCode = item,
|
||||
ReceiptHeaderId = vm.Entity.ReceiptHeaderId
|
||||
});
|
||||
}
|
||||
_unitwork.BatchAdd(detailList.ToArray());
|
||||
return FFResult().CloseDialog().RefreshGrid(index: 1);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Edit
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System;
|
||||
using WalkingTec.Mvvm.Core;
|
||||
@@ -138,6 +138,7 @@ namespace HHWMS.Web.Controllers
|
||||
public ActionResult Details(string id)
|
||||
{
|
||||
var vm = Wtm.CreateVM<ReceiptHeaderVM>(id);
|
||||
vm.Details.SearcherMode = ListVMSearchModeEnum.MasterDetail;
|
||||
return PartialView(vm);
|
||||
}
|
||||
#endregion
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using HHWMS.Web.Models;
|
||||
using WalkingTec.Mvvm.Core;
|
||||
|
||||
namespace HHWMS.Web
|
||||
{
|
||||
public partial class ReceiptDetailListVM2 : BasePagedListVM<ReceiptDetail_View, ReceiptDetailSearcher>
|
||||
{
|
||||
protected override List<GridAction> InitGridAction()
|
||||
{
|
||||
if (SearcherMode != ListVMSearchModeEnum.MasterDetail)
|
||||
{
|
||||
return new List<GridAction>
|
||||
{
|
||||
//this.MakeStandardAction("ReceiptDetail", GridActionStandardTypesEnum.Create, Localizer["Sys.Create"],"receipt", dialogWidth: 800),
|
||||
this.MakeAction("ReceiptDetail","Create2",Localizer["Sys.Create"],Localizer["Sys.Create"],GridActionParameterTypesEnum.NoId,"receipt").SetOnClickScript("CreateDetail"),
|
||||
this.MakeAction("ReceiptDetail","CreateDetail",Localizer["Sys.CreateDetails"],Localizer["Sys.CreateDetails"],GridActionParameterTypesEnum.NoId,"receipt").SetOnClickScript("CreateDetails"),
|
||||
|
||||
this.MakeStandardAction("ReceiptDetail", GridActionStandardTypesEnum.Edit, Localizer["Sys.Edit"], "receipt", dialogWidth: 800),
|
||||
this.MakeStandardAction("ReceiptDetail", GridActionStandardTypesEnum.Delete, Localizer["Sys.Delete"], "receipt", dialogWidth: 800),
|
||||
this.MakeStandardAction("ReceiptDetail", GridActionStandardTypesEnum.Details, Localizer["Sys.Details"], "receipt", dialogWidth: 800),
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
return new List<GridAction>();
|
||||
}
|
||||
}
|
||||
|
||||
protected override IEnumerable<IGridColumn<ReceiptDetail_View>> InitGridHeader()
|
||||
{
|
||||
var result = new List<GridColumn<ReceiptDetail_View>>{
|
||||
this.MakeGridHeader(x => x.Code_view),
|
||||
this.MakeGridHeader(x => x.ZoneCode),
|
||||
this.MakeGridHeader(x => x.MaterialCode),
|
||||
this.MakeGridHeader(x => x.MaterialType),
|
||||
this.MakeGridHeader(x => x.MaterialName),
|
||||
this.MakeGridHeader(x => x.MaterialSpec),
|
||||
this.MakeGridHeader(x => x.MaterialUnit),
|
||||
this.MakeGridHeader(x => x.Batch),
|
||||
this.MakeGridHeader(x => x.Lot),
|
||||
this.MakeGridHeader(x => x.ManufactureDate),
|
||||
this.MakeGridHeader(x => x.ExpirationDate),
|
||||
this.MakeGridHeader(x => x.CompanyCode),
|
||||
this.MakeGridHeader(x => x.SupplierCode),
|
||||
this.MakeGridHeader(x => x.CompletedQty),
|
||||
this.MakeGridHeader(x => x.Qty),
|
||||
this.MakeGridHeader(x => x.InventoryStatus),
|
||||
this.MakeGridHeader(x => x.Status)
|
||||
};
|
||||
|
||||
if (SearcherMode != ListVMSearchModeEnum.MasterDetail)
|
||||
{
|
||||
result.Add(this.MakeGridHeaderAction(width: 200));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public override IOrderedQueryable<ReceiptDetail_View> GetSearchQuery()
|
||||
{
|
||||
var query = DC.Set<ReceiptDetail>()
|
||||
.Where(x => x.ReceiptHeaderId == Searcher.ReceiptHeaderId)
|
||||
.Select(x => new ReceiptDetail_View
|
||||
{
|
||||
ID = x.ID,
|
||||
Code_view = x.ReceiptHeader.Code,
|
||||
ZoneCode = x.ZoneCode,
|
||||
MaterialCode = x.MaterialCode,
|
||||
MaterialType = x.MaterialType,
|
||||
MaterialName = x.MaterialName,
|
||||
MaterialSpec = x.MaterialSpec,
|
||||
MaterialUnit = x.MaterialUnit,
|
||||
Batch = x.Batch,
|
||||
Lot = x.Lot,
|
||||
ManufactureDate = x.ManufactureDate,
|
||||
ExpirationDate = x.ExpirationDate,
|
||||
CompanyCode = x.CompanyCode,
|
||||
SupplierCode = x.SupplierCode,
|
||||
CompletedQty = x.CompletedQty,
|
||||
Qty = x.Qty,
|
||||
InventoryStatus = x.InventoryStatus,
|
||||
Status = x.Status,
|
||||
})
|
||||
.OrderBy(x => x.ID);
|
||||
return query;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,12 @@ namespace HHWMS.Web
|
||||
{
|
||||
public partial class ReceiptHeaderListVM : BasePagedListVM<ReceiptHeader_View, ReceiptHeaderSearcher>
|
||||
{
|
||||
public ReceiptDetailListVM2 Details { get; set; } = new ReceiptDetailListVM2();
|
||||
|
||||
protected override void InitVM()
|
||||
{
|
||||
Details.CopyContext(this);
|
||||
}
|
||||
protected override List<GridAction> InitGridAction()
|
||||
{
|
||||
return new List<GridAction>
|
||||
@@ -27,7 +33,11 @@ namespace HHWMS.Web
|
||||
{
|
||||
return new List<GridColumn<ReceiptHeader_View>>{
|
||||
this.MakeGridHeader(x => x.SourceCode),
|
||||
this.MakeGridHeader(x => x.Code),
|
||||
this.MakeGridHeader(x => x.Code).SetFormat((a,b) =>
|
||||
{
|
||||
string rv = UIService.MakeScriptButton(ButtonTypesEnum.Link,a.Code,$"details('{a.ID}')");
|
||||
return rv;
|
||||
}),
|
||||
this.MakeGridHeader(x => x.BillType),
|
||||
this.MakeGridHeader(x => x.CompanyCode),
|
||||
this.MakeGridHeader(x => x.SupplierCode),
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using HHWMS.Web.Models;
|
||||
using WalkingTec.Mvvm.Core;
|
||||
@@ -7,12 +8,15 @@ namespace HHWMS.Web
|
||||
{
|
||||
public partial class ReceiptHeaderVM : BaseCRUDVM<ReceiptHeader>
|
||||
{
|
||||
public ReceiptDetailListVM2 Details = new ReceiptDetailListVM2();
|
||||
public ReceiptHeaderVM()
|
||||
{
|
||||
}
|
||||
|
||||
protected override void InitVM()
|
||||
{
|
||||
Details.CopyContext(this);
|
||||
Details.Searcher.ReceiptHeaderId = Entity.ID;
|
||||
}
|
||||
|
||||
public override void DoAdd()
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
@model HHWMS.Web.ReceiptDetailVM
|
||||
@inject IStringLocalizer<Program> Localizer;
|
||||
|
||||
<wt:form vm="@Model">
|
||||
<wt:row items-per-row="ItemsPerRowEnum.Two">
|
||||
<wt:textbox field="Entity.ZoneCode" />
|
||||
<wt:textbox field="Entity.MaterialCode" />
|
||||
<wt:textbox field="Entity.MaterialType" />
|
||||
<wt:textbox field="Entity.MaterialName" />
|
||||
<wt:textbox field="Entity.MaterialSpec" />
|
||||
<wt:textbox field="Entity.MaterialUnit" />
|
||||
<wt:textbox field="Entity.Batch" />
|
||||
<wt:textbox field="Entity.Lot" />
|
||||
<wt:datetime field="Entity.ManufactureDate" />
|
||||
<wt:datetime field="Entity.ExpirationDate" />
|
||||
<wt:textbox field="Entity.CompanyCode" />
|
||||
<wt:textbox field="Entity.SupplierCode" />
|
||||
<wt:textbox field="Entity.CompletedQty" />
|
||||
<wt:textbox field="Entity.Qty" />
|
||||
<wt:textbox field="Entity.InventoryStatus" />
|
||||
<wt:combobox field="Entity.Status" />
|
||||
</wt:row>
|
||||
<wt:hidden field="Entity.ReceiptHeaderId" />
|
||||
<wt:row align="AlignEnum.Right">
|
||||
<wt:submitbutton />
|
||||
<wt:closebutton />
|
||||
</wt:row>
|
||||
</wt:form>
|
||||
@@ -0,0 +1,13 @@
|
||||
@model HHWMS.Web.ReceiptDetailVM
|
||||
@inject IStringLocalizer<Program> Localizer;
|
||||
|
||||
<wt:form vm="@Model">
|
||||
<wt:row items-per-row="ItemsPerRowEnum.One">
|
||||
<wt:textarea field="Entity.MaterialCode" />
|
||||
</wt:row>
|
||||
<wt:hidden field="Entity.ReceiptHeaderId" />
|
||||
<wt:row align="AlignEnum.Right">
|
||||
<wt:submitbutton />
|
||||
<wt:closebutton />
|
||||
</wt:row>
|
||||
</wt:form>
|
||||
@@ -1,4 +1,4 @@
|
||||
@model HHWMS.Web.ReceiptHeaderVM
|
||||
@model HHWMS.Web.ReceiptHeaderVM
|
||||
@inject IStringLocalizer<Program> Localizer;
|
||||
|
||||
<wt:form vm="@Model">
|
||||
@@ -15,6 +15,8 @@
|
||||
<wt:display field="Entity.AppointmentTime" />
|
||||
<wt:display field="Entity.Remark" />
|
||||
</wt:row>
|
||||
<wt:grid vm="@Model.Details" height="300" hidden-checkbox="true" hidden-grid-index="true" use-local-data="true" hidden-panel="true" />
|
||||
|
||||
<wt:row align="AlignEnum.Right">
|
||||
<wt:closebutton />
|
||||
</wt:row>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
@model HHWMS.Web.ReceiptHeaderListVM
|
||||
@model HHWMS.Web.ReceiptHeaderListVM
|
||||
@inject IStringLocalizer<Program> Localizer;
|
||||
|
||||
<wt:searchpanel vm="@Model" reset-btn="true">
|
||||
<wt:searchpanel vm="@Model" reset-btn="true" grid-id="header">
|
||||
<wt:row items-per-row="ItemsPerRowEnum.Three">
|
||||
<wt:textbox field="Searcher.SourceCode" />
|
||||
<wt:textbox field="Searcher.Code" />
|
||||
@@ -10,4 +10,33 @@
|
||||
<wt:combobox field="Searcher.LastStatus" empty-text="@Localizer["Sys.All"]" />
|
||||
</wt:row>
|
||||
</wt:searchpanel>
|
||||
<wt:grid vm="@Model" url="/receipt/ReceiptHeader/Search"/>
|
||||
<wt:grid vm="@Model" id="header" url="/receipt/ReceiptHeader/Search" limit="7" />
|
||||
<wt:grid vm="@Model.Details" id="detail" url="/receipt/ReceiptDetail/Search2" height="400" />
|
||||
|
||||
<script>
|
||||
var headerId = 0;
|
||||
function details(id) {
|
||||
headerId = id;
|
||||
layui.table.reload('detail', { where: { "Searcher.ReceiptHeaderId": id } });
|
||||
}
|
||||
|
||||
function CreateDetail() {
|
||||
if (headerId == 0) {
|
||||
layui.layer.alert('请选择一个单据');
|
||||
}
|
||||
else {
|
||||
|
||||
ff.OpenDialog('/receipt/ReceiptDetail/Create2/' + headerId, '@Guid.NewGuid()', '添加明细', 600);
|
||||
}
|
||||
}
|
||||
|
||||
function CreateDetails() {
|
||||
if (headerId == 0) {
|
||||
layui.layer.alert('请选择一个单据');
|
||||
}
|
||||
else {
|
||||
|
||||
ff.OpenDialog('/receipt/ReceiptDetail/CreateDetails/' + headerId, '@Guid.NewGuid()', '批量添加明细', 600);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
Reference in new issue
Block a user