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.
726 lines
29 KiB
726 lines
29 KiB
using ICS.WCF.Base;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Configuration;
|
|
using System.Data;
|
|
using System.Linq;
|
|
using System.ServiceModel;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using UFIDA.ISV.ApproveMiscRcv;
|
|
using UFIDA.ISV.CreateLotMaster;
|
|
using UFIDA.ISV.SubmitMisRcv;
|
|
using UFSoft.UBF.Service;
|
|
using UFSoft.UBF.Util.Context;
|
|
using www.ufida.org.EntityData;
|
|
|
|
namespace UFIDA.ISV.CreateBFMiscRcv
|
|
{
|
|
|
|
public class CustCreateBFMiscRcv
|
|
{
|
|
public List<rtnRcvInfo> CreateBFMisRcv(List<rCVhead> rCVInfoList)
|
|
{
|
|
#region 接口传入参数日志
|
|
StringBuilder firststrlog = new StringBuilder();
|
|
firststrlog.AppendLine("传入数据开始");
|
|
firststrlog.AppendLine("*****************************************************");
|
|
foreach (var item in rCVInfoList)
|
|
{
|
|
firststrlog.AppendLine("单据编号:" + item.DocNO);
|
|
firststrlog.AppendLine("单据类型:" + item.DocType);
|
|
firststrlog.AppendLine("组织编码:" + item.OrgCode);
|
|
firststrlog.AppendLine("客户编码:" + item.ClientCode);
|
|
firststrlog.AppendLine("用户名:" + item.UserName);
|
|
foreach (var line in item.lines)
|
|
{
|
|
firststrlog.AppendLine("料品编码:" + line.ItemCode);
|
|
firststrlog.AppendLine("料品数量:" + line.ReqQty);
|
|
firststrlog.AppendLine("批号:" + line.Batch);
|
|
firststrlog.AppendLine("仓库:" + line.WhCode);
|
|
firststrlog.AppendLine("部门编码:" + line.DeptCode);
|
|
}
|
|
}
|
|
firststrlog.AppendLine("*****************************************************");
|
|
firststrlog.AppendLine("传入数据结束");
|
|
Appconfig.WriteLogFile(firststrlog.ToString(), "创建杂收单");
|
|
#endregion
|
|
#region 服务调用框架结构
|
|
UFIDAU9ISVMiscRcvISVICommonCreateMiscRcvClient client = new UFIDAU9ISVMiscRcvISVICommonCreateMiscRcvClient();
|
|
//服务返回结果
|
|
UFIDAU9CBOPubControllerCommonArchiveDataDTOData[] returnItems;
|
|
//返回异常信息,目前还没有使用此属性
|
|
UFSoft.UBF.Exceptions.MessageBase[] returnMsg;
|
|
//上下文信息
|
|
object context;
|
|
//传入 参数
|
|
UFIDAU9ISVMiscRcvISVIC_MiscRcvDTOData[] pOList;
|
|
//空
|
|
string[] splitBy = new string[] { };
|
|
|
|
try
|
|
{
|
|
List<rtnRcvInfo> rtnpos = new List<rtnRcvInfo>();
|
|
long PickID = 0;
|
|
long ItemID = 0;
|
|
if (rCVInfoList == null || rCVInfoList.Count == 0)
|
|
{
|
|
rtnRcvInfo rtnpo = new rtnRcvInfo();
|
|
rtnpo.IsSuccess = false;
|
|
rtnpo.Message = "传入参数不能为空";
|
|
rtnpos.Add(rtnpo);
|
|
return rtnpos;
|
|
}
|
|
string OrgID = "";
|
|
foreach (var item in rCVInfoList)
|
|
{
|
|
if (item.DocType == null || item.DocType == "")
|
|
{
|
|
rtnRcvInfo rtnpo = new rtnRcvInfo();
|
|
rtnpo.IsSuccess = false;
|
|
rtnpo.Message = "传入单据类型不能为空";
|
|
rtnpos.Add(rtnpo);
|
|
return rtnpos;
|
|
}
|
|
//if (item.ClientCode == null || item.ClientCode == "")
|
|
//{
|
|
// rtnRcvInfo rtnpo = new rtnRcvInfo();
|
|
// rtnpo.IsSuccess = false;
|
|
// rtnpo.Message = "传入客户信息不能为空";
|
|
// rtnpos.Add(rtnpo);
|
|
// return rtnpos;
|
|
//}
|
|
if (item.lines == null || item.lines.Count() == 0)
|
|
{
|
|
rtnRcvInfo rtnpo = new rtnRcvInfo();
|
|
rtnpo.IsSuccess = false;
|
|
rtnpo.Message = "传入行信息不能为空";
|
|
rtnpos.Add(rtnpo);
|
|
return rtnpos;
|
|
}
|
|
foreach (var _item in item.lines)
|
|
{
|
|
if (_item.ItemCode == null || _item.ItemCode == "")
|
|
{
|
|
rtnRcvInfo rtnpo = new rtnRcvInfo();
|
|
rtnpo.IsSuccess = false;
|
|
rtnpo.Message = "传入行信息中料号不能为空!";
|
|
rtnpos.Add(rtnpo);
|
|
return rtnpos;
|
|
}
|
|
if (_item.ReqQty == 0)
|
|
{
|
|
rtnRcvInfo rtnpo = new rtnRcvInfo();
|
|
rtnpo.IsSuccess = false;
|
|
rtnpo.Message = "传入行信息中数量不能为空";
|
|
rtnpos.Add(rtnpo);
|
|
return rtnpos;
|
|
}
|
|
if (_item.WhCode == null || _item.WhCode == "")
|
|
{
|
|
rtnRcvInfo rtnpo = new rtnRcvInfo();
|
|
rtnpo.IsSuccess = false;
|
|
rtnpo.Message = "传入行信息中仓库不能为空";
|
|
rtnpos.Add(rtnpo);
|
|
return rtnpos;
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
//给传入参数赋值
|
|
|
|
//pOList = SetrCVDtos(rCVInfoList);
|
|
StringBuilder strlog = new StringBuilder();
|
|
string orgID = "";
|
|
strlog.AppendLine("创建杂收单");
|
|
strlog.AppendLine("*****************************************************");
|
|
List<UFIDAU9ISVMiscRcvISVIC_MiscRcvDTOData> rcvList = new List<UFIDAU9ISVMiscRcvISVIC_MiscRcvDTOData>();
|
|
foreach (var rCVhead in rCVInfoList)
|
|
{
|
|
strlog.AppendLine("组织编码:" + rCVhead.OrgCode);
|
|
//获取组织ID
|
|
string orgsql = @"select ID from Base_Organization
|
|
where Code='{0}' ";
|
|
orgsql = string.Format(orgsql, rCVhead.OrgCode);
|
|
DataTable orgdt = DBhlper.Query(orgsql, Appconfig.GetU9ConnStr());
|
|
if (orgdt.Rows.Count == 0)
|
|
{
|
|
rtnRcvInfo rtnpo = new rtnRcvInfo();
|
|
rtnpo.IsSuccess = false;
|
|
rtnpo.Message = "组织编码不存在";
|
|
rtnpos.Add(rtnpo);
|
|
return rtnpos;
|
|
}
|
|
else
|
|
{
|
|
orgID = orgdt.Rows[0]["ID"].ToString();
|
|
}
|
|
//获取单据类型ID
|
|
string docsql = @"select ID from InvDoc_MiscRcvDocType
|
|
where Code='{0}' AND Org='{1}'";
|
|
docsql = string.Format(docsql, rCVhead.DocType, orgID);
|
|
DataTable docdt = DBhlper.Query(docsql, Appconfig.GetU9ConnStr());
|
|
long docTypeID = 0;
|
|
if (docdt != null && docdt.Rows.Count > 0)
|
|
{
|
|
docTypeID = long.Parse(docdt.Rows[0]["ID"].ToString());
|
|
}
|
|
if (docTypeID == 0)
|
|
{
|
|
rtnRcvInfo rtnpo = new rtnRcvInfo();
|
|
rtnpo.IsSuccess = false;
|
|
rtnpo.Message = "未获取到单据类型ID";
|
|
rtnpos.Add(rtnpo);
|
|
return rtnpos;
|
|
}
|
|
UFIDAU9ISVMiscRcvISVIC_MiscRcvDTOData rcv = new UFIDAU9ISVMiscRcvISVIC_MiscRcvDTOData();
|
|
rcv.m_docNo = rCVhead.DocNO;
|
|
rcv.m_miscRcvDocType = new UFIDAU9CBOPubControllerCommonArchiveDataDTOData();
|
|
rcv.m_miscRcvDocType.m_code = rCVhead.DocType;
|
|
rcv.m_miscRcvDocType.m_iD = docTypeID;
|
|
rcv.m_benefitOrg = long.Parse(orgID);
|
|
List<UFIDAU9ISVMiscRcvISVIC_MiscRcvTransLsDTOData> rcvLineList = new List<UFIDAU9ISVMiscRcvISVIC_MiscRcvTransLsDTOData>();
|
|
foreach (rCVLine line in rCVhead.lines)
|
|
{
|
|
#region 获取料品ID
|
|
string sqlitem = @"select ID from CBO_ItemMaster
|
|
where Code='" + line.ItemCode + "' AND Org='" + orgID + "'";
|
|
sqlitem = string.Format(sqlitem);
|
|
DataTable dtitem = DBhlper.Query(sqlitem, Appconfig.GetU9ConnStr());
|
|
if (dtitem.Rows.Count > 0)
|
|
{
|
|
ItemID = long.Parse(dtitem.Rows[0]["ID"].ToString());
|
|
}
|
|
else
|
|
{
|
|
rtnRcvInfo rtnpo = new rtnRcvInfo();
|
|
rtnpo.IsSuccess = false;
|
|
rtnpo.Message = "料品不存在!";
|
|
rtnpos.Add(rtnpo);
|
|
return rtnpos;
|
|
}
|
|
#endregion
|
|
#region 获取仓库ID
|
|
string sqlWH = @"select ID,Code from CBO_Wh
|
|
WHERE Code='" + line.WhCode + "' AND Org='" + orgID + "' ";
|
|
sqlWH = string.Format(sqlWH);
|
|
DataTable _dtWH = DBhlper.Query(sqlWH, Appconfig.GetU9ConnStr());
|
|
string WHCode = string.Empty;
|
|
long WHID = 0;
|
|
if (_dtWH != null && _dtWH.Rows.Count > 0)
|
|
{
|
|
WHCode = _dtWH.Rows[0]["Code"].ToString();
|
|
WHID = long.Parse(_dtWH.Rows[0]["ID"].ToString());
|
|
}
|
|
if (string.IsNullOrWhiteSpace(WHCode))
|
|
{
|
|
rtnRcvInfo rtnpo = new rtnRcvInfo();
|
|
rtnpo.IsSuccess = false;
|
|
rtnpo.Message = "未获取到仓库";
|
|
rtnpos.Add(rtnpo);
|
|
return rtnpos;
|
|
}
|
|
#endregion
|
|
#region 获取部门ID
|
|
string deptsql = @"select ID from CBO_Department
|
|
where Code='{0}' AND Org='{1}'";
|
|
deptsql = string.Format(deptsql, line.DeptCode, orgID);
|
|
DataTable deptdt = DBhlper.Query(deptsql, Appconfig.GetU9ConnStr());
|
|
long DeptID = 0;
|
|
if (deptdt != null && deptdt.Rows.Count > 0)
|
|
{
|
|
DeptID = long.Parse(deptdt.Rows[0]["ID"].ToString());
|
|
}
|
|
if (DeptID == 0)
|
|
{
|
|
rtnRcvInfo rtnpo = new rtnRcvInfo();
|
|
rtnpo.IsSuccess = false;
|
|
rtnpo.Message = "未获取到部门";
|
|
rtnpos.Add(rtnpo);
|
|
return rtnpos;
|
|
}
|
|
#endregion
|
|
UFIDAU9ISVMiscRcvISVIC_MiscRcvTransLsDTOData rcvLine = new UFIDAU9ISVMiscRcvISVIC_MiscRcvTransLsDTOData();
|
|
rcvLine.m_benefitDept = new UFIDAU9CBOPubControllerCommonArchiveDataDTOData();
|
|
rcvLine.m_benefitDept.m_code = line.DeptCode;
|
|
rcvLine.m_benefitDept.m_iD = DeptID;
|
|
rcvLine.m_benefitOrg = long.Parse(orgID);
|
|
rcvLine.m_itemInfo = new UFIDAU9CBOSCMItemItemInfoData();
|
|
rcvLine.m_itemInfo.m_itemCode = line.ItemCode;
|
|
rcvLine.m_itemInfo.ItemID = ItemID;
|
|
rcvLine.m_itemInfo.ItemID_SKey = new UFSoft.UBF.Business.BusinessEntity.EntityKey();
|
|
rcvLine.m_itemInfo.ItemID_SKey.ID = ItemID;
|
|
rcvLine.m_storeType = 4;
|
|
rcvLine.m_costUOMQty = line.ReqQty;
|
|
rcvLine.m_wh = new UFIDAU9CBOPubControllerCommonArchiveDataDTOData();
|
|
rcvLine.m_wh.m_code = WHCode;
|
|
rcvLine.m_iD = WHID;
|
|
rcvLine.m_customerInfo = new UFIDAU9CBOSCMCustomerCustomerMISCInfoData();
|
|
rcvLine.m_customerInfo.m_code = rCVhead.ClientCode;
|
|
rcvLine.m_memo = line.Memo;
|
|
#region 创建批号接口调用
|
|
string LotID = "";
|
|
if (line.Batch != "")
|
|
{
|
|
CustCreateLotMaster LotMasterCreate = new CustCreateLotMaster();
|
|
string lotWHCode = line.WhCode;
|
|
string lotItemCode = line.ItemCode;
|
|
string LotCode = line.Batch;
|
|
LotMasterCreate.CustCreateRCVLotMaster(lotWHCode, lotItemCode, LotCode, orgID, ref LotID);
|
|
if (LotID != "")
|
|
{
|
|
rcvLine.m_lotInfo = new UFIDAU9CBOSCMPropertyTypesLotInfoData();
|
|
rcvLine.m_lotInfo.m_lotCode = line.Batch;
|
|
rcvLine.m_lotInfo.m_lotMaster = new UFIDAU9BasePropertyTypesBizEntityKeyData();
|
|
rcvLine.m_lotInfo.m_lotMaster.m_entityID = long.Parse(LotID);
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
rcvLineList.Add(rcvLine);
|
|
strlog.AppendLine("料品编码:" + line.ItemCode);
|
|
strlog.AppendLine("料品数量:" + line.ReqQty);
|
|
strlog.AppendLine("仓库:" + WHCode);
|
|
strlog.AppendLine("批号ID:" + LotID);
|
|
|
|
}
|
|
rcv.m_miscRcvTransLs = rcvLineList.ToArray();
|
|
rcvList.Add(rcv);
|
|
}
|
|
pOList = rcvList.ToArray();
|
|
|
|
(client.Endpoint.Binding as BasicHttpBinding).MaxReceivedMessageSize = int.MaxValue;
|
|
(client.Endpoint.Binding as BasicHttpBinding).MaxBufferSize = int.MaxValue;
|
|
List<string> shDocList = new List<string>();
|
|
|
|
//给上下文信息赋值
|
|
context = CreateContextObj(rCVInfoList, long.Parse(orgID));
|
|
returnItems = client.Do(out returnMsg, context, pOList);
|
|
strlog.AppendLine("返回数据:");
|
|
foreach (var info in returnItems)
|
|
{
|
|
strlog.AppendLine("单号:" + info.m_code);
|
|
}
|
|
strlog.AppendLine("*****************************************************");
|
|
Appconfig.WriteLogFile(strlog.ToString(), "创建杂收单");
|
|
if (returnItems != null)
|
|
{
|
|
rtnRcvInfo rtnpo = new rtnRcvInfo();
|
|
rtnpo.IsSuccess = true;
|
|
rtnpo.DocNo = returnItems[0].m_code;
|
|
rtnpo.Message = "杂收单创建成功";
|
|
rtnpos.Add(rtnpo);
|
|
}
|
|
|
|
#region 提交杂收单
|
|
StringBuilder submitlog = new StringBuilder();
|
|
submitlog.AppendLine("---------------------提交杂收单----------------------------");
|
|
submitlog.AppendLine("杂收单号:" + returnItems[0].m_code);
|
|
OperationResult result = new OperationResult();
|
|
result = CustCallSubmitMisRcv.CustSubmitMisRcv(returnItems[0].m_code, orgID);
|
|
if (result.IsSuccess == true)
|
|
{
|
|
submitlog.AppendLine("杂收单提交成功!");
|
|
#region 审核杂收单
|
|
CustApproveMiscRcv.OperationResult_ApproveMiscRcv approveresult = new CustApproveMiscRcv.OperationResult_ApproveMiscRcv();
|
|
CustApproveMiscRcv approveclient = new CustApproveMiscRcv();
|
|
approveresult = approveclient.CustApproveMis(returnItems[0].m_code, rCVInfoList[0].OrgCode);
|
|
if (approveresult.IsSuccess == true)
|
|
{
|
|
submitlog.AppendLine("杂收单审核成功!");
|
|
rtnRcvInfo rtnpo = new rtnRcvInfo();
|
|
rtnpo.IsSuccess = true;
|
|
rtnpo.DocNo = returnItems[0].m_code;
|
|
rtnpo.Message = "杂收单创建成功!";
|
|
rtnpos.Add(rtnpo);
|
|
}
|
|
else
|
|
{
|
|
submitlog.AppendLine("杂收单审核失败!");
|
|
submitlog.AppendLine("失败原因:" + approveresult.Message);
|
|
rtnRcvInfo rtnpo = new rtnRcvInfo();
|
|
rtnpo.IsSuccess = false;
|
|
rtnpo.DocNo = returnItems[0].m_code;
|
|
rtnpo.Message = "杂收单审核失败";
|
|
rtnpos.Add(rtnpo);
|
|
}
|
|
#endregion
|
|
}
|
|
else
|
|
{
|
|
submitlog.AppendLine("杂收单提交失败!");
|
|
submitlog.AppendLine("失败原因:" + result.Message);
|
|
rtnRcvInfo rtnpo = new rtnRcvInfo();
|
|
rtnpo.IsSuccess = false;
|
|
rtnpo.DocNo = returnItems[0].m_code;
|
|
rtnpo.Message = "杂收单提交失败";
|
|
rtnpos.Add(rtnpo);
|
|
}
|
|
Appconfig.WriteLogFile(submitlog.ToString(), "创建杂收单");
|
|
#endregion
|
|
return rtnpos;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
//异常信息捕获
|
|
List<rtnRcvInfo> rtnpos = new List<rtnRcvInfo>();
|
|
rtnRcvInfo rtnpo = new rtnRcvInfo();
|
|
rtnpo.IsSuccess = false;
|
|
rtnpo.Message = GetExceptionMessage(ex);
|
|
rtnpos.Add(rtnpo);
|
|
|
|
StringBuilder strlog = new StringBuilder();
|
|
strlog.AppendLine("创建杂发单");
|
|
strlog.AppendLine("*****************************************************");
|
|
foreach (var item in rCVInfoList)
|
|
{
|
|
strlog.AppendLine("组织编码:" + item.OrgCode);
|
|
foreach (var line in item.lines)
|
|
{
|
|
strlog.AppendLine("料品编码:" + line.ItemCode);
|
|
strlog.AppendLine("料品数量:" + line.ReqQty);
|
|
strlog.AppendLine("仓库:" + line.WhCode);
|
|
strlog.AppendLine("批号:" + line.Batch);
|
|
}
|
|
}
|
|
strlog.AppendLine("返回消息:" + rtnpo.Message);
|
|
strlog.AppendLine("*****************************************************");
|
|
Appconfig.WriteLogFile(strlog.ToString(), "创建杂收单");
|
|
|
|
return rtnpos;
|
|
}
|
|
#endregion
|
|
}
|
|
|
|
#region 表头类
|
|
public class rCVhead
|
|
{
|
|
private rCVLine[] _lines;
|
|
private string _DocType;
|
|
private string _OrgCode;
|
|
private string _ClientCode;
|
|
private string _UserName;
|
|
private string _ServiceMoCode;
|
|
private string _DocNo;
|
|
|
|
//private string _DocType;
|
|
|
|
|
|
public rCVLine[] lines
|
|
{
|
|
get { return _lines; }
|
|
set { _lines = value; }
|
|
}
|
|
|
|
public string DocNO
|
|
{
|
|
get { return _DocNo; }
|
|
set { _DocNo = value; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// 单据类型
|
|
/// </summary>
|
|
public string DocType
|
|
{
|
|
get { return _DocType; }
|
|
set { _DocType = value; }
|
|
}
|
|
/// <summary>
|
|
/// 组织编号
|
|
/// </summary>
|
|
public string OrgCode
|
|
{
|
|
get { return _OrgCode; }
|
|
set { _OrgCode = value; }
|
|
}
|
|
/// <summary>
|
|
/// 客户
|
|
/// </summary>
|
|
public string ClientCode
|
|
{
|
|
get { return _ClientCode; }
|
|
set { _ClientCode = value; }
|
|
}
|
|
public string UserName
|
|
{
|
|
get { return _UserName; }
|
|
set { _UserName = value; }
|
|
}
|
|
|
|
|
|
//public string DocType
|
|
//{
|
|
// get { return _DocType; }
|
|
// set { _DocType = value; }
|
|
// }
|
|
}
|
|
#endregion
|
|
|
|
#region 表体类
|
|
public class rCVLine
|
|
{
|
|
/// <summary>
|
|
/// 数量
|
|
/// </summary>
|
|
public decimal ReqQty { get; set; }
|
|
|
|
public string WhCode { get; set; }
|
|
|
|
//public string BinCode { get; set; }
|
|
|
|
/// <summary>
|
|
/// 料号
|
|
/// </summary>
|
|
public string ItemCode { get; set; }
|
|
/// <summary>
|
|
/// 受益部门
|
|
/// </summary>
|
|
public string DeptCode { get; set; }
|
|
|
|
|
|
/// <summary>
|
|
/// 库存批号
|
|
/// </summary>
|
|
public string Batch { get; set; }
|
|
/// <summary>
|
|
/// 备注
|
|
/// </summary>
|
|
public string Memo { get; set; }
|
|
}
|
|
#endregion
|
|
|
|
|
|
#region 提取异常信息
|
|
/// <summary>
|
|
/// 提取异常信息
|
|
/// </summary>
|
|
/// <param name="ex"></param>
|
|
private string GetExceptionMessage(Exception ex)
|
|
{
|
|
string faultMessage = "未知错误,请查看ERP日志!";
|
|
|
|
System.TimeoutException timeoutEx = ex as System.TimeoutException;
|
|
if (timeoutEx != null)
|
|
{
|
|
faultMessage = "访问服务超时,请修改配置信息!";
|
|
}
|
|
else
|
|
{
|
|
FaultException<ServiceException> faultEx = ex as FaultException<ServiceException>;
|
|
if (faultEx == null)
|
|
{
|
|
faultMessage = ex.Message;
|
|
}
|
|
else
|
|
{
|
|
ServiceException serviceEx = faultEx.Detail;
|
|
if (serviceEx != null && !string.IsNullOrEmpty(serviceEx.Message)
|
|
&& !serviceEx.Message.Equals("fault", StringComparison.OrdinalIgnoreCase))
|
|
{
|
|
// 错误信息在faultEx.Message中,请提取,
|
|
// 格式为"Fault:料品不能为空,请录入\n 在....."
|
|
int startIndex = serviceEx.Message.IndexOf(":");
|
|
int endIndex = serviceEx.Message.IndexOf("\n");
|
|
if (endIndex == -1)
|
|
endIndex = serviceEx.Message.Length;
|
|
if (endIndex > 0 && endIndex > startIndex + 1)
|
|
{
|
|
faultMessage = serviceEx.Message.Substring(startIndex + 1, endIndex - startIndex - 1);
|
|
}
|
|
else
|
|
{
|
|
faultMessage = serviceEx.Message;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return faultMessage;
|
|
}
|
|
#endregion
|
|
|
|
#region 给上下文信息赋值
|
|
/// <summary>
|
|
/// 给上下文信息赋值
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
private ThreadContext CreateContextObj(List<rCVhead> rcvInfoList, long OrgID)
|
|
{
|
|
// 实例化应用上下文对象
|
|
ThreadContext thContext = new ThreadContext();
|
|
|
|
System.Collections.Generic.Dictionary<object, object> ns = new Dictionary<object, object>();
|
|
ns.Add("OrgID", OrgID);
|
|
ns.Add("UserID", ConfigurationManager.AppSettings["userID"].ToString());
|
|
ns.Add("UserCode", ConfigurationManager.AppSettings["userCode"].ToString());
|
|
ns.Add("Datetime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
|
|
ns.Add("CultureName", ConfigurationManager.AppSettings["cultureName"].ToString());
|
|
ns.Add("EnterpriseID", ConfigurationManager.AppSettings["enterpriseID"].ToString());
|
|
ns.Add("DefaultCultureName", ConfigurationManager.AppSettings["cultureName"].ToString());
|
|
thContext.nameValueHas = ns;
|
|
|
|
return thContext;
|
|
}
|
|
#endregion
|
|
|
|
#region 时间戳方法
|
|
private DateTime TimestampToDateTime(long timestamp)
|
|
{
|
|
DateTime dateTimeStart = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1));
|
|
long lTime = timestamp * 10000000;
|
|
TimeSpan nowTimeSpan = new TimeSpan(lTime);
|
|
DateTime resultDateTime = dateTimeStart.Add(nowTimeSpan);
|
|
return resultDateTime;
|
|
}
|
|
#endregion
|
|
}
|
|
|
|
#region 上下文类信息
|
|
public class contextInfo
|
|
{
|
|
private long _OrgID;
|
|
private string _OrgCode;
|
|
private long _UserID;
|
|
private string _UserCode;
|
|
private DateTime _Datetime;
|
|
private string _CultureName;
|
|
private string _EnterpriseID;
|
|
|
|
|
|
/// <summary>
|
|
/// 组织ID
|
|
/// </summary>
|
|
public long OrgID
|
|
{
|
|
get { return _OrgID; }
|
|
set { _OrgID = value; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// 组织编码
|
|
/// </summary>
|
|
public string OrgCode
|
|
{
|
|
get { return _OrgCode; }
|
|
set { _OrgCode = value; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// 操作员ID
|
|
/// </summary>
|
|
public long UserID
|
|
{
|
|
get { return _UserID; }
|
|
set { _UserID = value; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// 操作员编码
|
|
/// </summary>
|
|
public string UserCode
|
|
{
|
|
get { return _UserCode; }
|
|
set { _UserCode = value; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// 时间
|
|
/// </summary>
|
|
public DateTime Datetime
|
|
{
|
|
get { return _Datetime; }
|
|
set { _Datetime = value; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// 语言
|
|
/// </summary>
|
|
public string CultureName
|
|
{
|
|
get { return _CultureName; }
|
|
set { _CultureName = value; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// 企业ID号
|
|
/// </summary>
|
|
public string EnterpriseID
|
|
{
|
|
get { return _EnterpriseID; }
|
|
set { _EnterpriseID = value; }
|
|
}
|
|
|
|
public contextInfo()
|
|
{
|
|
CultureName = "zh-CN";
|
|
Datetime = DateTime.Now;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
|
|
|
|
#region 返回信息类
|
|
public class rtnRcvInfo
|
|
{
|
|
public string DocNo { get; set; }
|
|
public bool IsSuccess { get; set; }
|
|
public string Message { get; set; }
|
|
public rtnRcvLine[] rtnLines { get; set; }
|
|
}
|
|
|
|
public class rtnRcvLine
|
|
{
|
|
public int LineNo { get; set; }
|
|
|
|
//public string srcDocNo { get; set; }
|
|
|
|
//public int srcLineNo { get; set; }
|
|
|
|
//public decimal reqQty { get; set; }
|
|
|
|
//public string proCode { get; set; }
|
|
}
|
|
#endregion
|
|
|
|
|
|
#region 表体类
|
|
//public class rCVLine
|
|
//{
|
|
// /// <summary>
|
|
// /// 来源采购订单
|
|
// /// </summary>
|
|
// public string srcDocPONo { get; set; }
|
|
|
|
// private int _srcDocPOLineNo;
|
|
// private decimal _reqQty;
|
|
// public string WhCode { get; set; }
|
|
|
|
// /// <summary>
|
|
// /// 炉号
|
|
// /// </summary>
|
|
// public string FurnaceNo { get; set; }
|
|
|
|
// /// <summary>
|
|
// /// 数量
|
|
// /// </summary>
|
|
// public decimal ReqQty
|
|
// {
|
|
// get { return _reqQty; }
|
|
// set { _reqQty = value; }
|
|
// }
|
|
|
|
// /// <summary>
|
|
// /// 来源采购订单行
|
|
// /// </summary>
|
|
// public int srcDocPOLineNo
|
|
// {
|
|
// get { return _srcDocPOLineNo; }
|
|
// set { _srcDocPOLineNo = value; }
|
|
// }
|
|
//}
|
|
#endregion
|
|
|
|
|
|
}
|