添加客户管理

修改入库页面
修改 库存 物料 工序等页面
This commit is contained in:
zhougf committed 2025-07-25 04:35:31 +08:00
1 parent 2435176f77
commit c2b039ea47
41 files changed
+977 -160

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.configs.ViewModels.CustomerVMs;
namespace HHWMS.Web.Controllers
{
[Area("configs")]
[ActionDescription("客户管理")]
public partial class CustomerController : BaseController
{
private readonly IUnitWork _unitWork;
public CustomerController(IUnitWork unitWork)
{
_unitWork = unitWork;
}
#region Search
[ActionDescription("Sys.Search")]
public ActionResult Index()
{
var vm = Wtm.CreateVM<CustomerListVM>();
return PartialView(vm);
}
[ActionDescription("Sys.Search")]
[HttpPost]
public string Search(CustomerSearcher searcher)
{
var vm = Wtm.CreateVM<CustomerListVM>(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<CustomerVM>();
return PartialView(vm);
}
[HttpPost]
[ActionDescription("Sys.Create")]
public ActionResult Create(CustomerVM 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<CustomerVM>(id);
return PartialView(vm);
}
[ActionDescription("Sys.Edit")]
[HttpPost]
[ValidateFormItemOnly]
public ActionResult Edit(CustomerVM 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<CustomerVM>(id);
return PartialView(vm);
}
[ActionDescription("Sys.Delete")]
[HttpPost]
public ActionResult Delete(string id, IFormCollection nouse)
{
var vm = Wtm.CreateVM<CustomerVM>(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<CustomerVM>(id);
return PartialView(vm);
}
#endregion
#region BatchEdit
[HttpPost]
[ActionDescription("Sys.BatchEdit")]
public ActionResult BatchEdit(string[] IDs)
{
var vm = Wtm.CreateVM<CustomerBatchVM>(Ids: IDs);
return PartialView(vm);
}
[HttpPost]
[ActionDescription("Sys.BatchEdit")]
public ActionResult DoBatchEdit(CustomerBatchVM 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<CustomerBatchVM>(Ids: IDs);
return PartialView(vm);
}
[HttpPost]
[ActionDescription("Sys.BatchDelete")]
public ActionResult DoBatchDelete(CustomerBatchVM 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<CustomerImportVM>();
return PartialView(vm);
}
[HttpPost]
[ActionDescription("Sys.Import")]
public ActionResult Import(CustomerImportVM 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(CustomerListVM 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.configs.ViewModels.CustomerVMs
{
public partial class CustomerBatchVM : BaseBatchVM<Customer, Customer_BatchEdit>
{
public CustomerBatchVM()
{
ListVM = new CustomerListVM();
LinkedVM = new Customer_BatchEdit();
}
}
/// <summary>
/// Class to define batch edit fields
/// </summary>
public class Customer_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.configs.ViewModels.CustomerVMs
{
public partial class CustomerTemplateVM : BaseTemplateVM
{
[Display(Name = "Location.ZoneCode")]
public ExcelPropety Code_Excel = ExcelPropety.CreateProperty<Customer>(x => x.Code);
[Display(Name = "Location.ZoneName")]
public ExcelPropety Type_Excel = ExcelPropety.CreateProperty<Customer>(x => x.Type);
[Display(Name = "Customer.ZoneName")]
public ExcelPropety Name_Excel = ExcelPropety.CreateProperty<Customer>(x => x.Name);
protected override void InitVM()
{
}
}
public class CustomerImportVM : BaseImportVM<CustomerTemplateVM, Customer>
{
}
}
@@ -0,0 +1,64 @@
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.configs.ViewModels.CustomerVMs
{
public partial class CustomerListVM : BasePagedListVM<Customer_View, CustomerSearcher>
{
protected override List<GridAction> InitGridAction()
{
return new List<GridAction>
{
this.MakeStandardAction("Customer", GridActionStandardTypesEnum.Create, Localizer["Sys.Create"],"configs", dialogWidth: 800),
this.MakeStandardAction("Customer", GridActionStandardTypesEnum.Edit, Localizer["Sys.Edit"], "configs", dialogWidth: 800),
this.MakeStandardAction("Customer", GridActionStandardTypesEnum.Delete, Localizer["Sys.Delete"], "configs", dialogWidth: 800),
this.MakeStandardAction("Customer", GridActionStandardTypesEnum.Details, Localizer["Sys.Details"], "configs", dialogWidth: 800),
this.MakeStandardAction("Customer", GridActionStandardTypesEnum.BatchEdit, Localizer["Sys.BatchEdit"], "configs", dialogWidth: 800),
this.MakeStandardAction("Customer", GridActionStandardTypesEnum.BatchDelete, Localizer["Sys.BatchDelete"], "configs", dialogWidth: 800),
this.MakeStandardAction("Customer", GridActionStandardTypesEnum.Import, Localizer["Sys.Import"], "configs", dialogWidth: 800),
this.MakeStandardAction("Customer", GridActionStandardTypesEnum.ExportExcel, Localizer["Sys.Export"], "configs"),
};
}
protected override IEnumerable<IGridColumn<Customer_View>> InitGridHeader()
{
return new List<GridColumn<Customer_View>>{
this.MakeGridHeader(x => x.Code),
this.MakeGridHeader(x => x.Type),
this.MakeGridHeader(x => x.Name),
this.MakeGridHeaderAction(width: 200)
};
}
public override IOrderedQueryable<Customer_View> GetSearchQuery()
{
var query = DC.Set<Customer>()
.CheckContain(Searcher.Code, x=>x.Code)
.CheckContain(Searcher.Type, x=>x.Type)
.CheckContain(Searcher.Name, x=>x.Name)
.Select(x => new Customer_View
{
ID = x.ID,
Code = x.Code,
Type = x.Type,
Name = x.Name,
})
.OrderBy(x => x.ID);
return query;
}
}
public class Customer_View : Customer{
}
}
@@ -0,0 +1,27 @@
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.configs.ViewModels.CustomerVMs
{
public partial class CustomerSearcher : BaseSearcher
{
[Display(Name = "Customer.Code")]
public String Code { get; set; }
[Display(Name = "Customer.Type")]
public String Type { get; set; }
[Display(Name = "Customer.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.configs.ViewModels.CustomerVMs
{
public partial class CustomerVM : BaseCRUDVM<Customer>
{
public CustomerVM()
{
}
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();
}
}
}
@@ -429,7 +429,6 @@ namespace HHWMS.Web
string code = moveloc.Data.Code;
var movelocation = _unitWork.FindSingle<Location>(x => x.Code == code);
// 生成outter移库任务
var outterTask = new TaskHeader()
{
@@ -466,18 +465,16 @@ namespace HHWMS.Web
}
// 下发任务到wcs
// 成品库下发WCS入库,目的仓位给固定WareCell
var postData = new
{
TaskNo = task.TaskNo,
PalletNo = task.ContainerCode,
FromLocation = task.FromLocation,
ToLocation = task.ToLocation
ToLocation = (task.TaskType == TaskTypeEnum.入库 && task.ZoneId != 1027) ? "WareCell" : task.ToLocation
};
task.Status = TaskStatusEnum.已下发;
task.UpdateTime = DateTime.Now;
task.UpdateBy = "WMS";
_unitWork.Add(task);
/*try
try
{
var domain = task.ZoneId == 1027 ? "WCSXB" : "WCSCP";
var res = Wtm.CallAPI<ApiJsonResult<dynamic>>(domain, "TaskAssign", HttpMethodEnum.POST, postData)
@@ -500,7 +497,7 @@ namespace HHWMS.Web
{
task.ErrorMsg = ex.Message;
return ResponseResult<dynamic>.Error("任务下发失败!");
}*/
}
return ResponseResult<dynamic>.Success();
}
@@ -20,6 +20,8 @@ namespace HHWMS.Web
public ExcelPropety ProcessName_Excel = ExcelPropety.CreateProperty<MaterialProcess>(x => x.ProcessName);
[Display(Name = "MaterialProcess.ProcessCode")]
public ExcelPropety ProcessCode_Excel = ExcelPropety.CreateProperty<MaterialProcess>(x => x.ProcessCode);
[Display(Name = "MaterialProcess.Weight")]
public ExcelPropety Weight_Excel = ExcelPropety.CreateProperty<MaterialProcess>(x => x.Weight);
[Display(Name = "MaterialProcess.Description")]
public ExcelPropety Description_Excel = ExcelPropety.CreateProperty<MaterialProcess>(x => x.Description);
[Display(Name = "MaterialProcess.IsActive")]
@@ -36,6 +36,7 @@ namespace HHWMS.Web
this.MakeGridHeader(x => x.ProcessOrder),
this.MakeGridHeader(x => x.ProcessName),
this.MakeGridHeader(x => x.ProcessCode),
this.MakeGridHeader(x => x.Weight),
this.MakeGridHeader(x => x.Description),
this.MakeGridHeader(x => x.IsActive),
this.MakeGridHeaderAction(width: 200)
@@ -49,7 +50,9 @@ namespace HHWMS.Web
.CheckEqual(Searcher.ProcessOrder, x=>x.ProcessOrder)
.CheckContain(Searcher.ProcessName, x=>x.ProcessName)
.CheckContain(Searcher.ProcessCode, x=>x.ProcessCode)
.CheckEqual(Searcher.Weight, x=>x.Weight)
.CheckContain(Searcher.Description, x=>x.Description)
.CheckEqual(Searcher.IsActive, x=>x.IsActive)
.Select(x => new MaterialProcess_View
{
ID = x.ID,
@@ -57,6 +60,7 @@ namespace HHWMS.Web
ProcessOrder = x.ProcessOrder,
ProcessName = x.ProcessName,
ProcessCode = x.ProcessCode,
Weight = x.Weight,
Description = x.Description,
IsActive = x.IsActive,
})
@@ -20,8 +20,12 @@ namespace HHWMS.Web
public String ProcessName { get; set; }
[Display(Name = "MaterialProcess.ProcessCode")]
public String ProcessCode { get; set; }
[Display(Name = "MaterialProcess.Weight")]
public Int32? Weight { get; set; }
[Display(Name = "MaterialProcess.Description")]
public String Description { get; set; }
[Display(Name = "MaterialProcess.IsActive")]
public Boolean? IsActive { get; set; }
protected override void InitVM()
{
@@ -17,33 +17,7 @@
<script>
let template =
{
"panels": [{
"index": 0,
"height": 60,
"width": 100,
"paperHeader": 43.5,
"paperFooter": 170.07874015748033,
"printElements": [{
"options": {
"left": 18,
"top": 25.5,
"height": 106.5,
"width": 246,
"title": "code",
"testData": "",
"field": "code",
"fontSize": 18,
"textAlign": "center",
"lineHeight": 24,
"textType": "barcode"
}, "printElementType": {"type": "text"}
}],
"paperNumberLeft": 258,
"paperNumberTop": 144,
"paperNumberDisabled": true
}]
};
{"panels":[{"index":0,"height":60,"width":100,"paperHeader":43.5,"paperFooter":170.07874015748033,"printElements":[{"options":{"left":55.5,"top":25.5,"height":106.5,"width":142.5,"title":"code","testData":"C0006","field":"code","fontSize":18,"textAlign":"center","lineHeight":24,"textType":"barcode"},"printElementType":{"type":"text"}}],"paperNumberLeft":258,"paperNumberTop":144,"paperNumberDisabled":true}]};
let printData = [];
@@ -0,0 +1,12 @@
@model HHWMS.Web.configs.ViewModels.CustomerVMs.CustomerBatchVM
@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.configs.ViewModels.CustomerVMs.CustomerBatchVM
@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.configs.ViewModels.CustomerVMs.CustomerVM
@inject IStringLocalizer<Program> Localizer;
<wt:form vm="@Model">
<wt:row items-per-row="ItemsPerRowEnum.Two">
<wt:textbox field="Entity.Code" />
<wt:textbox field="Entity.Type" />
<wt:textbox field="Entity.Name" />
</wt:row>
<wt:row align="AlignEnum.Right">
<wt:submitbutton />
<wt:closebutton />
</wt:row>
</wt:form>
@@ -0,0 +1,16 @@
@model HHWMS.Web.configs.ViewModels.CustomerVMs.CustomerVM
@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.Code" />
<wt:display field="Entity.Type" />
<wt:display field="Entity.Name" />
</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.configs.ViewModels.CustomerVMs.CustomerVM
@inject IStringLocalizer<Program> Localizer;
<wt:form vm="@Model">
<wt:row items-per-row="ItemsPerRowEnum.Two">
<wt:display field="Entity.Code" />
<wt:display field="Entity.Type" />
<wt:display field="Entity.Name" />
</wt:row>
<wt:row align="AlignEnum.Right">
<wt:closebutton />
</wt:row>
</wt:form>
@@ -0,0 +1,15 @@
@model HHWMS.Web.configs.ViewModels.CustomerVMs.CustomerVM
@inject IStringLocalizer<Program> Localizer;
<wt:form vm="@Model">
<wt:row items-per-row="ItemsPerRowEnum.Two">
<wt:textbox field="Entity.Code" />
<wt:textbox field="Entity.Type" />
<wt:textbox field="Entity.Name" />
</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.configs.ViewModels.CustomerVMs.CustomerImportVM
@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,11 @@
@model HHWMS.Web.configs.ViewModels.CustomerVMs.CustomerListVM
@inject IStringLocalizer<Program> Localizer;
<wt:searchpanel vm="@Model" reset-btn="true">
<wt:row items-per-row="ItemsPerRowEnum.Three">
<wt:textbox field="Searcher.Code" />
<wt:textbox field="Searcher.Type" />
<wt:textbox field="Searcher.Name" />
</wt:row>
</wt:searchpanel>
<wt:grid vm="@Model" url="/configs/Customer/Search"/>
@@ -7,6 +7,7 @@
<wt:textbox field="Entity.ProcessOrder" />
<wt:textbox field="Entity.ProcessName" />
<wt:textbox field="Entity.ProcessCode" />
<wt:textbox field="Entity.Weight" />
<wt:textbox field="Entity.Description" />
<wt:switch field="Entity.IsActive" />
</wt:row>
@@ -8,6 +8,7 @@
<wt:display field="Entity.ProcessOrder" />
<wt:display field="Entity.ProcessName" />
<wt:display field="Entity.ProcessCode" />
<wt:display field="Entity.Weight" />
<wt:display field="Entity.Description" />
<wt:display field="Entity.IsActive" />
</wt:row>
@@ -7,6 +7,7 @@
<wt:display field="Entity.ProcessOrder" />
<wt:display field="Entity.ProcessName" />
<wt:display field="Entity.ProcessCode" />
<wt:display field="Entity.Weight" />
<wt:display field="Entity.Description" />
<wt:display field="Entity.IsActive" />
</wt:row>
@@ -7,6 +7,7 @@
<wt:textbox field="Entity.ProcessOrder" />
<wt:textbox field="Entity.ProcessName" />
<wt:textbox field="Entity.ProcessCode" />
<wt:textbox field="Entity.Weight" />
<wt:textbox field="Entity.Description" />
<wt:switch field="Entity.IsActive" />
</wt:row>
@@ -7,7 +7,9 @@
<wt:textbox field="Searcher.ProcessOrder" />
<wt:textbox field="Searcher.ProcessName" />
<wt:textbox field="Searcher.ProcessCode" />
<wt:textbox field="Searcher.Weight" />
<wt:textbox field="Searcher.Description" />
<wt:combobox field="Searcher.IsActive" empty-text="@Localizer["Sys.All"]" />
</wt:row>
</wt:searchpanel>
<wt:grid vm="@Model" url="/configs/MaterialProcess/Search"/>