打印
定时器修改
This commit is contained in:
1 parent
ba8fd9e53b
commit
26d46cad00
6 files changed
+282
-134
No files matched your search
@@ -2,6 +2,7 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using HHWMS.Web.Models;
|
using HHWMS.Web.Models;
|
||||||
|
using ICSharpCode.SharpZipLib.Core;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using WalkingTec.Mvvm.Core;
|
using WalkingTec.Mvvm.Core;
|
||||||
@@ -26,6 +27,9 @@ namespace HHWMS.Web.Controllers
|
|||||||
[ActionDescription("Sys.Search")]
|
[ActionDescription("Sys.Search")]
|
||||||
public ActionResult Index()
|
public ActionResult Index()
|
||||||
{
|
{
|
||||||
|
var inv = _unitwork.Find<Inventory>(x => x.TaskStatus != InventoryTaskStatus.任务中)
|
||||||
|
.ToList()
|
||||||
|
.GroupBy(x => x.ContainerCode);
|
||||||
var vm = Wtm.CreateVM<ContainerListVM>();
|
var vm = Wtm.CreateVM<ContainerListVM>();
|
||||||
return PartialView(vm);
|
return PartialView(vm);
|
||||||
}
|
}
|
||||||
@@ -56,6 +60,7 @@ namespace HHWMS.Web.Controllers
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
var materialQrList = new List<MaterialQr>();
|
var materialQrList = new List<MaterialQr>();
|
||||||
|
var printList = new List<dynamic>();
|
||||||
for (int i = 0; i < num; i++)
|
for (int i = 0; i < num; i++)
|
||||||
{
|
{
|
||||||
var prefix = code.Split("@")[1].Substring(2);
|
var prefix = code.Split("@")[1].Substring(2);
|
||||||
@@ -69,9 +74,14 @@ namespace HHWMS.Web.Controllers
|
|||||||
CreateTime = DateTime.Now,
|
CreateTime = DateTime.Now,
|
||||||
CreateBy = Wtm.LoginUserInfo.ITCode
|
CreateBy = Wtm.LoginUserInfo.ITCode
|
||||||
});
|
});
|
||||||
|
printList.Add(new
|
||||||
|
{
|
||||||
|
UniqueCode = uniqueCode,
|
||||||
|
Batch = material.Batch
|
||||||
|
});
|
||||||
}
|
}
|
||||||
_unitwork.BatchAdd(materialQrList.ToArray());
|
_unitwork.BatchAdd(materialQrList.ToArray());
|
||||||
return JsonMore(materialQrList);
|
return JsonMore(printList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="8">
|
<el-col :span="8">
|
||||||
<el-input v-model.number="num"
|
<el-input v-model.number="num"
|
||||||
placeholder="请输入数量">
|
placeholder="请输入数量" readonly>
|
||||||
</el-input>
|
</el-input>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="4">
|
<el-col :span="4">
|
||||||
@@ -78,7 +78,7 @@
|
|||||||
data: { code: _this.qrcode },
|
data: { code: _this.qrcode },
|
||||||
url: "/configs/Print/ScanCode",
|
url: "/configs/Print/ScanCode",
|
||||||
success: function (json) {
|
success: function (json) {
|
||||||
console.log(json);
|
// console.log(json);
|
||||||
if (json.Code != 200) {
|
if (json.Code != 200) {
|
||||||
_this.$message({
|
_this.$message({
|
||||||
message: "扫描失败!" + json.Msg,
|
message: "扫描失败!" + json.Msg,
|
||||||
@@ -86,6 +86,7 @@
|
|||||||
duration: "10000",
|
duration: "10000",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
_this.printData = [];
|
||||||
},
|
},
|
||||||
error: function (json) {
|
error: function (json) {
|
||||||
_this.$message({
|
_this.$message({
|
||||||
@@ -130,10 +131,12 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
console.log(json);
|
// console.log(json);
|
||||||
json.Data.forEach(function (item) {
|
json.Data.forEach(function (item) {
|
||||||
_this.gendCode += item.UniqueCode + '\n';
|
_this.gendCode += item.UniqueCode + '\n';
|
||||||
|
_this.gendCode += item.Batch + '\n';
|
||||||
_this.printData.push({ uniqueCode: item.UniqueCode });
|
_this.printData.push({ uniqueCode: item.UniqueCode });
|
||||||
|
_this.printData.push({ uniqueCode: item.Batch });
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -156,7 +159,7 @@
|
|||||||
template: this.template
|
template: this.template
|
||||||
})
|
})
|
||||||
hiprintTemplate.print(this.printData);
|
hiprintTemplate.print(this.printData);
|
||||||
_this.printData = [];
|
// _this.printData = [];
|
||||||
//清空
|
//清空
|
||||||
_this.qrcode = '';
|
_this.qrcode = '';
|
||||||
_this.unm = 1;
|
_this.unm = 1;
|
||||||
|
|||||||
@@ -107,6 +107,7 @@ public class ShipOutController : BaseController
|
|||||||
if (Sation != null)
|
if (Sation != null)
|
||||||
{
|
{
|
||||||
Sation.ContainerCode = "";
|
Sation.ContainerCode = "";
|
||||||
|
Sation.Height = 0;
|
||||||
_unitWork.Update(Sation);
|
_unitWork.Update(Sation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,26 +26,23 @@ namespace HHWMS.Web
|
|||||||
|
|
||||||
var tasks = _unitwork.Find<TaskHeader>(x =>x.Status > TaskStatusEnum.新建 && x.Status < TaskStatusEnum.已下发)
|
var tasks = _unitwork.Find<TaskHeader>(x =>x.Status > TaskStatusEnum.新建 && x.Status < TaskStatusEnum.已下发)
|
||||||
.Include(x => x.TaskDetails)
|
.Include(x => x.TaskDetails)
|
||||||
|
.OrderBy(x => x.Priority)
|
||||||
.ToList();
|
.ToList();
|
||||||
foreach (var task in tasks)
|
foreach (var task in tasks)
|
||||||
{
|
{
|
||||||
if (task != null)
|
if (task != null)
|
||||||
{
|
{
|
||||||
var count = 0;
|
var count = 0;
|
||||||
var Count = 0;
|
|
||||||
if (task.TaskType == TaskTypeEnum.盘料入库)
|
if (task.TaskType == TaskTypeEnum.盘料入库)
|
||||||
{
|
{
|
||||||
GenTask(task, _unitwork);
|
GenTask(task, _unitwork);
|
||||||
//子任务为新建的盘料入库任务不需要下发给WCS
|
|
||||||
count = task.TaskDetails.Where(x => x.Status == TaskStatusEnum.新建).Count();
|
count = task.TaskDetails.Where(x => x.Status <= TaskStatusEnum.待下发).Count();
|
||||||
//子任务部分完成,需要下发部分子任务
|
|
||||||
Count = task.TaskDetails.Where(x => x.Status == TaskStatusEnum.待下发).Count();
|
|
||||||
}
|
}
|
||||||
else if (task.TaskType == TaskTypeEnum.盘料出库)
|
else if (task.TaskType == TaskTypeEnum.盘料出库)
|
||||||
{
|
{
|
||||||
OutGenTask(task, _unitwork);
|
//if(OutGenTask(task, _unitwork))
|
||||||
//子任务为新建的盘料入库任务不需要下发给WCS
|
count = task.TaskDetails.Where(x => x.Status <= TaskStatusEnum.待下发).Count();
|
||||||
count = task.TaskDetails.Where(x => x.Status == TaskStatusEnum.新建).Count();
|
|
||||||
}
|
}
|
||||||
else if (task.TaskType == TaskTypeEnum.散料盒出库)
|
else if (task.TaskType == TaskTypeEnum.散料盒出库)
|
||||||
{
|
{
|
||||||
@@ -57,8 +54,16 @@ namespace HHWMS.Web
|
|||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
count = 1;
|
||||||
}
|
}
|
||||||
if (count == 0 || Count > 0)
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
count = 1;
|
||||||
|
}
|
||||||
|
if (count > 0)
|
||||||
{
|
{
|
||||||
var taskList = CreateWCSTask(task, _unitwork);
|
var taskList = CreateWCSTask(task, _unitwork);
|
||||||
foreach (var item in taskList)
|
foreach (var item in taskList)
|
||||||
@@ -251,14 +256,49 @@ namespace HHWMS.Web
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 根据盘料出库生成盘料盒出库任务
|
/// 根据盘料出库生成盘料盒出库任务
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void OutGenTask(TaskHeader task, UnitWork _unitwork)
|
public bool OutGenTask(TaskHeader task, UnitWork _unitwork)
|
||||||
{
|
{
|
||||||
//查找料塔工位
|
var details = task.TaskDetails.Where(x => x.Status == TaskStatusEnum.新建
|
||||||
|
&& string.IsNullOrEmpty(x.ToLocation));
|
||||||
|
if(!details.Any())
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
var container = _unitwork.Find<Location>(n => n.ContainerCode == task.ContainerCode).FirstOrDefault();
|
||||||
|
|
||||||
|
var tLoc = _unitwork.FindSingle<Location>(x => x.Code == task.ToLocation);
|
||||||
|
|
||||||
|
var outTask = _unitwork.Find<TaskHeader>(x => x.ContainerCode == task.ContainerCode
|
||||||
|
&& x.TaskType == TaskTypeEnum.盘料盒出库).FirstOrDefault();
|
||||||
|
if(outTask != null && tLoc.Height < tLoc.Length)
|
||||||
|
{
|
||||||
|
foreach (var detail in details)
|
||||||
|
{
|
||||||
|
if (tLoc.Height >= tLoc.Length)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
detail.ToLocation = (Convert.ToInt32(tLoc.Height) + 1).ToString();
|
||||||
|
detail.Lot = $"{Convert.ToInt32(container.Length)}-{task.ToLocation}";
|
||||||
|
tLoc.Height += 1;
|
||||||
|
if (tLoc.Height == tLoc.Length)
|
||||||
|
{
|
||||||
|
tLoc.Height = tLoc.Length;
|
||||||
|
_unitwork.Update(tLoc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_unitwork.Update(tLoc);
|
||||||
|
_unitwork.Update(task);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
if (string.IsNullOrEmpty(task.FromLocation))
|
if (string.IsNullOrEmpty(task.FromLocation))
|
||||||
{
|
{
|
||||||
var details = task.TaskDetails.Where(x => x.Status == TaskStatusEnum.新建);
|
//var details = task.TaskDetails.Where(x => x.Status == TaskStatusEnum.新建);
|
||||||
//根据盘料出库的托盘创建盘料盒出库任务
|
//根据盘料出库的托盘创建盘料盒出库任务
|
||||||
var container = _unitwork.Find<Location>(n => n.ContainerCode == task.ContainerCode).FirstOrDefault();
|
//var container = _unitwork.Find<Location>(n => n.ContainerCode == task.ContainerCode).FirstOrDefault();
|
||||||
var station = _unitwork.FindSingle<Location>(x => x.Type.Equals(LocationTypeEnum.堆垛机工位) && x.Row == container.Row);
|
var station = _unitwork.FindSingle<Location>(x => x.Type.Equals(LocationTypeEnum.堆垛机工位) && x.Row == container.Row);
|
||||||
if (container != null)
|
if (container != null)
|
||||||
{
|
{
|
||||||
@@ -277,13 +317,26 @@ namespace HHWMS.Web
|
|||||||
&& x.Type.Equals(LocationTypeEnum.机械臂工位))?.Code;
|
&& x.Type.Equals(LocationTypeEnum.机械臂工位))?.Code;
|
||||||
task.FromLocation = from;
|
task.FromLocation = from;
|
||||||
//更新任务明细对应在料塔的位置
|
//更新任务明细对应在料塔的位置
|
||||||
var Invcount = 0;
|
|
||||||
foreach (var detail in details)
|
foreach (var detail in details)
|
||||||
{
|
{
|
||||||
detail.ToLocation = (Invcount + 1).ToString();
|
if (tLoc.Height >= tLoc.Length)
|
||||||
Invcount = Invcount + 1;
|
{
|
||||||
detail.Lot = $"{Convert.ToInt32(container.Length)}-{task.ToLocation}";
|
break;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
detail.ToLocation = (Convert.ToInt32(tLoc.Height) + 1).ToString();
|
||||||
|
detail.Lot = $"{Convert.ToInt32(container.Length)}-{task.ToLocation}";
|
||||||
|
tLoc.Height += 1;
|
||||||
|
if (tLoc.Height == tLoc.Length)
|
||||||
|
{
|
||||||
|
tLoc.Height = tLoc.Length;
|
||||||
|
_unitwork.Update(tLoc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_unitwork.Update(tLoc);
|
||||||
var fromstation = _unitwork.Find<Location>(n => n.ContiguousCode == station.Code && n.Type.Equals(LocationTypeEnum.机械臂工位)).FirstOrDefault();
|
var fromstation = _unitwork.Find<Location>(n => n.ContiguousCode == station.Code && n.Type.Equals(LocationTypeEnum.机械臂工位)).FirstOrDefault();
|
||||||
if (fromstation != null)
|
if (fromstation != null)
|
||||||
{
|
{
|
||||||
@@ -292,9 +345,9 @@ namespace HHWMS.Web
|
|||||||
_unitwork.Update(task);
|
_unitwork.Update(task);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 创建WCS任务
|
/// 创建WCS任务
|
||||||
|
|||||||
@@ -26,198 +26,278 @@ namespace HHWMS.Web
|
|||||||
{
|
{
|
||||||
var _unitwork = new UnitWork(Wtm);
|
var _unitwork = new UnitWork(Wtm);
|
||||||
|
|
||||||
var Shipments = _unitwork.Find<ShipmentHeader>(x =>x.FirstStatus == ShipStatusEnum.分配中)
|
var Shipments = _unitwork.Find<ShipmentHeader>(x => x.FirstStatus == ShipStatusEnum.分配中)
|
||||||
.Include(x => x.ShipmentDetails)
|
.Include(x => x.ShipmentDetails)
|
||||||
|
.Take(5)
|
||||||
.ToList();
|
.ToList();
|
||||||
var shipments = Shipments.Take(1).ToList();
|
|
||||||
|
|
||||||
foreach (var shipment in shipments)
|
List<Inventory> shiInventorys = new List<Inventory>();
|
||||||
|
using (var tran = Wtm.DC.Database.BeginTransaction())
|
||||||
{
|
{
|
||||||
List<Inventory> ShiInventorys = new List<Inventory>();
|
try
|
||||||
var ShipmentDetails = shipment.ShipmentDetails.Where(x => x.Status.Equals(ShipStatusEnum.新建)).ToList();
|
|
||||||
foreach (var ShipmentDetail in ShipmentDetails)
|
|
||||||
{
|
{
|
||||||
var inventory = _unitwork.Find<Inventory>(x => x.UniqueCode == ShipmentDetail.UniqueCode
|
foreach (var shipment in Shipments)
|
||||||
&& x.TaskStatus == InventoryTaskStatus.无任务).FirstOrDefault();
|
{
|
||||||
if (inventory == null)
|
var shipmentDetails = shipment.ShipmentDetails.Where(x => x.Status.Equals(ShipStatusEnum.新建)).ToList();
|
||||||
|
foreach (var shipmentDetail in shipmentDetails)
|
||||||
|
{
|
||||||
|
var inventorys = _unitwork.Find<Inventory>(x => x.UniqueCode == shipmentDetail.UniqueCode
|
||||||
|
&& x.TaskStatus == InventoryTaskStatus.无任务).ToList();
|
||||||
|
if (inventorys.Count <= 0)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
inventory.SourceCode = ShipmentDetail.ID.ToString();
|
|
||||||
|
foreach (var inventory in inventorys)
|
||||||
|
{
|
||||||
|
inventory.SourceCode = shipmentDetail.ShipmentHeader.Code;
|
||||||
|
inventory.TaskStatus = InventoryTaskStatus.任务中;
|
||||||
|
inventory.UpdateBy = "wmsjob";
|
||||||
|
inventory.UpdateTime = DateTime.Now;
|
||||||
|
|
||||||
_unitwork.Update(inventory);
|
_unitwork.Update(inventory);
|
||||||
//更新单据子表状态
|
shiInventorys.Add(inventory);
|
||||||
ShiInventorys.Add(inventory);
|
|
||||||
|
shipmentDetail.DividedQty += inventory.Qty;
|
||||||
|
if (shipmentDetail.DividedQty >= shipmentDetail.Qty)
|
||||||
|
{
|
||||||
|
shipmentDetail.Status = ShipStatusEnum.分配完成;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
shipmentDetail.Status = ShipStatusEnum.分配中;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
shipmentDetail.UpdateTime = DateTime.Now;
|
||||||
|
shipmentDetail.UpdateBy = "wmsjob";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!shipment.ShipmentDetails.Any(x => x.Status < ShipStatusEnum.分配完成))
|
||||||
|
{
|
||||||
|
shipment.FirstStatus = ShipStatusEnum.分配完成;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
shipment.FirstStatus = ShipStatusEnum.分配中;
|
||||||
|
}
|
||||||
|
|
||||||
|
shipment.UpdateBy = "wmsjob";
|
||||||
|
shipment.UpdateTime = DateTime.Now;
|
||||||
|
_unitwork.Update(shipment);
|
||||||
|
}
|
||||||
|
|
||||||
//出库库存通过托盘号分组
|
//出库库存通过托盘号分组
|
||||||
var Inventorys = ShiInventorys.GroupBy(x => x.ContainerCode).ToList();
|
var lockInvs = _unitwork.Find<Inventory>(x => x.TaskStatus == InventoryTaskStatus.任务中).ToList();
|
||||||
|
shiInventorys.AddRange(lockInvs);
|
||||||
|
shiInventorys.DistinctBy(x => x.UniqueCode);
|
||||||
|
var inventoryList = shiInventorys.GroupBy(x => x.ContainerCode)
|
||||||
|
.ToList();
|
||||||
|
|
||||||
//散料库
|
//散料库
|
||||||
if (Inventorys.First().Key.Contains("C"))
|
if (inventoryList.Any(x => x.Key.Contains("C")))
|
||||||
{
|
{
|
||||||
foreach (var item in Inventorys)
|
foreach (var item in inventoryList.Where(x => x.Key.Contains("C")))
|
||||||
{
|
{
|
||||||
var inventory = item.FirstOrDefault();
|
|
||||||
//出库托盘
|
//出库托盘
|
||||||
Location location = _unitwork.Find<Location>(x => x.Code == inventory.ContainerCode && x.Status != LocationStatus.任务锁).FirstOrDefault();
|
Location location = _unitwork.Find<Location>(x => x.Code == item.Key && x.Status != LocationStatus.任务锁).FirstOrDefault();
|
||||||
if (location == null)
|
if (location == null)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// 查询目的地站台是否可用
|
// 查询目的地站台是否可用
|
||||||
var stations = _unitwork.Find<Location>(x => x.Row == location.Row && x.Type == LocationTypeEnum.散料库站台 && string.IsNullOrEmpty(x.ContainerCode)).FirstOrDefault();
|
var station = _unitwork.Find<Location>(x => x.Row == location.Row && x.Type == LocationTypeEnum.散料库站台 && string.IsNullOrEmpty(x.ContainerCode)).FirstOrDefault();
|
||||||
if (stations == null)
|
if (station == null)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//判断是否已经有目的站台的出库任务
|
//判断是否已经有目的站台的出库任务
|
||||||
TaskHeader taskHeader = _unitwork.Find<TaskHeader>(x => x.ToLocation == stations.Code && x.TaskType == TaskTypeEnum.散料盒出库).FirstOrDefault();
|
TaskHeader taskHeader = _unitwork.Find<TaskHeader>(x =>
|
||||||
|
x.ToLocation == station.Code && x.TaskType == TaskTypeEnum.散料盒出库).FirstOrDefault();
|
||||||
if (taskHeader != null)
|
if (taskHeader != null)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 创建任务
|
// 创建任务
|
||||||
var task = new TaskHeader
|
var task = new TaskHeader
|
||||||
{
|
{
|
||||||
ZoneCode = ZoneCodeEnum.散料库,
|
ZoneCode = ZoneCodeEnum.散料库,
|
||||||
TaskNo = _unitwork.GetSerialNumber("SOut"),
|
TaskNo = _unitwork.GetSerialNumber("SOut"),
|
||||||
TaskType = TaskTypeEnum.散料盒出库,
|
TaskType = TaskTypeEnum.散料盒出库,
|
||||||
ContainerCode = inventory.ContainerCode,
|
ContainerCode = item.Key,
|
||||||
FromLocation = location.ContainerCode,
|
FromLocation = location.ContainerCode,
|
||||||
ToLocation = stations.Code,
|
ToLocation = station.Code,
|
||||||
Status = TaskStatusEnum.待下发,
|
Status = TaskStatusEnum.待下发,
|
||||||
|
Priority = 0,
|
||||||
CreateTime = DateTime.Now,
|
CreateTime = DateTime.Now,
|
||||||
|
CreateBy = "wmsjob"
|
||||||
};
|
};
|
||||||
_unitwork.Add(task);
|
_unitwork.Add(task);
|
||||||
//更新库位状态
|
//更新库位状态
|
||||||
location.Status = LocationStatus.任务锁;
|
location.Status = LocationStatus.任务锁;
|
||||||
_unitwork.Update(location);
|
_unitwork.Update(location);
|
||||||
|
|
||||||
//更新库存状态
|
|
||||||
var invs = _unitwork.Find<Inventory>(x => x.ContainerCode == inventory.ContainerCode).ToList();
|
|
||||||
if (invs.Count() > 0)
|
|
||||||
{
|
|
||||||
foreach (var inv in invs)
|
|
||||||
{
|
|
||||||
inv.TaskStatus = InventoryTaskStatus.任务中;
|
|
||||||
_unitwork.Update(inv);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//更新单据主表状态
|
|
||||||
foreach (var Inventory in item)
|
|
||||||
{
|
|
||||||
var shipmentdetail = shipment.ShipmentDetails.Where(x => x.ID == int.Parse(Inventory.SourceCode)).FirstOrDefault();
|
|
||||||
if (shipmentdetail != null)
|
|
||||||
{
|
|
||||||
shipmentdetail.Status = ShipStatusEnum.分配完成;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!shipment.ShipmentDetails.Any(x => x.Status < ShipStatusEnum.分配完成))
|
|
||||||
{
|
|
||||||
shipment.FirstStatus = ShipStatusEnum.分配完成;
|
|
||||||
_unitwork.Update(shipment);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//盘料库
|
//盘料库
|
||||||
else if(Inventorys.First().Key.Contains("L"))
|
if (inventoryList.Any(x => x.Key.Contains("L")))
|
||||||
{
|
{
|
||||||
foreach (var item in Inventorys)
|
foreach (var item in inventoryList.Where(x => x.Key.Contains("L")))
|
||||||
{
|
{
|
||||||
var task = new TaskHeader();
|
var task = new TaskHeader();
|
||||||
task.TaskDetails = new List<TaskDetail>();
|
task.TaskDetails = new List<TaskDetail>();
|
||||||
var Inventory = item.FirstOrDefault();
|
var inv = item.FirstOrDefault();
|
||||||
var location = _unitwork.Find<Location>(x => x.ContainerCode == Inventory.ContainerCode
|
var location = _unitwork.Find<Location>(x => x.ContainerCode == item.Key
|
||||||
&& x.Status != LocationStatus.空仓位
|
&& x.Status != LocationStatus.空仓位
|
||||||
&& x.Status != LocationStatus.空容器).FirstOrDefault();
|
&& x.Status != LocationStatus.空容器).FirstOrDefault();
|
||||||
//查询仓位表是否符合
|
//查询仓位表是否符合
|
||||||
if (location != null)
|
if (location != null)
|
||||||
{
|
{
|
||||||
var row = 1;
|
var row = 1;
|
||||||
if (Inventory.Flag == 8)
|
if (inv.Flag == 8)
|
||||||
{
|
{
|
||||||
row = 3;
|
row = 3;
|
||||||
}
|
}
|
||||||
else if(Inventory.Flag == 24 || Inventory.Flag == 16 || Inventory.Flag == 10)
|
else if (inv.Flag == 24 || inv.Flag == 16 || inv.Flag == 10)
|
||||||
{
|
{
|
||||||
row = 1;
|
row = 1;
|
||||||
}
|
}
|
||||||
//查找料塔工位
|
// 查找工位 G1
|
||||||
var to = _unitwork.Find<Location>(x => string.IsNullOrEmpty(x.ContainerCode)
|
var gLoc = _unitwork.Find<Location>(x => string.IsNullOrEmpty(x.ContainerCode)
|
||||||
|
&& x.Row == location.Row
|
||||||
|
&& x.Type.Equals(LocationTypeEnum.堆垛机工位)).FirstOrDefault();
|
||||||
|
// 新建盘料盒出库任务
|
||||||
|
if (gLoc != null)
|
||||||
|
{
|
||||||
|
var pTask = new TaskHeader
|
||||||
|
{
|
||||||
|
ZoneCode = ZoneCodeEnum.盘料库,
|
||||||
|
TaskNo = _unitwork.GetSerialNumber("Out"),
|
||||||
|
TaskType = TaskTypeEnum.盘料盒出库,
|
||||||
|
ContainerCode = item.Key,
|
||||||
|
FromLocation = location.ContainerCode,
|
||||||
|
ToLocation = gLoc.Code,
|
||||||
|
Status = TaskStatusEnum.待下发,
|
||||||
|
Priority = 0,
|
||||||
|
CreateTime = DateTime.Now,
|
||||||
|
CreateBy = "wmsjob"
|
||||||
|
};
|
||||||
|
//_unitwork.Add(pTask);
|
||||||
|
//查找料塔工位 T
|
||||||
|
var tLoc = _unitwork.Find<Location>(x => string.IsNullOrEmpty(x.ContainerCode)
|
||||||
&& x.Row == row
|
&& x.Row == row
|
||||||
&& x.Type.Equals(LocationTypeEnum.料塔)).FirstOrDefault();
|
&& x.Type.Equals(LocationTypeEnum.料塔))
|
||||||
|
.FirstOrDefault();
|
||||||
|
|
||||||
//查询料塔是否为空
|
//查询料塔是否为空
|
||||||
if (to == null)
|
//if (tLoc == null)
|
||||||
|
//{
|
||||||
|
// //判断是否存在此托盘的出库任务
|
||||||
|
// var containerTask = _unitwork.Find<TaskHeader>(x => x.Status < TaskStatusEnum.已下发
|
||||||
|
// && x.ContainerCode == item.Key
|
||||||
|
// && x.TaskType == TaskTypeEnum.盘料出库)
|
||||||
|
// .Include(x => x.TaskDetails).FirstOrDefault();
|
||||||
|
// if (containerTask != null)
|
||||||
|
// {
|
||||||
|
// foreach (var inventory in item)
|
||||||
|
// {
|
||||||
|
// if (tLoc.Height < tLoc.Length)
|
||||||
|
// {
|
||||||
|
// var detail = new TaskDetail
|
||||||
|
// {
|
||||||
|
// UniqueCode = inventory.UniqueCode,
|
||||||
|
// Lot = $"{Convert.ToInt32(location.Length)}-{tLoc.Code}",
|
||||||
|
// FromLocation = inventory.Lot,
|
||||||
|
// ToLocation = (Convert.ToInt32(tLoc.Height) + 1).ToString(),
|
||||||
|
// Status = TaskStatusEnum.新建,
|
||||||
|
// ContainerCode = inventory.ContainerCode,
|
||||||
|
// CreateTime = DateTime.Now
|
||||||
|
// };
|
||||||
|
// tLoc.Height += 1;
|
||||||
|
// containerTask.Status = TaskStatusEnum.待下发;
|
||||||
|
// containerTask.TaskDetails.Add(detail);
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// _unitwork.Update(tLoc);
|
||||||
|
// _unitwork.Update(containerTask);
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// continue;
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
//else
|
||||||
|
if (tLoc != null)
|
||||||
{
|
{
|
||||||
continue;
|
task.ZoneCode = ZoneCodeEnum.盘料库;
|
||||||
}
|
|
||||||
task.TaskNo = _unitwork.GetSerialNumber("pout", 4);
|
task.TaskNo = _unitwork.GetSerialNumber("pout", 4);
|
||||||
task.TaskType = TaskTypeEnum.盘料出库;
|
task.TaskType = TaskTypeEnum.盘料出库;
|
||||||
task.Status = TaskStatusEnum.待下发;
|
task.Status = TaskStatusEnum.新建;
|
||||||
task.ContainerCode = Inventory.ContainerCode;
|
task.ContainerCode = item.Key;
|
||||||
task.ToLocation = to.Code;
|
task.Priority = 100;
|
||||||
task.ZoneCode = ZoneCodeEnum.盘料库;
|
task.FromLocation = _unitwork
|
||||||
|
.FindSingle<Location>(x => x.ContiguousCode == pTask.ToLocation)?.Code;
|
||||||
|
task.ToLocation = tLoc.Code;
|
||||||
|
task.CreateTime = DateTime.Now;
|
||||||
|
task.CreateBy = "wmsjob";
|
||||||
foreach (var inventory in item)
|
foreach (var inventory in item)
|
||||||
|
{
|
||||||
|
if (tLoc.Height < tLoc.Length)
|
||||||
{
|
{
|
||||||
var detail = new TaskDetail
|
var detail = new TaskDetail
|
||||||
{
|
{
|
||||||
UniqueCode = inventory.UniqueCode,
|
UniqueCode = inventory.UniqueCode,
|
||||||
|
Lot = $"{Convert.ToInt32(location.Length)}-{tLoc.Code}",
|
||||||
FromLocation = inventory.Lot,
|
FromLocation = inventory.Lot,
|
||||||
|
ToLocation = (Convert.ToInt32(tLoc.Height) + 1).ToString(),
|
||||||
Status = TaskStatusEnum.新建,
|
Status = TaskStatusEnum.新建,
|
||||||
ContainerCode = inventory.ContainerCode,
|
ContainerCode = inventory.ContainerCode,
|
||||||
CreateTime = DateTime.Now
|
CreateTime = DateTime.Now
|
||||||
};
|
};
|
||||||
task.TaskDetails.Add(detail);
|
task.TaskDetails.Add(detail);
|
||||||
}
|
tLoc.Height += 1;
|
||||||
_unitwork.Add(task);
|
|
||||||
//更新库位状态
|
|
||||||
var container = _unitwork.Find<Location>(x => x.ContainerCode == Inventory.ContainerCode).FirstOrDefault();
|
|
||||||
if (container != null)
|
|
||||||
{
|
|
||||||
container.Status = LocationStatus.任务锁;
|
|
||||||
_unitwork.Update(container);
|
|
||||||
}
|
|
||||||
|
|
||||||
to.ContainerCode = to.Code;
|
|
||||||
_unitwork.Update(to);
|
|
||||||
//更新库存状态
|
|
||||||
var invs = _unitwork.Find<Inventory>(x => x.ContainerCode == Inventory.ContainerCode).ToList();
|
|
||||||
if (invs.Count() > 0)
|
|
||||||
{
|
|
||||||
foreach (var inv in invs)
|
|
||||||
{
|
|
||||||
inv.TaskStatus = InventoryTaskStatus.任务中;
|
|
||||||
_unitwork.Update(inv);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//更新单据主表状态
|
|
||||||
foreach (var inventory in item)
|
|
||||||
{
|
|
||||||
var shipmentdetail = shipment.ShipmentDetails.Where(x => x.ID == int.Parse(inventory.SourceCode)).FirstOrDefault();
|
|
||||||
if (shipmentdetail != null)
|
|
||||||
{
|
|
||||||
shipmentdetail.Status = ShipStatusEnum.分配完成;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!shipment.ShipmentDetails.Any(x => x.Status < ShipStatusEnum.分配完成))
|
|
||||||
{
|
|
||||||
shipment.FirstStatus = ShipStatusEnum.分配完成;
|
|
||||||
_unitwork.Update(shipment);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
continue;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
_unitwork.Add(pTask);
|
||||||
|
_unitwork.Add(task);
|
||||||
|
//更新库位状态
|
||||||
|
var container = _unitwork.Find<Location>(x => x.ContainerCode == item.Key)
|
||||||
|
.FirstOrDefault();
|
||||||
|
if (container != null)
|
||||||
|
{
|
||||||
|
container.Status = LocationStatus.任务锁;
|
||||||
|
container.UpdateTime = DateTime.Now;
|
||||||
|
container.UpdateBy = "wmsjob";
|
||||||
|
_unitwork.Update(container);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tLoc.ContainerCode = tLoc.Code;
|
||||||
|
tLoc.UpdateBy = "wmsjob";
|
||||||
|
tLoc.UpdateTime = DateTime.Now;
|
||||||
|
_unitwork.Update(tLoc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
tran.Commit();
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
tran.Rollback();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#region 更新时间
|
#region 更新时间
|
||||||
|
|
||||||
@@ -233,6 +313,7 @@ namespace HHWMS.Web
|
|||||||
_unitwork.Update<SysJob>(job);
|
_unitwork.Update<SysJob>(job);
|
||||||
}
|
}
|
||||||
Wtm.DoLog("出库分解", ActionLogTypesEnum.Job, "SendWmsJob");
|
Wtm.DoLog("出库分解", ActionLogTypesEnum.Job, "SendWmsJob");
|
||||||
|
|
||||||
#endregion 更新时间
|
#endregion 更新时间
|
||||||
}
|
}
|
||||||
catch { }
|
catch { }
|
||||||
|
|||||||
@@ -27,18 +27,18 @@
|
|||||||
// "Value": "Server=127.0.0.1;Port=3306;Database=8357wms;Uid=root;Password=abc123*;Character Set=utf8mb4;",
|
// "Value": "Server=127.0.0.1;Port=3306;Database=8357wms;Uid=root;Password=abc123*;Character Set=utf8mb4;",
|
||||||
// "DBType": "mysql"
|
// "DBType": "mysql"
|
||||||
//}
|
//}
|
||||||
{
|
|
||||||
"Key": "default",
|
|
||||||
"Value": "Data Source=.;Initial Catalog=8357wms;User=sa;Password=abc123*;Persist Security Info=True",
|
|
||||||
"DbContext": "DataContext",
|
|
||||||
"DBType": "sqlserver" //DataBase, you can choose mysql,sqlserver,pgsql,sqlite,oracle
|
|
||||||
}
|
|
||||||
//{
|
//{
|
||||||
// "Key": "default",
|
// "Key": "default",
|
||||||
// "Value": "Data Source=10.18.106.4;Initial Catalog=8357wms;User=wms;Password=abc123*;Persist Security Info=True",
|
// "Value": "Data Source=.;Initial Catalog=8357wms;User=sa;Password=abc123*;Persist Security Info=True",
|
||||||
// "DbContext": "DataContext",
|
// "DbContext": "DataContext",
|
||||||
// "DBType": "sqlserver" //DataBase, you can choose mysql,sqlserver,pgsql,sqlite,oracle
|
// "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",
|
||||||
|
"DbContext": "DataContext",
|
||||||
|
"DBType": "sqlserver" //DataBase, you can choose mysql,sqlserver,pgsql,sqlite,oracle
|
||||||
|
}
|
||||||
],
|
],
|
||||||
"CookiePre": "HHWMS", //cookie前缀
|
"CookiePre": "HHWMS", //cookie前缀
|
||||||
"IsQuickDebug": true, //是否启用debug模式
|
"IsQuickDebug": true, //是否启用debug模式
|
||||||
|
|||||||
Reference in new issue
Block a user