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.
1808 lines
82 KiB
1808 lines
82 KiB
4 years ago
|
using System;
|
||
|
using System.Collections.Generic;
|
||
|
using System.Data.Entity.Migrations;
|
||
|
using System.Linq;
|
||
|
using System.Text;
|
||
|
using System.Threading.Tasks;
|
||
|
using CK.SCP.Models;
|
||
|
using CK.SCP.Models.ScpEntity;
|
||
|
using CK.SCP.Utils;
|
||
|
using CK.SCP.Controller;
|
||
|
using CK.SCP.Models.Enums;
|
||
|
using CK.SCP.Models.AppBoxEntity;
|
||
|
using System.Data.Entity.Core;
|
||
|
using System.Data.SqlClient;
|
||
|
using System.Data;
|
||
|
using System.Text.RegularExpressions;
|
||
|
using CK.SCP.Models.ScpEntity.ExcelExportEnttity;
|
||
|
|
||
|
namespace CK.SCP.Controller
|
||
|
{
|
||
|
public class SCP_RECIVECE_CONTROLLER
|
||
|
{
|
||
|
public static void Get_V_TB_RECEIVE_GG_List(V_TB_RECEIVE p_entity, Action<ResultObject<IQueryable<V_TB_RECEIVE>>> p_action)
|
||
|
{
|
||
|
ResultObject<IQueryable<V_TB_RECEIVE>> _ret = new ResultObject<IQueryable<V_TB_RECEIVE>>();
|
||
|
try
|
||
|
{
|
||
|
using (ScpEntities db = EntitiesFactory.CreateScpInstance())
|
||
|
{
|
||
|
IQueryable<V_TB_RECEIVE> q = db.V_TB_RECEIVE;
|
||
|
|
||
|
if (!string.IsNullOrEmpty(p_entity.RecvBillNum))
|
||
|
{
|
||
|
q = q.Where(p => p.RecvBillNum.Contains(p_entity.RecvBillNum));
|
||
|
}
|
||
|
if (!string.IsNullOrEmpty(p_entity.PoBillNum))
|
||
|
{
|
||
|
q = q.Where(p => p.PoBillNum.Contains(p_entity.PoBillNum));
|
||
|
}
|
||
|
if (!string.IsNullOrEmpty(p_entity.AsnBillNum))
|
||
|
{
|
||
|
q = q.Where(p => p.AsnBillNum.Contains(p_entity.AsnBillNum));
|
||
|
}
|
||
|
if (p_entity.UserInAddress != null && p_entity.UserInAddress.Count > 0)
|
||
|
{
|
||
|
q = q.Where(p => p_entity.UserInAddress.Contains(p.Site));
|
||
|
}
|
||
|
if (p_entity.UserInVendIds != null && p_entity.UserInVendIds.Count > 0)
|
||
|
{
|
||
|
q = q.Where(p => p_entity.UserInVendIds.Contains(p.VendId));
|
||
|
}
|
||
|
|
||
|
if (p_entity.State == 0 || p_entity.State == 1 || p_entity.State == 2)
|
||
|
{
|
||
|
q = q.Where(p => p.State == p_entity.State);
|
||
|
}
|
||
|
if (!string.IsNullOrEmpty(p_entity.Remark))
|
||
|
{
|
||
|
q = q.Where(p => p.Remark.Contains(p_entity.Remark));
|
||
|
}
|
||
|
if (!string.IsNullOrEmpty(p_entity.CreateUser))
|
||
|
{
|
||
|
q = q.Where(p => p.CreateUser.Contains(p_entity.CreateUser));
|
||
|
}
|
||
|
if (p_entity.IsDeleted != false)
|
||
|
{
|
||
|
q = q.Where(p => p.IsDeleted == p_entity.IsDeleted);
|
||
|
}
|
||
|
if (!string.IsNullOrEmpty(p_entity.VendName))
|
||
|
{
|
||
|
q = q.Where(p => p.VendName.Contains(p_entity.VendName));
|
||
|
}
|
||
|
if (!string.IsNullOrEmpty(p_entity.OperName))
|
||
|
{
|
||
|
q = q.Where(p => p.OperName.Contains(p_entity.OperName));
|
||
|
}
|
||
|
if (!string.IsNullOrEmpty(p_entity.Site_Desc))
|
||
|
{
|
||
|
q = q.Where(p => p.Site_Desc.Contains(p_entity.Site_Desc));
|
||
|
}
|
||
|
if (!string.IsNullOrEmpty(p_entity.BillType_DESC))
|
||
|
{
|
||
|
q = q.Where(p => p.BillType_DESC.Contains(p_entity.BillType_DESC));
|
||
|
}
|
||
|
if (p_entity.UserInAddress != null && p_entity.UserInAddress.Count > 0)
|
||
|
{
|
||
|
q = q.Where(p => p_entity.UserInAddress.Contains(p.Site));
|
||
|
}
|
||
|
_ret.State = ReturnStatus.Succeed;
|
||
|
_ret.Result = q;
|
||
|
|
||
|
p_action(_ret);
|
||
|
}
|
||
|
}
|
||
|
catch (System.Data.Entity.Validation.DbEntityValidationException dbEx)//捕获实体验证异常
|
||
|
{
|
||
|
var sb = new StringBuilder();
|
||
|
|
||
|
foreach (var error in dbEx.EntityValidationErrors.ToList())
|
||
|
{
|
||
|
|
||
|
error.ValidationErrors.ToList().ForEach(i =>
|
||
|
{
|
||
|
sb.AppendFormat("表:{0},字段:{1},信息:{2}\r\n", error.Entry.Entity.GetType().Name, i.PropertyName, i.ErrorMessage);
|
||
|
});
|
||
|
}
|
||
|
_ret.State = ReturnStatus.Failed;
|
||
|
_ret.ErrorList.Add(dbEx);
|
||
|
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_RECIVECE_CONTROLLER), "Get_V_TB_RECEIVE_List", sb.ToString());
|
||
|
throw new ScpException(ResultCode.DbEntityValidationException, sb.ToString(), "字段验证失败" + sb.ToString());
|
||
|
}
|
||
|
catch (OptimisticConcurrencyException ex)//并发冲突异常
|
||
|
{
|
||
|
|
||
|
_ret.State = ReturnStatus.Failed;
|
||
|
_ret.ErrorList.Add(ex);
|
||
|
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_RECIVECE_CONTROLLER), "Get_V_TB_RECEIVE_List", ex.ToString());
|
||
|
throw new ScpException(ResultCode.Exception, "9999", ex.ToString());
|
||
|
}
|
||
|
catch (ScpException ex)
|
||
|
{
|
||
|
_ret.State = ReturnStatus.Failed;
|
||
|
_ret.ErrorList.Add(ex);
|
||
|
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_RECIVECE_CONTROLLER), "Get_V_TB_RECEIVE_List", ex.ToString());
|
||
|
|
||
|
if (ex.InnerException != null && ex.InnerException.GetType() == typeof(UpdateException))
|
||
|
{
|
||
|
var inner = (UpdateException)ex.InnerException;
|
||
|
|
||
|
|
||
|
throw new ScpException(ResultCode.Exception, "0000", ex.ToString());
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
if (ex.InnerException != null) throw ex.InnerException;
|
||
|
}
|
||
|
}
|
||
|
catch (Exception e)
|
||
|
{
|
||
|
_ret.State = ReturnStatus.Failed;
|
||
|
_ret.ErrorList.Add(e);
|
||
|
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_RECIVECE_CONTROLLER), "Get_V_TB_RECEIVE_List", e.Message);
|
||
|
throw e;
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
|
public static void Get_V_TB_RECEIVE_List(V_TB_RECEIVE p_entity, Action<ResultObject<IQueryable<V_TB_RECEIVE>>> p_action)
|
||
|
{
|
||
|
ResultObject<IQueryable<V_TB_RECEIVE>> _ret = new ResultObject<IQueryable<V_TB_RECEIVE>>();
|
||
|
try
|
||
|
{
|
||
|
using (ScpEntities db = EntitiesFactory.CreateScpInstance())
|
||
|
{
|
||
|
IQueryable<V_TB_RECEIVE> q = db.V_TB_RECEIVE;
|
||
|
|
||
|
if (!string.IsNullOrEmpty(p_entity.RecvBillNum))
|
||
|
{
|
||
|
q = q.Where(p => p.RecvBillNum.Contains(p_entity.RecvBillNum));
|
||
|
}
|
||
|
if (!string.IsNullOrEmpty(p_entity.PoBillNum))
|
||
|
{
|
||
|
q = q.Where(p => p.PoBillNum.Contains(p_entity.PoBillNum));
|
||
|
}
|
||
|
if (!string.IsNullOrEmpty(p_entity.AsnBillNum))
|
||
|
{
|
||
|
q = q.Where(p => p.AsnBillNum.Contains(p_entity.AsnBillNum));
|
||
|
}
|
||
|
if (!string.IsNullOrEmpty(p_entity.Site))
|
||
|
{
|
||
|
q = q.Where(p => p.Site==p_entity.Site);
|
||
|
}
|
||
|
if (!string.IsNullOrEmpty(p_entity.VendId))
|
||
|
{
|
||
|
q = q.Where(p => p.VendId.Contains(p_entity.VendId));
|
||
|
}
|
||
|
if (p_entity.State == 0 || p_entity.State == 1 || p_entity.State == 2)
|
||
|
{
|
||
|
q = q.Where(p => p.State == p_entity.State);
|
||
|
}
|
||
|
if (!string.IsNullOrEmpty(p_entity.Remark))
|
||
|
{
|
||
|
q = q.Where(p => p.Remark.Contains(p_entity.Remark));
|
||
|
}
|
||
|
if (!string.IsNullOrEmpty(p_entity.CreateUser))
|
||
|
{
|
||
|
q = q.Where(p => p.CreateUser.Contains(p_entity.CreateUser));
|
||
|
}
|
||
|
if (p_entity.IsDeleted != false)
|
||
|
{
|
||
|
q = q.Where(p => p.IsDeleted == p_entity.IsDeleted);
|
||
|
}
|
||
|
if (!string.IsNullOrEmpty(p_entity.VendName))
|
||
|
{
|
||
|
q = q.Where(p => p.VendName.Contains(p_entity.VendName));
|
||
|
}
|
||
|
if (!string.IsNullOrEmpty(p_entity.OperName))
|
||
|
{
|
||
|
q = q.Where(p => p.OperName.Contains(p_entity.OperName));
|
||
|
}
|
||
|
if (!string.IsNullOrEmpty(p_entity.Site_Desc))
|
||
|
{
|
||
|
q = q.Where(p => p.Site_Desc.Contains(p_entity.Site_Desc));
|
||
|
}
|
||
|
if (!string.IsNullOrEmpty(p_entity.BillType_DESC))
|
||
|
{
|
||
|
q = q.Where(p => p.BillType_DESC.Contains(p_entity.BillType_DESC));
|
||
|
}
|
||
|
//if (p_entity.UserInAddress != null && p_entity.UserInAddress.Count > 0)
|
||
|
//{
|
||
|
// q = q.Where(p => p_entity.UserInAddress.Contains(p.Address));
|
||
|
//}
|
||
|
_ret.State = ReturnStatus.Succeed;
|
||
|
_ret.Result = q;
|
||
|
|
||
|
p_action(_ret);
|
||
|
}
|
||
|
}
|
||
|
catch (System.Data.Entity.Validation.DbEntityValidationException dbEx)//捕获实体验证异常
|
||
|
{
|
||
|
var sb = new StringBuilder();
|
||
|
|
||
|
foreach (var error in dbEx.EntityValidationErrors.ToList())
|
||
|
{
|
||
|
|
||
|
error.ValidationErrors.ToList().ForEach(i =>
|
||
|
{
|
||
|
sb.AppendFormat("表:{0},字段:{1},信息:{2}\r\n", error.Entry.Entity.GetType().Name, i.PropertyName, i.ErrorMessage);
|
||
|
});
|
||
|
}
|
||
|
_ret.State = ReturnStatus.Failed;
|
||
|
_ret.ErrorList.Add(dbEx);
|
||
|
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_RECIVECE_CONTROLLER), "Get_V_TB_RECEIVE_List", sb.ToString());
|
||
|
throw new ScpException(ResultCode.DbEntityValidationException, sb.ToString(), "字段验证失败" + sb.ToString());
|
||
|
}
|
||
|
catch (OptimisticConcurrencyException ex)//并发冲突异常
|
||
|
{
|
||
|
|
||
|
_ret.State = ReturnStatus.Failed;
|
||
|
_ret.ErrorList.Add(ex);
|
||
|
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_RECIVECE_CONTROLLER), "Get_V_TB_RECEIVE_List", ex.ToString());
|
||
|
throw new ScpException(ResultCode.Exception, "9999", ex.ToString());
|
||
|
}
|
||
|
catch (ScpException ex)
|
||
|
{
|
||
|
|
||
|
|
||
|
_ret.State = ReturnStatus.Failed;
|
||
|
_ret.ErrorList.Add(ex);
|
||
|
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_RECIVECE_CONTROLLER), "Get_V_TB_RECEIVE_List", ex.ToString());
|
||
|
|
||
|
if (ex.InnerException != null && ex.InnerException.GetType() == typeof(UpdateException))
|
||
|
{
|
||
|
var inner = (UpdateException)ex.InnerException;
|
||
|
|
||
|
|
||
|
throw new ScpException(ResultCode.Exception, "0000", ex.ToString());
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
if (ex.InnerException != null) throw ex.InnerException;
|
||
|
}
|
||
|
}
|
||
|
catch (Exception e)
|
||
|
{
|
||
|
_ret.State = ReturnStatus.Failed;
|
||
|
_ret.ErrorList.Add(e);
|
||
|
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_RECIVECE_CONTROLLER), "Get_V_TB_RECEIVE_List", e.Message);
|
||
|
throw e;
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
public static DataTable Get_TB_RECEIVE_PLAN(V_TB_RECEIVE_DETAIL p_plan,string p_date)
|
||
|
{
|
||
|
|
||
|
string _sql = "SELECT D.PROJECTID,b.VENDNAME, c.* FROM(SELECT partcode,PartDesc1, Qty, CONVERT(varchar(100), CreateTime, 23) as endtime,PoUnit,Site,VendId FROM v_TB_RECEIVE_DETAIL \n" +
|
||
|
" ) A\n" +
|
||
|
" pivot(sum(Qty) for a.endtime in ( {1}\n" +
|
||
|
"\n" +
|
||
|
" )\n" +
|
||
|
" ) as C left join TA_VENDER B ON C.VENDID=B.VENDID AND C.SITE=B.SITE LEFT JOIN TA_PART D ON C.PARTCODE=D.PARTCODE AND C.SITE=D.SITE where {0};";
|
||
|
|
||
|
|
||
|
|
||
|
string _sqlDate = "select '[' + convert(varchar(10), DATEADD(day, number, CAST('{0}' as datetime)), 23) + ']' endtime\n" +
|
||
|
" from master.dbo.spt_values\n" +
|
||
|
" where type = 'p'\n" +
|
||
|
" AND number<= DATEDIFF(day, CAST('{0}' as datetime), DATEADD(DAY, -1, DATEADD(MM, DATEDIFF(MM, 0, CAST('{0}' as datetime)) + 1, 0)))";
|
||
|
|
||
|
|
||
|
DataTable dt = new DataTable();
|
||
|
DataTable _tbDate = new DataTable();
|
||
|
|
||
|
var dbSetting = GlobalConfig.ScpDatabase;
|
||
|
SqlConnection conn = new System.Data.SqlClient.SqlConnection();
|
||
|
try
|
||
|
{
|
||
|
var strConn = EntitiesFactory.GetEfConnectionString(dbSetting);
|
||
|
|
||
|
conn.ConnectionString = strConn;
|
||
|
if (conn.State != ConnectionState.Open)
|
||
|
{
|
||
|
conn.Open();
|
||
|
}
|
||
|
SqlCommand cmdDate = new SqlCommand();
|
||
|
cmdDate.Connection = conn;
|
||
|
cmdDate.CommandText = string.Format(_sqlDate, p_date);
|
||
|
SqlDataAdapter adapter1 = new SqlDataAdapter(cmdDate);
|
||
|
adapter1.Fill(_tbDate);
|
||
|
|
||
|
List<string> _dateList = new List<string>();
|
||
|
foreach (DataRow row in _tbDate.Rows)
|
||
|
{
|
||
|
_dateList.Add(row["endtime"].ToString());
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
SqlCommand cmd = new SqlCommand();
|
||
|
cmd.Connection = conn;
|
||
|
string where1 = " 1=1 ";
|
||
|
if (!string.IsNullOrEmpty(p_plan.PartCode))
|
||
|
{
|
||
|
where1 += string.Format(" and C.partcode='{0}' ", p_plan.PartCode);
|
||
|
}
|
||
|
if (!string.IsNullOrEmpty(p_plan.VendId))
|
||
|
{
|
||
|
where1 += string.Format(" and C.VendId='{0}' ", p_plan.VendId);
|
||
|
}
|
||
|
if (!string.IsNullOrEmpty(p_plan.ProjectId))
|
||
|
{
|
||
|
where1 += string.Format(" and ProjectId like '{0}%' ", p_plan.ProjectId);
|
||
|
}
|
||
|
|
||
|
if (!string.IsNullOrEmpty(p_plan.Site))
|
||
|
{
|
||
|
where1 += string.Format(" and C.SITE = '{0}' ", p_plan.Site);
|
||
|
}
|
||
|
//if (!string.IsNullOrEmpty(p_plan.PoBillNum))
|
||
|
//{
|
||
|
// where1 += string.Format(" and PoBillNum='{0}' ", p_plan.PoBillNum);
|
||
|
//}
|
||
|
//if (p_plan.EndTime_Begin != null)
|
||
|
//{
|
||
|
// where1 += string.Format(" and EndTime>='{0}'", p_plan.EndTime_Begin.Value.ToString("yyyy-MM-dd"));
|
||
|
//}
|
||
|
//else
|
||
|
//{
|
||
|
// where1 += string.Format(" and EndTime>='{0}'", DateTime.Now.ToString("yyyy-MM-dd"));
|
||
|
//}
|
||
|
//if (p_plan.EndTime_End != null)
|
||
|
//{
|
||
|
// where1 += string.Format(" and EndTime<='{0}'", p_plan.EndTime_End.Value.ToString("yyyy-MM-dd"));
|
||
|
//}
|
||
|
//else
|
||
|
//{
|
||
|
// where1 += string.Format(" and EndTime<='{0}'", DateTime.Now.AddMonths(1).ToString("yyyy-MM-dd"));
|
||
|
//}
|
||
|
cmd.CommandText = string.Format(_sql, where1,string.Join(",",_dateList.ToArray()));
|
||
|
SqlDataAdapter adapter = new SqlDataAdapter(cmd);
|
||
|
adapter.Fill(dt);
|
||
|
dt.Columns.Add("合计");
|
||
|
dt.Columns["PartCode"].ColumnName = "零件编号";
|
||
|
dt.Columns["VendId"].ColumnName = "供应商编号";
|
||
|
dt.Columns["VendName"].ColumnName = "供应商名称";
|
||
|
dt.Columns["PartDesc1"].ColumnName = "零件名称";
|
||
|
dt.Columns["Site"].ColumnName = "域";
|
||
|
dt.Columns["PoUnit"].ColumnName = "单位";
|
||
|
dt.Columns["Projectid"].ColumnName = "项目编号";
|
||
|
foreach (DataRow row in dt.Rows)
|
||
|
{
|
||
|
decimal num = 0;
|
||
|
foreach (DataColumn column in dt.Columns)
|
||
|
{
|
||
|
var _reg = Regex.Match(column.ColumnName, @"\d{4}(\-|\/|\.)\d{1,2}\1\d{1,2}");
|
||
|
if (!string.IsNullOrEmpty(_reg.Value))
|
||
|
{
|
||
|
if (row[column.ColumnName] != null && !string.IsNullOrEmpty(row[column.ColumnName].ToString()))
|
||
|
{
|
||
|
num+= decimal.Parse(row[column.ColumnName].ToString());
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
row["合计"] = num;
|
||
|
}
|
||
|
|
||
|
|
||
|
conn.Close();
|
||
|
}
|
||
|
catch (SqlException ex)
|
||
|
{
|
||
|
conn.Close();
|
||
|
throw new Exception($"系统无法连接到数据库:{dbSetting},请检查配置的服务器,数据库,用户名和密码等信息是否正确。{Environment.NewLine}{ex}");
|
||
|
}
|
||
|
return dt;
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
public static void Get_V_TB_RECEIVE_DETAIL_List(List<V_TB_RECEIVE> p_list, Action<ResultObject<IQueryable<V_TB_RECEIVE_DETAIL>>> p_action)
|
||
|
{
|
||
|
ResultObject<IQueryable<V_TB_RECEIVE_DETAIL>> _ret = new ResultObject<IQueryable<V_TB_RECEIVE_DETAIL>>();
|
||
|
try
|
||
|
{
|
||
|
using (ScpEntities db = EntitiesFactory.CreateScpInstance())
|
||
|
{
|
||
|
var _ary=p_list.Select(p => "'"+p.RecvBillNum+"'").ToList().ToArray();
|
||
|
if (_ary.Count() > 0)
|
||
|
{
|
||
|
string str = string.Join(",", _ary);
|
||
|
string _sql = string.Format("SELECT * FROM [V_TB_RECEIVE_DETAIL] where RecvBillNum in ({0})",str);
|
||
|
IQueryable<V_TB_RECEIVE_DETAIL> q = db.Database.SqlQuery<V_TB_RECEIVE_DETAIL>(_sql).AsQueryable();
|
||
|
|
||
|
|
||
|
_ret.State = ReturnStatus.Succeed;
|
||
|
_ret.Result = q;
|
||
|
|
||
|
p_action(_ret);
|
||
|
}
|
||
|
|
||
|
|
||
|
}
|
||
|
}
|
||
|
catch (System.Data.Entity.Validation.DbEntityValidationException dbEx)//捕获实体验证异常
|
||
|
{
|
||
|
var sb = new StringBuilder();
|
||
|
|
||
|
foreach (var error in dbEx.EntityValidationErrors.ToList())
|
||
|
{
|
||
|
|
||
|
error.ValidationErrors.ToList().ForEach(i =>
|
||
|
{
|
||
|
sb.AppendFormat("表:{0},字段:{1},信息:{2}\r\n", error.Entry.Entity.GetType().Name, i.PropertyName, i.ErrorMessage);
|
||
|
});
|
||
|
}
|
||
|
_ret.State = ReturnStatus.Failed;
|
||
|
_ret.ErrorList.Add(dbEx);
|
||
|
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_RECIVECE_CONTROLLER), "Get_V_TB_RECEIVE_DETAIL_List", sb.ToString());
|
||
|
throw new ScpException(ResultCode.DbEntityValidationException, sb.ToString(), "字段验证失败" + sb.ToString());
|
||
|
}
|
||
|
catch (OptimisticConcurrencyException ex)//并发冲突异常
|
||
|
{
|
||
|
|
||
|
_ret.State = ReturnStatus.Failed;
|
||
|
_ret.ErrorList.Add(ex);
|
||
|
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_RECIVECE_CONTROLLER), "Get_V_TB_RECEIVE_DETAIL_List", ex.ToString());
|
||
|
throw new ScpException(ResultCode.Exception, "9999", ex.ToString());
|
||
|
}
|
||
|
catch (ScpException ex)
|
||
|
{
|
||
|
|
||
|
|
||
|
_ret.State = ReturnStatus.Failed;
|
||
|
_ret.ErrorList.Add(ex);
|
||
|
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_RECIVECE_CONTROLLER), "Get_V_TB_RECEIVE_DETAIL_List", ex.ToString());
|
||
|
|
||
|
if (ex.InnerException != null && ex.InnerException.GetType() == typeof(UpdateException))
|
||
|
{
|
||
|
var inner = (UpdateException)ex.InnerException;
|
||
|
|
||
|
|
||
|
throw new ScpException(ResultCode.Exception, "0000", ex.ToString());
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
if (ex.InnerException != null) throw ex.InnerException;
|
||
|
}
|
||
|
}
|
||
|
catch (Exception e)
|
||
|
{
|
||
|
_ret.State = ReturnStatus.Failed;
|
||
|
_ret.ErrorList.Add(e);
|
||
|
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_RECIVECE_CONTROLLER), "Get_V_TB_RECEIVE_DETAIL_List", e.Message);
|
||
|
throw e;
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
|
public static void Get_V_TB_RECEIVE_DETAIL_List(V_TB_RECEIVE_DETAIL p_entity, Action<ResultObject<IQueryable<V_TB_RECEIVE_DETAIL>>> p_action)
|
||
|
{
|
||
|
ResultObject<IQueryable<V_TB_RECEIVE_DETAIL>> _ret = new ResultObject<IQueryable<V_TB_RECEIVE_DETAIL>>();
|
||
|
try
|
||
|
{
|
||
|
using (ScpEntities db = EntitiesFactory.CreateScpInstance())
|
||
|
{
|
||
|
IQueryable<V_TB_RECEIVE_DETAIL> q = db.V_TB_RECEIVE_DETAIL;
|
||
|
|
||
|
if (!string.IsNullOrEmpty(p_entity.RecvBillNum))
|
||
|
{
|
||
|
q = q.Where(p => p.RecvBillNum == p_entity.RecvBillNum);
|
||
|
}
|
||
|
if (p_entity.PoLine != 0)
|
||
|
{
|
||
|
q = q.Where(p => p.PoLine == p_entity.PoLine);
|
||
|
}
|
||
|
if (!string.IsNullOrEmpty(p_entity.PartCode))
|
||
|
{
|
||
|
q = q.Where(p => p.PartCode.Contains(p_entity.PartCode));
|
||
|
}
|
||
|
if (!string.IsNullOrEmpty(p_entity.Site))
|
||
|
{
|
||
|
q = q.Where(p => p.PartCode.Contains(p_entity.Site));
|
||
|
}
|
||
|
if (!string.IsNullOrEmpty(p_entity.Batch))
|
||
|
{
|
||
|
q = q.Where(p => p.Batch.Contains(p_entity.Batch));
|
||
|
}
|
||
|
if (p_entity.Qty != 0)
|
||
|
{
|
||
|
q = q.Where(p => p.Qty == p_entity.Qty);
|
||
|
}
|
||
|
if (!string.IsNullOrEmpty(p_entity.DockCode))
|
||
|
{
|
||
|
q = q.Where(p => p.DockCode.Contains(p_entity.DockCode));
|
||
|
}
|
||
|
if (!string.IsNullOrEmpty(p_entity.Remark))
|
||
|
{
|
||
|
q = q.Where(p => p.Remark.Contains(p_entity.Remark));
|
||
|
}
|
||
|
if (!string.IsNullOrEmpty(p_entity.CreateUser))
|
||
|
{
|
||
|
q = q.Where(p => p.CreateUser.Contains(p_entity.CreateUser));
|
||
|
}
|
||
|
if (p_entity.IsDeleted != false)
|
||
|
{
|
||
|
q = q.Where(p => p.IsDeleted == p_entity.IsDeleted);
|
||
|
}
|
||
|
if (!string.IsNullOrEmpty(p_entity.AsnBillNum))
|
||
|
{
|
||
|
q = q.Where(p => p.AsnBillNum.Contains(p_entity.AsnBillNum));
|
||
|
}
|
||
|
if (!string.IsNullOrEmpty(p_entity.Site))
|
||
|
{
|
||
|
q = q.Where(p => p.Site.Contains(p_entity.Site));
|
||
|
}
|
||
|
if (!string.IsNullOrEmpty(p_entity.VendId))
|
||
|
{
|
||
|
q = q.Where(p => p.VendId.Contains(p_entity.VendId));
|
||
|
}
|
||
|
if (!string.IsNullOrEmpty(p_entity.OperName))
|
||
|
{
|
||
|
q = q.Where(p => p.OperName.Contains(p_entity.OperName));
|
||
|
}
|
||
|
if (!string.IsNullOrEmpty(p_entity.PartDesc1))
|
||
|
{
|
||
|
q = q.Where(p => p.PartDesc1.Contains(p_entity.PartDesc1));
|
||
|
}
|
||
|
if (p_entity.State != 0)
|
||
|
{
|
||
|
q = q.Where(p => p.State == p_entity.State);
|
||
|
}
|
||
|
if (!string.IsNullOrEmpty(p_entity.PoBillNum))
|
||
|
{
|
||
|
q = q.Where(p => p.PoBillNum.Contains(p_entity.PoBillNum));
|
||
|
}
|
||
|
//if (p_entity.UserInAddress != null && p_entity.UserInAddress.Count > 0)
|
||
|
//{
|
||
|
// q = q.Where(p => p_entity.UserInAddress.Contains(p.Address));
|
||
|
//}
|
||
|
_ret.State = ReturnStatus.Succeed;
|
||
|
_ret.Result = q;
|
||
|
|
||
|
p_action(_ret);
|
||
|
}
|
||
|
}
|
||
|
catch (System.Data.Entity.Validation.DbEntityValidationException dbEx)//捕获实体验证异常
|
||
|
{
|
||
|
var sb = new StringBuilder();
|
||
|
|
||
|
foreach (var error in dbEx.EntityValidationErrors.ToList())
|
||
|
{
|
||
|
|
||
|
error.ValidationErrors.ToList().ForEach(i =>
|
||
|
{
|
||
|
sb.AppendFormat("表:{0},字段:{1},信息:{2}\r\n", error.Entry.Entity.GetType().Name, i.PropertyName, i.ErrorMessage);
|
||
|
});
|
||
|
}
|
||
|
_ret.State = ReturnStatus.Failed;
|
||
|
_ret.ErrorList.Add(dbEx);
|
||
|
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_RECIVECE_CONTROLLER), "Get_V_TB_RECEIVE_DETAIL_List", sb.ToString());
|
||
|
throw new ScpException(ResultCode.DbEntityValidationException, sb.ToString(), "字段验证失败" + sb.ToString());
|
||
|
}
|
||
|
catch (OptimisticConcurrencyException ex)//并发冲突异常
|
||
|
{
|
||
|
|
||
|
_ret.State = ReturnStatus.Failed;
|
||
|
_ret.ErrorList.Add(ex);
|
||
|
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_RECIVECE_CONTROLLER), "Get_V_TB_RECEIVE_DETAIL_List", ex.ToString());
|
||
|
throw new ScpException(ResultCode.Exception, "9999", ex.ToString());
|
||
|
}
|
||
|
catch (ScpException ex)
|
||
|
{
|
||
|
|
||
|
|
||
|
_ret.State = ReturnStatus.Failed;
|
||
|
_ret.ErrorList.Add(ex);
|
||
|
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_RECIVECE_CONTROLLER), "Get_V_TB_RECEIVE_DETAIL_List", ex.ToString());
|
||
|
|
||
|
if (ex.InnerException != null && ex.InnerException.GetType() == typeof(UpdateException))
|
||
|
{
|
||
|
var inner = (UpdateException)ex.InnerException;
|
||
|
|
||
|
|
||
|
throw new ScpException(ResultCode.Exception, "0000", ex.ToString());
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
if (ex.InnerException != null) throw ex.InnerException;
|
||
|
}
|
||
|
}
|
||
|
catch (Exception e)
|
||
|
{
|
||
|
_ret.State = ReturnStatus.Failed;
|
||
|
_ret.ErrorList.Add(e);
|
||
|
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_RECIVECE_CONTROLLER), "Get_V_TB_RECEIVE_DETAIL_List", e.Message);
|
||
|
throw e;
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
public static ResultObject<bool> Save_TB_RECEIVE_STATE(List<string> p_list, ReceiveState p_state, string userName,string p_site)
|
||
|
{
|
||
|
ResultObject<bool> _ret = new ResultObject<bool>();
|
||
|
try
|
||
|
{
|
||
|
using (ScpEntities db = EntitiesFactory.CreateScpInstance())
|
||
|
{
|
||
|
|
||
|
if (p_state == ReceiveState.Check)
|
||
|
{
|
||
|
|
||
|
var _ls = db.V_TB_RECEIVE.Where(p => p_list.Contains(p.RecvBillNum) && p.Site==p_site).ToList();
|
||
|
int count = _ls.Count(p => p.State == (int)ReceiveState.Receive);
|
||
|
if (count == _ls.Count && _ls.Count > 0)
|
||
|
{
|
||
|
_ls.ForEach(p =>
|
||
|
{
|
||
|
p.OperName = userName;
|
||
|
p.State = (int)ReceiveState.Check;
|
||
|
var _list = db.TB_RECEIVE_DETAIL.Where(itm => itm.RecvBillNum == p.RecvBillNum && itm.Remark == p_site).ToList();
|
||
|
_list.ForEach(itm => itm.State = (int)ReceiveState.Check);
|
||
|
db.TB_RECEIVE_DETAIL.AddOrUpdate(itm => itm.UID, _list.ToArray());
|
||
|
#region 收货审核提醒供应商提起发票申请
|
||
|
TB_PENING_ITEMS _item = new TB_PENING_ITEMS();
|
||
|
_item.ROLE_NAME = "供应商";
|
||
|
_item.ITEM_NO = p.RecvBillNum;
|
||
|
_item.ITEM_CONTENT = string.Format("收货单号{0}发货单号{1},已收货!请申请发票", p.RecvBillNum, _ls[0].AsnBillNum);
|
||
|
_item.ITEM_TYPE = (int)PENDING_MESSAGE_TYPE.PO_AUDIT_PASS;
|
||
|
_item.ITEM_STATE = (int)PENDING_STATE.WAITING;
|
||
|
_item.SENDER = p.CreateUser;
|
||
|
_item.VEND_ID = p.VendId;
|
||
|
_item.SENDING_TIME = DateTime.Now;
|
||
|
//_item.ITEM_ADDRESS = p.Site_Desc;
|
||
|
_item.ITEM_ADDRESS = p.Site;
|
||
|
_item.GUID = Guid.NewGuid();
|
||
|
db.TB_PENING_ITEMS.Add(_item);
|
||
|
#endregion
|
||
|
}
|
||
|
);
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
_ret.State = ReturnStatus.Failed;
|
||
|
_ret.Result = false;
|
||
|
_ret.Message = "选择的记录,有不是收货状态记录!";
|
||
|
}
|
||
|
if (db.SaveChanges() != -1)
|
||
|
{
|
||
|
_ret.State = ReturnStatus.Succeed;
|
||
|
_ret.Result = true;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
_ret.State = ReturnStatus.Failed;
|
||
|
_ret.Result = false;
|
||
|
_ret.Message = "数据更新失败!";
|
||
|
}
|
||
|
}
|
||
|
if (p_state == ReceiveState.Reject)
|
||
|
{
|
||
|
var _ls = db.V_TB_RECEIVE.Where(p => p_list.Contains(p.RecvBillNum) && p.Site == p_site).ToList();
|
||
|
int count = _ls.Count(p => p.State == (int)ReceiveState.Receive);
|
||
|
if (count == _ls.Count && _ls.Count > 0)
|
||
|
{
|
||
|
_ls.ForEach(p =>
|
||
|
{
|
||
|
p.OperName = userName;
|
||
|
p.State = (int)ReceiveState.Reject;
|
||
|
p.IsDeleted = true;
|
||
|
var _list = db.TB_RECEIVE_DETAIL.Where(itm => itm.RecvBillNum == p.RecvBillNum && p.Site == p_site).ToList();
|
||
|
_list.ForEach(itm =>
|
||
|
{
|
||
|
itm.State = (int)ReceiveState.Reject;
|
||
|
itm.IsDeleted = true;
|
||
|
}
|
||
|
|
||
|
);
|
||
|
db.TB_RECEIVE_DETAIL.AddOrUpdate(itm => itm.UID, _list.ToArray());
|
||
|
|
||
|
|
||
|
}
|
||
|
);
|
||
|
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
_ret.State = ReturnStatus.Failed;
|
||
|
_ret.Result = false;
|
||
|
_ret.Message = "选择的记录,有不是收货状态记录!";
|
||
|
}
|
||
|
if (db.SaveChanges() != -1)
|
||
|
{
|
||
|
_ret.State = ReturnStatus.Succeed;
|
||
|
_ret.Result = true;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
_ret.State = ReturnStatus.Failed;
|
||
|
_ret.Result = false;
|
||
|
_ret.Message = "数据更新失败!";
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
}
|
||
|
}
|
||
|
catch (System.Data.Entity.Validation.DbEntityValidationException dbEx)//捕获实体验证异常
|
||
|
{
|
||
|
var sb = new StringBuilder();
|
||
|
foreach (var error in dbEx.EntityValidationErrors.ToList())
|
||
|
{
|
||
|
error.ValidationErrors.ToList().ForEach(i =>
|
||
|
{
|
||
|
sb.AppendFormat("表:{0},字段:{1},信息:{2}\r\n", error.Entry.Entity.GetType().Name, i.PropertyName, i.ErrorMessage);
|
||
|
});
|
||
|
}
|
||
|
_ret.State = ReturnStatus.Failed;
|
||
|
_ret.Result = false;
|
||
|
_ret.ErrorList.Add(dbEx);
|
||
|
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_RECIVECE_CONTROLLER), "Save_TB_RECEIVE_STATE", sb.ToString());
|
||
|
throw new ScpException(ResultCode.DbEntityValidationException, sb.ToString(), "字段验证失败" + sb.ToString());
|
||
|
}
|
||
|
catch (OptimisticConcurrencyException ex)//并发冲突异常
|
||
|
{
|
||
|
|
||
|
_ret.State = ReturnStatus.Failed;
|
||
|
_ret.Result = false;
|
||
|
_ret.ErrorList.Add(ex);
|
||
|
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_RECIVECE_CONTROLLER), "Save_TB_RECEIVE_STATE", ex.ToString());
|
||
|
throw new ScpException(ResultCode.Exception, "9999", ex.ToString());
|
||
|
}
|
||
|
catch (ScpException ex)
|
||
|
{
|
||
|
_ret.State = ReturnStatus.Failed;
|
||
|
_ret.Result = false;
|
||
|
_ret.ErrorList.Add(ex);
|
||
|
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_RECIVECE_CONTROLLER), "Save_TB_RECEIVE_STATE", ex.ToString());
|
||
|
if (ex.InnerException != null && ex.InnerException.GetType() == typeof(UpdateException))
|
||
|
{
|
||
|
var inner = (UpdateException)ex.InnerException;
|
||
|
throw new ScpException(ResultCode.Exception, "0000", ex.ToString());
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
if (ex.InnerException != null) throw ex.InnerException;
|
||
|
}
|
||
|
}
|
||
|
catch (Exception e)
|
||
|
{
|
||
|
_ret.State = ReturnStatus.Failed;
|
||
|
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_RECIVECE_CONTROLLER), "Save_TB_RECEIVE_STATE", e.Message);
|
||
|
_ret.Result = false;
|
||
|
_ret.ErrorList.Add(e);
|
||
|
throw e;
|
||
|
}
|
||
|
return _ret;
|
||
|
}
|
||
|
|
||
|
public static List<V_TB_RECEIVE_LIST> Get_V_TB_RECEIVE_LIST(List<V_TB_RECEIVE_LIST> p_list)
|
||
|
{
|
||
|
|
||
|
using (ScpEntities db = EntitiesFactory.CreateScpInstance())
|
||
|
{
|
||
|
p_list.ForEach(itm =>
|
||
|
{
|
||
|
|
||
|
//var _sum= db.TB_INVOICE_DETAIL.Where(p => p.RecvBillNum == itm.RecvBillNum && p.PartCode == itm.PartCode && p.Batch==itm.Batch && p.IsDeleted==false).Select(p=>p.Qty).Sum();
|
||
|
var _sum = db.TB_INVOICE_DETAIL.Where(p => p.RecvBillNum == itm.RecvBillNum && p.PartCode == itm.PartCode && p.Batch == itm.Batch && p.IsDeleted == false).ToArray().Sum(p => new decimal?(p.Qty)).GetValueOrDefault();
|
||
|
itm.CanQty = itm.Qty - _sum;
|
||
|
});
|
||
|
|
||
|
}
|
||
|
return p_list;
|
||
|
|
||
|
}
|
||
|
|
||
|
public static List<V_TB_INVOICE_DETAIL> Get_V_TB_INVOICE_LIST(List<V_TB_INVOICE_DETAIL> p_list)
|
||
|
{
|
||
|
using (ScpEntities db = EntitiesFactory.CreateScpInstance())
|
||
|
{
|
||
|
p_list.ForEach(itm =>
|
||
|
{
|
||
|
try
|
||
|
{
|
||
|
var _recSum = db.V_TB_RECEIVE_DETAIL.Where(p => p.RecvBillNum == itm.RecvBillNum && p.PartCode == itm.PartCode && p.Batch == itm.Batch && p.IsDeleted == false).Select(p => p.Qty).Sum();
|
||
|
|
||
|
if (itm.RecvBillNum.Substring(0, 1) == "R")
|
||
|
{
|
||
|
_recSum = 0 - Math.Abs(_recSum);
|
||
|
}
|
||
|
var _sum = db.V_TB_INVOICE_DETAIL.Where(p => p.RecvBillNum == itm.RecvBillNum && p.PartCode == itm.PartCode && p.Batch == itm.Batch && p.IsDeleted == false).Select(p => p.Qty).Sum();
|
||
|
if (_recSum - _sum <= 0)
|
||
|
{
|
||
|
itm.CanQty = 0;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
itm.CanQty = _recSum - _sum;
|
||
|
}
|
||
|
}
|
||
|
catch
|
||
|
{
|
||
|
itm.CanQty = 0;
|
||
|
}
|
||
|
|
||
|
|
||
|
});
|
||
|
|
||
|
}
|
||
|
return p_list;
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
public static ResultObject<IQueryable<V_TB_RECEIVE_LIST>> Get_V_TB_RECEIVE_LIST_List(V_TB_RECEIVE_LIST p_entity, Action<ResultObject<IQueryable<V_TB_RECEIVE_LIST>>> p_action)
|
||
|
{
|
||
|
ResultObject<IQueryable<V_TB_RECEIVE_LIST>> _ret = new ResultObject<IQueryable<V_TB_RECEIVE_LIST>>();
|
||
|
try
|
||
|
{
|
||
|
using (ScpEntities db = EntitiesFactory.CreateScpInstance())
|
||
|
{
|
||
|
IQueryable<V_TB_RECEIVE_LIST> q = db.V_TB_RECEIVE_LIST;
|
||
|
|
||
|
if (!string.IsNullOrEmpty(p_entity.ProjectId))
|
||
|
{
|
||
|
q = q.Where(p => p.ProjectId.Contains(p_entity.ProjectId));
|
||
|
}
|
||
|
if (!string.IsNullOrEmpty(p_entity.RecvBillNum))
|
||
|
{
|
||
|
q = q.Where(p => p.RecvBillNum == p_entity.RecvBillNum);
|
||
|
}
|
||
|
if (p_entity.PoLine != 0)
|
||
|
{
|
||
|
q = q.Where(p => p.PoLine == p_entity.PoLine);
|
||
|
}
|
||
|
if (!string.IsNullOrEmpty(p_entity.PartCode))
|
||
|
{
|
||
|
q = q.Where(p => p.PartCode.Contains(p_entity.PartCode));
|
||
|
}
|
||
|
if (!string.IsNullOrEmpty(p_entity.Batch))
|
||
|
{
|
||
|
q = q.Where(p => p.Batch.Contains(p_entity.Batch));
|
||
|
}
|
||
|
if (p_entity.Qty != 0)
|
||
|
{
|
||
|
q = q.Where(p => p.Qty == p_entity.Qty);
|
||
|
}
|
||
|
if (!string.IsNullOrEmpty(p_entity.DockCode))
|
||
|
{
|
||
|
q = q.Where(p => p.DockCode.Contains(p_entity.DockCode));
|
||
|
}
|
||
|
if (!string.IsNullOrEmpty(p_entity.Remark))
|
||
|
{
|
||
|
q = q.Where(p => p.Remark.Contains(p_entity.Remark));
|
||
|
}
|
||
|
if (!string.IsNullOrEmpty(p_entity.CreateUser))
|
||
|
{
|
||
|
q = q.Where(p => p.CreateUser.Contains(p_entity.CreateUser));
|
||
|
}
|
||
|
if (p_entity.IsDeleted != false)
|
||
|
{
|
||
|
q = q.Where(p => p.IsDeleted == p_entity.IsDeleted);
|
||
|
}
|
||
|
if (!string.IsNullOrEmpty(p_entity.AsnBillNum))
|
||
|
{
|
||
|
q = q.Where(p => p.AsnBillNum.Contains(p_entity.AsnBillNum));
|
||
|
}
|
||
|
if (!string.IsNullOrEmpty(p_entity.Site))
|
||
|
{
|
||
|
q = q.Where(p => p.Site.Contains(p_entity.Site));
|
||
|
}
|
||
|
if (!string.IsNullOrEmpty(p_entity.VendId))
|
||
|
{
|
||
|
q = q.Where(p => p.VendId.Contains(p_entity.VendId));
|
||
|
}
|
||
|
|
||
|
if (!string.IsNullOrEmpty(p_entity.PartDesc1))
|
||
|
{
|
||
|
q = q.Where(p => p.PartDesc1.Contains(p_entity.PartDesc1));
|
||
|
}
|
||
|
if (p_entity.State != 0)
|
||
|
{
|
||
|
q = q.Where(p => p.State == p_entity.State);
|
||
|
}
|
||
|
if (!string.IsNullOrEmpty(p_entity.PoBillNum))
|
||
|
{
|
||
|
q = q.Where(p => p.PoBillNum.Contains(p_entity.PoBillNum));
|
||
|
}
|
||
|
if (!string.IsNullOrEmpty(p_entity.VendName))
|
||
|
{
|
||
|
q = q.Where(p => p.VendName.Contains(p_entity.VendName));
|
||
|
}
|
||
|
if (!string.IsNullOrEmpty(p_entity.PartCode))
|
||
|
{
|
||
|
q = q.Where(p => p.PartCode.Contains(p_entity.PartCode));
|
||
|
}
|
||
|
if (!string.IsNullOrEmpty(p_entity.Site_Desc))
|
||
|
{
|
||
|
q = q.Where(p => p.Site_Desc.Contains(p_entity.Site_Desc));
|
||
|
}
|
||
|
if (p_entity.UserInAddress != null && p_entity.UserInAddress.Count > 0)
|
||
|
{
|
||
|
q = q.Where(p => p_entity.UserInAddress.Contains(p.Site));
|
||
|
}
|
||
|
if (p_entity.BeginTime != null)
|
||
|
{
|
||
|
q = q.Where(p => p.CreateTime >= p_entity.BeginTime);
|
||
|
}
|
||
|
if (p_entity.ShipTime != null)
|
||
|
{
|
||
|
q = q.Where(p => p.CreateTime <= p_entity.ShipTime);
|
||
|
}
|
||
|
if (!string.IsNullOrEmpty(p_entity.BillType_DESC))
|
||
|
{
|
||
|
q = q.Where(p => p.BillType_DESC.Contains(p_entity.BillType_DESC));
|
||
|
}
|
||
|
if (p_entity.UserInVendIds != null && p_entity.UserInVendIds.Count > 0)
|
||
|
{
|
||
|
q = q.Where(p => p_entity.UserInVendIds.Contains(p.VendId));
|
||
|
}
|
||
|
|
||
|
if (p_entity.UIDList != null && p_entity.UIDList.Count > 0)
|
||
|
{
|
||
|
q = q.Where(p => p_entity.UIDList.Contains(p.UID));
|
||
|
}
|
||
|
_ret.State = ReturnStatus.Succeed;
|
||
|
_ret.Result = q;
|
||
|
p_action(_ret);
|
||
|
}
|
||
|
}
|
||
|
catch (System.Data.Entity.Validation.DbEntityValidationException dbEx)//捕获实体验证异常
|
||
|
{
|
||
|
var sb = new StringBuilder();
|
||
|
|
||
|
foreach (var error in dbEx.EntityValidationErrors.ToList())
|
||
|
{
|
||
|
|
||
|
error.ValidationErrors.ToList().ForEach(i =>
|
||
|
{
|
||
|
sb.AppendFormat("表:{0},字段:{1},信息:{2}\r\n", error.Entry.Entity.GetType().Name, i.PropertyName, i.ErrorMessage);
|
||
|
});
|
||
|
}
|
||
|
_ret.State = ReturnStatus.Failed;
|
||
|
_ret.ErrorList.Add(dbEx);
|
||
|
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_RECIVECE_CONTROLLER), "Get_V_TB_RECEIVE_LIST_List", sb.ToString());
|
||
|
throw new ScpException(ResultCode.DbEntityValidationException, sb.ToString(), "字段验证失败" + sb.ToString());
|
||
|
}
|
||
|
catch (OptimisticConcurrencyException ex)//并发冲突异常
|
||
|
{
|
||
|
|
||
|
_ret.State = ReturnStatus.Failed;
|
||
|
_ret.ErrorList.Add(ex);
|
||
|
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_RECIVECE_CONTROLLER), "Get_V_TB_RECEIVE_LIST_List", ex.ToString());
|
||
|
throw new ScpException(ResultCode.Exception, "9999", ex.ToString());
|
||
|
}
|
||
|
catch (ScpException ex)
|
||
|
{
|
||
|
|
||
|
|
||
|
_ret.State = ReturnStatus.Failed;
|
||
|
_ret.ErrorList.Add(ex);
|
||
|
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_RECIVECE_CONTROLLER), "Get_V_TB_RECEIVE_LIST_List", ex.ToString());
|
||
|
|
||
|
if (ex.InnerException != null && ex.InnerException.GetType() == typeof(UpdateException))
|
||
|
{
|
||
|
var inner = (UpdateException)ex.InnerException;
|
||
|
|
||
|
|
||
|
throw new ScpException(ResultCode.Exception, "0000", ex.ToString());
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
if (ex.InnerException != null) throw ex.InnerException;
|
||
|
}
|
||
|
}
|
||
|
catch (Exception e)
|
||
|
{
|
||
|
_ret.State = ReturnStatus.Failed;
|
||
|
_ret.ErrorList.Add(e);
|
||
|
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_RECIVECE_CONTROLLER), "Get_V_TB_RECEIVE_LIST_List", e.Message);
|
||
|
throw e;
|
||
|
}
|
||
|
return _ret;
|
||
|
}
|
||
|
|
||
|
|
||
|
public static ResultObject<IQueryable<TB_PRICE>> Get_V_TB_RECEIVE_LIST_PRICE(string p_vendId,List<V_TB_RECEIVE_LIST> p_list, Action<ResultObject<IQueryable<TB_PRICE>>> p_action)
|
||
|
{
|
||
|
var _ls = p_list.Select(itm => itm.PartCode);
|
||
|
StringBuilder _buffer = new StringBuilder();
|
||
|
_buffer.Append(" SELECT * FROM TB_PRICE WHERE UID IN");
|
||
|
_buffer.Append("( SELECT MAX(UID) AS UID FROM TB_PRICE AS A");
|
||
|
_buffer.AppendFormat(" where A.VendId='{0}' AND A.PartCode IN ('{1}') ",p_vendId,String.Join("','",_ls));
|
||
|
_buffer.Append(" GROUP BY VendId, Site, PartCode, StartTime, EndTime)");
|
||
|
|
||
|
ResultObject<IQueryable<TB_PRICE>> _ret = new ResultObject<IQueryable<TB_PRICE>>();
|
||
|
try
|
||
|
{
|
||
|
using (ScpEntities db = EntitiesFactory.CreateScpInstance())
|
||
|
{
|
||
|
IQueryable<TB_PRICE> q = db.Database.SqlQuery<TB_PRICE>(_buffer.ToString()).AsQueryable();
|
||
|
|
||
|
|
||
|
_ret.State = ReturnStatus.Succeed;
|
||
|
_ret.Result = q;
|
||
|
p_action(_ret);
|
||
|
}
|
||
|
}
|
||
|
catch (System.Data.Entity.Validation.DbEntityValidationException dbEx)//捕获实体验证异常
|
||
|
{
|
||
|
var sb = new StringBuilder();
|
||
|
|
||
|
foreach (var error in dbEx.EntityValidationErrors.ToList())
|
||
|
{
|
||
|
|
||
|
error.ValidationErrors.ToList().ForEach(i =>
|
||
|
{
|
||
|
sb.AppendFormat("表:{0},字段:{1},信息:{2}\r\n", error.Entry.Entity.GetType().Name, i.PropertyName, i.ErrorMessage);
|
||
|
});
|
||
|
}
|
||
|
_ret.State = ReturnStatus.Failed;
|
||
|
_ret.ErrorList.Add(dbEx);
|
||
|
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_RECIVECE_CONTROLLER), "Get_V_TB_RECEIVE_LIST_List", sb.ToString());
|
||
|
throw new ScpException(ResultCode.DbEntityValidationException, sb.ToString(), "字段验证失败" + sb.ToString());
|
||
|
}
|
||
|
catch (OptimisticConcurrencyException ex)//并发冲突异常
|
||
|
{
|
||
|
|
||
|
_ret.State = ReturnStatus.Failed;
|
||
|
_ret.ErrorList.Add(ex);
|
||
|
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_RECIVECE_CONTROLLER), "Get_V_TB_RECEIVE_LIST_List", ex.ToString());
|
||
|
throw new ScpException(ResultCode.Exception, "9999", ex.ToString());
|
||
|
}
|
||
|
catch (ScpException ex)
|
||
|
{
|
||
|
|
||
|
|
||
|
_ret.State = ReturnStatus.Failed;
|
||
|
_ret.ErrorList.Add(ex);
|
||
|
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_RECIVECE_CONTROLLER), "Get_V_TB_RECEIVE_LIST_List", ex.ToString());
|
||
|
|
||
|
if (ex.InnerException != null && ex.InnerException.GetType() == typeof(UpdateException))
|
||
|
{
|
||
|
var inner = (UpdateException)ex.InnerException;
|
||
|
|
||
|
|
||
|
throw new ScpException(ResultCode.Exception, "0000", ex.ToString());
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
if (ex.InnerException != null) throw ex.InnerException;
|
||
|
}
|
||
|
}
|
||
|
catch (Exception e)
|
||
|
{
|
||
|
_ret.State = ReturnStatus.Failed;
|
||
|
_ret.ErrorList.Add(e);
|
||
|
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_RECIVECE_CONTROLLER), "Get_V_TB_RECEIVE_LIST_List", e.Message);
|
||
|
throw e;
|
||
|
}
|
||
|
return _ret;
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
public static void Get_V_TB_ARRIVE_List(V_TB_ARRIVE p_entity, Action<ResultObject<IQueryable<V_TB_ARRIVE>>> p_action)
|
||
|
{
|
||
|
ResultObject<IQueryable<V_TB_ARRIVE>> _ret = new ResultObject<IQueryable<V_TB_ARRIVE>>();
|
||
|
try
|
||
|
{
|
||
|
using (ScpEntities db = EntitiesFactory.CreateScpInstance())
|
||
|
{
|
||
|
IQueryable<V_TB_ARRIVE> q = db.V_TB_ARRIVE;
|
||
|
|
||
|
if (!string.IsNullOrEmpty(p_entity.ArrvBillNum))
|
||
|
{
|
||
|
q = q.Where(p => p.ArrvBillNum.Contains(p_entity.ArrvBillNum));
|
||
|
}
|
||
|
if (!string.IsNullOrEmpty(p_entity.PoBillNum))
|
||
|
{
|
||
|
q = q.Where(p => p.PoBillNum.Contains(p_entity.PoBillNum));
|
||
|
}
|
||
|
if (!string.IsNullOrEmpty(p_entity.AsnBillNum))
|
||
|
{
|
||
|
q = q.Where(p => p.AsnBillNum.Contains(p_entity.AsnBillNum));
|
||
|
}
|
||
|
if (!string.IsNullOrEmpty(p_entity.Site))
|
||
|
{
|
||
|
q = q.Where(p => p.Site.Contains(p_entity.Site));
|
||
|
}
|
||
|
if (!string.IsNullOrEmpty(p_entity.VendId))
|
||
|
{
|
||
|
q = q.Where(p => p.VendId.Contains(p_entity.VendId));
|
||
|
}
|
||
|
if (p_entity.State == 0 || p_entity.State == 1 || p_entity.State == 2)
|
||
|
{
|
||
|
q = q.Where(p => p.State == p_entity.State);
|
||
|
}
|
||
|
if (!string.IsNullOrEmpty(p_entity.Remark))
|
||
|
{
|
||
|
q = q.Where(p => p.Remark.Contains(p_entity.Remark));
|
||
|
}
|
||
|
if (!string.IsNullOrEmpty(p_entity.CreateUser))
|
||
|
{
|
||
|
q = q.Where(p => p.CreateUser.Contains(p_entity.CreateUser));
|
||
|
}
|
||
|
if (p_entity.IsDeleted != false)
|
||
|
{
|
||
|
q = q.Where(p => p.IsDeleted == p_entity.IsDeleted);
|
||
|
}
|
||
|
if (!string.IsNullOrEmpty(p_entity.VendName))
|
||
|
{
|
||
|
q = q.Where(p => p.VendName.Contains(p_entity.VendName));
|
||
|
}
|
||
|
if (!string.IsNullOrEmpty(p_entity.OperName))
|
||
|
{
|
||
|
q = q.Where(p => p.OperName.Contains(p_entity.OperName));
|
||
|
}
|
||
|
if (!string.IsNullOrEmpty(p_entity.Site_Desc))
|
||
|
{
|
||
|
q = q.Where(p => p.Site_Desc.Contains(p_entity.Site_Desc));
|
||
|
}
|
||
|
if (!string.IsNullOrEmpty(p_entity.BillType_DESC))
|
||
|
{
|
||
|
q = q.Where(p => p.BillType_DESC.Contains(p_entity.BillType_DESC));
|
||
|
}
|
||
|
//if (p_entity.UserInAddress != null && p_entity.UserInAddress.Count > 0)
|
||
|
//{
|
||
|
// q = q.Where(p => p_entity.UserInAddress.Contains(p.Address));
|
||
|
//}
|
||
|
_ret.State = ReturnStatus.Succeed;
|
||
|
_ret.Result = q;
|
||
|
|
||
|
p_action(_ret);
|
||
|
}
|
||
|
}
|
||
|
catch (System.Data.Entity.Validation.DbEntityValidationException dbEx)//捕获实体验证异常
|
||
|
{
|
||
|
var sb = new StringBuilder();
|
||
|
|
||
|
foreach (var error in dbEx.EntityValidationErrors.ToList())
|
||
|
{
|
||
|
|
||
|
error.ValidationErrors.ToList().ForEach(i =>
|
||
|
{
|
||
|
sb.AppendFormat("表:{0},字段:{1},信息:{2}\r\n", error.Entry.Entity.GetType().Name, i.PropertyName, i.ErrorMessage);
|
||
|
});
|
||
|
}
|
||
|
_ret.State = ReturnStatus.Failed;
|
||
|
_ret.ErrorList.Add(dbEx);
|
||
|
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_RECIVECE_CONTROLLER), "Get_V_TB_ARRIVE_List", sb.ToString());
|
||
|
throw new ScpException(ResultCode.DbEntityValidationException, sb.ToString(), "字段验证失败" + sb.ToString());
|
||
|
}
|
||
|
catch (OptimisticConcurrencyException ex)//并发冲突异常
|
||
|
{
|
||
|
Console.WriteLine(ex.ToString());
|
||
|
_ret.State = ReturnStatus.Failed;
|
||
|
_ret.ErrorList.Add(ex);
|
||
|
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_RECIVECE_CONTROLLER), "Get_V_TB_ARRIVE_List", ex.ToString());
|
||
|
throw new ScpException(ResultCode.Exception, "9999", ex.ToString());
|
||
|
}
|
||
|
catch (ScpException ex)
|
||
|
{
|
||
|
Console.WriteLine(ex.ToString());
|
||
|
|
||
|
_ret.State = ReturnStatus.Failed;
|
||
|
_ret.ErrorList.Add(ex);
|
||
|
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_RECIVECE_CONTROLLER), "Get_V_TB_ARRIVE_List", ex.ToString());
|
||
|
|
||
|
if (ex.InnerException != null && ex.InnerException.GetType() == typeof(UpdateException))
|
||
|
{
|
||
|
var inner = (UpdateException)ex.InnerException;
|
||
|
|
||
|
//Console.WriteLine(inner?.StateEntries[0].EntitySet.Name);
|
||
|
throw new ScpException(ResultCode.Exception, "0000", ex.ToString());
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
if (ex.InnerException != null) throw ex.InnerException;
|
||
|
}
|
||
|
}
|
||
|
catch (Exception e)
|
||
|
{
|
||
|
_ret.State = ReturnStatus.Failed;
|
||
|
_ret.ErrorList.Add(e);
|
||
|
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_RECIVECE_CONTROLLER), "Get_V_TB_ARRIVE_List", e.Message);
|
||
|
throw e;
|
||
|
}
|
||
|
|
||
|
}
|
||
|
public static ResultObject<bool> Save_TB_ARRIVE_STATE(List<string> p_list, ReceiveState p_state, string userName)
|
||
|
{
|
||
|
ResultObject<bool> _ret = new ResultObject<bool>();
|
||
|
try
|
||
|
{
|
||
|
using (ScpEntities db = EntitiesFactory.CreateScpInstance())
|
||
|
{
|
||
|
var _ls = db.V_TB_ARRIVE.Where(p => p_list.Contains(p.ArrvBillNum)).ToList();
|
||
|
int count = _ls.Count(p => p.State == (int)ReceiveState.Receive);
|
||
|
if (count == _ls.Count && _ls.Count > 0)
|
||
|
{
|
||
|
_ls.ForEach(p =>
|
||
|
{
|
||
|
p.OperName = userName;
|
||
|
p.State = (int)ReceiveState.Check;
|
||
|
var _list = db.TB_ARRIVE_DETAIL.Where(itm => itm.ArrvBillNum == p.ArrvBillNum).ToList();
|
||
|
_list.ForEach(itm => itm.State = (int)ReceiveState.Check);
|
||
|
db.TB_ARRIVE_DETAIL.AddOrUpdate(itm => itm.UID, _list.ToArray());
|
||
|
#region 收货审核提醒供应商提起发票申请
|
||
|
TB_PENING_ITEMS _item = new TB_PENING_ITEMS();
|
||
|
_item.ROLE_NAME = "供应商";
|
||
|
_item.ITEM_NO = p.ArrvBillNum;
|
||
|
_item.ITEM_CONTENT = string.Format("到货单号{0}发货单号{1},已到货!请申请发票", p.ArrvBillNum, _ls[0].AsnBillNum);
|
||
|
_item.ITEM_TYPE = (int)PENDING_MESSAGE_TYPE.PO_AUDIT_PASS;
|
||
|
_item.ITEM_STATE = (int)PENDING_STATE.WAITING;
|
||
|
_item.SENDER = p.CreateUser;
|
||
|
_item.VEND_ID = p.VendId;
|
||
|
_item.SENDING_TIME = DateTime.Now;
|
||
|
//_item.ITEM_ADDRESS = p.Site_Desc;
|
||
|
_item.ITEM_ADDRESS = p.Site;
|
||
|
_item.GUID = Guid.NewGuid();
|
||
|
db.TB_PENING_ITEMS.Add(_item);
|
||
|
#endregion
|
||
|
}
|
||
|
);
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
_ret.State = ReturnStatus.Failed;
|
||
|
_ret.Result = false;
|
||
|
_ret.Message = "选择的记录,有不是到货状态记录!";
|
||
|
}
|
||
|
if (db.SaveChanges() != -1)
|
||
|
{
|
||
|
_ret.State = ReturnStatus.Succeed;
|
||
|
_ret.Result = true;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
_ret.State = ReturnStatus.Failed;
|
||
|
_ret.Result = false;
|
||
|
_ret.Message = "数据更新失败!";
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
catch (System.Data.Entity.Validation.DbEntityValidationException dbEx)//捕获实体验证异常
|
||
|
{
|
||
|
var sb = new StringBuilder();
|
||
|
|
||
|
foreach (var error in dbEx.EntityValidationErrors.ToList())
|
||
|
{
|
||
|
|
||
|
error.ValidationErrors.ToList().ForEach(i =>
|
||
|
{
|
||
|
sb.AppendFormat("表:{0},字段:{1},信息:{2}\r\n", error.Entry.Entity.GetType().Name, i.PropertyName, i.ErrorMessage);
|
||
|
});
|
||
|
}
|
||
|
_ret.State = ReturnStatus.Failed;
|
||
|
_ret.Result = false;
|
||
|
_ret.ErrorList.Add(dbEx);
|
||
|
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_RECIVECE_CONTROLLER), "Save_TB_ARRIVE_STATE", sb.ToString());
|
||
|
throw new ScpException(ResultCode.DbEntityValidationException, sb.ToString(), "字段验证失败" + sb.ToString());
|
||
|
}
|
||
|
catch (OptimisticConcurrencyException ex)//并发冲突异常
|
||
|
{
|
||
|
Console.WriteLine(ex.ToString());
|
||
|
_ret.State = ReturnStatus.Failed;
|
||
|
_ret.Result = false;
|
||
|
_ret.ErrorList.Add(ex);
|
||
|
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_RECIVECE_CONTROLLER), "Save_TB_ARRIVE_STATE", ex.ToString());
|
||
|
throw new ScpException(ResultCode.Exception, "9999", ex.ToString());
|
||
|
}
|
||
|
catch (ScpException ex)
|
||
|
{
|
||
|
Console.WriteLine(ex.ToString());
|
||
|
|
||
|
_ret.State = ReturnStatus.Failed;
|
||
|
_ret.Result = false;
|
||
|
_ret.ErrorList.Add(ex);
|
||
|
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_RECIVECE_CONTROLLER), "Save_TB_ARRIVE_STATE", ex.ToString());
|
||
|
|
||
|
if (ex.InnerException != null && ex.InnerException.GetType() == typeof(UpdateException))
|
||
|
{
|
||
|
var inner = (UpdateException)ex.InnerException;
|
||
|
|
||
|
//Console.WriteLine(inner?.StateEntries[0].EntitySet.Name);
|
||
|
throw new ScpException(ResultCode.Exception, "0000", ex.ToString());
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
if (ex.InnerException != null) throw ex.InnerException;
|
||
|
}
|
||
|
}
|
||
|
catch (Exception e)
|
||
|
{
|
||
|
_ret.State = ReturnStatus.Failed;
|
||
|
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_RECIVECE_CONTROLLER), "Save_TB_ARRIVE_STATE", e.Message);
|
||
|
_ret.Result = false;
|
||
|
_ret.ErrorList.Add(e);
|
||
|
throw e;
|
||
|
}
|
||
|
return _ret;
|
||
|
}
|
||
|
public static void GetNumber(string p_asnBillNum)
|
||
|
{
|
||
|
using (ScpEntities db = EntitiesFactory.CreateScpInstance())
|
||
|
{
|
||
|
var _list = db.TB_ASN.Where(p => p.AsnBillNum == p_asnBillNum && p.IsDeleted == false).ToList();
|
||
|
if (_list.Count > 0)
|
||
|
{
|
||
|
_list.ForEach(itm => itm.State = (int)AsnState.Receive);
|
||
|
db.TB_ASN.AddOrUpdate(p => p.UID, _list.ToArray());
|
||
|
var _entity = _list.FirstOrDefault();
|
||
|
var _asnList = db.TB_ASN.Where(p => p.AskBillNum == _entity.AskBillNum && p.IsDeleted == false);
|
||
|
var _count = _asnList.Count(p => p.State == (int)AsnState.Receive);
|
||
|
if (_asnList.Count() == _count)
|
||
|
{
|
||
|
var _askList = db.TB_ASK.Where(p => p.AskBillNum == _entity.AskBillNum && p.IsDeleted == false).ToList();
|
||
|
_askList.ForEach(itm => itm.State = (int)AskState.Receive);
|
||
|
db.TB_ASK.AddOrUpdate(p => p.UID, _askList.ToArray());
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public static void Get_V_TB_ARRIVE_DETAIL_List(V_TB_ARRIVE_DETAIL p_entity, Action<ResultObject<IQueryable<V_TB_ARRIVE_DETAIL>>> p_action)
|
||
|
{
|
||
|
ResultObject<IQueryable<V_TB_ARRIVE_DETAIL>> _ret = new ResultObject<IQueryable<V_TB_ARRIVE_DETAIL>>();
|
||
|
try
|
||
|
{
|
||
|
using (ScpEntities db = EntitiesFactory.CreateScpInstance())
|
||
|
{
|
||
|
IQueryable<V_TB_ARRIVE_DETAIL> q = db.V_TB_ARRIVE_DETAIL;
|
||
|
|
||
|
if (!string.IsNullOrEmpty(p_entity.ArrvBillNum))
|
||
|
{
|
||
|
q = q.Where(p => p.ArrvBillNum == p_entity.ArrvBillNum);
|
||
|
}
|
||
|
if (p_entity.PoLine != 0)
|
||
|
{
|
||
|
q = q.Where(p => p.PoLine == p_entity.PoLine);
|
||
|
}
|
||
|
if (!string.IsNullOrEmpty(p_entity.PartCode))
|
||
|
{
|
||
|
q = q.Where(p => p.PartCode.Contains(p_entity.PartCode));
|
||
|
}
|
||
|
if (!string.IsNullOrEmpty(p_entity.Batch))
|
||
|
{
|
||
|
q = q.Where(p => p.Batch.Contains(p_entity.Batch));
|
||
|
}
|
||
|
if (p_entity.Qty != 0)
|
||
|
{
|
||
|
q = q.Where(p => p.Qty == p_entity.Qty);
|
||
|
}
|
||
|
if (!string.IsNullOrEmpty(p_entity.DockCode))
|
||
|
{
|
||
|
q = q.Where(p => p.DockCode.Contains(p_entity.DockCode));
|
||
|
}
|
||
|
if (!string.IsNullOrEmpty(p_entity.Remark))
|
||
|
{
|
||
|
q = q.Where(p => p.Remark.Contains(p_entity.Remark));
|
||
|
}
|
||
|
if (!string.IsNullOrEmpty(p_entity.CreateUser))
|
||
|
{
|
||
|
q = q.Where(p => p.CreateUser.Contains(p_entity.CreateUser));
|
||
|
}
|
||
|
if (p_entity.IsDeleted != false)
|
||
|
{
|
||
|
q = q.Where(p => p.IsDeleted == p_entity.IsDeleted);
|
||
|
}
|
||
|
if (!string.IsNullOrEmpty(p_entity.AsnBillNum))
|
||
|
{
|
||
|
q = q.Where(p => p.AsnBillNum.Contains(p_entity.AsnBillNum));
|
||
|
}
|
||
|
if (!string.IsNullOrEmpty(p_entity.Site))
|
||
|
{
|
||
|
q = q.Where(p => p.Site.Contains(p_entity.Site));
|
||
|
}
|
||
|
if (!string.IsNullOrEmpty(p_entity.VendId))
|
||
|
{
|
||
|
q = q.Where(p => p.VendId.Contains(p_entity.VendId));
|
||
|
}
|
||
|
if (!string.IsNullOrEmpty(p_entity.OperName))
|
||
|
{
|
||
|
q = q.Where(p => p.OperName.Contains(p_entity.OperName));
|
||
|
}
|
||
|
if (!string.IsNullOrEmpty(p_entity.PartDesc1))
|
||
|
{
|
||
|
q = q.Where(p => p.PartDesc1.Contains(p_entity.PartDesc1));
|
||
|
}
|
||
|
if (p_entity.State != 0)
|
||
|
{
|
||
|
q = q.Where(p => p.State == p_entity.State);
|
||
|
}
|
||
|
if (!string.IsNullOrEmpty(p_entity.PoBillNum))
|
||
|
{
|
||
|
q = q.Where(p => p.PoBillNum.Contains(p_entity.PoBillNum));
|
||
|
}
|
||
|
//if (p_entity.UserInAddress != null && p_entity.UserInAddress.Count > 0)
|
||
|
//{
|
||
|
// q = q.Where(p => p_entity.UserInAddress.Contains(p.Address));
|
||
|
//}
|
||
|
_ret.State = ReturnStatus.Succeed;
|
||
|
_ret.Result = q;
|
||
|
|
||
|
p_action(_ret);
|
||
|
}
|
||
|
}
|
||
|
catch (System.Data.Entity.Validation.DbEntityValidationException dbEx)//捕获实体验证异常
|
||
|
{
|
||
|
var sb = new StringBuilder();
|
||
|
|
||
|
foreach (var error in dbEx.EntityValidationErrors.ToList())
|
||
|
{
|
||
|
|
||
|
error.ValidationErrors.ToList().ForEach(i =>
|
||
|
{
|
||
|
sb.AppendFormat("表:{0},字段:{1},信息:{2}\r\n", error.Entry.Entity.GetType().Name, i.PropertyName, i.ErrorMessage);
|
||
|
});
|
||
|
}
|
||
|
_ret.State = ReturnStatus.Failed;
|
||
|
_ret.ErrorList.Add(dbEx);
|
||
|
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_RECIVECE_CONTROLLER), "Get_V_TB_ARRIVE_DETAIL_List", sb.ToString());
|
||
|
throw new ScpException(ResultCode.DbEntityValidationException, sb.ToString(), "字段验证失败" + sb.ToString());
|
||
|
}
|
||
|
catch (OptimisticConcurrencyException ex)//并发冲突异常
|
||
|
{
|
||
|
Console.WriteLine(ex.ToString());
|
||
|
_ret.State = ReturnStatus.Failed;
|
||
|
_ret.ErrorList.Add(ex);
|
||
|
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_RECIVECE_CONTROLLER), "Get_V_TB_ARRIVE_DETAIL_List", ex.ToString());
|
||
|
throw new ScpException(ResultCode.Exception, "9999", ex.ToString());
|
||
|
}
|
||
|
catch (ScpException ex)
|
||
|
{
|
||
|
Console.WriteLine(ex.ToString());
|
||
|
|
||
|
_ret.State = ReturnStatus.Failed;
|
||
|
_ret.ErrorList.Add(ex);
|
||
|
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_RECIVECE_CONTROLLER), "Get_V_TB_ARRIVE_DETAIL_List", ex.ToString());
|
||
|
|
||
|
if (ex.InnerException != null && ex.InnerException.GetType() == typeof(UpdateException))
|
||
|
{
|
||
|
var inner = (UpdateException)ex.InnerException;
|
||
|
|
||
|
//Console.WriteLine(inner?.StateEntries[0].EntitySet.Name);
|
||
|
throw new ScpException(ResultCode.Exception, "0000", ex.ToString());
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
if (ex.InnerException != null) throw ex.InnerException;
|
||
|
}
|
||
|
}
|
||
|
catch (Exception e)
|
||
|
{
|
||
|
_ret.State = ReturnStatus.Failed;
|
||
|
_ret.ErrorList.Add(e);
|
||
|
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_RECIVECE_CONTROLLER), "Get_V_TB_ARRIVE_DETAIL_List", e.Message);
|
||
|
throw e;
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
public static List<V_TB_PO_DETAIL> COMPARE_DETAIL_SUM(string p_number)
|
||
|
{
|
||
|
List<V_TB_PO_DETAIL> _ls = new List<V_TB_PO_DETAIL>();
|
||
|
using (ScpEntities db = EntitiesFactory.CreateScpInstance())
|
||
|
{
|
||
|
var _list=db.V_TB_PO_DETAIL.Where(p => p.PoBillNum == p_number).ToList();
|
||
|
if (_list.Count > 0)
|
||
|
{
|
||
|
//var _detail = p_list[0];
|
||
|
foreach (V_TB_PO_DETAIL _detail in _list)
|
||
|
{
|
||
|
//var _ask = db.TB_ASK_DETAIL.Where(p => p.PoBillNum == _detail.PoBillNum && p.IsDeleted == false).GroupBy(p => new { p.PoBillNum, p.PoLine, p.PartCode }).Select(p => new { AskSum = p.Sum(itm => itm.AskQty), PoLine = p.Key.PoLine, PoBillNum = p.Key.PoBillNum, PartCode = p.Key.PartCode });
|
||
|
|
||
|
var rec = db.TB_RECEIVE_DETAIL.Where(p => p.PoBillNum == _detail.PoBillNum && p.IsDeleted == false && p.BillType == 0).GroupBy(p => new { p.PoBillNum, p.PoLine, p.PartCode }).Select(p => new { ReceiveSum = p.Sum(itm => itm.Qty), PoLine = p.Key.PoLine, PoBillNum = p.Key.PoBillNum, PartCode = p.Key.PartCode });
|
||
|
|
||
|
var reject = db.TB_RECEIVE_DETAIL.Where(p => p.PoBillNum == _detail.PoBillNum && p.IsDeleted == false && p.BillType == 1).GroupBy(p => new { p.PoBillNum, p.PoLine, p.PartCode }).Select(p => new { RejectSum = p.Sum(itm => itm.Qty), PoLine = p.Key.PoLine, PoBillNum = p.Key.PoBillNum, PartCode = p.Key.PartCode });
|
||
|
|
||
|
var asn = db.TB_ASN_DETAIL.Where(p => p.PoBillNum == _detail.PoBillNum && p.IsDeleted == false && p.State == (int)AsnState.Ship).GroupBy(p => new { p.PoBillNum, p.PoLine, p.PartCode }).Select(p => new { AsSum = p.Sum(itm => itm.Qty), PoLine = p.Key.PoLine, PoBillNum = p.Key.PoBillNum, PartCode = p.Key.PartCode });
|
||
|
|
||
|
//var arrive = db.TB_ARRIVE_DETAIL.Where(p => p.PoBillNum == _detail.PoBillNum && p.IsDeleted == false && p.State == (int)ArriveState.OK && p.BillType == (int)ArriveBillType.Receive).GroupBy(p => new { p.PoBillNum, p.PoLine, p.PartCode }).Select(p => new { ArriveSum = p.Sum(itm => itm.Qty), PoLine = p.Key.PoLine, PoBillNum = p.Key.PoBillNum, PartCode = p.Key.PartCode });
|
||
|
|
||
|
|
||
|
_detail.PartDesc1 = _detail.PartDesc1 + _detail.PartDesc2;
|
||
|
rec.ToList().ForEach(itm =>
|
||
|
{
|
||
|
if (_detail.PoBillNum == itm.PoBillNum && _detail.PoLine == itm.PoLine && _detail.PartCode == itm.PartCode)
|
||
|
{
|
||
|
_detail.ReceivedQty = itm.ReceiveSum;
|
||
|
}
|
||
|
|
||
|
});
|
||
|
reject.ToList().ForEach(itm =>
|
||
|
{
|
||
|
if (_detail.PoBillNum == itm.PoBillNum && _detail.PoLine == itm.PoLine && _detail.PartCode == itm.PartCode)
|
||
|
{
|
||
|
_detail.RejectQty = itm.RejectSum.ToString();
|
||
|
}
|
||
|
|
||
|
});
|
||
|
asn.ToList().ForEach(itm =>
|
||
|
{
|
||
|
if (_detail.PoBillNum == itm.PoBillNum && _detail.PoLine == itm.PoLine && _detail.PartCode == itm.PartCode)
|
||
|
{
|
||
|
_detail.ShippedQty = itm.AsSum;
|
||
|
}
|
||
|
|
||
|
});
|
||
|
//_ask.ToList().ForEach(itm =>
|
||
|
//{
|
||
|
// if (_detail.PoBillNum == itm.PoBillNum && _detail.PoLine == itm.PoLine && _detail.PartCode == itm.PartCode)
|
||
|
// {
|
||
|
// _detail.TempQty = itm.AskSum;
|
||
|
// }
|
||
|
//});
|
||
|
//arrive.ToList().ForEach(itm =>
|
||
|
//{
|
||
|
// if (_detail.PoBillNum == itm.PoBillNum && _detail.PoLine == itm.PoLine && _detail.PartCode == itm.PartCode)
|
||
|
// {
|
||
|
// _detail.ArriveQty = itm.ArriveSum.ToString();
|
||
|
// }
|
||
|
|
||
|
//});
|
||
|
|
||
|
|
||
|
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
_ls=_list;
|
||
|
|
||
|
}
|
||
|
return _ls;
|
||
|
|
||
|
|
||
|
}
|
||
|
|
||
|
public static List<V_TB_PO_DETAIL> COMPARE_PO(string p_number)
|
||
|
{
|
||
|
List<V_TB_PO_DETAIL> _ls = new List<V_TB_PO_DETAIL>();
|
||
|
using (ScpEntities db = EntitiesFactory.CreateScpInstance())
|
||
|
{
|
||
|
var _list = db.V_TB_PO_DETAIL.Where(p => p.PoBillNum == p_number).ToList();
|
||
|
if (_list.Count > 0)
|
||
|
{
|
||
|
//var _detail = p_list[0];
|
||
|
foreach (V_TB_PO_DETAIL _detail in _list)
|
||
|
{
|
||
|
//var _ask = db.TB_ASK_DETAIL.Where(p => p.PoBillNum == _detail.PoBillNum && p.IsDeleted == false).GroupBy(p => new { p.PoBillNum, p.PoLine, p.PartCode }).Select(p => new { AskSum = p.Sum(itm => itm.AskQty), PoLine = p.Key.PoLine, PoBillNum = p.Key.PoBillNum, PartCode = p.Key.PartCode });
|
||
|
|
||
|
var rec = db.TB_RECEIVE_DETAIL.Where(p => p.PoBillNum == _detail.PoBillNum && p.IsDeleted == false && p.BillType == 0).GroupBy(p => new { p.PoBillNum, p.PoLine, p.PartCode }).Select(p => new { ReceiveSum = p.Sum(itm => itm.Qty), PoLine = p.Key.PoLine, PoBillNum = p.Key.PoBillNum, PartCode = p.Key.PartCode });
|
||
|
|
||
|
var reject = db.TB_RECEIVE_DETAIL.Where(p => p.PoBillNum == _detail.PoBillNum && p.IsDeleted == false && p.BillType == 1).GroupBy(p => new { p.PoBillNum, p.PoLine, p.PartCode }).Select(p => new { RejectSum = p.Sum(itm => itm.Qty), PoLine = p.Key.PoLine, PoBillNum = p.Key.PoBillNum, PartCode = p.Key.PartCode });
|
||
|
|
||
|
var asn = db.TB_ASN_DETAIL.Where(p => p.PoBillNum == _detail.PoBillNum && p.IsDeleted == false && p.State == (int)AsnState.Ship).GroupBy(p => new { p.PoBillNum, p.PoLine, p.PartCode }).Select(p => new { AsSum = p.Sum(itm => itm.Qty), PoLine = p.Key.PoLine, PoBillNum = p.Key.PoBillNum, PartCode = p.Key.PartCode });
|
||
|
|
||
|
//var arrive = db.TB_ARRIVE_DETAIL.Where(p => p.PoBillNum == _detail.PoBillNum && p.IsDeleted == false && p.State == (int)ArriveState.OK && p.BillType == (int)ArriveBillType.Receive).GroupBy(p => new { p.PoBillNum, p.PoLine, p.PartCode }).Select(p => new { ArriveSum = p.Sum(itm => itm.Qty), PoLine = p.Key.PoLine, PoBillNum = p.Key.PoBillNum, PartCode = p.Key.PartCode });
|
||
|
|
||
|
|
||
|
_detail.PartDesc1 = _detail.PartDesc1 + _detail.PartDesc2;
|
||
|
rec.ToList().ForEach(itm =>
|
||
|
{
|
||
|
if (_detail.PoBillNum == itm.PoBillNum && _detail.PoLine == itm.PoLine && _detail.PartCode == itm.PartCode)
|
||
|
{
|
||
|
_detail.ReceivedQty = itm.ReceiveSum;
|
||
|
}
|
||
|
|
||
|
});
|
||
|
reject.ToList().ForEach(itm =>
|
||
|
{
|
||
|
if (_detail.PoBillNum == itm.PoBillNum && _detail.PoLine == itm.PoLine && _detail.PartCode == itm.PartCode)
|
||
|
{
|
||
|
_detail.RejectQty = itm.RejectSum.ToString();
|
||
|
}
|
||
|
|
||
|
});
|
||
|
asn.ToList().ForEach(itm =>
|
||
|
{
|
||
|
if (_detail.PoBillNum == itm.PoBillNum && _detail.PoLine == itm.PoLine && _detail.PartCode == itm.PartCode)
|
||
|
{
|
||
|
_detail.ShippedQty = itm.AsSum;
|
||
|
}
|
||
|
|
||
|
});
|
||
|
//_ask.ToList().ForEach(itm =>
|
||
|
//{
|
||
|
// if (_detail.PoBillNum == itm.PoBillNum && _detail.PoLine == itm.PoLine && _detail.PartCode == itm.PartCode)
|
||
|
// {
|
||
|
// _detail.TempQty = itm.AskSum;
|
||
|
// }
|
||
|
//});
|
||
|
//arrive.ToList().ForEach(itm =>
|
||
|
//{
|
||
|
// if (_detail.PoBillNum == itm.PoBillNum && _detail.PoLine == itm.PoLine && _detail.PartCode == itm.PartCode)
|
||
|
// {
|
||
|
// _detail.ArriveQty = itm.ArriveSum.ToString();
|
||
|
// }
|
||
|
|
||
|
//});
|
||
|
|
||
|
|
||
|
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
_ls = _list;
|
||
|
|
||
|
}
|
||
|
return _ls;
|
||
|
|
||
|
|
||
|
}
|
||
|
public static ResultObject<bool> Save_Reject(List<V_TB_RECEIVE_DETAIL> p_list)
|
||
|
{
|
||
|
ResultObject<bool> _ret = new ResultObject<bool>();
|
||
|
try
|
||
|
{
|
||
|
using (ScpEntities db = EntitiesFactory.CreateScpInstance())
|
||
|
{
|
||
|
var _ls = p_list.Select(p => p.UID).ToList();
|
||
|
|
||
|
var _list=db.TB_RECEIVE_DETAIL.Where(p => _ls.Contains(p.UID)).ToList();
|
||
|
_list.ForEach(p => {
|
||
|
var _entity=p_list.Where(itm => itm.UID == p.UID).FirstOrDefault();
|
||
|
if (_entity != null)
|
||
|
{
|
||
|
p.Remark = _entity.Remark;
|
||
|
//p.AsnBillNum = _entity.AsnBillNum;
|
||
|
}
|
||
|
|
||
|
});
|
||
|
|
||
|
db.TB_RECEIVE_DETAIL.AddOrUpdate(_list.ToArray());
|
||
|
|
||
|
int state = db.SaveChanges();
|
||
|
if (state != -1)
|
||
|
{
|
||
|
|
||
|
_ret.State = ReturnStatus.Succeed;
|
||
|
_ret.Result = true;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
_ret.State = ReturnStatus.Failed;
|
||
|
_ret.Result = false;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|
||
|
catch (System.Data.Entity.Validation.DbEntityValidationException dbEx)//捕获实体验证异常
|
||
|
{
|
||
|
var sb = new StringBuilder();
|
||
|
|
||
|
foreach (var error in dbEx.EntityValidationErrors.ToList())
|
||
|
{
|
||
|
|
||
|
error.ValidationErrors.ToList().ForEach(i =>
|
||
|
{
|
||
|
sb.AppendFormat("表:{0},字段:{1},信息:{2}\r\n", error.Entry.Entity.GetType().Name, i.PropertyName, i.ErrorMessage);
|
||
|
});
|
||
|
}
|
||
|
_ret.State = ReturnStatus.Failed;
|
||
|
_ret.Result = false;
|
||
|
_ret.ErrorList.Add(dbEx);
|
||
|
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASK_CONTROLLER), "Save_ASK_TO_ASN", sb.ToString());
|
||
|
throw new ScpException(ResultCode.DbEntityValidationException, sb.ToString(), "字段验证失败" + sb.ToString());
|
||
|
}
|
||
|
catch (OptimisticConcurrencyException ex)//并发冲突异常
|
||
|
{
|
||
|
|
||
|
_ret.State = ReturnStatus.Failed;
|
||
|
_ret.Result = false;
|
||
|
_ret.ErrorList.Add(ex);
|
||
|
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASK_CONTROLLER), "Save_ASK_TO_ASN", ex.ToString());
|
||
|
throw new ScpException(ResultCode.Exception, "9999", ex.ToString());
|
||
|
}
|
||
|
catch (ScpException ex)
|
||
|
{
|
||
|
_ret.State = ReturnStatus.Failed;
|
||
|
_ret.Result = false;
|
||
|
_ret.ErrorList.Add(ex);
|
||
|
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASK_CONTROLLER), "Save_ASK_TO_ASN", ex.ToString());
|
||
|
|
||
|
if (ex.InnerException != null && ex.InnerException.GetType() == typeof(UpdateException))
|
||
|
{
|
||
|
var inner = (UpdateException)ex.InnerException;
|
||
|
throw new ScpException(ResultCode.Exception, "0000", ex.ToString());
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
if (ex.InnerException != null) throw ex.InnerException;
|
||
|
}
|
||
|
}
|
||
|
catch (Exception e)
|
||
|
{
|
||
|
_ret.State = ReturnStatus.Failed;
|
||
|
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASK_CONTROLLER), "Save_ASK_TO_ASN", e.Message);
|
||
|
_ret.Result = false;
|
||
|
_ret.ErrorList.Add(e);
|
||
|
throw e;
|
||
|
}
|
||
|
return _ret;
|
||
|
}
|
||
|
|
||
|
|
||
|
public static DataSet GET_RECEIVE_EXECEL(List<string> p_lst, string p_site, string p_vendid = "")
|
||
|
{
|
||
|
DataSet _ds = new DataSet();
|
||
|
using (ScpEntities db = EntitiesFactory.CreateScpInstance())
|
||
|
{
|
||
|
List<V_TB_RECEIVE> _ls = new List<V_TB_RECEIVE>();
|
||
|
if (!string.IsNullOrEmpty(p_vendid))
|
||
|
{ _ls = db.V_TB_RECEIVE.Where(p => p_lst.Contains(p.RecvBillNum) && p.VendId == p_vendid).ToList(); }
|
||
|
else
|
||
|
{
|
||
|
_ls = db.V_TB_RECEIVE.Where(p => p_lst.Contains(p.RecvBillNum) && p.Site==p_site ).ToList();
|
||
|
}
|
||
|
|
||
|
var str = JsonHelper.GetJson(_ls);
|
||
|
var _exportList = new List<SCP_RECEIVE_EXPORT>();
|
||
|
_ls.ForEach(itm =>
|
||
|
{
|
||
|
var _entity = new SCP_RECEIVE_EXPORT();
|
||
|
_entity.状态 = itm.State_DESC;
|
||
|
_entity.单据类型 = itm.BillType_DESC;
|
||
|
_entity.到货单号 = itm.RecvBillNum;
|
||
|
_entity.发货单号 = itm.AsnBillNum;
|
||
|
// _entity.要货看板号 = itm.AskBillNum;
|
||
|
_entity.订单号 = itm.PoBillNum;
|
||
|
_entity.供应商 = itm.VendName;
|
||
|
_entity.供应商编码 = itm.VendId;
|
||
|
_entity.地点 = itm.Site;
|
||
|
_entity.地点名称 = itm.Site_Desc;
|
||
|
_entity.到货日期 = itm.ShipTime == null ? string.Empty : itm.ShipTime.ToString("yyyyMMdd");
|
||
|
_exportList.Add(_entity);
|
||
|
});
|
||
|
var _dt = ConvertHelper.ToDataTable(_exportList);
|
||
|
_ds.Tables.Add(_dt);
|
||
|
var _exportDetailList = new List<SCP_RECEIVE_DETAIL_EXPORT>();
|
||
|
|
||
|
List<V_TB_RECEIVE_DETAIL> _detailList = new List<V_TB_RECEIVE_DETAIL>();
|
||
|
if (!string.IsNullOrEmpty(p_vendid))
|
||
|
{
|
||
|
_detailList = db.V_TB_RECEIVE_DETAIL.Where(p => p_lst.Contains(p.RecvBillNum) && p.VendId == p_vendid).ToList();
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
_detailList = db.V_TB_RECEIVE_DETAIL.Where(p => p_lst.Contains(p.RecvBillNum) && p.Site == p_site).ToList();
|
||
|
}
|
||
|
|
||
|
|
||
|
_detailList.ForEach(itm => {
|
||
|
var _entity = new SCP_RECEIVE_DETAIL_EXPORT();
|
||
|
_entity.单据号 = itm.RecvBillNum;
|
||
|
_entity.发货单号 = itm.AsnBillNum;
|
||
|
_entity.订单号 = itm.PoBillNum;
|
||
|
_entity.订单行 = itm.PoLine.ToString();
|
||
|
_entity.零件号 = itm.PartCode;
|
||
|
_entity.零件名称 = itm.PartDesc1;
|
||
|
_entity.单位 = itm.Unit;
|
||
|
_entity.数量 = itm.Qty.ToString();
|
||
|
_entity.时间 = itm.ShipTime == null ? string.Empty : itm.ShipTime.Value.ToString("yyyyMMdd");
|
||
|
_entity.备注 = itm.Remark;
|
||
|
_exportDetailList.Add(_entity);
|
||
|
});
|
||
|
var _list_dt = ConvertHelper.ToDataTable(_exportDetailList);
|
||
|
_ds.Tables.Add(_list_dt);
|
||
|
}
|
||
|
return _ds;
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
}
|
||
|
}
|