diff --git a/HHWMS.Web/Areas/Configs/Controllers/MaterialController.cs b/HHWMS.Web/Areas/Configs/Controllers/MaterialController.cs index 3ebda4e..8e4f97e 100644 --- a/HHWMS.Web/Areas/Configs/Controllers/MaterialController.cs +++ b/HHWMS.Web/Areas/Configs/Controllers/MaterialController.cs @@ -12,11 +12,11 @@ namespace HHWMS.Web.Controllers [ActionDescription("物料管理")] 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 diff --git a/HHWMS.Web/Areas/Configs/ViewModels/MaterialVMs/MaterialImportVM.cs b/HHWMS.Web/Areas/Configs/ViewModels/MaterialVMs/MaterialImportVM.cs index 70a13a2..427f3d4 100644 --- a/HHWMS.Web/Areas/Configs/ViewModels/MaterialVMs/MaterialImportVM.cs +++ b/HHWMS.Web/Areas/Configs/ViewModels/MaterialVMs/MaterialImportVM.cs @@ -12,12 +12,6 @@ namespace HHWMS.Web { public partial class MaterialTemplateVM : BaseTemplateVM { - [Display(Name = "Inventory.UniqueCode")] - public ExcelPropety UniqueCode_Excel = ExcelPropety.CreateProperty(x => x.UniqueCode); - [Display(Name = "Inventory.QRCode")] - public ExcelPropety QRCode_Excel = ExcelPropety.CreateProperty(x => x.QRCode); - [Display(Name = "Inventory.SourceCode")] - public ExcelPropety SourceCode_Excel = ExcelPropety.CreateProperty(x => x.SourceCode); [Display(Name = "Inventory.MaterialCode")] public ExcelPropety MaterialCode_Excel = ExcelPropety.CreateProperty(x => x.MaterialCode); [Display(Name = "Inventory.MaterialType")] diff --git a/HHWMS.Web/Areas/Configs/ViewModels/MaterialVMs/MaterialListVM.cs b/HHWMS.Web/Areas/Configs/ViewModels/MaterialVMs/MaterialListVM.cs index f8deb72..d58a5d8 100644 --- a/HHWMS.Web/Areas/Configs/ViewModels/MaterialVMs/MaterialListVM.cs +++ b/HHWMS.Web/Areas/Configs/ViewModels/MaterialVMs/MaterialListVM.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; @@ -32,17 +32,14 @@ namespace HHWMS.Web protected override IEnumerable> InitGridHeader() { return new List>{ - 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.MaterialType), this.MakeGridHeader(x => x.MaterialName), this.MakeGridHeader(x => x.MaterialSpec), - this.MakeGridHeader(x => x.MaterialUnit).SetWidth(80), - this.MakeGridHeader(x => x.Batch).SetWidth(150), - this.MakeGridHeader(x => x.Lot).SetHide(), - this.MakeGridHeader(x => x.CompanyCode).SetHide(), + this.MakeGridHeader(x => x.MaterialUnit), + this.MakeGridHeader(x => x.Batch), + this.MakeGridHeader(x => x.Lot), + this.MakeGridHeader(x => x.CompanyCode), this.MakeGridHeader(x => x.SupplierCode), this.MakeGridHeader(x => x.Qty), this.MakeGridHeaderAction(width: 200) @@ -52,15 +49,15 @@ namespace HHWMS.Web public override IOrderedQueryable GetSearchQuery() { var query = DC.Set() - .CheckContain(Searcher.UniqueCode, x=>x.UniqueCode) - .CheckContain(Searcher.QRCode, x=>x.QRCode) .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 { ID = x.ID, - UniqueCode = x.UniqueCode, - QRCode = x.QRCode, - SourceCode = x.SourceCode, MaterialCode = x.MaterialCode, MaterialType = x.MaterialType, MaterialName = x.MaterialName, diff --git a/HHWMS.Web/Areas/Configs/ViewModels/MaterialVMs/MaterialSearcher.cs b/HHWMS.Web/Areas/Configs/ViewModels/MaterialVMs/MaterialSearcher.cs index 9f4326a..1d44991 100644 --- a/HHWMS.Web/Areas/Configs/ViewModels/MaterialVMs/MaterialSearcher.cs +++ b/HHWMS.Web/Areas/Configs/ViewModels/MaterialVMs/MaterialSearcher.cs @@ -12,12 +12,18 @@ namespace HHWMS.Web { 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")] 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() { diff --git a/HHWMS.Web/Areas/Configs/Views/Material/Create.cshtml b/HHWMS.Web/Areas/Configs/Views/Material/Create.cshtml index d0b0e0b..0d8fb9e 100644 --- a/HHWMS.Web/Areas/Configs/Views/Material/Create.cshtml +++ b/HHWMS.Web/Areas/Configs/Views/Material/Create.cshtml @@ -3,9 +3,6 @@ - - - diff --git a/HHWMS.Web/Areas/Configs/Views/Material/Delete.cshtml b/HHWMS.Web/Areas/Configs/Views/Material/Delete.cshtml index abeb034..bb479d0 100644 --- a/HHWMS.Web/Areas/Configs/Views/Material/Delete.cshtml +++ b/HHWMS.Web/Areas/Configs/Views/Material/Delete.cshtml @@ -4,9 +4,6 @@ @Localizer["Sys.DeleteConfirm"] - - - diff --git a/HHWMS.Web/Areas/Configs/Views/Material/Details.cshtml b/HHWMS.Web/Areas/Configs/Views/Material/Details.cshtml index 4269bb3..61f2e93 100644 --- a/HHWMS.Web/Areas/Configs/Views/Material/Details.cshtml +++ b/HHWMS.Web/Areas/Configs/Views/Material/Details.cshtml @@ -3,9 +3,6 @@ - - - diff --git a/HHWMS.Web/Areas/Configs/Views/Material/Edit.cshtml b/HHWMS.Web/Areas/Configs/Views/Material/Edit.cshtml index 1727767..2770d08 100644 --- a/HHWMS.Web/Areas/Configs/Views/Material/Edit.cshtml +++ b/HHWMS.Web/Areas/Configs/Views/Material/Edit.cshtml @@ -3,9 +3,6 @@ - - - diff --git a/HHWMS.Web/Areas/Configs/Views/Material/Index.cshtml b/HHWMS.Web/Areas/Configs/Views/Material/Index.cshtml index da33ae4..13d1166 100644 --- a/HHWMS.Web/Areas/Configs/Views/Material/Index.cshtml +++ b/HHWMS.Web/Areas/Configs/Views/Material/Index.cshtml @@ -1,11 +1,14 @@ -@model HHWMS.Web.MaterialListVM +@model HHWMS.Web.MaterialListVM @inject IStringLocalizer Localizer; - - + + + + + diff --git a/HHWMS.Web/Areas/Receipt/Controllers/ReceiptInController.cs b/HHWMS.Web/Areas/Receipt/Controllers/ReceiptInController.cs index a4f8987..61f6827 100644 --- a/HHWMS.Web/Areas/Receipt/Controllers/ReceiptInController.cs +++ b/HHWMS.Web/Areas/Receipt/Controllers/ReceiptInController.cs @@ -2,8 +2,12 @@ using Microsoft.AspNetCore.Mvc; using WalkingTec.Mvvm.Core; using WalkingTec.Mvvm.Mvc; 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")] [ActionDescription("入库操作")] @@ -85,6 +89,37 @@ namespace HHWMS.Web.Controllers } } + /// + /// 搜索物料 + /// + [HttpPost] + public IActionResult SearchMaterials(string keyword) + { + try + { + if (string.IsNullOrWhiteSpace(keyword)) + { + return Json(new { Code = 200, Data = new object[] { } }); + } + + var materials = _unitWork.Find + (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 } diff --git a/HHWMS.Web/Areas/Receipt/Views/ReceiptIn/Index.cshtml b/HHWMS.Web/Areas/Receipt/Views/ReceiptIn/Index.cshtml index 0ba23ca..867e6a9 100644 --- a/HHWMS.Web/Areas/Receipt/Views/ReceiptIn/Index.cshtml +++ b/HHWMS.Web/Areas/Receipt/Views/ReceiptIn/Index.cshtml @@ -8,7 +8,16 @@ - + + @@ -96,6 +105,9 @@ const operatorOptions = ref([]); const processOptions = ref([]); + const materialOptions = ref([]); + let searchTimer = null; + const rules = { palletCode: [ { required: true, message: '请输入托盘码', trigger: ['change', 'blur'] } @@ -162,6 +174,57 @@ // 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 = () => { if (!form.materialCode) return; @@ -287,7 +350,10 @@ handleOrderChange, submitForm, resetForm, - focusNext + focusNext, + materialOptions, + handleMaterialSearch, + handleMaterialSelect }; } }); diff --git a/HHWMS.Web/Areas/WCS/Controllers/WCSTaskController.cs b/HHWMS.Web/Areas/WCS/Controllers/WCSTaskController.cs new file mode 100644 index 0000000..e7b264d --- /dev/null +++ b/HHWMS.Web/Areas/WCS/Controllers/WCSTaskController.cs @@ -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 + { + /// + /// WCS任务下发页面 + /// + public IActionResult Index() + { + return PartialView("Index"); + } + + /// + /// 提交WCS任务 + /// + [HttpPost] + public async Task SubmitTask([FromBody] WCSTaskModel model) + { + try + { + // 调用WCS任务下发接口 + var result = Wtm.CallAPI("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 }); + } + } + } +} \ No newline at end of file diff --git a/HHWMS.Web/Areas/WCS/Views/WCSTask/Index.cshtml b/HHWMS.Web/Areas/WCS/Views/WCSTask/Index.cshtml new file mode 100644 index 0000000..d538b44 --- /dev/null +++ b/HHWMS.Web/Areas/WCS/Views/WCSTask/Index.cshtml @@ -0,0 +1,225 @@ +@{ + ViewData["Title"] = "WCS任务下发"; +} + +
+ + + + + + + 入库 + 出库 + + + + + + + + + + + + + + + + + + + + + + + 下发任务 + 重置 + + + + + + +
+ + \ No newline at end of file diff --git a/HHWMS.Web/HHWMS.Web.csproj b/HHWMS.Web/HHWMS.Web.csproj index ad77321..f29dedb 100644 --- a/HHWMS.Web/HHWMS.Web.csproj +++ b/HHWMS.Web/HHWMS.Web.csproj @@ -43,6 +43,16 @@ + + <_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" /> + diff --git a/HHWMS.Web/Models/Configs/Material.cs b/HHWMS.Web/Models/Configs/Material.cs index 5ae81a3..14af1de 100644 --- a/HHWMS.Web/Models/Configs/Material.cs +++ b/HHWMS.Web/Models/Configs/Material.cs @@ -13,18 +13,6 @@ namespace HHWMS.Web.Models [DatabaseGenerated(DatabaseGeneratedOption.Identity)] 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 = "物料编码")] [StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")] public string MaterialCode { get; set; } diff --git a/HHWMS.Web/Models/Enum/WMSEnum.cs b/HHWMS.Web/Models/Enum/WMSEnum.cs index b271c00..2d18ea5 100644 --- a/HHWMS.Web/Models/Enum/WMSEnum.cs +++ b/HHWMS.Web/Models/Enum/WMSEnum.cs @@ -273,5 +273,44 @@ namespace HHWMS.Web.Models public const string 任务中 = "lock"; } + /// + /// 拣货口 + /// + public static class PickingLocation + { + /// + /// 拣货口1 + /// + public const string Picking_1 = "EnterExit_P2001"; + /// + /// 拣货口2 + /// + public const string Picking_2 = "EnterExit_P2003"; + + /// + /// 拣货口3 + /// + public const string Picking_3 = "EnterExit_P2005"; + + /// + /// 拣货口4 + /// + public const string Picking_4 = "EnterExit_P2007"; + + /// + /// 拣货口5 + /// + public const string Picking_5 = "EnterExit_P2009"; + + /// + /// 拣货口6 + /// + public const string Picking_6 = "EnterExit_P2011"; + + /// + /// 拣货口7 + /// + public const string Picking_7 = "EnterExit_P2013"; + } } diff --git a/HHWMS.Web/Models/WCS/WCSTaskModel.cs b/HHWMS.Web/Models/WCS/WCSTaskModel.cs new file mode 100644 index 0000000..51c66dc --- /dev/null +++ b/HHWMS.Web/Models/WCS/WCSTaskModel.cs @@ -0,0 +1,33 @@ +using System.ComponentModel.DataAnnotations; + +namespace HHWMS.Web.Models +{ + /// + /// WCS任务下发模型 + /// + public class WCSTaskModel + { + /// + /// 任务号(选填) + /// + public string TaskNo { get; set; } + + /// + /// 托盘号 + /// + [Required(ErrorMessage = "托盘号不能为空")] + public string PalletNo { get; set; } + + /// + /// 起始位置 + /// + [Required(ErrorMessage = "起始位置不能为空")] + public string FromLocation { get; set; } + + /// + /// 目标位置 + /// + [Required(ErrorMessage = "目标位置不能为空")] + public string ToLocation { get; set; } + } +} \ No newline at end of file diff --git a/HHWMS.Web/Models/WCS/WCSTaskResponse.cs b/HHWMS.Web/Models/WCS/WCSTaskResponse.cs new file mode 100644 index 0000000..cfd9da9 --- /dev/null +++ b/HHWMS.Web/Models/WCS/WCSTaskResponse.cs @@ -0,0 +1,23 @@ +namespace HHWMS.Web.Models +{ + /// + /// WCS任务响应模型 + /// + public class WCSTaskResponse + { + /// + /// 是否成功 + /// + public bool Success { get; set; } + + /// + /// 消息 + /// + public string Msg { get; set; } + + /// + /// 数据 + /// + public object Data { get; set; } + } +} diff --git a/HHWMS.Web/WebService/WmsMesService.cs b/HHWMS.Web/WebService/WmsMesService.cs index 07a0701..50afc58 100644 --- a/HHWMS.Web/WebService/WmsMesService.cs +++ b/HHWMS.Web/WebService/WmsMesService.cs @@ -41,9 +41,7 @@ namespace WebService MaterialUnit = item.ERFME, MaterialSpec = item.ZZXHGG, Batch = item.LICHA, - QRCode = item.ZMBLNR, - Qty = decimal.Parse(item.MENGE), - SourceCode = item.AUFNR, + SupplierCode = item.ZZSCCJ, CreateTime = DateTime.Now, CreateBy = "mes" diff --git a/HHWMS.Web/appsettings.json b/HHWMS.Web/appsettings.json index 8bb7a5b..956c096 100644 --- a/HHWMS.Web/appsettings.json +++ b/HHWMS.Web/appsettings.json @@ -93,7 +93,7 @@ }, "Domains": { "WCS": { - "Address": "http://10.18.97.205:1111/api/WcsWebApi/" + "Address": "http://192.168.30.200:65533/api/WCS/" } }, "AppSettings": {