添加库位监控

库存 库位 添加zone权限管控
This commit is contained in:
zhougf committed 2025-05-13 17:26:39 +08:00
1 parent b005422b01
commit e90e0db019
43 files changed
+536 -479

No files matched your search

@@ -1,5 +1,12 @@
using HHWMS.Web.Models;
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
{
@@ -10,15 +17,19 @@ namespace HHWMS.Web
ListVM = new InventoryListVM();
LinkedVM = new Inventory_BatchEdit();
}
}
/// <summary>
/// <summary>
/// Class to define batch edit fields
/// </summary>
public class Inventory_BatchEdit : BaseVM
{
protected override void InitVM()
{
}
}
}
@@ -1,80 +1,72 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using HHWMS.Web.Models;
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 InventoryTemplateVM : BaseTemplateVM
{
[Display(Name = "Task.ZoneCode")]
public ExcelPropety ZoneCode_Excel = ExcelPropety.CreateProperty<Inventory>(x => x.ZoneCode);
public ExcelPropety Zone_Excel = ExcelPropety.CreateProperty<Inventory>(x => x.ZoneId);
[Display(Name = "Task.ContainerCode")]
public ExcelPropety ContainerCode_Excel = ExcelPropety.CreateProperty<Inventory>(x => x.ContainerCode);
[Display(Name = "Container.LocationCode")]
public ExcelPropety LocationCode_Excel = ExcelPropety.CreateProperty<Inventory>(x => x.LocationCode);
[Display(Name = "Inventory.MaterialCode")]
public ExcelPropety MaterialCode_Excel = ExcelPropety.CreateProperty<Inventory>(x => x.MaterialCode);
[Display(Name = "Inventory.MaterialType")]
public ExcelPropety MaterialType_Excel = ExcelPropety.CreateProperty<Inventory>(x => x.MaterialType);
[Display(Name = "Inventory.MaterialName")]
public ExcelPropety MaterialName_Excel = ExcelPropety.CreateProperty<Inventory>(x => x.MaterialName);
[Display(Name = "Inventory.MaterialSpec")]
public ExcelPropety MaterialSpec_Excel = ExcelPropety.CreateProperty<Inventory>(x => x.MaterialSpec);
[Display(Name = "Inventory.MaterialUnit")]
public ExcelPropety MaterialUnit_Excel = ExcelPropety.CreateProperty<Inventory>(x => x.MaterialUnit);
[Display(Name = "Inventory.Batch")]
public ExcelPropety Batch_Excel = ExcelPropety.CreateProperty<Inventory>(x => x.Batch);
[Display(Name = "Inventory.Lot")]
public ExcelPropety Lot_Excel = ExcelPropety.CreateProperty<Inventory>(x => x.Lot);
[Display(Name = "Inventory.ManufactureDate")]
public ExcelPropety ManufactureDate_Excel = ExcelPropety.CreateProperty<Inventory>(x => x.ManufactureDate);
[Display(Name = "Inventory.ExpirationDate")]
public ExcelPropety ExpirationDate_Excel = ExcelPropety.CreateProperty<Inventory>(x => x.ExpirationDate);
[Display(Name = "Inventory.CompanyCode")]
public ExcelPropety CompanyCode_Excel = ExcelPropety.CreateProperty<Inventory>(x => x.CompanyCode);
[Display(Name = "Inventory.SupplierCode")]
public ExcelPropety SupplierCode_Excel = ExcelPropety.CreateProperty<Inventory>(x => x.SupplierCode);
[Display(Name = "Inventory.TaskQty")]
public ExcelPropety TaskQty_Excel = ExcelPropety.CreateProperty<Inventory>(x => x.TaskQty);
[Display(Name = "Inventory.Qty")]
public ExcelPropety Qty_Excel = ExcelPropety.CreateProperty<Inventory>(x => x.Qty);
[Display(Name = "Inventory.SourceCode")]
public ExcelPropety SourceCode_Excel = ExcelPropety.CreateProperty<Inventory>(x => x.SourceCode);
[Display(Name = "Inventory.ReceiptCode")]
public ExcelPropety ReceiptCode_Excel = ExcelPropety.CreateProperty<Inventory>(x => x.ReceiptCode);
[Display(Name = "Inventory.ReceiptDetailId")]
public ExcelPropety ReceiptDetailId_Excel = ExcelPropety.CreateProperty<Inventory>(x => x.ReceiptDetailId);
[Display(Name = "Inventory.Status")]
public ExcelPropety Status_Excel = ExcelPropety.CreateProperty<Inventory>(x => x.Status);
[Display(Name = "Inventory.TaskStatus")]
public ExcelPropety TaskStatus_Excel = ExcelPropety.CreateProperty<Inventory>(x => x.TaskStatus);
[Display(Name = "Inventory.Flag")]
public ExcelPropety Flag_Excel = ExcelPropety.CreateProperty<Inventory>(x => x.Flag);
protected override void InitVM()
protected override void InitVM()
{
Zone_Excel.DataType = ColumnDataType.ComboBox;
Zone_Excel.ListItems = DC.Set<LocationZone>().GetSelectListItems(Wtm, y => y.Name);
}
}
public class InventoryImportVM : BaseImportVM<InventoryTemplateVM, Inventory>
{
}
}
@@ -1,30 +1,23 @@
using System;
using System.Collections.Generic;
using System.Linq;
using HHWMS.Web.Models;
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 InventoryListVM : BasePagedListVM<Inventory_View, InventorySearcher>
{
public List<ComboSelectListItem> ZoneCodes { get; set; }
public List<ComboSelectListItem> InventoryTaskStatus { get; set; }
protected override void InitVM()
{
var vm = Wtm.CreateVM<InventoryVM>();
ZoneCodes = vm.ZoneCodes;
InventoryTaskStatus = vm.InventoryTaskStatus;
}
protected override List<GridAction> InitGridAction()
{
if (SearcherMode != ListVMSearchModeEnum.MasterDetail)
{
return new List<GridAction>
return new List<GridAction>
{
this.MakeStandardAction("Inventory", GridActionStandardTypesEnum.Create, Localizer["Sys.Create"],"inventory", dialogWidth: 800),
this.MakeAction("Inventory","ReturnToMes",Localizer["Inventory.ReturnToMes"],Localizer["Inventory.ReturnToMes"],GridActionParameterTypesEnum.SingleId,"inventory"),
this.MakeStandardAction("Inventory", GridActionStandardTypesEnum.Edit, Localizer["Sys.Edit"], "inventory", dialogWidth: 800),
this.MakeStandardAction("Inventory", GridActionStandardTypesEnum.Delete, Localizer["Sys.Delete"], "inventory", dialogWidth: 800),
this.MakeStandardAction("Inventory", GridActionStandardTypesEnum.Details, Localizer["Sys.Details"], "inventory", dialogWidth: 800),
@@ -33,97 +26,54 @@ namespace HHWMS.Web
this.MakeStandardAction("Inventory", GridActionStandardTypesEnum.Import, Localizer["Sys.Import"], "inventory", dialogWidth: 800),
this.MakeStandardAction("Inventory", GridActionStandardTypesEnum.ExportExcel, Localizer["Sys.Export"], "inventory"),
};
}
else
{
return new List<GridAction>
{
this.MakeStandardAction("Inventory", GridActionStandardTypesEnum.Details, Localizer["Sys.Details"], "inventory", dialogWidth: 800),
};
}
}
protected override IEnumerable<IGridColumn<Inventory_View>> InitGridHeader()
{
InitVM();
if (SearcherMode != ListVMSearchModeEnum.MasterDetail)
{
return new List<GridColumn<Inventory_View>>{
this.MakeGridHeader(x => x.ZoneCode)
.SetFormat((a, b) =>
{
var data = ZoneCodes.FirstOrDefault(x => x.Value.ToString() == a.ZoneCode);
return data?.Text ?? a.ZoneCode;
}),
this.MakeGridHeader(x => x.ContainerCode).SetHide(),
return new List<GridColumn<Inventory_View>>{
this.MakeGridHeader(x => x.Name_view),
this.MakeGridHeader(x => x.ContainerCode),
this.MakeGridHeader(x => x.LocationCode),
this.MakeGridHeader(x => x.MaterialCode),
this.MakeGridHeader(x => x.MaterialType),
this.MakeGridHeader(x => x.MaterialName),
this.MakeGridHeader(x => x.MaterialSpec),
this.MakeGridHeader(x => x.MaterialSpec).SetHide(),
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.TaskQty).SetHide(),
this.MakeGridHeader(x => x.Lot).SetHide(),
this.MakeGridHeader(x => x.ManufactureDate).SetHide(),
this.MakeGridHeader(x => x.ExpirationDate).SetHide(),
this.MakeGridHeader(x => x.CompanyCode).SetHide(),
this.MakeGridHeader(x => x.SupplierCode).SetHide(),
this.MakeGridHeader(x => x.TaskQty),
this.MakeGridHeader(x => x.Qty),
//this.MakeGridHeader(x => x.SourceCode),
//this.MakeGridHeader(x => x.ReceiptCode),
//this.MakeGridHeader(x => x.ReceiptDetailId),
//this.MakeGridHeader(x => x.Status),
this.MakeGridHeader(x => x.TaskStatus)
.SetFormat((a, b) =>
{
var data = InventoryTaskStatus.FirstOrDefault(x => x.Value.ToString() == a.TaskStatus);
return data?.Text ?? a.TaskStatus;
}),
this.MakeGridHeader(x => x.SourceCode).SetHide(),
this.MakeGridHeader(x => x.ReceiptCode).SetHide(),
this.MakeGridHeader(x => x.ReceiptDetailId).SetHide(),
this.MakeGridHeader(x => x.Status),
this.MakeGridHeader(x => x.TaskStatus),
this.MakeGridHeaderAction(width: 200)
};
}
else
{
return new List<GridColumn<Inventory_View>>{
//this.MakeGridHeader(x => x.ZoneCode),
//this.MakeGridHeader(x => x.ContainerCode),
//this.MakeGridHeader(x => x.LocationCode),
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.SupplierCode),
//this.MakeGridHeader(x => x.TaskQty),
this.MakeGridHeader(x => x.Qty),
//this.MakeGridHeader(x => x.Status),
this.MakeGridHeader(x => x.TaskStatus),
//this.MakeGridHeaderAction(width: 50)
};
}
}
public override IOrderedQueryable<Inventory_View> GetSearchQuery()
{
var query = DC.Set<Inventory>()
.CheckContain(Searcher.ZoneCode, x => x.ZoneCode)
.CheckContain(Searcher.LocationCode, x => x.LocationCode)
.CheckContain(Searcher.MaterialCode, x => x.MaterialCode)
.CheckContain(Searcher.MaterialType, x => x.MaterialType)
.CheckContain(Searcher.MaterialName, x => x.MaterialName)
.CheckContain(Searcher.MaterialSpec, x => x.MaterialSpec)
.CheckContain(Searcher.MaterialUnit, x => x.MaterialUnit)
.CheckContain(Searcher.Batch, x => x.Batch)
.CheckContain(Searcher.Lot, x => x.Lot)
.CheckContain(Searcher.SourceCode, x => x.SourceCode)
.CheckContain(Searcher.ReceiptCode, x => x.ReceiptCode)
.CheckContain(Searcher.Status, x => x.Status)
.CheckEqual(Searcher.ZoneId, x=>x.ZoneId)
.CheckContain(Searcher.ContainerCode, x=>x.ContainerCode)
.CheckContain(Searcher.MaterialCode, x=>x.MaterialCode)
.CheckContain(Searcher.MaterialType, x=>x.MaterialType)
.CheckContain(Searcher.MaterialName, x=>x.MaterialName)
.CheckContain(Searcher.Batch, x=>x.Batch)
.CheckContain(Searcher.ReceiptCode, x=>x.ReceiptCode)
.CheckContain(Searcher.Status, x=>x.Status)
.CheckEqual(Searcher.TaskStatus, x=>x.TaskStatus)
.DPWhere(Wtm,x => x.ZoneId)
.Select(x => new Inventory_View
{
ID = x.ID,
ZoneCode = x.ZoneCode,
ID = x.ID,
Name_view = x.Zone.Name,
ContainerCode = x.ContainerCode,
LocationCode = x.LocationCode,
MaterialCode = x.MaterialCode,
@@ -133,9 +83,9 @@ namespace HHWMS.Web
MaterialUnit = x.MaterialUnit,
Batch = x.Batch,
Lot = x.Lot,
//ManufactureDate = x.ManufactureDate,
//ExpirationDate = x.ExpirationDate,
//CompanyCode = x.CompanyCode,
ManufactureDate = x.ManufactureDate,
ExpirationDate = x.ExpirationDate,
CompanyCode = x.CompanyCode,
SupplierCode = x.SupplierCode,
TaskQty = x.TaskQty,
Qty = x.Qty,
@@ -144,13 +94,17 @@ namespace HHWMS.Web
ReceiptDetailId = x.ReceiptDetailId,
Status = x.Status,
TaskStatus = x.TaskStatus,
Flag = x.Flag,
})
.OrderBy(x => x.ID);
return query;
}
}
public class Inventory_View : Inventory
{
public class Inventory_View : Inventory{
[Display(Name = "Location.ZoneName")]
public String Name_view { get; set; }
}
}
@@ -1,46 +1,40 @@
using System;
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;
using HHWMS.Web.Models;
namespace HHWMS.Web
{
public partial class InventorySearcher : BaseSearcher
{
[Display(Name = "Task.ZoneCode")]
public String ZoneCode { get; set; }
[Display(Name = "Inventory.LocationCode")]
public String LocationCode { get; set; }
[Display(Name = "Inventory.UniqueCode")]
public String UniqueCode { get; set; }
public List<ComboSelectListItem> AllZones { get; set; }
[Display(Name = "Location.ZoneName")]
public int? ZoneId { get; set; }
[Display(Name = "Task.ContainerCode")]
public String ContainerCode { get; set; }
[Display(Name = "Inventory.MaterialCode")]
public String MaterialCode { get; set; }
[Display(Name = "Inventory.MaterialType")]
public String MaterialType { get; set; }
[Display(Name = "Inventory.MaterialName")]
public String MaterialName { get; set; }
[Display(Name = "Inventory.MaterialSpec")]
public String MaterialSpec { get; set; }
[Display(Name = "Inventory.MaterialUnit")]
public String MaterialUnit { get; set; }
[Display(Name = "Inventory.Batch")]
public String Batch { get; set; }
[Display(Name = "Inventory.Lot")]
public String Lot { get; set; }
[Display(Name = "Inventory.SourceCode")]
public String SourceCode { get; set; }
[Display(Name = "Inventory.ReceiptCode")]
public String ReceiptCode { get; set; }
[Display(Name = "Inventory.Status")]
public String Status { get; set; }
[Display(Name = "Inventory.TaskStatus")]
public InventoryTaskStatusEnum? TaskStatus { get; set; }
protected override void InitVM()
{
AllZones = DC.Set<LocationZone>().GetSelectListItems(Wtm, y => y.Name);
}
}
@@ -1,39 +1,27 @@
using System;
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;
using HHWMS.Web.Models;
namespace HHWMS.Web
{
public partial class InventoryVM : BaseCRUDVM<Inventory>
{
public List<ComboSelectListItem> ZoneCodes { get; set; }
public List<ComboSelectListItem> InventoryTaskStatus { get; set; }
public List<ComboSelectListItem> AllZones { get; set; }
public InventoryVM()
{
SetInclude(x => x.Zone);
}
protected override void InitVM()
{
var CurrentCulture = Wtm.CurrentCulture;
var dictDatas = DC.Set<SysDictData>().ToList();
ZoneCodes = dictDatas.Where(x => x.DictType == "ZoneCode").Select(x => new ComboSelectListItem
{
Text = CurrentCulture == "zh" ? x.DictLabel : x.DictLabelUs,
Value = x.DictValue
}).ToList();
InventoryTaskStatus = dictDatas.Where(x => x.DictType == "InventoryTaskStatus").Select(x => new ComboSelectListItem
{
Text = CurrentCulture == "zh" ? x.DictLabel : x.DictLabelUs,
Value = x.DictValue
}).ToList();
AllZones = DC.Set<LocationZone>().GetSelectListItems(Wtm, y => y.Name);
}
public override void DoAdd()