|
@@ -1,8 +1,10 @@
|
|
|
-using ServiceCenter.Extensions;
|
|
|
+using Newtonsoft.Json;
|
|
|
+using ServiceCenter.Extensions;
|
|
|
using ServiceCenter.Logs;
|
|
|
using ServiceCenter.Redis;
|
|
|
using ServiceCenter.SqlSugars;
|
|
|
using WCS.Entity;
|
|
|
+using wms.sqlsugar.model.fj;
|
|
|
|
|
|
namespace WCS.WorkEngineering.Extensions
|
|
|
{
|
|
@@ -140,12 +142,82 @@ namespace WCS.WorkEngineering.Extensions
|
|
|
|
|
|
#region 工字轮支线分流
|
|
|
|
|
|
- ///// <summary>
|
|
|
- ///// 初始化码垛信息
|
|
|
- ///// </summary>
|
|
|
- //public static void InitStackStructure()
|
|
|
- //{
|
|
|
- //}
|
|
|
+ /// <summary>
|
|
|
+ /// 初始化码垛信息
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="stackId"> 垛形ID</param>
|
|
|
+ public static void InitStackStructure(long stackId)
|
|
|
+ {
|
|
|
+ SqlSugarHelper.Do(_db =>
|
|
|
+ {
|
|
|
+ var db = _db.Default;
|
|
|
+ //TODO:获取对应的垛形主表信息,暂时直接使用垛形ID获取,后续需要更新使用订单号
|
|
|
+ BillBomsetgrp billBomsetgrp = db.Queryable<BillBomsetgrp>().Single(x => x.Id == stackId);
|
|
|
+ var billBomsetinfos = db.Queryable<BillBomsetinfo>().Where(x => x.BomSetHdrId == billBomsetgrp.Id).ToList();
|
|
|
+
|
|
|
+ //开始构造垛形信息
|
|
|
+ StackInfo stackInfo = new StackInfo()
|
|
|
+ {
|
|
|
+ Code = billBomsetgrp.Code,
|
|
|
+ ShortCode = billBomsetgrp.ShortCode,
|
|
|
+ ProMaterCode = billBomsetgrp.ProMaterCode,
|
|
|
+ TpTypeCode = billBomsetgrp.TpTypeCode,
|
|
|
+ LayerCountQty = 2,
|
|
|
+ LayerInfos = new List<StackLayerInfo>()
|
|
|
+ {
|
|
|
+ new StackLayerInfo()
|
|
|
+ {
|
|
|
+ LayerNo=1,
|
|
|
+ RowInfos=new List<StackRowInfo>(),
|
|
|
+ },
|
|
|
+ new StackLayerInfo()
|
|
|
+ {
|
|
|
+ LayerNo=2,
|
|
|
+ RowInfos=new List<StackRowInfo>()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ StampType = billBomsetgrp.StampType
|
|
|
+ };
|
|
|
+
|
|
|
+ foreach (var item in billBomsetinfos.GroupBy(x => x.Row).OrderBy(x => x.Key))
|
|
|
+ {
|
|
|
+ //获取层信息
|
|
|
+ StackLayerInfo layerInfo = new StackLayerInfo();
|
|
|
+ if (item.Key <= 6) layerInfo = stackInfo.LayerInfos.Single(x => x.LayerNo == 1);
|
|
|
+ else layerInfo = stackInfo.LayerInfos.Single(x => x.LayerNo == 2);
|
|
|
+
|
|
|
+ //构造行信息
|
|
|
+ var rowInfo = new StackRowInfo()
|
|
|
+ {
|
|
|
+ RowNo = item.Key,
|
|
|
+ PosInfos = new List<StackPosInfo>()
|
|
|
+ };
|
|
|
+
|
|
|
+ //构造位信息
|
|
|
+ foreach (var item1 in item)
|
|
|
+ {
|
|
|
+ rowInfo.PosInfos.Add(new StackPosInfo()
|
|
|
+ {
|
|
|
+ IsEmpty = item1.IsEmpty == 0 ? false : true,
|
|
|
+ XYNo = item1.XYNo,
|
|
|
+ MatCode = item1.MatCode,
|
|
|
+ SideNum = item1.SideNum,
|
|
|
+ SpoolType = item1.SpoolType,
|
|
|
+ TaskNumber = 0
|
|
|
+ });
|
|
|
+ //同步是否混合料行
|
|
|
+ rowInfo.IsMixRow = item1.IsMixRow == 0 ? false : true;
|
|
|
+ }
|
|
|
+ rowInfo.QtyMaxCount = rowInfo.PosInfos.Count;
|
|
|
+ rowInfo.IsEmpty = rowInfo.QtyMaxCount > 0 ? false : true;
|
|
|
+ layerInfo.RowInfos.Add(rowInfo);
|
|
|
+ var count = layerInfo.RowInfos.Count(x => !x.IsEmpty); //计算所有不空数量
|
|
|
+ layerInfo.IsEmpty = count <= 0 ? true : false;
|
|
|
+ }
|
|
|
+
|
|
|
+ RedisHub.Default.Set("", JsonConvert.SerializeObject(stackInfo));
|
|
|
+ });
|
|
|
+ }
|
|
|
|
|
|
////获取目标地址
|
|
|
//public static string GetNextAdd(this WCS_TaskInfo task)
|
|
@@ -155,4 +227,143 @@ namespace WCS.WorkEngineering.Extensions
|
|
|
|
|
|
#endregion 工字轮支线分流
|
|
|
}
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 垛形信息
|
|
|
+ /// </summary>
|
|
|
+ public class StackInfo
|
|
|
+ {
|
|
|
+ /// <summary>
|
|
|
+ /// 垛型编码
|
|
|
+ /// </summary>
|
|
|
+ public string Code { get; set; }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 短垛型编码
|
|
|
+ /// </summary>
|
|
|
+ public short ShortCode { get; set; }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 帘线物料编码
|
|
|
+ /// </summary>
|
|
|
+ public string ProMaterCode { get; set; }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 产品总数
|
|
|
+ /// </summary>
|
|
|
+ public int CountQty { get; set; }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 托盘类型
|
|
|
+ /// </summary>
|
|
|
+ public string TpTypeCode { get; set; }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 层数
|
|
|
+ /// </summary>
|
|
|
+ public int LayerCountQty { get; set; }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 层信息
|
|
|
+ /// </summary>
|
|
|
+ public List<StackLayerInfo> LayerInfos { get; set; }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 垛型大类
|
|
|
+ /// </summary>
|
|
|
+ public int StampType { get; set; }
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 垛形层信息
|
|
|
+ /// </summary>
|
|
|
+ public class StackLayerInfo
|
|
|
+ {
|
|
|
+ /// <summary>
|
|
|
+ /// 是否空置
|
|
|
+ /// </summary>
|
|
|
+ public bool IsEmpty { get; set; }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 层号
|
|
|
+ /// </summary>
|
|
|
+ public int LayerNo { get; set; }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 行数
|
|
|
+ /// </summary>
|
|
|
+ public int RowCountQty { get; set; }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 行信息
|
|
|
+ /// </summary>
|
|
|
+ public List<StackRowInfo> RowInfos { get; set; }
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 垛形行信息
|
|
|
+ /// </summary>
|
|
|
+ public class StackRowInfo
|
|
|
+ {
|
|
|
+ /// <summary>
|
|
|
+ /// 是否空置
|
|
|
+ /// </summary>
|
|
|
+ public bool IsEmpty { get; set; }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 数量上限
|
|
|
+ /// </summary>
|
|
|
+ public int QtyMaxCount { get; set; }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 行号
|
|
|
+ /// </summary>
|
|
|
+ public int RowNo { get; set; }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 是否混合料行
|
|
|
+ /// </summary>
|
|
|
+ public bool IsMixRow { get; set; }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 表示每一个具体位置的商品信息
|
|
|
+ /// </summary>
|
|
|
+ public List<StackPosInfo> PosInfos { get; set; }
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 垛形位信息
|
|
|
+ /// </summary>
|
|
|
+ public class StackPosInfo
|
|
|
+ {
|
|
|
+ /// <summary>
|
|
|
+ /// 任务号
|
|
|
+ /// </summary>
|
|
|
+ public int TaskNumber { get; set; }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 是否空置
|
|
|
+ /// </summary>
|
|
|
+ public bool IsEmpty { get; set; }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 坐标号
|
|
|
+ /// </summary>
|
|
|
+ public string XYNo { get; set; }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 物料编码
|
|
|
+ /// </summary>
|
|
|
+ public string MatCode { get; set; }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 正反面
|
|
|
+ /// </summary>
|
|
|
+ public int SideNum { get; set; }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 工字轮类型
|
|
|
+ /// </summary>
|
|
|
+ public string SpoolType { get; set; }
|
|
|
+ }
|
|
|
}
|