修改
This commit is contained in:
1 parent
523dee5e38
commit
f9bf7be066
12 files changed
+635
-42
No files matched your search
@@ -141,7 +141,7 @@ namespace HHWMS.Web
|
||||
{
|
||||
tasktolocatioin.Status = LocationStatus.满货;
|
||||
}
|
||||
else if (invCount < tasktolocatioin.Length)
|
||||
else if (invCount < tasktolocatioin.Length && invCount != 0)
|
||||
{
|
||||
tasktolocatioin.Status = LocationStatus.有货;
|
||||
}
|
||||
@@ -239,13 +239,21 @@ namespace HHWMS.Web
|
||||
// 创建料盒入库任务
|
||||
// 查找回库的任务起点,
|
||||
var fromLocation = _unitwork.FindSingle<Location>(x => x.Code.Equals(task.ToLocation)).ContiguousCode;
|
||||
newTask.ZoneCode = "L";
|
||||
newTask.TaskNo = _unitwork.GetSerialNumber("in", 4);
|
||||
newTask.ZoneCode = ZoneCodeEnum.盘料库;
|
||||
if (task.TaskNo.Contains("PLoop"))
|
||||
{
|
||||
newTask.TaskNo = _unitwork.GetSerialNumber("PLoopin", 4);
|
||||
}
|
||||
else
|
||||
{
|
||||
newTask.TaskNo = _unitwork.GetSerialNumber("in", 4);
|
||||
}
|
||||
newTask.TaskType = TaskTypeEnum.盘料盒入库;
|
||||
newTask.ContainerCode = containerCode;
|
||||
newTask.FromLocation = fromLocation;
|
||||
newTask.ToLocation = containerCode;
|
||||
newTask.Status = TaskStatusEnum.待下发;
|
||||
newTask.CreateTime = DateTime.Now;
|
||||
_unitwork.Add(newTask);
|
||||
//更新料塔占用
|
||||
station.ContainerCode = "";
|
||||
@@ -282,12 +290,20 @@ namespace HHWMS.Web
|
||||
var fromLocation = _unitwork.FindSingle<Location>(x => x.Code.Equals(task.FromLocation)).ContiguousCode;
|
||||
// 下发盘料盒回库任务,回原位
|
||||
newTask.ZoneCode = ZoneCodeEnum.盘料库;
|
||||
newTask.TaskNo = _unitwork.GetSerialNumber("in", 4);
|
||||
if (task.TaskNo.Contains("PLoop"))
|
||||
{
|
||||
newTask.TaskNo = _unitwork.GetSerialNumber("PLoopin", 4);
|
||||
}
|
||||
else
|
||||
{
|
||||
newTask.TaskNo = _unitwork.GetSerialNumber("in", 4);
|
||||
}
|
||||
newTask.TaskType = TaskTypeEnum.盘料盒入库;
|
||||
newTask.ContainerCode = task.ContainerCode;
|
||||
newTask.FromLocation = fromLocation;
|
||||
newTask.ToLocation = task.ContainerCode;
|
||||
newTask.Status = TaskStatusEnum.待下发;
|
||||
newTask.CreateTime = DateTime.Now;
|
||||
_unitwork.Add(newTask);
|
||||
}
|
||||
break;
|
||||
@@ -302,7 +318,10 @@ namespace HHWMS.Web
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
return ApiResultError(msg: $"未找到任务号{taskno}对应的任务!");
|
||||
}
|
||||
return ApiResult();
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<el-col :span="16">
|
||||
<el-input v-model="qrcode"
|
||||
placeholder="请扫描二维码"
|
||||
@@change="scanCode">
|
||||
@@change="scanCode" ref="QrCode">
|
||||
</el-input>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
@@ -72,13 +72,46 @@
|
||||
data: { code: _this.qrcode },
|
||||
url: "/configs/Print/ScanCode",
|
||||
success: function (json) {
|
||||
console.log(json);
|
||||
if (json.Code != 200) {
|
||||
_this.$message({
|
||||
message: "扫描失败!" + json.Msg,
|
||||
type: "warning",
|
||||
duration: "10000",
|
||||
});
|
||||
}
|
||||
}
|
||||
else{
|
||||
$.ajax({
|
||||
type: "post",
|
||||
dataType: "json",
|
||||
data: { code: _this.qrcode },
|
||||
url: "/configs/Print/GenCode",
|
||||
success: function (json) {
|
||||
if (json.Code != 200) {
|
||||
_this.$message({
|
||||
message: "生成失败!" + json.Msg,
|
||||
type: "warning",
|
||||
duration: "10000",
|
||||
});
|
||||
return;
|
||||
}
|
||||
else {
|
||||
_this.gendCode += json.Data + '\n';
|
||||
_this.printData.push({ uniqueCode: json.Data });
|
||||
//清空
|
||||
_this.qrcode = '';
|
||||
}
|
||||
},
|
||||
error: function (json) {
|
||||
_this.$message({
|
||||
message: "生成失败!",
|
||||
type: "error",
|
||||
duration: "10000",
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
}
|
||||
},
|
||||
error: function (json) {
|
||||
_this.$message({
|
||||
@@ -120,14 +153,17 @@
|
||||
},
|
||||
});
|
||||
//清空
|
||||
this.qrcode = '';
|
||||
_this.qrcode = '';
|
||||
},
|
||||
print() {
|
||||
var _this = this;
|
||||
_this.gendCode = "";
|
||||
hiprint.init();
|
||||
var hiprintTemplate = new hiprint.PrintTemplate({
|
||||
template: this.template
|
||||
})
|
||||
hiprintTemplate.print(this.printData);
|
||||
_this.printData = [];
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -42,13 +42,13 @@ public class ReceiptSLInController : BaseController
|
||||
|
||||
// 查找没任务的仓位,分两边查,那边站台能用 查哪边
|
||||
var box = _unitWork.Find<Location>(x => (x.ZoneCode == ZoneCodeEnum.散料库)
|
||||
& (x.Status != LocationStatus.任务锁)
|
||||
&& x.Status != LocationStatus.任务锁
|
||||
&& x.Status != LocationStatus.满货
|
||||
&& x.Status != LocationStatus.空仓位
|
||||
&& x.Row == stations.First().Row).FirstOrDefault();
|
||||
if (box == null && stations.Count == 2)
|
||||
box = _unitWork.Find<Location>(x => (x.ZoneCode == ZoneCodeEnum.散料库)
|
||||
& (x.Status != LocationStatus.任务锁)
|
||||
&& x.Status != LocationStatus.任务锁
|
||||
&& x.Status != LocationStatus.满货
|
||||
&& x.Status != LocationStatus.空仓位
|
||||
&& x.Row == stations.Last().Row).FirstOrDefault();
|
||||
|
||||
@@ -141,8 +141,9 @@ public class ShipOutController : BaseController
|
||||
{
|
||||
// 查找目标库位
|
||||
var toLocation = _unitWork.FindSingle<Location>(x => x.Status.Equals(LocationStatus.空仓位)
|
||||
&& x.Type.Equals(LocationTypeEnum.散料库位)
|
||||
&& x.Row.Equals(box.Row));
|
||||
&& x.Type.Equals(LocationTypeEnum.散料库位)
|
||||
&& x.Code == boxCode
|
||||
&& x.Row.Equals(box.Row));
|
||||
|
||||
if (toLocation != null)
|
||||
{
|
||||
@@ -155,7 +156,7 @@ public class ShipOutController : BaseController
|
||||
ContainerCode = boxCode,
|
||||
FromLocation = box.Code,
|
||||
ToLocation = toLocation.Code,
|
||||
Status = TaskStatusEnum.新建,
|
||||
Status = TaskStatusEnum.待下发,
|
||||
CreateBy = Wtm.LoginUserInfo.ITCode,
|
||||
CreateTime = DateTime.Now
|
||||
};
|
||||
|
||||
@@ -0,0 +1,351 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Reflection.Emit;
|
||||
using System.Threading.Tasks;
|
||||
using HHWMS.Web.Models;
|
||||
using Humanizer;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Newtonsoft.Json;
|
||||
using Quartz;
|
||||
using WalkingTec.Mvvm.Core;
|
||||
using WalkingTec.Mvvm.Core.Support.Quartz;
|
||||
using static HHWMS.Web.Controllers.ReceiptInOperationController;
|
||||
|
||||
namespace HHWMS.Web
|
||||
{
|
||||
//[QuartzRepeat(10,10, true, 30)]
|
||||
//循环创建出库与入库任务
|
||||
[PersistJobDataAfterExecution]
|
||||
[DisallowConcurrentExecution]
|
||||
public class LoopTaskJob : WtmJob
|
||||
{
|
||||
public override Task Execute(IJobExecutionContext context)
|
||||
{
|
||||
try
|
||||
{
|
||||
var _unitwork = new UnitWork(Wtm);
|
||||
|
||||
var PTask = _unitwork.Find<TaskHeader>(x =>x.TaskNo.Contains("PLoop")).Include(x => x.TaskDetails).ToList();
|
||||
var STask = _unitwork.Find<TaskHeader>(x => x.TaskNo.Contains("SLoop")).Include(x => x.TaskDetails).ToList();
|
||||
//没有盘料循环任务
|
||||
if (PTask.Count() == 0)
|
||||
{
|
||||
Location location = _unitwork.Find<Location>(x => x.Type == LocationTypeEnum.料塔
|
||||
&& !string.IsNullOrEmpty(x.ContainerCode)).FirstOrDefault();
|
||||
//创建入库任务
|
||||
if (location != null)
|
||||
{
|
||||
List<Inventory> inventories = _unitwork.Find<Inventory>(x => x.ContainerCode == location.Code).ToList();
|
||||
if (inventories.Count() > 0)
|
||||
{
|
||||
var task = new TaskHeader
|
||||
{
|
||||
TaskNo = _unitwork.GetSerialNumber("PLoopin", 4),
|
||||
TaskType = TaskTypeEnum.盘料入库,
|
||||
Status = TaskStatusEnum.待下发,
|
||||
ZoneCode = ZoneCodeEnum.盘料库,
|
||||
FromLocation = location.Code,
|
||||
TaskDetails = new List<TaskDetail>(),
|
||||
};
|
||||
foreach (var inventorie in inventories)
|
||||
{
|
||||
var detail = new TaskDetail
|
||||
{
|
||||
UniqueCode = inventorie.UniqueCode,
|
||||
FromLocation = inventorie.Lot,
|
||||
Status = TaskStatusEnum.新建,
|
||||
CreateTime = DateTime.Now
|
||||
};
|
||||
task.TaskDetails.Add(detail);
|
||||
}
|
||||
_unitwork.Add(task);
|
||||
|
||||
// 查找符合条件的料盒出库,创建料盒出库任务 length-width, 默认小盘料 找23格的料盒
|
||||
var details = task.TaskDetails.Where(x => x.Status == TaskStatusEnum.新建
|
||||
&& string.IsNullOrEmpty(x.ContainerCode));
|
||||
var count = details.Count();
|
||||
//根据任务库存查询可对应的出库托盘与巷道
|
||||
var Length = 23;
|
||||
Inventory inventory = _unitwork.Find<Inventory>(x => x.ContainerCode == task.FromLocation).FirstOrDefault();
|
||||
if (inventory != null)
|
||||
{
|
||||
switch (inventory.Flag)
|
||||
{
|
||||
case 8:
|
||||
Length = 23;
|
||||
break;
|
||||
case 10:
|
||||
Length = 19;
|
||||
break;
|
||||
case 16:
|
||||
Length = 16;
|
||||
break;
|
||||
case 24:
|
||||
Length = 13;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
var station = _unitwork.FindSingle<Location>(x => x.Type.Equals(LocationTypeEnum.堆垛机工位)
|
||||
&& x.Status != LocationStatus.任务锁);
|
||||
if (task.FromLocation == "L01")
|
||||
{
|
||||
station = _unitwork.Find<Location>(x => x.Type.Equals(LocationTypeEnum.堆垛机工位)
|
||||
&& x.Status != LocationStatus.任务锁).OrderByDescending(x => x.Row).FirstOrDefault();
|
||||
}
|
||||
if (station != null && count > 0)
|
||||
{
|
||||
var container = _unitwork.Find<Location>(x => x.Row == station.Row && x.Type == LocationTypeEnum.盘料库位
|
||||
&& (x.Status == LocationStatus.有货 || x.Status == LocationStatus.空容器) && x.Length == Length && !x.IsStop && x.Height < inventory.Qty)
|
||||
.OrderBy(x => x.Height).FirstOrDefault();
|
||||
if (Length == 23 && container == null && station.Row == 3)
|
||||
{
|
||||
station = _unitwork.Find<Location>(x => x.Type.Equals(LocationTypeEnum.堆垛机工位)
|
||||
&& x.Status != LocationStatus.任务锁 && x.Row == 1).FirstOrDefault();
|
||||
|
||||
container = _unitwork.Find<Location>(x => x.Row == station.Row && x.Type == LocationTypeEnum.盘料库位
|
||||
&& (x.Status == LocationStatus.有货 || x.Status == LocationStatus.空容器) && x.Length == Length && !x.IsStop && x.Height < inventory.Qty)
|
||||
.OrderBy(x => x.Height).FirstOrDefault();
|
||||
}
|
||||
if (station != null && container != null)
|
||||
{
|
||||
var newTask = new TaskHeader();
|
||||
newTask.ZoneCode = ZoneCodeEnum.盘料库;
|
||||
newTask.TaskNo = _unitwork.GetSerialNumber("PLoopout", 4);
|
||||
newTask.TaskType = TaskTypeEnum.盘料盒出库;
|
||||
newTask.ContainerCode = container.Code;
|
||||
newTask.FromLocation = container.Code;
|
||||
newTask.ToLocation = station.Code;
|
||||
newTask.Status = TaskStatusEnum.待下发;
|
||||
newTask.Station = "2";
|
||||
_unitwork.Add(newTask);
|
||||
|
||||
task.ContainerCode += container.ContainerCode;
|
||||
// 更新库位
|
||||
container.Status = LocationStatus.任务锁;
|
||||
container.Height += 1;
|
||||
_unitwork.Update(container);
|
||||
|
||||
// 计算 容器可用格
|
||||
var used = _unitwork.Find<Inventory>(x => x.LocationCode.Equals(container.Code))
|
||||
.Select(x => int.Parse(x.Lot)).ToArray();
|
||||
var caseCount = Convert.ToInt32(container.Length);
|
||||
var caseList = Enumerable.Range(1, caseCount).ToArray();
|
||||
var canUse = caseList.Except(used).ToArray<int>();
|
||||
foreach (var item in canUse)
|
||||
{
|
||||
var detail = details.FirstOrDefault();
|
||||
if (detail != null)
|
||||
{
|
||||
details.First().Lot = $"{task.FromLocation}-{Convert.ToInt32(container.Length)}";
|
||||
details.First().ToLocation = item.ToString();
|
||||
details.First().ContainerCode = container.Code;
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
_unitwork.Update(task);
|
||||
station.Status = LocationStatus.任务锁;
|
||||
_unitwork.Update(station);
|
||||
}
|
||||
else
|
||||
{
|
||||
task.ErrorMsg = "循环任务:库内没有符合条件的盘料箱";
|
||||
_unitwork.Update(task);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//创建出库任务
|
||||
else
|
||||
{
|
||||
List<Inventory> inventories = _unitwork.Find<Inventory>(x => x.ZoneCode == ZoneCodeEnum.盘料库
|
||||
&& x.TaskStatus == InventoryTaskStatus.无任务).OrderBy(x => x.Qty).ToList();
|
||||
if (inventories.Count() > 0)
|
||||
{
|
||||
var Inventorys = inventories.GroupBy(x => x.ContainerCode).ToList();
|
||||
foreach (var item in Inventorys)
|
||||
{
|
||||
var task = new TaskHeader();
|
||||
task.TaskDetails = new List<TaskDetail>();
|
||||
var Inventory = item.FirstOrDefault();
|
||||
//查询剩余满足条件库位有多少个
|
||||
var Length = 23;
|
||||
switch (Inventory.Flag)
|
||||
{
|
||||
case 8:
|
||||
Length = 23;
|
||||
break;
|
||||
case 10:
|
||||
Length = 19;
|
||||
break;
|
||||
case 16:
|
||||
Length = 16;
|
||||
break;
|
||||
case 24:
|
||||
Length = 13;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
var locCon = _unitwork.Find<Location>(x => x.Type == Inventory.ZoneCode
|
||||
&& (x.Status == LocationStatus.有货 || x.Status == LocationStatus.空容器)
|
||||
&& x.Length == Length
|
||||
&& x.Height < Inventory.Qty).Count();
|
||||
if (locCon == 0)
|
||||
{
|
||||
Inventory.Qty += 1;
|
||||
_unitwork.Update(Inventory);
|
||||
continue;
|
||||
}
|
||||
var loc = _unitwork.Find<Location>(x => x.ContainerCode == Inventory.ContainerCode && x.Type == ZoneCodeEnum.盘料库).FirstOrDefault();
|
||||
//查询仓位表是否符合
|
||||
if (loc != null)
|
||||
{
|
||||
var row = 1;
|
||||
if (Inventory.Flag == 8)
|
||||
{
|
||||
row = 3;
|
||||
}
|
||||
else if (Inventory.Flag == 24 || Inventory.Flag == 16 || Inventory.Flag == 10)
|
||||
{
|
||||
row = 1;
|
||||
}
|
||||
//查找料塔工位
|
||||
var to = _unitwork.Find<Location>(x => string.IsNullOrEmpty(x.ContainerCode)
|
||||
&& x.Row == row
|
||||
&& x.Type.Equals(LocationTypeEnum.料塔)).FirstOrDefault();
|
||||
|
||||
task.TaskNo = _unitwork.GetSerialNumber("PLooppout", 4);
|
||||
task.TaskType = TaskTypeEnum.盘料出库;
|
||||
task.Status = TaskStatusEnum.待下发;
|
||||
task.ContainerCode = Inventory.ContainerCode;
|
||||
task.ToLocation = to.Code;
|
||||
task.ZoneCode = ZoneCodeEnum.盘料库;
|
||||
foreach (var inventory in item)
|
||||
{
|
||||
var detail = new TaskDetail
|
||||
{
|
||||
UniqueCode = inventory.UniqueCode,
|
||||
FromLocation = inventory.Lot,
|
||||
Status = TaskStatusEnum.新建,
|
||||
ContainerCode = inventory.ContainerCode,
|
||||
CreateTime = DateTime.Now
|
||||
};
|
||||
task.TaskDetails.Add(detail);
|
||||
}
|
||||
_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);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (STask.Count() ==0)
|
||||
{
|
||||
Location location = _unitwork.Find<Location>(x => x.Type == LocationTypeEnum.散料库站台 && !string.IsNullOrEmpty(x.ContainerCode)).FirstOrDefault();
|
||||
//创建入库任务
|
||||
if (location != null)
|
||||
{
|
||||
// 查找目标库位
|
||||
var toLocation = _unitwork.FindSingle<Location>(x => x.Status.Equals(LocationStatus.空仓位)
|
||||
&& x.Type.Equals(LocationTypeEnum.散料库位)
|
||||
&& x.Code == location.ContainerCode);
|
||||
if (toLocation != null)
|
||||
{
|
||||
// 创建任务
|
||||
var task = new TaskHeader
|
||||
{
|
||||
ZoneCode = ZoneCodeEnum.散料库,
|
||||
TaskNo = _unitwork.GetSerialNumber("SLoopIn"),
|
||||
TaskType = TaskTypeEnum.散料盒入库,
|
||||
ContainerCode = location.ContainerCode,
|
||||
FromLocation = location.Code,
|
||||
ToLocation = toLocation.Code,
|
||||
Status = TaskStatusEnum.待下发,
|
||||
CreateTime = DateTime.Now
|
||||
};
|
||||
_unitwork.Add(task);
|
||||
|
||||
toLocation.Status = LocationStatus.任务锁;
|
||||
toLocation.Height += 1; // 是否满盘
|
||||
_unitwork.Update(toLocation);
|
||||
}
|
||||
}
|
||||
//创建出库任务
|
||||
else
|
||||
{
|
||||
Location location1 = _unitwork.Find<Location>(x => !string.IsNullOrEmpty(x.ContainerCode)
|
||||
&& x.Status != LocationStatus.任务锁
|
||||
&& x.Status != LocationStatus.满货
|
||||
&& x.Type == LocationTypeEnum.散料库位
|
||||
&& x.Status != LocationStatus.空仓位).OrderBy(x => x.Height).FirstOrDefault();
|
||||
if (location1 != null)
|
||||
{
|
||||
var stations = _unitwork.Find<Location>(x => x.Row == location1.Row
|
||||
&& x.Type == LocationTypeEnum.散料库站台).FirstOrDefault();
|
||||
// 创建任务
|
||||
var task = new TaskHeader
|
||||
{
|
||||
ZoneCode = ZoneCodeEnum.散料库,
|
||||
TaskNo = _unitwork.GetSerialNumber("SLoopOut"),
|
||||
TaskType = TaskTypeEnum.散料盒出库,
|
||||
ContainerCode = location1.ContainerCode,
|
||||
FromLocation = location1.ContainerCode,
|
||||
ToLocation = stations.Code,
|
||||
Status = TaskStatusEnum.待下发,
|
||||
CreateTime = DateTime.Now,
|
||||
};
|
||||
_unitwork.Add(task);
|
||||
}
|
||||
}
|
||||
}
|
||||
#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);
|
||||
}
|
||||
Wtm.DoLog("循环任务创建", ActionLogTypesEnum.Job, "LoopTaskJob");
|
||||
#endregion 更新时间
|
||||
}
|
||||
catch { }
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -187,7 +187,7 @@ namespace HHWMS.Web
|
||||
}
|
||||
if (station != null && count > 0)
|
||||
{
|
||||
var container = _unitwork.Find<Location>(x => x.Row == station.Row && x.ZoneCode == LocationTypeEnum.盘料库位
|
||||
var container = _unitwork.Find<Location>(x => x.Row == station.Row && x.Type == LocationTypeEnum.盘料库位
|
||||
&& (x.Status == LocationStatus.有货 || x.Status == LocationStatus.空容器) && x.Length == Length && !x.IsStop)
|
||||
.OrderByDescending(x => x.Length - x.Width).FirstOrDefault();
|
||||
if (Length == 23 && container == null && station.Row == 3)
|
||||
@@ -195,9 +195,10 @@ namespace HHWMS.Web
|
||||
station = _unitwork.Find<Location>(x => x.Type.Equals(LocationTypeEnum.堆垛机工位)
|
||||
&& x.Status != LocationStatus.任务锁 && x.Row == 1).FirstOrDefault();
|
||||
|
||||
container = _unitwork.Find<Location>(x => x.Row == station.Row && x.ZoneCode == LocationTypeEnum.盘料库位
|
||||
container = _unitwork.Find<Location>(x => x.Row == station.Row && x.Type == LocationTypeEnum.盘料库位
|
||||
&& (x.Status == LocationStatus.有货 || x.Status == LocationStatus.空容器) && x.Length == Length && !x.IsStop)
|
||||
.OrderByDescending(x => x.Length - x.Width).FirstOrDefault();
|
||||
|
||||
}
|
||||
if(station != null && container != null)
|
||||
{
|
||||
|
||||
@@ -8,6 +8,7 @@ using HHWMS.Web;
|
||||
using HHWMS.Web.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace HHWMS.Web.Controllers
|
||||
{
|
||||
@@ -245,10 +246,11 @@ namespace HHWMS.Web.Controllers
|
||||
|
||||
if (task != null)
|
||||
{
|
||||
var isSend = 0;
|
||||
// 判断任务 是否能取消
|
||||
if (task.Status < TaskStatusEnum.已下发)
|
||||
{
|
||||
return FFResult().Alert($"此任务未下发,无需取消!");
|
||||
isSend = 1;
|
||||
}
|
||||
else if (task.Status == TaskStatusEnum.完成)
|
||||
{
|
||||
@@ -262,15 +264,93 @@ namespace HHWMS.Web.Controllers
|
||||
};
|
||||
try
|
||||
{
|
||||
var res = Wtm.CallAPI<ApiJsonResult<dynamic>>("WCS", "TaskAssign", HttpMethodEnum.POST, taskInfo).Result.Data;
|
||||
|
||||
if ((bool)res?.Success)
|
||||
if (isSend == 0)
|
||||
{
|
||||
// 删除任务,处理数据
|
||||
var res = Wtm.CallAPI<ApiJsonResult<dynamic>>("WCS", "TaskAssign", HttpMethodEnum.POST, taskInfo).Result.Data;
|
||||
if ((bool)res?.Success)
|
||||
{
|
||||
isSend = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return FFResult().Alert($"操作失败,{res.Msg}");
|
||||
}
|
||||
}
|
||||
else
|
||||
if (isSend == 1)
|
||||
{
|
||||
return FFResult().Alert($"操作失败,{res.Msg}");
|
||||
// 盘料入库,删除子表任务,并且删除子表对应库存,
|
||||
if (task.TaskHeader.TaskType.Equals(TaskTypeEnum.盘料入库))
|
||||
{
|
||||
List<TaskDetail> taskDetails = _unitwork.Find<TaskDetail>(x => x.TaskHeaderId == task.TaskHeader.ID
|
||||
&& x.ID != task.ID).ToList();
|
||||
Inventory inventory = _unitwork.Find<Inventory>(n => n.UniqueCode == task.UniqueCode
|
||||
&& n.ContainerCode == task.TaskHeader.FromLocation
|
||||
&& n.TaskStatus == InventoryTaskStatus.任务中).FirstOrDefault();
|
||||
if (inventory != null)
|
||||
{
|
||||
_unitwork.Delete(inventory);
|
||||
}
|
||||
_unitwork.Delete(task);
|
||||
//子表已经被全部删除,创建盘料盒回库任务
|
||||
if (taskDetails.Count() == 0)
|
||||
{
|
||||
var newTask = new TaskHeader
|
||||
{
|
||||
TaskDetails = new List<TaskDetail>()
|
||||
};
|
||||
var station = _unitwork.Find<Location>(x => x.Code == task.FromLocation).FirstOrDefault();
|
||||
// 创建料盒入库任务
|
||||
// 查找回库的任务起点,
|
||||
var fromLocation = _unitwork.FindSingle<Location>(x => x.Code.Equals(task.ToLocation)).ContiguousCode;
|
||||
newTask.ZoneCode = ZoneCodeEnum.盘料库;
|
||||
newTask.TaskNo = _unitwork.GetSerialNumber("Deletein", 4);
|
||||
newTask.TaskType = TaskTypeEnum.盘料盒入库;
|
||||
newTask.ContainerCode = task.TaskHeader.ContainerCode;
|
||||
newTask.FromLocation = fromLocation;
|
||||
newTask.ToLocation = task.TaskHeader.ContainerCode;
|
||||
newTask.Status = TaskStatusEnum.待下发;
|
||||
newTask.CreateTime = DateTime.Now;
|
||||
_unitwork.Add(newTask);
|
||||
//更新料塔占用
|
||||
station.ContainerCode = "";
|
||||
_unitwork.Update(station);
|
||||
}
|
||||
|
||||
}
|
||||
//盘料出库,删除子表任务,并且恢复子表对应库存,子表全部删除后创建盘料盒回库任务
|
||||
else if (task.TaskHeader.TaskType.Equals(TaskTypeEnum.盘料出库))
|
||||
{
|
||||
List<TaskDetail> taskDetails = _unitwork.Find<TaskDetail>(x => x.TaskHeaderId == task.TaskHeader.ID
|
||||
&& x.ID != task.ID).ToList();
|
||||
Inventory inventory = _unitwork.Find<Inventory>(n => n.UniqueCode == task.UniqueCode
|
||||
&& n.ContainerCode == task.TaskHeader.FromLocation
|
||||
&& n.TaskStatus == InventoryTaskStatus.任务中).FirstOrDefault();
|
||||
if (inventory != null)
|
||||
{
|
||||
inventory.ContainerCode = task.TaskHeader.ContainerCode;
|
||||
inventory.LocationCode = task.TaskHeader.ContainerCode;
|
||||
_unitwork.Update(inventory);
|
||||
}
|
||||
if (taskDetails.Count() == 0)
|
||||
{
|
||||
// 查找回库的任务起点,
|
||||
var fromLocation = _unitwork.FindSingle<Location>(x => x.Code.Equals(task.FromLocation)).ContiguousCode;
|
||||
// 下发盘料盒回库任务,回原位
|
||||
var newTask = new TaskHeader
|
||||
{
|
||||
TaskDetails = new List<TaskDetail>()
|
||||
};
|
||||
newTask.ZoneCode = ZoneCodeEnum.盘料库;
|
||||
newTask.TaskNo = _unitwork.GetSerialNumber("Deletein", 4);
|
||||
newTask.TaskType = TaskTypeEnum.盘料盒入库;
|
||||
newTask.ContainerCode = task.ContainerCode;
|
||||
newTask.FromLocation = fromLocation;
|
||||
newTask.ToLocation = task.ContainerCode;
|
||||
newTask.Status = TaskStatusEnum.待下发;
|
||||
newTask.CreateTime = DateTime.Now;
|
||||
_unitwork.Add(newTask);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Security.Cryptography;
|
||||
using HHWMS.Web.Models;
|
||||
@@ -334,9 +335,10 @@ namespace HHWMS.Web.Controllers
|
||||
|
||||
if (task != null)
|
||||
{
|
||||
if (task.Status > TaskStatusEnum.已下发)
|
||||
var isSend = 0;
|
||||
if (task.Status >= TaskStatusEnum.已下发)
|
||||
{
|
||||
return FFResult().Alert($"此任务未下发,无需取消!");
|
||||
isSend = 1;
|
||||
}
|
||||
// 判断任务 是否能取消
|
||||
if (task.TaskType.Equals(TaskTypeEnum.盘料入库) || task.TaskType.Equals(TaskTypeEnum.盘料出库))
|
||||
@@ -350,10 +352,100 @@ namespace HHWMS.Web.Controllers
|
||||
};
|
||||
try
|
||||
{
|
||||
var res = Wtm.CallAPI<ApiJsonResult<dynamic>>("WCS", "TaskAssign", HttpMethodEnum.POST, taskInfo).Result.Data;
|
||||
var res = new ApiJsonResult<dynamic>();
|
||||
if (isSend == 1)
|
||||
{
|
||||
res = Wtm.CallAPI<ApiJsonResult<dynamic>>("WCS", "TaskAssign", HttpMethodEnum.POST, taskInfo).Result.Data;
|
||||
}
|
||||
else
|
||||
{
|
||||
res.Success = true;
|
||||
}
|
||||
if ((bool)res?.Success)
|
||||
{
|
||||
// 删除任务,处理数据
|
||||
//盘料盒出库任务删除,连带删除盘料入库和盘料出库任务
|
||||
if (task.TaskType.Equals(TaskTypeEnum.盘料盒出库))
|
||||
{
|
||||
//库位恢复原位
|
||||
List<Location> locations = _unitwork.Find<Location>(x => x.Code == task.FromLocation || x.Code == task.ToLocation).ToList();
|
||||
foreach (var location in locations)
|
||||
{
|
||||
//原仓位数据还原为在仓位的初始状态
|
||||
if (location.Code == task.ContainerCode)
|
||||
{
|
||||
location.ContainerCode = task.ContainerCode;
|
||||
location.Status = LocationStatus.有货;
|
||||
}
|
||||
else
|
||||
{
|
||||
location.ContainerCode = "";
|
||||
location.Status = LocationStatus.空仓位;
|
||||
}
|
||||
_unitwork.Update(location);
|
||||
}
|
||||
//物料恢复原位
|
||||
List<Inventory> inventories = _unitwork.Find<Inventory>(x => x.ContainerCode == task.ContainerCode).ToList();
|
||||
foreach (var inventorie in inventories)
|
||||
{
|
||||
inventorie.LocationCode = task.ContainerCode;
|
||||
inventorie.TaskStatus = InventoryTaskStatus.无任务;
|
||||
_unitwork.Update(inventorie);
|
||||
}
|
||||
//删除任务
|
||||
_unitwork.Delete(task);
|
||||
//删除盘料入库任务和库存
|
||||
TaskHeader taskHeader = _unitwork.Find<TaskHeader>(x => x.ContainerCode == task.ContainerCode
|
||||
&& (x.TaskType.Equals(TaskTypeEnum.盘料入库) || x.TaskType.Equals(TaskTypeEnum.盘料出库))).FirstOrDefault();
|
||||
if (taskHeader != null && taskHeader.TaskType.Equals(TaskTypeEnum.盘料入库))
|
||||
{
|
||||
List<Inventory> inventories1 = _unitwork.Find<Inventory>(x => x.ContainerCode == taskHeader.FromLocation
|
||||
&& x.TaskStatus == InventoryTaskStatus.任务中).ToList();
|
||||
foreach (var inventorie1 in inventories1)
|
||||
{
|
||||
_unitwork.Delete(inventorie1);
|
||||
}
|
||||
_unitwork.Delete(taskHeader);
|
||||
|
||||
}
|
||||
//删除盘料出库任务
|
||||
else if (taskHeader != null && taskHeader.TaskType.Equals(TaskTypeEnum.盘料出库))
|
||||
{
|
||||
_unitwork.Delete(taskHeader);
|
||||
}
|
||||
}
|
||||
//盘料盒入库任务删除,托盘恢复原位
|
||||
else if (task.TaskType.Equals(TaskTypeEnum.盘料盒入库))
|
||||
{
|
||||
// 删除任务,处理数据
|
||||
List<Location> locations = _unitwork.Find<Location>(x => x.ContainerCode == task.ContainerCode).ToList();
|
||||
foreach (var location in locations)
|
||||
{
|
||||
//原仓位数据还原为在仓位的初始状态
|
||||
if (location.Code == task.ContainerCode)
|
||||
{
|
||||
location.ContainerCode = task.ContainerCode;
|
||||
location.Status = LocationStatus.有货;
|
||||
}
|
||||
else
|
||||
{
|
||||
location.ContainerCode = "";
|
||||
location.Status = LocationStatus.空仓位;
|
||||
}
|
||||
_unitwork.Update(location);
|
||||
}
|
||||
List<Inventory> inventories = _unitwork.Find<Inventory>(x => x.ContainerCode == task.ContainerCode).ToList();
|
||||
foreach (var inventorie in inventories)
|
||||
{
|
||||
inventorie.LocationCode = task.ContainerCode;
|
||||
inventorie.TaskStatus = InventoryTaskStatus.无任务;
|
||||
_unitwork.Update(inventorie);
|
||||
}
|
||||
_unitwork.Delete(task);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return FFResult().Alert($"操作失败,{res.Msg}");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
@@ -34,8 +34,10 @@ namespace HHWMS.Web
|
||||
public ExcelPropety Status_Excel = ExcelPropety.CreateProperty<TaskHeader>(x => x.Status);
|
||||
[Display(Name = "Task.ErrorMsg")]
|
||||
public ExcelPropety ErrorMsg_Excel = ExcelPropety.CreateProperty<TaskHeader>(x => x.ErrorMsg);
|
||||
[Display(Name = "Task.CreateTime")]
|
||||
public ExcelPropety CreateTime_Excel = ExcelPropety.CreateProperty<TaskHeader>(x => x.CreateTime);
|
||||
|
||||
protected override void InitVM()
|
||||
protected override void InitVM()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -57,16 +57,20 @@ namespace HHWMS.Web
|
||||
{
|
||||
string rv = UIService.MakeScriptButton(ButtonTypesEnum.Link,a.TaskNo,$"details('{a.ID}')");
|
||||
return rv;
|
||||
}),
|
||||
this.MakeGridHeader(x => x.TaskType),
|
||||
this.MakeGridHeader(x => x.FromLocation),
|
||||
this.MakeGridHeader(x => x.ToLocation),
|
||||
this.MakeGridHeader(x => x.Station),
|
||||
this.MakeGridHeader(x => x.ContainerCode),
|
||||
this.MakeGridHeader(x => x.RoadWay),
|
||||
this.MakeGridHeader(x => x.Priority),
|
||||
this.MakeGridHeader(x => x.Status),
|
||||
this.MakeGridHeader(x => x.ErrorMsg),
|
||||
}).SetWidth(150),
|
||||
this.MakeGridHeader(x => x.TaskType,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.RoadWay, 150),
|
||||
this.MakeGridHeader(x => x.Priority, 150),
|
||||
this.MakeGridHeader(x => x.Status, 150),
|
||||
this.MakeGridHeader(x => x.ErrorMsg, 150),
|
||||
this.MakeGridHeader(x => x.CreateTime, 150),
|
||||
this.MakeGridHeader(x => x.CreateBy, 150),
|
||||
this.MakeGridHeader(x => x.UpdateTime, 150),
|
||||
this.MakeGridHeader(x => x.UpdateBy, 150),
|
||||
this.MakeGridHeaderAction(width: 200)
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@model HHWMS.Web.TaskHeaderVM
|
||||
@model HHWMS.Web.TaskHeaderVM
|
||||
@inject IStringLocalizer<Program> Localizer;
|
||||
|
||||
<wt:form vm="@Model">
|
||||
@@ -14,6 +14,7 @@
|
||||
<wt:display field="Entity.Priority" />
|
||||
<wt:display field="Entity.Status" />
|
||||
<wt:display field="Entity.ErrorMsg" />
|
||||
<wt:display field="Entity.CreateTime" />
|
||||
</wt:row>
|
||||
<wt:row align="AlignEnum.Right">
|
||||
<wt:closebutton />
|
||||
|
||||
@@ -22,14 +22,20 @@
|
||||
},
|
||||
|
||||
"Connections": [
|
||||
//{
|
||||
// "Key": "default",
|
||||
// "Value": "Server=127.0.0.1;Port=3306;Database=8357wms;Uid=root;Password=abc123*;Character Set=utf8mb4;",
|
||||
// "DBType": "mysql"
|
||||
//}
|
||||
{
|
||||
"Key": "default",
|
||||
"Value": "Server=127.0.0.1;Port=3306;Database=8357wms;Uid=root;Password=abc123*;Character Set=utf8mb4;",
|
||||
"DBType": "mysql"
|
||||
"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",
|
||||
// "Value": "Data Source=.;Initial Catalog=8357wms;User=sa;Password=abc123*;Persist Security Info=True",
|
||||
// "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
|
||||
//}
|
||||
|
||||
Reference in new issue
Block a user