|
|
@ -3108,18 +3108,22 @@ namespace CK.SCP.Controller |
|
|
|
} |
|
|
|
p_entitys.ForEach(itm => |
|
|
|
{ |
|
|
|
|
|
|
|
var _sum = db.V_TB_ASK_DETAIL.Where(p => p.AskBillNum == p_asn.AskBillNum && p.PartCode == itm.PartCode |
|
|
|
&& p.PoBillNum == p_asn.PoBillNum && p.PoLine == itm.PoLine && p.IsDeleted == false).Select(p => p.AskQty).Sum();//要货单要货数量
|
|
|
|
var _currSum = db.V_TB_ASN_DETAIL.Where(p => p.AskBillNum == p_asn.AskBillNum && p.PartCode == itm.PartCode |
|
|
|
&& p.PoBillNum == p_asn.PoBillNum && p.PoLine == itm.PoLine && p.IsDeleted == false).Select(p => p.Qty).Sum();//当前存在发货单数量
|
|
|
|
var _curr = db.V_TB_ASN_DETAIL.Where(p => p.AsnBillNum == p_asn.AsnBillNum && p.PartCode == itm.PartCode |
|
|
|
&& p.PoBillNum == p_asn.PoBillNum && p.PoLine == itm.PoLine && p.IsDeleted == false).Select(p => p.Qty).Sum(); |
|
|
|
var _rejct = db.TB_ARRIVE_DETAIL.Where(p => p.Remark == p_asn.AskBillNum && p.PartCode == itm.PartCode |
|
|
|
&& p.PoBillNum == p_asn.PoBillNum && p.PoLine == itm.PoLine && p.IsDeleted == false&&p.BillType==3).Select(p => p.Qty).ToList().Sum(); |
|
|
|
var askdeail = db.TB_ASK_DETAIL.Where(p => p.AskBillNum == p_asn.AskBillNum && p.PartCode == itm.PartCode && p.PoBillNum == p_asn.PoBillNum && p.PoLine == itm.PoLine && p.State != -1 && p.IsDeleted == false);//判断是否作废
|
|
|
|
if (askdeail == null) |
|
|
|
{ |
|
|
|
_ret.MessageList.Add(string.Format("要货看板{1}零件号{0}已经作废不能发货,请联系采购员确认!", itm.PartCode, itm.AskBillNum)); |
|
|
|
} |
|
|
|
//var _sum = db.V_TB_ASK_DETAIL.Where(p => p.AskBillNum == p_asn.AskBillNum && p.PartCode == itm.PartCode
|
|
|
|
// && p.PoBillNum == p_asn.PoBillNum && p.PoLine == itm.PoLine && p.IsDeleted == false).Select(p => p.AskQty).Sum();//要货单要货数量
|
|
|
|
//var _currSum = db.V_TB_ASN_DETAIL.Where(p => p.AskBillNum == p_asn.AskBillNum && p.PartCode == itm.PartCode
|
|
|
|
// && p.PoBillNum == p_asn.PoBillNum && p.PoLine == itm.PoLine && p.IsDeleted == false).Select(p => p.Qty).Sum();//当前存在发货单数量
|
|
|
|
//var _curr = db.V_TB_ASN_DETAIL.Where(p => p.AsnBillNum == p_asn.AsnBillNum && p.PartCode == itm.PartCode
|
|
|
|
// && p.PoBillNum == p_asn.PoBillNum && p.PoLine == itm.PoLine && p.IsDeleted == false).Select(p => p.Qty).Sum();
|
|
|
|
// var _rejct = db.TB_ARRIVE_DETAIL.Where(p => p.Remark == p_asn.AskBillNum && p.PartCode == itm.PartCode
|
|
|
|
//&& p.PoBillNum == p_asn.PoBillNum && p.PoLine == itm.PoLine && p.IsDeleted == false&&p.BillType==3).Select(p => p.Qty).ToList().Sum();
|
|
|
|
//if (_currSum - _curr + itm.Qty- Math.Abs(_rejct) <= _sum)
|
|
|
|
//{
|
|
|
|
TB_ASN_DETAIL _detail = new TB_ASN_DETAIL(); |
|
|
|
TB_ASN_DETAIL _detail = new TB_ASN_DETAIL(); |
|
|
|
_detail.UID = itm.UID; |
|
|
|
_detail.UnConv = itm.UnConv; |
|
|
|
_detail.AsnBillNum = itm.AsnBillNum; |
|
|
|