添加打印模板配置
This commit is contained in:
1 parent
b627851ab5
commit
ebdd40c518
22 files changed
+584
-190
No files matched your search
@@ -0,0 +1,228 @@
|
|||||||
|
using Microsoft.AspNetCore.Http;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using System;
|
||||||
|
using WalkingTec.Mvvm.Core;
|
||||||
|
using WalkingTec.Mvvm.Mvc;
|
||||||
|
using WalkingTec.Mvvm.Core.Extensions;
|
||||||
|
using HHWMS.Web;
|
||||||
|
|
||||||
|
namespace HHWMS.Web.Controllers
|
||||||
|
{
|
||||||
|
[Area("configs")]
|
||||||
|
[ActionDescription("打印模板配置")]
|
||||||
|
public partial class PrintConfigController : BaseController
|
||||||
|
{
|
||||||
|
private readonly IUnitWork _unitWork;
|
||||||
|
|
||||||
|
public PrintConfigController(IUnitWork unitWork)
|
||||||
|
{
|
||||||
|
_unitWork = unitWork;
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Search
|
||||||
|
[ActionDescription("Sys.Search")]
|
||||||
|
public ActionResult Index()
|
||||||
|
{
|
||||||
|
var vm = Wtm.CreateVM<PrintConfigListVM>();
|
||||||
|
return PartialView(vm);
|
||||||
|
}
|
||||||
|
|
||||||
|
[ActionDescription("Sys.Search")]
|
||||||
|
[HttpPost]
|
||||||
|
public string Search(PrintConfigSearcher searcher)
|
||||||
|
{
|
||||||
|
var vm = Wtm.CreateVM<PrintConfigListVM>(passInit: true);
|
||||||
|
if (ModelState.IsValid)
|
||||||
|
{
|
||||||
|
vm.Searcher = searcher;
|
||||||
|
return vm.GetJson(false);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return vm.GetError();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Create
|
||||||
|
[ActionDescription("Sys.Create")]
|
||||||
|
public ActionResult Create()
|
||||||
|
{
|
||||||
|
var vm = Wtm.CreateVM<PrintConfigVM>();
|
||||||
|
return PartialView(vm);
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
[ActionDescription("Sys.Create")]
|
||||||
|
public ActionResult Create(PrintConfigVM vm)
|
||||||
|
{
|
||||||
|
if (!ModelState.IsValid)
|
||||||
|
{
|
||||||
|
return PartialView(vm);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
vm.DoAdd();
|
||||||
|
if (!ModelState.IsValid)
|
||||||
|
{
|
||||||
|
vm.DoReInit();
|
||||||
|
return PartialView(vm);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return FFResult().CloseDialog().RefreshGrid();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Edit
|
||||||
|
[ActionDescription("Sys.Edit")]
|
||||||
|
public ActionResult Edit(string id)
|
||||||
|
{
|
||||||
|
var vm = Wtm.CreateVM<PrintConfigVM>(id);
|
||||||
|
return PartialView(vm);
|
||||||
|
}
|
||||||
|
|
||||||
|
[ActionDescription("Sys.Edit")]
|
||||||
|
[HttpPost]
|
||||||
|
[ValidateFormItemOnly]
|
||||||
|
public ActionResult Edit(PrintConfigVM vm)
|
||||||
|
{
|
||||||
|
if (!ModelState.IsValid)
|
||||||
|
{
|
||||||
|
return PartialView(vm);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
vm.DoEdit();
|
||||||
|
if (!ModelState.IsValid)
|
||||||
|
{
|
||||||
|
vm.DoReInit();
|
||||||
|
return PartialView(vm);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return FFResult().CloseDialog().RefreshGridRow(vm.Entity.ID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Delete
|
||||||
|
[ActionDescription("Sys.Delete")]
|
||||||
|
public ActionResult Delete(string id)
|
||||||
|
{
|
||||||
|
var vm = Wtm.CreateVM<PrintConfigVM>(id);
|
||||||
|
return PartialView(vm);
|
||||||
|
}
|
||||||
|
|
||||||
|
[ActionDescription("Sys.Delete")]
|
||||||
|
[HttpPost]
|
||||||
|
public ActionResult Delete(string id, IFormCollection nouse)
|
||||||
|
{
|
||||||
|
var vm = Wtm.CreateVM<PrintConfigVM>(id);
|
||||||
|
vm.DoDelete();
|
||||||
|
if (!ModelState.IsValid)
|
||||||
|
{
|
||||||
|
return PartialView(vm);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return FFResult().CloseDialog().RefreshGrid();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Details
|
||||||
|
[ActionDescription("Sys.Details")]
|
||||||
|
public ActionResult Details(string id)
|
||||||
|
{
|
||||||
|
var vm = Wtm.CreateVM<PrintConfigVM>(id);
|
||||||
|
return PartialView(vm);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region BatchEdit
|
||||||
|
[HttpPost]
|
||||||
|
[ActionDescription("Sys.BatchEdit")]
|
||||||
|
public ActionResult BatchEdit(string[] IDs)
|
||||||
|
{
|
||||||
|
var vm = Wtm.CreateVM<PrintConfigBatchVM>(Ids: IDs);
|
||||||
|
return PartialView(vm);
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
[ActionDescription("Sys.BatchEdit")]
|
||||||
|
public ActionResult DoBatchEdit(PrintConfigBatchVM vm, IFormCollection nouse)
|
||||||
|
{
|
||||||
|
if (!ModelState.IsValid || !vm.DoBatchEdit())
|
||||||
|
{
|
||||||
|
return PartialView("BatchEdit",vm);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return FFResult().CloseDialog().RefreshGrid().Alert(Localizer["Sys.BatchEditSuccess", vm.Ids.Length]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region BatchDelete
|
||||||
|
[HttpPost]
|
||||||
|
[ActionDescription("Sys.BatchDelete")]
|
||||||
|
public ActionResult BatchDelete(string[] IDs)
|
||||||
|
{
|
||||||
|
var vm = Wtm.CreateVM<PrintConfigBatchVM>(Ids: IDs);
|
||||||
|
return PartialView(vm);
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
[ActionDescription("Sys.BatchDelete")]
|
||||||
|
public ActionResult DoBatchDelete(PrintConfigBatchVM vm, IFormCollection nouse)
|
||||||
|
{
|
||||||
|
if (!ModelState.IsValid || !vm.DoBatchDelete())
|
||||||
|
{
|
||||||
|
return PartialView("BatchDelete",vm);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return FFResult().CloseDialog().RefreshGrid().Alert(Localizer["Sys.BatchDeleteSuccess", vm.Ids.Length]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Import
|
||||||
|
[ActionDescription("Sys.Import")]
|
||||||
|
public ActionResult Import()
|
||||||
|
{
|
||||||
|
var vm = Wtm.CreateVM<PrintConfigImportVM>();
|
||||||
|
return PartialView(vm);
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
[ActionDescription("Sys.Import")]
|
||||||
|
public ActionResult Import(PrintConfigImportVM vm, IFormCollection nouse)
|
||||||
|
{
|
||||||
|
if (vm.ErrorListVM.EntityList.Count > 0 || !vm.BatchSaveData())
|
||||||
|
{
|
||||||
|
return PartialView(vm);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return FFResult().CloseDialog().RefreshGrid().Alert(Localizer["Sys.ImportSuccess", vm.EntityList.Count.ToString()]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Export
|
||||||
|
[ActionDescription("Sys.Export")]
|
||||||
|
[HttpPost]
|
||||||
|
public IActionResult ExportExcel(PrintConfigListVM vm)
|
||||||
|
{
|
||||||
|
return vm.GetExportData();
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using WalkingTec.Mvvm.Core;
|
||||||
|
using WalkingTec.Mvvm.Core.Extensions;
|
||||||
|
using HHWMS.Web.Models;
|
||||||
|
|
||||||
|
|
||||||
|
namespace HHWMS.Web
|
||||||
|
{
|
||||||
|
public partial class PrintConfigBatchVM : BaseBatchVM<PrintConfig, PrintConfig_BatchEdit>
|
||||||
|
{
|
||||||
|
public PrintConfigBatchVM()
|
||||||
|
{
|
||||||
|
ListVM = new PrintConfigListVM();
|
||||||
|
LinkedVM = new PrintConfig_BatchEdit();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Class to define batch edit fields
|
||||||
|
/// </summary>
|
||||||
|
public class PrintConfig_BatchEdit : BaseVM
|
||||||
|
{
|
||||||
|
|
||||||
|
protected override void InitVM()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using WalkingTec.Mvvm.Core;
|
||||||
|
using WalkingTec.Mvvm.Core.Extensions;
|
||||||
|
using HHWMS.Web.Models;
|
||||||
|
|
||||||
|
|
||||||
|
namespace HHWMS.Web
|
||||||
|
{
|
||||||
|
public partial class PrintConfigTemplateVM : BaseTemplateVM
|
||||||
|
{
|
||||||
|
[Display(Name = "PrintConfig.Name")]
|
||||||
|
public ExcelPropety Name_Excel = ExcelPropety.CreateProperty<PrintConfig>(x => x.Name);
|
||||||
|
[Display(Name = "PrintConfig.Template")]
|
||||||
|
public ExcelPropety Template_Excel = ExcelPropety.CreateProperty<PrintConfig>(x => x.Template);
|
||||||
|
[Display(Name = "PrintConfig.TestData")]
|
||||||
|
public ExcelPropety TestData_Excel = ExcelPropety.CreateProperty<PrintConfig>(x => x.TestData);
|
||||||
|
|
||||||
|
protected override void InitVM()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public class PrintConfigImportVM : BaseImportVM<PrintConfigTemplateVM, PrintConfig>
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using WalkingTec.Mvvm.Core;
|
||||||
|
using WalkingTec.Mvvm.Core.Extensions;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using HHWMS.Web.Models;
|
||||||
|
|
||||||
|
|
||||||
|
namespace HHWMS.Web
|
||||||
|
{
|
||||||
|
public partial class PrintConfigListVM : BasePagedListVM<PrintConfig_View, PrintConfigSearcher>
|
||||||
|
{
|
||||||
|
protected override List<GridAction> InitGridAction()
|
||||||
|
{
|
||||||
|
return new List<GridAction>
|
||||||
|
{
|
||||||
|
this.MakeStandardAction("PrintConfig", GridActionStandardTypesEnum.Create, Localizer["Sys.Create"],"configs", dialogWidth: 800),
|
||||||
|
this.MakeStandardAction("PrintConfig", GridActionStandardTypesEnum.Edit, Localizer["Sys.Edit"], "configs", dialogWidth: 800),
|
||||||
|
this.MakeStandardAction("PrintConfig", GridActionStandardTypesEnum.Delete, Localizer["Sys.Delete"], "configs", dialogWidth: 800),
|
||||||
|
this.MakeStandardAction("PrintConfig", GridActionStandardTypesEnum.Details, Localizer["Sys.Details"], "configs", dialogWidth: 800),
|
||||||
|
this.MakeStandardAction("PrintConfig", GridActionStandardTypesEnum.BatchEdit, Localizer["Sys.BatchEdit"], "configs", dialogWidth: 800),
|
||||||
|
this.MakeStandardAction("PrintConfig", GridActionStandardTypesEnum.BatchDelete, Localizer["Sys.BatchDelete"], "configs", dialogWidth: 800),
|
||||||
|
this.MakeStandardAction("PrintConfig", GridActionStandardTypesEnum.Import, Localizer["Sys.Import"], "configs", dialogWidth: 800),
|
||||||
|
this.MakeStandardAction("PrintConfig", GridActionStandardTypesEnum.ExportExcel, Localizer["Sys.Export"], "configs"),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected override IEnumerable<IGridColumn<PrintConfig_View>> InitGridHeader()
|
||||||
|
{
|
||||||
|
return new List<GridColumn<PrintConfig_View>>{
|
||||||
|
this.MakeGridHeader(x => x.Name),
|
||||||
|
this.MakeGridHeader(x => x.Template),
|
||||||
|
this.MakeGridHeader(x => x.TestData),
|
||||||
|
this.MakeGridHeaderAction(width: 200)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public override IOrderedQueryable<PrintConfig_View> GetSearchQuery()
|
||||||
|
{
|
||||||
|
var query = DC.Set<PrintConfig>()
|
||||||
|
.CheckContain(Searcher.Name, x=>x.Name)
|
||||||
|
.Select(x => new PrintConfig_View
|
||||||
|
{
|
||||||
|
ID = x.ID,
|
||||||
|
Name = x.Name,
|
||||||
|
Template = x.Template,
|
||||||
|
TestData = x.TestData,
|
||||||
|
})
|
||||||
|
.OrderBy(x => x.ID);
|
||||||
|
return query;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public class PrintConfig_View : PrintConfig{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using WalkingTec.Mvvm.Core;
|
||||||
|
using WalkingTec.Mvvm.Core.Extensions;
|
||||||
|
using HHWMS.Web.Models;
|
||||||
|
|
||||||
|
|
||||||
|
namespace HHWMS.Web
|
||||||
|
{
|
||||||
|
public partial class PrintConfigSearcher : BaseSearcher
|
||||||
|
{
|
||||||
|
[Display(Name = "PrintConfig.Name")]
|
||||||
|
public String Name { get; set; }
|
||||||
|
|
||||||
|
protected override void InitVM()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using WalkingTec.Mvvm.Core;
|
||||||
|
using WalkingTec.Mvvm.Core.Extensions;
|
||||||
|
using HHWMS.Web.Models;
|
||||||
|
|
||||||
|
|
||||||
|
namespace HHWMS.Web
|
||||||
|
{
|
||||||
|
public partial class PrintConfigVM : BaseCRUDVM<PrintConfig>
|
||||||
|
{
|
||||||
|
|
||||||
|
public PrintConfigVM()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void InitVM()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void DoAdd()
|
||||||
|
{
|
||||||
|
base.DoAdd();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void DoEdit(bool updateAllFields = false)
|
||||||
|
{
|
||||||
|
base.DoEdit(updateAllFields);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void DoDelete()
|
||||||
|
{
|
||||||
|
base.DoDelete();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
@model HHWMS.Web.PrintConfigBatchVM
|
||||||
|
@inject IStringLocalizer<Program> Localizer;
|
||||||
|
|
||||||
|
<wt:form vm="@Model">
|
||||||
|
<wt:quote>@Localizer["Sys.BatchDeleteConfirm"]</wt:quote>
|
||||||
|
<wt:hidden field="Ids" />
|
||||||
|
<wt:grid vm="ListVM" use-local-data="true" height="300" hidden-checkbox="true" hidden-panel="true"/>
|
||||||
|
<wt:row align="AlignEnum.Right">
|
||||||
|
<wt:submitbutton theme=" ButtonThemeEnum.Warm" text="@Localizer["Sys.Delete"]"/>
|
||||||
|
<wt:closebutton />
|
||||||
|
</wt:row>
|
||||||
|
</wt:form>
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
@model HHWMS.Web.PrintConfigBatchVM
|
||||||
|
@inject IStringLocalizer<Program> Localizer;
|
||||||
|
|
||||||
|
<wt:form vm="@Model">
|
||||||
|
<div style="margin-bottom:10px">@Localizer["Sys.BatchEditConfirm"] </div>
|
||||||
|
<wt:row items-per-row="ItemsPerRowEnum.Two">
|
||||||
|
</wt:row>
|
||||||
|
<wt:hidden field="Ids" />
|
||||||
|
<wt:grid vm="ListVM" use-local-data="true" height="300" hidden-checkbox="true" hidden-panel="true"/>
|
||||||
|
<wt:row align="AlignEnum.Right">
|
||||||
|
<wt:submitbutton />
|
||||||
|
<wt:closebutton />
|
||||||
|
</wt:row>
|
||||||
|
</wt:form>
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
@model HHWMS.Web.PrintConfigVM
|
||||||
|
@inject IStringLocalizer<Program> Localizer;
|
||||||
|
|
||||||
|
<wt:form vm="@Model">
|
||||||
|
<wt:row items-per-row="ItemsPerRowEnum.Two">
|
||||||
|
<wt:textbox field="Entity.Name" />
|
||||||
|
<wt:textbox field="Entity.Template" />
|
||||||
|
<wt:textbox field="Entity.TestData" />
|
||||||
|
</wt:row>
|
||||||
|
<wt:row align="AlignEnum.Right">
|
||||||
|
<wt:submitbutton />
|
||||||
|
<wt:closebutton />
|
||||||
|
</wt:row>
|
||||||
|
</wt:form>
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
@model HHWMS.Web.PrintConfigVM
|
||||||
|
@inject IStringLocalizer<Program> Localizer;
|
||||||
|
|
||||||
|
<wt:form vm="@Model">
|
||||||
|
<wt:quote>@Localizer["Sys.DeleteConfirm"]</wt:quote>
|
||||||
|
<wt:row items-per-row="ItemsPerRowEnum.Two">
|
||||||
|
<wt:display field="Entity.Name" />
|
||||||
|
<wt:display field="Entity.Template" />
|
||||||
|
<wt:display field="Entity.TestData" />
|
||||||
|
</wt:row>
|
||||||
|
<wt:hidden field="Entity.ID" />
|
||||||
|
<wt:row align="AlignEnum.Right">
|
||||||
|
<wt:submitbutton theme=" ButtonThemeEnum.Warm" text="@Localizer["Sys.Delete"]"/>
|
||||||
|
<wt:closebutton />
|
||||||
|
</wt:row>
|
||||||
|
</wt:form>
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
@model HHWMS.Web.PrintConfigVM
|
||||||
|
@inject IStringLocalizer<Program> Localizer;
|
||||||
|
|
||||||
|
<wt:form vm="@Model">
|
||||||
|
<wt:row items-per-row="ItemsPerRowEnum.Two">
|
||||||
|
<wt:display field="Entity.Name" />
|
||||||
|
<wt:display field="Entity.Template" />
|
||||||
|
<wt:display field="Entity.TestData" />
|
||||||
|
</wt:row>
|
||||||
|
<wt:row align="AlignEnum.Right">
|
||||||
|
<wt:closebutton />
|
||||||
|
</wt:row>
|
||||||
|
</wt:form>
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
@model HHWMS.Web.PrintConfigVM
|
||||||
|
@inject IStringLocalizer<Program> Localizer;
|
||||||
|
|
||||||
|
<wt:form vm="@Model">
|
||||||
|
<wt:row items-per-row="ItemsPerRowEnum.Two">
|
||||||
|
<wt:textbox field="Entity.Name" />
|
||||||
|
<wt:textbox field="Entity.Template" />
|
||||||
|
<wt:textbox field="Entity.TestData" />
|
||||||
|
</wt:row>
|
||||||
|
<wt:hidden field="Entity.ID" />
|
||||||
|
<wt:row align="AlignEnum.Right">
|
||||||
|
<wt:submitbutton />
|
||||||
|
<wt:closebutton />
|
||||||
|
</wt:row>
|
||||||
|
</wt:form>
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
@model HHWMS.Web.PrintConfigImportVM
|
||||||
|
@inject IStringLocalizer<Program> Localizer;
|
||||||
|
|
||||||
|
<wt:form vm="@Model">
|
||||||
|
<wt:row align="AlignEnum.Right">
|
||||||
|
<wt:downloadTemplateButton vm="@Model" />
|
||||||
|
</wt:row>
|
||||||
|
<wt:upload field="UploadFileId" label-text="@Model.Localizer["Sys.UploadTemplate"]" upload-type="ExcelFile" />
|
||||||
|
<wt:grid vm="ErrorListVM" use-local-data="true" hidden-checkbox="true" hidden-grid-index="true" hidden-panel="true" height="300"/>
|
||||||
|
<wt:row align="AlignEnum.Right">
|
||||||
|
<wt:submitbutton />
|
||||||
|
<wt:closebutton />
|
||||||
|
</wt:row>
|
||||||
|
</wt:form>
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
@model HHWMS.Web.PrintConfigListVM
|
||||||
|
@inject IStringLocalizer<Program> Localizer;
|
||||||
|
|
||||||
|
<wt:searchpanel vm="@Model" reset-btn="true">
|
||||||
|
<wt:row items-per-row="ItemsPerRowEnum.Three">
|
||||||
|
<wt:textbox field="Searcher.Name" />
|
||||||
|
</wt:row>
|
||||||
|
</wt:searchpanel>
|
||||||
|
<wt:grid vm="@Model" url="/configs/PrintConfig/Search"/>
|
||||||
@@ -118,114 +118,6 @@ namespace HHWMS.Web.Controllers
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[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 header = _unitwork.FindSingle<ReceiptHeader>(x => x.ID == vm.Entity.ReceiptHeaderId);
|
|
||||||
if(header.FirstStatus != ReceiptStatusEnum.新建)
|
|
||||||
{
|
|
||||||
return FFResult().Alert("主单据不是新建状态,不能新建明细!");
|
|
||||||
}
|
|
||||||
var plList = vm.Entity.MaterialCode.Split("\n");
|
|
||||||
var slList = vm.Entity.Lot.Split("\n");
|
|
||||||
var detailList = new List<ReceiptDetail>();
|
|
||||||
foreach(var item in plList)
|
|
||||||
{
|
|
||||||
if (!string.IsNullOrEmpty(item))
|
|
||||||
{
|
|
||||||
detailList.Add(new ReceiptDetail
|
|
||||||
{
|
|
||||||
UniqueCode = item,
|
|
||||||
Status = 0,
|
|
||||||
ZoneCode = ZoneCodeEnum.盘料库,
|
|
||||||
ReceiptHeaderId = vm.Entity.ReceiptHeaderId
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (var item in slList)
|
|
||||||
{
|
|
||||||
if (!string.IsNullOrEmpty(item))
|
|
||||||
{
|
|
||||||
detailList.Add(new ReceiptDetail
|
|
||||||
{
|
|
||||||
UniqueCode = item,
|
|
||||||
ZoneCode = ZoneCodeEnum.散料库,
|
|
||||||
Status = 0,
|
|
||||||
ReceiptHeaderId = vm.Entity.ReceiptHeaderId
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
var uniqueGroup = detailList.GroupBy(x => x.UniqueCode);
|
|
||||||
|
|
||||||
if (uniqueGroup.Any(x => x.Count() > 1))
|
|
||||||
{
|
|
||||||
var codeList = uniqueGroup.Where(x => x.Count() > 1)
|
|
||||||
.Select(x => x.Key)
|
|
||||||
.ToList();
|
|
||||||
return FFResult().Alert($"新增明细中,存在重复的唯一码!{String.Join(", ", codeList.ToArray())}");
|
|
||||||
}
|
|
||||||
|
|
||||||
// 判断唯一码是否已在库内
|
|
||||||
var reDetailList = _unitwork.Find<ReceiptDetail>(x => x.Status == ReceiptStatusEnum.新建)
|
|
||||||
.Select(x => new { x.UniqueCode, x.ReceiptHeader.Code })
|
|
||||||
.ToList();
|
|
||||||
var reDel = reDetailList.Select(x => x.UniqueCode)
|
|
||||||
.Intersect(detailList.Select(x => x.UniqueCode));
|
|
||||||
if (reDel.Count() > 0)
|
|
||||||
{
|
|
||||||
var tt= reDetailList.Where(x => reDel.Contains(x.UniqueCode))
|
|
||||||
.ToList();
|
|
||||||
var returnStr = "";
|
|
||||||
foreach (var item in tt)
|
|
||||||
{
|
|
||||||
returnStr += $"单号:{item.Code};唯一码:{item.UniqueCode};";
|
|
||||||
}
|
|
||||||
return FFResult().Alert($"新增明细中,存在已添加的唯一码!{returnStr}");
|
|
||||||
}
|
|
||||||
|
|
||||||
// 判断唯一码是否已在库内
|
|
||||||
var invList = _unitwork.Find<Inventory>(x => 1 == 1)
|
|
||||||
.Select(x => x.UniqueCode)
|
|
||||||
.ToList();
|
|
||||||
if(invList.Intersect(detailList.Select(x => x.UniqueCode)).Count() > 0)
|
|
||||||
{
|
|
||||||
return FFResult().Alert("新增明细中,存在已在库内的唯一码!");
|
|
||||||
}
|
|
||||||
// 补充物料明细
|
|
||||||
foreach (var item in detailList)
|
|
||||||
{
|
|
||||||
var materialqr = _unitwork.FindSingle<MaterialQr>(x => x.UniqueCode.Equals(item.UniqueCode));
|
|
||||||
if(materialqr == null)
|
|
||||||
{
|
|
||||||
return FFResult().Alert("新增明细中,存在不是WMS生成的唯一码!");
|
|
||||||
}
|
|
||||||
var material = _unitwork.FindSingle<Material>(x => x.QRCode.Equals(materialqr.QRCode));
|
|
||||||
item.MaterialCode = material.MaterialCode;
|
|
||||||
item.MaterialName = material.MaterialName;
|
|
||||||
item.MaterialSpec = material.MaterialSpec;
|
|
||||||
item.MaterialType = material.MaterialType;
|
|
||||||
item.MaterialUnit = material.MaterialUnit;
|
|
||||||
item.Batch = material.Batch;
|
|
||||||
item.Qty = material.Qty;
|
|
||||||
item.SupplierCode = material.SupplierCode;
|
|
||||||
item.CreateBy = Wtm.LoginUserInfo.ITCode;
|
|
||||||
item.CreateTime = DateTime.Now;
|
|
||||||
}
|
|
||||||
_unitwork.BatchAdd(detailList.ToArray());
|
|
||||||
return FFResult().CloseDialog().RefreshGrid(index: 1);
|
|
||||||
}
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Edit
|
#region Edit
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ namespace HHWMS.Web
|
|||||||
public DbSet<ShipmentDetailHistory> ShipmentDetailHistories { get; set; }
|
public DbSet<ShipmentDetailHistory> ShipmentDetailHistories { get; set; }
|
||||||
public DbSet<ReportDesign> ReportDesigns { get; set; }
|
public DbSet<ReportDesign> ReportDesigns { get; set; }
|
||||||
public DbSet<Material> Materials { get; set; }
|
public DbSet<Material> Materials { get; set; }
|
||||||
public DbSet<MaterialQr> MaterialQrs { get; set; }
|
public DbSet<PrintConfig> PrintConfigs { get; set; }
|
||||||
public override async Task<bool> DataInit(object allModules, bool IsSpa)
|
public override async Task<bool> DataInit(object allModules, bool IsSpa)
|
||||||
{
|
{
|
||||||
var state = await base.DataInit(allModules, IsSpa);
|
var state = await base.DataInit(allModules, IsSpa);
|
||||||
|
|||||||
@@ -18,9 +18,13 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Remove="Migrations\**" />
|
<Compile Remove="Migrations\**" />
|
||||||
|
<Compile Remove="wwwroot\hiprint\vue-plugin-hiprint\**" />
|
||||||
<Content Remove="Migrations\**" />
|
<Content Remove="Migrations\**" />
|
||||||
|
<Content Remove="wwwroot\hiprint\vue-plugin-hiprint\**" />
|
||||||
<EmbeddedResource Remove="Migrations\**" />
|
<EmbeddedResource Remove="Migrations\**" />
|
||||||
|
<EmbeddedResource Remove="wwwroot\hiprint\vue-plugin-hiprint\**" />
|
||||||
<None Remove="Migrations\**" />
|
<None Remove="Migrations\**" />
|
||||||
|
<None Remove="wwwroot\hiprint\vue-plugin-hiprint\**" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|
||||||
@@ -47,9 +51,9 @@
|
|||||||
<PackageReference Include="System.ServiceModel.Http" Version="4.10.*" />
|
<PackageReference Include="System.ServiceModel.Http" Version="4.10.*" />
|
||||||
<PackageReference Include="System.ServiceModel.NetTcp" Version="4.10.*" />
|
<PackageReference Include="System.ServiceModel.NetTcp" Version="4.10.*" />
|
||||||
<PackageReference Include="System.ServiceModel.Security" Version="4.10.*" />
|
<PackageReference Include="System.ServiceModel.Security" Version="4.10.*" />
|
||||||
<PackageReference Include="WalkingTec.Mvvm.Core" Version="6.3.7-alpha" />
|
<PackageReference Include="WalkingTec.Mvvm.Core" Version="6.3.8-alpha" />
|
||||||
<PackageReference Include="WalkingTec.Mvvm.Mvc" Version="6.3.7-alpha" />
|
<PackageReference Include="WalkingTec.Mvvm.Mvc" Version="6.3.8-alpha" />
|
||||||
<PackageReference Include="WalkingTec.Mvvm.TagHelpers.LayUI" Version="6.3.7-alpha" />
|
<PackageReference Include="WalkingTec.Mvvm.TagHelpers.LayUI" Version="6.3.8-alpha" />
|
||||||
<PackageReference Include="Z.EntityFramework.Plus.EFCore" Version="6.102.1.1" />
|
<PackageReference Include="Z.EntityFramework.Plus.EFCore" Version="6.102.1.1" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|||||||
@@ -1,25 +0,0 @@
|
|||||||
using System.ComponentModel.DataAnnotations;
|
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
|
||||||
using WalkingTec.Mvvm.Core;
|
|
||||||
|
|
||||||
namespace HHWMS.Web.Models
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 物料二维码 唯一码对照表
|
|
||||||
/// </summary>
|
|
||||||
[Table("Materialqr")]
|
|
||||||
public class MaterialQr : BasePoco
|
|
||||||
{
|
|
||||||
[Key]
|
|
||||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
|
||||||
public new int ID { get; set; }
|
|
||||||
|
|
||||||
[Display(Name = "Inventory.QRCode", Description = "二维码")]
|
|
||||||
[StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
|
|
||||||
public string QRCode { get; set; }
|
|
||||||
|
|
||||||
[Display(Name = "Inventory.UniqueCode", Description = "唯一码")]
|
|
||||||
[StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
|
|
||||||
public string UniqueCode { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
using WalkingTec.Mvvm.Core;
|
||||||
|
|
||||||
|
namespace HHWMS.Web.Models
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 打印模板配置
|
||||||
|
/// </summary>
|
||||||
|
[Table("PrintConfig")]
|
||||||
|
public class PrintConfig : BasePoco
|
||||||
|
{
|
||||||
|
[Key]
|
||||||
|
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||||
|
public new int ID { get; set; }
|
||||||
|
|
||||||
|
[Display(Name = "PrintConfig.Name", Description = "名称")]
|
||||||
|
[Required(ErrorMessage = "Validate.{0}required")]
|
||||||
|
[StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
|
||||||
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
[Display(Name = "PrintConfig.Template", Description = "模板")]
|
||||||
|
[Required(ErrorMessage = "Validate.{0}required")]
|
||||||
|
public string Template { get; set; }
|
||||||
|
|
||||||
|
[Display(Name = "PrintConfig.TestData", Description = "测试数据")]
|
||||||
|
[Required(ErrorMessage = "Validate.{0}required")]
|
||||||
|
public string TestData { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1382,8 +1382,17 @@
|
|||||||
</data>
|
</data>
|
||||||
<data name="Inventory.ReturnToMes" xml:space="preserve">
|
<data name="Inventory.ReturnToMes" xml:space="preserve">
|
||||||
<value>回传</value>
|
<value>回传</value>
|
||||||
</data>Ship.ShipmentCode
|
</data>
|
||||||
<data name="Ship.ShipmentCode" xml:space="preserve">
|
<data name="Ship.ShipmentCode" xml:space="preserve">
|
||||||
<value>出库单号</value>
|
<value>出库单号</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="PrintConfig.Name" xml:space="preserve">
|
||||||
|
<value>名称</value>
|
||||||
|
</data>
|
||||||
|
<data name="PrintConfig.Template" xml:space="preserve">
|
||||||
|
<value>模板</value>
|
||||||
|
</data>
|
||||||
|
<data name="PrintConfig.TestData" xml:space="preserve">
|
||||||
|
<value>测试数据</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
@@ -65,50 +65,7 @@ namespace WebService
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
_wtm.DoLog("", ActionLogTypesEnum.Normal, "mes", request: outOrder);
|
_wtm.DoLog("", ActionLogTypesEnum.Normal, "mes", request: outOrder);
|
||||||
var data = JsonConvert.DeserializeObject<MesOut>(outOrder);
|
|
||||||
// 生成出库单和明细
|
|
||||||
var shipment = new ShipmentHeader
|
|
||||||
{
|
|
||||||
Code = _unitwork.GetSerialNumber("MO",4),
|
|
||||||
BillType = "out",
|
|
||||||
FirstStatus = ShipStatusEnum.新建,
|
|
||||||
ShipmentDetails = new List<ShipmentDetail>(),
|
|
||||||
CreateTime = DateTime.Now
|
|
||||||
};
|
|
||||||
foreach(var item in data.OUTWMS.OUTITEM)
|
|
||||||
{
|
|
||||||
var materialqr = _unitwork.FindSingle<MaterialQr>(x => x.UniqueCode.Equals(item.SN));
|
|
||||||
if (materialqr != null)
|
|
||||||
{
|
|
||||||
var material = _unitwork.FindSingle<Material>(x => x.QRCode.Equals(materialqr.QRCode));
|
|
||||||
|
|
||||||
var detail = new ShipmentDetail
|
|
||||||
{
|
|
||||||
UniqueCode = item.SN,
|
|
||||||
MaterialCode = material?.MaterialCode,
|
|
||||||
MaterialName = material?.MaterialName,
|
|
||||||
MaterialSpec = material?.MaterialSpec,
|
|
||||||
MaterialType = material?.MaterialType,
|
|
||||||
MaterialUnit = material?.MaterialUnit,
|
|
||||||
Batch = material?.Batch,
|
|
||||||
DividedQty = 0,
|
|
||||||
Qty = material?.Qty,
|
|
||||||
CompanyCode = item?.FACTORY,
|
|
||||||
ManufactureDate = Convert.ToDateTime(item.MESDATE),
|
|
||||||
Status = ShipStatusEnum.新建,
|
|
||||||
CreateTime = DateTime.Now
|
|
||||||
};
|
|
||||||
shipment.ShipmentDetails.Add(detail);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return new Result { Status = "N", Message = $"物料不存在库内!" };
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(shipment.ShipmentDetails.Count > 0)
|
|
||||||
{
|
|
||||||
_unitwork.Add(shipment);
|
|
||||||
}
|
|
||||||
return new Result();
|
return new Result();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
|||||||
@@ -22,17 +22,17 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
"Connections": [
|
"Connections": [
|
||||||
{
|
|
||||||
"Key": "default",
|
|
||||||
"Value": "Server=127.0.0.1;Port=3306;Database=8357wms;Uid=root;Password=abc123*;Character Set=utf8mb4;",
|
|
||||||
"DBType": "mysql"
|
|
||||||
},
|
|
||||||
//{
|
//{
|
||||||
// "Key": "default",
|
// "Key": "default",
|
||||||
// "Value": "Data Source=.;Initial Catalog=8357wms;User=sa;Password=abc123*;Persist Security Info=True",
|
// "Value": "Server=127.0.0.1;Port=3306;Database=8357wms;Uid=root;Password=abc123*;Character Set=utf8mb4;",
|
||||||
// "DbContext": "DataContext",
|
// "DBType": "mysql"
|
||||||
// "DBType": "sqlserver" //DataBase, you can choose mysql,sqlserver,pgsql,sqlite,oracle
|
//},
|
||||||
//}
|
{
|
||||||
|
"Key": "default",
|
||||||
|
"Value": "Data Source=.;Initial Catalog=8357wms;User=sa;Password=abc123*;Persist Security Info=True",
|
||||||
|
"DbContext": "DataContext",
|
||||||
|
"DBType": "sqlserver" //DataBase, you can choose mysql,sqlserver,pgsql,sqlite,oracle
|
||||||
|
}
|
||||||
//{
|
//{
|
||||||
// "Key": "default",
|
// "Key": "default",
|
||||||
// "Value": "Data Source=10.18.106.4;Initial Catalog=8357wms;User=wms;Password=abc123*;Persist Security Info=True",
|
// "Value": "Data Source=10.18.106.4;Initial Catalog=8357wms;User=wms;Password=abc123*;Persist Security Info=True",
|
||||||
|
|||||||
Reference in new issue
Block a user