diff --git a/ICSSoft.U9ERP.WebAPI/ICSSoft.APIApproveRCV/ApproveRCV.cs b/ICSSoft.U9ERP.WebAPI/ICSSoft.APIApproveRCV/ApproveRCV.cs index 636fab3..ec3c8cc 100644 --- a/ICSSoft.U9ERP.WebAPI/ICSSoft.APIApproveRCV/ApproveRCV.cs +++ b/ICSSoft.U9ERP.WebAPI/ICSSoft.APIApproveRCV/ApproveRCV.cs @@ -35,6 +35,7 @@ namespace ICSSoft.APIApproveRCV { long DocID = 0; string EntityType = ""; + Decimal RCVQty = 0; //实例化代理类 UFIDAU9PMRcvIRcvApprovedSVClient client = new UFIDAU9PMRcvIRcvApprovedSVClient(); //服务返回结果 @@ -59,11 +60,21 @@ namespace ICSSoft.APIApproveRCV { throw new Exception("传入组织编码错误!"); } - DataTable dt = GetData(Info.RCVTCode, OrgID); + DataTable dt = GetData(Info.DNCode, OrgID); if (!string.IsNullOrEmpty(dt.Rows[0][0].ToString()) || !string.IsNullOrEmpty(dt.Rows[0][1].ToString())) { DocID = long.Parse(dt.Rows[0][0].ToString()); EntityType = dt.Rows[0][1].ToString(); + RCVQty= Convert.ToDecimal(dt.Rows[0][3].ToString()); + decimal ACTQty = 0; + foreach (ICSPurchaseReceiveDocs InfoLine in Info.details) + { + ACTQty += InfoLine.Quantity; + } + if (RCVQty != ACTQty) + { + throw new Exception("实际入库数量未满足收货单数量,请整单入库!"); + } } else { @@ -208,11 +219,13 @@ namespace ICSSoft.APIApproveRCV private static DataTable GetData(string DocCode, string OrgID) { - string sql = @" select A.ID,A1.[Code] as [Receivement_RcvDocType_Code],A.Status + string sql = @" select A.ID,A1.[Code] as [Receivement_RcvDocType_Code],A.Status,SUM(A3.RcvQtyCU) AS RcvQtyCU from PM_Receivement as A left join [PM_RcvDocType] as A1 on (A.[RcvDocType] = A1.[ID]) left join [PM_RcvDocType_Trl] as A2 on (A2.SysMlFlag = 'zh-CN') and (A1.[ID] = A2.[ID]) - where A.DocNo='" + DocCode + "' AND A.Org='" + OrgID + "'"; + left join [PM_RcvLine] A3 ON A3.Receivement=A.ID + where A.DocNo='" + DocCode + "' AND A.Org='" + OrgID + @"' + GROUP BY A.ID,A1.[Code],A.Status"; return DBHelper.Query(sql, connString); } } diff --git a/ICSSoft.U9ERP.WebAPI/ICSSoft.ERP.WebAPI/Controllers/ValuesController.cs b/ICSSoft.U9ERP.WebAPI/ICSSoft.ERP.WebAPI/Controllers/ValuesController.cs index ae464f8..f588c6d 100644 --- a/ICSSoft.U9ERP.WebAPI/ICSSoft.ERP.WebAPI/Controllers/ValuesController.cs +++ b/ICSSoft.U9ERP.WebAPI/ICSSoft.ERP.WebAPI/Controllers/ValuesController.cs @@ -1426,75 +1426,75 @@ namespace ICSSoft.WebAPI.Controllers /// /// /// - [Route("api/PurchaseReceiveDocPOArrive/Create")] - [HttpPost] - public HttpResponseMessage CreateRdRecord01ByPOArrive([FromBody] object JsonData) - { - log.Info("接口:api/PurchaseReceiveDocPOArrive/Create"); - log.Info("创建采购入库单(源头单据到货单)传入值:" + JsonData); - HttpResponseMessage result = new HttpResponseMessage(); - Result res = new Result(); - string str = string.Empty; - try - { - if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]") - { - try - { - List infos = new List(); - try - { - infos = JsonConvert.DeserializeObject>(JsonData.ToString()); - } - catch (Exception ex) - { - log.Error("转换失败:" + ex.ToString()); + //[Route("api/PurchaseReceiveDocPOArrive/Create")] + //[HttpPost] + //public HttpResponseMessage CreateRdRecord01ByPOArrive([FromBody] object JsonData) + //{ + // log.Info("接口:api/PurchaseReceiveDocPOArrive/Create"); + // log.Info("创建采购入库单(源头单据到货单)传入值:" + JsonData); + // HttpResponseMessage result = new HttpResponseMessage(); + // Result res = new Result(); + // string str = string.Empty; + // try + // { + // if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]") + // { + // try + // { + // List infos = new List(); + // try + // { + // infos = JsonConvert.DeserializeObject>(JsonData.ToString()); + // } + // catch (Exception ex) + // { + // log.Error("转换失败:" + ex.ToString()); - res.Success = false; - res.Message = "JSON格式不正确!"; - throw new Exception(res.Message); - } - PurchaseReceiveDoc action = new PurchaseReceiveDoc(); - string resultStr = action.CreateRdRecord01sByPOArrive(infos); - if (!string.IsNullOrWhiteSpace(resultStr)) - { - res.Success = true; - res.Message = "接口调用成功!"; - res.Data = resultStr; - } - else - { - res.Success = false; - res.Data = resultStr; - } - } - catch (Exception ex) - { - log.Error("调用后台失败:" + ex.ToString()); - res.Success = false; - res.Message = ex.Message; - } - } - else - { - res.Success = false; - res.Message = "请传入参数"; - } - } - catch (Exception ex) - { - log.Error("参数检验失败:" + ex.ToString()); - res.Success = false; - res.Message = ex.Message; - } - finally - { - str = JsonConvert.SerializeObject(res); - result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json"); - } - log.Debug("创建采购入库单(源头单据到货单)返回值:" + str); - return result; - } + // res.Success = false; + // res.Message = "JSON格式不正确!"; + // throw new Exception(res.Message); + // } + // PurchaseReceiveDoc action = new PurchaseReceiveDoc(); + // string resultStr = action.CreateRdRecord01sByPOArrive(infos); + // if (!string.IsNullOrWhiteSpace(resultStr)) + // { + // res.Success = true; + // res.Message = "接口调用成功!"; + // res.Data = resultStr; + // } + // else + // { + // res.Success = false; + // res.Data = resultStr; + // } + // } + // catch (Exception ex) + // { + // log.Error("调用后台失败:" + ex.ToString()); + // res.Success = false; + // res.Message = ex.Message; + // } + // } + // else + // { + // res.Success = false; + // res.Message = "请传入参数"; + // } + // } + // catch (Exception ex) + // { + // log.Error("参数检验失败:" + ex.ToString()); + // res.Success = false; + // res.Message = ex.Message; + // } + // finally + // { + // str = JsonConvert.SerializeObject(res); + // result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json"); + // } + // log.Debug("创建采购入库单(源头单据到货单)返回值:" + str); + // return result; + //} /// /// 审核采购入库单 /// @@ -7354,7 +7354,7 @@ namespace ICSSoft.WebAPI.Controllers #region U9入库单相关 #region 审核入库单(采购入库) - [Route("api/PurchaseReceiveDoc/Create")] + [Route("api/PurchaseReceiveDocPOArrive/Create")] [HttpPost] public HttpResponseMessage ApproveRCV([FromBody] object JsonData) { diff --git a/ICSSoft.WMS.WebAPI/ICSSoft.WMS.WebAPI/Web.config b/ICSSoft.WMS.WebAPI/ICSSoft.WMS.WebAPI/Web.config index d092c74..f14a24f 100644 --- a/ICSSoft.WMS.WebAPI/ICSSoft.WMS.WebAPI/Web.config +++ b/ICSSoft.WMS.WebAPI/ICSSoft.WMS.WebAPI/Web.config @@ -6,8 +6,8 @@ - - + +