Compare commits
11
Commits
master
...
96d8309793
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
96d8309793 | ||
|
|
09098c020a | ||
|
|
55cce81912 | ||
|
|
17b3236989 | ||
|
|
38c126c7b7 | ||
|
|
a3e91357ee | ||
|
|
a6168a75bf | ||
|
|
70e6866e20 | ||
|
|
b4632cfc33 | ||
|
|
345b5a3d5b | ||
|
|
f8e5ea23a9 |
No files matched your search
@@ -279,3 +279,4 @@ __pycache__/
|
||||
/nuget.exe
|
||||
/demo/WalkingTec.Mvvm.VueDemo/ClientApp/yarn.lock
|
||||
*.lock
|
||||
.DS_Store
|
||||
@@ -8,12 +8,12 @@ namespace HHWMS.Web
|
||||
{
|
||||
protected JsonResult ApiResult(object data = null, string msg = "success")
|
||||
{
|
||||
return new JsonResult(new ApiJsonResult<object> { Data = data, Success = true, Status = true, Msg = msg });
|
||||
return new JsonResult(new ApiJsonResult<object> { Data = data, Success = true, Msg = msg });
|
||||
}
|
||||
|
||||
protected JsonResult ApiResultError(object data = null, string msg = "faield")
|
||||
protected JsonResult ApiResultError(object data = null, string msg = "failed")
|
||||
{
|
||||
return new JsonResult(new ApiJsonResult<object> { Data = data, Success = false, Status = false, Msg = msg });
|
||||
return new JsonResult(new ApiJsonResult<object> { Data = data, Success = false, Msg = msg });
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using AutoMapper;
|
||||
using HHWMS.Web.Controllers;
|
||||
using HHWMS.Web.Models;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
@@ -9,7 +11,7 @@ using WalkingTec.Mvvm.Core;
|
||||
namespace HHWMS.Web
|
||||
{
|
||||
/// <summary>
|
||||
/// WCS接口
|
||||
/// 提供WCS调用接口
|
||||
/// 调用方向 WCS --> WMS
|
||||
/// </summary>
|
||||
[Public]
|
||||
@@ -18,74 +20,248 @@ namespace HHWMS.Web
|
||||
[Route("api/[controller]/[action]"), ApiExplorerSettings(GroupName = "User")]
|
||||
public class IWCSController : ApiController
|
||||
{
|
||||
private readonly IUnitWork _unitwork;
|
||||
private readonly IUnitWork _unitWork;
|
||||
private readonly IMapper _mapper;
|
||||
|
||||
public IWCSController(IUnitWork unitwork, IMapper mapper)
|
||||
public IWCSController(IUnitWork unitWork, IMapper mapper)
|
||||
{
|
||||
_unitwork = unitwork;
|
||||
_unitWork = unitWork;
|
||||
_mapper = mapper;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 请求入库
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public IActionResult RequestIn(WcsRequest request)
|
||||
{
|
||||
//var inv = new List<Inventory>();
|
||||
//for (int i = 0; i < 10; i++)
|
||||
// inv.Add(new Inventory
|
||||
// {
|
||||
// ContainerCode = "test" + i
|
||||
// });
|
||||
//_unitwork.BatchAdd<Inventory>(inv);
|
||||
//_unitwork.DeleteById<Inventory>(1441);
|
||||
//_unitwork.BatchUpdate<Inventory>(x => x.ID > 1030, x=>new Inventory { Batch = "test"});
|
||||
|
||||
// 测试 删除数据 保存到历史表 主子表数据
|
||||
/*var receipt = _unitwork.Find<ReceiptHeader>(x => x.ID == 3)
|
||||
.FirstOrDefault();
|
||||
|
||||
var details = _unitwork.Find<ReceiptDetail>(x => x.HeaderId == 3)
|
||||
.ToArray();
|
||||
var his = _mapper.Map<ReceiptHeaderHistory>(receipt);
|
||||
var his2 = _mapper.Map<ReceiptDetail[], IEnumerable<ReceiptDetailHistory>>(details);
|
||||
_unitwork.Add(his);
|
||||
_unitwork.BatchAdd(his2);*/
|
||||
|
||||
/*var receipt = _unitwork.Find<ShipmentHeader>(x => x.ID == 3)
|
||||
.FirstOrDefault();
|
||||
|
||||
var details = _unitwork.Find<ShipmentDetail>(x => x.HeaderId == 3)
|
||||
.ToArray();
|
||||
var his = _mapper.Map<ShipmentHeaderHistory>(receipt);
|
||||
var his2 = _mapper.Map<ShipmentDetail[], IEnumerable<ShipmentDetailHistory>>(details);
|
||||
_unitwork.Add(his);
|
||||
_unitwork.BatchAdd(his2);*/
|
||||
|
||||
var receipt = _unitwork.Find<TaskHeader>(x => 1==1)
|
||||
.FirstOrDefault();
|
||||
|
||||
var details = _unitwork.Find<TaskDetail>(x => x.HeaderId == receipt.ID)
|
||||
.ToArray();
|
||||
var his = _mapper.Map<TaskHeaderHistory>(receipt);
|
||||
var his2 = _mapper.Map<TaskDetail[], IEnumerable<TaskDetailHistory>>(details);
|
||||
_unitwork.Add(his);
|
||||
_unitwork.BatchAdd(his2);
|
||||
return ApiResult();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 状态返回
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public IActionResult TaskStatusResult(WcsRequest request)
|
||||
public IActionResult ReturnStatus(WcsRequest request)
|
||||
{
|
||||
// 返回状态 只接收100
|
||||
if (request.State != 100)
|
||||
{
|
||||
return ApiResultError(msg: "State 不为100, 请检查后重新请求!");
|
||||
}
|
||||
|
||||
// 判断任务是否合理
|
||||
var task = _unitWork.FindSingle<TaskHeader>(x => x.TaskNo.Equals(request.TaskNo));
|
||||
if (task == null)
|
||||
{
|
||||
return ApiResultError(msg: $"任务不存在, 任务号 {request.TaskNo} , 请检查后重新请求!");
|
||||
}
|
||||
|
||||
// 根据任务类型 入/出 处理不同流程
|
||||
switch (task.TaskType)
|
||||
{
|
||||
case TaskTypeEnum.立库入库:
|
||||
// 1.更新库存
|
||||
_unitWork.BatchUpdate<Inventory>(x => x.ContainerCode.Equals(task.ContainerCode), x => new Inventory
|
||||
{
|
||||
LocationCode = task.ToLocation,
|
||||
UpdateTime = DateTime.Now,
|
||||
UpdateBy = "WMS",
|
||||
TaskStatus = InventoryTaskStatus.无任务
|
||||
});
|
||||
// 2.更新容器
|
||||
_unitWork.BatchUpdate<Container>(x => x.Code.Equals(task.ContainerCode), x => new Container
|
||||
{
|
||||
UpdateTime = DateTime.Now,
|
||||
UpdateBy = "WMS",
|
||||
IsLock = ContainerLockEnum.未锁,
|
||||
LocationCode = task.ToLocation
|
||||
});
|
||||
var inventoryList = _unitWork.Find<Inventory>(x => x.ContainerCode.Equals(task.ContainerCode))
|
||||
.ToList();
|
||||
// 3.更新库位
|
||||
_unitWork.BatchUpdate<Location>(x => x.Code.Equals(task.ToLocation), x => new Location
|
||||
{
|
||||
UpdateTime = DateTime.Now,
|
||||
UpdateBy = "WMS",
|
||||
Status = inventoryList.Count > 0 ? LocationStatus.有货 : LocationStatus.空容器,
|
||||
ContainerCode = task.ContainerCode
|
||||
});
|
||||
// 4.插入库存交易
|
||||
// 1.将任务容器的库存查出来
|
||||
// if (inventoryList.Count > 0)
|
||||
// {
|
||||
// // 2.根据库存生成库存交易出库信息
|
||||
// var inventoryTransactions = inventoryList.Select(inventory => new InventoryTransaction
|
||||
// {
|
||||
// BillType = InventoryTranType.入库,
|
||||
// MaterialCode = inventory.MaterialCode,
|
||||
// MaterialName = inventory.MaterialName,
|
||||
// MaterialUnit = inventory.MaterialUnit,
|
||||
// Batch = inventory.Batch,
|
||||
// Lot = inventory.Lot,
|
||||
// LocationCode = inventory.LocationCode,
|
||||
// ContainerCode = inventory.ContainerCode,
|
||||
// Qty = inventory.Qty,
|
||||
// CreateTime = DateTime.Now,
|
||||
// CreateBy = "WMS",
|
||||
// UpdateTime = DateTime.Now,
|
||||
// UpdateBy = "WMS"
|
||||
// }).ToList();
|
||||
//
|
||||
// // 3.批量插入库存交易
|
||||
// _unitWork.BatchAdd(inventoryTransactions);
|
||||
// }
|
||||
|
||||
break;
|
||||
case TaskTypeEnum.立库出库:
|
||||
|
||||
_unitWork.BatchUpdate<Container>(x => x.Code.Equals(task.ContainerCode), x => new Container
|
||||
{
|
||||
UpdateTime = DateTime.Now,
|
||||
UpdateBy = "WMS",
|
||||
IsLock = ContainerLockEnum.未锁,
|
||||
LocationCode = ""
|
||||
});
|
||||
_unitWork.BatchUpdate<Location>(x => x.Code.Equals(task.FromLocation), x => new Location
|
||||
{
|
||||
UpdateTime = DateTime.Now,
|
||||
UpdateBy = "WMS",
|
||||
Status = LocationStatus.空仓位,
|
||||
ContainerCode = ""
|
||||
});
|
||||
|
||||
/*
|
||||
// 1.将任务容器的库存查出来
|
||||
var inventoryList2 = _unitWork.Find<Inventory>(x => x.ContainerCode.Equals(task.ContainerCode))
|
||||
.ToList();
|
||||
if (inventoryList2.Count > 0)
|
||||
{
|
||||
// 2.根据库存生成库存交易出库信息
|
||||
var inventoryTransactions2 = inventoryList2.Select(inventory => new InventoryTransaction
|
||||
{
|
||||
BillType = InventoryTranType.出库,
|
||||
MaterialCode = inventory.MaterialCode,
|
||||
MaterialName = inventory.MaterialName,
|
||||
MaterialUnit = inventory.MaterialUnit,
|
||||
Batch = inventory.Batch,
|
||||
Lot = inventory.Lot,
|
||||
LocationCode = inventory.LocationCode,
|
||||
ContainerCode = inventory.ContainerCode,
|
||||
Qty = inventory.Qty,
|
||||
CreateTime = DateTime.Now,
|
||||
CreateBy = "WMS",
|
||||
UpdateTime = DateTime.Now,
|
||||
UpdateBy = "WMS"
|
||||
}).ToList();
|
||||
|
||||
// 3.批量插入库存交易
|
||||
_unitWork.BatchAdd(inventoryTransactions2);
|
||||
|
||||
_unitWork.BatchDelete<Inventory>(inventoryList2);
|
||||
}
|
||||
*/
|
||||
|
||||
// 如果是出库页面创建的任务,则创建入库任务并联动AGV
|
||||
/*
|
||||
if (task.Station == "1")
|
||||
{
|
||||
new ReceiptInController(_unitWork, Wtm).TaskIn(task.ContainerCode);
|
||||
|
||||
// 下发AGV到出库口的任务
|
||||
|
||||
var agv_task_id = Wtm.ConfigInfo.AppSettings.FirstOrDefault(x => x.Key == "OutIn").Value;
|
||||
var postAgv = new
|
||||
{
|
||||
task_id = agv_task_id,
|
||||
};
|
||||
|
||||
var res = Wtm.CallAPI<ShipOutController.agvResult>("ACS", "task_mould_do",
|
||||
HttpMethodEnum.POST, postAgv);
|
||||
// if (res.Result.Data.ack == 0)
|
||||
// {
|
||||
//
|
||||
// }
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
break;
|
||||
default:
|
||||
return ApiResultError(msg: $"任务类型不正确!任务号{request.TaskNo}");
|
||||
}
|
||||
|
||||
task.Status = TaskStatusEnum.完成;
|
||||
// 插到历史表,或者接下来流程
|
||||
|
||||
_unitWork.Add(new TaskHeaderHistory
|
||||
{
|
||||
TaskNo = task.TaskNo,
|
||||
TaskType = task.TaskType,
|
||||
FromLocation = task.FromLocation,
|
||||
ToLocation = task.ToLocation,
|
||||
ContainerCode = task.ContainerCode,
|
||||
Status = task.Status,
|
||||
CreateTime = DateTime.Now,
|
||||
CreateBy = "WMS"
|
||||
});
|
||||
|
||||
_unitWork.Delete(task);
|
||||
|
||||
return ApiResult();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 满入
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public IActionResult FullIn(WcsRequest request)
|
||||
{
|
||||
var task = _unitWork.FindSingle<TaskHeader>(x => x.TaskNo.Equals(request.TaskNo));
|
||||
if (task == null)
|
||||
{
|
||||
return ApiResultError(msg: $"任务不存在, 任务号 {request.TaskNo} , 请检查后重新请求!");
|
||||
}
|
||||
|
||||
var location = _unitWork.FindSingle<Location>(x => x.Status == LocationStatus.空仓位);
|
||||
if (location == null)
|
||||
{
|
||||
return ApiResultError(msg: "没有空仓位");
|
||||
}
|
||||
|
||||
task.ToLocation = location.Code;
|
||||
_unitWork.Update(task);
|
||||
|
||||
location.Status = LocationStatus.任务锁;
|
||||
_unitWork.Update(location);
|
||||
|
||||
return ApiResult(new
|
||||
{
|
||||
locationCode = location.Code
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 空出
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public IActionResult EmptyOut(WcsRequest request)
|
||||
{
|
||||
var task = _unitWork.FindSingle<TaskHeader>(x => x.TaskNo.Equals(request.TaskNo));
|
||||
if (task == null)
|
||||
{
|
||||
return ApiResultError(msg: $"任务不存在, 任务号 {request.TaskNo} , 请检查后重新请求!");
|
||||
}
|
||||
|
||||
_unitWork.Add(new TaskHeaderHistory
|
||||
{
|
||||
TaskNo = task.TaskNo,
|
||||
TaskType = task.TaskType,
|
||||
FromLocation = task.FromLocation,
|
||||
ToLocation = task.ToLocation,
|
||||
ContainerCode = task.ContainerCode,
|
||||
Status = task.Status,
|
||||
CreateTime = DateTime.Now,
|
||||
CreateBy = "WMS"
|
||||
});
|
||||
|
||||
_unitWork.Delete(task);
|
||||
return ApiResult();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using HHWMS.Web.Models;
|
||||
@@ -265,8 +266,10 @@ namespace HHWMS.Web.Controllers
|
||||
vm.MSD.AddModelError(vm.Entity.BatchError, "数量和类型必填,且数量要大于0!");
|
||||
return PartialView(vm);
|
||||
}
|
||||
var maxContainer = _unitwork.Find<Container>(x => x.Type == vm.Entity.Type).ToList().MaxBy(x => x.Code);
|
||||
int maxNum = 1;
|
||||
var maxContainer = _unitwork.Find<Container>(x => x.Type == vm.Entity.Type)
|
||||
.ToList()
|
||||
.MaxBy(x => x.Code);
|
||||
int maxNum = 0;
|
||||
if (maxContainer != null)
|
||||
int.TryParse(maxContainer?.Code.Substring(1, 4), out maxNum);
|
||||
// 查询已有的最大托盘值 在此基础上累加
|
||||
@@ -288,5 +291,89 @@ namespace HHWMS.Web.Controllers
|
||||
return FFResult().CloseDialog().RefreshGrid();
|
||||
}
|
||||
}
|
||||
|
||||
[ActionDescription("Inventory.Out")]
|
||||
public IActionResult Out(int id)
|
||||
{
|
||||
var container = _unitwork.FindById<Container>(id);
|
||||
if (container == null)
|
||||
{
|
||||
return FFResult().RefreshGrid().Alert("选定容器不存在!请检查后再执行出库任务!");
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(container.LocationCode))
|
||||
{
|
||||
return FFResult().RefreshGrid().Alert("选定容器不在库位!请检查后再执行出库任务!");
|
||||
}
|
||||
|
||||
if (_unitwork.IsExit<TaskHeader>(x => x.ContainerCode.Equals(container.Code)))
|
||||
{
|
||||
return FFResult().RefreshGrid().Alert("选定容器已存在任务!请检查后再执行出库任务!");
|
||||
}
|
||||
var location = _unitwork.FindSingle<Location>(x => x.Code == container.LocationCode);
|
||||
if (location != null)
|
||||
{
|
||||
location.Status = LocationStatus.任务锁;
|
||||
location.UpdateTime = DateTime.Now;
|
||||
location.UpdateBy = Wtm.LoginUserInfo?.ITCode ?? "WMS";
|
||||
_unitwork.Update(location);
|
||||
|
||||
// 查找container,并更新状态
|
||||
// var container = _unitwork.FindSingle<Container>(x => x.Code == location.ContainerCode);
|
||||
container.IsLock = ContainerLockEnum.任务锁;
|
||||
container.UpdateTime = DateTime.Now;
|
||||
container.UpdateBy = Wtm.LoginUserInfo?.ITCode ?? "WMS";
|
||||
_unitwork.Update(container);
|
||||
|
||||
//创建出库任务
|
||||
var task = new TaskHeader
|
||||
{
|
||||
ZoneCode = ZoneCodeEnum.立库,
|
||||
TaskNo = _unitwork.GetSerialNumber("Out"),
|
||||
TaskType = TaskTypeEnum.立库出库,
|
||||
ContainerCode = location.ContainerCode,
|
||||
FromLocation = location.Code,
|
||||
ToLocation = "",
|
||||
Status = TaskStatusEnum.待下发,
|
||||
CreateBy = Wtm.LoginUserInfo?.ITCode ?? "WMS",
|
||||
CreateTime = DateTime.Now
|
||||
};
|
||||
_unitwork.Add(task);
|
||||
|
||||
// 下发任务到wcs
|
||||
var postData = new
|
||||
{
|
||||
TaskNo = task.TaskNo,
|
||||
PalletNo = task.ContainerCode,
|
||||
FromLocation = task.FromLocation,
|
||||
ToLocation = task.ToLocation
|
||||
};
|
||||
try
|
||||
{
|
||||
var res = Wtm.CallAPI<ApiJsonResult<dynamic>>("WCS", "TaskAssign", HttpMethodEnum.POST, postData)
|
||||
.Result.Data;
|
||||
|
||||
if (res.Success)
|
||||
{
|
||||
task.Status = TaskStatusEnum.已下发;
|
||||
}
|
||||
else
|
||||
{
|
||||
task.ErrorMsg = res.Msg;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
task.ErrorMsg = ex.Message;
|
||||
}
|
||||
task.UpdateTime = DateTime.Now;
|
||||
task.UpdateBy = "WMS";
|
||||
_unitwork.Update(task);
|
||||
|
||||
}
|
||||
|
||||
return FFResult().RefreshGrid().Message("任务创建成功!");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ using WalkingTec.Mvvm.Mvc;
|
||||
using WalkingTec.Mvvm.Core.Extensions;
|
||||
using HHWMS.Web;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using HHWMS.Web.Models;
|
||||
|
||||
namespace HHWMS.Web.Controllers
|
||||
@@ -287,5 +288,30 @@ namespace HHWMS.Web.Controllers
|
||||
return Ok();
|
||||
}
|
||||
|
||||
[ActionDescription("Location.StopLocation")]
|
||||
public ActionResult StopLocation(string[] ids)
|
||||
{
|
||||
_unitwork.BatchUpdate<Location>(x => ids.Contains(x.ID.ToString()),
|
||||
x => new Location
|
||||
{
|
||||
IsStop = true,
|
||||
UpdateBy = Wtm.LoginUserInfo.ITCode,
|
||||
UpdateTime = DateTime.Now
|
||||
});
|
||||
return FFResult().RefreshGrid().Message("库位禁用成功!");
|
||||
}
|
||||
|
||||
[ActionDescription("Location.LiftLocation")]
|
||||
public ActionResult LiftLocation(string[] ids)
|
||||
{
|
||||
_unitwork.BatchUpdate<Location>(x => ids.Contains(x.ID.ToString()),
|
||||
x => new Location
|
||||
{
|
||||
IsStop = false,
|
||||
UpdateBy = Wtm.LoginUserInfo.ITCode,
|
||||
UpdateTime = DateTime.Now
|
||||
});
|
||||
return FFResult().RefreshGrid().Message("库位解禁成功!");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -31,6 +31,10 @@ namespace HHWMS.Web
|
||||
this.MakeStandardAction("Container", GridActionStandardTypesEnum.Import, Localizer["Sys.Import"], "configs", dialogWidth: 800),
|
||||
this.MakeStandardAction("Container", GridActionStandardTypesEnum.ExportExcel, Localizer["Sys.Export"], "configs"),
|
||||
this.MakeAction("Container","AddContainer",Localizer["Container.AddContainer"],Localizer["Container.AddContainer"],GridActionParameterTypesEnum.NoId,"configs"),
|
||||
this.MakeAction("Container","Out",Localizer["Inventory.Out"],Localizer["Inventory.Out"],GridActionParameterTypesEnum.SingleId,"configs"),
|
||||
|
||||
this.MakeAction("Location","Print",Localizer["Sys.Print"],Localizer["Sys.Print"],GridActionParameterTypesEnum.MultiIds,"configs")
|
||||
.SetShowDialog(false).SetOnClickScript("print"),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -33,6 +33,9 @@ namespace HHWMS.Web
|
||||
this.MakeStandardAction("Location", GridActionStandardTypesEnum.Import, Localizer["Sys.Import"], "configs", dialogWidth: 800),
|
||||
this.MakeStandardAction("Location", GridActionStandardTypesEnum.ExportExcel, Localizer["Sys.Export"], "configs"),
|
||||
this.MakeAction("Location","AddLocation",Localizer["Location.AddLocation"],Localizer["Location.AddLocation"],GridActionParameterTypesEnum.NoId,"configs"),
|
||||
this.MakeAction("Location","StopLocation",Localizer["Location.StopLocation"],Localizer["Location.StopLocation"],GridActionParameterTypesEnum.MultiIds,"configs"),
|
||||
this.MakeAction("Location","LiftLocation",Localizer["Location.LiftLocation"],Localizer["Location.LiftLocation"],GridActionParameterTypesEnum.MultiIds,"configs"),
|
||||
|
||||
this.MakeAction("Location","Print",Localizer["Sys.Print"],Localizer["Sys.Print"],GridActionParameterTypesEnum.MultiIds,"configs")
|
||||
.SetShowDialog(false).SetOnClickScript("print"),
|
||||
|
||||
|
||||
@@ -12,12 +12,6 @@ namespace HHWMS.Web
|
||||
{
|
||||
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")]
|
||||
public ExcelPropety MaterialCode_Excel = ExcelPropety.CreateProperty<Material>(x => x.MaterialCode);
|
||||
[Display(Name = "Inventory.MaterialType")]
|
||||
|
||||
@@ -25,6 +25,8 @@ namespace HHWMS.Web
|
||||
this.MakeStandardAction("Material", GridActionStandardTypesEnum.BatchDelete, Localizer["Sys.BatchDelete"], "configs", dialogWidth: 800),
|
||||
this.MakeStandardAction("Material", GridActionStandardTypesEnum.Import, Localizer["Sys.Import"], "configs", dialogWidth: 800),
|
||||
this.MakeStandardAction("Material", GridActionStandardTypesEnum.ExportExcel, Localizer["Sys.Export"], "configs"),
|
||||
this.MakeAction("Location","Print",Localizer["Sys.Print"],Localizer["Sys.Print"],GridActionParameterTypesEnum.MultiIds,"configs")
|
||||
.SetShowDialog(false).SetOnClickScript("print"),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -32,9 +34,6 @@ namespace HHWMS.Web
|
||||
protected override IEnumerable<IGridColumn<Material_View>> InitGridHeader()
|
||||
{
|
||||
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.MaterialType),
|
||||
this.MakeGridHeader(x => x.MaterialName),
|
||||
@@ -52,15 +51,10 @@ namespace HHWMS.Web
|
||||
public override IOrderedQueryable<Material_View> GetSearchQuery()
|
||||
{
|
||||
var query = DC.Set<Material>()
|
||||
.CheckContain(Searcher.UniqueCode, x=>x.UniqueCode)
|
||||
.CheckContain(Searcher.QRCode, x=>x.QRCode)
|
||||
.CheckContain(Searcher.MaterialCode, x=>x.MaterialCode)
|
||||
.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,
|
||||
|
||||
@@ -12,12 +12,11 @@ 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.MaterialName")]
|
||||
public String MaterialName { get; set; }
|
||||
|
||||
protected override void InitVM()
|
||||
{
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
<wt:form vm="@Model">
|
||||
<wt:row items-per-row="ItemsPerRowEnum.Two">
|
||||
<wt:textbox field="Entity.Type" />
|
||||
<wt:combobox field="Entity.Type" items="ContainerType"/>
|
||||
<wt:textbox field="Num" />
|
||||
<wt:textbox field="Entity.Length" />
|
||||
<wt:textbox field="Entity.Width" />
|
||||
|
||||
@@ -14,3 +14,20 @@
|
||||
</wt:row>
|
||||
</wt:searchpanel>
|
||||
<wt:grid vm="@Model" url="/configs/Container/Search"/>
|
||||
<script>
|
||||
let template = {"panels":[{"index":0,"height":60,"width":80,"paperHeader":43.5,"paperFooter":170.07874015748033,"printElements":[{"options":{"left":13.5,"top":22.5,"height":100.5,"width":198,"title":"12345678","field":"code","testData":"12345678","textType":"barcode","barcodeMode":"CODE128A","fontFamily":"Microsoft YaHei","fontSize":20.25,"textAlign":"center","lineHeight":30},"printElementType":{"type":"text"}}],"paperNumberLeft":196,"paperNumberTop":148,"paperNumberDisabled":true}]};
|
||||
let printData = [];
|
||||
|
||||
function print(ids, datas) {
|
||||
datas.forEach(function (value, index, arr) {
|
||||
printData.push({ code: value.Code })
|
||||
});
|
||||
|
||||
hiprint.init();
|
||||
var hiprintTemplate = new hiprint.PrintTemplate({
|
||||
template: template
|
||||
});
|
||||
hiprintTemplate.print(printData);
|
||||
printData = [];
|
||||
}
|
||||
</script>
|
||||
@@ -5,15 +5,17 @@
|
||||
<wt:row items-per-row="ItemsPerRowEnum.Three">
|
||||
<wt:combobox field="Searcher.ZoneCode" items="ZoneCodes" />
|
||||
<wt:textbox field="Searcher.Code" />
|
||||
@* <wt:combobox field="Searcher.Type" items="Types" />
|
||||
<wt:combobox field="Searcher.Type" items="Types" />
|
||||
<wt:combobox field="Searcher.Status" items="LocationStatus" />
|
||||
<wt:textbox field="Searcher.ContainerCode" />
|
||||
<wt:combobox field="Searcher.IsStop" empty-text="@Localizer["Sys.All"]" />
|
||||
<wt:textbox field="Searcher.Row" />
|
||||
<wt:textbox field="Searcher.Line" />
|
||||
<wt:textbox field="Searcher.Layer" />
|
||||
@*
|
||||
<wt:textbox field="Searcher.RoadWay" />
|
||||
<wt:textbox field="Searcher.ContainerCode" />
|
||||
<wt:combobox field="Searcher.IsStop" empty-text="@Localizer["Sys.All"]" /> *@
|
||||
@*<wt:textbox field="Searcher.ContiguousCode" />*@
|
||||
<wt:textbox field="Searcher.ContiguousCode" />
|
||||
*@
|
||||
</wt:row>
|
||||
</wt:searchpanel>
|
||||
<wt:grid vm="@Model" url="/configs/Location/Search"/>
|
||||
|
||||
@@ -3,9 +3,6 @@
|
||||
|
||||
<wt:form vm="@Model">
|
||||
<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.MaterialType" />
|
||||
<wt:textbox field="Entity.MaterialName" />
|
||||
|
||||
@@ -4,9 +4,6 @@
|
||||
<wt:form vm="@Model">
|
||||
<wt:quote>@Localizer["Sys.DeleteConfirm"]</wt:quote>
|
||||
<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.MaterialType" />
|
||||
<wt:display field="Entity.MaterialName" />
|
||||
|
||||
@@ -3,9 +3,6 @@
|
||||
|
||||
<wt:form vm="@Model">
|
||||
<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.MaterialType" />
|
||||
<wt:display field="Entity.MaterialName" />
|
||||
|
||||
@@ -3,9 +3,6 @@
|
||||
|
||||
<wt:form vm="@Model">
|
||||
<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.MaterialType" />
|
||||
<wt:textbox field="Entity.MaterialName" />
|
||||
|
||||
@@ -3,9 +3,25 @@
|
||||
|
||||
<wt:searchpanel vm="@Model" reset-btn="true">
|
||||
<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.MaterialName" />
|
||||
</wt:row>
|
||||
</wt:searchpanel>
|
||||
<wt:grid vm="@Model" url="/configs/Material/Search"/>
|
||||
<script>
|
||||
let template = {"panels":[{"index":0,"height":60,"width":80,"paperHeader":43.5,"paperFooter":170.07874015748033,"printElements":[{"options":{"left":10.5,"top":37.5,"height":50,"width":120,"field":"MaterialCode","fontSize":18,"textAlign":"center","textContentVerticalAlign":"middle"},"printElementType":{"type":"text"}},{"options":{"left":132,"top":37.5,"height":99,"width":90,"title":"123","field":"MaterialCode","textType":"qrcode"},"printElementType":{"type":"text"}},{"options":{"left":10.5,"top":88.5,"height":50,"width":120,"field":"MaterialName","fontSize":12,"textAlign":"center","textContentVerticalAlign":"middle"},"printElementType":{"type":"text"}}],"paperNumberLeft":196,"paperNumberTop":148,"paperNumberDisabled":true}]};
|
||||
let printData = [];
|
||||
|
||||
function print(ids, datas) {
|
||||
datas.forEach(function (value, index, arr) {
|
||||
printData.push({ MaterialCode: value.MaterialCode, MaterialName: value.MaterialName })
|
||||
});
|
||||
|
||||
hiprint.init();
|
||||
var hiprintTemplate = new hiprint.PrintTemplate({
|
||||
template: template
|
||||
});
|
||||
hiprintTemplate.print(printData);
|
||||
printData = [];
|
||||
}
|
||||
</script>
|
||||
@@ -225,5 +225,83 @@ namespace HHWMS.Web.Controllers
|
||||
}
|
||||
#endregion
|
||||
|
||||
[ActionDescription("Inventory.Out")]
|
||||
public IActionResult Out(int id)
|
||||
{
|
||||
var inv = _unitwork.FindById<Inventory>(id);
|
||||
if (inv == null)
|
||||
{
|
||||
return FFResult().RefreshGrid().Alert("选定库存不存在!请检查后再执行出库任务!");
|
||||
}
|
||||
|
||||
if (_unitwork.IsExit<TaskHeader>(x => x.ContainerCode.Equals(inv.ContainerCode)))
|
||||
{
|
||||
return FFResult().RefreshGrid().Alert("选定库存已存在任务!请检查后再执行出库任务!");
|
||||
}
|
||||
var location = _unitwork.FindSingle<Location>(x => x.Code == inv.LocationCode);
|
||||
if (location != null)
|
||||
{
|
||||
location.Status = LocationStatus.任务锁;
|
||||
location.UpdateTime = DateTime.Now;
|
||||
location.UpdateBy = Wtm.LoginUserInfo?.ITCode ?? "WMS";
|
||||
// _unitwork.Update(location);
|
||||
|
||||
// 查找container,并更新状态
|
||||
var container = _unitwork.FindSingle<Container>(x => x.Code == location.ContainerCode);
|
||||
container.IsLock = ContainerLockEnum.任务锁;
|
||||
container.UpdateTime = DateTime.Now;
|
||||
container.UpdateBy = Wtm.LoginUserInfo?.ITCode ?? "WMS";
|
||||
// _unitwork.Update(container);
|
||||
|
||||
//创建出库任务
|
||||
var task = new TaskHeader
|
||||
{
|
||||
ZoneCode = ZoneCodeEnum.立库,
|
||||
TaskNo = _unitwork.GetSerialNumber("Out"),
|
||||
TaskType = TaskTypeEnum.立库出库,
|
||||
ContainerCode = location.ContainerCode,
|
||||
FromLocation = location.Code,
|
||||
ToLocation = "",
|
||||
Status = TaskStatusEnum.待下发,
|
||||
CreateBy = Wtm.LoginUserInfo?.ITCode ?? "WMS",
|
||||
CreateTime = DateTime.Now
|
||||
};
|
||||
// _unitwork.Add(task);
|
||||
|
||||
// 下发任务到wcs
|
||||
var postData = new
|
||||
{
|
||||
TaskNo = task.TaskNo,
|
||||
PalletNo = task.ContainerCode,
|
||||
FromLocation = task.FromLocation,
|
||||
ToLocation = task.ToLocation
|
||||
};
|
||||
var res = Wtm.CallAPI<ApiJsonResult<dynamic>>("WCS", "TaskAssign", HttpMethodEnum.POST, postData)
|
||||
.Result.Data;
|
||||
if (res.Success)
|
||||
{
|
||||
task.Status = TaskStatusEnum.已下发;
|
||||
task.UpdateTime = DateTime.Now;
|
||||
task.UpdateBy = "WMS";
|
||||
_unitwork.Add(task);
|
||||
|
||||
inv.TaskStatus = InventoryTaskStatus.任务中;
|
||||
_unitwork.Update(inv);
|
||||
|
||||
_unitwork.Update(container);
|
||||
_unitwork.Update(location);
|
||||
}
|
||||
else
|
||||
{
|
||||
task.ErrorMsg = res.Msg;
|
||||
return FFResult().RefreshGrid().Alert("出库任务创建失败!");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
return FFResult().RefreshGrid().Message("任务创建成功!");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -24,7 +24,7 @@ namespace HHWMS.Web
|
||||
return new List<GridAction>
|
||||
{
|
||||
this.MakeStandardAction("Inventory", GridActionStandardTypesEnum.Create, Localizer["Sys.Create"],"inventory", dialogWidth: 800),
|
||||
this.MakeAction("Inventory","ReturnToMes",Localizer["Inventory.ReturnToMes"],Localizer["Inventory.ReturnToMes"],GridActionParameterTypesEnum.SingleId,"inventory"),
|
||||
this.MakeAction("Inventory","Out",Localizer["Inventory.Out"],Localizer["Inventory.Out"],GridActionParameterTypesEnum.SingleId,"inventory"),
|
||||
this.MakeStandardAction("Inventory", GridActionStandardTypesEnum.Edit, Localizer["Sys.Edit"], "inventory", dialogWidth: 800),
|
||||
this.MakeStandardAction("Inventory", GridActionStandardTypesEnum.Delete, Localizer["Sys.Delete"], "inventory", dialogWidth: 800),
|
||||
this.MakeStandardAction("Inventory", GridActionStandardTypesEnum.Details, Localizer["Sys.Details"], "inventory", dialogWidth: 800),
|
||||
@@ -55,15 +55,15 @@ namespace HHWMS.Web
|
||||
var data = ZoneCodes.FirstOrDefault(x => x.Value.ToString() == a.ZoneCode);
|
||||
return data?.Text ?? a.ZoneCode;
|
||||
}),
|
||||
this.MakeGridHeader(x => x.ContainerCode).SetHide(),
|
||||
this.MakeGridHeader(x => x.ContainerCode),
|
||||
this.MakeGridHeader(x => x.LocationCode),
|
||||
this.MakeGridHeader(x => x.MaterialCode),
|
||||
this.MakeGridHeader(x => x.MaterialType),
|
||||
// this.MakeGridHeader(x => x.MaterialType),
|
||||
this.MakeGridHeader(x => x.MaterialName),
|
||||
this.MakeGridHeader(x => x.MaterialSpec),
|
||||
this.MakeGridHeader(x => x.MaterialUnit),
|
||||
this.MakeGridHeader(x => x.Batch),
|
||||
this.MakeGridHeader(x => x.Lot),
|
||||
// this.MakeGridHeader(x => x.MaterialUnit),
|
||||
// this.MakeGridHeader(x => x.Batch),
|
||||
// this.MakeGridHeader(x => x.Lot),
|
||||
//this.MakeGridHeader(x => x.ManufactureDate),
|
||||
//this.MakeGridHeader(x => x.ExpirationDate),
|
||||
//this.MakeGridHeader(x => x.CompanyCode),
|
||||
@@ -110,6 +110,7 @@ namespace HHWMS.Web
|
||||
var query = DC.Set<Inventory>()
|
||||
.CheckContain(Searcher.ZoneCode, x => x.ZoneCode)
|
||||
.CheckContain(Searcher.LocationCode, x => x.LocationCode)
|
||||
.CheckContain(Searcher.ContainerCode, x => x.ContainerCode)
|
||||
.CheckContain(Searcher.MaterialCode, x => x.MaterialCode)
|
||||
.CheckContain(Searcher.MaterialType, x => x.MaterialType)
|
||||
.CheckContain(Searcher.MaterialName, x => x.MaterialName)
|
||||
|
||||
@@ -14,8 +14,12 @@ namespace HHWMS.Web
|
||||
{
|
||||
[Display(Name = "Task.ZoneCode")]
|
||||
public String ZoneCode { get; set; }
|
||||
[Display(Name = "Inventory.LocationCode")]
|
||||
[Display(Name = "Container.LocationCode")]
|
||||
public String LocationCode { get; set; }
|
||||
|
||||
[Display(Name = "Task.ContainerCode")]
|
||||
public String ContainerCode { get; set; }
|
||||
|
||||
[Display(Name = "Inventory.UniqueCode")]
|
||||
public String UniqueCode { get; set; }
|
||||
[Display(Name = "Inventory.MaterialCode")]
|
||||
|
||||
@@ -3,12 +3,12 @@
|
||||
|
||||
<wt:searchpanel vm="@Model" reset-btn="true">
|
||||
<wt:row items-per-row="ItemsPerRowEnum.Three">
|
||||
<wt:combobox field="Searcher.ZoneCode" items="ZoneCodes" />
|
||||
<wt:textbox field="Searcher.UniqueCode" />
|
||||
<wt:textbox field="Searcher.MaterialCode" />
|
||||
<wt:textbox field="Searcher.Batch" />
|
||||
@*<wt:textbox field="Searcher.MaterialType" />
|
||||
<wt:textbox field="Searcher.MaterialName" />
|
||||
<wt:textbox field="Searcher.ContainerCode" />
|
||||
<wt:textbox field="Searcher.LocationCode" />
|
||||
|
||||
@*<wt:textbox field="Searcher.MaterialType" />
|
||||
<wt:textbox field="Searcher.MaterialSpec" />
|
||||
<wt:textbox field="Searcher.MaterialUnit" />
|
||||
<wt:textbox field="Searcher.Batch" />
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using HHWMS.Web.Models;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using WalkingTec.Mvvm.Core;
|
||||
using WalkingTec.Mvvm.Mvc;
|
||||
@@ -5,14 +8,16 @@ using WalkingTec.Mvvm.Mvc;
|
||||
namespace HHWMS.Web.Controllers
|
||||
{
|
||||
[Area("receipt")]
|
||||
[ActionDescription("盘料操作")]
|
||||
[ActionDescription("入库操作")]
|
||||
public partial class ReceiptInController : BaseController
|
||||
{
|
||||
private readonly IUnitWork _unitWork;
|
||||
private readonly WTMContext _context;
|
||||
|
||||
public ReceiptInController(IUnitWork unitwork)
|
||||
public ReceiptInController(IUnitWork unitWork, WTMContext wtmContext)
|
||||
{
|
||||
_unitWork = unitwork;
|
||||
_unitWork = unitWork;
|
||||
_context = wtmContext;
|
||||
}
|
||||
|
||||
#region Index
|
||||
@@ -24,5 +29,370 @@ namespace HHWMS.Web.Controllers
|
||||
}
|
||||
|
||||
#endregion Index
|
||||
|
||||
[HttpGet]
|
||||
public ActionResult SearchMaterials(string keyword)
|
||||
{
|
||||
if (string.IsNullOrEmpty(keyword))
|
||||
{
|
||||
return JsonMore(new { Data = new object[] { } });
|
||||
}
|
||||
|
||||
var materials = _unitWork.Find<Material>(x =>
|
||||
x.MaterialCode.Contains(keyword) ||
|
||||
x.MaterialName.Contains(keyword))
|
||||
.Take(10)
|
||||
.Select(x => new {
|
||||
MaterialCode = x.MaterialCode,
|
||||
MaterialName = x.MaterialName,
|
||||
MaterialSpec = x.MaterialSpec,
|
||||
MaterialUnit = x.MaterialUnit
|
||||
})
|
||||
.ToList();
|
||||
|
||||
return JsonMore( materials );
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public ActionResult AddInventory(string containerCode, string materialCode, decimal qty)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrEmpty(containerCode))
|
||||
{
|
||||
return JsonMore(null, 500, "容器编码为空!");
|
||||
}
|
||||
if (string.IsNullOrEmpty(materialCode))
|
||||
{
|
||||
return JsonMore(null, 500, "物料编码为空!");
|
||||
}
|
||||
if (qty <= 0)
|
||||
{
|
||||
return JsonMore(null, 500, "数量必须大于0!");
|
||||
}
|
||||
|
||||
// 查询容器
|
||||
var container = _unitWork.FindSingle<Container>(u => u.Code == containerCode);
|
||||
if (container == null)
|
||||
{
|
||||
return JsonMore(null, 500, $"库内没有编码为 {containerCode} 的容器!");
|
||||
}
|
||||
|
||||
// 查询物料信息
|
||||
var material = _unitWork.FindSingle<Material>(x => x.MaterialCode == materialCode);
|
||||
if (material == null)
|
||||
{
|
||||
return JsonMore(null, 500, $"未找到物料编码为 {materialCode} 的物料信息!");
|
||||
}
|
||||
|
||||
// 创建库存记录
|
||||
var inventory = new Inventory()
|
||||
{
|
||||
ZoneCode = ZoneCodeEnum.立库,
|
||||
ContainerCode = container.Code,
|
||||
MaterialCode = material.MaterialCode,
|
||||
MaterialName = material.MaterialName,
|
||||
MaterialType = material.MaterialType,
|
||||
MaterialSpec = material.MaterialSpec,
|
||||
MaterialUnit = material.MaterialUnit,
|
||||
Qty = qty,
|
||||
TaskStatus = InventoryTaskStatus.任务中,
|
||||
CreateTime = DateTime.Now
|
||||
};
|
||||
_unitWork.Add(inventory);
|
||||
|
||||
// 创建入库交易记录
|
||||
var transaction = new InventoryTransaction
|
||||
{
|
||||
BillType = InventoryTranType.入库,
|
||||
MaterialCode = material.MaterialCode,
|
||||
MaterialName = material.MaterialName,
|
||||
MaterialUnit = material.MaterialUnit,
|
||||
ContainerCode = container.Code,
|
||||
Qty = qty,
|
||||
CreateTime = DateTime.Now,
|
||||
CreateBy = "WMS",
|
||||
UpdateTime = DateTime.Now,
|
||||
UpdateBy = "WMS"
|
||||
};
|
||||
_unitWork.Add(transaction);
|
||||
|
||||
return JsonMore(new { Id = inventory.ID });
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return JsonMore(null, 500, ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public ActionResult TaskIn(string containerCode)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrEmpty(containerCode))
|
||||
{
|
||||
return JsonMore(null, 500, "容器编码为空!");
|
||||
}
|
||||
|
||||
// 查询容器
|
||||
var container = _unitWork.FindSingle<Container>(u => u.Code == containerCode);
|
||||
if (container == null)
|
||||
{
|
||||
return JsonMore(null, 500, $"库内没有编码为 {containerCode} 的容器!");
|
||||
}
|
||||
|
||||
// 查询容器的库存
|
||||
var inventories = _unitWork.Find<Inventory>(x => x.ContainerCode == containerCode).ToList();
|
||||
|
||||
// 根据库存情况设置容器状态
|
||||
if (inventories.Any())
|
||||
{
|
||||
container.Status = ContainerStatus.有;
|
||||
}
|
||||
else
|
||||
{
|
||||
container.Status = ContainerStatus.空;
|
||||
}
|
||||
|
||||
// 查找仓位
|
||||
var location = _unitWork.Find<Location>(u => u.Status == LocationStatus.空仓位
|
||||
&& u.Type == container.Type
|
||||
&& !u.IsStop)
|
||||
.OrderBy(x => x.Layer)
|
||||
.ThenBy(x => x.Line)
|
||||
.FirstOrDefault();
|
||||
|
||||
// 判断location是否为空
|
||||
if (location == null)
|
||||
{
|
||||
return JsonMore(null, 500, "库内没有空闲仓位!");
|
||||
}
|
||||
|
||||
// 更新容器状态
|
||||
container.IsLock = ContainerLockEnum.任务锁;
|
||||
container.UpdateTime = DateTime.Now;
|
||||
container.UpdateBy = Wtm?.LoginUserInfo?.ITCode ?? "WMS";
|
||||
// _unitWork.Update(container);
|
||||
|
||||
// 更新仓位状态
|
||||
location.Status = LocationStatus.任务锁;
|
||||
location.UpdateTime = DateTime.Now;
|
||||
location.UpdateBy = Wtm?.LoginUserInfo?.ITCode ?? "WMS";
|
||||
// _unitWork.Update(location);
|
||||
|
||||
// 更新库存记录
|
||||
// foreach (var inventory in inventories)
|
||||
// {
|
||||
// inventory.LocationCode = location.Code;
|
||||
// _unitWork.Update(inventory);
|
||||
// }
|
||||
|
||||
// 创建入库任务
|
||||
var task = new TaskHeader
|
||||
{
|
||||
ZoneCode = ZoneCodeEnum.立库,
|
||||
TaskNo = _unitWork.GetSerialNumber("In"),
|
||||
TaskType = TaskTypeEnum.立库入库,
|
||||
ContainerCode = container.Code,
|
||||
FromLocation = "",
|
||||
ToLocation = location.Code,
|
||||
Status = TaskStatusEnum.待下发,
|
||||
CreateTime = DateTime.Now,
|
||||
CreateBy = Wtm?.LoginUserInfo?.ITCode??"WMS",
|
||||
};
|
||||
|
||||
// _unitWork.Add(task);
|
||||
|
||||
// 下发任务到wcs
|
||||
var postData = new
|
||||
{
|
||||
TaskNo = task.TaskNo,
|
||||
PalletNo = task.ContainerCode,
|
||||
FromLocation = task.FromLocation,
|
||||
ToLocation = task.ToLocation
|
||||
};
|
||||
try
|
||||
{
|
||||
var res = Wtm.CallAPI<ApiJsonResult<dynamic>>("WCS", "TaskAssign", HttpMethodEnum.POST, postData)
|
||||
.Result?.Data;
|
||||
|
||||
if (res.Success)
|
||||
{
|
||||
task.Status = TaskStatusEnum.已下发;
|
||||
task.UpdateTime = DateTime.Now;
|
||||
task.UpdateBy = "WMS";
|
||||
_unitWork.Add(task);
|
||||
|
||||
_unitWork.Update(container);
|
||||
_unitWork.Update(location);
|
||||
}
|
||||
else
|
||||
{
|
||||
task.ErrorMsg = res.Msg;
|
||||
return JsonMore(null, 500, res.Msg);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
task.ErrorMsg = ex.Message;
|
||||
return JsonMore(null, 500, "任务下发失败!");
|
||||
}
|
||||
|
||||
return JsonMore(null);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return JsonMore(null, 500, ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public ActionResult DeleteInventory(int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
// 查询库存记录
|
||||
var inventory = _unitWork.Find<Inventory>(x => x.ID == id).FirstOrDefault();
|
||||
|
||||
if (inventory == null)
|
||||
{
|
||||
return JsonMore(null, 500, "未找到对应的库存记录!");
|
||||
}
|
||||
|
||||
// 创建出库交易记录
|
||||
var transaction = new InventoryTransaction
|
||||
{
|
||||
BillType = InventoryTranType.出库,
|
||||
MaterialCode = inventory.MaterialCode,
|
||||
MaterialName = inventory.MaterialName,
|
||||
MaterialUnit = inventory.MaterialUnit,
|
||||
ContainerCode = inventory.ContainerCode,
|
||||
Qty = inventory.Qty,
|
||||
CreateTime = DateTime.Now,
|
||||
CreateBy = "WMS",
|
||||
UpdateTime = DateTime.Now,
|
||||
UpdateBy = "WMS"
|
||||
};
|
||||
_unitWork.Add(transaction);
|
||||
|
||||
// 删除库存记录
|
||||
_unitWork.Delete(inventory);
|
||||
|
||||
return JsonMore(null);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return JsonMore(null, 500, ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public ActionResult UpdateInventory(int id, decimal qty)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (qty <= 0)
|
||||
{
|
||||
return JsonMore(null, 500, "数量必须大于0!");
|
||||
}
|
||||
|
||||
// 查询库存记录
|
||||
var inventory = _unitWork.Find<Inventory>(x => x.ID == id).FirstOrDefault();
|
||||
|
||||
if (inventory == null)
|
||||
{
|
||||
return JsonMore(null, 500, "未找到对应的库存记录!");
|
||||
}
|
||||
|
||||
// 创建出库交易记录(原数量)
|
||||
var outTransaction = new InventoryTransaction
|
||||
{
|
||||
BillType = InventoryTranType.出库,
|
||||
MaterialCode = inventory.MaterialCode,
|
||||
MaterialName = inventory.MaterialName,
|
||||
MaterialUnit = inventory.MaterialUnit,
|
||||
ContainerCode = inventory.ContainerCode,
|
||||
Qty = inventory.Qty,
|
||||
CreateTime = DateTime.Now,
|
||||
CreateBy = "WMS",
|
||||
UpdateTime = DateTime.Now,
|
||||
UpdateBy = "WMS"
|
||||
};
|
||||
_unitWork.Add(outTransaction);
|
||||
|
||||
// 创建入库交易记录(新数量)
|
||||
var inTransaction = new InventoryTransaction
|
||||
{
|
||||
BillType = InventoryTranType.入库,
|
||||
MaterialCode = inventory.MaterialCode,
|
||||
MaterialName = inventory.MaterialName,
|
||||
MaterialUnit = inventory.MaterialUnit,
|
||||
ContainerCode = inventory.ContainerCode,
|
||||
Qty = qty,
|
||||
CreateTime = DateTime.Now,
|
||||
CreateBy = "WMS",
|
||||
UpdateTime = DateTime.Now,
|
||||
UpdateBy = "WMS"
|
||||
};
|
||||
_unitWork.Add(inTransaction);
|
||||
|
||||
// 更新库存数量
|
||||
inventory.Qty = qty;
|
||||
inventory.UpdateTime = DateTime.Now;
|
||||
inventory.UpdateBy = Wtm?.LoginUserInfo?.ITCode ?? "WMS";
|
||||
_unitWork.Update(inventory);
|
||||
|
||||
return JsonMore(null);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return JsonMore(null, 500, ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public JsonResult ValidateContainer(string containerCode)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrEmpty(containerCode))
|
||||
{
|
||||
return Json(new { Code = 400, Msg = "容器编码不能为空" });
|
||||
}
|
||||
|
||||
var container = _unitWork.FindSingle<Container>(u => u.Code == containerCode);
|
||||
if (container == null)
|
||||
{
|
||||
return Json(new { Code = 400, Msg = "容器不存在" });
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(container.LocationCode))
|
||||
{
|
||||
return Json(new { Code = 400, Msg = $"{containerCode} 容器状态不正确!已存在任务或者已在库内" });
|
||||
}
|
||||
|
||||
// 获取容器内的物料信息
|
||||
var inventories = _unitWork.Find<Inventory>(x => x.ContainerCode == containerCode)
|
||||
.Select(x => new {
|
||||
Id = x.ID,
|
||||
ContainerCode = x.ContainerCode,
|
||||
MaterialCode = x.MaterialCode,
|
||||
MaterialName = x.MaterialName,
|
||||
Qty = x.Qty
|
||||
})
|
||||
.ToList();
|
||||
|
||||
return Json(new {
|
||||
Code = 200,
|
||||
Msg = "验证成功",
|
||||
Data = inventories
|
||||
});
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return Json(new { Code = 500, Msg = ex.Message });
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,342 +1,443 @@
|
||||
<el-row id="plapp" :gutter="20">
|
||||
<el-col :span="6">
|
||||
<el-card class="box-card" :span="8">
|
||||
<el-select v-model="value" clearable filterable placeholder="请选择单据" size="big" style="width:100%"
|
||||
@@change="changeselect" @@clear="clearReceipt">
|
||||
<el-option v-for="item in options"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value">
|
||||
</el-option>
|
||||
</el-select>
|
||||
<div id="receiptin">
|
||||
<a-space direction="vertical" fill>
|
||||
<a-form :model="formData" layout="vertical">
|
||||
<a-form-item field="containerCode" label="容器编码">
|
||||
<a-input
|
||||
v-model="ContainerCode"
|
||||
placeholder="扫描箱号"
|
||||
allow-clear
|
||||
@@keyup.enter="validateContainer"
|
||||
ref="containerInput"/>
|
||||
</a-form-item>
|
||||
<a-form-item field="materialCode" label="物料信息">
|
||||
<a-auto-complete
|
||||
v-model="MaterialCode"
|
||||
:data="materialOptions"
|
||||
@@search="handleSearch"
|
||||
@@select="handleSelect"
|
||||
placeholder="输入物料编码或名称"
|
||||
ref="materialInput">
|
||||
</a-auto-complete>
|
||||
</a-form-item>
|
||||
<a-form-item field="materialName" label="物料名称">
|
||||
<a-input v-model="MaterialName" disabled/>
|
||||
</a-form-item>
|
||||
<a-form-item field="materialSpec" label="物料型号">
|
||||
<a-input v-model="MaterialSpec" disabled/>
|
||||
</a-form-item>
|
||||
<a-form-item field="qty" label="数量">
|
||||
<a-input-number v-model="Qty" :min="0" style="width: 100%"/>
|
||||
</a-form-item>
|
||||
<a-form-item>
|
||||
<a-space>
|
||||
<a-button @@click="handleBind" type="primary">绑定</a-button>
|
||||
<a-button @@click="handleClick" :loading="loading1" type="primary">入库</a-button>
|
||||
</a-space>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
|
||||
<el-table :data="tableData" height="700" border
|
||||
style="width: 100%">
|
||||
<el-table-column prop="name"
|
||||
label="唯一码"
|
||||
align="center">
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-card>
|
||||
</el-col>
|
||||
<el-col :span="18">
|
||||
<el-card class="box-card" :span="16">
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
|
||||
<el-form-item label="单据名称">
|
||||
<el-input v-model="form.code" readonly></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="周转箱编码" prop="boxCode">
|
||||
<el-input v-model="form.boxCode" @@change="scanBox" ref="boxCode"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="料盘尺寸" prop="size">
|
||||
<el-select v-model="form.size" placeholder="请选择料盘尺寸" style="width:100%" @@change="changeSize" clearable>
|
||||
<el-option v-for="item in form.boxSize"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="唯一码" prop="uniqueCode">
|
||||
<el-input v-model="form.uniqueCode" @@change="scanUniqueCode" ref="uniqueCode"></el-input>
|
||||
</el-form-item>
|
||||
<el-table :data="bindingData"
|
||||
ref="tableData"
|
||||
height="450" border
|
||||
style="width: 100%">
|
||||
<el-table-column fixed="left"
|
||||
label="操作"
|
||||
width="120"
|
||||
align="center">
|
||||
<template slot-scope="scope">
|
||||
<el-button @@click.native.prevent="deleteRow(scope.$index, bindingData)"
|
||||
type="text"
|
||||
size="small">
|
||||
移除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="入库单编码" align="center" prop="receiptCode" v-if="false"></el-table-column>
|
||||
<el-table-column label="周转箱" align="center" prop="boxCode"></el-table-column>
|
||||
<el-table-column label="索引" align="center" prop="index"></el-table-column>
|
||||
<el-table-column label="唯一码" align="center" prop="uniqueCode"></el-table-column>
|
||||
<el-table-column label="料盘尺寸" align="center" prop="size" :formatter="sizeFormatter"></el-table-column>
|
||||
</el-table>
|
||||
<el-form-item style="float:right">
|
||||
<el-button type="primary" @@click="onSubmit">绑定入库</el-button>
|
||||
<el-button @@click="resetForm('form')">重置</el-button>
|
||||
@* <el-button type="primary" @@click="inOperation">启动入库</el-button> *@
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<a-table :data="bindList" :columns="columns" :pagination="false">
|
||||
<template #operations="{ record }">
|
||||
<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-space>
|
||||
</template>
|
||||
<template #qty="{ record }">
|
||||
{{ Math.floor(record.Qty) }}
|
||||
</template>
|
||||
</a-table>
|
||||
|
||||
<a-modal v-model:visible="editModalVisible" title="修改数量" @@ok="handleEditConfirm" @@cancel="handleEditCancel">
|
||||
<a-form :model="editForm">
|
||||
<a-form-item field="qty" label="数量">
|
||||
<a-input-number v-model="editForm.qty" :min="0" :precision="0" style="width: 100%"/>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</a-modal>
|
||||
|
||||
<a-modal v-model:visible="deductModalVisible" title="扣除数量" @@ok="handleDeductConfirm" @@cancel="handleDeductCancel">
|
||||
<a-form :model="deductForm">
|
||||
<a-form-item field="qty" label="扣除数量">
|
||||
<a-input-number v-model="deductForm.qty" :min="0" :max="deductForm.maxQty" :precision="0" style="width: 100%"/>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</a-modal>
|
||||
</a-space>
|
||||
</div>
|
||||
<script>
|
||||
var app = new Vue({
|
||||
el: '#plapp',
|
||||
data() {
|
||||
var validatePass = (rule, value, callback) => {
|
||||
if (value === '') {
|
||||
callback(new Error('请输入工位编码'));
|
||||
}
|
||||
else if (value == 'L01' || value == 'L02') {
|
||||
callback();
|
||||
} else {
|
||||
callback(new Error('请输入正确工位编码'));
|
||||
}
|
||||
};
|
||||
const { createApp, reactive, ref } = Vue
|
||||
|
||||
return {
|
||||
form: {
|
||||
code: '',
|
||||
boxCode: '',
|
||||
boxSize: [],
|
||||
size: '',
|
||||
uniqueCode: ''
|
||||
},
|
||||
options: [],
|
||||
value: '',
|
||||
tableData: [],
|
||||
bindingData: [],
|
||||
dataIndex: [],
|
||||
rules: {
|
||||
boxCode: [
|
||||
{ validator: validatePass, trigger: 'blur' }
|
||||
]
|
||||
}
|
||||
}
|
||||
const app = createApp({
|
||||
data() {
|
||||
return {
|
||||
ContainerCode: '',
|
||||
MaterialCode: '',
|
||||
MaterialName: '',
|
||||
MaterialSpec: '',
|
||||
Qty: null,
|
||||
loading1: false,
|
||||
materialOptions: [],
|
||||
searchTimer: null,
|
||||
bindList: [],
|
||||
editModalVisible: false,
|
||||
editForm: {
|
||||
index: -1,
|
||||
qty: 0
|
||||
},
|
||||
mounted: function () {
|
||||
// 获取所有单据编码
|
||||
$.ajax({
|
||||
type: "post",
|
||||
dataType: "json",
|
||||
data: {},
|
||||
url: "/receipt/ReceiptIn/SelectReceiptCode",
|
||||
success: function (json) {
|
||||
app.options = json.Data;
|
||||
},
|
||||
error: function (json) {
|
||||
alert("加载失败");
|
||||
}
|
||||
});
|
||||
deductModalVisible: false,
|
||||
deductForm: {
|
||||
index: -1,
|
||||
qty: 0,
|
||||
maxQty: 0
|
||||
},
|
||||
methods: {
|
||||
sizeFormatter(row) {
|
||||
return row.size + 'mm';
|
||||
},
|
||||
//绑定单据
|
||||
onSubmit() {
|
||||
var _this = this;
|
||||
|
||||
// 提交已绑定数据
|
||||
$.ajax({
|
||||
type: "post",
|
||||
dataType: "json",
|
||||
data: { data: _this.bindingData },
|
||||
url: "/receipt/ReceiptIn/BindingData",
|
||||
success: function (json) {
|
||||
if (json.Code == 200) {
|
||||
_this.$message({
|
||||
message: '入库成功!',
|
||||
type: 'success'
|
||||
});
|
||||
_this.resetForm('form');
|
||||
}
|
||||
else {
|
||||
_this.$message({
|
||||
message: '入库失败!',
|
||||
type: 'warning'
|
||||
});
|
||||
}
|
||||
},
|
||||
error: function (json) {
|
||||
_this.$message({
|
||||
message: '入库失败!',
|
||||
type: 'error'
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
resetForm(formName) {
|
||||
this.$refs[formName].resetFields();
|
||||
this.form.boxSize = [];
|
||||
this.bindingData = [];
|
||||
},
|
||||
clearReceipt() {
|
||||
this.tableData = [];
|
||||
},
|
||||
// 选择单据后,查询明细
|
||||
changeselect(data) {
|
||||
var _this = this;
|
||||
_this.form.code = data;
|
||||
// 调用后台方法,查询单据明细数据
|
||||
if (data != "") {
|
||||
$.ajax({
|
||||
type: "post",
|
||||
dataType: "json",
|
||||
data: { Code: data },
|
||||
url: "/receipt/ReceiptIn/SelectReceipt",
|
||||
success: function (json) {
|
||||
_this.tableData = json.Data;
|
||||
// 对比待绑定列表,删除在其表内的明细
|
||||
_this.bindingData.forEach(function (item) {
|
||||
_this.tableData.forEach(function (value, index, arr) {
|
||||
if (value.name == item.uniqueCode) {
|
||||
arr.splice(index, 1);
|
||||
}
|
||||
});
|
||||
})
|
||||
},
|
||||
error: function (json) {
|
||||
_this.$message({
|
||||
message: '加载单据明细失败!',
|
||||
type: 'error'
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
// 扫描周转箱
|
||||
scanBox(Box) {
|
||||
var _this = this;
|
||||
_this.form.size = '';
|
||||
_this.form.boxSize = [];
|
||||
|
||||
if (this.form.code == '') {
|
||||
this.$message({
|
||||
message: '请先选择单据!',
|
||||
type: 'warning'
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
type: "post",
|
||||
dataType: "json",
|
||||
data: { boxCode: Box },
|
||||
url: "/receipt/ReceiptIn/ScanBox",
|
||||
success: function (json) {
|
||||
if (json.Code != 200) {
|
||||
_this.$message({
|
||||
message: "扫描失败!" + json.Msg,
|
||||
type: "warning",
|
||||
duration: "10000",
|
||||
});
|
||||
_this.form.boxCode = "";
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
_this.$message({
|
||||
message: "扫描成功!",
|
||||
type: "success",
|
||||
duration: "10000",
|
||||
});
|
||||
_this.$refs.uniqueCode.focus();
|
||||
|
||||
if (Box == "L02") {
|
||||
_this.form.boxSize = [{ label: "24mm", value: "24" }, { label: "16mm", value: "16" }, { label: "10mm", value: "10" }]
|
||||
_this.dataIndex = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16];
|
||||
}
|
||||
else if (Box == "L01") {
|
||||
_this.form.boxSize = [{ label: "8mm", value: "8" }];
|
||||
_this.form.size = _this.form.boxSize[0].value;
|
||||
_this.dataIndex = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20];
|
||||
}
|
||||
else {
|
||||
_this.$message({
|
||||
message: '输入周转箱编码不正确!',
|
||||
type: 'warning'
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
},
|
||||
error: function (json) {
|
||||
_this.$message({
|
||||
message: "扫描失败!",
|
||||
type: "error",
|
||||
duration: "10000",
|
||||
});
|
||||
return;
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
// 重新扫描箱号后,待绑定列表清空
|
||||
_this.bindingData = [];
|
||||
_this.changeselect(_this.value);
|
||||
|
||||
// _this.$refs.uniqueCode.focus();
|
||||
},
|
||||
// 选择尺寸后
|
||||
changeSize() {
|
||||
this.$refs.uniqueCode.focus();
|
||||
},
|
||||
// 扫描唯一码
|
||||
scanUniqueCode(data) {
|
||||
if (this.form.code == '') {
|
||||
this.$message({
|
||||
message: '请先选择单据!',
|
||||
type: 'warning'
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (this.dataIndex.length == 0) {
|
||||
this.$message({
|
||||
message: '该周转箱已放满!',
|
||||
type: 'warning'
|
||||
});
|
||||
this.form.uniqueCode = '';
|
||||
return;
|
||||
}
|
||||
if (this.form.boxCode == '' || this.form.size == '') {
|
||||
this.$message({
|
||||
message: '请先输入周转箱编码并选择料盘尺寸!',
|
||||
type: 'warning'
|
||||
});
|
||||
this.form.uniqueCode = '';
|
||||
return;
|
||||
}
|
||||
var isExit = this.tableData.findIndex(function (value, index, arr) {
|
||||
return value.name == data;
|
||||
})
|
||||
if (isExit == -1) {
|
||||
this.$message({
|
||||
message: '唯一码' + data + '不正确!',
|
||||
type: 'warning'
|
||||
});
|
||||
this.form.uniqueCode = '';
|
||||
return;
|
||||
}
|
||||
// 1.明细减少
|
||||
this.tableData.forEach(function (item, index, arr) {
|
||||
if (item.name == data) {
|
||||
arr.splice(index, 1);
|
||||
}
|
||||
});
|
||||
// 2.已扫描增加
|
||||
this.bindingData.push({
|
||||
receiptCode: this.form.code,
|
||||
boxCode: this.form.boxCode,
|
||||
index: this.dataIndex.shift(),
|
||||
uniqueCode: data,
|
||||
size: this.form.size
|
||||
})
|
||||
this.form.uniqueCode = '';
|
||||
this.$nextTick(() => {
|
||||
this.$refs.tableData.bodyWrapper.scrollTop = this.$refs.tableData.bodyWrapper.scrollHeight
|
||||
})
|
||||
},
|
||||
// 删除已绑定行
|
||||
deleteRow(index, rows) {
|
||||
if (this.form.code == rows[index].receiptCode) {
|
||||
this.tableData.push({ name: rows[index].uniqueCode });
|
||||
}
|
||||
this.dataIndex.unshift(rows[index].index);
|
||||
rows.splice(index, 1);
|
||||
}
|
||||
columns: [
|
||||
{
|
||||
title: 'ID',
|
||||
dataIndex: 'Id',
|
||||
width: 80
|
||||
},
|
||||
{
|
||||
title: '容器编码',
|
||||
dataIndex: 'ContainerCode',
|
||||
},
|
||||
{
|
||||
title: '物料编码',
|
||||
dataIndex: 'MaterialCode',
|
||||
},
|
||||
{
|
||||
title: '物料名称',
|
||||
dataIndex: 'MaterialName',
|
||||
},
|
||||
{
|
||||
title: '物料型号',
|
||||
dataIndex: 'MaterialSpec',
|
||||
},
|
||||
{
|
||||
title: '数量',
|
||||
dataIndex: 'Qty',
|
||||
slotName: 'qty'
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
slotName: 'operations',
|
||||
width: 120
|
||||
}
|
||||
],
|
||||
formData: {
|
||||
containerCode: '',
|
||||
materialCode: '',
|
||||
materialName: '',
|
||||
qty: 1
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
// 页面加载完成后,将焦点设置到容器编码输入框
|
||||
this.$nextTick(() => {
|
||||
this.$refs.containerInput.focus();
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
handleSearch(value) {
|
||||
if (this.searchTimer) {
|
||||
clearTimeout(this.searchTimer);
|
||||
}
|
||||
this.searchTimer = setTimeout(() => {
|
||||
if (value) {
|
||||
this.searchMaterials(value);
|
||||
} else {
|
||||
this.materialOptions = [];
|
||||
}
|
||||
}, 300);
|
||||
},
|
||||
|
||||
searchMaterials(keyword) {
|
||||
var _this = this;
|
||||
axios.get(`/receipt/ReceiptIn/SearchMaterials?keyword=${encodeURIComponent(keyword)}`)
|
||||
.then(function (json) {
|
||||
if (json.data.Code == 200) {
|
||||
_this.materialOptions = json.data.Data.map(item => ({
|
||||
...item,
|
||||
value: item.MaterialCode,
|
||||
label: `${item.MaterialCode} - ${item.MaterialName} - ${item.MaterialSpec}`
|
||||
}));
|
||||
} else {
|
||||
_this.$message.error(json.data.Msg);
|
||||
_this.materialOptions = [];
|
||||
}
|
||||
})
|
||||
.catch(function (error) {
|
||||
_this.$message.error(error);
|
||||
_this.materialOptions = [];
|
||||
});
|
||||
},
|
||||
|
||||
handleSelect(value, option) {
|
||||
const selectedMaterial = this.materialOptions.find(item => item.value === value);
|
||||
if (selectedMaterial) {
|
||||
this.MaterialCode = selectedMaterial.MaterialCode;
|
||||
this.MaterialName = selectedMaterial.MaterialName;
|
||||
this.MaterialSpec = selectedMaterial.MaterialSpec;
|
||||
}
|
||||
},
|
||||
|
||||
handleBind() {
|
||||
if (!this.ContainerCode) {
|
||||
this.$notification.error("请扫描箱号!");
|
||||
return;
|
||||
}
|
||||
if (!this.MaterialCode) {
|
||||
this.$notification.error("请选择物料!");
|
||||
return;
|
||||
}
|
||||
if (!this.Qty || this.Qty <= 0 || !Number.isInteger(this.Qty)) {
|
||||
this.$notification.error("请输入大于0的正整数!");
|
||||
return;
|
||||
}
|
||||
|
||||
// 检查已绑定物料的容器编码
|
||||
if (this.bindList.length > 0) {
|
||||
const firstBind = this.bindList[0];
|
||||
if (firstBind.ContainerCode !== this.ContainerCode) {
|
||||
this.$notification.warning("容器编码已变更,已清空绑定物料");
|
||||
this.bindList = [];
|
||||
}
|
||||
}
|
||||
|
||||
// 添加到绑定列表
|
||||
const bindItem = {
|
||||
ContainerCode: this.ContainerCode,
|
||||
MaterialCode: this.MaterialCode,
|
||||
MaterialName: this.MaterialName,
|
||||
MaterialSpec: this.MaterialSpec,
|
||||
Qty: this.Qty
|
||||
};
|
||||
|
||||
// 调用后端添加库存
|
||||
let postData = new URLSearchParams();
|
||||
postData.append('containerCode', this.ContainerCode);
|
||||
postData.append('materialCode', this.MaterialCode);
|
||||
postData.append('qty', this.Qty);
|
||||
|
||||
axios.post("/receipt/ReceiptIn/AddInventory", postData)
|
||||
.then((json) => {
|
||||
if (json.data.Code == 200) {
|
||||
// 添加ID到绑定项
|
||||
bindItem.Id = json.data.Data.Id;
|
||||
this.bindList.push(bindItem);
|
||||
this.$message.success("物料绑定成功");
|
||||
// 清空表单
|
||||
this.MaterialCode = '';
|
||||
this.MaterialName = '';
|
||||
this.MaterialSpec = '';
|
||||
this.Qty = null;
|
||||
// 验证成功后,将焦点设置到物料编码输入框
|
||||
this.$nextTick(() => {
|
||||
this.$refs.materialInput.focus();
|
||||
});
|
||||
} else {
|
||||
this.$notification.error(json.data.Msg);
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
this.$notification.error("物料绑定失败");
|
||||
});
|
||||
},
|
||||
|
||||
handleClick() {
|
||||
if (!this.ContainerCode) {
|
||||
this.$notification.error('请扫描箱号!');
|
||||
return;
|
||||
}
|
||||
|
||||
this.loading1 = true;
|
||||
let postData = new URLSearchParams();
|
||||
postData.append('containerCode', this.ContainerCode);
|
||||
|
||||
axios.post("/receipt/ReceiptIn/TaskIn", postData)
|
||||
.then((json) => {
|
||||
this.loading1 = false;
|
||||
if (json.data.Code == 200) {
|
||||
this.ContainerCode = '';
|
||||
this.MaterialCode = '';
|
||||
this.MaterialName = '';
|
||||
this.Qty = 1;
|
||||
this.bindList = [];
|
||||
this.$notification.success("入库任务创建成功!");
|
||||
} else {
|
||||
this.$notification.error({
|
||||
content: json.data.Msg,
|
||||
duration: 5000,
|
||||
closable: true
|
||||
});
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
this.loading1 = false;
|
||||
this.$notification.error({
|
||||
content: error,
|
||||
duration: 5000,
|
||||
closable: true
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
validateContainer() {
|
||||
if (!this.ContainerCode) return;
|
||||
|
||||
axios.get(`/receipt/ReceiptIn/ValidateContainer?containerCode=${encodeURIComponent(this.ContainerCode)}`)
|
||||
.then((json) => {
|
||||
if (json.data.Code == 200) {
|
||||
this.$message.success("容器验证成功");
|
||||
// 更新绑定列表
|
||||
this.bindList = json.data.Data;
|
||||
// 验证成功后,将焦点设置到物料编码输入框
|
||||
this.$nextTick(() => {
|
||||
this.$refs.materialInput.focus();
|
||||
});
|
||||
} else {
|
||||
this.$message.error(json.data.Msg || "容器验证失败");
|
||||
this.ContainerCode = '';
|
||||
this.bindList = [];
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
this.$message.error("容器验证失败");
|
||||
this.ContainerCode = '';
|
||||
this.bindList = [];
|
||||
});
|
||||
},
|
||||
|
||||
handleDelete(record) {
|
||||
const index = this.bindList.findIndex(item => item.Id === record.Id);
|
||||
|
||||
if (index > -1) {
|
||||
// 调用后端删除库存
|
||||
let postData = new URLSearchParams();
|
||||
postData.append('id', record.Id);
|
||||
|
||||
axios.post("/receipt/ReceiptIn/DeleteInventory", postData)
|
||||
.then((json) => {
|
||||
if (json.data.Code == 200) {
|
||||
this.bindList.splice(index, 1);
|
||||
this.$message.success("删除成功");
|
||||
} else {
|
||||
this.$message.error(json.data.Msg);
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
this.$message.error("删除失败");
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
handleEdit(record) {
|
||||
this.editForm.index = this.bindList.findIndex(item => item.Id === record.Id);
|
||||
this.editForm.qty = Math.floor(record.Qty);
|
||||
this.editModalVisible = true;
|
||||
},
|
||||
|
||||
handleEditConfirm() {
|
||||
if (this.editForm.index > -1) {
|
||||
if (!this.editForm.qty || this.editForm.qty <= 0 || !Number.isInteger(this.editForm.qty)) {
|
||||
this.$notification.error("请输入大于0的正整数!");
|
||||
return;
|
||||
}
|
||||
|
||||
const record = this.bindList[this.editForm.index];
|
||||
|
||||
// 调用后端更新库存
|
||||
let postData = new URLSearchParams();
|
||||
postData.append('id', record.Id);
|
||||
postData.append('qty', this.editForm.qty);
|
||||
|
||||
axios.post("/receipt/ReceiptIn/UpdateInventory", postData)
|
||||
.then((json) => {
|
||||
if (json.data.Code == 200) {
|
||||
this.bindList[this.editForm.index].Qty = this.editForm.qty;
|
||||
this.$notification.success("修改成功");
|
||||
this.editModalVisible = false;
|
||||
} else {
|
||||
this.$notification.error(json.data.Msg);
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
this.$notification.error("修改失败");
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
handleEditCancel() {
|
||||
this.editModalVisible = false;
|
||||
this.editForm.index = -1;
|
||||
this.editForm.qty = 1;
|
||||
},
|
||||
|
||||
handleDeduct(record) {
|
||||
this.deductForm.index = this.bindList.findIndex(item => item.Id === record.Id);
|
||||
this.deductForm.qty = null;
|
||||
this.deductForm.maxQty = Math.floor(record.Qty);
|
||||
this.deductModalVisible = true;
|
||||
},
|
||||
|
||||
handleDeductConfirm() {
|
||||
if (this.deductForm.index > -1) {
|
||||
const record = this.bindList[this.deductForm.index];
|
||||
|
||||
if (!this.deductForm.qty) {
|
||||
this.$notification.error("请输入扣除数量");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Number.isInteger(this.deductForm.qty) || this.deductForm.qty <= 0) {
|
||||
this.$notification.error("请输入大于0的正整数!");
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.deductForm.qty > record.Qty) {
|
||||
this.$notification.error("扣除数量不能大于当前数量");
|
||||
return;
|
||||
}
|
||||
|
||||
const newQty = record.Qty - this.deductForm.qty;
|
||||
|
||||
if (newQty == 0) {
|
||||
// 如果扣除后数量等于0,直接删除
|
||||
this.handleDelete(record);
|
||||
} else {
|
||||
// 调用后端更新库存
|
||||
let postData = new URLSearchParams();
|
||||
postData.append('id', record.Id);
|
||||
postData.append('qty', newQty);
|
||||
|
||||
axios.post("/receipt/ReceiptIn/UpdateInventory", postData)
|
||||
.then((json) => {
|
||||
if (json.data.Code == 200) {
|
||||
this.bindList[this.deductForm.index].Qty = newQty;
|
||||
this.$notification.success("扣除成功");
|
||||
this.deductModalVisible = false;
|
||||
} else {
|
||||
this.$notification.error(json.data.Msg);
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
this.$notification.error("扣除失败");
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
handleDeductCancel() {
|
||||
this.deductModalVisible = false;
|
||||
this.deductForm.index = -1;
|
||||
this.deductForm.qty = 1;
|
||||
this.deductForm.maxQty = 0;
|
||||
}
|
||||
}
|
||||
});
|
||||
app.use(ArcoVue)
|
||||
.use(ArcoVueIcon)
|
||||
.mount('#receiptin');
|
||||
</script>
|
||||
@@ -1,3 +1,6 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using HHWMS.Web.Models;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using WalkingTec.Mvvm.Core;
|
||||
using WalkingTec.Mvvm.Mvc;
|
||||
@@ -24,4 +27,116 @@ public class ShipOutController : BaseController
|
||||
}
|
||||
#endregion
|
||||
|
||||
[HttpPost]
|
||||
public IActionResult CallBox()
|
||||
{
|
||||
// 查找库位状态为空容器的库位
|
||||
var location = _unitWork.FindSingle<Location>(x => x.Status == LocationStatus.空容器);
|
||||
if (location != null)
|
||||
{
|
||||
location.Status = LocationStatus.任务锁;
|
||||
location.UpdateTime = DateTime.Now;
|
||||
location.UpdateBy = Wtm.LoginUserInfo?.ITCode ?? "WMS";
|
||||
_unitWork.Update(location);
|
||||
|
||||
// 查找container,并更新状态
|
||||
var container = _unitWork.FindSingle<Container>(x => x.Code == location.ContainerCode);
|
||||
container.IsLock = ContainerLockEnum.任务锁;
|
||||
container.UpdateTime = DateTime.Now;
|
||||
container.UpdateBy = Wtm.LoginUserInfo?.ITCode ?? "WMS";
|
||||
_unitWork.Update(container);
|
||||
|
||||
//创建出库任务
|
||||
var task = new TaskHeader
|
||||
{
|
||||
ZoneCode = ZoneCodeEnum.立库,
|
||||
TaskNo = _unitWork.GetSerialNumber("Out"),
|
||||
TaskType = TaskTypeEnum.立库出库,
|
||||
ContainerCode = location.ContainerCode,
|
||||
FromLocation = location.Code,
|
||||
ToLocation = "",
|
||||
Station = "1",
|
||||
Status = TaskStatusEnum.待下发,
|
||||
CreateBy = Wtm.LoginUserInfo?.ITCode??"WMS",
|
||||
CreateTime = DateTime.Now
|
||||
};
|
||||
_unitWork.Add(task);
|
||||
|
||||
// 下发任务到wcs
|
||||
var postData = new
|
||||
{
|
||||
TaskNo = task.TaskNo,
|
||||
PalletNo = task.ContainerCode,
|
||||
FromLocation = task.FromLocation,
|
||||
ToLocation = task.ToLocation
|
||||
};
|
||||
try
|
||||
{
|
||||
var res = Wtm.CallAPI<ApiJsonResult<dynamic>>("WCS", "TaskAssign", HttpMethodEnum.POST, postData)
|
||||
.Result.Data;
|
||||
if (res.Success)
|
||||
{
|
||||
task.Status = TaskStatusEnum.已下发;
|
||||
}
|
||||
else
|
||||
{
|
||||
task.ErrorMsg = res.Msg;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
task.ErrorMsg = ex.Message;
|
||||
}
|
||||
|
||||
task.UpdateTime = DateTime.Now;
|
||||
task.UpdateBy = "WMS";
|
||||
_unitWork.Update(task);
|
||||
|
||||
|
||||
return JsonMore(null);
|
||||
}
|
||||
else
|
||||
{
|
||||
return JsonMore(null, 500, "库内无可用空容器!");
|
||||
}
|
||||
}
|
||||
|
||||
public IActionResult AgvTask(string type)
|
||||
{
|
||||
try
|
||||
{
|
||||
var ids = Wtm.ConfigInfo.AppSettings.ToList();
|
||||
var task_id = type switch
|
||||
{
|
||||
"In" => ids.FirstOrDefault(x => x.Key == "In").Value,
|
||||
"Out" => ids.FirstOrDefault(x => x.Key == "Out").Value,
|
||||
"Charge" => ids.FirstOrDefault(x => x.Key == "Charge").Value,
|
||||
"OutIn" => ids.FirstOrDefault(x => x.Key == "OutIn").Value,
|
||||
_ => throw new Exception("参数错误!")
|
||||
};
|
||||
|
||||
var res = Wtm.CallAPI<agvResult>("ACS", "task_mould_do", HttpMethodEnum.POST, new
|
||||
{
|
||||
task_id = task_id
|
||||
});
|
||||
if (res.Result.Data.ack != 0)
|
||||
{
|
||||
return JsonMore(null, 500, res.Result.Data.msg);
|
||||
}
|
||||
|
||||
return JsonMore(null);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return JsonMore(null, 500, ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
public class agvResult
|
||||
{
|
||||
public int ack { get; set; }
|
||||
public string msg { get; set; }
|
||||
public dynamic data { get; set; }
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,299 +1,101 @@
|
||||
<el-row id="outapp">
|
||||
<el-card class="box-card" :span="16">
|
||||
<el-form ref="form" :model="form" label-width="100px">
|
||||
<el-row>
|
||||
<el-col :span="4">
|
||||
<el-form-item label="类型" prop="type">
|
||||
<el-select v-model="form.type"
|
||||
placeholder="请选择类型"
|
||||
style="width: 100%"
|
||||
@@change="select"
|
||||
>
|
||||
<el-option v-for="item in taskType"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="16">
|
||||
<el-input v-model="form.code"
|
||||
placeholder="请扫描"
|
||||
@@change="scanCode">
|
||||
</el-input>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row v-show="showTable">
|
||||
<el-divider></el-divider>
|
||||
<el-table :data="invTable" height="200" stripe border @@row-click="selectdata"
|
||||
style="width: 100%">
|
||||
<el-table-column label="唯一码" width="220" align="center" prop="UniqueCode"></el-table-column>
|
||||
<el-table-column label="编码" align="center" prop="MaterialCode"></el-table-column>
|
||||
<el-table-column label="规格型号" align="center" prop="MaterialSpec"></el-table-column>
|
||||
<el-table-column label="批次" align="center" prop="Batch"></el-table-column>
|
||||
<el-table-column label="数量" align="center" prop="Qty"></el-table-column>
|
||||
</el-table>
|
||||
</el-row>
|
||||
<el-divider></el-divider>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="24">
|
||||
<el-form-item label="唯一码" prop="uniqueCode">
|
||||
<el-input v-model="form.uniqueCode" ref="uniqueCode" readonly></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="物料码" prop="materialCode">
|
||||
<el-input v-model="form.materialCode" readonly></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="规格型号" prop="materialSpec">
|
||||
<el-input v-model="form.materialSpec" readonly></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="批次" prop="batch">
|
||||
<el-input v-model="form.batch" readonly></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="数量" prop="qty">
|
||||
<el-input v-model.number="form.qty" ref="qty" ></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<div id="shipout">
|
||||
<a-space direction="vertical" fill :size="large">
|
||||
@* <a-input :style="{width:'320px'}" placeholder="扫描箱号" v-model="ContainerCode" allow-clear/> *@
|
||||
<a-button @@click="handleClick"
|
||||
:loading="loading1"
|
||||
type="primary"
|
||||
size="large">
|
||||
呼叫出库
|
||||
</a-button>
|
||||
|
||||
<el-form-item style="float:right">
|
||||
<el-button type="primary" @@click="onSubmit">拣货</el-button>
|
||||
<el-button v-show="showBack" type="success" @@click="back">回库</el-button>
|
||||
</el-form-item>
|
||||
</el-row>
|
||||
</el-form>
|
||||
</el-card>
|
||||
</el-row>
|
||||
<a-divider />
|
||||
<a-space>
|
||||
<template #split>
|
||||
<a-divider direction="vertical" />
|
||||
</template>
|
||||
<a-button @@click='handleAGVTask("OutIn")'
|
||||
:loading="loading2"
|
||||
type="primary"
|
||||
status="warning"
|
||||
size="large">
|
||||
入库
|
||||
</a-button>
|
||||
|
||||
<a-button @@click='handleAGVTask("Charge")'
|
||||
:loading="loading2"
|
||||
type="primary"
|
||||
status="success"
|
||||
size="large">
|
||||
充电任务
|
||||
</a-button>
|
||||
|
||||
@* <a-button @@click='handleAGVTask("Out")' *@
|
||||
@* :loading="loading2" *@
|
||||
@* type="outline" *@
|
||||
@* size="large"> *@
|
||||
@* 到出库点 *@
|
||||
@* </a-button> *@
|
||||
</a-space>
|
||||
</a-space>
|
||||
</div>
|
||||
<script>
|
||||
var app = new Vue({
|
||||
el: "#outapp",
|
||||
data() {
|
||||
return {
|
||||
form: {
|
||||
type:"",
|
||||
code: "",
|
||||
uniqueCode: "",
|
||||
materialCode: "",
|
||||
materialSpec: "",
|
||||
batch: "",
|
||||
qty: ""
|
||||
},
|
||||
type: "",
|
||||
taskType: [
|
||||
{ label: "散料站台", value: "slbox" },
|
||||
{ label: "料塔周转箱", value: "lt" },
|
||||
{ label: "唯一码", value: "uniqueCode" },
|
||||
],
|
||||
invTable:[],
|
||||
showTable: false,
|
||||
showBack: false
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
// 选中行
|
||||
selectdata(data) {
|
||||
this.form.uniqueCode = data.UniqueCode;
|
||||
this.form.materialCode = data.MaterialCode;
|
||||
this.form.materialSpec = data.MaterialSpec;
|
||||
this.form.batch = data.Batch;
|
||||
this.form.qty = data.Qty;
|
||||
},
|
||||
select(data) {
|
||||
this.form.code = "";
|
||||
this.form.type = data;
|
||||
this.invTable = [];
|
||||
if (this.invTable.length == 0
|
||||
&& this.form.type == "slbox"
|
||||
&& this.form.code.startsWith("C")) {
|
||||
this.showBack = true;
|
||||
}
|
||||
},
|
||||
// 扫描料塔站台号
|
||||
scanCode(data) {
|
||||
var _this = this;
|
||||
if (_this.form.type == "") {
|
||||
_this.$message({
|
||||
message: "请先选择操作类型!",
|
||||
type: "warning",
|
||||
duration: "10000",
|
||||
});
|
||||
_this.form.code = "";
|
||||
return;
|
||||
}
|
||||
let url = "";
|
||||
if (_this.form.type == "uniqueCode") {
|
||||
url = "/shipment/ShipOut/ScanUniqueCode"
|
||||
}
|
||||
else{
|
||||
url = "/shipment/ShipOut/ScanBox"
|
||||
}
|
||||
$.ajax({
|
||||
type: "post",
|
||||
dataType: "json",
|
||||
data: { code: _this.form.code, type: _this.form.type },
|
||||
url: url,
|
||||
success: function (json) {
|
||||
if (json.Code != 200) {
|
||||
_this.$message({
|
||||
message: "扫描失败!" + json.Msg,
|
||||
type: "warning",
|
||||
duration: "10000",
|
||||
});
|
||||
_this.form.code = "";
|
||||
} else {
|
||||
if (_this.form.type == "uniqueCode") {
|
||||
_this.form.uniqueCode = json.Data.UniqueCode;
|
||||
_this.form.materialCode = json.Data.MaterialCode;
|
||||
_this.form.materialSpec = json.Data.MaterialSpec;
|
||||
_this.form.batch = json.Data.Batch;
|
||||
_this.form.qty = json.Data.Qty;
|
||||
} else {
|
||||
_this.showTable = true;
|
||||
_this.invTable = json.Data;
|
||||
if (_this.invTable.length == 0
|
||||
&& _this.form.type == "slbox"
|
||||
&& _this.form.code.startsWith("C")) {
|
||||
_this.showBack = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
error: function (json) {
|
||||
_this.$message({
|
||||
message: "扫描失败!",
|
||||
type: "error",
|
||||
duration: "10000",
|
||||
});
|
||||
},
|
||||
});
|
||||
},
|
||||
// 拣货
|
||||
onSubmit() {
|
||||
var _this = this;
|
||||
if (_this.form.uniqueCode == "") {
|
||||
_this.$message({
|
||||
message: "未选择出库明细!",
|
||||
type: "warning",
|
||||
duration: "10000",
|
||||
});
|
||||
return;
|
||||
}
|
||||
// 提交已绑定数据
|
||||
$.ajax({
|
||||
type: "post",
|
||||
dataType: "json",
|
||||
data: { uniqueCode: _this.form.uniqueCode, qty: _this.form.qty, station: _this.form.code },
|
||||
url: "/shipment/ShipOut/Pick",
|
||||
success: function (json) {
|
||||
if (json.Code == 200) {
|
||||
_this.$message({
|
||||
message: "拣货成功!",
|
||||
});
|
||||
// 删除invTable 对应的 uniqueCode行
|
||||
_this.invTable.forEach(function (value, index, arr) {
|
||||
if (value.UniqueCode == _this.form.uniqueCode) {
|
||||
arr.splice(index, 1);
|
||||
}
|
||||
});
|
||||
if (_this.invTable.length == 0
|
||||
&& _this.form.type == "slbox"
|
||||
&& _this.form.code.startsWith("C")) {
|
||||
_this.showBack = true;
|
||||
}
|
||||
if (_this.form.code == "uniqueCode") {
|
||||
_this.form.code = "";
|
||||
}
|
||||
// 清空下面表单 不清空code
|
||||
_this.form.uniqueCode = "";
|
||||
_this.form.materialCode = "";
|
||||
_this.form.materialSpec = "";
|
||||
_this.form.batch = "";
|
||||
_this.form.qty = "";
|
||||
// _this.$refs['form'].resetFields();
|
||||
} else {
|
||||
_this.$message({
|
||||
message: "提交失败!"+json.Msg,
|
||||
type: "warning",
|
||||
duration: "10000",
|
||||
});
|
||||
}
|
||||
},
|
||||
error: function (json) {
|
||||
_this.$message({
|
||||
message: "提交失败!",
|
||||
type: "error",
|
||||
duration: "10000",
|
||||
});
|
||||
},
|
||||
});
|
||||
},
|
||||
// 回库
|
||||
back() {
|
||||
var _this = this;
|
||||
// 创建回库任务
|
||||
if (_this.form.code == "") {
|
||||
_this.$message({
|
||||
message: "箱号为空,不能创建回库任务!",
|
||||
type: "error",
|
||||
duration: "1000",
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (_this.invTable.length > 0) {
|
||||
_this.$message({
|
||||
message: "存在未拣货库存,不能创建回库任务!",
|
||||
type: "error",
|
||||
duration: "1000",
|
||||
});
|
||||
return;
|
||||
}
|
||||
this.$confirm('确定执行回库动作?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
$.ajax({
|
||||
type: "post",
|
||||
dataType: "json",
|
||||
data: { boxCode: _this.form.code, isFull: _this.form.isFull },
|
||||
url: "/shipment/ShipOut/BoxBack",
|
||||
success: function (json) {
|
||||
if (json.Code != 200) {
|
||||
_this.$message({
|
||||
message: "回库任务创建失败!" + json.Msg,
|
||||
type: "warning",
|
||||
duration: "10000",
|
||||
});
|
||||
} else {
|
||||
_this.$message({
|
||||
message: "回库任务创建成功!"
|
||||
});
|
||||
_this.resetForm('form');
|
||||
}
|
||||
},
|
||||
error: function (json) {
|
||||
_this.$message({
|
||||
message: "回库任务创建失败!",
|
||||
type: "error",
|
||||
duration: "10000",
|
||||
});
|
||||
},
|
||||
});
|
||||
}).catch(() => {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: '已取消'
|
||||
});
|
||||
});
|
||||
const { createApp, reactive, ref } = Vue
|
||||
|
||||
const app = createApp({
|
||||
data() {
|
||||
return {
|
||||
ContainerCode: '',
|
||||
loading1:false,
|
||||
loading2:false,
|
||||
data: reactive([])
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleClick() {
|
||||
var _this = this;
|
||||
|
||||
_this.loading1 = !_this.loading1
|
||||
|
||||
axios.post("/shipment/Shipout/CallBox", {})
|
||||
.then(function (json) {
|
||||
_this.loading1 = !_this.loading1;
|
||||
if (json.data.Code == 200){
|
||||
_this.$message.success("呼叫料盒任务创建成功!");
|
||||
}
|
||||
},
|
||||
});
|
||||
else{
|
||||
_this.$message.error(json.data.Msg);
|
||||
}
|
||||
})
|
||||
.catch(function (error) {
|
||||
_this.$message.error(error);
|
||||
});
|
||||
},
|
||||
handleAGVTask(val) {
|
||||
var _this = this;
|
||||
|
||||
_this.loading2 = !_this.loading2
|
||||
|
||||
let postData = new URLSearchParams();
|
||||
postData.append('type', val);
|
||||
|
||||
axios.post("/shipment/Shipout/AgvTask", postData)
|
||||
.then(function (json) {
|
||||
_this.loading2 = !_this.loading2;
|
||||
if (json.data.Code == 200){
|
||||
_this.$message.success("任务创建成功!");
|
||||
}
|
||||
else{
|
||||
_this.$message.error(json.data.Msg);
|
||||
}
|
||||
})
|
||||
.catch(function (error) {
|
||||
_this.$message.error(error);
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
app.use(ArcoVue)
|
||||
.use(ArcoVueIcon)
|
||||
.mount('#shipout');
|
||||
|
||||
</script>
|
||||
@@ -144,7 +144,7 @@ namespace HHWMS.Web.Controllers
|
||||
}
|
||||
else
|
||||
{
|
||||
return FFResult().CloseDialog().RefreshGridRow(vm.Entity.ID);
|
||||
return FFResult().CloseDialog().RefreshGrid(index:1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -172,7 +172,7 @@ namespace HHWMS.Web.Controllers
|
||||
}
|
||||
else
|
||||
{
|
||||
return FFResult().CloseDialog().RefreshGrid();
|
||||
return FFResult().CloseDialog().RefreshGrid(index:1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using HHWMS.Web.Models;
|
||||
using Quartz;
|
||||
using WalkingTec.Mvvm.Core;
|
||||
using WalkingTec.Mvvm.Core.Support.Quartz;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using HHWMS.Web.Services;
|
||||
using System.Linq;
|
||||
|
||||
namespace HHWMS.Web
|
||||
{
|
||||
//[QuartzRepeat(5,5, true, -1)]
|
||||
[PersistJobDataAfterExecution]
|
||||
[DisallowConcurrentExecution]
|
||||
public class MqttMessageJob : WtmJob
|
||||
{
|
||||
public override async Task Execute(IJobExecutionContext context)
|
||||
{
|
||||
try
|
||||
{
|
||||
var _unitwork = new UnitWork(Wtm);
|
||||
var _channel = Wtm.ServiceProvider.GetRequiredService<MqttMessageChannel>();
|
||||
|
||||
Wtm.DoLog("执行MQTT消息消费", ActionLogTypesEnum.Job, "MqttMessageJob");
|
||||
|
||||
// Drain the channel and process messages
|
||||
while (_channel.Reader.TryRead(out var message))
|
||||
{
|
||||
try
|
||||
{
|
||||
message.IsProcessed = true;
|
||||
message.ProcessTime = DateTime.Now;
|
||||
message.ProcessResult = "Success";
|
||||
|
||||
_unitwork.Add(message);
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
message.IsProcessed = true;
|
||||
message.ProcessTime = DateTime.Now;
|
||||
message.ProcessResult = $"Error: {ex.Message}";
|
||||
_unitwork.Add(message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
await _unitwork.SaveChangesAsync();
|
||||
|
||||
#region 更新时间
|
||||
var job = _unitwork.FindSingle<SysJob>(x =>
|
||||
x.JobName == context.JobDetail.Key.Name
|
||||
);
|
||||
if (job != null)
|
||||
{
|
||||
job.LastFireTime = TimeZoneInfo.ConvertTimeFromUtc(
|
||||
context.FireTimeUtc.DateTime,
|
||||
TimeZoneInfo.Local
|
||||
);
|
||||
if (context.NextFireTimeUtc != null)
|
||||
{
|
||||
job.NextFireTime = TimeZoneInfo.ConvertTimeFromUtc(
|
||||
context.NextFireTimeUtc.Value.DateTime,
|
||||
TimeZoneInfo.Local
|
||||
);
|
||||
}
|
||||
_unitwork.Update<SysJob>(job);
|
||||
await _unitwork.SaveChangesAsync();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
Wtm.DoLog("处理MQTT消息异常", ActionLogTypesEnum.Job, "MqttMessageJob", request:"error", result:ex.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using HHWMS.Web.Models;
|
||||
using Quartz;
|
||||
using WalkingTec.Mvvm.Core;
|
||||
using WalkingTec.Mvvm.Core.Support.Quartz;
|
||||
|
||||
namespace HHWMS.Web
|
||||
{
|
||||
//[QuartzRepeat(10,10, true, 30)]
|
||||
[PersistJobDataAfterExecution]
|
||||
[DisallowConcurrentExecution]
|
||||
public class SendWcsJob : WtmJob
|
||||
{
|
||||
public override Task Execute(IJobExecutionContext context)
|
||||
{
|
||||
try
|
||||
{
|
||||
var _unitWork = new UnitWork(Wtm);
|
||||
var task = _unitWork.FindSingle<TaskHeader>(x => x.Status == TaskStatusEnum.待下发);
|
||||
if (task != null)
|
||||
{
|
||||
// 下发任务到wcs
|
||||
var postData = new
|
||||
{
|
||||
TaskNo = task.TaskNo,
|
||||
PalletNo = task.ContainerCode,
|
||||
FromLocation = task.FromLocation,
|
||||
ToLocation = task.ToLocation
|
||||
};
|
||||
var res1 = Wtm.CallAPI<ApiJsonResult<dynamic>>("WCS", "TaskAssign", HttpMethodEnum.POST, postData);
|
||||
var res = res1.Result.Data;
|
||||
if (res.Success)
|
||||
{
|
||||
task.Status = TaskStatusEnum.已下发;
|
||||
}
|
||||
else
|
||||
{
|
||||
task.ErrorMsg = res.Msg;
|
||||
}
|
||||
task.UpdateTime = DateTime.Now;
|
||||
task.UpdateBy = "WMS";
|
||||
_unitWork.Update(task);
|
||||
}
|
||||
|
||||
Wtm.DoLog("下发WCS任务", ActionLogTypesEnum.Job, "SendWcsJob");
|
||||
|
||||
#region 更新时间
|
||||
var job = _unitWork.FindSingle<SysJob>(x =>
|
||||
x.JobName == context.JobDetail.Key.Name
|
||||
);
|
||||
if (job != null)
|
||||
{
|
||||
job.LastFireTime = TimeZoneInfo.ConvertTimeFromUtc(
|
||||
context.FireTimeUtc.DateTime,
|
||||
TimeZoneInfo.Local
|
||||
);
|
||||
// 只执行一次 没有下次执行时间
|
||||
if (context.NextFireTimeUtc != null)
|
||||
{
|
||||
job.NextFireTime = TimeZoneInfo.ConvertTimeFromUtc(
|
||||
context.NextFireTimeUtc.Value.DateTime,
|
||||
TimeZoneInfo.Local
|
||||
);
|
||||
}
|
||||
_unitWork.Update<SysJob>(job);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
catch(Exception ex) {
|
||||
Wtm.DoLog("下发WCS任务", ActionLogTypesEnum.Job, "SendWcsJob", request:"error", result:ex.Message);
|
||||
}
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -57,15 +57,15 @@ namespace HHWMS.Web
|
||||
{
|
||||
string rv = UIService.MakeScriptButton(ButtonTypesEnum.Link,a.TaskNo,$"details('{a.ID}')");
|
||||
return rv;
|
||||
}).SetWidth(220),
|
||||
}).SetWidth(180),
|
||||
this.MakeGridHeader(x => x.TaskType,150),
|
||||
this.MakeGridHeader(x => x.ContainerCode, 150),
|
||||
this.MakeGridHeader(x => x.FromLocation,150),
|
||||
this.MakeGridHeader(x => x.ToLocation, 150),
|
||||
this.MakeGridHeader(x => x.Station,150),
|
||||
this.MakeGridHeader(x => x.ContainerCode, 150),
|
||||
this.MakeGridHeader(x => x.Status, 150),
|
||||
this.MakeGridHeader(x => x.Station,150).SetHide(),
|
||||
this.MakeGridHeader(x => x.RoadWay, 150).SetHide(),
|
||||
this.MakeGridHeader(x => x.Priority, 150).SetHide(),
|
||||
this.MakeGridHeader(x => x.Status, 150),
|
||||
this.MakeGridHeader(x => x.CreateTime, 150).SetHide(),
|
||||
this.MakeGridHeader(x => x.ErrorMsg, 150).SetHide(),
|
||||
this.MakeGridHeaderAction(width: 200)
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
</wt:row>
|
||||
</wt:searchpanel>
|
||||
<wt:grid vm="@Model" id="TaskHeader" url="/taskManage/TaskHeader/Search" limit="7" />
|
||||
<wt:grid vm="@Model.TaskDetails" id="TaskDetail" url="/taskManage/TaskDetail/Search2" height="400" />
|
||||
@* <wt:grid vm="@Model.TaskDetails" id="TaskDetail" url="/taskManage/TaskDetail/Search2" height="400" /> *@
|
||||
|
||||
<script>
|
||||
var headerId = 0;
|
||||
|
||||
@@ -54,6 +54,8 @@ namespace HHWMS.Web
|
||||
public DbSet<ReportDesign> ReportDesigns { get; set; }
|
||||
public DbSet<Material> Materials { get; set; }
|
||||
public DbSet<PrintConfig> PrintConfigs { get; set; }
|
||||
public DbSet<MqttSubscription> MqttSubscriptions { get; set; }
|
||||
public DbSet<MqttMessageRecord> MqttMessageRecords { get; set; }
|
||||
public override async Task<bool> DataInit(object allModules, bool IsSpa)
|
||||
{
|
||||
var state = await base.DataInit(allModules, IsSpa);
|
||||
@@ -138,7 +140,7 @@ namespace HHWMS.Web
|
||||
{
|
||||
public DataContext CreateDbContext(string[] args)
|
||||
{
|
||||
return new DataContext("Server=(localdb)\\mssqllocaldb;Database=HHWMS;Trusted_Connection=True;MultipleActiveResultSets=true", DBTypeEnum.SqlServer);
|
||||
return new DataContext("Server=127.0.0.1;Port=3306;Database=wms3;Uid=root;Password=abc123*;Character Set=utf8mb4;", DBTypeEnum.MySql);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -17,13 +17,9 @@
|
||||
<Import Project="..\common.props" />
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Remove="Migrations\**" />
|
||||
<Compile Remove="wwwroot\hiprint\vue-plugin-hiprint\**" />
|
||||
<Content Remove="Migrations\**" />
|
||||
<Content Remove="wwwroot\hiprint\vue-plugin-hiprint\**" />
|
||||
<EmbeddedResource Remove="Migrations\**" />
|
||||
<EmbeddedResource Remove="wwwroot\hiprint\vue-plugin-hiprint\**" />
|
||||
<None Remove="Migrations\**" />
|
||||
<None Remove="wwwroot\hiprint\vue-plugin-hiprint\**" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -63,6 +59,7 @@
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="MQTTnet.Extensions.ManagedClient" Version="4.3.7.1207" />
|
||||
<PackageReference Include="SoapCore" Version="1.1.0.38" />
|
||||
<PackageReference Include="SqlSugarCore" Version="5.1.4.143" />
|
||||
<PackageReference Include="System.Reactive.Linq" Version="6.0.0" />
|
||||
|
||||
@@ -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; }
|
||||
|
||||
@@ -29,13 +29,13 @@ namespace HHWMS.Web.Models
|
||||
/// 入库任务
|
||||
/// </summary>
|
||||
[Display(Name = "TaskType.In")]
|
||||
盘料盒入库 = 1,
|
||||
立库入库 = 1,
|
||||
|
||||
/// <summary>
|
||||
/// 出库任务
|
||||
/// </summary>
|
||||
[Display(Name = "TaskType.Out")]
|
||||
盘料盒出库 = 2,
|
||||
立库出库 = 2,
|
||||
|
||||
/// <summary>
|
||||
/// 盘料入库
|
||||
@@ -104,16 +104,10 @@ namespace HHWMS.Web.Models
|
||||
/// <summary>
|
||||
/// 容器类型
|
||||
/// </summary>
|
||||
public enum ContainerTypeEnum : int
|
||||
public static class ContainerTypeEnum
|
||||
{
|
||||
//// 11:23格料盒; 12:13格料盒; 13:16格料盒; 14:19格料盒
|
||||
格料盒23 = 11,
|
||||
|
||||
格料盒13 = 12,
|
||||
|
||||
格料盒16 = 13,
|
||||
|
||||
格料盒19 = 14,
|
||||
public const string 料箱 = "B";
|
||||
public const string 托盘 = "P";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -258,7 +252,7 @@ namespace HHWMS.Web.Models
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// 交易类型
|
||||
/// 库存任务状态
|
||||
/// </summary>
|
||||
public static class InventoryTaskStatus
|
||||
{
|
||||
@@ -280,55 +274,25 @@ namespace HHWMS.Web.Models
|
||||
public static class ZoneCodeEnum
|
||||
{
|
||||
/// <summary>
|
||||
/// 盘料库 = "L";
|
||||
/// 立库 = "L";
|
||||
/// </summary>
|
||||
public const string 盘料库 = "L";
|
||||
|
||||
/// <summary>
|
||||
/// 散料库 = "C";
|
||||
/// </summary>
|
||||
public const string 散料库 = "C";
|
||||
|
||||
/// <summary>
|
||||
/// 货架库 = "P";
|
||||
/// </summary>
|
||||
public const string 货架库 = "P";
|
||||
public const string 立库 = "L";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 区域
|
||||
/// 类型
|
||||
/// </summary>
|
||||
public static class LocationTypeEnum
|
||||
{
|
||||
/// <summary>
|
||||
/// 盘料库位 = "L";
|
||||
/// 周转箱库位 = "B";
|
||||
/// </summary>
|
||||
public const string 盘料库位 = "L";
|
||||
public const string 周转箱库位 = "B";
|
||||
|
||||
/// <summary>
|
||||
/// 料塔 = "T";
|
||||
/// 托盘库位 = "P";
|
||||
/// </summary>
|
||||
public const string 料塔 = "T";
|
||||
|
||||
/// <summary>
|
||||
/// 机械臂工位 = "G2";
|
||||
/// </summary>
|
||||
public const string 机械臂工位 = "G2";
|
||||
|
||||
/// <summary>
|
||||
/// 堆垛机工位 = "G1";
|
||||
/// </summary>
|
||||
public const string 堆垛机工位 = "G1";
|
||||
|
||||
/// <summary>
|
||||
/// 散料库 = "C";
|
||||
/// </summary>
|
||||
public const string 散料库位 = "C";
|
||||
|
||||
/// <summary>
|
||||
/// 散料库站台 = "C1";
|
||||
/// </summary>
|
||||
public const string 散料库站台 = "C1";
|
||||
public const string 托盘库位 = "P";
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using WalkingTec.Mvvm.Core;
|
||||
|
||||
namespace HHWMS.Web.Models
|
||||
{
|
||||
[Table("MqttMessageRecord")]
|
||||
public class MqttMessageRecord : BasePoco
|
||||
{
|
||||
[Key]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public new int ID { get; set; }
|
||||
|
||||
[Display(Name = "Mqtt.Topic", Description = "主题")]
|
||||
[StringLength(200, ErrorMessage = "Validate.{0}stringmax{1}")]
|
||||
public string Topic { get; set; }
|
||||
|
||||
[Display(Name = "Mqtt.Payload", Description = "消息内容")]
|
||||
public string Payload { get; set; }
|
||||
|
||||
[Display(Name = "Mqtt.ReceiveTime", Description = "接收时间")]
|
||||
public DateTime ReceiveTime { get; set; }
|
||||
|
||||
[Display(Name = "Mqtt.IsProcessed", Description = "是否已处理")]
|
||||
public bool IsProcessed { get; set; }
|
||||
|
||||
[Display(Name = "Mqtt.ProcessTime", Description = "处理时间")]
|
||||
public DateTime? ProcessTime { get; set; }
|
||||
|
||||
[Display(Name = "Mqtt.ProcessResult", Description = "处理结果")]
|
||||
public string ProcessResult { get; set; }
|
||||
|
||||
[Display(Name = "Mqtt.ParsedData", Description = "解析后数据")]
|
||||
public string ParsedData { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using WalkingTec.Mvvm.Core;
|
||||
|
||||
namespace HHWMS.Web.Models
|
||||
{
|
||||
[Table("MqttSubscription")]
|
||||
public class MqttSubscription : BasePoco
|
||||
{
|
||||
[Key]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public new int ID { get; set; }
|
||||
|
||||
[Display(Name = "Mqtt.Topic", Description = "订阅主题")]
|
||||
[StringLength(200, ErrorMessage = "Validate.{0}stringmax{1}")]
|
||||
[Required(ErrorMessage = "Validate.{0}required")]
|
||||
public string Topic { get; set; }
|
||||
|
||||
[Display(Name = "Mqtt.Qos", Description = "服务质量(0,1,2)")]
|
||||
public int Qos { get; set; }
|
||||
|
||||
[Display(Name = "Mqtt.IsEnabled", Description = "是否启用")]
|
||||
public bool IsEnabled { get; set; }
|
||||
|
||||
[Display(Name = "Mqtt.Remark", Description = "备注")]
|
||||
[StringLength(500, ErrorMessage = "Validate.{0}stringmax{1}")]
|
||||
public string Remark { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -64,6 +64,10 @@ builder.Services.AddSignalR()
|
||||
|
||||
builder.Services.AddSingleton<StockTicker>();
|
||||
|
||||
builder.Services.AddSingleton<HHWMS.Web.Services.MqttMessageChannel>();
|
||||
builder.Services.AddHostedService<HHWMS.Web.Services.MqttService>();
|
||||
|
||||
|
||||
|
||||
var app = builder.Build();
|
||||
IOptionsMonitor<Configs> config = app.Services.GetRequiredService<IOptionsMonitor<Configs>>();
|
||||
|
||||
@@ -18,12 +18,12 @@
|
||||
},
|
||||
"HHWMS.Web": {
|
||||
"commandName": "Project",
|
||||
"launchBrowser": true,
|
||||
"launchBrowser": false,
|
||||
"applicationUrl": "http://127.0.0.1:5000",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development",
|
||||
"ASPNETCORE_HOSTINGSTARTUPASSEMBLIES": "Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation"
|
||||
},
|
||||
"applicationUrl": "http://localhost:5000/"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,17 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
|
||||
Example:
|
||||
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
@@ -26,36 +26,36 @@
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
@@ -924,4 +924,7 @@
|
||||
<data name="_Admin.ZipCode" xml:space="preserve">
|
||||
<value>Zip</value>
|
||||
</data>
|
||||
</root>
|
||||
<data name="Inventory.Out" xml:space="preserve">
|
||||
<value />
|
||||
</data>
|
||||
</root>
|
||||
@@ -1,17 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
|
||||
Example:
|
||||
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
@@ -26,36 +26,36 @@
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
@@ -1018,10 +1018,10 @@
|
||||
<value>错误信息</value>
|
||||
</data>
|
||||
<data name="TaskType.In" xml:space="preserve">
|
||||
<value>盘料盒入库</value>
|
||||
<value>立库入库</value>
|
||||
</data>
|
||||
<data name="TaskType.Out" xml:space="preserve">
|
||||
<value>盘料盒出库</value>
|
||||
<value>立库出库</value>
|
||||
</data>
|
||||
<data name="TaskType.PIn" xml:space="preserve">
|
||||
<value>盘料入库</value>
|
||||
@@ -1152,6 +1152,12 @@
|
||||
<data name="Location.AddLocation" xml:space="preserve">
|
||||
<value>添加库位</value>
|
||||
</data>
|
||||
<data name="Location.StopLocation" xml:space="preserve">
|
||||
<value>禁用库位</value>
|
||||
</data>
|
||||
<data name="Location.LiftLocation" xml:space="preserve">
|
||||
<value>解禁库位</value>
|
||||
</data>
|
||||
<data name="Location.BeginLine" xml:space="preserve">
|
||||
<value>起始列</value>
|
||||
</data>
|
||||
@@ -1225,7 +1231,7 @@
|
||||
<value>批次</value>
|
||||
</data>
|
||||
<data name="Inventory.Lot" xml:space="preserve">
|
||||
<value>格</value>
|
||||
<value>Lot</value>
|
||||
</data>
|
||||
<data name="Inventory.ManufactureDate" xml:space="preserve">
|
||||
<value>生产日期</value>
|
||||
@@ -1407,4 +1413,7 @@
|
||||
<data name="MenuKey.InterfaceLog" xml:space="preserve">
|
||||
<value>接口日志</value>
|
||||
</data>
|
||||
<data name="Inventory.Out" xml:space="preserve">
|
||||
<value>出库</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -0,0 +1,28 @@
|
||||
using System.Threading.Channels;
|
||||
using System.Threading.Tasks;
|
||||
using HHWMS.Web.Models;
|
||||
using System.Threading;
|
||||
|
||||
namespace HHWMS.Web.Services
|
||||
{
|
||||
public class MqttMessageChannel
|
||||
{
|
||||
private readonly Channel<MqttMessageRecord> _channel;
|
||||
|
||||
public MqttMessageChannel()
|
||||
{
|
||||
_channel = Channel.CreateUnbounded<MqttMessageRecord>(new UnboundedChannelOptions
|
||||
{
|
||||
SingleReader = true,
|
||||
SingleWriter = false
|
||||
});
|
||||
}
|
||||
|
||||
public async ValueTask AddMessageAsync(MqttMessageRecord message, CancellationToken cancellationToken = default)
|
||||
{
|
||||
await _channel.Writer.WriteAsync(message, cancellationToken);
|
||||
}
|
||||
|
||||
public ChannelReader<MqttMessageRecord> Reader => _channel.Reader;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using HHWMS.Web.Models;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using MQTTnet;
|
||||
using MQTTnet.Client;
|
||||
using MQTTnet.Extensions.ManagedClient;
|
||||
using WalkingTec.Mvvm.Core;
|
||||
|
||||
namespace HHWMS.Web.Services
|
||||
{
|
||||
public class MqttService : BackgroundService
|
||||
{
|
||||
private readonly IServiceProvider _serviceProvider;
|
||||
private readonly IConfiguration _configuration;
|
||||
private readonly MqttMessageChannel _channel;
|
||||
private IManagedMqttClient _mqttClient;
|
||||
|
||||
public MqttService(IServiceProvider serviceProvider, IConfiguration configuration, MqttMessageChannel channel)
|
||||
{
|
||||
_serviceProvider = serviceProvider;
|
||||
_configuration = configuration;
|
||||
_channel = channel;
|
||||
}
|
||||
|
||||
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
|
||||
{
|
||||
var factory = new MqttFactory();
|
||||
_mqttClient = factory.CreateManagedMqttClient();
|
||||
|
||||
// 1. Handle received messages
|
||||
_mqttClient.ApplicationMessageReceivedAsync += async e =>
|
||||
{
|
||||
var payload = e.ApplicationMessage.PayloadSegment.Array != null ?
|
||||
System.Text.Encoding.UTF8.GetString(e.ApplicationMessage.PayloadSegment) : string.Empty;
|
||||
|
||||
var record = new MqttMessageRecord
|
||||
{
|
||||
Topic = e.ApplicationMessage.Topic,
|
||||
Payload = payload,
|
||||
ReceiveTime = DateTime.Now,
|
||||
IsProcessed = false
|
||||
};
|
||||
await _channel.AddMessageAsync(record, stoppingToken);
|
||||
};
|
||||
|
||||
// 2. Setup MQTT options
|
||||
var mqttOptions = new MqttClientOptionsBuilder()
|
||||
.WithClientId($"HHWMS_Service_{Guid.NewGuid()}")
|
||||
.WithTcpServer(_configuration["Mqtt:Server"] ?? "127.0.0.1", int.Parse(_configuration["Mqtt:Port"] ?? "1883"));
|
||||
|
||||
var user = _configuration["Mqtt:Username"];
|
||||
if (!string.IsNullOrEmpty(user))
|
||||
{
|
||||
mqttOptions.WithCredentials(user, _configuration["Mqtt:Password"]);
|
||||
}
|
||||
|
||||
var managedOptions = new ManagedMqttClientOptionsBuilder()
|
||||
.WithAutoReconnectDelay(TimeSpan.FromSeconds(5))
|
||||
.WithClientOptions(mqttOptions.Build())
|
||||
.Build();
|
||||
|
||||
// 3. Start the client
|
||||
await _mqttClient.StartAsync(managedOptions);
|
||||
|
||||
// 4. Periodically sync subscriptions from database
|
||||
while (!stoppingToken.IsCancellationRequested)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var scope = _serviceProvider.CreateScope())
|
||||
{
|
||||
var unitwork = scope.ServiceProvider.GetRequiredService<IUnitWork>();
|
||||
var subscriptions = unitwork.Find<MqttSubscription>(x => x.IsEnabled).ToList();
|
||||
|
||||
if (subscriptions.Any())
|
||||
{
|
||||
var subOptionsBuilder = factory.CreateSubscribeOptionsBuilder();
|
||||
foreach (var sub in subscriptions)
|
||||
{
|
||||
var qosLevel = sub.Qos switch
|
||||
{
|
||||
1 => MQTTnet.Protocol.MqttQualityOfServiceLevel.AtLeastOnce,
|
||||
2 => MQTTnet.Protocol.MqttQualityOfServiceLevel.ExactlyOnce,
|
||||
_ => MQTTnet.Protocol.MqttQualityOfServiceLevel.AtMostOnce
|
||||
};
|
||||
subOptionsBuilder.WithTopicFilter(f => f.WithTopic(sub.Topic).WithQualityOfServiceLevel(qosLevel));
|
||||
}
|
||||
await _mqttClient.SubscribeAsync(subOptionsBuilder.Build().TopicFilters);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
// Basic logging or handling
|
||||
}
|
||||
|
||||
// Check for new subscriptions every 1 minute
|
||||
await Task.Delay(TimeSpan.FromMinutes(1), stoppingToken);
|
||||
}
|
||||
}
|
||||
|
||||
public override async Task StopAsync(CancellationToken cancellationToken)
|
||||
{
|
||||
if (_mqttClient != null)
|
||||
{
|
||||
await _mqttClient.StopAsync();
|
||||
}
|
||||
await base.StopAsync(cancellationToken);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
@model WalkingTec.Mvvm.Core.BaseVM
|
||||
@using System.Text.Json
|
||||
|
||||
<div class="layui-row layui-col-space15" id="frontpage">
|
||||
<div class="layui-col-md12">
|
||||
<div class="layui-row layui-col-space15">
|
||||
<div class="layui-col-md6">
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-header">快捷菜单</div>
|
||||
<div class="layui-card-body">
|
||||
|
||||
<div class="layui-carousel layadmin-carousel layadmin-shortcut">
|
||||
<div carousel-item>
|
||||
<ul class="layui-row layui-col-space10">
|
||||
<li class="layui-col-xs3">
|
||||
<a lay-href="receipt/ReceiptIn/Index">
|
||||
<i class="layui-icon layui-icon-file"></i>
|
||||
<cite>出入库操作</cite>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<script>
|
||||
$("#frontpage").parent().css("background-color", "#eee");
|
||||
$.get("/Home/GetGithubInfo", function (r) {
|
||||
if (r === undefined || r === null) {
|
||||
return;
|
||||
}
|
||||
$("#githubstar").html(r.stargazers_count);
|
||||
$("#githubstars").html(r.stargazers_count);
|
||||
$("#githubfork").html(r.forks_count);
|
||||
$("#githubwatch").html(r.subscribers_count);
|
||||
$("#githubissue").html(r.open_issues_count);
|
||||
});
|
||||
|
||||
//区块轮播切换
|
||||
layui.use(['admin', 'carousel'], function () {
|
||||
var $ = layui.$
|
||||
, admin = layui.admin
|
||||
, carousel = layui.carousel
|
||||
, element = layui.element
|
||||
, device = layui.device();
|
||||
|
||||
//轮播切换
|
||||
$('.layadmin-carousel').each(function () {
|
||||
var othis = $(this);
|
||||
carousel.render({
|
||||
elem: this
|
||||
, width: '100%'
|
||||
, arrow: 'none'
|
||||
, interval: othis.data('interval')
|
||||
, autoplay: othis.data('autoplay') === true
|
||||
, trigger: (device.ios || device.android) ? 'click' : 'hover'
|
||||
, anim: othis.data('anim')
|
||||
});
|
||||
});
|
||||
|
||||
element.render('progress');
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
@@ -46,9 +46,10 @@
|
||||
<script src="/hiprint/polyfill.min.js"></script>
|
||||
<script src="/hiprint/hiprint.bundle.js"></script>
|
||||
<script src="/hiprint/plugins/qrcode.js"></script>
|
||||
<script src="/hiprint/plugins/JsBarcode.all.min.js"></script>
|
||||
<script src="/hiprint/plugins/jquery.minicolors.min.js"></script>
|
||||
<script src="/hiprint/plugins/jquery.hiwprint.js"></script>
|
||||
<script src="/hiprint/plugins/jquery.jqprint-0.3.js"></script>
|
||||
<script src="/hiprint/plugins/jquery.jqprint-0.3.js"></script>
|
||||
<script>
|
||||
var DONOTUSE_IGNOREHASH = false;
|
||||
var DONOTUSE_COOKIEPRE = '@ViewData["DONOTUSE_COOKIEPRE"]';
|
||||
|
||||
@@ -31,25 +31,6 @@ namespace WebService
|
||||
var data = JsonConvert.DeserializeObject<MesMaterials>(materails);
|
||||
// 插入物料信息表
|
||||
var materialList = new List<Material>();
|
||||
foreach (var item in data.ISSUEMATERIALS.ISSUEITEM)
|
||||
{
|
||||
var material = new Material
|
||||
{
|
||||
MaterialCode = item.MATNR,
|
||||
MaterialName = item.MAKTX,
|
||||
MaterialType = item.BWART,
|
||||
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"
|
||||
};
|
||||
materialList.Add(material);
|
||||
}
|
||||
_unitwork.BatchAdd<Material>(materialList.ToArray());
|
||||
return new Result();
|
||||
}
|
||||
@@ -65,7 +46,7 @@ namespace WebService
|
||||
try
|
||||
{
|
||||
_wtm.DoLog("", ActionLogTypesEnum.Normal, "mes", request: outOrder);
|
||||
|
||||
|
||||
return new Result();
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
||||
+25
-13
@@ -20,19 +20,18 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"Connections": [
|
||||
//{
|
||||
// "Key": "default",
|
||||
// "Value": "Server=127.0.0.1;Port=3306;Database=WMS;Uid=root;Password=abc123*;Character Set=utf8mb4;",
|
||||
// "DBType": "mysql"
|
||||
//},
|
||||
{
|
||||
"Key": "default",
|
||||
"Value": "Data Source=.;Initial Catalog=WMS;User=sa;Password=abc123*;Persist Security Info=True",
|
||||
"DbContext": "DataContext",
|
||||
"DBType": "sqlserver" //DataBase, you can choose mysql,sqlserver,pgsql,sqlite,oracle
|
||||
}
|
||||
"Value": "Server=127.0.0.1;Port=3306;Database=wms3;Uid=root;Password=abc123*;Character Set=utf8mb4;",
|
||||
"DBType": "mysql"
|
||||
},
|
||||
//{
|
||||
// "Key": "default",
|
||||
// "Value": "Data Source=.;Initial Catalog=WMS;User=sa;Password=abc123*;Persist Security Info=True",
|
||||
// "DbContext": "DataContext",
|
||||
// "DBType": "sqlserver" //DataBase, you can choose mysql,sqlserver,pgsql,sqlite,oracle
|
||||
//}
|
||||
//{
|
||||
// "Key": "default",
|
||||
// "Value": "Data Source=10.18.106.4;Initial Catalog=8357wms;User=wms;Password=abc123*;Persist Security Info=True",
|
||||
@@ -111,11 +110,24 @@
|
||||
"Address": "https://api.github.com"
|
||||
},
|
||||
"WCS": {
|
||||
"Address": "http://10.18.97.205:1111/api/WcsWebApi/"
|
||||
"Address": "http://192.168.30.200:65533/api/WCS/"
|
||||
},
|
||||
"ACS": {
|
||||
"Address": "http://192.168.30.136:10002/"
|
||||
}
|
||||
},
|
||||
"AppSettings": {
|
||||
"Key1": "abc",
|
||||
"Key2": "123"
|
||||
"Key2": "123",
|
||||
"Out": "123",
|
||||
"In": "123",
|
||||
"Charge": "123",
|
||||
"OutIn": "123",
|
||||
},
|
||||
"Mqtt": {
|
||||
"Server": "127.0.0.1",
|
||||
"Port": 1883,
|
||||
"Username": "",
|
||||
"Password": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user