diff --git a/北京北汽/Controller/SCP_ASK_CONTROLLER.cs b/北京北汽/Controller/SCP_ASK_CONTROLLER.cs index 6f203a6..a89106c 100644 --- a/北京北汽/Controller/SCP_ASK_CONTROLLER.cs +++ b/北京北汽/Controller/SCP_ASK_CONTROLLER.cs @@ -3687,5 +3687,158 @@ namespace CK.SCP.Controller return list; } + + + /// + /// 供应商要货未完成查询 + /// + /// + /// + public static void Get_V_TB_ASK_ASN_View_List_Directly(V_TB_INCOMPLETE_ASK p_entity, Action>> p_action) + { + ResultObject> _ret = new ResultObject>(); + try + { + using (ScpEntities db = EntitiesFactory.CreateScpInstance()) + { + + IQueryable 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; + } + + } + + } } diff --git a/北京北汽/Controller/SCP_INVOICE_CONTROLLER.cs b/北京北汽/Controller/SCP_INVOICE_CONTROLLER.cs index f3a5a75..98f5b27 100644 --- a/北京北汽/Controller/SCP_INVOICE_CONTROLLER.cs +++ b/北京北汽/Controller/SCP_INVOICE_CONTROLLER.cs @@ -230,6 +230,10 @@ namespace CK.SCP.Controller { q = q.Where(p => p_entity.BillStateList.Contains(p.State)); } + if (!string.IsNullOrEmpty( p_entity.Site)) + { + q = q.Where(p => p.Site == p_entity.Site); + } else if (p_entity.State != 0) { q = q.Where(p => p.State == p_entity.State); @@ -279,6 +283,10 @@ namespace CK.SCP.Controller { q = q.Where(p => p.StartTime == p_entity.StartTime); } + if (!string.IsNullOrEmpty(p_entity.SubSite)) + { + q = q.Where(p => p.SubSite == p_entity.SubSite); + } // q = q.Where(p => p_entity.IsRed == p.IsRed); _ret.State = ReturnStatus.Succeed; diff --git a/北京北汽/Controller/SCP_PO_CONTROLLER.cs b/北京北汽/Controller/SCP_PO_CONTROLLER.cs index 3d3e1f1..094c31b 100644 --- a/北京北汽/Controller/SCP_PO_CONTROLLER.cs +++ b/北京北汽/Controller/SCP_PO_CONTROLLER.cs @@ -13,6 +13,8 @@ using System.Data.Entity.Core; using CK.SCP.Models.ScpEntity.ExcelExportEnttity; using System.Text.RegularExpressions; using System.Data.SqlClient; +using System.Security.Policy; +using System.ComponentModel; namespace CK.SCP.Controller { @@ -1389,7 +1391,7 @@ namespace CK.SCP.Controller ErrorList.Add(string.Format("订单编号【{0}】零件号【{1}】行号【{2}】已经存在", p_excel.订单编号, p_excel.零件号, p_excel.行号)); } var checkcount = db.TB_PRICE.Where(p => p.PartCode == p_excel.零件号.Trim() && p.Site == site && p.SubSite == subsite && p.State != (int)PriceState.Reject && p.VendId == p_excel.供应商编号 && p.StartTime <= DateTime.Now && DateTime.Now <= p.EndTime).ToList(); - if (checkcount.Count == 0) + if (checkcount.Count() == 0) { ErrorList.Add(string.Format("零件名称【{0}】供应编码【{1}】价格表没有维护信息!", p_excel.零件号, p_excel.供应商编号)); } @@ -1545,7 +1547,7 @@ namespace CK.SCP.Controller } } var checkcount = db.TB_PRICE.Where(p => p.PartCode == p_excel.零件号.Trim() && p.Site == site && p.SubSite == subsite && p.State == (int)PriceState.FConfirm && p.VendId == p_excel.供应商编号 && p.StartTime <= DateTime.Now && DateTime.Now <= p.EndTime).ToList(); - if (checkcount.Count == 0) + if (checkcount.Count() == 0) { ErrorList.Add(string.Format("零件名称【{0}】供应编码【{1}】价格表没有维护信息!", p_excel.零件号, p_excel.供应商编号)); } @@ -2279,7 +2281,7 @@ namespace CK.SCP.Controller _t_ASK_Detail.PoUnit = itm.单位; _t_ASK_Detail.CreateTime = DateTime.Now; _t_ASK_Detail.CreateUser = _ask.CreateUser; - _t_ASK_Detail.PartCode = itm.零件编码; + _t_ASK_Detail.PartCode = itm.零件编码.Trim(); _t_ASK_Detail.BeginTime = DateTime.Parse(itm.订货日期); _t_ASK_Detail.EndTime = DateTime.Parse(itm.到货日期); _t_ASK_Detail.TempQty = decimal.Parse(itm.订单数); @@ -5459,5 +5461,25 @@ namespace CK.SCP.Controller } return p_list; } + + + public static List GetPriceError(List details,V_TB_PO po) + { + List errorlist = new List(); + using (ScpEntities db = EntitiesFactory.CreateScpInstance()) + { + foreach (var item in details) + { + var checkcount = db.TB_PRICE.Where(p => p.PartCode == item.PartCode && p.Site == item.Site && p.SubSite == po.SubSite && p.State == (int)PriceState.FConfirm && p.VendId == po.VendId && p.StartTime <= DateTime.Now && DateTime.Now <= p.EndTime).ToList(); + if (checkcount.Count == 0) + { + errorlist.Add(string.Format("零件编号【{0}】供应编码【{1}】价格表没有维护信息!", item.PartCode.Trim(), po.VendId)); + } + } + + } + + return errorlist; + } } } diff --git a/北京北汽/SCP/Views/BasicData/Price.aspx.cs b/北京北汽/SCP/Views/BasicData/Price.aspx.cs index b3f6bb7..4d23724 100644 --- a/北京北汽/SCP/Views/BasicData/Price.aspx.cs +++ b/北京北汽/SCP/Views/BasicData/Price.aspx.cs @@ -190,10 +190,6 @@ namespace SCP.BasicData { _entity.State = int.Parse(DDL_State.SelectedValue); } - if (!string.IsNullOrEmpty(textCreator.Text)) - { - _entity.Creator = textCreator.Text; - } if (!string.IsNullOrEmpty(NB_Amt.Text)) { _entity.Amt = decimal.Parse(NB_Amt.Text); diff --git a/北京北汽/SCP/Views/PlanData/SCP_ASN_DETAIL_View.aspx.cs b/北京北汽/SCP/Views/PlanData/SCP_ASN_DETAIL_View.aspx.cs index 6c3d68e..363a9d7 100644 --- a/北京北汽/SCP/Views/PlanData/SCP_ASN_DETAIL_View.aspx.cs +++ b/北京北汽/SCP/Views/PlanData/SCP_ASN_DETAIL_View.aspx.cs @@ -123,7 +123,8 @@ namespace SCP.PlanData SearchV_TB_ASN_DETAILData((ret) => { Dictionary cellheader = new Dictionary(){ - {"PoBillNum" , "发货单号" }, + {"PoBillNum" , "订单单号" }, + {"AskBillNum" , "要货看板号" }, {"AsnBillNum" , "发货单号" }, { "PackQty" , "标包数量" }, { "Qty" , "发货数量" }, diff --git a/北京北汽/SCP/Views/PlanData/SCP_INCOMPLETE_ASK.aspx.cs b/北京北汽/SCP/Views/PlanData/SCP_INCOMPLETE_ASK.aspx.cs index 81a3813..424e4b9 100644 --- a/北京北汽/SCP/Views/PlanData/SCP_INCOMPLETE_ASK.aspx.cs +++ b/北京北汽/SCP/Views/PlanData/SCP_INCOMPLETE_ASK.aspx.cs @@ -119,16 +119,20 @@ namespace SCP.PlanData _entity.SendState = int.Parse(rb_SendState.SelectedValue); _entity.DayState = int.Parse(ddl_DayState.SelectedValue); _entity.IsDeleted = false; - _entity.UserInAddress = CurrentUser.FactoryList; - _entity.UserInVendIds = CurrentUser.VenderList; - _entity.UserInSubSite = CurrentUser.SubSiteList; + _entity.Site = CurrentUser.UsedDomain; + if (CurrentUser.VenderList.Count > 0) + { + _entity.VendId = CurrentUser.VenderList.FirstOrDefault(); + } + + _entity.SubSite = CurrentUser.UserdSite; if (CurrentUser.RoleList.Contains("供应商") && CurrentUser.VenderList.Count==0) { return; } - SCP_ASK_CONTROLLER.Get_V_TB_ASK_ASN_View_List(_entity, (_ret) => + SCP_ASK_CONTROLLER.Get_V_TB_ASK_ASN_View_List_Directly(_entity, (_ret) => { if (_ret.State == ReturnStatus.Succeed) { @@ -147,37 +151,37 @@ namespace SCP.PlanData } protected void btnOutput_Click(object sender , EventArgs e) { - var _ls = new V_TB_INCOMPLETE_ASK(); - _ls.PoBillNum = TextBillNo.Text; + V_TB_INCOMPLETE_ASK _entity = new V_TB_INCOMPLETE_ASK(); + _entity.PoBillNum = TextBillNo.Text; if (TextBillTime1.SelectedDate != null) { - _ls.BeginTimeStart = (DateTime)TextBillTime1.SelectedDate; + _entity.BeginTimeStart = (DateTime)TextBillTime1.SelectedDate; } if (TextBillTime2.SelectedDate != null) { - _ls.BeginTimeEnd = (DateTime)TextBillTime2.SelectedDate; + _entity.BeginTimeEnd = (DateTime)TextBillTime2.SelectedDate; } if (dp_EndTimeStart.SelectedDate != null) { - _ls.EndTimeStart = (DateTime)dp_EndTimeStart.SelectedDate; + _entity.EndTimeStart = (DateTime)dp_EndTimeStart.SelectedDate; } if (dp_EndTimeEnd.SelectedDate != null) { - _ls.EndTimeEnd = (DateTime)dp_EndTimeEnd.SelectedDate; + _entity.EndTimeEnd = (DateTime)dp_EndTimeEnd.SelectedDate; } if (TextBoxAskNo.Text != null) { - _ls.AskBillNum = TextBoxAskNo.Text; + _entity.AskBillNum = TextBoxAskNo.Text; } if (TextPartCode.Text != null) { - _ls.PartCode = TextPartCode.Text; + _entity.PartCode = TextPartCode.Text; } if (TextPartName.Text != null) { - _ls.PartDesc1 = TextPartName.Text; + _entity.PartDesc1 = TextPartName.Text; } if (!string.IsNullOrEmpty(CurrentUser.Name)) { @@ -198,25 +202,29 @@ namespace SCP.PlanData btn_planner.Hidden = false; if (!string.IsNullOrEmpty(this.txt_Planner.Text)) { - _ls.Buyer = txt_Planner.Text; + _entity.Buyer = txt_Planner.Text; } } //} } //} - _ls.SendState = int.Parse(rb_SendState.SelectedValue); - _ls.DayState = int.Parse(ddl_DayState.SelectedValue); - _ls.IsDeleted = false; - _ls.UserInAddress = CurrentUser.FactoryList; - _ls.UserInVendIds = CurrentUser.VenderList; - _ls.UserInSubSite = CurrentUser.SubSiteList; + _entity.SendState = int.Parse(rb_SendState.SelectedValue); + _entity.DayState = int.Parse(ddl_DayState.SelectedValue); + _entity.IsDeleted = false; + _entity.Site = CurrentUser.UsedDomain; + if (CurrentUser.VenderList.Count > 0) + { + _entity.VendId = CurrentUser.VenderList.FirstOrDefault(); + } + + _entity.SubSite = CurrentUser.UserdSite; if (CurrentUser.RoleList.Contains("供应商") && CurrentUser.VenderList.Count == 0) { return; } //_ls.DayState = int.Parse(ddl_DayState.SelectedValue); - SCP_ASK_CONTROLLER.Get_V_TB_ASK_ASN_View_List(_ls, (ret) => + SCP_ASK_CONTROLLER.Get_V_TB_ASK_ASN_View_List_Directly(_entity, (ret) => { if (ret.State == ReturnStatus.Succeed) { diff --git a/北京北汽/SCP/Views/PlanData/SCP_PO_CREATE_ASK.aspx.cs b/北京北汽/SCP/Views/PlanData/SCP_PO_CREATE_ASK.aspx.cs index 8f5bca3..885b2a4 100644 --- a/北京北汽/SCP/Views/PlanData/SCP_PO_CREATE_ASK.aspx.cs +++ b/北京北汽/SCP/Views/PlanData/SCP_PO_CREATE_ASK.aspx.cs @@ -465,7 +465,13 @@ namespace SCP.PlanData Ssite = DDL_Site.SelectedValue; } string Stremark = txtRemark.Text; - + // 判断 价格是否是财务审核状态 + var errorlist = SCP_PO_CONTROLLER.GetPriceError(qadOrderList, qadOrder); + if (errorlist.Count()>0) + { + Alert.Show(string.Join("
", errorlist.ToArray())); + return; + } var ret = SCP_PO_CONTROLLER.Save_PO_TO_ASK_CQ(qadOrder, qadOrderList, CurrentUser.ChineseName, str, CurrentUser.Name, Stremark, Ssite); if (ret.Result == true) { diff --git a/北京北汽/SCP/Views/SupplierData/SCP_INVOICE.aspx.cs b/北京北汽/SCP/Views/SupplierData/SCP_INVOICE.aspx.cs index d08a875..c817559 100644 --- a/北京北汽/SCP/Views/SupplierData/SCP_INVOICE.aspx.cs +++ b/北京北汽/SCP/Views/SupplierData/SCP_INVOICE.aspx.cs @@ -81,6 +81,10 @@ namespace SCP.Views.SupplierData { _entity.Site = CurrentUser.FactoryList[0]; } + if (!string.IsNullOrEmpty( CurrentUser.UserdSite)) + { + _entity.SubSite = CurrentUser.UserdSite; + } _entity.InvoiceList = SCP_INVOICE_CONTROLLER.Get_V_TB_INVOICE_BY_TIME(DP_CreateTime1.Text, DP_CreateTime2.Text,TXT_PO.Text,TXT_ASN.Text); if (string.IsNullOrEmpty(_entity.VendId)) {