添加库位监控
库存 库位 添加zone权限管控
No files matched your search
@@ -133,6 +133,11 @@ namespace HHWMS.Web
|
||||
{
|
||||
return Task.FromResult<IActionResult>(ApiResultError("容器编码不能为空"));
|
||||
}
|
||||
|
||||
if (!request.RoadWay.HasValue)
|
||||
{
|
||||
return Task.FromResult<IActionResult>(ApiResultError("巷道不能为空"));
|
||||
}
|
||||
|
||||
return WithDebounce($"RequestLocation_{request.PalletNo}", () =>
|
||||
{
|
||||
|
||||
@@ -260,7 +260,7 @@ namespace HHWMS.Web.Controllers
|
||||
locationList.Add(new Location
|
||||
{
|
||||
Code = $"{vm.Entity.Type}{vm.Entity.RoadWay.ToString().PadLeft(2, '0')}-{row.ToString().PadLeft(2, '0')}-{line.ToString().PadLeft(2, '0')}-{layer.ToString().PadLeft(2, '0')}",
|
||||
LocationZoneId = vm.Entity.LocationZoneId,
|
||||
ZoneId = vm.Entity.ZoneId,
|
||||
Type = vm.Entity.Type,
|
||||
RoadWay = vm.Entity.RoadWay,
|
||||
Row = row,
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Collections.Generic;
|
||||
using WalkingTec.Mvvm.Core;
|
||||
using WalkingTec.Mvvm.Mvc;
|
||||
|
||||
namespace HHWMS.Web.Controllers
|
||||
{
|
||||
[Area("configs")]
|
||||
[ActionDescription("库位监控")]
|
||||
public partial class LocationMonitorController : BaseController
|
||||
{
|
||||
[ActionDescription("二维监控")]
|
||||
public IActionResult Index()
|
||||
{
|
||||
var vm = Wtm.CreateVM<LocationMonitor2DVM>();
|
||||
return PartialView(vm);
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public IActionResult GetAreas()
|
||||
{
|
||||
var vm = Wtm.CreateVM<LocationMonitor2DVM>();
|
||||
return Json(vm.GetAreas());
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public IActionResult GetRows([FromQuery]int area)
|
||||
{
|
||||
var vm = Wtm.CreateVM<LocationMonitor2DVM>();
|
||||
return Json(vm.GetRows(area));
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public IActionResult GetLocationsByAreaAndRow([FromQuery]int area, short row)
|
||||
{
|
||||
var vm = Wtm.CreateVM<LocationMonitor2DVM>();
|
||||
return Json(vm.GetLocationsByAreaAndRow(area, row));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using WalkingTec.Mvvm.Core;
|
||||
using HHWMS.Web.Models;
|
||||
|
||||
namespace HHWMS.Web
|
||||
{
|
||||
public class LocationMonitor2DVM : BaseVM
|
||||
{
|
||||
public string Area { get; set; }
|
||||
public string Row { get; set; }
|
||||
|
||||
public class LocationGridItem
|
||||
{
|
||||
public string Code { get; set; }
|
||||
public short Row { get; set; }
|
||||
public short Line { get; set; }
|
||||
public short Layer { get; set; }
|
||||
public LocationStatusEnum Status { get; set; }
|
||||
public string ContainerCode { get; set; }
|
||||
}
|
||||
|
||||
public IEnumerable<int> GetAreas()
|
||||
{
|
||||
return DC.Set<Location>()
|
||||
.Select(x => x.ZoneId)
|
||||
.Distinct()
|
||||
.OrderBy(x => x)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public IEnumerable<short> GetRows(int area)
|
||||
{
|
||||
return DC.Set<Location>()
|
||||
.Where(x => x.ZoneId == area)
|
||||
.Select(x => x.Row)
|
||||
.Distinct()
|
||||
.OrderBy(x => x)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public IEnumerable<dynamic> GetLocationsByAreaAndRow(int area, short row)
|
||||
{
|
||||
var result = DC.Set<Location>()
|
||||
.Where(x => x.ZoneId == area && x.Row == row)
|
||||
.OrderBy(x => x.Line)
|
||||
.Select(x => new
|
||||
{
|
||||
Code = x.Code,
|
||||
Row = x.Row,
|
||||
Line = x.Line,
|
||||
Layer = x.Layer,
|
||||
x.Status,
|
||||
Status1 = x.Status.GetEnumDisplayName(),
|
||||
ContainerCode = x.ContainerCode
|
||||
}).ToList();
|
||||
return result;
|
||||
}
|
||||
|
||||
private string GetEnumDisplayName(Enum enumValue)
|
||||
{
|
||||
var fieldInfo = enumValue.GetType().GetField(enumValue.ToString());
|
||||
var displayAttribute = fieldInfo.GetCustomAttributes(typeof(DisplayAttribute), false).FirstOrDefault() as DisplayAttribute;
|
||||
|
||||
return displayAttribute?.Name ?? enumValue.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,7 +12,7 @@ namespace HHWMS.Web
|
||||
{
|
||||
public partial class LocationTemplateVM : BaseTemplateVM
|
||||
{
|
||||
public ExcelPropety LocationZone_Excel = ExcelPropety.CreateProperty<Location>(x => x.LocationZoneId);
|
||||
public ExcelPropety LocationZone_Excel = ExcelPropety.CreateProperty<Location>(x => x.ZoneId);
|
||||
[Display(Name = "Location.Code")]
|
||||
public ExcelPropety Code_Excel = ExcelPropety.CreateProperty<Location>(x => x.Code);
|
||||
[Display(Name = "Location.Type")]
|
||||
|
||||
@@ -57,7 +57,7 @@ namespace HHWMS.Web
|
||||
public override IOrderedQueryable<Location_View> GetSearchQuery()
|
||||
{
|
||||
var query = DC.Set<Location>()
|
||||
.CheckEqual(Searcher.LocationZoneId, x=>x.LocationZoneId)
|
||||
.CheckEqual(Searcher.LocationZoneId, x=>x.ZoneId)
|
||||
.CheckContain(Searcher.Code, x=>x.Code)
|
||||
.CheckEqual(Searcher.Type, x=>x.Type)
|
||||
.CheckEqual(Searcher.Status, x=>x.Status)
|
||||
@@ -68,7 +68,7 @@ namespace HHWMS.Web
|
||||
.Select(x => new Location_View
|
||||
{
|
||||
ID = x.ID,
|
||||
Name_view = x.LocationZone.Name,
|
||||
Name_view = x.Zone.Name,
|
||||
Code = x.Code,
|
||||
Type = x.Type,
|
||||
Status = x.Status,
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace HHWMS.Web
|
||||
|
||||
public LocationVM()
|
||||
{
|
||||
SetInclude(x => x.LocationZone);
|
||||
SetInclude(x => x.Zone);
|
||||
}
|
||||
|
||||
protected override void InitVM()
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
<wt:form vm="@Model">
|
||||
<wt:row items-per-row="ItemsPerRowEnum.Two">
|
||||
<wt:combobox field="Entity.LocationZoneId" items="AllLocationZones" empty-text="@Localizer["Sys.All"]"/>
|
||||
<wt:combobox field="Entity.ZoneId" items="AllLocationZones" empty-text="@Localizer["Sys.All"]"/>
|
||||
|
||||
<wt:combobox field="RoadwayType" items="RoadwayTypes" empty-text="@Localizer["Sys.All"]"/>
|
||||
<wt:combobox field="Entity.Type" empty-text="@Localizer["Sys.All"]"/>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
<wt:form vm="@Model">
|
||||
<wt:row items-per-row="ItemsPerRowEnum.Two">
|
||||
<wt:combobox field="Entity.LocationZoneId" items="AllLocationZones"/>
|
||||
<wt:combobox field="Entity.ZoneId" items="AllLocationZones"/>
|
||||
<wt:textbox field="Entity.Code" />
|
||||
<wt:combobox field="Entity.Type" />
|
||||
<wt:combobox field="Entity.Status" />
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<wt:form vm="@Model">
|
||||
<wt:quote>@Localizer["Sys.DeleteConfirm"]</wt:quote>
|
||||
<wt:row items-per-row="ItemsPerRowEnum.Two">
|
||||
<wt:display field="Entity.LocationZone.Name" />
|
||||
<wt:display field="Entity.Zone.Name" />
|
||||
<wt:display field="Entity.Code" />
|
||||
<wt:display field="Entity.Type" />
|
||||
<wt:display field="Entity.Status" />
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
<wt:form vm="@Model">
|
||||
<wt:row items-per-row="ItemsPerRowEnum.Two">
|
||||
<wt:display field="Entity.LocationZone.Name" />
|
||||
<wt:display field="Entity.Zone.Name" />
|
||||
<wt:display field="Entity.Code" />
|
||||
<wt:display field="Entity.Type" />
|
||||
<wt:display field="Entity.Status" />
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
<wt:form vm="@Model">
|
||||
<wt:row items-per-row="ItemsPerRowEnum.Two">
|
||||
<wt:combobox field="Entity.LocationZoneId" items="AllLocationZones"/>
|
||||
<wt:combobox field="Entity.ZoneId" items="AllLocationZones"/>
|
||||
<wt:textbox field="Entity.Code" />
|
||||
<wt:combobox field="Entity.Type" />
|
||||
<wt:combobox field="Entity.Status" />
|
||||
|
||||
@@ -0,0 +1,266 @@
|
||||
@model HHWMS.Web.LocationMonitor2DVM
|
||||
@inject IStringLocalizer<Program> Localizer;
|
||||
<div class="layui-fluid">
|
||||
<div class="layui-card">
|
||||
<div class="layui-form layui-card-header">
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label">库区</label>
|
||||
<div class="layui-input-inline">
|
||||
<select id="areaSelect" lay-filter="areaSelect">
|
||||
<option value="">请选择库区</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label">排号</label>
|
||||
<div class="layui-input-inline">
|
||||
<select id="rowSelect" lay-filter="rowSelect">
|
||||
<option value="">请选择排号</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-card-body">
|
||||
<div id="locationGrid" class="location-grid">
|
||||
<!-- 货架布局将通过JavaScript动态生成 -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.location-grid {
|
||||
display: flex;
|
||||
flex-direction: column-reverse;
|
||||
gap: 10px;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.layer-container {
|
||||
display: flex;
|
||||
flex-wrap: nowrap;
|
||||
gap: 5px;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.column-header {
|
||||
min-width: 40px;
|
||||
height: 40px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-weight: bold;
|
||||
color: #666;
|
||||
padding: 4px;
|
||||
box-sizing: border-box;
|
||||
width: 50px;
|
||||
}
|
||||
|
||||
.layer-title {
|
||||
min-width: 60px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.location-cell {
|
||||
border: none;
|
||||
padding: 4px;
|
||||
min-width: 40px;
|
||||
height: 40px;
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
font-size: 12px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background-size: contain;
|
||||
background-repeat: no-repeat;
|
||||
background-position: center;
|
||||
box-sizing: border-box;
|
||||
width: 50px;
|
||||
}
|
||||
|
||||
.location-cell.some {
|
||||
background-image: url('/images/container/Some.png');
|
||||
}
|
||||
|
||||
.location-cell.full {
|
||||
background-image: url('/images/container/Full.png');
|
||||
}
|
||||
|
||||
.location-cell.emptycontainer {
|
||||
background-image: url('/images/container/EmptyContainer.png');
|
||||
}
|
||||
|
||||
.location-cell.empty {
|
||||
background-image: url('/images/container/Empty.png');
|
||||
}
|
||||
|
||||
.location-cell.locked {
|
||||
background-image: url('/images/container/locked.svg');
|
||||
}
|
||||
.location-cell.none {
|
||||
background-color: black;
|
||||
}
|
||||
|
||||
|
||||
.location-tooltip {
|
||||
display: none;
|
||||
position: absolute;
|
||||
background: rgba(0, 0, 0, 0.8);
|
||||
color: white;
|
||||
padding: 8px;
|
||||
border-radius: 4px;
|
||||
font-size: 12px;
|
||||
z-index: 1000;
|
||||
max-width: 200px;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
<script>
|
||||
layui.use(['form', 'jquery'], function () {
|
||||
var form = layui.form;
|
||||
var $ = layui.jquery;
|
||||
|
||||
// 初始化加载库区数据
|
||||
function loadAreas() {
|
||||
$.get('/configs/LocationMonitor/GetAreas', function(data) {
|
||||
var areaSelect = $('#areaSelect');
|
||||
data.forEach(function(area) {
|
||||
areaSelect.append(new Option(area, area));
|
||||
});
|
||||
form.render('select');
|
||||
});
|
||||
}
|
||||
|
||||
// 根据库区加载排号
|
||||
function loadRows(area) {
|
||||
console.log(area);
|
||||
if (!area) return;
|
||||
$.get('/configs/LocationMonitor/GetRows', { area: area }, function(data) {
|
||||
var rowSelect = $('#rowSelect');
|
||||
rowSelect.empty();
|
||||
rowSelect.append(new Option('请选择排号', ''));
|
||||
data.forEach(function(row) {
|
||||
rowSelect.append(new Option(row, row));
|
||||
});
|
||||
form.render('select');
|
||||
});
|
||||
}
|
||||
|
||||
// 加载库位数据并渲染网格
|
||||
function loadLocationGrid(area, row) {
|
||||
if (!area || !row) return;
|
||||
$.get('/configs/LocationMonitor/GetLocationsByAreaAndRow', {
|
||||
area: area,
|
||||
row: row
|
||||
}, function(data) {
|
||||
renderLocationGrid(data);
|
||||
});
|
||||
}
|
||||
|
||||
// 渲染库位网格
|
||||
function renderLocationGrid(locations) {
|
||||
var grid = $('#locationGrid');
|
||||
grid.empty();
|
||||
|
||||
// 获取所有唯一的Layer和Line值
|
||||
var layers = [...new Set(locations.map(loc => loc.Layer || 1))].sort((a, b) => a - b);
|
||||
var lines = [...new Set(locations.map(loc => loc.Line || 1))].sort((a, b) => a - b);
|
||||
|
||||
// 按层级和列号分组
|
||||
var locationsByLayer = {};
|
||||
locations.forEach(function(loc) {
|
||||
var layer = loc.Layer || 1;
|
||||
locationsByLayer[layer] = locationsByLayer[layer] || {};
|
||||
var line = loc.Line || 1;
|
||||
locationsByLayer[layer][line] = loc;
|
||||
});
|
||||
|
||||
// 创建tooltip元素
|
||||
var tooltip = $('<div>').addClass('location-tooltip').appendTo('body');
|
||||
|
||||
// 处理鼠标移动
|
||||
$(document).on('mousemove', function(e) {
|
||||
tooltip.css({
|
||||
left: e.pageX + 10,
|
||||
top: e.pageY + 10
|
||||
});
|
||||
});
|
||||
|
||||
// 当鼠标移出网格区域时隐藏提示框
|
||||
grid.on('mouseleave', function() {
|
||||
tooltip.hide();
|
||||
});
|
||||
|
||||
// 如果有数据,先添加列标行
|
||||
if (lines.length > 0) {
|
||||
var headerContainer = $('<div>').addClass('layer-container');
|
||||
headerContainer.append($('<div>').addClass('layer-title').text('')); // 空标题占位
|
||||
|
||||
// 使用实际的Line值生成列标
|
||||
lines.forEach(function(line) {
|
||||
headerContainer.append($('<div>').addClass('column-header').text(line.toString()));
|
||||
});
|
||||
grid.append(headerContainer);
|
||||
}
|
||||
|
||||
// 按层级顺序创建容器(自动从下到上显示)
|
||||
layers.forEach(function(layer) {
|
||||
var layerContainer = $('<div>').addClass('layer-container');
|
||||
|
||||
// 添加层号标题
|
||||
layerContainer.append($('<div>').addClass('layer-title').text('第' + layer + '层'));
|
||||
|
||||
// 按Line顺序创建单元格
|
||||
lines.forEach(function(line) {
|
||||
var loc = locationsByLayer[layer]?.[line];
|
||||
var cell = $('<div>').addClass('location-cell');
|
||||
|
||||
if (loc) {
|
||||
var status = (loc.Status).toString().toLowerCase();
|
||||
cell.addClass(status)
|
||||
.data('location', loc)
|
||||
.hover(
|
||||
function() {
|
||||
var location = $(this).data('location');
|
||||
var tooltipContent =
|
||||
'编码: ' + location.Code + '<br>' +
|
||||
'状态: ' + (location.Status1) + '<br>' +
|
||||
(location.ContainerCode ? '容器: ' + location.ContainerCode + '<br>' : '');
|
||||
tooltip.html(tooltipContent).show();
|
||||
},
|
||||
function() {
|
||||
tooltip.hide();
|
||||
}
|
||||
);
|
||||
} else {
|
||||
cell.addClass('none');
|
||||
}
|
||||
|
||||
layerContainer.append(cell);
|
||||
});
|
||||
|
||||
grid.append(layerContainer);
|
||||
});
|
||||
}
|
||||
|
||||
// 事件绑定
|
||||
form.on('select(areaSelect)', function(data) {
|
||||
loadRows(data.value);
|
||||
$('#rowSelect').val('');
|
||||
form.render('select');
|
||||
$('#locationGrid').empty();
|
||||
});
|
||||
|
||||
form.on('select(rowSelect)', function(data) {
|
||||
var area = $('#areaSelect').val();
|
||||
loadLocationGrid(area, data.value);
|
||||
});
|
||||
|
||||
// 初始化加载
|
||||
loadAreas();
|
||||
});
|
||||
</script>
|
||||
@@ -1,13 +1,10 @@
|
||||
using Microsoft.AspNetCore.Http;
|
||||
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;
|
||||
using HHWMS.Web.Models;
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace HHWMS.Web.Controllers
|
||||
{
|
||||
@@ -15,11 +12,13 @@ namespace HHWMS.Web.Controllers
|
||||
[ActionDescription("库存管理")]
|
||||
public partial class InventoryController : BaseController
|
||||
{
|
||||
private readonly IUnitWork _unitwork;
|
||||
public InventoryController(IUnitWork unitwork)
|
||||
private readonly IUnitWork _unitWork;
|
||||
|
||||
public InventoryController(IUnitWork unitWork)
|
||||
{
|
||||
_unitwork = unitwork;
|
||||
_unitWork = unitWork;
|
||||
}
|
||||
|
||||
#region Search
|
||||
[ActionDescription("Sys.Search")]
|
||||
public ActionResult Index()
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
<wt:form vm="@Model">
|
||||
<wt:row items-per-row="ItemsPerRowEnum.Two">
|
||||
<wt:textbox field="Entity.ZoneCode" />
|
||||
<wt:combobox field="Entity.ZoneId" items="AllZones"/>
|
||||
<wt:textbox field="Entity.ContainerCode" />
|
||||
<wt:textbox field="Entity.LocationCode" />
|
||||
<wt:textbox field="Entity.MaterialCode" />
|
||||
@@ -23,7 +23,7 @@
|
||||
<wt:textbox field="Entity.ReceiptCode" />
|
||||
<wt:textbox field="Entity.ReceiptDetailId" />
|
||||
<wt:textbox field="Entity.Status" />
|
||||
<wt:textbox field="Entity.TaskStatus" />
|
||||
<wt:combobox field="Entity.TaskStatus" />
|
||||
</wt:row>
|
||||
<wt:row align="AlignEnum.Right">
|
||||
<wt:submitbutton />
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<wt:form vm="@Model">
|
||||
<wt:quote>@Localizer["Sys.DeleteConfirm"]</wt:quote>
|
||||
<wt:row items-per-row="ItemsPerRowEnum.Two">
|
||||
<wt:display field="Entity.ZoneCode" />
|
||||
<wt:display field="Entity.Zone.Name" />
|
||||
<wt:display field="Entity.ContainerCode" />
|
||||
<wt:display field="Entity.LocationCode" />
|
||||
<wt:display field="Entity.MaterialCode" />
|
||||
@@ -25,6 +25,7 @@
|
||||
<wt:display field="Entity.ReceiptDetailId" />
|
||||
<wt:display field="Entity.Status" />
|
||||
<wt:display field="Entity.TaskStatus" />
|
||||
<wt:display field="Entity.Flag" />
|
||||
</wt:row>
|
||||
<wt:hidden field="Entity.ID" />
|
||||
<wt:row align="AlignEnum.Right">
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
@model HHWMS.Web.InventoryVM
|
||||
@model HHWMS.Web.InventoryVM
|
||||
@inject IStringLocalizer<Program> Localizer;
|
||||
|
||||
<wt:form vm="@Model">
|
||||
<wt:row items-per-row="ItemsPerRowEnum.Two">
|
||||
<wt:display field="Entity.ZoneCode" />
|
||||
<wt:display field="Entity.Zone.Name" />
|
||||
<wt:display field="Entity.ContainerCode" />
|
||||
<wt:display field="Entity.LocationCode" />
|
||||
<wt:display field="Entity.MaterialCode" />
|
||||
@@ -24,6 +24,7 @@
|
||||
<wt:display field="Entity.ReceiptDetailId" />
|
||||
<wt:display field="Entity.Status" />
|
||||
<wt:display field="Entity.TaskStatus" />
|
||||
<wt:display field="Entity.Flag" />
|
||||
</wt:row>
|
||||
<wt:row align="AlignEnum.Right">
|
||||
<wt:closebutton />
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
<wt:form vm="@Model">
|
||||
<wt:row items-per-row="ItemsPerRowEnum.Two">
|
||||
<wt:textbox field="Entity.ZoneCode" />
|
||||
<wt:combobox field="Entity.ZoneId" items="AllZones"/>
|
||||
<wt:textbox field="Entity.ContainerCode" />
|
||||
<wt:textbox field="Entity.LocationCode" />
|
||||
<wt:textbox field="Entity.MaterialCode" />
|
||||
@@ -24,6 +24,7 @@
|
||||
<wt:textbox field="Entity.ReceiptDetailId" />
|
||||
<wt:textbox field="Entity.Status" />
|
||||
<wt:textbox field="Entity.TaskStatus" />
|
||||
<wt:textbox field="Entity.Flag" />
|
||||
</wt:row>
|
||||
<wt:hidden field="Entity.ID" />
|
||||
<wt:row align="AlignEnum.Right">
|
||||
|
||||
@@ -1,21 +1,17 @@
|
||||
@model HHWMS.Web.InventoryListVM
|
||||
@model HHWMS.Web.InventoryListVM
|
||||
@inject IStringLocalizer<Program> Localizer;
|
||||
|
||||
<wt:searchpanel vm="@Model" reset-btn="true">
|
||||
<wt:row items-per-row="ItemsPerRowEnum.Three">
|
||||
<wt:combobox field="Searcher.ZoneCode" items="ZoneCodes" />
|
||||
<wt:textbox field="Searcher.UniqueCode" />
|
||||
<wt:combobox field="Searcher.ZoneId" items="Searcher.AllZones" empty-text="@Localizer["Sys.All"]" />
|
||||
<wt:textbox field="Searcher.ContainerCode" />
|
||||
<wt:textbox field="Searcher.MaterialCode" />
|
||||
<wt:textbox field="Searcher.Batch" />
|
||||
@*<wt:textbox field="Searcher.MaterialType" />
|
||||
<wt:textbox field="Searcher.MaterialType" />
|
||||
<wt:textbox field="Searcher.MaterialName" />
|
||||
<wt:textbox field="Searcher.MaterialSpec" />
|
||||
<wt:textbox field="Searcher.MaterialUnit" />
|
||||
<wt:textbox field="Searcher.Batch" />
|
||||
<wt:textbox field="Searcher.Lot" />
|
||||
<wt:textbox field="Searcher.SourceCode" />
|
||||
<wt:textbox field="Searcher.ReceiptCode" />
|
||||
<wt:textbox field="Searcher.Status" /> *@
|
||||
<wt:textbox field="Searcher.Status" />
|
||||
<wt:combobox field="Searcher.TaskStatus" empty-text="@Localizer["Sys.All"]" />
|
||||
</wt:row>
|
||||
</wt:searchpanel>
|
||||
<wt:grid vm="@Model" url="/inventory/Inventory/Search"/>
|
||||
@@ -34,149 +34,7 @@ namespace HHWMS.Web
|
||||
Value = x.DictValue
|
||||
}).ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 分解出库单
|
||||
/// </summary>
|
||||
/// <returns>处理结果</returns>
|
||||
public ResponseResult<dynamic> DecomposeShipment()
|
||||
{
|
||||
try
|
||||
{
|
||||
using var transaction = DC.BeginTransaction();
|
||||
try
|
||||
{
|
||||
var details = DC.Set<ShipmentDetail>()
|
||||
.Where(x => x.HeaderId == Entity.ID && x.Status != ShipStatusEnum.分配完成)
|
||||
.ToList();
|
||||
|
||||
if (!details.Any())
|
||||
{
|
||||
return ResponseResult<dynamic>.Error("没有需要分配的出库单明细");
|
||||
}
|
||||
|
||||
foreach (var detail in details)
|
||||
{
|
||||
var availableInventories = DC.Set<Inventory>()
|
||||
.Where(x => x.MaterialCode == detail.MaterialCode
|
||||
&& x.TaskStatus == InventoryTaskStatus.无任务
|
||||
&& x.Qty > x.TaskQty
|
||||
)
|
||||
.OrderBy(x => x.CreateTime)
|
||||
.ToList();
|
||||
|
||||
decimal remainingQty = (decimal)(detail.Qty - (detail.DividedQty ?? 0));
|
||||
decimal dividedQty = 0;
|
||||
|
||||
foreach (var inventory in availableInventories)
|
||||
{
|
||||
if (remainingQty <= 0) break;
|
||||
|
||||
var currentInventory = DC.Set<Inventory>()
|
||||
.FirstOrDefault(x => x.ID == inventory.ID);
|
||||
|
||||
if (currentInventory == null || currentInventory.UpdateVersion != inventory.UpdateVersion)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
decimal availableQty = (decimal)(currentInventory.Qty - (currentInventory.TaskQty ?? 0));
|
||||
if (availableQty <= 0) continue;
|
||||
|
||||
decimal qtyToDivide = Math.Min(remainingQty, availableQty);
|
||||
|
||||
// 更新库存分配数量
|
||||
currentInventory.TaskQty = (currentInventory.TaskQty ?? 0) + qtyToDivide;
|
||||
currentInventory.Status = InventoryTaskStatus.任务中;
|
||||
currentInventory.UpdateVersion++;
|
||||
DC.UpdateEntity(currentInventory);
|
||||
|
||||
remainingQty -= qtyToDivide;
|
||||
dividedQty += qtyToDivide;
|
||||
|
||||
/*var allocation = new InventoryAllocation
|
||||
{
|
||||
InventoryId = currentInventory.ID,
|
||||
ShipmentDetailId = detail.ID,
|
||||
DividedQty = qtyToDivide,
|
||||
Status = ShipStatusEnum.分配完成.ToString()
|
||||
};
|
||||
DC.AddEntity(allocation);*/
|
||||
}
|
||||
|
||||
if (dividedQty > 0)
|
||||
{
|
||||
var currentDetail = DC.Set<ShipmentDetail>()
|
||||
.FirstOrDefault(x => x.ID == detail.ID);
|
||||
|
||||
if (currentDetail != null && currentDetail.UpdateVersion == detail.UpdateVersion)
|
||||
{
|
||||
currentDetail.DividedQty = (currentDetail.DividedQty ?? 0) + dividedQty;
|
||||
currentDetail.Status = currentDetail.DividedQty >= currentDetail.Qty ?
|
||||
ShipStatusEnum.分配完成 :
|
||||
ShipStatusEnum.分配中;
|
||||
currentDetail.UpdateVersion++;
|
||||
DC.UpdateEntity(currentDetail);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var currentHeader = DC.Set<ShipmentHeader>()
|
||||
.FirstOrDefault(x => x.ID == Entity.ID);
|
||||
|
||||
if (currentHeader != null && currentHeader.UpdateVersion == Entity.UpdateVersion)
|
||||
{
|
||||
var allDetails = DC.Set<ShipmentDetail>()
|
||||
.Where(x => x.HeaderId == Entity.ID)
|
||||
.ToList();
|
||||
|
||||
bool allDivided = allDetails.All(x => x.Status == ShipStatusEnum.分配完成);
|
||||
|
||||
currentHeader.FirstStatus = allDivided ?
|
||||
ShipStatusEnum.分配完成 :
|
||||
ShipStatusEnum.分配中;
|
||||
currentHeader.UpdateVersion++;
|
||||
DC.UpdateEntity(currentHeader);
|
||||
}
|
||||
|
||||
DC.SaveChanges();
|
||||
transaction.Commit();
|
||||
|
||||
var unallocatedDetails = details.Where(x => x.Status != ShipStatusEnum.分配完成).ToList();
|
||||
if (unallocatedDetails.Any())
|
||||
{
|
||||
var errorMsg = string.Join("\n", unallocatedDetails.Select(x =>
|
||||
$"物料{x.MaterialCode}缺少{x.Qty - (x.DividedQty ?? 0)}个"));
|
||||
return ResponseResult<dynamic>.Error($"部分物料库存不足,请检查:\n{errorMsg}");
|
||||
}
|
||||
|
||||
return ResponseResult<dynamic>.Success(new
|
||||
{
|
||||
message = "出库单分解完成",
|
||||
headerId = Entity.ID,
|
||||
status = Entity.FirstStatus,
|
||||
allocatedDetails = details.Select(x => new
|
||||
{
|
||||
x.ID,
|
||||
x.MaterialCode,
|
||||
x.Qty,
|
||||
DividedQty = x.DividedQty,
|
||||
x.Status
|
||||
}).ToList()
|
||||
});
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
transaction.Rollback();
|
||||
throw new Exception($"处理出库单时发生错误: {ex.Message}");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return ResponseResult<dynamic>.Error($"分解出库单失败:{ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public override void DoAdd()
|
||||
{
|
||||
base.DoAdd();
|
||||
@@ -191,151 +49,5 @@ namespace HHWMS.Web
|
||||
{
|
||||
base.DoDelete();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取分配库存对应的货架列表
|
||||
/// </summary>
|
||||
/// <returns>货架列表</returns>
|
||||
public ResponseResult<List<string>> GetAllocatedLocations()
|
||||
{
|
||||
try
|
||||
{
|
||||
// 获取已分配的出库单明细
|
||||
var details = DC.Set<ShipmentDetail>()
|
||||
.Where(x => x.HeaderId == Entity.ID
|
||||
&& (x.Status == ShipStatusEnum.分配完成 || x.Status == ShipStatusEnum.分配中))
|
||||
.ToList();
|
||||
|
||||
if (!details.Any())
|
||||
{
|
||||
return ResponseResult<List<string>>.Error("没有已分配的出库单明细");
|
||||
}
|
||||
|
||||
// 获取明细对应的所有库存记录
|
||||
var allocatedInventories = DC.Set<Inventory>()
|
||||
.Where(x => x.TaskStatus == InventoryTaskStatus.任务中
|
||||
&& details.Select(d => d.MaterialCode).Contains(x.MaterialCode))
|
||||
.ToList();
|
||||
|
||||
// 获取去重后的货架编码列表
|
||||
var locations = allocatedInventories
|
||||
.Where(x => !string.IsNullOrEmpty(x.LocationCode))
|
||||
.Select(x => x.LocationCode)
|
||||
.Distinct()
|
||||
.OrderBy(x => x)
|
||||
.ToList();
|
||||
|
||||
if (!locations.Any())
|
||||
{
|
||||
return ResponseResult<List<string>>.Error("未找到相关库存的货架信息");
|
||||
}
|
||||
|
||||
// 返回货架列表,并包含统计信息
|
||||
return ResponseResult<List<string>>.Success(locations);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return ResponseResult<List<string>>.Error($"获取货架列表失败:{ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取分配库存的详细信息
|
||||
/// </summary>
|
||||
/// <returns>库存详细信息</returns>
|
||||
public ResponseResult<List<InventoryLocationInfo>> GetAllocatedInventoryDetails()
|
||||
{
|
||||
try
|
||||
{
|
||||
// 获取已分配的出库单明细
|
||||
var details = DC.Set<ShipmentDetail>()
|
||||
.Where(x => x.HeaderId == Entity.ID
|
||||
&& (x.Status == ShipStatusEnum.分配完成 || x.Status == ShipStatusEnum.分配中))
|
||||
.ToList();
|
||||
|
||||
if (!details.Any())
|
||||
{
|
||||
return ResponseResult<List<InventoryLocationInfo>>.Error("没有已分配的出库单明细");
|
||||
}
|
||||
|
||||
// 获取明细对应的所有库存记录,并按货架分组
|
||||
var inventoryGroups = DC.Set<Inventory>()
|
||||
.Where(x => x.TaskStatus == InventoryTaskStatus.任务中
|
||||
&& details.Select(d => d.MaterialCode).Contains(x.MaterialCode))
|
||||
.GroupBy(x => x.LocationCode)
|
||||
.Select(g => new InventoryLocationInfo
|
||||
{
|
||||
LocationCode = g.Key,
|
||||
Inventories = g.Select(inv => new InventoryInfo
|
||||
{
|
||||
MaterialCode = inv.MaterialCode,
|
||||
MaterialName = inv.MaterialName,
|
||||
Qty = (decimal)inv.Qty,
|
||||
TaskQty = inv.TaskQty ?? 0,
|
||||
BatchCode = inv.Batch
|
||||
}).ToList()
|
||||
})
|
||||
.OrderBy(x => x.LocationCode)
|
||||
.ToList();
|
||||
|
||||
if (!inventoryGroups.Any())
|
||||
{
|
||||
return ResponseResult<List<InventoryLocationInfo>>.Error("未找到相关库存信息");
|
||||
}
|
||||
|
||||
return ResponseResult<List<InventoryLocationInfo>>.Success(inventoryGroups);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return ResponseResult<List<InventoryLocationInfo>>.Error($"获取库存详细信息失败:{ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 库存位置信息
|
||||
/// </summary>
|
||||
public class InventoryLocationInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// 货架编码
|
||||
/// </summary>
|
||||
public string LocationCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 该货架上的库存列表
|
||||
/// </summary>
|
||||
public List<InventoryInfo> Inventories { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 库存信息
|
||||
/// </summary>
|
||||
public class InventoryInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// 物料编码
|
||||
/// </summary>
|
||||
public string MaterialCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 物料名称
|
||||
/// </summary>
|
||||
public string MaterialName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 总数量
|
||||
/// </summary>
|
||||
public decimal Qty { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 任务数量
|
||||
/// </summary>
|
||||
public decimal TaskQty { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 批次号
|
||||
/// </summary>
|
||||
public string BatchCode { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,9 +12,9 @@ public class Location : BasePoco
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public new int ID { get; set; }
|
||||
|
||||
public LocationZone LocationZone { get; set; }
|
||||
public LocationZone Zone { get; set; }
|
||||
[Display(Name = "Location.ZoneCode", Description = "库位编码")]
|
||||
public int LocationZoneId { get; set; }
|
||||
public int ZoneId { get; set; }
|
||||
|
||||
[Display(Name = "Location.Code", Description = "库位编码")]
|
||||
[StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
|
||||
@@ -28,7 +28,7 @@ public class Location : BasePoco
|
||||
|
||||
[Display(Name = "Location.RoadWay", Description = "巷道")]
|
||||
[Required(ErrorMessage = "Validate.{0}required")]
|
||||
public short? RoadWay { get; set; }
|
||||
public short RoadWay { get; set; }
|
||||
|
||||
[Display(Name = "Location.Row", Description = "行")]
|
||||
public short Row { get; set; }
|
||||
|
||||
@@ -13,9 +13,9 @@ namespace HHWMS.Web.Models
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public new int ID { get; set; }
|
||||
|
||||
[Display(Name = "Task.ZoneCode", Description = "库区")]
|
||||
[StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
|
||||
public string ZoneCode { get; set; }
|
||||
[Display(Name = "Location.ZoneCode", Description = "库区")]
|
||||
public int ZoneId{ get; set; }
|
||||
public LocationZone Zone { get; set; }
|
||||
|
||||
[Display(Name = "Task.ContainerCode", Description = "容器编码")]
|
||||
[StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
|
||||
@@ -90,8 +90,7 @@ namespace HHWMS.Web.Models
|
||||
public string Status { get; set; }
|
||||
|
||||
[Display(Name = "Inventory.TaskStatus", Description = "任务状态")]
|
||||
[StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
|
||||
public string TaskStatus { get; set; }
|
||||
public InventoryTaskStatusEnum TaskStatus { get; set; }
|
||||
|
||||
[Display(Name = "Inventory.Flag", Description = "格数")]
|
||||
public int Flag { get; set; }
|
||||
@@ -99,3 +98,11 @@ namespace HHWMS.Web.Models
|
||||
public int UpdateVersion { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
public enum InventoryTaskStatusEnum : short
|
||||
{
|
||||
[Display(Name = "InventoryTaskStatusEnum.Idle")]
|
||||
Idle = 0,
|
||||
[Display(Name = "InventoryTaskStatusEnum.Locked")]
|
||||
Locked = 1,
|
||||
}
|
||||
@@ -1443,4 +1443,10 @@
|
||||
<data name="Location.ZoneName" xml:space="preserve">
|
||||
<value>库区</value>
|
||||
</data>
|
||||
<data name="InventoryTaskStatusEnum.Idle" xml:space="preserve">
|
||||
<value>无任务</value>
|
||||
</data>
|
||||
<data name="InventoryTaskStatusEnum.Locked" xml:space="preserve">
|
||||
<value>任务中</value>
|
||||
</data>
|
||||
</root>
|
||||
|
After Width: | Height: | Size: 3.6 KiB |
|
After Width: | Height: | Size: 3.4 KiB |
|
After Width: | Height: | Size: 3.9 KiB |
|
After Width: | Height: | Size: 3.7 KiB |
@@ -0,0 +1,3 @@
|
||||
<svg width="40" height="40" viewBox="0 0 40 40" xmlns="http://www.w3.org/2000/svg">
|
||||
<rect x="2" y="2" width="36" height="36" rx="4" fill="#fac858" stroke="#ddd" stroke-width="2"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 188 B |
@@ -0,0 +1,5 @@
|
||||
<svg width="40" height="40" viewBox="0 0 40 40" xmlns="http://www.w3.org/2000/svg">
|
||||
<rect x="2" y="2" width="36" height="36" rx="4" fill="#ee6666" stroke="#ddd" stroke-width="2"/>
|
||||
<path d="M20 10 C17 10 15 12 15 15 L15 18 L25 18 L25 15 C25 12 23 10 20 10 Z" fill="#fff" opacity="0.6"/>
|
||||
<rect x="13" y="18" width="14" height="12" rx="2" fill="#fff" opacity="0.6"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 376 B |
@@ -0,0 +1,4 @@
|
||||
<svg width="40" height="40" viewBox="0 0 40 40" xmlns="http://www.w3.org/2000/svg">
|
||||
<rect x="2" y="2" width="36" height="36" rx="4" fill="#91cc75" stroke="#ddd" stroke-width="2"/>
|
||||
<rect x="8" y="8" width="24" height="24" rx="2" fill="#fff" opacity="0.6"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 266 B |
|
After Width: | Height: | Size: 6.0 KiB |
|
After Width: | Height: | Size: 4.9 KiB |
|
After Width: | Height: | Size: 5.9 KiB |
|
After Width: | Height: | Size: 4.8 KiB |
|
After Width: | Height: | Size: 5.4 KiB |
|
After Width: | Height: | Size: 4.5 KiB |
|
After Width: | Height: | Size: 5.1 KiB |
|
After Width: | Height: | Size: 4.0 KiB |