添加工序配置

修改入库页面,任务完成,库存页面等
This commit is contained in:
zhougf committed 2025-08-31 15:57:46 +08:00
1 parent c2b039ea47
commit 5a04ca9d59
41 files changed
+1151 -84

No files matched your search

@@ -24,9 +24,9 @@ namespace HHWMS.Web.Controllers
_unitWork = unitwork;
_materialZones = new Dictionary<string, LineRange>
{
{ "zone1", new LineRange { BeginLine = 1, EndLine = 25 } },
{ "zone2", new LineRange { BeginLine = 26, EndLine = 57 } },
{ "zone3", new LineRange { BeginLine = 58, EndLine = 96 } },
{ "Zone1", new LineRange { BeginLine = 1, EndLine = 25 } },
{ "Zone2", new LineRange { BeginLine = 26, EndLine = 57 } },
{ "Zone3", new LineRange { BeginLine = 58, EndLine = 96 } },
};
}
@@ -121,6 +121,21 @@ namespace HHWMS.Web.Controllers
return Json(new { Code = 200, Data = orders });
}
[Public]
[HttpGet]
public IActionResult GetTrayTypes()
{
var containerconfig = _unitWork.Find<SysDictData>(x => x.DictType == "ContainerConfig"
&& x.DictLabelUs.ToLower() != "container")
.Select(x => new
{
value = x.ID,
label = x.DictLabel,
})
.ToList();
return Json(new { Code = 200, Data = containerconfig });
}
[HttpPost]
public IActionResult SubmitReceipt([FromBody] ReceiptInModel model)
{
@@ -141,15 +156,28 @@ namespace HHWMS.Web.Controllers
{
return Json(new { Code = 500, Msg = "容器不存在" });
}
var materialProcessList = _unitWork.Find<MaterialProcess>(m => m.MaterialCode == material.MaterialCode);
var materialProcess = _unitWork.FindSingle<MaterialProcess>(m => m.ID == model.ProcessId);
if (materialProcess == null)
{
return Json(new { Code = 500, Msg = "未找到此工序配置" });
return Json(new { Code = 500, Msg = "未找到此物料工序配置" });
}
// 下一道工序
var nextProcess = materialProcessList
// 筛选同一物料
.Where(p => p.MaterialCode == material.MaterialCode)
// 筛选顺序大于当前工序的工序
.Where(p => p.ProcessOrder > materialProcess.ProcessOrder)
// 按工序顺序升序排列(取最小的一个,即下一道)
.OrderBy(p => p.ProcessOrder)
// 取第一个(下一道工序)
.FirstOrDefault();
// 从字典查询工序对应的区域
var zoneName = _unitWork.FindSingle<SysDictData>(x => x.DictType == "ProcessZone"
&& x.DictLabel == materialProcess.ProcessCode)?.DictValue;
var zoneName = _unitWork.FindSingle<ProcessConfig>(x =>
x.Code == nextProcess.ProcessCode)?.Zone;
if (string.IsNullOrEmpty(zoneName))
{
@@ -180,7 +208,7 @@ namespace HHWMS.Web.Controllers
TaskType = TaskTypeEnum.入库,
FromLocation = "",
ToLocation = locationCode,
ContainerCode = model.PalletCode,
ContainerCode = container.Code,
RoadWay = 1,
Status = TaskStatusEnum.新建,
CreateBy = model.OperatorId,
@@ -193,18 +221,21 @@ namespace HHWMS.Web.Controllers
var inventory = new Inventory
{
ZoneId = zone.ID,
ContainerCode = model.PalletCode,
ContainerCode = taskHeader.ContainerCode,
LocationCode = locationCode,
MaterialCode = model.MaterialCode,
MaterialType = material.MaterialType,
MaterialName = material.MaterialName,
MaterialSpec = material.MaterialSpec,
MaterialUnit = material.MaterialUnit,
SupplierCode = material.SupplierCode,
SourceCode = model.SourceCode,
Batch = materialProcess.ProcessName,
Lot = materialProcess.ProcessCode,
Lot = nextProcess?.ProcessName,
Status = model.IsQualified ? "合格" : "不合格",
TaskStatus = InventoryTaskStatusEnum.Locked,
TaskQty = model.Qty,
TaskQty = model.Qty,//小托盘数量
Flag = model.Type,//小托盘类型
CreateBy = model.OperatorId,
ReceiptCode = model.OperatorInfo, //校验员
CreateTime = DateTime.Now
@@ -226,7 +257,7 @@ namespace HHWMS.Web.Controllers
{
Status = LocationStatusEnum.锁定,
ContainerStatus = LocationStatus.有货,
ContainerCode = model.PalletCode,
ContainerCode = taskHeader.ContainerCode,
UpdateTime = DateTime.Now,
UpdateBy = "WMS",
Version = Guid.NewGuid()
@@ -243,7 +274,7 @@ namespace HHWMS.Web.Controllers
var wcsTaskModel = new WCSTaskModel
{
TaskNo = taskNo,
PalletNo = model.PalletCode,
PalletNo = taskHeader.ContainerCode,
FromLocation = "", // 入库任务起始位置为空
ToLocation = locationCode,
};
@@ -295,7 +326,7 @@ namespace HHWMS.Web.Controllers
// 1. 查找可用库位信息
var locationVm = Wtm.CreateVM<LocationVM>();
var locationCode = locationVm.GetEmptyLocationFromXb(_materialZones["zone1"].BeginLine, _materialZones["zone1"].EndLine);
var locationCode = locationVm.GetEmptyLocationFromXb(_materialZones["Zone1"].BeginLine, _materialZones["Zone1"].EndLine);
if (string.IsNullOrWhiteSpace(locationCode))
{
@@ -317,7 +348,7 @@ namespace HHWMS.Web.Controllers
TaskType = TaskTypeEnum.入库,
FromLocation = "",
ToLocation = locationCode,
ContainerCode = model.PalletCode,
ContainerCode = container.Code,
RoadWay = 1,
Status = TaskStatusEnum.新建,
CreateBy = model.OperatorId,
@@ -358,7 +389,7 @@ namespace HHWMS.Web.Controllers
var wcsTaskModel = new WCSTaskModel
{
TaskNo = taskNo,
PalletNo = model.PalletCode,
PalletNo = taskHeader.ContainerCode,
FromLocation = "", // 入库任务起始位置为空
ToLocation = locationCode,
};
@@ -387,6 +418,58 @@ namespace HHWMS.Web.Controllers
}
}}
/// <summary>
/// 空托盘出库
/// </summary>
/// <returns></returns>
[HttpPost]
public IActionResult EmptyPalletOut()
{
var container = _unitWork.FindSingle<Container>(x => x.Status == ContainerStatus.空
&& x.IsLock == ContainerLockEnum.未锁
&& !string.IsNullOrEmpty(x.LocationCode));
if (container == null)
{
return Json(new { Code = 500, Msg = "库内不存在可用空容器!"} );
}
//创建出库任务
var location = _unitWork.FindSingle<Location>(x => x.Code == container.LocationCode);
var outPort = _unitWork.FindSingle<ProcessConfig>(x => x.Code == "00")?.Port;
if (string.IsNullOrEmpty(outPort))
{
return Json(new { Code = 500, Msg = "未配置空托盘出库口,请配置后重新呼叫出库任务!"} );
}
var task = new TaskHeader()
{
ZoneId = location.ZoneId,
TaskNo = _unitWork.GetSerialNumber("Out", 6),
TaskType = TaskTypeEnum.出库,
ContainerCode = container.Code,
FromLocation = container.LocationCode,
ToLocation = outPort,
Status = TaskStatusEnum.新建
};
var vm = Wtm.CreateVM<LocationVM>();
var result = vm.SendWcsTask(task);
if (!result.Status)
{
return Json(new { Code = 500, Msg =result.Message});
}
location.Status = LocationStatusEnum.锁定;
location.UpdateTime = DateTime.Now;
_unitWork.Update(location);
container.IsLock = ContainerLockEnum.任务锁;
container.UpdateTime = DateTime.Now;
_unitWork.Update(container);
return Json(new { Code = 200, Msg = "提交成功" });
}
/// <summary>
/// 搜索物料
/// </summary>
@@ -425,11 +508,13 @@ namespace HHWMS.Web.Controllers
public class ReceiptInModel
{
public string PalletCode { get; set; }
public string SourceCode { get; set; }
public string MaterialCode { get; set; }
public string OrderId { get; set; }
public string OperatorId { get; set; }
public int ProcessId { get; set; }
public string ProcessName { get; set; }
public int Type { get; set; }
public int Qty { get; set; }
public bool IsQualified { get; set; }
public string OperatorInfo { get; set; }
@@ -163,7 +163,7 @@ namespace HHWMS.Web.Controllers
var inventory = new Inventory()
{
ZoneId = zone.ID,
ContainerCode = containerCode,
ContainerCode = container.Code,
MaterialCode = material.MaterialCode,
MaterialName = material.MaterialName,
MaterialType = material.MaterialType,
@@ -186,7 +186,7 @@ namespace HHWMS.Web.Controllers
MaterialCode = material.MaterialCode,
MaterialName = material.MaterialName,
MaterialUnit = material.MaterialUnit,
ContainerCode = containerCode,
ContainerCode = container.Code,
CompanyCode = inventory.CompanyCode,
SourceCode = inventory.SourceCode,
SupplierCode = inventory.SupplierCode,
@@ -249,7 +249,7 @@ namespace HHWMS.Web.Controllers
TaskNo = _unitWork.GetSerialNumber("In"),
TaskType = TaskTypeEnum.入库,
RoadWay = 2,
ContainerCode = containerCode,
ContainerCode = container.Code,
FromLocation = "Enter_0000",
ToLocation = "",
Status = TaskStatusEnum.待下发,
@@ -452,7 +452,7 @@ namespace HHWMS.Web.Controllers
TaskNo = _unitWork.GetSerialNumber("In"),
TaskType = TaskTypeEnum.入库,
RoadWay = 2,
ContainerCode = containerCode,
ContainerCode = container.Code,
FromLocation = "Enter_0000",
ToLocation = "",
Status = TaskStatusEnum.待下发,