1. 添加你入库页面验证

2. 库存查询条件
3. 接口任务完成修改
4. 添加物料及物料工序的修改
This commit is contained in:
zhougf committed 2025-11-30 22:55:43 +08:00
1 parent 13d3a96f0c
commit 713c3528ad
15 files changed
+145 -19

No files matched your search

+10 -8
View File
@@ -480,14 +480,6 @@ namespace HHWMS.Web
// 处理移库:同时更新源库位和目标库位 // 处理移库:同时更新源库位和目标库位
// 1. 更新源库位(移出后变为空) // 1. 更新源库位(移出后变为空)
var sourceLocation = _unitWork.FindSingle<Location>(x => x.Code == task.FromLocation); var sourceLocation = _unitWork.FindSingle<Location>(x => x.Code == task.FromLocation);
if (sourceLocation != null)
{
sourceLocation.ContainerCode = "";
sourceLocation.Status = LocationStatusEnum.未锁;
sourceLocation.ContainerStatus = LocationStatus.空仓位;
sourceLocation.UpdateTime = DateTime.Now;
_unitWork.Update(sourceLocation);
}
// 2. 更新目标库位(移入后有容器) // 2. 更新目标库位(移入后有容器)
var targetLocation = _unitWork.FindSingle<Location>(x => x.Code == task.ToLocation); var targetLocation = _unitWork.FindSingle<Location>(x => x.Code == task.ToLocation);
@@ -495,10 +487,20 @@ namespace HHWMS.Web
{ {
targetLocation.ContainerCode = task.ContainerCode; targetLocation.ContainerCode = task.ContainerCode;
targetLocation.Status = LocationStatusEnum.未锁; targetLocation.Status = LocationStatusEnum.未锁;
targetLocation.ContainerStatus = sourceLocation.ContainerStatus;
targetLocation.UpdateTime = DateTime.Now; targetLocation.UpdateTime = DateTime.Now;
_unitWork.Update(targetLocation); _unitWork.Update(targetLocation);
} }
if (sourceLocation != null)
{
sourceLocation.ContainerCode = "";
sourceLocation.Status = LocationStatusEnum.未锁;
sourceLocation.ContainerStatus = LocationStatus.空仓位;
sourceLocation.UpdateTime = DateTime.Now;
_unitWork.Update(sourceLocation);
}
break; break;
default: default:
@@ -45,6 +45,14 @@ namespace HHWMS.Web.Controllers
} }
} }
[ActionDescription("Sys.Search")]
[HttpPost]
public string Search2(MaterialProcessListVM2 vm)
{
vm.Searcher.Page = vm.FC.GetValue<int>("Page");
vm.Searcher.Limit = vm.FC.GetValue<int>("Limit");
return vm.GetJson(false);
}
#endregion #endregion
#region Create #region Create
@@ -112,6 +120,15 @@ namespace HHWMS.Web.Controllers
} }
else else
{ {
var code = _unitWork.FindSingle<MaterialProcess>(x => x.ProcessName == vm.Entity.ProcessName)?.ProcessCode;
vm.Entity.ProcessCode = code;
// 判断是否重复
if (_unitWork.IsExit<MaterialProcess>(x => x.ID != vm.Entity.ID && x.MaterialCode == vm.Entity.MaterialCode
&& (x.ProcessOrder == vm.Entity.ProcessOrder
|| x.ProcessName == vm.Entity.ProcessName)))
{
return FFResult().Alert("同一物料的工序或者顺序不能重复,请检查后重新编辑!");
}
vm.DoEdit(); vm.DoEdit();
if (!ModelState.IsValid) if (!ModelState.IsValid)
{ {
@@ -120,7 +137,7 @@ namespace HHWMS.Web.Controllers
} }
else else
{ {
return FFResult().CloseDialog().RefreshGridRow(vm.Entity.ID); return FFResult().CloseDialog().RefreshGrid(vm.ParentWindowId);
} }
} }
} }
@@ -426,7 +426,7 @@ namespace HHWMS.Web
var moveloc = GetMoveLocation(outter); var moveloc = GetMoveLocation(outter);
if (moveloc.Status) if (moveloc.Status)
{ {
string code = moveloc.Data.Code; string code = moveloc.Data.LocationCode;
var movelocation = _unitWork.FindSingle<Location>(x => x.Code == code); var movelocation = _unitWork.FindSingle<Location>(x => x.Code == code);
// 生成outter移库任务 // 生成outter移库任务
@@ -435,6 +435,7 @@ namespace HHWMS.Web
ZoneId = outter.ZoneId, ZoneId = outter.ZoneId,
TaskNo = _unitWork.GetSerialNumber("Move"), TaskNo = _unitWork.GetSerialNumber("Move"),
TaskType = TaskTypeEnum.移库, TaskType = TaskTypeEnum.移库,
RoadWay = 2,
ContainerCode = outter.ContainerCode, ContainerCode = outter.ContainerCode,
FromLocation = outter.Code, FromLocation = outter.Code,
ToLocation = movelocation.Code, ToLocation = movelocation.Code,
@@ -18,7 +18,7 @@ namespace HHWMS.Web
return new List<GridAction> return new List<GridAction>
{ {
this.MakeStandardAction("MaterialProcess", GridActionStandardTypesEnum.Create, Localizer["Sys.Create"],"configs", dialogWidth: 800), this.MakeStandardAction("MaterialProcess", GridActionStandardTypesEnum.Create, Localizer["Sys.Create"],"configs", dialogWidth: 800),
this.MakeStandardAction("MaterialProcess", GridActionStandardTypesEnum.Edit, Localizer["Sys.Edit"], "configs", dialogWidth: 800), this.MakeStandardAction("MaterialProcess", GridActionStandardTypesEnum.Edit, Localizer["Sys.Edit"], "configs", dialogWidth: 800,dialogHeight:800),
this.MakeStandardAction("MaterialProcess", GridActionStandardTypesEnum.Delete, Localizer["Sys.Delete"], "configs", dialogWidth: 800), this.MakeStandardAction("MaterialProcess", GridActionStandardTypesEnum.Delete, Localizer["Sys.Delete"], "configs", dialogWidth: 800),
this.MakeStandardAction("MaterialProcess", GridActionStandardTypesEnum.Details, Localizer["Sys.Details"], "configs", dialogWidth: 800), this.MakeStandardAction("MaterialProcess", GridActionStandardTypesEnum.Details, Localizer["Sys.Details"], "configs", dialogWidth: 800),
this.MakeStandardAction("MaterialProcess", GridActionStandardTypesEnum.BatchEdit, Localizer["Sys.BatchEdit"], "configs", dialogWidth: 800), this.MakeStandardAction("MaterialProcess", GridActionStandardTypesEnum.BatchEdit, Localizer["Sys.BatchEdit"], "configs", dialogWidth: 800),
@@ -64,7 +64,7 @@ namespace HHWMS.Web
Description = x.Description, Description = x.Description,
IsActive = x.IsActive, IsActive = x.IsActive,
}) })
.OrderBy(x => x.ID); .OrderBy(x => x.ProcessOrder);
return query; return query;
} }
@@ -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 MaterialProcessListVM2 : BasePagedListVM<MaterialProcess_View, MaterialProcessSearcher>
{
protected override List<GridAction> InitGridAction()
{
return new List<GridAction>
{
this.MakeStandardAction("MaterialProcess", GridActionStandardTypesEnum.Create, Localizer["Sys.Create"],"configs", dialogWidth: 800),
this.MakeStandardAction("MaterialProcess", GridActionStandardTypesEnum.Edit, Localizer["Sys.Edit"], "configs", dialogWidth: 800,dialogHeight:800),
this.MakeStandardAction("MaterialProcess", GridActionStandardTypesEnum.Delete, Localizer["Sys.Delete"], "configs", dialogWidth: 800),
this.MakeStandardAction("MaterialProcess", GridActionStandardTypesEnum.Details, Localizer["Sys.Details"], "configs", dialogWidth: 800),
};
}
protected override IEnumerable<IGridColumn<MaterialProcess_View>> InitGridHeader()
{
return new List<GridColumn<MaterialProcess_View>>{
this.MakeGridHeader(x => x.MaterialCode).SetHide(),
this.MakeGridHeader(x => x.ProcessOrder),
this.MakeGridHeader(x => x.ProcessName),
this.MakeGridHeader(x => x.ProcessCode).SetHide(),
this.MakeGridHeader(x => x.Weight),
this.MakeGridHeader(x => x.Description),
this.MakeGridHeader(x => x.IsActive).SetHide(),
this.MakeGridHeaderAction(width: 200)
};
}
public override IOrderedQueryable<MaterialProcess_View> GetSearchQuery()
{
var query = DC.Set<MaterialProcess>()
.Where( x=>x.MaterialCode == Searcher.MaterialCode)
.Select(x => new MaterialProcess_View
{
ID = x.ID,
MaterialCode = x.MaterialCode,
ProcessOrder = x.ProcessOrder,
ProcessName = x.ProcessName,
ProcessCode = x.ProcessCode,
Weight = x.Weight,
Description = x.Description,
IsActive = x.IsActive,
})
.OrderBy(x => x.ProcessOrder);
return query;
}
}
}
@@ -12,13 +12,20 @@ namespace HHWMS.Web
{ {
public partial class MaterialProcessVM : BaseCRUDVM<MaterialProcess> public partial class MaterialProcessVM : BaseCRUDVM<MaterialProcess>
{ {
public List<ComboSelectListItem> Processes { get; set; }
public MaterialProcessVM() public MaterialProcessVM()
{ {
} }
protected override void InitVM() protected override void InitVM()
{ {
var CurrentCulture = Wtm.CurrentCulture;
var processDatas = DC.Set<ProcessConfig>().ToList();
Processes = processDatas.Select(x => new ComboSelectListItem
{
Text = x.Name,
Value = x.Name
}).ToList();
} }
public override void DoAdd() public override void DoAdd()
@@ -12,13 +12,15 @@ namespace HHWMS.Web
{ {
public partial class MaterialVM : BaseCRUDVM<Material> public partial class MaterialVM : BaseCRUDVM<Material>
{ {
public MaterialProcessListVM2 materialProcesses = new MaterialProcessListVM2();
public MaterialVM() public MaterialVM()
{ {
} }
protected override void InitVM() protected override void InitVM()
{ {
materialProcesses.CopyContext(this);
materialProcesses.Searcher.MaterialCode = Entity.MaterialCode;
} }
public override void DoAdd() public override void DoAdd()
@@ -18,5 +18,15 @@
<wt:row align="AlignEnum.Right"> <wt:row align="AlignEnum.Right">
<wt:submitbutton /> <wt:submitbutton />
<wt:closebutton /> <wt:closebutton />
<wt:submitbutton click="test2()" text="刷新"/>
</wt:row> </wt:row>
</wt:form> </wt:form>
<wt:grid vm="@Model.materialProcesses" id="materialProcesses" hidden-checkbox="true" hidden-panel="true" use-local-data="true" height="400" />
<script>
function test2(){
let code = $('[name="Entity.MaterialCode"]').val()
console.log(1,code)
layui.table.reload('materialProcesses', { where: { "Searcher.MaterialCode": code } });
}
</script>
@@ -5,8 +5,8 @@
<wt:row items-per-row="ItemsPerRowEnum.Two"> <wt:row items-per-row="ItemsPerRowEnum.Two">
<wt:textbox field="Entity.MaterialCode" disabled/> <wt:textbox field="Entity.MaterialCode" disabled/>
<wt:textbox field="Entity.ProcessOrder" /> <wt:textbox field="Entity.ProcessOrder" />
<wt:textbox field="Entity.ProcessName" /> <wt:combobox field="Entity.ProcessName" items="Processes" />
<wt:textbox field="Entity.ProcessCode" /> <wt:hidden field="Entity.ProcessCode" />
<wt:textbox field="Entity.Weight" /> <wt:textbox field="Entity.Weight" />
<wt:textbox field="Entity.Description" /> <wt:textbox field="Entity.Description" />
<wt:switch field="Entity.IsActive" /> <wt:switch field="Entity.IsActive" />
@@ -17,3 +17,7 @@
<wt:closebutton /> <wt:closebutton />
</wt:row> </wt:row>
</wt:form> </wt:form>
<script>
</script>
@@ -379,6 +379,8 @@ namespace HHWMS.Web.Controllers
[HttpPost] [HttpPost]
[ActionDescription("TaskType.Out")] [ActionDescription("TaskType.Out")]
public ActionResult InvOut2(InventoryVM vm) public ActionResult InvOut2(InventoryVM vm)
{
try
{ {
var id = vm.Entity.ID; var id = vm.Entity.ID;
// 校验参数 // 校验参数
@@ -386,12 +388,14 @@ namespace HHWMS.Web.Controllers
{ {
return FFResult().Alert("出口必选,请选择后重试!"); return FFResult().Alert("出口必选,请选择后重试!");
} }
// 校验库存 // 校验库存
var inv = _unitWork.FindSingle<Inventory>(x => x.ID == id); var inv = _unitWork.FindSingle<Inventory>(x => x.ID == id);
if (inv == null) if (inv == null)
{ {
return FFResult().CloseDialog().Alert("所选库存不存在,请检查后重试!").RefreshGrid(); return FFResult().CloseDialog().Alert("所选库存不存在,请检查后重试!").RefreshGrid();
} }
if (inv.TaskStatus == InventoryTaskStatusEnum.Locked) if (inv.TaskStatus == InventoryTaskStatusEnum.Locked)
{ {
return FFResult().CloseDialog().Alert("所选库存已被锁定!,请检查后重试!").RefreshGrid(); return FFResult().CloseDialog().Alert("所选库存已被锁定!,请检查后重试!").RefreshGrid();
@@ -507,7 +511,11 @@ namespace HHWMS.Web.Controllers
// WCS任务下发失败 // WCS任务下发失败
return FFResult().CloseDialog().Message(wcsResult?.Msg ?? "WCS任务下发失败").RefreshGrid(); return FFResult().CloseDialog().Message(wcsResult?.Msg ?? "WCS任务下发失败").RefreshGrid();
}*/ }*/
}
catch (Exception ex)
{
return FFResult().CloseDialog().Alert(ex.Message).RefreshGrid();
}
} }
#endregion #endregion
} }
@@ -109,6 +109,7 @@ namespace HHWMS.Web
.CheckContain(Searcher.SourceCode, x=>x.SourceCode) .CheckContain(Searcher.SourceCode, x=>x.SourceCode)
.CheckContain(Searcher.CompanyCode, x=>x.CompanyCode) .CheckContain(Searcher.CompanyCode, x=>x.CompanyCode)
.CheckContain(Searcher.Batch, x=>x.Batch) .CheckContain(Searcher.Batch, x=>x.Batch)
.CheckContain(Searcher.Lot, x=>x.Lot)
.CheckContain(Searcher.Status, x=>x.Status) .CheckContain(Searcher.Status, x=>x.Status)
.CheckEqual(Searcher.TaskStatus, x=>x.TaskStatus) .CheckEqual(Searcher.TaskStatus, x=>x.TaskStatus)
.DPWhere(Wtm,x => x.ZoneId) .DPWhere(Wtm,x => x.ZoneId)
@@ -156,6 +156,12 @@ namespace HHWMS.Web.Controllers
{ {
return Json(new { Code = 500, Msg = "容器不存在" }); return Json(new { Code = 500, Msg = "容器不存在" });
} }
if (!string.IsNullOrWhiteSpace(container.LocationCode))
{
return Json(new { Code = 400, Msg = $"{container.Code} 容器状态不正确!已存在任务或者已在库内" });
}
var materialProcessList = _unitWork.Find<MaterialProcess>(m => m.MaterialCode == material.MaterialCode); var materialProcessList = _unitWork.Find<MaterialProcess>(m => m.MaterialCode == material.MaterialCode);
var materialProcess = _unitWork.FindSingle<MaterialProcess>(m => m.ID == model.ProcessId); var materialProcess = _unitWork.FindSingle<MaterialProcess>(m => m.ID == model.ProcessId);
@@ -222,6 +222,11 @@ namespace HHWMS.Web.Controllers
return JsonMore(null, 500, $"库内没有编码为 {containerCode} 的容器!"); return JsonMore(null, 500, $"库内没有编码为 {containerCode} 的容器!");
} }
if (!string.IsNullOrWhiteSpace(container.LocationCode))
{
return JsonMore(null,500, $"{container.Code} 容器状态不正确!已存在任务或者已在库内" );
}
// 查询容器的库存 // 查询容器的库存
var inventories = _unitWork.Find<Inventory>(x => x.ContainerCode == containerCode).ToList(); var inventories = _unitWork.Find<Inventory>(x => x.ContainerCode == containerCode).ToList();
@@ -5,8 +5,8 @@
<a-form :model="form" :rules="rules" ref="formRef" auto-label-width> <a-form :model="form" :rules="rules" ref="formRef" auto-label-width>
<a-form-item label="托盘码" field="palletCode"> <a-form-item label="托盘码" field="palletCode">
<a-input v-model="form.palletCode" ref="palletCodeRef" placeholder="请扫描托盘码" <a-input v-model="form.palletCode" ref="palletCodeRef" placeholder="请扫描托盘码"
@@keyup.enter="validateContainer"
@@keyup.enter="validateContainer" /> @@blur="validateContainer" />
</a-form-item> </a-form-item>
<a-form-item label="物料码" field="materialCode"> <a-form-item label="物料码" field="materialCode">
@@ -7,6 +7,7 @@
placeholder="扫描托盘号" placeholder="扫描托盘号"
allow-clear allow-clear
@@keyup.enter="validateContainer" @@keyup.enter="validateContainer"
@@blur="validateContainer"
ref="containerInput"/> ref="containerInput"/>
</a-form-item> </a-form-item>
<a-form-item field="materialCode" label="物料信息"> <a-form-item field="materialCode" label="物料信息">