Browse Source

北汽 要货看板 红色字体加载超时 打不开

master
qian 6 months ago
parent
commit
587b608d17
  1. 78
      北京北汽/Controller/SCP_ASK_CONTROLLER.cs
  2. 2
      北京北汽/Models/ScpEntity/V_TB_ASK.cs

78
北京北汽/Controller/SCP_ASK_CONTROLLER.cs

@ -1504,26 +1504,70 @@ namespace CK.SCP.Controller
{ {
using (ScpEntities db = EntitiesFactory.CreateScpInstance()) using (ScpEntities db = EntitiesFactory.CreateScpInstance())
{ {
var _ls = p_list.Select(p => p.AskBillNum); var _ls = p_list.Select(p => p.AskBillNum).ToList();
StringBuilder _buffer = new StringBuilder(); List<string> numlist = new List<string>();
_buffer.Append(" select distinct (C.AskBillNum)from V_TB_ASK_DETAIL C"); var askdetailList = db.V_TB_ASK_DETAIL.Where(q => _ls.Contains(q.AskBillNum) && q.IsDeleted == false).ToList().Distinct().ToList();
_buffer.Append(" left JOIN "); var asndetailList = db.V_TB_ASN_DETAIL.Where(q => _ls.Contains(q.AskBillNum) && q.IsDeleted == false).ToList();
_buffer.Append(" (select SUM(Qty) as Qty, a.PoLine, a.AskBillNum, a.PartCode from v_tb_asn_detail a where a.IsDeleted=0 "); if (askdetailList.Count() > 0)
_buffer.Append(" group by a.PoLine, a.AskBillNum, a.PartCode) AS D ");
_buffer.Append(" ON C.AskBillNum = D.AskBillNum AND C.PoLine = D.PoLine AND C.PartCode = D.PartCode ");
_buffer.Append(" WHERE C.AskQty>isnull(D.Qty,0)");
_buffer.Append(" and c.AskBillNum in ('{0}')");
var _str = string.Format(_buffer.ToString(), string.Join("','", _ls.ToArray()));
var _list = db.Database.SqlQuery<string>(_str).ToList();
p_list.ForEach(p =>
{ {
p.IsComplete = true; if (asndetailList.Count() > 0)
if (_list.Contains(p.AskBillNum)) {
//按照看板号 行号 零件号分组
var list = asndetailList.GroupBy(p => new { p.AskBillNum, p.PoLine, p.PartCode }).Select(p => new { Sum = p.Sum(itm => itm.Qty), PoLine = p.Key.PoLine, AskBillNum = p.Key.AskBillNum, PartCode = p.Key.PartCode }).ToList();
askdetailList.ForEach(p =>
{
var detail = list.FirstOrDefault(q => q.AskBillNum == p.AskBillNum && q.PoLine == p.PoLine && q.PartCode == p.PartCode);
if (detail != null)
{
if (detail.Sum < p.AskQty)
{
numlist.Add(p.AskBillNum);
}
}
else
{
numlist.Add(p.AskBillNum);
}
});
if (numlist.Count() > 0)
{
p_list.ForEach(p =>
{
if (numlist.Contains(p.AskBillNum))
{
p.IsComplete = false;
}
});
}
}
else // 全部没有
{ {
p.IsComplete = false; p_list.ForEach(p =>
{
p.IsComplete = true;
});
} }
}); }
//StringBuilder _buffer = new StringBuilder();
//_buffer.Append(" select distinct (C.AskBillNum)from V_TB_ASK_DETAIL C");
//_buffer.Append(" left JOIN ");
//_buffer.Append(" (select SUM(Qty) as Qty, a.PoLine, a.AskBillNum, a.PartCode from v_tb_asn_detail a where a.IsDeleted=0 ");
//_buffer.Append(" group by a.PoLine, a.AskBillNum, a.PartCode) AS D ");
//_buffer.Append(" ON C.AskBillNum = D.AskBillNum AND C.PoLine = D.PoLine AND C.PartCode = D.PartCode ");
//_buffer.Append(" WHERE C.AskQty>isnull(D.Qty,0)");
//_buffer.Append(" and c.AskBillNum in ('{0}')");
//var _str = string.Format(_buffer.ToString(), string.Join("','", _ls.ToArray()));
//var _list = db.Database.SqlQuery<string>(_str).ToList();
//p_list.ForEach(p =>
//{
// p.IsComplete = true;
// if (_list.Contains(p.AskBillNum))
// {
// p.IsComplete = false;
// }
//});
} }
return p_list; return p_list;

2
北京北汽/Models/ScpEntity/V_TB_ASK.cs

@ -77,7 +77,7 @@ namespace CK.SCP.Models.ScpEntity
[NotMapped] [NotMapped]
public string Month { get; set; } public string Month { get; set; }
[NotMapped] [NotMapped]
public bool IsComplete { get; set; } public bool IsComplete { get; set; } = true;
[NotMapped] [NotMapped]
public string PartCode { get; set; } public string PartCode { get; set; }
[NotMapped] [NotMapped]

Loading…
Cancel
Save