添加客户管理

修改入库页面
修改 库存 物料 工序等页面
This commit is contained in:
zhougf committed 2025-07-25 04:35:31 +08:00
1 parent 2435176f77
commit c2b039ea47
41 files changed
+977 -160

No files matched your search

+74 -22
View File
@@ -33,6 +33,7 @@ namespace HHWMS.Web
private readonly IMemoryCache _cache;
private const int DEBOUNCE_INTERVAL_MS = 1000; // 防抖间隔1秒
private int ContainerWeight = 500;
private int SmallContainerWeight = 50;
public IWCSController(IUnitWork unitWork, IMapper mapper, IMemoryCache cache)
{
@@ -85,40 +86,59 @@ namespace HHWMS.Web
return ApiResultError($"处理请求时发生错误: {ex.Message}");
}
}
/// <summary>
/// 请求入库(带防抖)
/// 满入处理
/// </summary>
[HttpPost]
public Task<IActionResult> RequestIn(WcsRequest request)
public IActionResult FullIn(WcsRequest request)
{
if (request == null || string.IsNullOrEmpty(request.PalletNo))
var task = _unitWork.FindSingle<TaskHeader>(x => x.TaskNo == request.TaskNo
&& x.Status != TaskStatusEnum.完成);
if (task == null)
{
return Task.FromResult<IActionResult>(ApiResultError("请求参数无效"));
return ApiResultError(msg: "未找到任务!");
}
//查找新仓位
var locationVm = Wtm.CreateVM<LocationVM>();
// 更新旧仓位
var oldLoc = _unitWork.FindSingle<Location>(x => x.Code == task.ToLocation);
oldLoc.ContainerCode = "FullIn";
oldLoc.UpdateBy = "FullIn";
oldLoc.UpdateTime = DateTime.Now;
_unitWork.Update(oldLoc);
return ApiResult();
}
/// <summary>
/// 空出处理
/// </summary>
[HttpPost]
public IActionResult EmptyOut(WcsRequest request)
{
var task = _unitWork.FindSingle<TaskHeader>(x => x.TaskNo == request.TaskNo
&& x.Status != TaskStatusEnum.完成);
if (task == null)
{
return ApiResultError(msg: "未找到任务!");
}
return WithDebounce($"RequestIn_{request.PalletNo}", async () =>
{
await ProcessRequestIn(request);
return ApiResult(new { Message = "入库请求处理成功" });
});
return ApiResult();
}
/// <summary>
/// 处理入库请求的具体业务逻辑
/// </summary>
private async Task ProcessRequestIn(WcsRequest request)
{
// TODO: 实现具体的入库处理逻辑
await Task.Delay(1000); // 模拟异步处理
}
/// <summary>
/// 状态返回(带防抖)
/// </summary>
[Public]
[HttpPost]
public Task<IActionResult> TaskStatusResult(WcsRequest request)
public Task<IActionResult> ReturnStatus(WcsRequest request)
{
if (request == null || string.IsNullOrEmpty(request.TaskNo))
{
@@ -251,7 +271,7 @@ namespace HHWMS.Web
{
var material =
_unitWork.FindSingle<Material>(x => x.MaterialCode == inventory.MaterialCode);
inventory.Qty = (request.Weight - ContainerWeight) / material.Qty;
inventory.Qty = (request.Weight - ContainerWeight - inventory.TaskQty * SmallContainerWeight) / (material.Qty ?? 5);
}
if (task.TaskType != TaskTypeEnum.移库)
@@ -409,7 +429,37 @@ namespace HHWMS.Web
}
}
#region 暂时无用
/// <summary>
/// 请求入库(带防抖)
/// </summary>
[HttpPost]
public Task<IActionResult> RequestIn(WcsRequest request)
{
if (request == null || string.IsNullOrEmpty(request.PalletNo))
{
return Task.FromResult<IActionResult>(ApiResultError("请求参数无效"));
}
return WithDebounce($"RequestIn_{request.PalletNo}", async () =>
{
await ProcessRequestIn(request);
return ApiResult(new { Message = "入库请求处理成功" });
});
}
/// <summary>
/// 处理入库请求的具体业务逻辑
/// </summary>
private async Task ProcessRequestIn(WcsRequest request)
{
// TODO: 实现具体的入库处理逻辑
await Task.Delay(1000); // 模拟异步处理
}
/// <summary>
/// 请求空闲库位(带防抖)
/// </summary>
@@ -474,5 +524,7 @@ namespace HHWMS.Web
return ApiResult(new { LocationCode = location?.Code });
}
#endregion
}
}
@@ -0,0 +1,228 @@
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.configs.ViewModels.CustomerVMs;
namespace HHWMS.Web.Controllers
{
[Area("configs")]
[ActionDescription("客户管理")]
public partial class CustomerController : BaseController
{
private readonly IUnitWork _unitWork;
public CustomerController(IUnitWork unitWork)
{
_unitWork = unitWork;
}
#region Search
[ActionDescription("Sys.Search")]
public ActionResult Index()
{
var vm = Wtm.CreateVM<CustomerListVM>();
return PartialView(vm);
}
[ActionDescription("Sys.Search")]
[HttpPost]
public string Search(CustomerSearcher searcher)
{
var vm = Wtm.CreateVM<CustomerListVM>(passInit: true);
if (ModelState.IsValid)
{
vm.Searcher = searcher;
return vm.GetJson(false);
}
else
{
return vm.GetError();
}
}
#endregion
#region Create
[ActionDescription("Sys.Create")]
public ActionResult Create()
{
var vm = Wtm.CreateVM<CustomerVM>();
return PartialView(vm);
}
[HttpPost]
[ActionDescription("Sys.Create")]
public ActionResult Create(CustomerVM vm)
{
if (!ModelState.IsValid)
{
return PartialView(vm);
}
else
{
vm.DoAdd();
if (!ModelState.IsValid)
{
vm.DoReInit();
return PartialView(vm);
}
else
{
return FFResult().CloseDialog().RefreshGrid();
}
}
}
#endregion
#region Edit
[ActionDescription("Sys.Edit")]
public ActionResult Edit(string id)
{
var vm = Wtm.CreateVM<CustomerVM>(id);
return PartialView(vm);
}
[ActionDescription("Sys.Edit")]
[HttpPost]
[ValidateFormItemOnly]
public ActionResult Edit(CustomerVM vm)
{
if (!ModelState.IsValid)
{
return PartialView(vm);
}
else
{
vm.DoEdit();
if (!ModelState.IsValid)
{
vm.DoReInit();
return PartialView(vm);
}
else
{
return FFResult().CloseDialog().RefreshGridRow(vm.Entity.ID);
}
}
}
#endregion
#region Delete
[ActionDescription("Sys.Delete")]
public ActionResult Delete(string id)
{
var vm = Wtm.CreateVM<CustomerVM>(id);
return PartialView(vm);
}
[ActionDescription("Sys.Delete")]
[HttpPost]
public ActionResult Delete(string id, IFormCollection nouse)
{
var vm = Wtm.CreateVM<CustomerVM>(id);
vm.DoDelete();
if (!ModelState.IsValid)
{
return PartialView(vm);
}
else
{
return FFResult().CloseDialog().RefreshGrid();
}
}
#endregion
#region Details
[ActionDescription("Sys.Details")]
public ActionResult Details(string id)
{
var vm = Wtm.CreateVM<CustomerVM>(id);
return PartialView(vm);
}
#endregion
#region BatchEdit
[HttpPost]
[ActionDescription("Sys.BatchEdit")]
public ActionResult BatchEdit(string[] IDs)
{
var vm = Wtm.CreateVM<CustomerBatchVM>(Ids: IDs);
return PartialView(vm);
}
[HttpPost]
[ActionDescription("Sys.BatchEdit")]
public ActionResult DoBatchEdit(CustomerBatchVM vm, IFormCollection nouse)
{
if (!ModelState.IsValid || !vm.DoBatchEdit())
{
return PartialView("BatchEdit",vm);
}
else
{
return FFResult().CloseDialog().RefreshGrid().Alert(Localizer["Sys.BatchEditSuccess", vm.Ids.Length]);
}
}
#endregion
#region BatchDelete
[HttpPost]
[ActionDescription("Sys.BatchDelete")]
public ActionResult BatchDelete(string[] IDs)
{
var vm = Wtm.CreateVM<CustomerBatchVM>(Ids: IDs);
return PartialView(vm);
}
[HttpPost]
[ActionDescription("Sys.BatchDelete")]
public ActionResult DoBatchDelete(CustomerBatchVM vm, IFormCollection nouse)
{
if (!ModelState.IsValid || !vm.DoBatchDelete())
{
return PartialView("BatchDelete",vm);
}
else
{
return FFResult().CloseDialog().RefreshGrid().Alert(Localizer["Sys.BatchDeleteSuccess", vm.Ids.Length]);
}
}
#endregion
#region Import
[ActionDescription("Sys.Import")]
public ActionResult Import()
{
var vm = Wtm.CreateVM<CustomerImportVM>();
return PartialView(vm);
}
[HttpPost]
[ActionDescription("Sys.Import")]
public ActionResult Import(CustomerImportVM vm, IFormCollection nouse)
{
if (vm.ErrorListVM.EntityList.Count > 0 || !vm.BatchSaveData())
{
return PartialView(vm);
}
else
{
return FFResult().CloseDialog().RefreshGrid().Alert(Localizer["Sys.ImportSuccess", vm.EntityList.Count.ToString()]);
}
}
#endregion
#region Export
[ActionDescription("Sys.Export")]
[HttpPost]
public IActionResult ExportExcel(CustomerListVM vm)
{
return vm.GetExportData();
}
#endregion
}
}
@@ -0,0 +1,35 @@
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.configs.ViewModels.CustomerVMs
{
public partial class CustomerBatchVM : BaseBatchVM<Customer, Customer_BatchEdit>
{
public CustomerBatchVM()
{
ListVM = new CustomerListVM();
LinkedVM = new Customer_BatchEdit();
}
}
/// <summary>
/// Class to define batch edit fields
/// </summary>
public class Customer_BatchEdit : BaseVM
{
protected override void InitVM()
{
}
}
}
@@ -0,0 +1,33 @@
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.configs.ViewModels.CustomerVMs
{
public partial class CustomerTemplateVM : BaseTemplateVM
{
[Display(Name = "Location.ZoneCode")]
public ExcelPropety Code_Excel = ExcelPropety.CreateProperty<Customer>(x => x.Code);
[Display(Name = "Location.ZoneName")]
public ExcelPropety Type_Excel = ExcelPropety.CreateProperty<Customer>(x => x.Type);
[Display(Name = "Customer.ZoneName")]
public ExcelPropety Name_Excel = ExcelPropety.CreateProperty<Customer>(x => x.Name);
protected override void InitVM()
{
}
}
public class CustomerImportVM : BaseImportVM<CustomerTemplateVM, Customer>
{
}
}
@@ -0,0 +1,64 @@
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.configs.ViewModels.CustomerVMs
{
public partial class CustomerListVM : BasePagedListVM<Customer_View, CustomerSearcher>
{
protected override List<GridAction> InitGridAction()
{
return new List<GridAction>
{
this.MakeStandardAction("Customer", GridActionStandardTypesEnum.Create, Localizer["Sys.Create"],"configs", dialogWidth: 800),
this.MakeStandardAction("Customer", GridActionStandardTypesEnum.Edit, Localizer["Sys.Edit"], "configs", dialogWidth: 800),
this.MakeStandardAction("Customer", GridActionStandardTypesEnum.Delete, Localizer["Sys.Delete"], "configs", dialogWidth: 800),
this.MakeStandardAction("Customer", GridActionStandardTypesEnum.Details, Localizer["Sys.Details"], "configs", dialogWidth: 800),
this.MakeStandardAction("Customer", GridActionStandardTypesEnum.BatchEdit, Localizer["Sys.BatchEdit"], "configs", dialogWidth: 800),
this.MakeStandardAction("Customer", GridActionStandardTypesEnum.BatchDelete, Localizer["Sys.BatchDelete"], "configs", dialogWidth: 800),
this.MakeStandardAction("Customer", GridActionStandardTypesEnum.Import, Localizer["Sys.Import"], "configs", dialogWidth: 800),
this.MakeStandardAction("Customer", GridActionStandardTypesEnum.ExportExcel, Localizer["Sys.Export"], "configs"),
};
}
protected override IEnumerable<IGridColumn<Customer_View>> InitGridHeader()
{
return new List<GridColumn<Customer_View>>{
this.MakeGridHeader(x => x.Code),
this.MakeGridHeader(x => x.Type),
this.MakeGridHeader(x => x.Name),
this.MakeGridHeaderAction(width: 200)
};
}
public override IOrderedQueryable<Customer_View> GetSearchQuery()
{
var query = DC.Set<Customer>()
.CheckContain(Searcher.Code, x=>x.Code)
.CheckContain(Searcher.Type, x=>x.Type)
.CheckContain(Searcher.Name, x=>x.Name)
.Select(x => new Customer_View
{
ID = x.ID,
Code = x.Code,
Type = x.Type,
Name = x.Name,
})
.OrderBy(x => x.ID);
return query;
}
}
public class Customer_View : Customer{
}
}
@@ -0,0 +1,27 @@
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.configs.ViewModels.CustomerVMs
{
public partial class CustomerSearcher : BaseSearcher
{
[Display(Name = "Customer.Code")]
public String Code { get; set; }
[Display(Name = "Customer.Type")]
public String Type { get; set; }
[Display(Name = "Customer.Name")]
public String Name { get; set; }
protected override void InitVM()
{
}
}
}
@@ -0,0 +1,39 @@
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.Models;
namespace HHWMS.Web.configs.ViewModels.CustomerVMs
{
public partial class CustomerVM : BaseCRUDVM<Customer>
{
public CustomerVM()
{
}
protected override void InitVM()
{
}
public override void DoAdd()
{
base.DoAdd();
}
public override void DoEdit(bool updateAllFields = false)
{
base.DoEdit(updateAllFields);
}
public override void DoDelete()
{
base.DoDelete();
}
}
}
@@ -429,7 +429,6 @@ namespace HHWMS.Web
string code = moveloc.Data.Code;
var movelocation = _unitWork.FindSingle<Location>(x => x.Code == code);
// 生成outter移库任务
var outterTask = new TaskHeader()
{
@@ -466,18 +465,16 @@ namespace HHWMS.Web
}
// 下发任务到wcs
// 成品库下发WCS入库,目的仓位给固定WareCell
var postData = new
{
TaskNo = task.TaskNo,
PalletNo = task.ContainerCode,
FromLocation = task.FromLocation,
ToLocation = task.ToLocation
ToLocation = (task.TaskType == TaskTypeEnum.入库 && task.ZoneId != 1027) ? "WareCell" : task.ToLocation
};
task.Status = TaskStatusEnum.已下发;
task.UpdateTime = DateTime.Now;
task.UpdateBy = "WMS";
_unitWork.Add(task);
/*try
try
{
var domain = task.ZoneId == 1027 ? "WCSXB" : "WCSCP";
var res = Wtm.CallAPI<ApiJsonResult<dynamic>>(domain, "TaskAssign", HttpMethodEnum.POST, postData)
@@ -500,7 +497,7 @@ namespace HHWMS.Web
{
task.ErrorMsg = ex.Message;
return ResponseResult<dynamic>.Error("任务下发失败!");
}*/
}
return ResponseResult<dynamic>.Success();
}
@@ -20,6 +20,8 @@ namespace HHWMS.Web
public ExcelPropety ProcessName_Excel = ExcelPropety.CreateProperty<MaterialProcess>(x => x.ProcessName);
[Display(Name = "MaterialProcess.ProcessCode")]
public ExcelPropety ProcessCode_Excel = ExcelPropety.CreateProperty<MaterialProcess>(x => x.ProcessCode);
[Display(Name = "MaterialProcess.Weight")]
public ExcelPropety Weight_Excel = ExcelPropety.CreateProperty<MaterialProcess>(x => x.Weight);
[Display(Name = "MaterialProcess.Description")]
public ExcelPropety Description_Excel = ExcelPropety.CreateProperty<MaterialProcess>(x => x.Description);
[Display(Name = "MaterialProcess.IsActive")]
@@ -36,6 +36,7 @@ namespace HHWMS.Web
this.MakeGridHeader(x => x.ProcessOrder),
this.MakeGridHeader(x => x.ProcessName),
this.MakeGridHeader(x => x.ProcessCode),
this.MakeGridHeader(x => x.Weight),
this.MakeGridHeader(x => x.Description),
this.MakeGridHeader(x => x.IsActive),
this.MakeGridHeaderAction(width: 200)
@@ -49,7 +50,9 @@ namespace HHWMS.Web
.CheckEqual(Searcher.ProcessOrder, x=>x.ProcessOrder)
.CheckContain(Searcher.ProcessName, x=>x.ProcessName)
.CheckContain(Searcher.ProcessCode, x=>x.ProcessCode)
.CheckEqual(Searcher.Weight, x=>x.Weight)
.CheckContain(Searcher.Description, x=>x.Description)
.CheckEqual(Searcher.IsActive, x=>x.IsActive)
.Select(x => new MaterialProcess_View
{
ID = x.ID,
@@ -57,6 +60,7 @@ namespace HHWMS.Web
ProcessOrder = x.ProcessOrder,
ProcessName = x.ProcessName,
ProcessCode = x.ProcessCode,
Weight = x.Weight,
Description = x.Description,
IsActive = x.IsActive,
})
@@ -20,8 +20,12 @@ namespace HHWMS.Web
public String ProcessName { get; set; }
[Display(Name = "MaterialProcess.ProcessCode")]
public String ProcessCode { get; set; }
[Display(Name = "MaterialProcess.Weight")]
public Int32? Weight { get; set; }
[Display(Name = "MaterialProcess.Description")]
public String Description { get; set; }
[Display(Name = "MaterialProcess.IsActive")]
public Boolean? IsActive { get; set; }
protected override void InitVM()
{
@@ -17,33 +17,7 @@
<script>
let template =
{
"panels": [{
"index": 0,
"height": 60,
"width": 100,
"paperHeader": 43.5,
"paperFooter": 170.07874015748033,
"printElements": [{
"options": {
"left": 18,
"top": 25.5,
"height": 106.5,
"width": 246,
"title": "code",
"testData": "",
"field": "code",
"fontSize": 18,
"textAlign": "center",
"lineHeight": 24,
"textType": "barcode"
}, "printElementType": {"type": "text"}
}],
"paperNumberLeft": 258,
"paperNumberTop": 144,
"paperNumberDisabled": true
}]
};
{"panels":[{"index":0,"height":60,"width":100,"paperHeader":43.5,"paperFooter":170.07874015748033,"printElements":[{"options":{"left":55.5,"top":25.5,"height":106.5,"width":142.5,"title":"code","testData":"C0006","field":"code","fontSize":18,"textAlign":"center","lineHeight":24,"textType":"barcode"},"printElementType":{"type":"text"}}],"paperNumberLeft":258,"paperNumberTop":144,"paperNumberDisabled":true}]};
let printData = [];
@@ -0,0 +1,12 @@
@model HHWMS.Web.configs.ViewModels.CustomerVMs.CustomerBatchVM
@inject IStringLocalizer<Program> Localizer;
<wt:form vm="@Model">
<wt:quote>@Localizer["Sys.BatchDeleteConfirm"]</wt:quote>
<wt:hidden field="Ids" />
<wt:grid vm="ListVM" use-local-data="true" height="300" hidden-checkbox="true" hidden-panel="true"/>
<wt:row align="AlignEnum.Right">
<wt:submitbutton theme=" ButtonThemeEnum.Warm" text="@Localizer["Sys.Delete"]"/>
<wt:closebutton />
</wt:row>
</wt:form>
@@ -0,0 +1,14 @@
@model HHWMS.Web.configs.ViewModels.CustomerVMs.CustomerBatchVM
@inject IStringLocalizer<Program> Localizer;
<wt:form vm="@Model">
<div style="margin-bottom:10px">@Localizer["Sys.BatchEditConfirm"] </div>
<wt:row items-per-row="ItemsPerRowEnum.Two">
</wt:row>
<wt:hidden field="Ids" />
<wt:grid vm="ListVM" use-local-data="true" height="300" hidden-checkbox="true" hidden-panel="true"/>
<wt:row align="AlignEnum.Right">
<wt:submitbutton />
<wt:closebutton />
</wt:row>
</wt:form>
@@ -0,0 +1,14 @@
@model HHWMS.Web.configs.ViewModels.CustomerVMs.CustomerVM
@inject IStringLocalizer<Program> Localizer;
<wt:form vm="@Model">
<wt:row items-per-row="ItemsPerRowEnum.Two">
<wt:textbox field="Entity.Code" />
<wt:textbox field="Entity.Type" />
<wt:textbox field="Entity.Name" />
</wt:row>
<wt:row align="AlignEnum.Right">
<wt:submitbutton />
<wt:closebutton />
</wt:row>
</wt:form>
@@ -0,0 +1,16 @@
@model HHWMS.Web.configs.ViewModels.CustomerVMs.CustomerVM
@inject IStringLocalizer<Program> Localizer;
<wt:form vm="@Model">
<wt:quote>@Localizer["Sys.DeleteConfirm"]</wt:quote>
<wt:row items-per-row="ItemsPerRowEnum.Two">
<wt:display field="Entity.Code" />
<wt:display field="Entity.Type" />
<wt:display field="Entity.Name" />
</wt:row>
<wt:hidden field="Entity.ID" />
<wt:row align="AlignEnum.Right">
<wt:submitbutton theme=" ButtonThemeEnum.Warm" text="@Localizer["Sys.Delete"]"/>
<wt:closebutton />
</wt:row>
</wt:form>
@@ -0,0 +1,13 @@
@model HHWMS.Web.configs.ViewModels.CustomerVMs.CustomerVM
@inject IStringLocalizer<Program> Localizer;
<wt:form vm="@Model">
<wt:row items-per-row="ItemsPerRowEnum.Two">
<wt:display field="Entity.Code" />
<wt:display field="Entity.Type" />
<wt:display field="Entity.Name" />
</wt:row>
<wt:row align="AlignEnum.Right">
<wt:closebutton />
</wt:row>
</wt:form>
@@ -0,0 +1,15 @@
@model HHWMS.Web.configs.ViewModels.CustomerVMs.CustomerVM
@inject IStringLocalizer<Program> Localizer;
<wt:form vm="@Model">
<wt:row items-per-row="ItemsPerRowEnum.Two">
<wt:textbox field="Entity.Code" />
<wt:textbox field="Entity.Type" />
<wt:textbox field="Entity.Name" />
</wt:row>
<wt:hidden field="Entity.ID" />
<wt:row align="AlignEnum.Right">
<wt:submitbutton />
<wt:closebutton />
</wt:row>
</wt:form>
@@ -0,0 +1,14 @@
@model HHWMS.Web.configs.ViewModels.CustomerVMs.CustomerImportVM
@inject IStringLocalizer<Program> Localizer;
<wt:form vm="@Model">
<wt:row align="AlignEnum.Right">
<wt:downloadTemplateButton vm="@Model" />
</wt:row>
<wt:upload field="UploadFileId" label-text="@Model.Localizer["Sys.UploadTemplate"]" upload-type="ExcelFile" />
<wt:grid vm="ErrorListVM" use-local-data="true" hidden-checkbox="true" hidden-grid-index="true" hidden-panel="true" height="300"/>
<wt:row align="AlignEnum.Right">
<wt:submitbutton />
<wt:closebutton />
</wt:row>
</wt:form>
@@ -0,0 +1,11 @@
@model HHWMS.Web.configs.ViewModels.CustomerVMs.CustomerListVM
@inject IStringLocalizer<Program> Localizer;
<wt:searchpanel vm="@Model" reset-btn="true">
<wt:row items-per-row="ItemsPerRowEnum.Three">
<wt:textbox field="Searcher.Code" />
<wt:textbox field="Searcher.Type" />
<wt:textbox field="Searcher.Name" />
</wt:row>
</wt:searchpanel>
<wt:grid vm="@Model" url="/configs/Customer/Search"/>
@@ -7,6 +7,7 @@
<wt:textbox field="Entity.ProcessOrder" />
<wt:textbox field="Entity.ProcessName" />
<wt:textbox field="Entity.ProcessCode" />
<wt:textbox field="Entity.Weight" />
<wt:textbox field="Entity.Description" />
<wt:switch field="Entity.IsActive" />
</wt:row>
@@ -8,6 +8,7 @@
<wt:display field="Entity.ProcessOrder" />
<wt:display field="Entity.ProcessName" />
<wt:display field="Entity.ProcessCode" />
<wt:display field="Entity.Weight" />
<wt:display field="Entity.Description" />
<wt:display field="Entity.IsActive" />
</wt:row>
@@ -7,6 +7,7 @@
<wt:display field="Entity.ProcessOrder" />
<wt:display field="Entity.ProcessName" />
<wt:display field="Entity.ProcessCode" />
<wt:display field="Entity.Weight" />
<wt:display field="Entity.Description" />
<wt:display field="Entity.IsActive" />
</wt:row>
@@ -7,6 +7,7 @@
<wt:textbox field="Entity.ProcessOrder" />
<wt:textbox field="Entity.ProcessName" />
<wt:textbox field="Entity.ProcessCode" />
<wt:textbox field="Entity.Weight" />
<wt:textbox field="Entity.Description" />
<wt:switch field="Entity.IsActive" />
</wt:row>
@@ -7,7 +7,9 @@
<wt:textbox field="Searcher.ProcessOrder" />
<wt:textbox field="Searcher.ProcessName" />
<wt:textbox field="Searcher.ProcessCode" />
<wt:textbox field="Searcher.Weight" />
<wt:textbox field="Searcher.Description" />
<wt:combobox field="Searcher.IsActive" empty-text="@Localizer["Sys.All"]" />
</wt:row>
</wt:searchpanel>
<wt:grid vm="@Model" url="/configs/MaterialProcess/Search"/>
@@ -442,8 +442,10 @@ namespace HHWMS.Web.Controllers
{
return FFResult().CloseDialog().Message(result.Message?? "WCS任务下发失败").RefreshGrid();
}
/*// 6. 调用WCS接口下发任务
var wcsTaskModel = new WCSTaskModel
// 6. 调用WCS接口下发任务
/*
var wcsTaskModel = new WCSTaskModel
{
TaskNo = task.TaskNo,
PalletNo = task.ContainerCode,
@@ -36,27 +36,38 @@ namespace HHWMS.Web
protected override IEnumerable<IGridColumn<Inventory_View>> InitGridHeader()
{
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).SetHide(),
this.MakeGridHeader(x => x.MaterialName),
this.MakeGridHeader(x => x.MaterialSpec),
this.MakeGridHeader(x => x.Name_view).SetWidth(80),
this.MakeGridHeader(x => x.ContainerCode).SetWidth(90),
this.MakeGridHeader(x => x.LocationCode).SetWidth(130),
this.MakeGridHeader(x => x.MaterialCode).SetWidth(90),
this.MakeGridHeader(x => x.MaterialType).SetWidth(100),
this.MakeGridHeader(x => x.SupplierCode).SetWidth(100),
this.MakeGridHeader(x => x.MaterialName).SetWidth(100),
this.MakeGridHeader(x => x.CompanyCode).SetWidth(150),
this.MakeGridHeader(x => x.SourceCode).SetWidth(150),
this.MakeGridHeader(x => x.MaterialSpec).SetHide().SetWidth(150),
this.MakeGridHeader(x => x.MaterialUnit).SetHide(),
this.MakeGridHeader(x => x.Batch),
this.MakeGridHeader(x => x.TaskQty).SetHide(),
this.MakeGridHeader(x => x.Qty).SetWidth(100)
.SetFormat((a, b) =>
{
return (int?)a.Qty ?? 0;
}),
this.MakeGridHeader(x => x.Batch).SetWidth(100),
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).SetHide(),
this.MakeGridHeader(x => x.ReceiptCode).SetHide(),
this.MakeGridHeader(x => x.ReceiptDetailId).SetHide(),
this.MakeGridHeader(x => x.Status),
this.MakeGridHeader(x => x.TaskStatus),
this.MakeGridHeader(x => x.Status).SetWidth(100),
this.MakeGridHeader(x => x.TaskStatus).SetWidth(100)
.SetBackGroundFunc((a)=>{
if(a.TaskStatus == InventoryTaskStatusEnum.Locked )
{
return "#FF0000";
}
return "";
}),
this.MakeGridHeaderAction(width: 200)
};
}
@@ -66,11 +77,13 @@ namespace HHWMS.Web
var query = DC.Set<Inventory>()
.CheckEqual(Searcher.ZoneId, x=>x.ZoneId)
.CheckContain(Searcher.ContainerCode, x=>x.ContainerCode)
.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.SourceCode, x=>x.SourceCode)
.CheckContain(Searcher.CompanyCode, x=>x.CompanyCode)
.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)
@@ -17,6 +17,8 @@ namespace HHWMS.Web
public int? ZoneId { get; set; }
[Display(Name = "Task.ContainerCode")]
public String ContainerCode { get; set; }
[Display(Name = "Location.Code")]
public String LocationCode { get; set; }
[Display(Name = "Inventory.MaterialCode")]
public String MaterialCode { get; set; }
[Display(Name = "Inventory.MaterialType")]
@@ -27,6 +29,10 @@ namespace HHWMS.Web
public String Batch { get; set; }
[Display(Name = "Inventory.ReceiptCode")]
public String ReceiptCode { get; set; }
[Display(Name = "Inventory.SourceCode")]
public String SourceCode { get; set; }
[Display(Name = "Inventory.CompanyCode")]
public String CompanyCode { get; set; }
[Display(Name = "Inventory.Status")]
public String Status { get; set; }
[Display(Name = "Inventory.TaskStatus")]
@@ -5,13 +5,15 @@
<wt:row items-per-row="ItemsPerRowEnum.Three">
<wt:combobox field="Searcher.ZoneId" items="Searcher.AllZones" empty-text="@Localizer["Sys.All"]" />
<wt:textbox field="Searcher.ContainerCode" />
<wt:textbox field="Searcher.LocationCode" />
<wt:textbox field="Searcher.MaterialCode" />
<wt:textbox field="Searcher.MaterialType" />
<wt:textbox field="Searcher.MaterialName" />
<wt:textbox field="Searcher.SourceCode" />
<wt:textbox field="Searcher.CompanyCode" />
<wt:textbox field="Searcher.Batch" />
<wt:textbox field="Searcher.ReceiptCode" />
<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"/>
<wt:grid vm="@Model" url="/inventory/Inventory/Search" />
@@ -130,6 +130,10 @@ namespace HHWMS.Web.Controllers
{
return Json(new { Code = 500, Msg = "物料不存在" });
}
if (material.Qty == null || material.Qty <= 0)
{
return Json(new { Code = 500, Msg = "物料毛重没有设置,请设置后再执行入库" });
}
// 获取容器信息
var container = _unitWork.FindSingle<Container>(c => c.Code == model.PalletCode);
@@ -137,19 +141,24 @@ namespace HHWMS.Web.Controllers
{
return Json(new { Code = 500, Msg = "容器不存在" });
}
// 从字典查询工序对应的区域
var processName = _unitWork.FindSingle<SysDictData>(x => x.DictType == "ProcessZone"
&& x.DictLabel == model.ProcessName)?.DictValue;
if (string.IsNullOrEmpty(processName))
var materialProcess = _unitWork.FindSingle<MaterialProcess>(m => m.ID == model.ProcessId);
if (materialProcess == null)
{
return Json(new { Code = 500, Msg = "未找到此工序配置" });
}
// 从字典查询工序对应的区域
var zoneName = _unitWork.FindSingle<SysDictData>(x => x.DictType == "ProcessZone"
&& x.DictLabel == materialProcess.ProcessCode)?.DictValue;
if (string.IsNullOrEmpty(zoneName))
{
return Json(new { Code = 500, Msg = "未找到此工序对应区域配置" });
}
// 1. 查找可用库位信息
var locationVm = Wtm.CreateVM<LocationVM>();
var locationCode = locationVm.GetEmptyLocationFromXb(_materialZones[processName].BeginLine, _materialZones[processName].EndLine);
var locationCode = locationVm.GetEmptyLocationFromXb(_materialZones[zoneName].BeginLine, _materialZones[zoneName].EndLine);
if (string.IsNullOrWhiteSpace(locationCode))
{
@@ -187,13 +196,17 @@ namespace HHWMS.Web.Controllers
ContainerCode = model.PalletCode,
LocationCode = locationCode,
MaterialCode = model.MaterialCode,
MaterialType = material.MaterialType,
MaterialName = material.MaterialName,
MaterialSpec = material.MaterialSpec,
MaterialUnit = material.MaterialUnit,
Batch = model.ProcessName,
Lot = model.ProcessId.ToString(),
Batch = materialProcess.ProcessName,
Lot = materialProcess.ProcessCode,
Status = model.IsQualified ? "合格" : "不合格",
TaskStatus = InventoryTaskStatusEnum.Locked,
TaskQty = model.Qty,
CreateBy = model.OperatorId,
ReceiptCode = model.OperatorInfo, //校验员
CreateTime = DateTime.Now
};
@@ -236,11 +249,16 @@ namespace HHWMS.Web.Controllers
};
// 调用WCS任务下发接口
// tran.Commit();
// return Json(new { Code = 200, Msg = "入库成功", Data = new { TaskNo = taskNo } });
var wcsResult = Wtm.CallAPI<WCSTaskResponse>("WCSXB", "TaskAssign", HttpMethodEnum.POST, wcsTaskModel).Result.Data;
if (wcsResult != null && wcsResult.Success)
{
// WCS任务下发成功,提交事务
taskHeader.Status = TaskStatusEnum.已下发;
_unitWork.Update(taskHeader);
tran.Commit();
return Json(new { Code = 200, Msg = "入库成功", Data = new { TaskNo = taskNo } });
}
@@ -387,6 +405,7 @@ namespace HHWMS.Web.Controllers
.Select(m => new
{
MaterialCode = m.MaterialCode,
m.MaterialType,
MaterialName = m.MaterialName
})
.Take(10)
@@ -411,7 +430,7 @@ namespace HHWMS.Web.Controllers
public string OperatorId { get; set; }
public int ProcessId { get; set; }
public string ProcessName { get; set; }
public int Qty { get; set; }
public bool IsQualified { get; set; }
public string OperatorInfo { get; set; }
}
@@ -93,21 +93,41 @@ namespace HHWMS.Web.Controllers
var materials = _unitWork.Find<Material>(x =>
x.MaterialCode.Contains(keyword) ||
x.MaterialName.Contains(keyword))
x.MaterialType.Contains(keyword))
.Take(10)
.Select(x => new {
MaterialCode = x.MaterialCode,
MaterialName = x.MaterialName,
MaterialSpec = x.MaterialSpec,
MaterialUnit = x.MaterialUnit
x.MaterialCode,
x.MaterialName,
x.MaterialSpec,
x.MaterialUnit,
x.MaterialType
})
.ToList();
return JsonMore( materials );
}
[HttpGet]
public ActionResult SearchCompanies(string keyword)
{
if (string.IsNullOrWhiteSpace(keyword))
{
return Json(new { Code = 200, Data = new object[] { } });
}
// 假设公司信息在Company表,字段CompanyCode、CompanyName
var companies = DC.Set<Customer>()
.Where(x => x.Code.Contains(keyword) || x.Name.Contains(keyword))
.Select(x => new {
CompanyCode = x.Code,
CompanyName = x.Name
})
.Take(10)
.ToList();
return Json(new { Code = 200, Data = companies });
}
[HttpPost]
public ActionResult AddInventory(string containerCode, string materialCode, string company, decimal qty)
public ActionResult AddInventory(string containerCode, string materialCode, string company, string sourceCode, decimal qty)
{
try
{
@@ -150,6 +170,8 @@ namespace HHWMS.Web.Controllers
MaterialSpec = material.MaterialSpec,
MaterialUnit = material.MaterialUnit,
CompanyCode = company,
SourceCode = sourceCode,
SupplierCode = material.SupplierCode,
Qty = qty,
TaskStatus = InventoryTaskStatusEnum.Locked,
CreateTime = DateTime.Now
@@ -165,6 +187,9 @@ namespace HHWMS.Web.Controllers
MaterialName = material.MaterialName,
MaterialUnit = material.MaterialUnit,
ContainerCode = containerCode,
CompanyCode = inventory.CompanyCode,
SourceCode = inventory.SourceCode,
SupplierCode = inventory.SupplierCode,
Qty = qty,
CreateTime = DateTime.Now,
CreateBy = "WMS",
@@ -225,7 +250,7 @@ namespace HHWMS.Web.Controllers
TaskType = TaskTypeEnum.入库,
RoadWay = 2,
ContainerCode = containerCode,
FromLocation = "",
FromLocation = "Enter_0000",
ToLocation = "",
Status = TaskStatusEnum.待下发,
CreateTime = DateTime.Now,
@@ -238,12 +263,12 @@ namespace HHWMS.Web.Controllers
TaskNo = task.TaskNo,
PalletNo = task.ContainerCode,
FromLocation = task.FromLocation,
ToLocation = task.ToLocation
ToLocation = "WareCell"
};
_unitWork.Add(task);
_unitWork.Update(container);
/*try
// _unitWork.Add(task);
//
// _unitWork.Update(container);
try
{
var res = Wtm.CallAPI<ApiJsonResult<dynamic>>("WCSCP", "TaskAssign", HttpMethodEnum.POST, postData)
.Result?.Data;
@@ -267,7 +292,7 @@ namespace HHWMS.Web.Controllers
{
task.ErrorMsg = ex.Message;
return JsonMore(null, 500, "任务下发失败!");
}*/
}
return JsonMore(null);
}
@@ -298,6 +323,9 @@ namespace HHWMS.Web.Controllers
MaterialName = inventory.MaterialName,
MaterialUnit = inventory.MaterialUnit,
ContainerCode = inventory.ContainerCode,
CompanyCode = inventory.CompanyCode,
SourceCode = inventory.SourceCode,
SupplierCode = inventory.SupplierCode,
Qty = inventory.Qty,
CreateTime = DateTime.Now,
CreateBy = "WMS",
@@ -343,6 +371,9 @@ namespace HHWMS.Web.Controllers
MaterialName = inventory.MaterialName,
MaterialUnit = inventory.MaterialUnit,
ContainerCode = inventory.ContainerCode,
CompanyCode = inventory.CompanyCode,
SourceCode = inventory.SourceCode,
SupplierCode = inventory.SupplierCode,
Qty = inventory.Qty,
CreateTime = DateTime.Now,
CreateBy = "WMS",
@@ -359,6 +390,9 @@ namespace HHWMS.Web.Controllers
MaterialName = inventory.MaterialName,
MaterialUnit = inventory.MaterialUnit,
ContainerCode = inventory.ContainerCode,
CompanyCode = inventory.CompanyCode,
SourceCode = inventory.SourceCode,
SupplierCode = inventory.SupplierCode,
Qty = qty,
CreateTime = DateTime.Now,
CreateBy = "WMS",
@@ -419,7 +453,7 @@ namespace HHWMS.Web.Controllers
TaskType = TaskTypeEnum.入库,
RoadWay = 2,
ContainerCode = containerCode,
FromLocation = "",
FromLocation = "Enter_0000",
ToLocation = "",
Status = TaskStatusEnum.待下发,
CreateTime = DateTime.Now,
@@ -4,7 +4,9 @@
<a-card class="general-card">
<a-form :model="form" :rules="rules" ref="formRef" auto-label-width>
<a-form-item label="托盘码" field="palletCode">
<a-input v-model="form.palletCode" ref="palletCodeRef" placeholder="请扫描托盘码" @@change="scanPallet" @@keydown.enter="focusNext('materialCodeRef')" />
<a-input v-model="form.palletCode" ref="palletCodeRef" placeholder="请扫描托盘码"
@@keyup.enter="validateContainer" />
</a-form-item>
<a-form-item label="物料码" field="materialCode">
@@ -19,11 +21,15 @@
</a-auto-complete>
</a-form-item>
<a-form-item label="图号" field="name">
<a-input v-model="form.name" />
</a-form-item>
<a-form-item label="当前工序" field="processId">
<a-select v-model="form.processId" placeholder="请选择工序" @@change="processSelect">
<a-option v-for="item in processOptions"
:key="item.value"
:value="item.value">
:key="item.value"
:value="item.value">
{{ item.label }}
</a-option>
</a-select>
@@ -32,6 +38,10 @@
<a-form-item label="工序名称" field="processName" v-show="false">
<a-input v-model="form.processName" />
</a-form-item>
<a-form-item field="qty" label="小托盘数量">
<a-input-number v-model="form.qty" :min="0" style="width: 100%" ref="numInput" @@keydown.enter="focusNext('operatorIdRef')"/>
</a-form-item>
<a-form-item label="是否合格" field="isQualified">
<a-switch v-model="form.isQualified" />
@@ -69,12 +79,14 @@
const palletCodeRef = ref(null);
const materialCodeRef = ref(null);
const numInput = ref(null);
const operatorIdRef = ref(null);
const operatorInfoRef = ref(null);
const inputRefs = {
palletCodeRef,
materialCodeRef,
numInput,
operatorIdRef,
operatorInfoRef
};
@@ -93,6 +105,8 @@
operatorId: '',
processId: '',
processName:'',
name:'',
qty:null,
isQualified: true,
operatorInfo: ''
});
@@ -107,7 +121,9 @@
materialCode: [
{ required: true, message: '请输入物料码', trigger: ['change', 'blur'] }
],
qty: [
{ required: true, message: '请输入数量', trigger: ['change', 'blur'] }
],
processId: [
{ required: true, message: '请选择工序', trigger: ['change', 'blur'] }
],
@@ -119,10 +135,29 @@
{ required: true, message: '请输入检验员信息', trigger: ['change', 'blur'] }
]
};
const validateContainer = (value) => {
if (!form.palletCode) return;
axios.get(`/receipt/SimpleReceiptIn/ValidateContainer?containerCode=${encodeURIComponent(form.palletCode)}`)
.then((json) => {
if (json.data.Code == 200) {
Message.success("容器验证成功");
focusNext('materialCodeRef')
} else {
Message.error(json.data.Msg || "容器验证失败");
resetForm();
}
})
.catch((error) => {
Message.error("容器验证失败");
resetForm()
});
};
const processSelect = (value) => {
form.processName = processOptions.value.find(item => item.value === value).processName;
focusNext('operatorIdRef');
focusNext('numInput');
}
// 加载工序列表
@@ -147,10 +182,11 @@
// 根据物料加载工序列表
const loadProcessesByMaterial = (materialCode) => {
if (!materialCode) {
form.processId = '';
processOptions.value = [];
return;
}
processOptions.value = [];
$.ajax({
type: "post",
dataType: "json",
@@ -158,7 +194,15 @@
url: "/receipt/ReceiptIn/GetProcessesByMaterial",
success: (json) => {
if (json.Code == 200) {
processOptions.value = json.Data;
const newOptions = json.Data.map(item => ({
...item,
value: item.value,
label: `${item.processCode} - ${item.processName}`
}));
// 使用新数组赋值,强制组件重新渲染
processOptions.value = [...newOptions];
} else {
Message.error(json.Msg || '加载物料工序失败');
processOptions.value = [];
@@ -192,30 +236,25 @@
};
// 搜索物料
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 => ({
axios.get(`/receipt/SimpleReceiptIn/SearchMaterials?keyword=${encodeURIComponent(keyword)}`)
.then(function (json) {
if (json.data.Code == 200) {
materialOptions.value = json.data.Data.map(item => ({
...item,
value: item.MaterialCode,
label: `${item.MaterialCode} - ${item.MaterialName}`
}));console.log(materialOptions.value)
label: `${item.MaterialCode} - ${item.MaterialType} - ${item.MaterialName}`
}));
} else {
Message.error(json.Msg || '搜索失败');
Message.error(json.data.Msg);
materialOptions.value = [];
}
},
error: (xhr, status, error) => {
Message.error('搜索失败:' + error);
})
.catch(function (error) {
Message.error(error);
materialOptions.value = [];
}
});
});
};
// 处理物料选择
@@ -223,8 +262,19 @@
const selectedMaterial = materialOptions.value.find(item => item.value === value);
if (selectedMaterial) {
form.materialCode = selectedMaterial.MaterialCode;
form.name = selectedMaterial.MaterialType;
// 选择物料后加载相关工序
loadProcessesByMaterial(selectedMaterial.MaterialCode);
// 先清空当前工序选择,避免显示旧数据
form.processId = '';
form.processName = '';
// 清除现有工序选项,触发重新渲染
processOptions.value = [];
// 延迟加载新工序,确保先清空再加载
nextTick(() => {
loadProcessesByMaterial(selectedMaterial.MaterialCode);
});
}
};
@@ -337,6 +387,7 @@
processOptions,
rules,
scanPallet,
validateContainer,
scanMaterial,
submitForm,
submitEmptyPallet,
@@ -346,6 +397,7 @@
handleMaterialSelect,
palletCodeRef,
materialCodeRef,
numInput,
operatorIdRef,
operatorInfoRef,
focusNext,
@@ -1,10 +1,10 @@
<div id="receiptin">
<a-space direction="vertical" fill>
<a-form :model="formData" layout="horizontal" :label-col="{ style: { width: '100px' } }" :wrapper-col="{ style: { width: '220px' } }">
<a-form-item field="containerCode" label="容器编码">
<a-form-item field="containerCode" label="托盘号">
<a-input
v-model="ContainerCode"
placeholder="扫描箱号"
placeholder="扫描托盘号"
allow-clear
@@keyup.enter="validateContainer"
ref="containerInput"/>
@@ -15,21 +15,33 @@
:data="materialOptions"
@@search="handleSearch"
@@select="handleSelect"
placeholder="输入物料编码或名称"
placeholder="输入物料编码或图号"
ref="materialInput">
</a-auto-complete>
</a-form-item>
<a-form-item field="materialName" label="物料名称">
<a-input v-model="MaterialName" disabled/>
<a-form-item field="materialName" label="图号">
<a-input v-model="MaterialName"/>
</a-form-item>
<a-form-item field="materialSpec" label="物料型号">
<a-input v-model="MaterialSpec" disabled/>
@* <a-form-item field="materialSpec" label="物料型号"> *@
@* <a-input v-model="MaterialSpec" disabled/> *@
@* </a-form-item> *@
<a-form-item field="sourceCode" label="订单号">
<a-input v-model="SourceCode" placeholder="输入订单号" ref="sourceCodeInput" @@keydown.enter="this.$nextTick(() => {
this.$refs.companyCodeInput.focus();
});"/>
</a-form-item>
<a-form-item field="company" label="公司">
<a-input v-model="Company" placeholder="输入公司"/>
<a-form-item field="companyCode" label="公司">
<a-auto-complete
v-model="CompanyCode"
:data="companyOptions"
@@search="handleCompanySearch"
@@select="handleCompanySelect"
placeholder="输入公司名称或编码"
ref="companyCodeInput">
</a-auto-complete>
</a-form-item>
<a-form-item field="qty" label="数量">
<a-input-number v-model="Qty" :min="0" style="width: 100%"/>
<a-input-number v-model="Qty" :min="0" style="width: 100%" ref="numInput" @@keydown.enter="this.handleBind()"/>
</a-form-item>
<a-form-item>
<a-space>
@@ -46,7 +58,7 @@
<a-space>
<a-button type="text" status="danger" @@click="handleDelete(record)">删除</a-button>
<a-button type="text" @@click="handleEdit(record)">修改</a-button>
@* <a-button type="text" @@click="handleDeduct(record)">扣料</a-button> *@
<a-button type="text" @@click="handleDeduct(record)">扣料</a-button>
</a-space>
</template>
<template #qty="{ record }">
@@ -77,6 +89,7 @@
<a-radio-group v-model="outForm.level">
<a-radio value="high">高货位</a-radio>
<a-radio value="low">低货位</a-radio>
<a-radio value="mid">模具库</a-radio>
</a-radio-group>
</a-form-item>
<a-form-item label="出库口">
@@ -98,7 +111,8 @@
MaterialCode: '',
MaterialName: '',
MaterialSpec: '',
Company: '',
SourceCode: '',
CompanyCode: '',
Qty: null,
loading1: false,
materialOptions: [],
@@ -150,9 +164,13 @@
title: '物料型号',
dataIndex: 'MaterialSpec',
},
{
title: '订单号',
dataIndex: 'SourceCode',
},
{
title: '公司',
dataIndex: 'Company',
dataIndex: 'CompanyCode',
},
{
title: '数量',
@@ -169,10 +187,13 @@
containerCode: '',
materialCode: '',
materialName: '',
materialSpec: '',
company: '',
materialSpec: '',
sourceCode: '',
companyCode: '',
qty: 1
}
},
companyOptions: [],
companySearchTimer: null
}
},
mounted() {
@@ -203,7 +224,7 @@
_this.materialOptions = json.data.Data.map(item => ({
...item,
value: item.MaterialCode,
label: `${item.MaterialCode} - ${item.MaterialName} - ${item.MaterialSpec}`
label: `${item.MaterialCode} - ${item.MaterialType} - ${item.MaterialName}`
}));
} else {
_this.$message.error(json.data.Msg);
@@ -220,9 +241,13 @@
const selectedMaterial = this.materialOptions.find(item => item.value === value);
if (selectedMaterial) {
this.MaterialCode = selectedMaterial.MaterialCode;
this.MaterialName = selectedMaterial.MaterialName;
this.MaterialName = selectedMaterial.MaterialType;
this.MaterialSpec = selectedMaterial.MaterialSpec;
}
this.$nextTick(() => {
this.$refs.sourceCodeInput.focus();
});
},
handleBind() {
@@ -254,7 +279,8 @@
MaterialCode: this.MaterialCode,
MaterialName: this.MaterialName,
MaterialSpec: this.MaterialSpec,
Company: this.Company,
SourceCode: this.SourceCode,
CompanyCode: this.CompanyCode,
Qty: this.Qty
};
@@ -262,7 +288,8 @@
let postData = new URLSearchParams();
postData.append('containerCode', this.ContainerCode);
postData.append('materialCode', this.MaterialCode);
postData.append('company', this.Company);
postData.append('company', this.CompanyCode);
postData.append('sourceCode', this.SourceCode);
postData.append('qty', this.Qty);
axios.post("/receipt/SimpleReceiptIn/AddInventory", postData)
@@ -276,7 +303,8 @@
this.MaterialCode = '';
this.MaterialName = '';
this.MaterialSpec = '';
this.Company = '';
this.SourceCode = '';
this.CompanyCode = '';
this.Qty = null;
// 验证成功后,将焦点设置到物料编码输入框
this.$nextTick(() => {
@@ -309,7 +337,8 @@
this.MaterialCode = '';
this.MaterialName = '';
this.MaterialSpec = '';
this.Company = '';
this.SourceCode = '';
this.CompanyCode = '';
this.Qty = 1;
this.bindList = [];
this.$notification.success("入库任务创建成功!");
@@ -498,7 +527,7 @@
this.MaterialCode = '';
this.MaterialName = '';
this.MaterialSpec = '';
this.Company = '';
this.CompanyCode = '';
this.Qty = 1;
this.bindList = [];
this.$notification.success("空托入库成功!");
@@ -546,8 +575,9 @@
this.MaterialCode = '';
this.MaterialName = '';
this.MaterialSpec = '';
this.Company = '';
this.Qty = 1;
this.SourceCode = '';
this.CompanyCode = '';
this.Qty = '';
this.bindList = [];
this.outModalVisible = false;
this.$notification.success("呼叫出库成功!");
@@ -570,6 +600,47 @@
},
handleOutCancel() {
this.outModalVisible = false;
},
handleCompanySearch(value) {
if (this.companySearchTimer) {
clearTimeout(this.companySearchTimer);
}
this.companySearchTimer = setTimeout(() => {
if (value) {
this.searchCompanies(value);
} else {
this.companyOptions = [];
}
}, 300);
},
searchCompanies(keyword) {
var _this = this;
axios.get(`/receipt/SimpleReceiptIn/SearchCompanies?keyword=${encodeURIComponent(keyword)}`)
.then(function (json) {
if (json.data.Code == 200) {
_this.companyOptions = json.data.Data.map(item => ({
...item,
value: item.CompanyName,
label: `${item.CompanyCode} - ${item.CompanyName}`
}));
} else {
_this.$message.error(json.data.Msg);
_this.companyOptions = [];
}
})
.catch(function (error) {
_this.$message.error(error);
_this.companyOptions = [];
});
},
handleCompanySelect(value, option) {
const selectedCompany = this.companyOptions.find(item => item.value === value);
if (selectedCompany) {
this.CompanyCode = selectedCompany.CompanyName;
}
this.$nextTick(() => {
this.$refs.numInput.focus();
});
}
}
});
+1
View File
@@ -56,6 +56,7 @@ namespace HHWMS.Web
public DbSet<MaterialProcess> MaterialProcesses { get; set; }
public DbSet<PrintConfig> PrintConfigs { get; set; }
public DbSet<LocationZone> LocationZones { get; set; }
public DbSet<Customer> Customers { get; set; }
public override async Task<bool> DataInit(object allModules, bool IsSpa)
{
var state = await base.DataInit(allModules, IsSpa);
+27
View File
@@ -0,0 +1,27 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using WalkingTec.Mvvm.Core;
namespace HHWMS.Web.Models
{
[Table("Customer")]
public class Customer : BasePoco
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public new int ID { get; set; }
[Display(Name = "Customer.Code", Description = "编码")]
[StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
public string Code { get; set; }
[Display(Name = "Customer.Type", Description = "类型")]
[StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
public string Type { get; set; }
[Display(Name = "Customer.Name", Description = "名称")]
[StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
public string Name { get; set; }
}
}
+1 -1
View File
@@ -45,7 +45,7 @@ namespace HHWMS.Web.Models
public string CompanyCode { get; set; }
[Display(Name = "Inventory.SupplierCode", Description = "供应商")]
[StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
[StringLength(100, ErrorMessage = "Validate.{0}stringmax{1}")]
public string SupplierCode { get; set; }
[Display(Name = "Inventory.Qty", Description = "数量")]
@@ -27,6 +27,10 @@ namespace HHWMS.Web.Models
[StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
public string ProcessCode { get; set; }
[Display(Name = "MaterialProcess.Weight", Description = "毛重")]
[Required]
public int? Weight { get; set; }
[Display(Name = "MaterialProcess.Description", Description = "工序描述")]
[StringLength(500, ErrorMessage = "Validate.{0}stringmax{1}")]
public string Description { get; set; }
+1 -1
View File
@@ -63,7 +63,7 @@ namespace HHWMS.Web.Models
public string CompanyCode { get; set; }
[Display(Name = "Inventory.SupplierCode", Description = "供应商")]
[StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
[StringLength(100, ErrorMessage = "Validate.{0}stringmax{1}")]
public string SupplierCode { get; set; }
[Display(Name = "Inventory.TaskQty", Description = "任务数量")]
@@ -67,7 +67,7 @@ namespace HHWMS.Web.Models
public string CompanyCode { get; set; }
[Display(Name = "Inventory.SupplierCode", Description = "供应商")]
[StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
[StringLength(100, ErrorMessage = "Validate.{0}stringmax{1}")]
public string SupplierCode { get; set; }
[Display(Name = "Inventory.Qty", Description = "数量")]
+16 -4
View File
@@ -1204,7 +1204,7 @@
<value>物料编码</value>
</data>
<data name="Inventory.MaterialType" xml:space="preserve">
<value>物料类型</value>
<value>图号</value>
</data>
<data name="Inventory.MaterialName" xml:space="preserve">
<value>物料名称</value>
@@ -1216,7 +1216,7 @@
<value>单位</value>
</data>
<data name="Inventory.Batch" xml:space="preserve">
<value>批次</value>
<value>工序</value>
</data>
<data name="Inventory.Lot" xml:space="preserve">
<value>格</value>
@@ -1231,7 +1231,7 @@
<value>公司</value>
</data>
<data name="Inventory.SupplierCode" xml:space="preserve">
<value>供应商</value>
<value>客户图号</value>
</data>
<data name="Inventory.TaskQty" xml:space="preserve">
<value>任务数量</value>
@@ -1240,7 +1240,7 @@
<value>数量</value>
</data>
<data name="Inventory.SourceCode" xml:space="preserve">
<value>上游单号</value>
<value>单号</value>
</data>
<data name="Inventory.UniqueCode" xml:space="preserve">
<value>唯一码</value>
@@ -1455,6 +1455,9 @@
<data name="MaterialProcess.ProcessName" xml:space="preserve">
<value>工序名称</value>
</data>
<data name="MaterialProcess.Weight" xml:space="preserve">
<value>重量(g)</value>
</data>
<data name="MaterialProcess.ProcessCode" xml:space="preserve">
<value>工序编码</value>
</data>
@@ -1467,4 +1470,13 @@
<data name="Location.OutPort" xml:space="preserve">
<value>拣货口</value>
</data>
<data name="Customer.Code" xml:space="preserve">
<value>编码</value>
</data>
<data name="Customer.Type" xml:space="preserve">
<value>类型</value>
</data>
<data name="Customer.Name" xml:space="preserve">
<value>名称</value>
</data>
</root>
+2 -2
View File
@@ -92,8 +92,8 @@
"LoginPath": "/Login/Login"
},
"Domains": {
"WCS": {
"Address": "http://192.168.30.200:65533/api/WCS/"
"WCSCP": {
"Address": "http://192.168.30.220:65533/api/WCS/"
}
},
"AppSettings": {