diff --git a/ICSSoft.ERP.WebAPI/ICSSoft.DataProject/MOIssueDocNegatives.cs b/ICSSoft.ERP.WebAPI/ICSSoft.DataProject/MOIssueDocNegatives.cs index 0ada31e..d831cfa 100644 --- a/ICSSoft.ERP.WebAPI/ICSSoft.DataProject/MOIssueDocNegatives.cs +++ b/ICSSoft.ERP.WebAPI/ICSSoft.DataProject/MOIssueDocNegatives.cs @@ -321,6 +321,17 @@ namespace ICSSoft.DataProject } else { + sql = @"SELECT isnull(fOutQuantity,0) as fOutQuantity,iQuantity from MaterialAppVouchs a where a.AutoID='" + body.SourceDetailID + "' "; + DataTable dtClose = DBHelper.SQlReturnData(sql, cmd); + if (dtClose != null && dtClose.Rows.Count > 0) + { + if (Convert.ToDecimal(dtClose.Rows[0][0].ToString()) + body.Quantity > Convert.ToDecimal(dtClose.Rows[0][1].ToString())) + { + throw new Exception("退料数量不能大于领料单的已出数量!"); + } + } + + sql = @"INSERT INTO dbo.rdrecords11 ( AutoID ,ID ,cInvCode ,iQuantity ,iFlag ,cDefine22 ,iMPoIds,cmocode,iNum, cDefine23 ,cDefine24 ,cDefine25 ,cDefine26 ,cDefine27 , diff --git a/ICSSoft.ERP.WebAPI/ICSSoft.DataProject/OutsourcingIssueDoNegative.cs b/ICSSoft.ERP.WebAPI/ICSSoft.DataProject/OutsourcingIssueDoNegative.cs index fbb6c44..c768f7c 100644 --- a/ICSSoft.ERP.WebAPI/ICSSoft.DataProject/OutsourcingIssueDoNegative.cs +++ b/ICSSoft.ERP.WebAPI/ICSSoft.DataProject/OutsourcingIssueDoNegative.cs @@ -496,6 +496,18 @@ GROUP BY d.number "; } else { + sql = @"SELECT isnull(fOutQuantity,0) as fOutQuantity,iQuantity from MaterialAppVouchs a where a.AutoID='" + body.SourceDetailID + "' "; + DataTable dtClose = DBHelper.SQlReturnData(sql, cmd); + if (dtClose != null && dtClose.Rows.Count > 0) + { + if (Convert.ToDecimal(dtClose.Rows[0][0].ToString()) + body.Quantity > Convert.ToDecimal(dtClose.Rows[0][1].ToString())) + { + throw new Exception("退料数量不能大于领料单的已出数量!"); + } + } + + + sql = @"INSERT INTO dbo.rdrecords11 ( AutoID ,ID ,cInvCode ,iQuantity ,iFlag ,cDefine22 ,iOMoDID,iOMoMID,iNum, cDefine23 ,cDefine24 ,cDefine25 ,cDefine26 ,cDefine27 ,