|
|
@ -3687,5 +3687,158 @@ namespace CK.SCP.Controller |
|
|
|
return list; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 供应商要货未完成查询
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="p_entity"></param>
|
|
|
|
/// <param name="p_action"></param>
|
|
|
|
public static void Get_V_TB_ASK_ASN_View_List_Directly(V_TB_INCOMPLETE_ASK p_entity, Action<ResultObject<IQueryable<V_TB_INCOMPLETE_ASK>>> p_action) |
|
|
|
{ |
|
|
|
ResultObject<IQueryable<V_TB_INCOMPLETE_ASK>> _ret = new ResultObject<IQueryable<V_TB_INCOMPLETE_ASK>>(); |
|
|
|
try |
|
|
|
{ |
|
|
|
using (ScpEntities db = EntitiesFactory.CreateScpInstance()) |
|
|
|
{ |
|
|
|
|
|
|
|
IQueryable<V_TB_INCOMPLETE_ASK> q = db.V_TB_INCOMPLETE_ASK; |
|
|
|
if (!string.IsNullOrEmpty(p_entity.PoBillNum)) |
|
|
|
{ |
|
|
|
q = q.Where(p => p.PoBillNum == p_entity.PoBillNum); |
|
|
|
} |
|
|
|
if (!string.IsNullOrEmpty(p_entity.AskBillNum)) |
|
|
|
{ |
|
|
|
q = q.Where(p => p.AskBillNum == p_entity.AskBillNum); |
|
|
|
} |
|
|
|
if (!string.IsNullOrEmpty(p_entity.PartCode)) |
|
|
|
{ |
|
|
|
q = q.Where(p => p.PartCode.Contains(p_entity.PartCode)); |
|
|
|
} |
|
|
|
if (!string.IsNullOrEmpty(p_entity.PartDesc1)) |
|
|
|
{ |
|
|
|
q = q.Where(p => p.PartDesc1.Contains(p_entity.PartDesc1)); |
|
|
|
} |
|
|
|
if (p_entity.BeginTimeStart != null) |
|
|
|
{ |
|
|
|
q = q.Where(p => p.BeginTime >= p_entity.BeginTimeStart); |
|
|
|
} |
|
|
|
if (p_entity.BeginTimeEnd != null) |
|
|
|
{ |
|
|
|
q = q.Where(p => p.BeginTime <= p_entity.BeginTimeEnd); |
|
|
|
} |
|
|
|
if (p_entity.EndTimeStart != null) |
|
|
|
{ |
|
|
|
q = q.Where(p => p.EndTime >= p_entity.EndTimeStart); |
|
|
|
} |
|
|
|
if (p_entity.EndTimeEnd != null) |
|
|
|
{ |
|
|
|
q = q.Where(p => p.EndTime <= p_entity.EndTimeEnd); |
|
|
|
} |
|
|
|
if (p_entity.Buyer != null) |
|
|
|
{ |
|
|
|
q = q.Where(p => p.Buyer == p_entity.Buyer); |
|
|
|
} |
|
|
|
if (p_entity.CreateUser != null) |
|
|
|
{ |
|
|
|
q = q.Where(p => p.CreateUser == p_entity.CreateUser); |
|
|
|
} |
|
|
|
if (p_entity.EndTime != null) |
|
|
|
{ |
|
|
|
q = q.Where(p => p.EndTime < p_entity.EndTime); |
|
|
|
} |
|
|
|
if (!string.IsNullOrEmpty(p_entity.Site)) |
|
|
|
{ |
|
|
|
q = q.Where(P => P.Site == p_entity.Site); |
|
|
|
} |
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(p_entity.SubSite) ) |
|
|
|
{ |
|
|
|
q = q.Where(p => p_entity.SubSite == p.SubSite); |
|
|
|
} |
|
|
|
if (!string.IsNullOrEmpty(p_entity.VendId)) |
|
|
|
{ |
|
|
|
q = q.Where(p => p.VendId == p_entity.VendId); |
|
|
|
} |
|
|
|
if (p_entity.SendState == 1) |
|
|
|
{ |
|
|
|
q = q.Where(p => p.AskQty != p.ReduceQty + p.Qty); |
|
|
|
} |
|
|
|
if (p_entity.SendState == 2) |
|
|
|
{ |
|
|
|
q = q.Where(p => p.AskQty == p.ReduceQty + p.Qty); |
|
|
|
} |
|
|
|
q = q.Where(p => p.IsDeleted == p_entity.IsDeleted); |
|
|
|
_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_ASK_CONTROLLER), "Get_V_TB_ASK_ASN_View_List_Directly", sb.ToString()); |
|
|
|
if (dbEx.InnerException != null) |
|
|
|
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASN_CONTROLLER), "Get_V_TB_ASK_ASN_View_List_Directly(DbEntityValidationException)", LogHelper.GetExceptionMessage(dbEx).Message); |
|
|
|
|
|
|
|
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_ASK_CONTROLLER), "Get_V_TB_ASK_ASN_View_List_Directly", ex.ToString()); |
|
|
|
if (ex.InnerException != null) |
|
|
|
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASN_CONTROLLER), "Get_V_TB_ASK_ASN_View_List_Directly(OptimisticConcurrencyException)", LogHelper.GetExceptionMessage(ex).Message); |
|
|
|
|
|
|
|
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_ASK_CONTROLLER), "Get_V_TB_ASK_ASN_View_List_Directly", ex.ToString()); |
|
|
|
if (ex.InnerException != null) |
|
|
|
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASN_CONTROLLER), "Get_V_TB_ASK_ASN_View_List_Directly(ScpException)", LogHelper.GetExceptionMessage(ex).Message); |
|
|
|
|
|
|
|
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_ASK_CONTROLLER), "Get_V_TB_ASK_ASN_View_List_Directly", e.Message); |
|
|
|
if (e.InnerException != null) |
|
|
|
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASN_CONTROLLER), "Get_V_TB_ASK_ASN_View_List_Directly(ScpException)", LogHelper.GetExceptionMessage(e).Message); |
|
|
|
|
|
|
|
throw e; |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|