This commit is contained in:
2024-06-20 17:12:59 +08:00
parent 8b222bd7c3
commit 6b59df065d
31 changed files with 1138 additions and 404 deletions
@@ -76,7 +76,8 @@ namespace BLL
AcceptLevel = pointBatchItem.AcceptLevel,
RepairRecordId = pointBatchItem.RepairRecordId,
BatchOrder = pointBatchItem.BatchOrder,
IsCompletedPoint=pointBatchItem.IsCompletedPoint
IsCompletedPoint=pointBatchItem.IsCompletedPoint,
EnterDate = pointBatchItem.EnterDate
};
db.Batch_PointBatchItem.InsertOnSubmit(newPointBatchItem);
db.SubmitChanges();
@@ -204,7 +205,13 @@ namespace BLL
db.SubmitChanges();
}
public static void UpdatePointBatchOrder(string pointBatchItemId, int batchOrder)
/// <summary>
/// 批次段完成
/// </summary>
/// <param name="pointBatchItemId"></param>
/// <param name="batchOrder"></param>
public static void UpdatePointBatchOrder(string pointBatchItemId, bool batchOrder)
{
Model.HJGLDB db = Funs.DB;
Model.Batch_PointBatchItem newPointBatchItem = db.Batch_PointBatchItem.FirstOrDefault(e => e.PointBatchItemId == pointBatchItemId);
@@ -305,6 +312,7 @@ namespace BLL
newPointBatchItem.AcceptLevel = "";
}
newPointBatchItem.IsCompletedPoint = false;
newPointBatchItem.EnterDate = DateTime.Now;
BLL.Batch_PointBatchItemService.AddPointBatchItem(newPointBatchItem); // 插入明细表
@@ -322,23 +330,14 @@ namespace BLL
&& (j.CoverWelderId == coverWelderId || j.BackingWelderId==backingWelderId)
&& x.PointDate.HasValue
select x;
if (Funs.UsingUnit == "TCC11")
if (threeJot.Count() <= 2)
{
if (threeJot.Count() <= 1)
{
UpdatePointBatchItem(pointBatchItemId, "1", System.DateTime.Now, null);
UpdateWelderFirst(pointBatchItemId, true);
}
UpdatePointBatchItem(pointBatchItemId, "1", System.DateTime.Now, null);
UpdateWelderFirst(pointBatchItemId, true);
UpdatePointBatchOrder(pointBatchItemId, true);
}
else
{
if (threeJot.Count() <= 2)
{
UpdatePointBatchItem(pointBatchItemId, "1", System.DateTime.Now, null);
UpdateWelderFirst(pointBatchItemId, true);
}
}
//// 焊工在这个批首道口RT要覆盖 不要了
#region RT要覆盖
//var joints = from x in Funs.DB.Batch_PointBatchItem
// join y in Funs.DB.Batch_PointBatch on x.PointBatchId equals y.PointBatchId
// join z in Funs.DB.Base_DetectionType on y.DetectionTypeId equals z.DetectionTypeId
@@ -351,81 +350,87 @@ namespace BLL
// UpdatePointBatchItem(pointBatchItemId, "1", System.DateTime.Now, null);
// UpdatePipelineFirst(pointBatchItemId, true);
//}
#endregion
// 管径大于等于500必点
if (jot.Dia >= 500)
{
UpdatePointBatchItem(pointBatchItemId, "1", System.DateTime.Now, null);
UpdatePointBatchOrder(pointBatchItemId, true);
}
if (jot.IsGoldJoint == true)
{
UpdatePointBatchItem(pointBatchItemId, "1", System.DateTime.Now, null);
UpdatePointBatchOrder(pointBatchItemId, true);
}
}
// 一个段位的数量
int dnum = Convert.ToInt32((double)100 / (double)rate.DetectionRateValue);
// 批里未完成点口的焊口
var totalJot = from x in Funs.DB.Batch_PointBatchItem
join y in Funs.DB.Pipeline_WeldJoint on x.WeldJointId equals y.WeldJointId
where x.PointBatchId == pointBatchId && x.IsCompletedPoint == false
&& (y.CoverWelderId==coverWelderId || y.BackingWelderId==backingWelderId)
&& y.WeldingDate.HasValue
&& (y.IsCancel == false || y.IsCancel == null)
select x;
int totalnum = totalJot.Count();
// 时间>15处理放globle
//DateTime lastWeldingDate = totalJot.Select(x => x.WeldingDate.Value).Min();
//if((DateTime.Now.Date- lastWeldingDate).Days>=15)
#region
//// 一个段位的数量
//int dnum = Convert.ToInt32((double)100 / (double)rate.DetectionRateValue);
// 该段达到检测比例的数量
if (dnum == totalnum)
{
var GJot = from x in Funs.DB.Batch_PointBatchItem
join y in Funs.DB.Pipeline_WeldJoint on x.WeldJointId equals y.WeldJointId
where x.PointBatchId == pointBatchId && x.IsCompletedPoint == false
&& (y.IsCancel == false || y.IsCancel == null) && y.JointAttribute== "固定F"
select x;
//// 批里未完成点口的焊口
//var totalJot = from x in Funs.DB.Batch_PointBatchItem
// join y in Funs.DB.Pipeline_WeldJoint on x.WeldJointId equals y.WeldJointId
// where x.PointBatchId == pointBatchId && x.IsCompletedPoint == false
// && (y.CoverWelderId==coverWelderId || y.BackingWelderId==backingWelderId)
// && y.WeldingDate.HasValue
// && (y.IsCancel == false || y.IsCancel == null)
// select x;
//int totalnum = totalJot.Count();
//// 时间>15处理放globle
////DateTime lastWeldingDate = totalJot.Select(x => x.WeldingDate.Value).Min();
////if((DateTime.Now.Date- lastWeldingDate).Days>=15)
// 先查找固定口数量,如有固定口,则优先点
if (GJot.Count() > 0)
{
int Gnum = GJot.Count();
int rnum = Funs.GetRandomNum(1, Gnum);
int j = 1;
foreach (var g in GJot)
{
if (rnum == j)
{
UpdatePointBatchItem(g.PointBatchItemId, "1", System.DateTime.Now, null);
}
j++;
}
}
else
{
int rnum = Funs.GetRandomNum(1, totalnum);
int j = 1;
foreach (var g in totalJot)
{
if (rnum == j)
{
UpdatePointBatchItem(g.PointBatchItemId, "1", System.DateTime.Now, null);
}
j++;
}
}
//// 该段达到检测比例的数量
//if (dnum == totalnum)
//{
// var GJot = from x in Funs.DB.Batch_PointBatchItem
// join y in Funs.DB.Pipeline_WeldJoint on x.WeldJointId equals y.WeldJointId
// where x.PointBatchId == pointBatchId && x.IsCompletedPoint == false
// && (y.IsCancel == false || y.IsCancel == null) && y.JointAttribute== "固定F"
// select x;
int batchOrder= GetMaxBatchOrder(pointBatchId);
// 点口后,更新该段批里的所有口为完成点口,并更新分段的顺序
foreach (var g in totalJot)
{
UpdateIsCompletedPoint(g.PointBatchItemId, true);
UpdatePointBatchOrder(g.PointBatchItemId, batchOrder);
}
}
// // 先查找固定口数量,如有固定口,则优先点
// if (GJot.Count() > 0)
// {
// int Gnum = GJot.Count();
// int rnum = Funs.GetRandomNum(1, Gnum);
// int j = 1;
// foreach (var g in GJot)
// {
// if (rnum == j)
// {
// UpdatePointBatchItem(g.PointBatchItemId, "1", System.DateTime.Now, null);
// }
// j++;
// }
// }
// else
// {
// int rnum = Funs.GetRandomNum(1, totalnum);
// int j = 1;
// foreach (var g in totalJot)
// {
// if (rnum == j)
// {
// UpdatePointBatchItem(g.PointBatchItemId, "1", System.DateTime.Now, null);
// }
// j++;
// }
// }
// //int batchOrder= GetMaxBatchOrder(pointBatchId);
// // 点口后,更新该段批里的所有口为完成点口,并更新分段的顺序
// foreach (var g in totalJot)
// {
// UpdateIsCompletedPoint(g.PointBatchItemId, true);
// //UpdatePointBatchOrder(g.PointBatchItemId, batchOrder);
// }
//}
#endregion
}
}
@@ -822,17 +827,17 @@ namespace BLL
#endregion
// 返回进批的顺序
public static int GetMaxBatchOrder(string pointBatchId)
{
int orderNum = 1;
Model.HJGLDB db = Funs.DB;
var batchItem = db.Batch_PointBatchItem.Where(x => x.PointBatchId == pointBatchId && x.IsCompletedPoint==true);
if (batchItem.Count() > 0)
{
orderNum = (batchItem.Max(x => x.BatchOrder) != null ? batchItem.Max(x => x.BatchOrder).Value : 0) + 1;
}
return orderNum;
}
//public static int GetMaxBatchOrder(string pointBatchId)
//{
// int orderNum = 1;
// Model.HJGLDB db = Funs.DB;
// var batchItem = db.Batch_PointBatchItem.Where(x => x.PointBatchId == pointBatchId && x.IsCompletedPoint==true);
// if (batchItem.Count() > 0)
// {
// orderNum = (batchItem.Max(x => x.BatchOrder) != null ? batchItem.Max(x => x.BatchOrder).Value : 0) + 1;
// }
// return orderNum;
//}
/// <summary>