You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1707 lines
70 KiB
1707 lines
70 KiB
using ICSSoft.Entity;
|
|
using Newtonsoft.Json;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Net;
|
|
using System.Net.Http;
|
|
using System.Text;
|
|
using System.Web.Http;
|
|
using ICS.WCF.Base;
|
|
using ICS.CreateU9Customer;
|
|
using ICS.CreateSoSrvSub;
|
|
using ICS.CreateRMASV.svc;
|
|
using UFIDA.ISV.CreateSOReturnRCV;
|
|
using UFIDA.ISV.CreateWCRCVForApi;
|
|
using UFIDA.ISV.CreateBFStandardShip;
|
|
using UFIDA.ISV.CreateBFRTN;
|
|
using UFIDA.ISV.CreateBFPMRecede;
|
|
using UFIDA.ISV.CreateIssue;
|
|
using UFIDA.ISV.CreateCompRpt;
|
|
using UFIDA.ISV.CreateBFMiscRcv;
|
|
using UFIDA.ISV.CreateBFMisShip;
|
|
using UFIDA.U9.CreateSupplier;
|
|
using UFIDA.ISV.Create_U9_ItemMaster;
|
|
using UFIDA.U9.Cust.ModifySOSV;
|
|
using UFIDA.ISV.CreatePoSrvSub;
|
|
using ICS.CreateTransInDoc;
|
|
using UFIDA.ISV.CreateMO;
|
|
using ICS.CreateCreateRcvRest;
|
|
using ICS.CreateIssueIN;
|
|
using UFIDA.ISV.CreateAboveIssue;
|
|
using System.Configuration;
|
|
using Newtonsoft.Json.Linq;
|
|
using ICS.CreateSMShip;
|
|
|
|
|
|
|
|
//using ICSSoft.U8.WebAPI.Controllers;
|
|
|
|
//using ICS.GetReceipt;
|
|
|
|
namespace ICSSoft.WeiC.WebAPI.Controllers
|
|
{
|
|
public class ValuesController : ApiController
|
|
{
|
|
private static log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
|
|
|
|
|
/// 创建U9客户档案
|
|
/// </summary>
|
|
/// <param name="d"></param>
|
|
/// <returns></returns>
|
|
[Route("api/APICreateU9Customer")]
|
|
[HttpPost]
|
|
public HttpResponseMessage APICreateU9Customer(CustomerInsertDataClass d)
|
|
{
|
|
HttpResponseMessage result = new HttpResponseMessage();
|
|
string str = string.Empty;
|
|
CreateU9Customer.OperationResult res = new CreateU9Customer.OperationResult();
|
|
try
|
|
{
|
|
|
|
try
|
|
{
|
|
|
|
str = JsonConvert.SerializeObject(d);
|
|
|
|
Appconfig.WriteLogFile(str.ToString(), "创建U9客户信息");
|
|
|
|
CreateU9Customer action = new CreateU9Customer();
|
|
res = action.CustCreateU9Customer(d);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
res.MESSAGE = ex.Message;
|
|
res.IsSuccess = false;
|
|
}
|
|
|
|
str = JsonConvert.SerializeObject(res);
|
|
result.Content = new StringContent(str.ToString(), Encoding.GetEncoding("UTF-8"), "application/json");
|
|
return result;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
res.MESSAGE = ex.Message;
|
|
res.IsSuccess = false;
|
|
str = JsonConvert.SerializeObject(res);
|
|
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
|
|
return result;
|
|
}
|
|
}
|
|
|
|
|
|
/// 创建销售订单
|
|
/// </summary>
|
|
/// <param name="d"></param>
|
|
/// <returns></returns>
|
|
[Route("api/APICreateSoSrvSub")]
|
|
[HttpPost]
|
|
public HttpResponseMessage APICreateSoSrvSub(List<Sohead> d)
|
|
{
|
|
HttpResponseMessage result = new HttpResponseMessage();
|
|
string str = string.Empty;
|
|
CustCallUFIDAISVCreateSoSrvSub.rtnSoinfo res = new CustCallUFIDAISVCreateSoSrvSub.rtnSoinfo();
|
|
try
|
|
{
|
|
try
|
|
{
|
|
str = JsonConvert.SerializeObject(d);
|
|
|
|
Appconfig.WriteLogFile(str.ToString(), "创建销售订单日志");
|
|
|
|
CustCallUFIDAISVCreateSoSrvSub action = new CustCallUFIDAISVCreateSoSrvSub();
|
|
foreach (var item in action.CustCreatePo(d))
|
|
{
|
|
res = item;
|
|
}
|
|
|
|
//res = action.CustCreatePo(d);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
res.DocNo = null;
|
|
res.Message = ex.Message;
|
|
res.IsSuccess = false;
|
|
res.rtnLines = null;
|
|
}
|
|
|
|
str = JsonConvert.SerializeObject(res);
|
|
result.Content = new StringContent(str.ToString(), Encoding.GetEncoding("UTF-8"), "application/json");
|
|
return result;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
res.DocNo = null;
|
|
res.Message = ex.Message;
|
|
res.IsSuccess = false;
|
|
res.rtnLines = null;
|
|
str = JsonConvert.SerializeObject(res);
|
|
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
|
|
return result;
|
|
}
|
|
}
|
|
|
|
|
|
/// 创建U9销售退货单
|
|
/// </summary>
|
|
/// <param name="d"></param>
|
|
/// <returns></returns>
|
|
[Route("api/APICreateSOReturnRCV")]
|
|
[HttpPost]
|
|
public HttpResponseMessage APICreateSOReturnRCV(List<UFIDA.ISV.CreateSOReturnRCV.CustCreateSOReturnRcvSrvSub.rCVhead> d)
|
|
{
|
|
HttpResponseMessage result = new HttpResponseMessage();
|
|
string str = string.Empty;
|
|
CustCreateSOReturnRcvSrvSub.rtnRcvInfo res = new CustCreateSOReturnRcvSrvSub.rtnRcvInfo();
|
|
try
|
|
{
|
|
|
|
try
|
|
{
|
|
|
|
str = JsonConvert.SerializeObject(d);
|
|
|
|
Appconfig.WriteLogFile(str.ToString(), "创建U9退货单");
|
|
|
|
CustCreateSOReturnRcvSrvSub action = new CustCreateSOReturnRcvSrvSub();
|
|
foreach (var item in action.CustCreateBFRCV(d))
|
|
{
|
|
res = item;
|
|
}
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
res.Message = ex.Message;
|
|
res.IsSuccess = false;
|
|
}
|
|
|
|
str = JsonConvert.SerializeObject(res);
|
|
result.Content = new StringContent(str.ToString(), Encoding.GetEncoding("UTF-8"), "application/json");
|
|
return result;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
res.Message = ex.Message;
|
|
res.IsSuccess = false;
|
|
str = JsonConvert.SerializeObject(res);
|
|
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
|
|
return result;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/// 创建退回处理单
|
|
/// </summary>
|
|
/// <param name="d"></param>
|
|
/// <returns></returns>
|
|
[Route("api/APICreateRMA")]
|
|
[HttpPost]
|
|
public HttpResponseMessage APICreateRMA(ICS.CreateRMASV.svc.CustCreateRMA.RMADate d)
|
|
{
|
|
HttpResponseMessage result = new HttpResponseMessage();
|
|
string str = string.Empty;
|
|
CustCreateRMA.rtnRMAInfo res = new CustCreateRMA.rtnRMAInfo();
|
|
try
|
|
{
|
|
|
|
try
|
|
{
|
|
str = JsonConvert.SerializeObject(d);
|
|
Appconfig.WriteLogFile(str.ToString(), "创建退回单");
|
|
CustCreateRMA action = new CustCreateRMA();
|
|
res = action.Cust_CreateRMA(d);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
res.Message = ex.Message;
|
|
res.IsSuccess = false;
|
|
}
|
|
|
|
str = JsonConvert.SerializeObject(res);
|
|
result.Content = new StringContent(str.ToString(), Encoding.GetEncoding("UTF-8"), "application/json");
|
|
return result;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
res.Message = ex.Message;
|
|
res.IsSuccess = false;
|
|
str = JsonConvert.SerializeObject(res);
|
|
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
|
|
return result;
|
|
}
|
|
}
|
|
|
|
|
|
/// 创建标准收货单
|
|
/// </summary>
|
|
/// <param name="JsonData"></param>
|
|
/// <returns></returns>
|
|
[Route("api/APICreateWCRCV")]
|
|
[HttpPost]
|
|
public HttpResponseMessage APICreateWCRCV([FromBody] object JsonData)
|
|
{
|
|
HttpResponseMessage result = new HttpResponseMessage();
|
|
|
|
CommonReturnEntity res = new CommonReturnEntity();
|
|
|
|
List<UFIDA.ISV.CreateWCRCVForApi.rtnRcvInfo> resultlist = new List<UFIDA.ISV.CreateWCRCVForApi.rtnRcvInfo>();
|
|
|
|
List<CustCreateBFRcvSrvSubForApi.rCVhead> dataList = new List<CustCreateBFRcvSrvSubForApi.rCVhead>();
|
|
string _result = string.Empty;
|
|
|
|
StringBuilder strlog = new StringBuilder();
|
|
strlog.AppendLine("创建标准收货单接口(API):");
|
|
strlog.AppendLine("*****************************************************");
|
|
strlog.AppendLine("传入数据:" + JsonData);
|
|
Appconfig.WriteLogFile(strlog.ToString(), "创建标准收货单接口(API)");
|
|
|
|
string str = string.Empty;
|
|
try
|
|
{
|
|
if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
|
|
{
|
|
|
|
dataList = JsonConvert.DeserializeObject<List<CustCreateBFRcvSrvSubForApi.rCVhead>>(JsonData.ToString());
|
|
|
|
if (dataList != null)
|
|
{
|
|
CustCreateBFRcvSrvSubForApi srv = new CustCreateBFRcvSrvSubForApi();
|
|
resultlist = srv.CustCreateBFRCVForApi(dataList);
|
|
|
|
foreach (UFIDA.ISV.CreateWCRCVForApi.rtnRcvInfo __result in resultlist)
|
|
{
|
|
if (__result.IsSuccess)
|
|
{
|
|
res.code = "2000";
|
|
res.DocNO = __result.DocNo;
|
|
}
|
|
else
|
|
{
|
|
res.code = "9999";
|
|
res.DocNO = "";
|
|
}
|
|
res.msg = __result.Message;
|
|
}
|
|
|
|
str = JsonConvert.SerializeObject(res);
|
|
result.Content = new StringContent(str.ToString(), Encoding.GetEncoding("UTF-8"), "application/json");
|
|
|
|
return result;
|
|
}
|
|
else
|
|
{
|
|
res.msg = "未获取到传输数据";
|
|
res.DocNO = "";
|
|
res.code = "9999";
|
|
}
|
|
}
|
|
else
|
|
{
|
|
res.msg = _result = "请传入参数";
|
|
res.DocNO = "";
|
|
res.code = "9999";
|
|
|
|
}
|
|
str = JsonConvert.SerializeObject(res);
|
|
|
|
result.Content = new StringContent(str.ToString(), Encoding.GetEncoding("UTF-8"), "application/json");
|
|
|
|
strlog.AppendLine("接口返回数据:" + str);
|
|
strlog.AppendLine("*****************************************************");
|
|
Appconfig.WriteLogFile(strlog.ToString(), "创建标准收货单接口(API)");
|
|
|
|
return result;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
res.msg = _result = ex.Message;
|
|
res.DocNO = "";
|
|
res.code = "9999";
|
|
str = JsonConvert.SerializeObject(_result);
|
|
|
|
strlog.AppendLine("接口返回异常数据:" + str);
|
|
strlog.AppendLine("*****************************************************");
|
|
Appconfig.WriteLogFile(strlog.ToString(), "创建标准收货单接口(API)");
|
|
|
|
|
|
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
|
|
return result;
|
|
}
|
|
}
|
|
|
|
|
|
/// 创建标准出货单
|
|
/// </summary>
|
|
/// <param name="d"></param>
|
|
/// <returns></returns>
|
|
[Route("api/APICreateOutShip_bak")]
|
|
[HttpPost]
|
|
public HttpResponseMessage APICreateOutShip_bak(List<CustCreateBFStandardShip.shiphead> d)
|
|
{
|
|
HttpResponseMessage result = new HttpResponseMessage();
|
|
string str = string.Empty;
|
|
List<UFIDA.ISV.CreateBFStandardShip.rtnRcvInfo> res = new List<UFIDA.ISV.CreateBFStandardShip.rtnRcvInfo>();
|
|
UFIDA.ISV.CreateBFStandardShip.rtnRcvInfo ress = new UFIDA.ISV.CreateBFStandardShip.rtnRcvInfo();
|
|
try
|
|
{
|
|
|
|
try
|
|
{
|
|
str = JsonConvert.SerializeObject(d);
|
|
Appconfig.WriteLogFile(str.ToString(), "创建标准出货单");
|
|
CustCreateBFStandardShip action = new CustCreateBFStandardShip();
|
|
//foreach (var item in action.CreateBFStandardShip(d))
|
|
//{
|
|
// res = item;
|
|
//}
|
|
res = action.CreateBFStandardShip(d);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
ress.Message = ex.Message;
|
|
ress.IsSuccess = false;
|
|
str = JsonConvert.SerializeObject(ress);
|
|
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
|
|
return result;
|
|
}
|
|
|
|
str = JsonConvert.SerializeObject(res);
|
|
result.Content = new StringContent(str.ToString(), Encoding.GetEncoding("UTF-8"), "application/json");
|
|
return result;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
ress.Message = ex.Message;
|
|
ress.IsSuccess = false;
|
|
str = JsonConvert.SerializeObject(ress);
|
|
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
|
|
return result;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/// 创建标准出货单
|
|
/// </summary>
|
|
/// <param name="d"></param>
|
|
/// <returns></returns>
|
|
[Route("api/APICreateOutShipp")]
|
|
[HttpPost]
|
|
public HttpResponseMessage APICreateOutShipp([FromBody]object ListJson)
|
|
{
|
|
HttpResponseMessage result = new HttpResponseMessage();
|
|
string str = string.Empty;
|
|
//List<ICS.CreateSMShip.CreateSMShip.OperationResult> res = new List<ICS.CreateSMShip.CreateSMShip.OperationResult>();
|
|
ICS.CreateSMShip.CreateSMShip.OperationResult res = new ICS.CreateSMShip.CreateSMShip.OperationResult();
|
|
|
|
UFIDA.ISV.CreateBFStandardShip.rtnRcvInfo ress = new UFIDA.ISV.CreateBFStandardShip.rtnRcvInfo();
|
|
|
|
List<ICSSoft.Entity.SMShip> SMShipList = JsonConvert.DeserializeObject<List<ICSSoft.Entity.SMShip>>(ListJson.ToString());
|
|
CreateSMShipOperationResult _result = new CreateSMShipOperationResult();
|
|
try
|
|
{
|
|
|
|
try
|
|
{
|
|
//str = JsonConvert.SerializeObject(d);
|
|
Appconfig.WriteLogFile(str.ToString(), "创建标准出货单");
|
|
CreateSMShip action = new CreateSMShip();
|
|
//foreach (var item in action.CreateBFStandardShip(d))
|
|
//{
|
|
// res = item;
|
|
//}
|
|
res = action.CustCreateSMShip(SMShipList);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
ress.Message = ex.Message;
|
|
ress.IsSuccess = false;
|
|
str = JsonConvert.SerializeObject(ress);
|
|
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
|
|
return result;
|
|
}
|
|
|
|
str = JsonConvert.SerializeObject(res);
|
|
result.Content = new StringContent(str.ToString(), Encoding.GetEncoding("UTF-8"), "application/json");
|
|
return result;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
ress.Message = ex.Message;
|
|
ress.IsSuccess = false;
|
|
str = JsonConvert.SerializeObject(ress);
|
|
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
|
|
return result;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
/// 创建标准出货单
|
|
/// </summary>
|
|
/// <param name="d"></param>
|
|
/// <returns></returns>
|
|
[Route("api/APICreateOutShip")]
|
|
[HttpPost]
|
|
public HttpResponseMessage APICreateOutShip([FromBody]object ListJson)
|
|
{
|
|
HttpResponseMessage result = new HttpResponseMessage();
|
|
string str = string.Empty;
|
|
List<UFIDA.ISV.CreateBFStandardShip.rtnRcvInfo> res = new List<UFIDA.ISV.CreateBFStandardShip.rtnRcvInfo>();
|
|
UFIDA.ISV.CreateBFStandardShip.rtnRcvInfo ress = new UFIDA.ISV.CreateBFStandardShip.rtnRcvInfo();
|
|
|
|
|
|
CreateSMShipOperationResult _result = new CreateSMShipOperationResult();
|
|
try
|
|
{
|
|
Appconfig.WriteLogFile(str.ToString(), "创建标准出货单传入日志");
|
|
|
|
List<ICSSoft.Entity.SMShip> SMShipList = JsonConvert.DeserializeObject<List<ICSSoft.Entity.SMShip>>(ListJson.ToString());
|
|
if (SMShipList == null)
|
|
{
|
|
_result.Message = "请传入信息";
|
|
_result.IsSuccess = false;
|
|
str = JsonConvert.SerializeObject(_result);
|
|
result.Content = new StringContent(str.ToString(), Encoding.GetEncoding("UTF-8"), "application/json");
|
|
Appconfig.WriteLogFile(str.ToString(), "创建标准出货单异常日志");
|
|
return result;
|
|
}
|
|
List<SMShip> _SOFileList = new List<SMShip>();
|
|
if (SMShipList != null && SMShipList.Count > 0)
|
|
{
|
|
foreach (var d in SMShipList)
|
|
{
|
|
SMShip model = new SMShip();
|
|
|
|
model.CurShipQty1 = d.CurShipQty1;
|
|
model.CurShipQty2 = d.CurShipQty2;
|
|
model.DocStatus = d.DocStatus;
|
|
model.Locations = new List<Location>();
|
|
model.OptionalSplitTerm = new OptionalSplitTerm[] { };
|
|
model.ShipDate = d.ShipDate;
|
|
model.ShipMemo = d.ShipMemo;
|
|
model.SOIsConsign = d.SOIsConsign;
|
|
|
|
//SrcDocSubLineNo
|
|
model.SrcDocSubLineNo = d.SrcDocSubLineNo;
|
|
|
|
string SrcID = Appconfig.GetSOLineID(d.SrcDocNo, d.SrcDocLineNo,d.SrcDocSubLineNo);
|
|
string OrgID = Appconfig.GetOrgID(d.SrcDocNo, d.SrcDocLineNo);
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(SrcID))
|
|
{
|
|
model.SrcDocLineID = long.Parse(SrcID);
|
|
}
|
|
else
|
|
{
|
|
_result.Message = "传入销售订单信息有误,请核对";
|
|
_result.IsSuccess = false;
|
|
str = JsonConvert.SerializeObject(_result);
|
|
result.Content = new StringContent(str.ToString(), Encoding.GetEncoding("UTF-8"), "application/json");
|
|
Appconfig.WriteLogFile(str.ToString(), "创建标准出货单异常日志");
|
|
return result;
|
|
}
|
|
model.SrcDocLineNo = d.SrcDocLineNo;
|
|
model.SrcDocNo = d.SrcDocNo;
|
|
//model.SrcDocSubLineNo = d.SrcDocSubLineNo;
|
|
model.SrcDocType = d.SrcDocType;
|
|
string WHID = Appconfig.GetWhIDByCode(d.WH, OrgID);
|
|
|
|
model.WH = WHID;
|
|
|
|
_SOFileList.Add(model);
|
|
}
|
|
str = JsonConvert.SerializeObject(_SOFileList);
|
|
|
|
string url = "http://{2}/u9c/webapi/OAuth2/GetAuthorizeCode?clientid={0}&clientsecret={1}";
|
|
url = string.Format(url, ConfigurationManager.AppSettings["clientid"].ToString(), ConfigurationManager.AppSettings["clientsecret"].ToString(), ConfigurationManager.AppSettings["U9IP"].ToString());
|
|
string resultuu = PostData.GetInfo("", url);
|
|
|
|
JObject objuu = new JObject();
|
|
objuu = JObject.Parse(resultuu);
|
|
|
|
string keyCode = objuu["Data"].ToString();
|
|
if (!string.IsNullOrWhiteSpace(keyCode))
|
|
{
|
|
string ToeknUrl = "http://{4}/u9c/webapi/OAuth2/Login?userCode={0}&entcode={1}&orgcode={2}&code={3}";
|
|
ToeknUrl = string.Format(ToeknUrl, ConfigurationManager.AppSettings["userCode"].ToString(), ConfigurationManager.AppSettings["enterpriseID"].ToString(), ConfigurationManager.AppSettings["orgCode"].ToString(), keyCode, ConfigurationManager.AppSettings["U9IP"].ToString());
|
|
string resultToken = PostData.GetInfo("", ToeknUrl);
|
|
|
|
JObject objToken = new JObject();
|
|
objuu = JObject.Parse(resultToken);
|
|
string TokenCode = objuu["Data"].ToString();
|
|
if (!string.IsNullOrWhiteSpace(TokenCode))
|
|
{
|
|
string CreatePOUrl = "http://{0}/u9c/webapi/Ship/CreateBySrcDoc";
|
|
CreatePOUrl = string.Format(CreatePOUrl, ConfigurationManager.AppSettings["U9IP"].ToString());
|
|
|
|
//_SOFileList.Add(model);// = model;
|
|
string postData = JsonConvert.SerializeObject(_SOFileList);
|
|
|
|
Appconfig.WriteLogFile(postData.ToString(), "标准出货单日志");
|
|
|
|
string resultCreateSoFile = PostData.APT(CreatePOUrl, postData, TokenCode);
|
|
bool IsSucess = false;
|
|
|
|
if (objuu["ResCode"].ToString() != "0")
|
|
{
|
|
IsSucess = false;
|
|
}
|
|
else
|
|
{
|
|
IsSucess = true;
|
|
}
|
|
_result.Message = resultCreateSoFile;
|
|
_result.IsSuccess = IsSucess;
|
|
str = JsonConvert.SerializeObject(_result);
|
|
result.Content = new StringContent(str.ToString(), Encoding.GetEncoding("UTF-8"), "application/json");
|
|
|
|
Appconfig.WriteLogFile(str.ToString(), "标准出货单日志");
|
|
|
|
return result;
|
|
}
|
|
else
|
|
{
|
|
string returnMessage = objuu["ResMsg"].ToString();
|
|
_result.Message = objuu["ResMsg"].ToString();
|
|
_result.IsSuccess = false;
|
|
str = JsonConvert.SerializeObject(_result);
|
|
result.Content = new StringContent(str.ToString(), Encoding.GetEncoding("UTF-8"), "application/json");
|
|
|
|
Appconfig.WriteLogFile(str.ToString(), "标准出货单异常日志");
|
|
|
|
return result;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
_result.Message = "获取授权码为空";
|
|
_result.IsSuccess = false;
|
|
str = JsonConvert.SerializeObject(_result);
|
|
result.Content = new StringContent(str.ToString(), Encoding.GetEncoding("UTF-8"), "application/json");
|
|
|
|
Appconfig.WriteLogFile(str.ToString(), "标准出货单异常日志");
|
|
return result;
|
|
}
|
|
|
|
}
|
|
str = JsonConvert.SerializeObject(_result);
|
|
result.Content = new StringContent(str.ToString(), Encoding.GetEncoding("UTF-8"), "application/json");
|
|
|
|
Appconfig.WriteLogFile(str.ToString(), "标准出货单日志");
|
|
|
|
return result;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
_result.Message = ex.ToString();
|
|
_result.IsSuccess = false;
|
|
str = JsonConvert.SerializeObject(_result);
|
|
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
|
|
Appconfig.WriteLogFile(str.ToString(), "标准出货单异常日志");
|
|
|
|
return result;
|
|
}
|
|
|
|
}
|
|
|
|
|
|
/// 创建委外收货单
|
|
/// </summary>
|
|
/// <param name="d"></param>
|
|
/// <returns></returns>
|
|
[Route("api/APICreateBFRTNSrvSub")]
|
|
[HttpPost]
|
|
public HttpResponseMessage APICreateBFRTNSrvSub(List<CustCreateBFRTNSrvSub.rCVhead> d)
|
|
{
|
|
HttpResponseMessage result = new HttpResponseMessage();
|
|
string str = string.Empty;
|
|
UFIDA.ISV.CreateBFRTN.rtnRcvInfo res = new UFIDA.ISV.CreateBFRTN.rtnRcvInfo();
|
|
try
|
|
{
|
|
|
|
try
|
|
{
|
|
str = JsonConvert.SerializeObject(d);
|
|
Appconfig.WriteLogFile(str.ToString(), "创建委外收货单");
|
|
CustCreateBFRTNSrvSub action = new CustCreateBFRTNSrvSub();
|
|
foreach (var item in action.CustCreateBFRTN(d))
|
|
{
|
|
res = item;
|
|
}
|
|
//res = action.CreateBFStandardShip(d);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
res.Message = ex.Message;
|
|
res.IsSuccess = false;
|
|
}
|
|
|
|
str = JsonConvert.SerializeObject(res);
|
|
result.Content = new StringContent(str.ToString(), Encoding.GetEncoding("UTF-8"), "application/json");
|
|
return result;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
res.Message = ex.Message;
|
|
res.IsSuccess = false;
|
|
str = JsonConvert.SerializeObject(res);
|
|
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
|
|
return result;
|
|
}
|
|
}
|
|
|
|
/// 创建委外退料单
|
|
/// </summary>
|
|
/// <param name="d"></param>
|
|
/// <returns></returns>
|
|
[Route("api/APICreatBFPMRecede")]
|
|
[HttpPost]
|
|
public HttpResponseMessage APICreatBFPMRecede(List<CustCreateBFPMRecedeSrvSub.rCVhead> d)
|
|
{
|
|
HttpResponseMessage result = new HttpResponseMessage();
|
|
string str = string.Empty;
|
|
UFIDA.ISV.CreateBFPMRecede.rtnRcvInfo res = new UFIDA.ISV.CreateBFPMRecede.rtnRcvInfo();
|
|
try
|
|
{
|
|
|
|
try
|
|
{
|
|
str = JsonConvert.SerializeObject(d);
|
|
Appconfig.WriteLogFile(str.ToString(), "创建委外退料单");
|
|
CustCreateBFPMRecedeSrvSub action = new CustCreateBFPMRecedeSrvSub();
|
|
foreach (var item in action.CustCreateBFPMRecede(d))
|
|
{
|
|
res = item;
|
|
}
|
|
//res = action.CreateBFStandardShip(d);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
res.Message = ex.Message;
|
|
res.IsSuccess = false;
|
|
}
|
|
|
|
str = JsonConvert.SerializeObject(res);
|
|
result.Content = new StringContent(str.ToString(), Encoding.GetEncoding("UTF-8"), "application/json");
|
|
return result;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
res.Message = ex.Message;
|
|
res.IsSuccess = false;
|
|
str = JsonConvert.SerializeObject(res);
|
|
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
|
|
return result;
|
|
}
|
|
}
|
|
|
|
|
|
/// 创建生产退料单
|
|
/// </summary>
|
|
/// <param name="d"></param>
|
|
/// <returns></returns>
|
|
[Route("api/APICreateReduceIssue")]
|
|
[HttpPost]
|
|
public HttpResponseMessage APICreateRecedeIssue(List<IssueData> d)
|
|
{
|
|
HttpResponseMessage result = new HttpResponseMessage();
|
|
string str = string.Empty;
|
|
CustCreateIssue.OperationResult res = new CustCreateIssue.OperationResult();
|
|
try
|
|
{
|
|
|
|
try
|
|
{
|
|
str = JsonConvert.SerializeObject(d);
|
|
Appconfig.WriteLogFile(str.ToString(), "创建委外退料单");
|
|
CustCreateIssue action = new CustCreateIssue();
|
|
res = action.CreateIssue(d);
|
|
//res = action.CreateBFStandardShip(d);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
res.MESSAGE = ex.Message;
|
|
res.IsSuccess = false;
|
|
}
|
|
|
|
str = JsonConvert.SerializeObject(res);
|
|
result.Content = new StringContent(str.ToString(), Encoding.GetEncoding("UTF-8"), "application/json");
|
|
return result;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
res.MESSAGE = ex.Message;
|
|
res.IsSuccess = false;
|
|
str = JsonConvert.SerializeObject(res);
|
|
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
|
|
return result;
|
|
}
|
|
}
|
|
|
|
/// 创建生产领料单
|
|
/// </summary>
|
|
/// <param name="d"></param>
|
|
/// <returns></returns>
|
|
[Route("api/APICreateIssue")]
|
|
[HttpPost]
|
|
public HttpResponseMessage APICreateIssue(List<IssueAboveData> d)
|
|
{
|
|
HttpResponseMessage result = new HttpResponseMessage();
|
|
string str = string.Empty;
|
|
CustCreateAboveIssue.OperationResult res = new CustCreateAboveIssue.OperationResult();
|
|
try
|
|
{
|
|
|
|
try
|
|
{
|
|
str = JsonConvert.SerializeObject(d);
|
|
Appconfig.WriteLogFile(str.ToString(), "创建生产领料单");
|
|
CustCreateAboveIssue action = new CustCreateAboveIssue();
|
|
res = action.CreateAboveIssue(d);
|
|
//res = action.CreateBFStandardShip(d);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
res.MESSAGE = ex.Message;
|
|
res.IsSuccess = false;
|
|
}
|
|
|
|
str = JsonConvert.SerializeObject(res);
|
|
result.Content = new StringContent(str.ToString(), Encoding.GetEncoding("UTF-8"), "application/json");
|
|
return result;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
res.MESSAGE = ex.Message;
|
|
res.IsSuccess = false;
|
|
str = JsonConvert.SerializeObject(res);
|
|
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
|
|
return result;
|
|
}
|
|
}
|
|
|
|
|
|
/// 创建完工报告
|
|
/// </summary>
|
|
/// <param name="d"></param>
|
|
/// <returns></returns>
|
|
[Route("api/APICreateCompRpt")]
|
|
[HttpPost]
|
|
public HttpResponseMessage APICreateRMA(List<CompRpt> d)
|
|
{
|
|
HttpResponseMessage result = new HttpResponseMessage();
|
|
string str = string.Empty;
|
|
UFIDA.ISV.CreateCompRpt.OperationResult res = new UFIDA.ISV.CreateCompRpt.OperationResult();
|
|
try
|
|
{
|
|
|
|
try
|
|
{
|
|
str = JsonConvert.SerializeObject(d);
|
|
Appconfig.WriteLogFile(str.ToString(), "创建完工报告");
|
|
CustCreateCompRptSrvSub action = new CustCreateCompRptSrvSub();
|
|
res = action.CustCreateCompRpt(d);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
res.MESSAGE = ex.Message;
|
|
res.IsSuccess = false;
|
|
}
|
|
|
|
str = JsonConvert.SerializeObject(res);
|
|
result.Content = new StringContent(str.ToString(), Encoding.GetEncoding("UTF-8"), "application/json");
|
|
return result;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
res.MESSAGE = ex.Message;
|
|
res.IsSuccess = false;
|
|
str = JsonConvert.SerializeObject(res);
|
|
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
|
|
return result;
|
|
}
|
|
}
|
|
|
|
|
|
/// 创建杂收单
|
|
/// </summary>
|
|
/// <param name="d"></param>
|
|
/// <returns></returns>
|
|
[Route("api/APICreateBFMiscRcv")]
|
|
[HttpPost]
|
|
public HttpResponseMessage APICreateRMA(List<CustCreateBFMiscRcv.rCVhead> d)
|
|
{
|
|
HttpResponseMessage result = new HttpResponseMessage();
|
|
string str = string.Empty;
|
|
UFIDA.ISV.CreateBFMiscRcv.rtnRcvInfo res = new UFIDA.ISV.CreateBFMiscRcv.rtnRcvInfo();
|
|
try
|
|
{
|
|
|
|
try
|
|
{
|
|
str = JsonConvert.SerializeObject(d);
|
|
Appconfig.WriteLogFile(str.ToString(), "创建委外退料单");
|
|
CustCreateBFMiscRcv action = new CustCreateBFMiscRcv();
|
|
foreach (var item in action.CreateBFMisRcv(d))
|
|
{
|
|
res = item;
|
|
}
|
|
//res = action.CreateBFMisRcv(d);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
res.Message = ex.Message;
|
|
res.IsSuccess = false;
|
|
}
|
|
|
|
str = JsonConvert.SerializeObject(res);
|
|
result.Content = new StringContent(str.ToString(), Encoding.GetEncoding("UTF-8"), "application/json");
|
|
return result;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
res.Message = ex.Message;
|
|
res.IsSuccess = false;
|
|
str = JsonConvert.SerializeObject(res);
|
|
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
|
|
return result;
|
|
}
|
|
}
|
|
|
|
|
|
/// 创建杂发单
|
|
/// </summary>
|
|
/// <param name="d"></param>
|
|
/// <returns></returns>
|
|
[Route("api/APICreateBFMisShip")]
|
|
[HttpPost]
|
|
public HttpResponseMessage APICreateRMA(List<CustCreateBFMisShipSrvSub.rCVhead> d)
|
|
{
|
|
HttpResponseMessage result = new HttpResponseMessage();
|
|
string str = string.Empty;
|
|
UFIDA.ISV.CreateBFMisShip.rtnRcvInfo res = new UFIDA.ISV.CreateBFMisShip.rtnRcvInfo();
|
|
try
|
|
{
|
|
|
|
try
|
|
{
|
|
str = JsonConvert.SerializeObject(d);
|
|
Appconfig.WriteLogFile(str.ToString(), "创建委外退料单");
|
|
CustCreateBFMisShipSrvSub action = new CustCreateBFMisShipSrvSub();
|
|
foreach (var item in action.CustCreateBFMisShip(d))
|
|
{
|
|
res = item;
|
|
}
|
|
//res = action.CustCreateBFMisShip(d);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
res.Message = ex.Message;
|
|
res.IsSuccess = false;
|
|
}
|
|
|
|
str = JsonConvert.SerializeObject(res);
|
|
result.Content = new StringContent(str.ToString(), Encoding.GetEncoding("UTF-8"), "application/json");
|
|
return result;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
res.Message = ex.Message;
|
|
res.IsSuccess = false;
|
|
str = JsonConvert.SerializeObject(res);
|
|
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
|
|
return result;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/// 创建供应商
|
|
/// </summary>
|
|
/// <param name="JsonData"></param>
|
|
/// <returns></returns>
|
|
[Route("api/CreateSupplier")]
|
|
[HttpPost]
|
|
public HttpResponseMessage CreateSupplier(UFIDA.U9.CreateSupplier.CustCreateSupplier.Supplier d)
|
|
{
|
|
|
|
HttpResponseMessage result = new HttpResponseMessage();
|
|
string str = string.Empty;
|
|
CustCreateSupplier.OperationResult res = new CustCreateSupplier.OperationResult();
|
|
try
|
|
{
|
|
|
|
try
|
|
{
|
|
|
|
str = JsonConvert.SerializeObject(d);
|
|
|
|
Appconfig.WriteLogFile(str.ToString(), "创建U9供应商信息");
|
|
|
|
CustCreateSupplier action = new CustCreateSupplier();
|
|
res = action.CustCreateSupp(d);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
res.MESSAGE = ex.Message;
|
|
res.IsSuccess = false;
|
|
}
|
|
|
|
str = JsonConvert.SerializeObject(res);
|
|
result.Content = new StringContent(str.ToString(), Encoding.GetEncoding("UTF-8"), "application/json");
|
|
return result;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
res.MESSAGE = ex.Message;
|
|
res.IsSuccess = false;
|
|
str = JsonConvert.SerializeObject(res);
|
|
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
|
|
return result;
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
/// 创建料品
|
|
/// </summary>
|
|
/// <param name="JsonData"></param>
|
|
/// <returns></returns>
|
|
[Route("api/CreateItem")]
|
|
[HttpPost]
|
|
public HttpResponseMessage CreateItem(List<ItemMasterDataClass> d)
|
|
{
|
|
|
|
HttpResponseMessage result = new HttpResponseMessage();
|
|
string str = string.Empty;
|
|
Create_U9_ItemMaster.OperationResult res = new Create_U9_ItemMaster.OperationResult();
|
|
try
|
|
{
|
|
|
|
try
|
|
{
|
|
|
|
str = JsonConvert.SerializeObject(d);
|
|
|
|
Appconfig.WriteLogFile(str.ToString(), "创建U9料品信息");
|
|
|
|
Create_U9_ItemMaster action = new Create_U9_ItemMaster();
|
|
res = action.CustCreateItemMaster(d);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
res.MESSAGE = ex.Message;
|
|
res.IsSuccess = false;
|
|
}
|
|
|
|
str = JsonConvert.SerializeObject(res);
|
|
result.Content = new StringContent(str.ToString(), Encoding.GetEncoding("UTF-8"), "application/json");
|
|
return result;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
res.MESSAGE = ex.Message;
|
|
res.IsSuccess = false;
|
|
str = JsonConvert.SerializeObject(res);
|
|
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
|
|
return result;
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
/// 采购订单
|
|
/// </summary>
|
|
/// <param name="JsonData"></param>
|
|
/// <returns></returns>
|
|
[Route("api/CreatePO")]
|
|
[HttpPost]
|
|
public HttpResponseMessage CreatePO(List<Pohead> d)
|
|
{
|
|
HttpResponseMessage result = new HttpResponseMessage();
|
|
string str = string.Empty;
|
|
UFIDA.ISV.CreatePoSrvSub.OperationResult res = new UFIDA.ISV.CreatePoSrvSub.OperationResult();
|
|
try
|
|
{
|
|
try
|
|
{
|
|
str = JsonConvert.SerializeObject(d);
|
|
Appconfig.WriteLogFile(str.ToString(), "创建U9采购订单信息");
|
|
CustCallUFIDAISVCreatePoSrvSub action = new CustCallUFIDAISVCreatePoSrvSub();
|
|
res = action.CustCreatePo(d);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
res.MESSAGE = ex.Message;
|
|
res.IsSuccess = false;
|
|
}
|
|
str = JsonConvert.SerializeObject(res);
|
|
result.Content = new StringContent(str.ToString(), Encoding.GetEncoding("UTF-8"), "application/json");
|
|
return result;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
res.MESSAGE = ex.Message;
|
|
res.IsSuccess = false;
|
|
str = JsonConvert.SerializeObject(res);
|
|
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
|
|
return result;
|
|
}
|
|
}
|
|
|
|
/// 委外采购订单
|
|
/// </summary>
|
|
/// <param name="JsonData"></param>
|
|
/// <returns></returns>
|
|
[Route("api/CreateWPO")]
|
|
[HttpPost]
|
|
public HttpResponseMessage CreateWPO(List<Pohead> d)
|
|
{
|
|
HttpResponseMessage result = new HttpResponseMessage();
|
|
string str = string.Empty;
|
|
UFIDA.ISV.CreatePoSrvSub.OperationResult res = new UFIDA.ISV.CreatePoSrvSub.OperationResult();
|
|
try
|
|
{
|
|
try
|
|
{
|
|
str = JsonConvert.SerializeObject(d);
|
|
Appconfig.WriteLogFile(str.ToString(), "创建U9委外采购订单信息");
|
|
CustCallUFIDAISVCreatePoSrvSub action = new CustCallUFIDAISVCreatePoSrvSub();
|
|
res = action.CustCreatePo(d);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
res.MESSAGE = ex.Message;
|
|
res.IsSuccess = false;
|
|
}
|
|
str = JsonConvert.SerializeObject(res);
|
|
result.Content = new StringContent(str.ToString(), Encoding.GetEncoding("UTF-8"), "application/json");
|
|
return result;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
res.MESSAGE = ex.Message;
|
|
res.IsSuccess = false;
|
|
str = JsonConvert.SerializeObject(res);
|
|
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
|
|
return result;
|
|
}
|
|
}
|
|
|
|
/// 销售变更
|
|
/// </summary>
|
|
/// <param name="JsonData"></param>
|
|
/// <returns></returns>
|
|
[Route("api/CreateSOC")]
|
|
[HttpPost]
|
|
public HttpResponseMessage CreateSOC(ModifySoDTO d)
|
|
{
|
|
|
|
HttpResponseMessage result = new HttpResponseMessage();
|
|
string str = string.Empty;
|
|
QMResultDTOData res = new QMResultDTOData();
|
|
try
|
|
{
|
|
|
|
try
|
|
{
|
|
|
|
str = JsonConvert.SerializeObject(d);
|
|
|
|
Appconfig.WriteLogFile(str.ToString(), "创建U9销售变更信息");
|
|
|
|
CustModifySO action = new CustModifySO();
|
|
res = action.CreateSOModify(d);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
res.Message = ex.Message;
|
|
res.IsSuccess = false;
|
|
}
|
|
|
|
str = JsonConvert.SerializeObject(res);
|
|
result.Content = new StringContent(str.ToString(), Encoding.GetEncoding("UTF-8"), "application/json");
|
|
return result;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
res.Message = ex.Message;
|
|
res.IsSuccess = false;
|
|
str = JsonConvert.SerializeObject(res);
|
|
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
|
|
return result;
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
/// 调入单
|
|
/// </summary>
|
|
/// <param name="d"></param>
|
|
/// <returns></returns>
|
|
[Route("api/CreateTranIN")]
|
|
[HttpPost]
|
|
public HttpResponseMessage CreateTranIN([FromBody]object ListJson)
|
|
{
|
|
HttpResponseMessage result = new HttpResponseMessage();
|
|
string str = string.Empty;
|
|
ICS.CreateTransInDoc.ReturnValue res = new ICS.CreateTransInDoc.ReturnValue();
|
|
res.IsSuccess = false;
|
|
res.Message = "";
|
|
//res.DocNo = "";
|
|
try
|
|
{
|
|
try
|
|
{
|
|
Appconfig.WriteLogFile(ListJson.ToString(), "调入单");
|
|
List<ICS.CreateTransInDoc.ITEMREQDATA> List = JsonConvert.DeserializeObject<List<ICS.CreateTransInDoc.ITEMREQDATA>>(ListJson.ToString());
|
|
res = ICS.CreateTransInDoc.CreateTransInDoc.CustCreatePR(List);
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
res.Message = ex.Message;
|
|
res.IsSuccess = false;
|
|
}
|
|
|
|
str = JsonConvert.SerializeObject(res);
|
|
result.Content = new StringContent(str.ToString(), Encoding.GetEncoding("UTF-8"), "application/json");
|
|
return result;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
res.Message = ex.Message;
|
|
res.IsSuccess = false;
|
|
str = JsonConvert.SerializeObject(res);
|
|
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
|
|
return result;
|
|
}
|
|
|
|
}
|
|
|
|
/// 创建采购退料单
|
|
/// </summary>
|
|
/// <param name="d"></param>
|
|
/// <returns></returns>
|
|
[Route("api/APICreatPOOUT")]
|
|
[HttpPost]
|
|
public HttpResponseMessage APICreatPOOUT([FromBody]object ListJson)
|
|
{
|
|
HttpResponseMessage result = new HttpResponseMessage();
|
|
string str = string.Empty;
|
|
ICS.CreateCreateRcvRest.ReturnValue res = new ICS.CreateCreateRcvRest.ReturnValue();
|
|
try
|
|
{
|
|
|
|
try
|
|
{
|
|
Appconfig.WriteLogFile(ListJson.ToString(), "采购退货单");
|
|
List<ICS.CreateCreateRcvRest.ITEMREQDATA> List = JsonConvert.DeserializeObject<List<ICS.CreateCreateRcvRest.ITEMREQDATA>>(ListJson.ToString());
|
|
|
|
res = ICS.CreateCreateRcvRest.CreateRcv.CustCreatePR(List);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
res.Message = ex.Message;
|
|
res.IsSuccess = false;
|
|
}
|
|
|
|
str = JsonConvert.SerializeObject(res);
|
|
result.Content = new StringContent(str.ToString(), Encoding.GetEncoding("UTF-8"), "application/json");
|
|
return result;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
res.Message = ex.Message;
|
|
res.IsSuccess = false;
|
|
str = JsonConvert.SerializeObject(res);
|
|
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
|
|
return result;
|
|
}
|
|
}
|
|
|
|
|
|
/// 生产订单
|
|
/// </summary>
|
|
/// <param name="JsonData"></param>
|
|
/// <returns></returns>
|
|
[Route("api/CreateMO")]
|
|
[HttpPost]
|
|
public HttpResponseMessage CreateMO(MO d)
|
|
{
|
|
HttpResponseMessage result = new HttpResponseMessage();
|
|
string str = string.Empty;
|
|
UFIDA.ISV.CreateMO.OperationResult res = new UFIDA.ISV.CreateMO.OperationResult();
|
|
try
|
|
{
|
|
try
|
|
{
|
|
str = JsonConvert.SerializeObject(d);
|
|
Appconfig.WriteLogFile(str.ToString(), "创建U9生产订单信息");
|
|
CustCreateMO action = new CustCreateMO();
|
|
res = action.CreateU9MO(d);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
res.MESSAGE = ex.Message;
|
|
res.IsSuccess = false;
|
|
}
|
|
str = JsonConvert.SerializeObject(res);
|
|
result.Content = new StringContent(str.ToString(), Encoding.GetEncoding("UTF-8"), "application/json");
|
|
return result;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
res.MESSAGE = ex.Message;
|
|
res.IsSuccess = false;
|
|
str = JsonConvert.SerializeObject(res);
|
|
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
|
|
return result;
|
|
}
|
|
}
|
|
|
|
|
|
/// 生产备料
|
|
/// </summary>
|
|
/// <param name="JsonData"></param>
|
|
/// <returns></returns>
|
|
[Route("api/CreateMOPickList")]
|
|
[HttpPost]
|
|
public HttpResponseMessage CreateMOPickList(List<CreateIssue.IssueData> modellist)
|
|
{
|
|
//string SODonNo = DateTime.Now.Year.ToString().Substring(2) + "0476"; ;
|
|
HttpResponseMessage result = new HttpResponseMessage();
|
|
string str = string.Empty;
|
|
ICS.CreateIssueIN.CreateIssue.OperationResult res = new ICS.CreateIssueIN.CreateIssue.OperationResult();
|
|
try
|
|
{
|
|
try
|
|
{
|
|
str = JsonConvert.SerializeObject(modellist);
|
|
Appconfig.WriteLogFile(str.ToString(), "创建U9生产备料信息");
|
|
CreateIssue action = new CreateIssue();
|
|
res = action.CreateIssue1(modellist);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
res.MESSAGE = ex.Message;
|
|
res.IsSuccess = false;
|
|
}
|
|
str = JsonConvert.SerializeObject(res);
|
|
result.Content = new StringContent(str.ToString(), Encoding.GetEncoding("UTF-8"), "application/json");
|
|
return result;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
res.MESSAGE = ex.Message;
|
|
res.IsSuccess = false;
|
|
str = JsonConvert.SerializeObject(res);
|
|
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
|
|
return result;
|
|
}
|
|
}
|
|
|
|
/// 委外备料
|
|
/// </summary>
|
|
/// <param name="JsonData"></param>
|
|
/// <returns></returns>
|
|
[Route("api/CreateOIssueIN")]
|
|
[HttpPost]
|
|
public HttpResponseMessage CreateOIssueIN(List<CreateOIssue.IssueData> d)
|
|
{
|
|
HttpResponseMessage result = new HttpResponseMessage();
|
|
string str = string.Empty;
|
|
ICS.CreateIssueIN.CreateOIssue.OperationResult res = new ICS.CreateIssueIN.CreateOIssue.OperationResult();
|
|
try
|
|
{
|
|
try
|
|
{
|
|
str = JsonConvert.SerializeObject(d);
|
|
Appconfig.WriteLogFile(str.ToString(), "创建U9委外备料信息");
|
|
CreateOIssue action = new CreateOIssue();
|
|
res = action.CreateIssue(d);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
res.MESSAGE = ex.Message;
|
|
res.IsSuccess = false;
|
|
}
|
|
str = JsonConvert.SerializeObject(res);
|
|
result.Content = new StringContent(str.ToString(), Encoding.GetEncoding("UTF-8"), "application/json");
|
|
return result;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
res.MESSAGE = ex.Message;
|
|
res.IsSuccess = false;
|
|
str = JsonConvert.SerializeObject(res);
|
|
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
|
|
return result;
|
|
}
|
|
}
|
|
|
|
|
|
[Route("api/APICreatePO")]
|
|
[HttpPost]
|
|
public HttpResponseMessage APICreatePO([FromBody]object ListJson)
|
|
{
|
|
string str = string.Empty;
|
|
HttpResponseMessage result = new HttpResponseMessage();
|
|
CreatePOOperationResult _result = new CreatePOOperationResult();
|
|
try
|
|
{
|
|
Appconfig.WriteLogFile(str.ToString(), "创建采购订单传入日志");
|
|
|
|
List<ICSSoft.Entity.PO> POList = JsonConvert.DeserializeObject<List<ICSSoft.Entity.PO>>(ListJson.ToString());
|
|
if (POList == null)
|
|
{
|
|
_result.Message = "请传入信息";
|
|
_result.IsSuccess = false;
|
|
str = JsonConvert.SerializeObject(_result);
|
|
result.Content = new StringContent(str.ToString(), Encoding.GetEncoding("UTF-8"), "application/json");
|
|
Appconfig.WriteLogFile(str.ToString(), "创建采购订单异常日志");
|
|
return result;
|
|
}
|
|
List<POInput> _SOFileList = new List<POInput>();
|
|
if (POList != null && POList.Count > 0)
|
|
{
|
|
foreach (var d in POList)
|
|
{
|
|
if (!string.IsNullOrWhiteSpace(d.OrgCode))
|
|
{
|
|
POInput model = new POInput();
|
|
|
|
model.DocNo = d.DocNo;
|
|
model.BizType = 316;
|
|
model.BusinessDate = d.BusinessDate;
|
|
model.bz = d.bz;
|
|
model.DocumentType = d.DocumentType;
|
|
model.IsPriceIncludeTax = d.IsPriceIncludeTax;
|
|
model.OrgCode = d.OrgCode;
|
|
model.Supplier = new Supplier();
|
|
|
|
string SupplierID = Appconfig.GetSupplierID(d.Supplier, d.OrgCode);
|
|
model.Supplier.ID = SupplierID;
|
|
if (string.IsNullOrWhiteSpace(SupplierID))
|
|
{
|
|
_result.Message = "传入供应编码不存在,请核对数据";
|
|
_result.IsSuccess = false;
|
|
str = JsonConvert.SerializeObject(_result);
|
|
result.Content = new StringContent(str.ToString(), Encoding.GetEncoding("UTF-8"), "application/json");
|
|
Appconfig.WriteLogFile(str.ToString(), "创建采购订单异常日志");
|
|
return result;
|
|
}
|
|
List<POLineInput> POLineList = new List<POLineInput>();
|
|
foreach (var item in d.POLines)
|
|
{
|
|
POLineInput POLineModel = new POLineInput();
|
|
string ItemID = Appconfig.GetITEMMATERID(item.ItemCode, d.OrgCode);
|
|
POLineModel.ItemInfo = new ItemInfo();
|
|
POLineModel.ItemInfo.m_iD = ItemID;
|
|
POLineModel.ItemInfo.m_code = item.ItemCode;
|
|
|
|
POLineModel.IsPresent = item.IsPresent;
|
|
POLineModel.ReqQtyTBU = item.ReqQtyTBU;
|
|
POLineModel.ReqQtyTU = item.ReqQtyTU;
|
|
POLineModel.SupplierConfirmQtyTBU = item.SupplierConfirmQtyTBU;
|
|
POLineModel.SupplierConfirmQtyTU = item.SupplierConfirmQtyTU;
|
|
|
|
string TaxScheduleID = Appconfig.GetTaxSchedule(item.TaxSchedule);
|
|
POLineModel.TaxSchedule = new TaxSchedule();
|
|
POLineModel.TaxSchedule.m_iD = TaxScheduleID;
|
|
POLineModel.TaxSchedule.m_code = item.TaxSchedule;
|
|
|
|
POLineModel.Seiban = new Seiban();
|
|
POLineModel.Seiban.m_iD = 0L;
|
|
POLineModel.Seiban.m_code = "";
|
|
|
|
//POLineModel.SeiBanCode = item.SeiBanCode;
|
|
|
|
POLineModel.FinallyPriceTC = item.FinallyPriceTC;
|
|
|
|
POLineList.Add(POLineModel);
|
|
}
|
|
model.POLineDTOList = POLineList;// new List<POLineInput>();
|
|
_SOFileList.Add(model);
|
|
}
|
|
}
|
|
str = JsonConvert.SerializeObject(_SOFileList);
|
|
|
|
|
|
string url = "http://{2}/u9c/webapi/OAuth2/GetAuthorizeCode?clientid={0}&clientsecret={1}";
|
|
url = string.Format(url, ConfigurationManager.AppSettings["clientid"].ToString(), ConfigurationManager.AppSettings["clientsecret"].ToString(), ConfigurationManager.AppSettings["U9IP"].ToString());
|
|
string resultuu = PostData.GetInfo("", url);
|
|
|
|
JObject objuu = new JObject();
|
|
objuu = JObject.Parse(resultuu);
|
|
|
|
string keyCode = objuu["Data"].ToString();
|
|
if (!string.IsNullOrWhiteSpace(keyCode))
|
|
{
|
|
string ToeknUrl = "http://{4}/u9c/webapi/OAuth2/Login?userCode={0}&entcode={1}&orgcode={2}&code={3}";
|
|
ToeknUrl = string.Format(ToeknUrl, ConfigurationManager.AppSettings["userCode"].ToString(), ConfigurationManager.AppSettings["enterpriseID"].ToString(), POList[0].OrgCode, keyCode, ConfigurationManager.AppSettings["U9IP"].ToString());
|
|
string resultToken = PostData.GetInfo("", ToeknUrl);
|
|
|
|
JObject objToken = new JObject();
|
|
objuu = JObject.Parse(resultToken);
|
|
string TokenCode = objuu["Data"].ToString();
|
|
if (!string.IsNullOrWhiteSpace(TokenCode))
|
|
{
|
|
string CreatePOUrl = "http://{0}/u9c/webapi/PurchaseOrder/Create";
|
|
CreatePOUrl = string.Format(CreatePOUrl, ConfigurationManager.AppSettings["U9IP"].ToString());
|
|
|
|
//_SOFileList.Add(model);// = model;
|
|
string postData = JsonConvert.SerializeObject(_SOFileList);
|
|
|
|
Appconfig.WriteLogFile(postData.ToString(), "创建采购订单日志");
|
|
|
|
string resultCreateSoFile = PostData.APT(CreatePOUrl, postData, TokenCode);
|
|
bool IsSucess = false;
|
|
|
|
if (objuu["ResCode"].ToString() != "0")
|
|
{
|
|
IsSucess = false;
|
|
}
|
|
else
|
|
{
|
|
IsSucess = true;
|
|
}
|
|
_result.Message = resultCreateSoFile;
|
|
_result.IsSuccess = IsSucess;
|
|
str = JsonConvert.SerializeObject(_result);
|
|
result.Content = new StringContent(str.ToString(), Encoding.GetEncoding("UTF-8"), "application/json");
|
|
|
|
Appconfig.WriteLogFile(str.ToString(), "创建采购订单日志");
|
|
|
|
return result;
|
|
}
|
|
else
|
|
{
|
|
string returnMessage = objuu["ResMsg"].ToString();
|
|
_result.Message = objuu["ResMsg"].ToString();
|
|
_result.IsSuccess = false;
|
|
str = JsonConvert.SerializeObject(_result);
|
|
result.Content = new StringContent(str.ToString(), Encoding.GetEncoding("UTF-8"), "application/json");
|
|
|
|
Appconfig.WriteLogFile(str.ToString(), "创建采购订单异常日志");
|
|
|
|
return result;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
_result.Message = "获取授权码为空";
|
|
_result.IsSuccess = false;
|
|
str = JsonConvert.SerializeObject(_result);
|
|
result.Content = new StringContent(str.ToString(), Encoding.GetEncoding("UTF-8"), "application/json");
|
|
|
|
Appconfig.WriteLogFile(str.ToString(), "创建采购订单异常日志");
|
|
return result;
|
|
}
|
|
|
|
}
|
|
str = JsonConvert.SerializeObject(_result);
|
|
result.Content = new StringContent(str.ToString(), Encoding.GetEncoding("UTF-8"), "application/json");
|
|
|
|
Appconfig.WriteLogFile(str.ToString(), "创建采购订单日志");
|
|
|
|
return result;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
_result.Message = ex.ToString();
|
|
_result.IsSuccess = false;
|
|
str = JsonConvert.SerializeObject(_result);
|
|
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
|
|
Appconfig.WriteLogFile(str.ToString(), "创建采购订单异常日志");
|
|
|
|
return result;
|
|
}
|
|
}
|
|
|
|
|
|
[Route("api/APICreateWWPO")]
|
|
[HttpPost]
|
|
public HttpResponseMessage APICreateWWPO([FromBody]object ListJson)
|
|
{
|
|
string str = string.Empty;
|
|
HttpResponseMessage result = new HttpResponseMessage();
|
|
CreatePOOperationResult _result = new CreatePOOperationResult();
|
|
try
|
|
{
|
|
Appconfig.WriteLogFile(str.ToString(), "创建委外采购订单传入日志");
|
|
|
|
List<ICSSoft.Entity.PO> POList = JsonConvert.DeserializeObject<List<ICSSoft.Entity.PO>>(ListJson.ToString());
|
|
if (POList == null)
|
|
{
|
|
_result.Message = "请传入信息";
|
|
_result.IsSuccess = false;
|
|
str = JsonConvert.SerializeObject(_result);
|
|
result.Content = new StringContent(str.ToString(), Encoding.GetEncoding("UTF-8"), "application/json");
|
|
Appconfig.WriteLogFile(str.ToString(), "创建委外采购订单异常日志");
|
|
return result;
|
|
}
|
|
List<POInput> _SOFileList = new List<POInput>();
|
|
if (POList != null && POList.Count > 0)
|
|
{
|
|
foreach (var d in POList)
|
|
{
|
|
if (!string.IsNullOrWhiteSpace(d.OrgCode))
|
|
{
|
|
POInput model = new POInput();
|
|
|
|
model.DocNo = d.DocNo;
|
|
model.BizType = 326;//全程委外采购 326 工序外协采购 325
|
|
model.BusinessDate = d.BusinessDate;
|
|
model.bz = d.bz;
|
|
model.DocumentType = d.DocumentType;
|
|
model.IsPriceIncludeTax = d.IsPriceIncludeTax;
|
|
model.OrgCode = d.OrgCode;
|
|
model.Supplier = new Supplier();
|
|
|
|
string SupplierID = Appconfig.GetSupplierID(d.Supplier, d.OrgCode);
|
|
model.Supplier.ID = SupplierID;
|
|
if (string.IsNullOrWhiteSpace(SupplierID))
|
|
{
|
|
_result.Message = "传入供应编码不存在,请核对数据";
|
|
_result.IsSuccess = false;
|
|
str = JsonConvert.SerializeObject(_result);
|
|
result.Content = new StringContent(str.ToString(), Encoding.GetEncoding("UTF-8"), "application/json");
|
|
Appconfig.WriteLogFile(str.ToString(), "创建委外采购订单异常日志");
|
|
return result;
|
|
}
|
|
List<POLineInput> POLineList = new List<POLineInput>();
|
|
foreach (var item in d.POLines)
|
|
{
|
|
POLineInput POLineModel = new POLineInput();
|
|
string ItemID = Appconfig.GetITEMMATERID(item.ItemCode, d.OrgCode);
|
|
POLineModel.ItemInfo = new ItemInfo();
|
|
POLineModel.ItemInfo.m_iD = ItemID;
|
|
POLineModel.ItemInfo.m_code = item.ItemCode;
|
|
|
|
POLineModel.IsPresent = item.IsPresent;
|
|
POLineModel.ReqQtyTBU = item.ReqQtyTBU;
|
|
POLineModel.ReqQtyTU = item.ReqQtyTU;
|
|
POLineModel.SupplierConfirmQtyTBU = item.SupplierConfirmQtyTBU;
|
|
POLineModel.SupplierConfirmQtyTU = item.SupplierConfirmQtyTU;
|
|
|
|
string TaxScheduleID = Appconfig.GetTaxSchedule(item.TaxSchedule);
|
|
POLineModel.TaxSchedule = new TaxSchedule();
|
|
POLineModel.TaxSchedule.m_iD = TaxScheduleID;
|
|
POLineModel.TaxSchedule.m_code = item.TaxSchedule;
|
|
|
|
POLineModel.FinallyPriceTC = item.FinallyPriceTC;
|
|
|
|
POLineList.Add(POLineModel);
|
|
}
|
|
model.POLineDTOList = POLineList;// new List<POLineInput>();
|
|
_SOFileList.Add(model);
|
|
}
|
|
}
|
|
str = JsonConvert.SerializeObject(_SOFileList);
|
|
|
|
string url = "http://{2}/u9c/webapi/OAuth2/GetAuthorizeCode?clientid={0}&clientsecret={1}";
|
|
url = string.Format(url, ConfigurationManager.AppSettings["clientid"].ToString(), ConfigurationManager.AppSettings["clientsecret"].ToString(), ConfigurationManager.AppSettings["U9IP"].ToString());
|
|
string resultuu = PostData.GetInfo("", url);
|
|
|
|
JObject objuu = new JObject();
|
|
objuu = JObject.Parse(resultuu);
|
|
|
|
string keyCode = objuu["Data"].ToString();
|
|
if (!string.IsNullOrWhiteSpace(keyCode))
|
|
{
|
|
string ToeknUrl = "http://{4}/u9c/webapi/OAuth2/Login?userCode={0}&entcode={1}&orgcode={2}&code={3}";
|
|
ToeknUrl = string.Format(ToeknUrl, ConfigurationManager.AppSettings["userCode"].ToString(), ConfigurationManager.AppSettings["enterpriseID"].ToString(), POList[0].OrgCode, keyCode, ConfigurationManager.AppSettings["U9IP"].ToString());
|
|
string resultToken = PostData.GetInfo("", ToeknUrl);
|
|
|
|
JObject objToken = new JObject();
|
|
objuu = JObject.Parse(resultToken);
|
|
string TokenCode = objuu["Data"].ToString();
|
|
if (!string.IsNullOrWhiteSpace(TokenCode))
|
|
{
|
|
string CreatePOUrl = "http://{0}/u9c/webapi/PurchaseOrder/Create";
|
|
CreatePOUrl = string.Format(CreatePOUrl, ConfigurationManager.AppSettings["U9IP"].ToString());
|
|
|
|
//_SOFileList.Add(model);// = model;
|
|
string postData = JsonConvert.SerializeObject(_SOFileList);
|
|
|
|
Appconfig.WriteLogFile(postData.ToString(), "创建委外采购订单日志");
|
|
|
|
string resultCreateSoFile = PostData.APT(CreatePOUrl, postData, TokenCode);
|
|
bool IsSucess = false;
|
|
|
|
if (objuu["ResCode"].ToString() != "0")
|
|
{
|
|
IsSucess = false;
|
|
}
|
|
else
|
|
{
|
|
IsSucess = true;
|
|
}
|
|
_result.Message = resultCreateSoFile;
|
|
_result.IsSuccess = IsSucess;
|
|
str = JsonConvert.SerializeObject(_result);
|
|
result.Content = new StringContent(str.ToString(), Encoding.GetEncoding("UTF-8"), "application/json");
|
|
|
|
Appconfig.WriteLogFile(str.ToString(), "创建委外采购订单日志");
|
|
|
|
return result;
|
|
}
|
|
else
|
|
{
|
|
string returnMessage = objuu["ResMsg"].ToString();
|
|
_result.Message = objuu["ResMsg"].ToString();
|
|
_result.IsSuccess = false;
|
|
str = JsonConvert.SerializeObject(_result);
|
|
result.Content = new StringContent(str.ToString(), Encoding.GetEncoding("UTF-8"), "application/json");
|
|
|
|
Appconfig.WriteLogFile(str.ToString(), "创建委外采购订单异常日志");
|
|
|
|
return result;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
_result.Message = "获取授权码为空";
|
|
_result.IsSuccess = false;
|
|
str = JsonConvert.SerializeObject(_result);
|
|
result.Content = new StringContent(str.ToString(), Encoding.GetEncoding("UTF-8"), "application/json");
|
|
|
|
Appconfig.WriteLogFile(str.ToString(), "创建委外采购订单异常日志");
|
|
return result;
|
|
}
|
|
|
|
}
|
|
str = JsonConvert.SerializeObject(_result);
|
|
result.Content = new StringContent(str.ToString(), Encoding.GetEncoding("UTF-8"), "application/json");
|
|
|
|
Appconfig.WriteLogFile(str.ToString(), "创建委外采购订单日志");
|
|
|
|
return result;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
_result.Message = ex.ToString();
|
|
_result.IsSuccess = false;
|
|
str = JsonConvert.SerializeObject(_result);
|
|
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
|
|
Appconfig.WriteLogFile(str.ToString(), "创建委外采购订单异常日志");
|
|
|
|
return result;
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|