using PlcSiemens.Core.Extension;
using ServiceCenter.Extensions;
using ServiceCenter.Logs;
using ServiceCenter.SqlSugars;
using SqlSugar;
using System.ComponentModel;
using WCS.Core;
using WCS.Entity;
using WCS.Entity.Protocol.BCR;
using WCS.Entity.Protocol.RGV;
using WCS.Entity.Protocol.Robot;
using WCS.Entity.Protocol.Station;
using WCS.Entity.Protocol.Truss;
using WCS.WorkEngineering.Extensions;
using WCS.WorkEngineering.Worlds;
using DeviceFlags = WCS.WorkEngineering.Extensions.DeviceFlags;
using TaskStatus = WCS.Entity.TaskStatus;
using TaskType = WCS.Entity.TaskType;
namespace WCS.WorkEngineering.Systems
{
///
/// RGV交互系统
///
[BelongTo(typeof(RgvWorld))]
[Description("RGV交互系统")]
public class RGVSystems : DeviceSystem>
{
protected override bool ParallelDo => true;
///
/// 取货点设备集合
///
private readonly Dictionary>> _pickUpDevices = new();
public RGVSystems()
{
//获取所有的巷道集合
var rgvList = Device.All.Where(v => v.HasFlag(DeviceFlags.RGV));
foreach (var rgv in rgvList)
{
_pickUpDevices.Add(rgv.Code, rgv.Sources.Where(v => v.HasFlag(DeviceFlags.输送机)).Select(v => new Device(v, this.World)).ToList());
}
}
public override void Do(Device obj)
{
try
{
if (obj.Data.VoucherNo != obj.Data2.VoucherNo)
{
World.Log($"凭证号不一致,DB520:{obj.Data.VoucherNo}-DB521:{obj.Data2.VoucherNo}", LogLevelEnum.High);
return;
}
if (obj.Data2.WorkMode != RGVWorkMode.Automatic)
{
World.Log(obj.Data2.WorkMode.GetDescription());
return;
}
//wcs任务完成确认信号未清除
if (obj.Data.RES1 == 1)
{
World.Log("wcs任务完成确认信号未清除");
return;
}
if (obj.Data2.Status.HasFlag(RGVStatus.Taskfinishi))
{
switch (obj.Data2.CmdType)
{
case RGVCmdType.PickGoods: //单独取货任务完成,默认只有空托盘才会下发单独取货任务
World.Log($"任务处理:开始-取货完成-任务号[{obj.Data2.TaskNumber}]起始地址[{obj.Data2.StartPosition}]目标地址[{obj.Data2.DestPosition}]");
//开始申请读码信息
var bcrCode = obj.Data3.GetBCRCode();
if (bcrCode.IsNullOrWhiteSpace() || bcrCode.Contains(":"))
{
World.Log("扫码失败,内容为空", LogLevelEnum.Mid);
return;
}
World.Log($"任务处理:扫码结果-{bcrCode}");
var taskNumber = 0;
SqlSugarHelper.Do(_db =>
{
var db = _db.Default;
//检查库存表是否有残留库存信息
if (db.Queryable().Any(x => x.ContGrpBarCode == bcrCode))
{
//删除库存
var invNow = db.Queryable().Where(x => x.ContGrpBarCode == bcrCode).OrderByDescending(x => x.AddTime).First();
if (invNow.IsTorsChk) //是一楼码垛入库
{
db.DeleteableRowLock(invNow).ExecuteCommand(); //删除库存
var invInit = db.Queryable().Where(x => x.ContGrpBarCode == bcrCode).OrderByDescending(x => x.AddTime).First();
db.DeleteableRowLock(invInit).ExecuteCommand();//删除条码
var taskInfos = db.Queryable().Where(x => x.BarCode == bcrCode && x.Status == TaskStatus.NewBuild && x.BusType == "人工满托入库").ToList();
foreach (var task in taskInfos)
{
//取消任务
task.Status = TaskStatus.Cancel;
task.ManualRemarks = "托盘已使用,需在二楼组盘";
db.Updateable(task).ExecuteCommand();
task.AddWCS_TASK_DTL(db, obj.Entity.Code, "", "取消任务");
}
}
World.Log($"【{obj.Entity.Code}】上的托盘 【{bcrCode}】存在历史库存信息,请检查对应托盘条码是否存在未完成的出库任务!!!!!", LogLevelEnum.High);
return;
}
var dev = Device.All.First(x => x.Code == obj.Data2.DestPosition.ToString());
if (dev.HasFlag(DeviceFlags.桁架码垛位))
{
//开始绑定任务,并下发新的任务信息到小车
var palletizingInfo = db.Queryable().Single(x => x.Id == obj.Data2.TaskNumber);
if (palletizingInfo == null)
{
World.Log($"未找到对应的码垛信息{obj.Data2.TaskNumber}", LogLevelEnum.Mid);
return;
}
palletizingInfo.PalleCode = bcrCode;
db.UpdateableRowLock(palletizingInfo).UpdateColumns(x => new { x.PalleCode }).ExecuteCommand();
taskNumber = palletizingInfo.Id;
World.Log($"任务处理:当前任务为桁架区域补空托任务");
}
else if (dev.HasFlag(DeviceFlags.环形库码垛工位))
{
//开始处理对应的搬运任务信息
var task = db.Queryable().UpdLock().First(x => x.Type == TaskType.Delivery && x.ID == obj.Data2.TaskNumber && x.AddrTo == obj.Data2.DestPosition.ToString());
if (task == null)
{
World.Log($"未找到对应的搬运任务{obj.Data2.TaskNumber}", LogLevelEnum.Mid);
return;
}
task.BarCode = bcrCode;
db.UpdateableRowLock(task).UpdateColumns(x => new { x.BarCode }).ExecuteCommand();
task.AddWCS_TASK_DTL(db, obj.Entity.Code, obj.Data2.DestPosition.ToString(), $"环形库码垛位{obj.Data2.DestPosition}搬运任务绑定条码信息{bcrCode}");
taskNumber = task.ID;
World.Log($"任务处理:当前任务为环形库区域补空托任务");
}
});
if (taskNumber == 0)
{
World.Log($"取货完成处理失败", LogLevelEnum.Mid);
return;
}
//清空目标点信息
var destDev = new Device(Device.All.FirstOrDefault(x => x.Code == obj.Data2.DestPosition.ToString())!, World);
destDev.Data.TaskNumber = 0;
destDev.Data.GoodsStart = 0;
destDev.Data.GoodsEnd = 0;
obj.Data2.TaskNumber = taskNumber;
obj.Data.RES1 = 1;
World.Log($"任务处理:结束-取货完成-任务号[{obj.Data2.TaskNumber}]起始地址[{obj.Data2.StartPosition}]目标地址[{obj.Data2.DestPosition}]");
break;
case RGVCmdType.PutGoods:
Device destPosition = null;
bool isPalletizing = false;
try
{
World.Log($"任务处理:开始-放货完成-任务号[{obj.Data2.TaskNumber}]起始地址[{obj.Data2.StartPosition}]目标地址[{obj.Data2.DestPosition}]");
WCS_TaskInfo finishiTask = null;
var startPosition = Device.All.Where(x => x.Code == obj.Data2.StartPosition.ToString())
.Select(x => new Device(x, World))
.FirstOrDefault();
destPosition = Device.All.FirstOrDefault(x => x.Code == obj.Data2.DestPosition.ToString());
isPalletizing = destPosition!.HasFlag(DeviceFlags.桁架码垛位, DeviceFlags.环形库码垛工位);
short countQty = 0;
short shortCode = 0;
SqlSugarHelper.Do(_db =>
{
var db = _db.Default;
if (isPalletizing)
{
if (destPosition.HasFlag(DeviceFlags.桁架码垛位))
{
var palletizingInfo = db.Queryable()
.First(x => x.Id == obj.Data.TaskNumber);
countQty = palletizingInfo.CountQty.ToShort();
shortCode = palletizingInfo.ShortCode;
World.Log($"任务处理:当前任务为桁架区域补空托任务");
}
else if (destPosition.HasFlag(DeviceFlags.环形库码垛工位))
{
var deliveryTask = db.Queryable().UpdLock()
.First(x => x.ID == obj.Data.TaskNumber);
countQty = deliveryTask.FullQty;
shortCode = deliveryTask.PalletType;
deliveryTask.Status = TaskStatus.RgvCompleted;
deliveryTask.EditTime = DateTime.Now;
deliveryTask.LastInteractionPoint = obj.Entity.Code;
db.Updateable(deliveryTask).UpdateColumns(x => new { x.Status, x.EditTime, x.LastInteractionPoint }).ExecuteCommand();
deliveryTask.AddWCS_TASK_DTL(db, deliveryTask.AddrTo, $"RGV任务执行结束");
World.Log($"任务处理:当前任务为环形库区域补空托任务");
}
}
});
if (startPosition.Data.TaskNumber == obj.Data.TaskNumber) //初始化起始点信息
{
startPosition.Data.TaskNumber = 0;
startPosition.Data.GoodsEnd = 0;
World.Log($"任务处理:初始化取货点{startPosition.Entity.Code}任务及目标地址信息");
}
//目标地址是码垛工位
if (isPalletizing)
{
if (destPosition.HasFlag(DeviceFlags.桁架码垛位))
{
var dest = new Device(destPosition!, World);
if (dest.Data2.MaxQuantity == 0)
{
dest.Data.MaxQuantity = countQty;
dest.Data.Quantity = 0;
dest.Data.Type = shortCode;
dest.Data.VoucherNo++;
World.Log($"任务处理:写入码垛信息-码垛位[{dest.Entity.Code}]最大码垛数量[{dest.Data.MaxQuantity}]已码数量[{dest.Data.Quantity}]垛形[{dest.Data.Type}]凭证号[{dest.Data.VoucherNo}]");
}
else {
World.Log($"桁架垛型信息未清除,无法写入新垛型信息请检查确认,最大码垛数量[{dest.Data.MaxQuantity}]已码数量[{dest.Data.Quantity}]垛形[{dest.Data.Type}]凭证号[{dest.Data.VoucherNo}]",LogLevelEnum.Mid);
return;
}
}
else if (destPosition.HasFlag(DeviceFlags.环形库码垛工位))
{
var dest = new Device(destPosition!, World);
dest.Data.MaxQuantity = countQty;
dest.Data.Type = shortCode;
dest.Data.VoucherNo++;
World.Log($"任务处理:写入码垛信息-码垛位[{dest.Entity.Code}]最大码垛数量[{dest.Data.MaxQuantity}]垛形[{dest.Data.Type}]凭证号[{dest.Data.VoucherNo}]");
}
}
}
catch (Exception e)
{
World.Log($"处理小车放货完成是出现错误:{e.Message}-{e.StackTrace}");
return;
}
obj.Data.RES1 = 1;
World.Log($"任务处理:结束-放货完成-任务号[{obj.Data2.TaskNumber}]起始地址[{obj.Data2.StartPosition}]目标地址[{obj.Data2.DestPosition}]");
break;
case RGVCmdType.Move:
World.Log($"任务处理:开始-移动完成-任务号[{obj.Data2.TaskNumber}]目标地址[{obj.Data2.DestPosition}]");
obj.Data.RES1 = 1;
World.Log($"任务处理:结束-移动完成-任务号[{obj.Data2.TaskNumber}]目标地址[{obj.Data2.DestPosition}]");
break;
case RGVCmdType.ChangePutGoods:
break;
case RGVCmdType.ChangePickGoods:
break;
case RGVCmdType.PickPutGoods:
World.Log($"任务处理:开始-取放货完成-任务号[{obj.Data2.TaskNumber}]起始地址[{obj.Data2.StartPosition}]目标地址[{obj.Data2.DestPosition}]");
var statDev = Device.All.FirstOrDefault(x => x.Code == obj.Data.StartPosition.ToString());
var stDev = new Device(Device.All.FirstOrDefault(x => x.Code == obj.Data.StartPosition.ToString())!, World);
stDev.Data.TaskNumber = 0;
stDev.Data.GoodsStart = 0;
stDev.Data.GoodsEnd = 0;
World.Log($"任务处理:清除目标地址信息-目标货位{stDev.Entity.Code}");
obj.Data.RES1 = 1;
World.Log($"任务处理:结束-取放货完成-任务号[{obj.Data2.TaskNumber}]起始地址[{obj.Data2.StartPosition}]目标地址[{obj.Data2.DestPosition}]");
break;
default:
throw new ArgumentOutOfRangeException();
}
return;
}
if (obj.Data2.SystemStatus != RGVSystemStatus.空闲)
{
World.Log(obj.Data2.SystemStatus.GetDescription());
return;
}
if (obj.Data2.Status.HasFlag(RGVStatus.RES1)) //离开非安全区域
{
World.Log($"任务处理:开始-下发移动任务-任务号[{obj.Data.TaskNumber}]任务类型[{obj.Data.CmdType}]目标地址[{obj.Data.DestPosition}]凭证号[{obj.Data.VoucherNo}]");
obj.Data.TaskNumber = obj.Data.TaskNumber;
obj.Data.CmdType = RGVCmdType.Move;
obj.Data.DestPosition = obj.Entity.Code switch
{
"RGV1" => 1668,
"RGV2" => 1683,
"RGV3" => 1698,
"RGV4" => 1713,
"RGV5" => 1728,
"RGV6" => 1743,
_ => throw new ArgumentOutOfRangeException()
};
obj.Data.VoucherNo++;
World.Log($"任务处理:结束-下发移动任务-任务号[{obj.Data.TaskNumber}]任务类型[{obj.Data.CmdType}]目标地址[{obj.Data.DestPosition}]凭证号[{obj.Data.VoucherNo}]");
return;
}
if (obj.Data2.CmdType == RGVCmdType.PickGoods && !obj.Data2.Status.HasFlag(RGVStatus.Taskfinishi))
{
if (obj.Data2.Status.HasFlag(RGVStatus.PH_Status))
{
World.Log($"任务处理:开始-下发放货任务-任务号[{obj.Data.TaskNumber}]任务类型[{obj.Data.CmdType}]起始地址[{obj.Data.StartPosition}]目标地址[{obj.Data.DestPosition}]凭证号[{obj.Data.VoucherNo}]");
obj.Data.TaskNumber = obj.Data.TaskNumber;
obj.Data.CmdType = RGVCmdType.PutGoods;
obj.Data.StartPosition = obj.Data2.StartPosition;
obj.Data.DestPosition = obj.Data2.DestPosition;
obj.Data.VoucherNo++;
World.Log($"任务处理:结束-下发放货任务-任务号[{obj.Data.TaskNumber}]任务类型[{obj.Data.CmdType}]起始地址[{obj.Data.StartPosition}]目标地址[{obj.Data.DestPosition}]凭证号[{obj.Data.VoucherNo}]");
return;
}
}
var pickUpDevices = _pickUpDevices.FirstOrDefault(x => x.Key == obj.Entity.Code).Value;
//有货且需要搬运货物的站台
var devs = pickUpDevices.Where(v => v.Data3.Status.HasFlag(StationStatus.PH_Status) && v.Data.TaskNumber != 0)
.Where(v => v.Entity.Code.ToShort() != v.Data.GoodsEnd && v.Data.GoodsEnd != 0)
.ToList();
//筛选出目标站台无货的站台
var putDev = obj.Entity.Targets.Where(x => x.HasFlag(DeviceFlags.输送机))
.Select(x => new Device(x, World))
.Where(x => !x.Data3.Status.HasFlag(StationStatus.PH_Status))
.Where(x => !x.Data3.Status.HasFlag(StationStatus.OT_Status))
.Select(x => x.Entity.Code.ToShort());
//var devList = devs.OrderBy(x => x.Entity.Code).Where(x => putDev.Contains(x.Data.GoodsEnd));
var devList = devs.OrderBy(x => x.Data.TaskNumber).Where(x => putDev.Contains(x.Data.GoodsEnd));
if (!devList.Any())
{
World.Log($"无可用任务");
}
foreach (var dev in devList)
{
//区分任务是拆盘机到码垛工位,还是码垛工位到拆盘机
if (dev.Entity.HasFlag(DeviceFlags.拆盘机))
{
World.Log($"任务处理:开始-下发取货任务-任务号[{obj.Data.TaskNumber}]任务类型[{obj.Data.CmdType}]RGV运行状态[{obj.Data2.WorkMode.GetDescription()}]起始地址[{obj.Data.StartPosition}]目标地址[{obj.Data.DestPosition}]凭证号[{obj.Data.VoucherNo}]");
obj.Data.TaskNumber = dev.Data.TaskNumber;
obj.Data.CmdType = RGVCmdType.PickGoods;
obj.Data.StartPosition = dev.Entity.Code.ToShort();
obj.Data.DestPosition = dev.Data.GoodsEnd;
obj.Data.VoucherNo++;
World.Log($"任务处理:结束-下发取货任务-任务号[{obj.Data.TaskNumber}]任务类型[{obj.Data.CmdType}]起始地址[{obj.Data.StartPosition}]目标地址[{obj.Data.DestPosition}]凭证号[{obj.Data.VoucherNo}]");
return;
}
//if (dev.Entity.HasFlag(DeviceFlags.二次码垛RGV取货口))
//{
// obj.Data.TaskNumber = dev.Data.TaskNumber;
// obj.Data.CmdType = RGVCmdType.PickPutGoods;
// obj.Data.StartPosition = dev.Entity.Code.ToShort();
// obj.Data.DestPosition = dev.Data.GoodsEnd;
// obj.Data.VoucherNo++;
// return;
//}
World.Log($"任务处理:开始-下发满托入库任务-任务号[{obj.Data.TaskNumber}]任务类型[{obj.Data.CmdType}]RGV运行状态[{obj.Data2.WorkMode.GetDescription()}]起始地址[{obj.Data.StartPosition}]目标地址[{obj.Data.DestPosition}]凭证号[{obj.Data.VoucherNo}]");
//非拆盘机起始任务
//站台中的任务号
WCS_TaskInfo task = null;
SqlSugarHelper.Do(_db =>
{
var db = _db.Default;
var taskInfo = db.Queryable().First(p => p.ID == dev.Data.TaskNumber && p.Status == TaskStatus.ConveyorExecution);
if (taskInfo == null)
{
World.Log($"任务处理:未找到对应的任务{dev.Entity.Code}--{dev.Data.TaskNumber}-1");
return;
}
taskInfo.Status = TaskStatus.RgvExecution;
taskInfo.AddrNext = obj.Entity.Code;
taskInfo.EditWho = "WCS";
taskInfo.EditTime = DateTime.Now; ;
db.UpdateableRowLock(taskInfo).UpdateColumns(x => new { x.Status, x.AddrNext, x.EditWho, x.EditTime }).ExecuteCommand();
taskInfo.AddWCS_TASK_DTL(db, dev.Entity.Code, obj.Entity.Code, $"任务分配至{obj.Entity.Code}");
task = taskInfo;
});
if (task == null)
{
World.Log($"任务处理:未找到对应的任务{dev.Entity.Code}--{dev.Data.TaskNumber}-2");
return;
}
World.Log($"任务处理:满托入库业务流程处理完成-任务[{task.ID}]状态已变更为[{task.Status}]开始准备写入PLC");
obj.Data.TaskNumber = task.ID;
obj.Data.CmdType = RGVCmdType.PickPutGoods;
obj.Data.StartPosition = dev.Entity.Code.ToShort();
obj.Data.DestPosition = dev.Data.GoodsEnd;
obj.Data.VoucherNo++;
World.Log($"任务处理:结束-下发满托入库任务-任务号[{obj.Data.TaskNumber}]任务类型[{obj.Data.CmdType}]起始地址[{obj.Data.StartPosition}]目标地址[{obj.Data.DestPosition}]凭证号[{obj.Data.VoucherNo}]");
return;
}
}
catch (Exception ex)
{
if (ex.Message == "Destination array was not long enough. Check the destination index, length, and the array's lower bounds")
{
World.Log($"未知异常:{ex.StackTrace}");
}
else if (ex.Message == "Number was less than the array's lower bound in the first dimension")
{
World.Log($"未知异常:{ex.StackTrace}");
}
else throw new KnownException(ex.Message, LogLevelEnum.Mid);
}
}
public override bool Select(Device dev)
{
return dev.Code is "RGV1" or "RGV2" or "RGV3" or "RGV4" or "RGV5" or "RGV6";
//return dev.HasFlag(Extensions.DeviceFlags.RGV);
}
}
///
/// 库存表
///
[SugarTable("Bill_InvNow")]
public partial class BillInvnow : BaseModel
{
///
/// 仓库ID 关联仓库表 ID
///
[SugarColumn(ColumnDataType = "bigint", IsNullable = false)]
public long WarehouseId { get; set; }
///
/// 组盘ID
/// 创建库存的时候 获取条码表ContGrpId
///
[SugarColumn(ColumnDataType = "bigint", IsNullable = false)]
public long ContGrpId { get; set; }
///
/// 容器条码 同联容器表容器条码 ContBarCode
///
[SugarColumn(ColumnDataType = "nvarchar", Length = 50, IsNullable = true)]
public string ContGrpBarCode { get; set; }
///
/// 组盘类型(1物料盘 2空盘)
///
[SugarColumn(IsNullable = true)]
public FJContGrpType ContGrpType { get; set; }
///
/// 箱条码
///
[SugarColumn(ColumnDataType = "nvarchar", Length = 50, IsNullable = true)]
public string BoxBarCode { get; set; }
///
/// Bom单号 关联投料单 帘线工序工单号 BillCode
///
[SugarColumn(ColumnDataType = "nvarchar", Length = 50, IsNullable = true)]
public string BomDocsNo { get; set; }
///
/// Bom物料ID
///
[SugarColumn(ColumnDataType = "bigint", IsNullable = false)]
public long BomMatId { get; set; }
///
/// Bom物料编号
///
[SugarColumn(ColumnDataType = "nvarchar", Length = 50, IsNullable = true)]
public string BomMatCode { get; set; }
///
/// Bom物料
///
[SugarColumn(ColumnDataType = "nvarchar", Length = 100, IsNullable = true)]
public string BomMatName { get; set; }
///
/// 垛形主表 ID
///
[SugarColumn(ColumnDataType = "bigint", IsNullable = false)]
public long BomSetId { get; set; }
///
/// 垛型编码
///
[SugarColumn(ColumnDataType = "nvarchar", Length = 100, IsNullable = true)]
public string SetGrpCode { get; set; }
///
/// 库存状态码
///
[SugarColumn(ColumnDataType = "nvarchar", Length = 50, IsNullable = true)]
public string ExecStateCode { get; set; }
///
/// 单据编号 关联单据表单据编号 DocsNo
///
[SugarColumn(ColumnDataType = "nvarchar", Length = 50, IsNullable = true)]
public string ExecDocsNo { get; set; }
///
/// 单据行号
///
[SugarColumn(ColumnDataType = "nvarchar", Length = 50, IsNullable = true)]
public string ExecDocsRowNo { get; set; }
///
/// 单据类型编号 同单据表TypeNum
///
[SugarColumn(ColumnDataType = "nvarchar", Length = 50, IsNullable = true)]
public string ExecDocsTypeCode { get; set; }
///
/// 出入库标识
///
[SugarColumn(ColumnDataType = "int", IsNullable = false)]
public FJInvInOutType InvInOut { get; set; }
///
/// 执行人
///
[SugarColumn(ColumnDataType = "nvarchar", Length = 50, IsNullable = true)]
public string ExecWho { get; set; }
///
/// 执行时间
///
[SugarColumn(ColumnDataType = "datetime", IsNullable = false)]
public DateTime ExecTime { get; set; }
///
/// 行
///
[SugarColumn(ColumnDataType = "int", IsNullable = false)]
public int PutRow { get; set; }
///
/// 列
///
[SugarColumn(ColumnDataType = "int", IsNullable = false)]
public int PutCol { get; set; }
///
/// 层
///
[SugarColumn(ColumnDataType = "int", IsNullable = false)]
public int PutLayer { get; set; }
///
/// 入库条码号 FJ材料号
///
[SugarColumn(ColumnDataType = "nvarchar", Length = 50, IsNullable = true)]
public string InvBarCode { get; set; }
///
/// 库存状态
///
[SugarColumn(ColumnDataType = "nvarchar", Length = 50, IsNullable = true)]
public string InvStateCode { get; set; }
///
/// 入库单号
///
[SugarColumn(ColumnDataType = "nvarchar", Length = 50, IsNullable = true)]
public string InDocsNo { get; set; }
///
/// 入库单行号
///
[SugarColumn(ColumnDataType = "nvarchar", Length = 50, IsNullable = true)]
public string InDocsRowNo { get; set; }
///
/// 供应编号
///
[SugarColumn(ColumnDataType = "nvarchar", Length = 50, IsNullable = true)]
public string SuppCode { get; set; }
///
/// 供应商名称
///
[SugarColumn(ColumnDataType = "nvarchar", Length = 50, IsNullable = true)]
public string SuppName { get; set; }
///
/// 海关编号
///
[SugarColumn(ColumnDataType = "nvarchar", Length = 50, IsNullable = true)]
public string CustCode { get; set; }
///
/// 海关名称
///
[SugarColumn(ColumnDataType = "nvarchar", Length = 50, IsNullable = true)]
public string CustName { get; set; }
///
/// 物料ID
///
[SugarColumn(ColumnDataType = "bigint", IsNullable = false)]
public long MatId { get; set; }
///
/// 物料编号
///
[SugarColumn(ColumnDataType = "nvarchar", Length = 50, IsNullable = true)]
public string MatCode { get; set; }
///
/// 物料名称
///
[SugarColumn(ColumnDataType = "nvarchar", Length = 100, IsNullable = true)]
public string MatName { get; set; }
///
/// 总重量
///
[SugarColumn(ColumnDataType = "decimal", Length = 18, IsNullable = false)]
public decimal TolWQty { get; set; }
///
/// 净重
///
[SugarColumn(ColumnDataType = "decimal", Length = 18, IsNullable = false)]
public decimal NetWQty { get; set; }
///
/// 皮重
///
[SugarColumn(ColumnDataType = "decimal", Length = 18, IsNullable = false)]
public decimal TareWQty { get; set; }
///
/// 总长
///
[SugarColumn(ColumnDataType = "decimal", Length = 18, IsNullable = false)]
public decimal LengthQty { get; set; }
///
/// 碳当量
///
[SugarColumn(ColumnDataType = "decimal", Length = 18, IsNullable = false)]
public decimal CaQty { get; set; }
///
/// 销售总量
///
[SugarColumn(ColumnDataType = "decimal", Length = 18, IsNullable = false)]
public decimal SolderQty { get; set; }
///
/// 暂定
///
[SugarColumn(ColumnDataType = "int", IsNullable = false)]
public int ContUsageQty { get; set; }
///
/// 批次号
///
[SugarColumn(ColumnDataType = "nvarchar", Length = 50, IsNullable = true)]
public string BatchNo { get; set; }
///
/// 生产时间
///
[SugarColumn(ColumnDataType = "datetime", IsNullable = false)]
public DateTime ProductTime { get; set; }
///
/// 第一次入库时间
///
[SugarColumn(ColumnDataType = "datetime", IsNullable = false)]
public DateTime OneInTime { get; set; }
///
/// 盘条条码
///
[SugarColumn(ColumnDataType = "nvarchar", Length = 50, IsNullable = true)]
public string RodBarCode { get; set; }
///
/// 工字轮条码
///
[SugarColumn(ColumnDataType = "nvarchar", Length = 50, IsNullable = true)]
public string HWBarCode { get; set; }
///
/// RFID条码
///
[SugarColumn(ColumnDataType = "nvarchar", Length = 50, IsNullable = true)]
public string RFIDBarCode { get; set; }
///
/// 材料号
///
[SugarColumn(ColumnDataType = "nvarchar", Length = 50, IsNullable = true)]
public string CLBarCode { get; set; }
///
/// 工字轮条码类型
///
[SugarColumn(ColumnDataType = "nvarchar", Length = 50, IsNullable = true)]
public string HWTypeCode { get; set; }
///
/// 炉号
///
[SugarColumn(ColumnDataType = "nvarchar", Length = 50, IsNullable = true)]
public string BoilerNo { get; set; }
///
/// 包号
///
[SugarColumn(ColumnDataType = "nvarchar", Length = 50, IsNullable = true)]
public string PackNo { get; set; }
///
/// 牌号
///
[SugarColumn(ColumnDataType = "nvarchar", Length = 50, IsNullable = true)]
public string BrandNo { get; set; }
///
/// 执行标准
///
[SugarColumn(ColumnDataType = "nvarchar", Length = 50, IsNullable = true)]
public string ExecStd { get; set; }
///
/// 许可证号
///
[SugarColumn(ColumnDataType = "nvarchar", Length = 50, IsNullable = true)]
public string LicenceCode { get; set; }
///
/// 改手盘标记
///
[SugarColumn(ColumnDataType = "bit", IsNullable = false)]
public bool IsSurplus { get; set; }
///
/// 返工标记
///
[SugarColumn(ColumnDataType = "bit", IsNullable = false)]
public bool IsRework { get; set; }
///
/// 是否黑盘
///
[SugarColumn(ColumnDataType = "bit", IsNullable = false)]
public bool IsBlack { get; set; }
///
/// 是否芯股
///
[SugarColumn(ColumnDataType = "bit", IsNullable = false)]
public bool IsCore { get; set; }
///
/// 快投标记
///
[SugarColumn(ColumnDataType = "bit", IsNullable = false)]
public bool IsFast { get; set; }
///
/// 是否异常
///
[SugarColumn(ColumnDataType = "bit", IsNullable = false)]
public bool IsFail { get; set; }
///
/// 异常原因
///
[SugarColumn(ColumnDataType = "nvarchar", Length = 200, IsNullable = true)]
public string FailReason { get; set; }
///
/// 单/双丝
///
[SugarColumn(ColumnDataType = "nvarchar", Length = 50, IsNullable = true)]
public string SilkTypeCode { get; set; }
///
/// 等级
///
[SugarColumn(ColumnDataType = "nvarchar", Length = 50, IsNullable = true)]
public string Grade { get; set; }
///
/// 是否退料
///
[SugarColumn(ColumnDataType = "bit", IsNullable = false)]
public bool IsBack { get; set; }
///
/// 退料原因
///
[SugarColumn(ColumnDataType = "nvarchar", Length = 200, IsNullable = true)]
public string BackReason { get; set; }
///
/// 是否扭转检测
///
[SugarColumn(ColumnDataType = "bit", IsNullable = false)]
public bool IsTorsChk { get; set; }
///
/// 扭转次数
///
[SugarColumn(ColumnDataType = "int", IsNullable = false)]
public int TorsChkQty { get; set; }
///
/// 扭转检测时间
///
[SugarColumn(ColumnDataType = "datetime", IsNullable = false)]
public DateTime TorsChkTime { get; set; }
///
/// 正反面
///
[SugarColumn(ColumnDataType = "int", IsNullable = true, ColumnDescription = "正反面")]
public int SideNum { get; set; }
///
/// 扭转检测结果值
///
[SugarColumn(ColumnDataType = "decimal", Length = 18, IsNullable = true)]
public decimal? TorsChkValue { get; set; }
///
/// 扭转检测设备号
///
[SugarColumn(ColumnDataType = "nvarchar", Length = 50, IsNullable = true)]
public string TorsChkMachCode { get; set; }
///
/// 工序订单号
///
[SugarColumn(ColumnDataType = "nvarchar", Length = 50, IsNullable = true)]
public string ProcessDocsCode { get; set; }
///
/// 生产机台号
///
[SugarColumn(ColumnDataType = "nvarchar", Length = 50, IsNullable = true)]
public string ProductMachCode { get; set; }
///
/// 生成产线号
///
[SugarColumn(ColumnDataType = "nvarchar", Length = 50, IsNullable = true)]
public string ProductLineNo { get; set; }
///
/// 货物大小
///
[SugarColumn(IsNullable = true)]
public int Size { get; set; }
///
/// 托盘类型
///
[SugarColumn(IsNullable = true, ColumnDescription = "托盘类型")]
public FJPalletType PalletType { get; set; }
///
/// 需要二次码垛的物料
///
[SugarColumn(IsNullable = true, ColumnDescription = "循环码垛物料")]
public bool Secondary { get; set; }
}
///
/// 条码表
///
[SugarTable("Bill_InvInit")]
public partial class BillInvinit : BaseModel
{
///
/// 仓库ID 关联仓库表 ID
///
[SugarColumn(ColumnDataType = "bigint", IsNullable = false)]
public long WarehouseId { get; set; }
///
/// 组盘ID
/// 创建条码表时生成 同库存表组盘ID ContGrpId
///
[SugarColumn(ColumnDataType = "bigint", IsNullable = false)]
public long ContGrpId { get; set; }
///
/// 容器条码 同联容器表容器条码 ContBarCode
///
[SugarColumn(ColumnDataType = "nvarchar", Length = 50, IsNullable = true)]
public string ContGrpBarCode { get; set; }
///
/// 箱条码
///
[SugarColumn(ColumnDataType = "nvarchar", Length = 50, IsNullable = true)]
public string BoxBarCode { get; set; }
///
/// Bom单号 关联投料单 帘线工序工单号 BillCode
///
[SugarColumn(ColumnDataType = "nvarchar", Length = 50, IsNullable = true)]
public string BomDocsNo { get; set; }
///
/// Bom物料ID
///
[SugarColumn(ColumnDataType = "bigint", IsNullable = false)]
public long BomMatId { get; set; }
///
/// Bom物料编号
///
[SugarColumn(ColumnDataType = "nvarchar", Length = 50, IsNullable = true)]
public string BomMatCode { get; set; }
///
/// Bom物料
///
[SugarColumn(ColumnDataType = "nvarchar", Length = 100, IsNullable = true)]
public string BomMatName { get; set; }
///
/// 垛形主表 ID
///
[SugarColumn(ColumnDataType = "bigint", IsNullable = false)]
public long BomSetId { get; set; }
///
/// 垛型编码
///
[SugarColumn(ColumnDataType = "nvarchar", Length = 100, IsNullable = true)]
public string SetGrpCode { get; set; }
///
/// 库存状态码
///
[SugarColumn(ColumnDataType = "nvarchar", Length = 50, IsNullable = true)]
public string ExecStateCode { get; set; }
///
/// 单据编号 关联单据表单据编号 DocsNo
///
[SugarColumn(ColumnDataType = "nvarchar", Length = 50, IsNullable = true)]
public string ExecDocsNo { get; set; }
///
/// 单据行号
///
[SugarColumn(ColumnDataType = "nvarchar", Length = 50, IsNullable = true)]
public string ExecDocsRowNo { get; set; }
///
/// 单据类型编号 同单据表TypeNum
///
[SugarColumn(ColumnDataType = "nvarchar", Length = 50, IsNullable = true)]
public string ExecDocsTypeCode { get; set; }
///
/// 出入库标识
///
[SugarColumn(ColumnDataType = "int", IsNullable = false)]
public FJInvInOutType InvInOut { get; set; }
///
/// 执行人
///
[SugarColumn(ColumnDataType = "nvarchar", Length = 50, IsNullable = true)]
public string ExecWho { get; set; }
///
/// 执行时间
///
[SugarColumn(ColumnDataType = "datetime", IsNullable = false)]
public DateTime ExecTime { get; set; }
///
/// 行
///
[SugarColumn(ColumnDataType = "int", IsNullable = false)]
public int PutRow { get; set; }
///
/// 列
///
[SugarColumn(ColumnDataType = "int", IsNullable = false)]
public int PutCol { get; set; }
///
/// 层
///
[SugarColumn(ColumnDataType = "int", IsNullable = false)]
public int PutLayer { get; set; }
///
/// 入库条码号 FJ材料号
///
[SugarColumn(ColumnDataType = "nvarchar", Length = 50, IsNullable = true)]
public string InvBarCode { get; set; }
///
/// 库存状态
///
[SugarColumn(ColumnDataType = "nvarchar", Length = 50, IsNullable = true)]
public string InvStateCode { get; set; }
///
/// 入库单号
///
[SugarColumn(ColumnDataType = "nvarchar", Length = 50, IsNullable = true)]
public string InDocsNo { get; set; }
///
/// 入库单行号
///
[SugarColumn(ColumnDataType = "nvarchar", Length = 50, IsNullable = true)]
public string InDocsRowNo { get; set; }
///
/// 供应编号
///
[SugarColumn(ColumnDataType = "nvarchar", Length = 50, IsNullable = true)]
public string SuppCode { get; set; }
///
/// 供应商名称
///
[SugarColumn(ColumnDataType = "nvarchar", Length = 50, IsNullable = true)]
public string SuppName { get; set; }
///
/// 海关编号
///
[SugarColumn(ColumnDataType = "nvarchar", Length = 50, IsNullable = true)]
public string CustCode { get; set; }
///
/// 海关名称
///
[SugarColumn(ColumnDataType = "nvarchar", Length = 50, IsNullable = true)]
public string CustName { get; set; }
///
/// 物料ID
///
[SugarColumn(ColumnDataType = "bigint", IsNullable = false)]
public long MatId { get; set; }
///
/// 物料编号
///
[SugarColumn(ColumnDataType = "nvarchar", Length = 50, IsNullable = true)]
public string MatCode { get; set; }
///
/// 物料名称
///
[SugarColumn(ColumnDataType = "nvarchar", Length = 100, IsNullable = true)]
public string MatName { get; set; }
///
/// 总重量
///
[SugarColumn(ColumnDataType = "decimal", Length = 18, IsNullable = false)]
public decimal TolWQty { get; set; }
///
/// 净重
///
[SugarColumn(ColumnDataType = "decimal", Length = 18, IsNullable = false)]
public decimal NetWQty { get; set; }
///
/// 皮重
///
[SugarColumn(ColumnDataType = "decimal", Length = 18, IsNullable = false)]
public decimal TareWQty { get; set; }
///
/// 总长
///
[SugarColumn(ColumnDataType = "decimal", Length = 18, IsNullable = false)]
public decimal LengthQty { get; set; }
///
/// 碳当量
///
[SugarColumn(ColumnDataType = "decimal", Length = 18, IsNullable = false)]
public decimal CaQty { get; set; }
///
/// 销售总量
///
[SugarColumn(ColumnDataType = "decimal", Length = 18, IsNullable = false)]
public decimal SolderQty { get; set; }
///
/// 暂定
///
[SugarColumn(ColumnDataType = "int", IsNullable = false)]
public int ContUsageQty { get; set; }
///
/// 批次号
///
[SugarColumn(ColumnDataType = "nvarchar", Length = 50, IsNullable = true)]
public string BatchNo { get; set; }
///
/// 生产时间
///
[SugarColumn(ColumnDataType = "datetime", IsNullable = false)]
public DateTime ProductTime { get; set; }
///
/// 第一次入库时间
///
[SugarColumn(ColumnDataType = "datetime", IsNullable = false)]
public DateTime OneInTime { get; set; }
///
/// 盘条条码
///
[SugarColumn(ColumnDataType = "nvarchar", Length = 50, IsNullable = true)]
public string RodBarCode { get; set; }
///
/// 工字轮条码
///
[SugarColumn(ColumnDataType = "nvarchar", Length = 50, IsNullable = true)]
public string HWBarCode { get; set; }
///
/// RFID条码
///
[SugarColumn(ColumnDataType = "nvarchar", Length = 50, IsNullable = true)]
public string RFIDBarCode { get; set; }
///
/// 材料号
///
[SugarColumn(ColumnDataType = "nvarchar", Length = 50, IsNullable = true)]
public string CLBarCode { get; set; }
///
/// 工字轮条码类型
///
[SugarColumn(ColumnDataType = "nvarchar", Length = 50, IsNullable = true)]
public string HWTypeCode { get; set; }
///
/// 炉号
///
[SugarColumn(ColumnDataType = "nvarchar", Length = 50, IsNullable = true)]
public string BoilerNo { get; set; }
///
/// 包号
///
[SugarColumn(ColumnDataType = "nvarchar", Length = 50, IsNullable = true)]
public string PackNo { get; set; }
///
/// 牌号
///
[SugarColumn(ColumnDataType = "nvarchar", Length = 50, IsNullable = true)]
public string BrandNo { get; set; }
///
/// 执行标准
///
[SugarColumn(ColumnDataType = "nvarchar", Length = 50, IsNullable = true)]
public string ExecStd { get; set; }
///
/// 许可证号
///
[SugarColumn(ColumnDataType = "nvarchar", Length = 50, IsNullable = true)]
public string LicenceCode { get; set; }
///
/// 改手盘标记
///
[SugarColumn(ColumnDataType = "bit", IsNullable = false)]
public bool IsSurplus { get; set; }
///
/// 返工标记
///
[SugarColumn(ColumnDataType = "bit", IsNullable = false)]
public bool IsRework { get; set; }
///
/// 是否黑盘
///
[SugarColumn(ColumnDataType = "bit", IsNullable = false)]
public bool IsBlack { get; set; }
///
/// 是否芯股
///
[SugarColumn(ColumnDataType = "bit", IsNullable = false)]
public bool IsCore { get; set; }
///
/// 快投标记
///
[SugarColumn(ColumnDataType = "bit", IsNullable = false)]
public bool IsFast { get; set; }
///
/// 是否异常
///
[SugarColumn(ColumnDataType = "bit", IsNullable = false)]
public bool IsFail { get; set; }
///
/// 异常原因
///
[SugarColumn(ColumnDataType = "nvarchar", Length = 200, IsNullable = true)]
public string FailReason { get; set; }
///
/// 单/双丝
///
[SugarColumn(ColumnDataType = "nvarchar", Length = 50, IsNullable = true)]
public string SilkTypeCode { get; set; }
///
/// 等级
///
[SugarColumn(ColumnDataType = "nvarchar", Length = 50, IsNullable = true)]
public string Grade { get; set; }
///
/// 是否退料
///
[SugarColumn(ColumnDataType = "bit", IsNullable = false)]
public bool IsBack { get; set; }
///
/// 退料原因
///
[SugarColumn(ColumnDataType = "nvarchar", Length = 200, IsNullable = true)]
public string BackReason { get; set; }
///
/// 是否扭转检测
///
[SugarColumn(ColumnDataType = "bit", IsNullable = false)]
public bool IsTorsChk { get; set; }
///
/// 扭转次数
///
[SugarColumn(ColumnDataType = "int", IsNullable = false)]
public int TorsChkQty { get; set; }
///
/// 扭转检测时间
///
[SugarColumn(ColumnDataType = "datetime", IsNullable = false)]
public DateTime TorsChkTime { get; set; }
///
/// 扭转检测结果值
///
[SugarColumn(ColumnDataType = "decimal", Length = 18, IsNullable = true)]
public decimal? TorsChkValue { get; set; }
///
/// 扭转检测设备号
///
[SugarColumn(ColumnDataType = "nvarchar", Length = 50, IsNullable = true)]
public string TorsChkMachCode { get; set; }
///
/// 工序订单号
///
[SugarColumn(ColumnDataType = "nvarchar", Length = 50, IsNullable = true)]
public string ProcessDocsCode { get; set; }
///
/// 生产机台号
///
[SugarColumn(ColumnDataType = "nvarchar", Length = 50, IsNullable = true)]
public string ProductMachCode { get; set; }
///
/// 生成产线号
///
[SugarColumn(ColumnDataType = "nvarchar", Length = 50, IsNullable = true)]
public string ProductLineNo { get; set; }
///
/// 货物大小
///
[SugarColumn(IsNullable = false)]
public int Size { get; set; }
///
/// 托盘类型
///
[SugarColumn(IsNullable = true, ColumnDescription = "托盘类型")]
public FJPalletType PalletType { get; set; }
///
/// 组盘类型
///
[SugarColumn(IsNullable = true)]
public FJContGrpType ContGrpType { get; set; }
}
///
/// 基础表实体
///
public class BaseModel
{
public BaseModel()
{ }
///
/// ID
///
[SugarColumn(ColumnName = "Id", IsPrimaryKey = true, ColumnDescription = "ID")]
public virtual long Id { get; set; }
///
/// 备注
///
[SugarColumn(ColumnName = "Memo", Length = 500, IsNullable = true, ColumnDataType = "nvarchar", DefaultValue = "", ColumnDescription = "备注")]
public virtual string Memo { get; set; }
///
/// 创建用户
///
[SugarColumn(ColumnName = "AddWho", Length = 50, ColumnDataType = "nvarchar", DefaultValue = "", IsNullable = false, ColumnDescription = "创建用户")]
public virtual string AddWho { get; set; } = "";
///
/// 更新用户
///
[SugarColumn(ColumnName = "EditWho", Length = 50, ColumnDataType = "nvarchar", DefaultValue = "", IsNullable = false, ColumnDescription = "更新用户")]
public virtual string EditWho { get; set; } = "";
///
/// 创建时间
///
[SugarColumn(ColumnName = "AddTime", DefaultValue = "1900-1-1", IsNullable = false, ColumnDescription = "创建时间")]
public virtual DateTime AddTime { get; set; } = DateTime.Now;
///
/// 更新时间
///
[SugarColumn(ColumnName = "EditTime", DefaultValue = "1900-1-1", IsNullable = false, ColumnDescription = "更新时间")]
public virtual DateTime EditTime { get; set; } = DateTime.Now;
}
///
/// 组盘类型
///
public enum FJContGrpType
{
///
/// 物料盘
///
[Description("物料盘")]
Material = 1,
///
/// 空盘
///
[Description("空盘")]
EmptyCon = 2,
}
///
/// 托盘类型
///
public enum FJPalletType
{
///
/// 09使用的托盘
///
[Description("09使用的托盘")]
Pallet09 = 1,
///
/// 非09使用的托盘
///
[Description("非09使用的托盘")]
PalletNo09 = 2,
}
///
/// 出入库类型
///
public enum FJInvInOutType
{
///
/// 默认
///
[Description("默认")]
Default = 0,
///
/// 入库
///
[Description("入库")]
In = 1,
///
/// 出库
///
[Description("出库")]
Out = 2,
}
}