添加wcs任务下发测试
修改入库功能 重新生成material页面
This commit is contained in:
1 parent
541fb5df6e
commit
2b01cc7584
20 files changed
+518
-60
No files matched your search
@@ -12,11 +12,11 @@ namespace HHWMS.Web.Controllers
|
|||||||
[ActionDescription("物料管理")]
|
[ActionDescription("物料管理")]
|
||||||
public partial class MaterialController : BaseController
|
public partial class MaterialController : BaseController
|
||||||
{
|
{
|
||||||
private readonly IUnitWork _unitwork;
|
private readonly IUnitWork _unitWork;
|
||||||
|
|
||||||
public MaterialController(IUnitWork unitwork)
|
public MaterialController(IUnitWork unitWork)
|
||||||
{
|
{
|
||||||
_unitwork = unitwork;
|
_unitWork = unitWork;
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Search
|
#region Search
|
||||||
|
|||||||
@@ -12,12 +12,6 @@ namespace HHWMS.Web
|
|||||||
{
|
{
|
||||||
public partial class MaterialTemplateVM : BaseTemplateVM
|
public partial class MaterialTemplateVM : BaseTemplateVM
|
||||||
{
|
{
|
||||||
[Display(Name = "Inventory.UniqueCode")]
|
|
||||||
public ExcelPropety UniqueCode_Excel = ExcelPropety.CreateProperty<Material>(x => x.UniqueCode);
|
|
||||||
[Display(Name = "Inventory.QRCode")]
|
|
||||||
public ExcelPropety QRCode_Excel = ExcelPropety.CreateProperty<Material>(x => x.QRCode);
|
|
||||||
[Display(Name = "Inventory.SourceCode")]
|
|
||||||
public ExcelPropety SourceCode_Excel = ExcelPropety.CreateProperty<Material>(x => x.SourceCode);
|
|
||||||
[Display(Name = "Inventory.MaterialCode")]
|
[Display(Name = "Inventory.MaterialCode")]
|
||||||
public ExcelPropety MaterialCode_Excel = ExcelPropety.CreateProperty<Material>(x => x.MaterialCode);
|
public ExcelPropety MaterialCode_Excel = ExcelPropety.CreateProperty<Material>(x => x.MaterialCode);
|
||||||
[Display(Name = "Inventory.MaterialType")]
|
[Display(Name = "Inventory.MaterialType")]
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@@ -32,17 +32,14 @@ namespace HHWMS.Web
|
|||||||
protected override IEnumerable<IGridColumn<Material_View>> InitGridHeader()
|
protected override IEnumerable<IGridColumn<Material_View>> InitGridHeader()
|
||||||
{
|
{
|
||||||
return new List<GridColumn<Material_View>>{
|
return new List<GridColumn<Material_View>>{
|
||||||
this.MakeGridHeader(x => x.UniqueCode).SetHide(),
|
|
||||||
this.MakeGridHeader(x => x.QRCode),
|
|
||||||
this.MakeGridHeader(x => x.SourceCode).SetHide(),
|
|
||||||
this.MakeGridHeader(x => x.MaterialCode),
|
this.MakeGridHeader(x => x.MaterialCode),
|
||||||
this.MakeGridHeader(x => x.MaterialType),
|
this.MakeGridHeader(x => x.MaterialType),
|
||||||
this.MakeGridHeader(x => x.MaterialName),
|
this.MakeGridHeader(x => x.MaterialName),
|
||||||
this.MakeGridHeader(x => x.MaterialSpec),
|
this.MakeGridHeader(x => x.MaterialSpec),
|
||||||
this.MakeGridHeader(x => x.MaterialUnit).SetWidth(80),
|
this.MakeGridHeader(x => x.MaterialUnit),
|
||||||
this.MakeGridHeader(x => x.Batch).SetWidth(150),
|
this.MakeGridHeader(x => x.Batch),
|
||||||
this.MakeGridHeader(x => x.Lot).SetHide(),
|
this.MakeGridHeader(x => x.Lot),
|
||||||
this.MakeGridHeader(x => x.CompanyCode).SetHide(),
|
this.MakeGridHeader(x => x.CompanyCode),
|
||||||
this.MakeGridHeader(x => x.SupplierCode),
|
this.MakeGridHeader(x => x.SupplierCode),
|
||||||
this.MakeGridHeader(x => x.Qty),
|
this.MakeGridHeader(x => x.Qty),
|
||||||
this.MakeGridHeaderAction(width: 200)
|
this.MakeGridHeaderAction(width: 200)
|
||||||
@@ -52,15 +49,15 @@ namespace HHWMS.Web
|
|||||||
public override IOrderedQueryable<Material_View> GetSearchQuery()
|
public override IOrderedQueryable<Material_View> GetSearchQuery()
|
||||||
{
|
{
|
||||||
var query = DC.Set<Material>()
|
var query = DC.Set<Material>()
|
||||||
.CheckContain(Searcher.UniqueCode, x=>x.UniqueCode)
|
|
||||||
.CheckContain(Searcher.QRCode, x=>x.QRCode)
|
|
||||||
.CheckContain(Searcher.MaterialCode, x=>x.MaterialCode)
|
.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)
|
||||||
.Select(x => new Material_View
|
.Select(x => new Material_View
|
||||||
{
|
{
|
||||||
ID = x.ID,
|
ID = x.ID,
|
||||||
UniqueCode = x.UniqueCode,
|
|
||||||
QRCode = x.QRCode,
|
|
||||||
SourceCode = x.SourceCode,
|
|
||||||
MaterialCode = x.MaterialCode,
|
MaterialCode = x.MaterialCode,
|
||||||
MaterialType = x.MaterialType,
|
MaterialType = x.MaterialType,
|
||||||
MaterialName = x.MaterialName,
|
MaterialName = x.MaterialName,
|
||||||
|
|||||||
@@ -12,12 +12,18 @@ namespace HHWMS.Web
|
|||||||
{
|
{
|
||||||
public partial class MaterialSearcher : BaseSearcher
|
public partial class MaterialSearcher : BaseSearcher
|
||||||
{
|
{
|
||||||
[Display(Name = "Inventory.UniqueCode")]
|
|
||||||
public String UniqueCode { get; set; }
|
|
||||||
[Display(Name = "Inventory.QRCode")]
|
|
||||||
public String QRCode { get; set; }
|
|
||||||
[Display(Name = "Inventory.MaterialCode")]
|
[Display(Name = "Inventory.MaterialCode")]
|
||||||
public String MaterialCode { get; set; }
|
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; }
|
||||||
|
|
||||||
protected override void InitVM()
|
protected override void InitVM()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,9 +3,6 @@
|
|||||||
|
|
||||||
<wt:form vm="@Model">
|
<wt:form vm="@Model">
|
||||||
<wt:row items-per-row="ItemsPerRowEnum.Two">
|
<wt:row items-per-row="ItemsPerRowEnum.Two">
|
||||||
<wt:textbox field="Entity.UniqueCode" />
|
|
||||||
<wt:textbox field="Entity.QRCode" />
|
|
||||||
<wt:textbox field="Entity.SourceCode" />
|
|
||||||
<wt:textbox field="Entity.MaterialCode" />
|
<wt:textbox field="Entity.MaterialCode" />
|
||||||
<wt:textbox field="Entity.MaterialType" />
|
<wt:textbox field="Entity.MaterialType" />
|
||||||
<wt:textbox field="Entity.MaterialName" />
|
<wt:textbox field="Entity.MaterialName" />
|
||||||
|
|||||||
@@ -4,9 +4,6 @@
|
|||||||
<wt:form vm="@Model">
|
<wt:form vm="@Model">
|
||||||
<wt:quote>@Localizer["Sys.DeleteConfirm"]</wt:quote>
|
<wt:quote>@Localizer["Sys.DeleteConfirm"]</wt:quote>
|
||||||
<wt:row items-per-row="ItemsPerRowEnum.Two">
|
<wt:row items-per-row="ItemsPerRowEnum.Two">
|
||||||
<wt:display field="Entity.UniqueCode" />
|
|
||||||
<wt:display field="Entity.QRCode" />
|
|
||||||
<wt:display field="Entity.SourceCode" />
|
|
||||||
<wt:display field="Entity.MaterialCode" />
|
<wt:display field="Entity.MaterialCode" />
|
||||||
<wt:display field="Entity.MaterialType" />
|
<wt:display field="Entity.MaterialType" />
|
||||||
<wt:display field="Entity.MaterialName" />
|
<wt:display field="Entity.MaterialName" />
|
||||||
|
|||||||
@@ -3,9 +3,6 @@
|
|||||||
|
|
||||||
<wt:form vm="@Model">
|
<wt:form vm="@Model">
|
||||||
<wt:row items-per-row="ItemsPerRowEnum.Two">
|
<wt:row items-per-row="ItemsPerRowEnum.Two">
|
||||||
<wt:display field="Entity.UniqueCode" />
|
|
||||||
<wt:display field="Entity.QRCode" />
|
|
||||||
<wt:display field="Entity.SourceCode" />
|
|
||||||
<wt:display field="Entity.MaterialCode" />
|
<wt:display field="Entity.MaterialCode" />
|
||||||
<wt:display field="Entity.MaterialType" />
|
<wt:display field="Entity.MaterialType" />
|
||||||
<wt:display field="Entity.MaterialName" />
|
<wt:display field="Entity.MaterialName" />
|
||||||
|
|||||||
@@ -3,9 +3,6 @@
|
|||||||
|
|
||||||
<wt:form vm="@Model">
|
<wt:form vm="@Model">
|
||||||
<wt:row items-per-row="ItemsPerRowEnum.Two">
|
<wt:row items-per-row="ItemsPerRowEnum.Two">
|
||||||
<wt:textbox field="Entity.UniqueCode" />
|
|
||||||
<wt:textbox field="Entity.QRCode" />
|
|
||||||
<wt:textbox field="Entity.SourceCode" />
|
|
||||||
<wt:textbox field="Entity.MaterialCode" />
|
<wt:textbox field="Entity.MaterialCode" />
|
||||||
<wt:textbox field="Entity.MaterialType" />
|
<wt:textbox field="Entity.MaterialType" />
|
||||||
<wt:textbox field="Entity.MaterialName" />
|
<wt:textbox field="Entity.MaterialName" />
|
||||||
|
|||||||
@@ -1,11 +1,14 @@
|
|||||||
@model HHWMS.Web.MaterialListVM
|
@model HHWMS.Web.MaterialListVM
|
||||||
@inject IStringLocalizer<Program> Localizer;
|
@inject IStringLocalizer<Program> Localizer;
|
||||||
|
|
||||||
<wt:searchpanel vm="@Model" reset-btn="true">
|
<wt:searchpanel vm="@Model" reset-btn="true">
|
||||||
<wt:row items-per-row="ItemsPerRowEnum.Three">
|
<wt:row items-per-row="ItemsPerRowEnum.Three">
|
||||||
<wt:textbox field="Searcher.UniqueCode" />
|
|
||||||
<wt:textbox field="Searcher.QRCode" />
|
|
||||||
<wt:textbox field="Searcher.MaterialCode" />
|
<wt:textbox field="Searcher.MaterialCode" />
|
||||||
|
<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:row>
|
</wt:row>
|
||||||
</wt:searchpanel>
|
</wt:searchpanel>
|
||||||
<wt:grid vm="@Model" url="/configs/Material/Search"/>
|
<wt:grid vm="@Model" url="/configs/Material/Search"/>
|
||||||
@@ -2,8 +2,12 @@ using Microsoft.AspNetCore.Mvc;
|
|||||||
using WalkingTec.Mvvm.Core;
|
using WalkingTec.Mvvm.Core;
|
||||||
using WalkingTec.Mvvm.Mvc;
|
using WalkingTec.Mvvm.Mvc;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using HHWMS.Web.Models;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Linq;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
namespace HHWMS.Web.Controllers
|
namespace HHWMS.Web.Areas.Receipt.Controllers
|
||||||
{
|
{
|
||||||
[Area("receipt")]
|
[Area("receipt")]
|
||||||
[ActionDescription("入库操作")]
|
[ActionDescription("入库操作")]
|
||||||
@@ -85,6 +89,37 @@ namespace HHWMS.Web.Controllers
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 搜索物料
|
||||||
|
/// </summary>
|
||||||
|
[HttpPost]
|
||||||
|
public IActionResult SearchMaterials(string keyword)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(keyword))
|
||||||
|
{
|
||||||
|
return Json(new { Code = 200, Data = new object[] { } });
|
||||||
|
}
|
||||||
|
|
||||||
|
var materials = _unitWork.Find<Material>
|
||||||
|
(m => m.MaterialCode.Contains(keyword) || m.MaterialName.Contains(keyword))
|
||||||
|
.Select(m => new
|
||||||
|
{
|
||||||
|
MaterialCode = m.MaterialCode,
|
||||||
|
MaterialName = m.MaterialName
|
||||||
|
})
|
||||||
|
.Take(10)
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
return Json(new { Code = 200, Data = materials });
|
||||||
|
}
|
||||||
|
catch (System.Exception ex)
|
||||||
|
{
|
||||||
|
return Json(new { Code = 500, Msg = $"搜索物料失败:{ex.Message}" });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endregion API Methods
|
#endregion API Methods
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,16 @@
|
|||||||
</a-form-item>
|
</a-form-item>
|
||||||
|
|
||||||
<a-form-item label="物料码" field="materialCode">
|
<a-form-item label="物料码" field="materialCode">
|
||||||
<a-input v-model="form.materialCode" @@change="scanMaterial" ref="materialCodeRef" placeholder="请扫描物料码" @@keydown.enter.prevent="focusNext('quantityInput')" />
|
<a-auto-complete
|
||||||
|
v-model="form.materialCode"
|
||||||
|
:data="materialOptions"
|
||||||
|
placeholder="请扫描或输入物料码"
|
||||||
|
@@search="handleMaterialSearch"
|
||||||
|
@@select="handleMaterialSelect"
|
||||||
|
ref="materialCodeRef"
|
||||||
|
@@keydown.enter.prevent="focusNext('quantityInput')"
|
||||||
|
>
|
||||||
|
</a-auto-complete>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
|
|
||||||
<a-form-item label="生产订单" field="orderId">
|
<a-form-item label="生产订单" field="orderId">
|
||||||
@@ -96,6 +105,9 @@
|
|||||||
const operatorOptions = ref([]);
|
const operatorOptions = ref([]);
|
||||||
const processOptions = ref([]);
|
const processOptions = ref([]);
|
||||||
|
|
||||||
|
const materialOptions = ref([]);
|
||||||
|
let searchTimer = null;
|
||||||
|
|
||||||
const rules = {
|
const rules = {
|
||||||
palletCode: [
|
palletCode: [
|
||||||
{ required: true, message: '请输入托盘码', trigger: ['change', 'blur'] }
|
{ required: true, message: '请输入托盘码', trigger: ['change', 'blur'] }
|
||||||
@@ -162,6 +174,57 @@
|
|||||||
// TODO: 实现托盘码验证逻辑
|
// TODO: 实现托盘码验证逻辑
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 处理物料搜索
|
||||||
|
const handleMaterialSearch = (value) => {
|
||||||
|
if (searchTimer) {
|
||||||
|
clearTimeout(searchTimer);
|
||||||
|
}
|
||||||
|
searchTimer = setTimeout(() => {
|
||||||
|
if (value) {
|
||||||
|
searchMaterials(value);
|
||||||
|
} else {
|
||||||
|
materialOptions.value = [];
|
||||||
|
}
|
||||||
|
}, 300);
|
||||||
|
};
|
||||||
|
|
||||||
|
// 搜索物料
|
||||||
|
const searchMaterials = (keyword) => {
|
||||||
|
$.ajax({
|
||||||
|
type: "post",
|
||||||
|
dataType: "json",
|
||||||
|
data: { keyword: keyword },
|
||||||
|
url: "/receipt/ReceiptIn/SearchMaterials",
|
||||||
|
success: (json) => {
|
||||||
|
console.log(json);
|
||||||
|
if (json.Code == 200) {
|
||||||
|
materialOptions.value = json.Data.map(item => ({
|
||||||
|
...item,
|
||||||
|
value: item.MaterialCode,
|
||||||
|
label: `${item.MaterialCode} - ${item.MaterialName}`
|
||||||
|
}));console.log(materialOptions.value)
|
||||||
|
} else {
|
||||||
|
Message.error(json.Msg || '搜索失败');
|
||||||
|
materialOptions.value = [];
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: (xhr, status, error) => {
|
||||||
|
Message.error('搜索失败:' + error);
|
||||||
|
materialOptions.value = [];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
// 处理物料选择
|
||||||
|
const handleMaterialSelect = (value, option) => {
|
||||||
|
const selectedMaterial = materialOptions.value.find(item => item.value === value);
|
||||||
|
if (selectedMaterial) {
|
||||||
|
form.materialCode = selectedMaterial.MaterialCode;
|
||||||
|
// 选择物料后加载相关订单
|
||||||
|
scanMaterial();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// 扫描物料码
|
// 扫描物料码
|
||||||
const scanMaterial = () => {
|
const scanMaterial = () => {
|
||||||
if (!form.materialCode) return;
|
if (!form.materialCode) return;
|
||||||
@@ -287,7 +350,10 @@
|
|||||||
handleOrderChange,
|
handleOrderChange,
|
||||||
submitForm,
|
submitForm,
|
||||||
resetForm,
|
resetForm,
|
||||||
focusNext
|
focusNext,
|
||||||
|
materialOptions,
|
||||||
|
handleMaterialSearch,
|
||||||
|
handleMaterialSelect
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -0,0 +1,53 @@
|
|||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using HHWMS.Web.Models;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using WalkingTec.Mvvm.Core;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Microsoft.AspNetCore.Http;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using System;
|
||||||
|
using WalkingTec.Mvvm.Core;
|
||||||
|
using WalkingTec.Mvvm.Mvc;
|
||||||
|
using WalkingTec.Mvvm.Core.Extensions;
|
||||||
|
|
||||||
|
namespace HHWMS.Web.Controllers
|
||||||
|
{
|
||||||
|
[Area("WCS")]
|
||||||
|
[ActionDescription("WCS任务测试")]
|
||||||
|
public class WCSTaskController : BaseController
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// WCS任务下发页面
|
||||||
|
/// </summary>
|
||||||
|
public IActionResult Index()
|
||||||
|
{
|
||||||
|
return PartialView("Index");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 提交WCS任务
|
||||||
|
/// </summary>
|
||||||
|
[HttpPost]
|
||||||
|
public async Task<IActionResult> SubmitTask([FromBody] WCSTaskModel model)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// 调用WCS任务下发接口
|
||||||
|
var result = Wtm.CallAPI<WCSTaskResponse>("WCS", "TaskAssign", HttpMethodEnum.POST, model).Result.Data;
|
||||||
|
|
||||||
|
if (result != null && result.Success)
|
||||||
|
{
|
||||||
|
return Json(new { Success = true, Msg = result.Msg ?? "接收任务成功", Data = (object)null });
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return Json(new { Success = false, Msg = result?.Msg ?? "任务下发失败", Data = (object)null });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (System.Exception ex)
|
||||||
|
{
|
||||||
|
return Json(new { Success = false, Msg = $"任务下发失败:{ex.Message}", Data = (object)null });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,225 @@
|
|||||||
|
@{
|
||||||
|
ViewData["Title"] = "WCS任务下发";
|
||||||
|
}
|
||||||
|
|
||||||
|
<div id="wcsapp">
|
||||||
|
<a-row :gutter="20">
|
||||||
|
<a-col :span="24">
|
||||||
|
<a-card class="general-card">
|
||||||
|
<a-form :model="form" :rules="rules" ref="formRef" auto-label-width>
|
||||||
|
<a-form-item label="任务类型" field="taskType">
|
||||||
|
<a-radio-group v-model="form.taskType" @@change="handleTaskTypeChange">
|
||||||
|
<a-radio value="in">入库</a-radio>
|
||||||
|
<a-radio value="out">出库</a-radio>
|
||||||
|
</a-radio-group>
|
||||||
|
</a-form-item>
|
||||||
|
|
||||||
|
<a-form-item label="任务号" field="taskNo">
|
||||||
|
<a-input v-model="form.taskNo" ref="taskNoRef" placeholder="请输入任务号(选填)" @@keydown.enter.prevent="focusNext('palletNoRef')" />
|
||||||
|
</a-form-item>
|
||||||
|
|
||||||
|
<a-form-item label="托盘号" field="palletNo">
|
||||||
|
<a-input v-model="form.palletNo" @@change="scanPallet" ref="palletNoRef" placeholder="请扫描托盘号" @@keydown.enter.prevent="focusNext('fromLocationRef')" />
|
||||||
|
</a-form-item>
|
||||||
|
|
||||||
|
<a-form-item label="起始位置" field="fromLocation">
|
||||||
|
<a-input v-model="form.fromLocation" ref="fromLocationRef" placeholder="请输入起始位置"
|
||||||
|
:disabled="form.taskType === 'in'"
|
||||||
|
@@keydown.enter.prevent="focusNext('toLocationRef')" />
|
||||||
|
</a-form-item>
|
||||||
|
|
||||||
|
<a-form-item label="目标位置" field="toLocation">
|
||||||
|
<template v-if="form.taskType === 'in'">
|
||||||
|
<a-input v-model="form.toLocation" ref="toLocationRef" placeholder="请输入目标位置" />
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
<a-select v-model="form.toLocation" placeholder="请选择目标位置" ref="toLocationRef">
|
||||||
|
<a-option v-for="item in locationOptions"
|
||||||
|
:key="item.value"
|
||||||
|
:value="item.value">
|
||||||
|
{{ item.label }}
|
||||||
|
</a-option>
|
||||||
|
</a-select>
|
||||||
|
</template>
|
||||||
|
</a-form-item>
|
||||||
|
|
||||||
|
<a-form-item>
|
||||||
|
<a-space>
|
||||||
|
<a-button type="primary" @@click="submitForm" :loading="loading">下发任务</a-button>
|
||||||
|
<a-button @@click="resetForm">重置</a-button>
|
||||||
|
</a-space>
|
||||||
|
</a-form-item>
|
||||||
|
</a-form>
|
||||||
|
</a-card>
|
||||||
|
</a-col>
|
||||||
|
</a-row>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
const { createApp, reactive, ref, onMounted, nextTick, watch } = Vue;
|
||||||
|
const { Message } = ArcoVue;
|
||||||
|
|
||||||
|
const app = createApp({
|
||||||
|
setup() {
|
||||||
|
const formRef = ref(null);
|
||||||
|
const taskNoRef = ref(null);
|
||||||
|
const palletNoRef = ref(null);
|
||||||
|
const fromLocationRef = ref(null);
|
||||||
|
const toLocationRef = ref(null);
|
||||||
|
const loading = ref(false);
|
||||||
|
|
||||||
|
const form = reactive({
|
||||||
|
taskType: 'in', // 默认入库
|
||||||
|
taskNo: '',
|
||||||
|
palletNo: '',
|
||||||
|
fromLocation: '',
|
||||||
|
toLocation: ''
|
||||||
|
});
|
||||||
|
|
||||||
|
const locationOptions = ref([
|
||||||
|
{ value: 'EnterExit_P2001', label: '拣货口1' },
|
||||||
|
{ value: 'EnterExit_P2003', label: '拣货口2' },
|
||||||
|
{ value: 'EnterExit_P2005', label: '拣货口3' },
|
||||||
|
{ value: 'EnterExit_P2007', label: '拣货口4' },
|
||||||
|
{ value: 'EnterExit_P2009', label: '拣货口5' },
|
||||||
|
{ value: 'EnterExit_P2011', label: '拣货口6' },
|
||||||
|
{ value: 'EnterExit_P2013', label: '拣货口7' }
|
||||||
|
]);
|
||||||
|
|
||||||
|
const rules = reactive({
|
||||||
|
palletNo: [
|
||||||
|
{ required: true, message: '请输入托盘号', trigger: ['change', 'blur'] }
|
||||||
|
],
|
||||||
|
fromLocation: [
|
||||||
|
{
|
||||||
|
required: form.taskType === 'out',
|
||||||
|
message: '请输入起始位置',
|
||||||
|
trigger: ['change', 'blur']
|
||||||
|
}
|
||||||
|
],
|
||||||
|
toLocation: [
|
||||||
|
{ required: true, message: '请输入/选择目标位置', trigger: ['change', 'blur'] }
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
|
// 任务类型变更处理
|
||||||
|
const handleTaskTypeChange = () => {
|
||||||
|
if (form.taskType === 'in') {
|
||||||
|
form.fromLocation = ''; // 入库时清空起始位置
|
||||||
|
}
|
||||||
|
form.toLocation = ''; // 清空目标位置
|
||||||
|
// 更新验证规则
|
||||||
|
rules.fromLocation[0].required = form.taskType === 'out';
|
||||||
|
};
|
||||||
|
|
||||||
|
// 扫描托盘号
|
||||||
|
const scanPallet = () => {
|
||||||
|
if (!form.palletNo) return;
|
||||||
|
// TODO: 实现托盘号验证逻辑
|
||||||
|
};
|
||||||
|
|
||||||
|
// 提交表单
|
||||||
|
const submitForm = () => {
|
||||||
|
formRef.value.validate((errors) => {
|
||||||
|
if (!errors) {
|
||||||
|
loading.value = true;
|
||||||
|
$.ajax({
|
||||||
|
type: "post",
|
||||||
|
dataType: "json",
|
||||||
|
contentType: "application/json",
|
||||||
|
data: JSON.stringify(form),
|
||||||
|
url: "/wcs/WCSTask/SubmitTask",
|
||||||
|
success: (json) => {
|
||||||
|
if (json.Success) {
|
||||||
|
Message.success(json.Msg || '任务下发成功!');
|
||||||
|
resetForm();
|
||||||
|
} else {
|
||||||
|
Message.error(json.Msg || '任务下发失败!');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: (xhr, status, error) => {
|
||||||
|
Message.error('提交失败:' + error);
|
||||||
|
},
|
||||||
|
complete: () => {
|
||||||
|
loading.value = false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
Message.error('请填写所有必填项!');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
// 重置表单
|
||||||
|
const resetForm = () => {
|
||||||
|
formRef.value.resetFields();
|
||||||
|
setTimeout(() => {
|
||||||
|
if (taskNoRef.value) {
|
||||||
|
taskNoRef.value.focus();
|
||||||
|
}
|
||||||
|
}, 100);
|
||||||
|
};
|
||||||
|
|
||||||
|
// 焦点跳转到下一个输入框
|
||||||
|
const focusNext = (nextRef) => {
|
||||||
|
const refMap = {
|
||||||
|
palletNoRef: palletNoRef,
|
||||||
|
fromLocationRef: fromLocationRef,
|
||||||
|
toLocationRef: toLocationRef
|
||||||
|
};
|
||||||
|
|
||||||
|
const nextElement = refMap[nextRef];
|
||||||
|
if (nextElement?.value) {
|
||||||
|
// 先让当前元素失去焦点
|
||||||
|
if (document.activeElement) {
|
||||||
|
document.activeElement.blur();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 使用 nextTick 确保 DOM 更新完成
|
||||||
|
nextTick(() => {
|
||||||
|
if (nextElement.value.$el) {
|
||||||
|
// 处理 Input 组件
|
||||||
|
const input = nextElement.value.$el.querySelector('input');
|
||||||
|
if (input) {
|
||||||
|
input.focus();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// 处理基础组件
|
||||||
|
nextElement.value.focus();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// 生命周期钩子
|
||||||
|
onMounted(() => {
|
||||||
|
// 页面加载时自动聚焦第一个输入框
|
||||||
|
setTimeout(() => {
|
||||||
|
if (taskNoRef.value) {
|
||||||
|
taskNoRef.value.focus();
|
||||||
|
}
|
||||||
|
}, 100);
|
||||||
|
});
|
||||||
|
|
||||||
|
return {
|
||||||
|
formRef,
|
||||||
|
taskNoRef,
|
||||||
|
palletNoRef,
|
||||||
|
fromLocationRef,
|
||||||
|
toLocationRef,
|
||||||
|
form,
|
||||||
|
loading,
|
||||||
|
locationOptions,
|
||||||
|
rules,
|
||||||
|
handleTaskTypeChange,
|
||||||
|
scanPallet,
|
||||||
|
submitForm,
|
||||||
|
resetForm,
|
||||||
|
focusNext
|
||||||
|
};
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
app.use(ArcoVue);
|
||||||
|
app.mount('#wcsapp');
|
||||||
|
</script>
|
||||||
@@ -43,6 +43,16 @@
|
|||||||
<PackageReference Include="WalkingTec.Mvvm.TagHelpers.LayUI" Version="6.4.1-alpha" />
|
<PackageReference Include="WalkingTec.Mvvm.TagHelpers.LayUI" Version="6.4.1-alpha" />
|
||||||
<PackageReference Include="Z.EntityFramework.Plus.EFCore" Version="6.102.1.1" />
|
<PackageReference Include="Z.EntityFramework.Plus.EFCore" Version="6.102.1.1" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<_ContentIncludedByDefault Remove="Areas\Configs\Views\Material\BatchDelete.cshtml" />
|
||||||
|
<_ContentIncludedByDefault Remove="Areas\Configs\Views\Material\BatchEdit.cshtml" />
|
||||||
|
<_ContentIncludedByDefault Remove="Areas\Configs\Views\Material\Create.cshtml" />
|
||||||
|
<_ContentIncludedByDefault Remove="Areas\Configs\Views\Material\Delete.cshtml" />
|
||||||
|
<_ContentIncludedByDefault Remove="Areas\Configs\Views\Material\Details.cshtml" />
|
||||||
|
<_ContentIncludedByDefault Remove="Areas\Configs\Views\Material\Edit.cshtml" />
|
||||||
|
<_ContentIncludedByDefault Remove="Areas\Configs\Views\Material\Import.cshtml" />
|
||||||
|
<_ContentIncludedByDefault Remove="Areas\Configs\Views\Material\Index.cshtml" />
|
||||||
|
</ItemGroup>
|
||||||
<ProjectExtensions>
|
<ProjectExtensions>
|
||||||
<VisualStudio>
|
<VisualStudio>
|
||||||
<UserProperties appsettings_1json__JsonSchema="" />
|
<UserProperties appsettings_1json__JsonSchema="" />
|
||||||
|
|||||||
@@ -13,18 +13,6 @@ namespace HHWMS.Web.Models
|
|||||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||||
public new int ID { get; set; }
|
public new int ID { get; set; }
|
||||||
|
|
||||||
[Display(Name = "Inventory.UniqueCode", Description = "唯一码")]
|
|
||||||
[StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
|
|
||||||
public string UniqueCode { get; set; }
|
|
||||||
|
|
||||||
[Display(Name = "Inventory.QRCode", Description = "二维码")]
|
|
||||||
[StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
|
|
||||||
public string QRCode { get; set; }
|
|
||||||
|
|
||||||
[Display(Name = "Inventory.SourceCode", Description = "上游单号")]
|
|
||||||
[StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
|
|
||||||
public string SourceCode { get; set; }
|
|
||||||
|
|
||||||
[Display(Name = "Inventory.MaterialCode", Description = "物料编码")]
|
[Display(Name = "Inventory.MaterialCode", Description = "物料编码")]
|
||||||
[StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
|
[StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
|
||||||
public string MaterialCode { get; set; }
|
public string MaterialCode { get; set; }
|
||||||
|
|||||||
@@ -273,5 +273,44 @@ namespace HHWMS.Web.Models
|
|||||||
public const string 任务中 = "lock";
|
public const string 任务中 = "lock";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 拣货口
|
||||||
|
/// </summary>
|
||||||
|
public static class PickingLocation
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 拣货口1
|
||||||
|
/// </summary>
|
||||||
|
public const string Picking_1 = "EnterExit_P2001";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 拣货口2
|
||||||
|
/// </summary>
|
||||||
|
public const string Picking_2 = "EnterExit_P2003";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 拣货口3
|
||||||
|
/// </summary>
|
||||||
|
public const string Picking_3 = "EnterExit_P2005";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 拣货口4
|
||||||
|
/// </summary>
|
||||||
|
public const string Picking_4 = "EnterExit_P2007";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 拣货口5
|
||||||
|
/// </summary>
|
||||||
|
public const string Picking_5 = "EnterExit_P2009";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 拣货口6
|
||||||
|
/// </summary>
|
||||||
|
public const string Picking_6 = "EnterExit_P2011";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 拣货口7
|
||||||
|
/// </summary>
|
||||||
|
public const string Picking_7 = "EnterExit_P2013";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
|
namespace HHWMS.Web.Models
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// WCS任务下发模型
|
||||||
|
/// </summary>
|
||||||
|
public class WCSTaskModel
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 任务号(选填)
|
||||||
|
/// </summary>
|
||||||
|
public string TaskNo { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 托盘号
|
||||||
|
/// </summary>
|
||||||
|
[Required(ErrorMessage = "托盘号不能为空")]
|
||||||
|
public string PalletNo { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 起始位置
|
||||||
|
/// </summary>
|
||||||
|
[Required(ErrorMessage = "起始位置不能为空")]
|
||||||
|
public string FromLocation { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 目标位置
|
||||||
|
/// </summary>
|
||||||
|
[Required(ErrorMessage = "目标位置不能为空")]
|
||||||
|
public string ToLocation { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
namespace HHWMS.Web.Models
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// WCS任务响应模型
|
||||||
|
/// </summary>
|
||||||
|
public class WCSTaskResponse
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 是否成功
|
||||||
|
/// </summary>
|
||||||
|
public bool Success { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 消息
|
||||||
|
/// </summary>
|
||||||
|
public string Msg { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 数据
|
||||||
|
/// </summary>
|
||||||
|
public object Data { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -41,9 +41,7 @@ namespace WebService
|
|||||||
MaterialUnit = item.ERFME,
|
MaterialUnit = item.ERFME,
|
||||||
MaterialSpec = item.ZZXHGG,
|
MaterialSpec = item.ZZXHGG,
|
||||||
Batch = item.LICHA,
|
Batch = item.LICHA,
|
||||||
QRCode = item.ZMBLNR,
|
|
||||||
Qty = decimal.Parse(item.MENGE),
|
|
||||||
SourceCode = item.AUFNR,
|
|
||||||
SupplierCode = item.ZZSCCJ,
|
SupplierCode = item.ZZSCCJ,
|
||||||
CreateTime = DateTime.Now,
|
CreateTime = DateTime.Now,
|
||||||
CreateBy = "mes"
|
CreateBy = "mes"
|
||||||
|
|||||||
@@ -93,7 +93,7 @@
|
|||||||
},
|
},
|
||||||
"Domains": {
|
"Domains": {
|
||||||
"WCS": {
|
"WCS": {
|
||||||
"Address": "http://10.18.97.205:1111/api/WcsWebApi/"
|
"Address": "http://192.168.30.200:65533/api/WCS/"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"AppSettings": {
|
"AppSettings": {
|
||||||
|
|||||||
Reference in new issue
Block a user