Browse Source

审核U9标准收货单接口修改(卡控整单入库)

master
陆晔 2 years ago
parent
commit
a9ff07181d
  1. 19
      ICSSoft.U9ERP.WebAPI/ICSSoft.APIApproveRCV/ApproveRCV.cs
  2. 138
      ICSSoft.U9ERP.WebAPI/ICSSoft.ERP.WebAPI/Controllers/ValuesController.cs
  3. 4
      ICSSoft.WMS.WebAPI/ICSSoft.WMS.WebAPI/Web.config

19
ICSSoft.U9ERP.WebAPI/ICSSoft.APIApproveRCV/ApproveRCV.cs

@ -35,6 +35,7 @@ namespace ICSSoft.APIApproveRCV
{ {
long DocID = 0; long DocID = 0;
string EntityType = ""; string EntityType = "";
Decimal RCVQty = 0;
//实例化代理类 //实例化代理类
UFIDAU9PMRcvIRcvApprovedSVClient client = new UFIDAU9PMRcvIRcvApprovedSVClient(); UFIDAU9PMRcvIRcvApprovedSVClient client = new UFIDAU9PMRcvIRcvApprovedSVClient();
//服务返回结果 //服务返回结果
@ -59,11 +60,21 @@ namespace ICSSoft.APIApproveRCV
{ {
throw new Exception("传入组织编码错误!"); 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())) if (!string.IsNullOrEmpty(dt.Rows[0][0].ToString()) || !string.IsNullOrEmpty(dt.Rows[0][1].ToString()))
{ {
DocID = long.Parse(dt.Rows[0][0].ToString()); DocID = long.Parse(dt.Rows[0][0].ToString());
EntityType = dt.Rows[0][1].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 else
{ {
@ -208,11 +219,13 @@ namespace ICSSoft.APIApproveRCV
private static DataTable GetData(string DocCode, string OrgID) 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 from PM_Receivement as A
left join [PM_RcvDocType] as A1 on (A.[RcvDocType] = A1.[ID]) 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]) 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); return DBHelper.Query(sql, connString);
} }
} }

138
ICSSoft.U9ERP.WebAPI/ICSSoft.ERP.WebAPI/Controllers/ValuesController.cs

@ -1426,75 +1426,75 @@ namespace ICSSoft.WebAPI.Controllers
/// </summary> /// </summary>
/// <param name="JsonData"></param> /// <param name="JsonData"></param>
/// <returns></returns> /// <returns></returns>
[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<ICSPurchaseReceiveDoc> infos = new List<ICSPurchaseReceiveDoc>();
try
{
infos = JsonConvert.DeserializeObject<List<ICSPurchaseReceiveDoc>>(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<ICSPurchaseReceiveDoc> infos = new List<ICSPurchaseReceiveDoc>();
// try
// {
// infos = JsonConvert.DeserializeObject<List<ICSPurchaseReceiveDoc>>(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;
//}
/// <summary> /// <summary>
/// 审核采购入库单 /// 审核采购入库单
/// </summary> /// </summary>
@ -7354,7 +7354,7 @@ namespace ICSSoft.WebAPI.Controllers
#region U9入库单相关 #region U9入库单相关
#region 审核入库单(采购入库) #region 审核入库单(采购入库)
[Route("api/PurchaseReceiveDoc/Create")]
[Route("api/PurchaseReceiveDocPOArrive/Create")]
[HttpPost] [HttpPost]
public HttpResponseMessage ApproveRCV([FromBody] object JsonData) public HttpResponseMessage ApproveRCV([FromBody] object JsonData)
{ {

4
ICSSoft.WMS.WebAPI/ICSSoft.WMS.WebAPI/Web.config

@ -6,8 +6,8 @@
<configuration> <configuration>
<appSettings> <appSettings>
<add key="ERPDB" value="UFDATA_999_2019"/> <add key="ERPDB" value="UFDATA_999_2019"/>
<!--88--><!--<add key="ConnStr" value="Data Source=192.168.1.88;Database=ICSWMS_Base;Uid=sa;Password=aA123456;"/>-->
<!--双金--><add key="ConnStr" value="Data Source=117.80.147.228;Database=ICSWMS_Base_SJ;Uid=sa;Password=p@ssw0rd;"/>
<!--88--><add key="ConnStr" value="Data Source=192.168.1.88;Database=ICSWMS_Base_test;Uid=sa;Password=aA123456;"/>
<!--双金--><!--<add key="ConnStr" value="Data Source=117.80.147.228;Database=ICSWMS_Base_SJ;Uid=sa;Password=p@ssw0rd;"/>-->
<add key="ERPUrl" value="http://192.168.1.88:3004/api/"/> <add key="ERPUrl" value="http://192.168.1.88:3004/api/"/>
<add key="UploadERP" value="true"/> <add key="UploadERP" value="true"/>
<add key="webpages:Version" value="3.0.0.0"/> <add key="webpages:Version" value="3.0.0.0"/>

Loading…
Cancel
Save