diff --git a/北京北汽/Controller/SCP_DC_UNI_CONTROLLER.cs b/北京北汽/Controller/SCP_DC_UNI_CONTROLLER.cs index 0402dfe..cd8792b 100644 --- a/北京北汽/Controller/SCP_DC_UNI_CONTROLLER.cs +++ b/北京北汽/Controller/SCP_DC_UNI_CONTROLLER.cs @@ -647,8 +647,8 @@ namespace CK.SCP.Controller { ScpEntities scpdb = EntitiesFactory.CreateScpInstance(); ExchangeCenterContext db = EntitiesFactory.CreateExchangeCenterInstance(); - var _list = scpdb.TS_UNI_API.Where(p => p.State == (int)DataState.Enabled && p.Domain == "ZZBMPT").OrderBy(p => p.UID).ToList(); - var _list1 = scpdb.TS_UNI_API.Where(p => p.State == (int)DataState.Enabled && p.Domain == "ZZBMPT" && p.InterfaceType == "Price").OrderBy(p => p.UID).ToList(); + var _list = scpdb.TS_UNI_API.Where(p => p.State == (int)DataState.Enabled && p.Domain == "CQBMPT").OrderBy(p => p.UID).ToList(); + var _list1 = scpdb.TS_UNI_API.Where(p => p.State == (int)DataState.Enabled && p.Domain == "CQBMPT" && p.InterfaceType == "Price").OrderBy(p => p.UID).ToList(); var apiii = _list1.Count(); if (apiii > 0) diff --git a/北京北汽/Controller/SCP_INVOICE_CONTROLLER.cs b/北京北汽/Controller/SCP_INVOICE_CONTROLLER.cs index cba7ac0..eafe852 100644 --- a/北京北汽/Controller/SCP_INVOICE_CONTROLLER.cs +++ b/北京北汽/Controller/SCP_INVOICE_CONTROLLER.cs @@ -560,6 +560,161 @@ namespace CK.SCP.Controller } + /// + /// 通过 InvcBillNum 查询 + /// + /// + /// + public static void Get_V_TB_INVOICE_List_BYInvcBillNum(V_TB_INVOICE p_entity, Action>> p_action) + { + ResultObject> _ret = new ResultObject>(); + try + { + using (ScpEntities db = EntitiesFactory.CreateScpInstance()) + { + IQueryable q = db.V_TB_INVOICE; + if (p_entity.UID != 0) + { + q = q.Where(p => p.UID == p_entity.UID); + } + if (!string.IsNullOrEmpty(p_entity.InvcBillNum)) + { + q = q.Where(p => p.InvcBillNum ==p_entity.InvcBillNum); + } + if (!string.IsNullOrEmpty(p_entity.VendId)) + { + q = q.Where(p => p.VendId.Contains(p_entity.VendId)); + } + if (!string.IsNullOrEmpty(p_entity.VendName)) + { + q = q.Where(p => p.VendName.Contains(p_entity.VendName)); + } + + if (!string.IsNullOrEmpty(p_entity.InvoiceNum)) + { + q = q.Where(p => p.InvoiceNum.Contains(p_entity.InvoiceNum)); + } + if (p_entity.BillStateList != null && p_entity.BillStateList.Count > 0) + { + 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); + } + if (!string.IsNullOrEmpty(p_entity.Remark)) + { + q = q.Where(p => p.Remark.Contains(p_entity.Remark)); + } + if (p_entity.Tax != null) + { + q = q.Where(p => p.Tax == p_entity.Tax); + } + if (p_entity.TaxAmount != null) + { + q = q.Where(p => p.TaxAmount == p_entity.TaxAmount); + } + if (p_entity.Amount != null) + { + q = q.Where(p => p.Amount == p_entity.Amount); + } + if (p_entity.Total != null) + { + q = q.Where(p => p.Total == p_entity.Total); + } + if (!string.IsNullOrEmpty(p_entity.ExpressNum)) + { + q = q.Where(p => p.ExpressNum.Contains(p_entity.ExpressNum)); + } + if (p_entity.UserInAddress != null && p_entity.UserInAddress.Count > 0) + { + q = q.Where(p => p_entity.UserInAddress.Contains(p.Site)); + } + + if (!string.IsNullOrEmpty(p_entity.CreateUser)) + { + q = q.Where(p => p.CreateUser.Contains(p_entity.CreateUser)); + } + if (p_entity.InvoiceList != null && p_entity.InvoiceList.Count > 0) + { + q = q.Where(p => p_entity.InvoiceList.Contains(p.InvcBillNum)); + } + if (p_entity.EndTimeb != null) + { + q = q.Where(p => p.EndTimeb == p_entity.EndTimeb); + } + if (p_entity.StartTime != null) + { + 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; + _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_INVOICE_CONTROLLER), "Get_V_TB_INVOICE_List_BYInvcBillNum", 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_INVOICE_CONTROLLER), "Get_V_TB_INVOICE_List_BYInvcBillNum", 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_INVOICE_CONTROLLER), "Get_V_TB_INVOICE_List_BYInvcBillNum", 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_INVOICE_CONTROLLER), "Get_V_TB_INVOICE_List_BYInvcBillNum", e.Message); + } + + } public static void Get_V_TB_INVOICE_List(List p_ls, Action>> p_action) { @@ -1004,6 +1159,171 @@ namespace CK.SCP.Controller } + /// + /// 通过InvcBillNum查询明细 + /// + /// + /// + public static void Get_V_TB_INVOICE_DETAIL_List_BYInvcBillNum(V_TB_INVOICE_DETAIL p_entity, Action>> p_action) + { + ResultObject> _ret = new ResultObject>(); + try + { + using (ScpEntities db = EntitiesFactory.CreateScpInstance()) + { + IQueryable q = db.V_TB_INVOICE_DETAIL; + if (p_entity.UID != 0) + { + q = q.Where(p => p.UID == p_entity.UID); + } + if (!string.IsNullOrEmpty(p_entity.InvcBillNum)) + { + q = q.Where(p => p.InvcBillNum ==p_entity.InvcBillNum); + } + if (!string.IsNullOrEmpty(p_entity.PoBillNum)) + { + q = q.Where(p => p.PoBillNum.Contains(p_entity.PoBillNum)); + } + if (p_entity.PoLineNum != 0) + { + q = q.Where(p => p.PoLineNum == p_entity.PoLineNum); + } + if (!string.IsNullOrEmpty(p_entity.AsnBillNum)) + { + q = q.Where(p => p.AsnBillNum.Contains(p_entity.AsnBillNum)); + } + 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 (!string.IsNullOrEmpty(p_entity.VendBatch)) + { + q = q.Where(p => p.VendBatch.Contains(p_entity.VendBatch)); + } + if (p_entity.Qty != 0) + { + q = q.Where(p => p.Qty == p_entity.Qty); + } + if (!string.IsNullOrEmpty(p_entity.PoUnit)) + { + q = q.Where(p => p.PoUnit.Contains(p_entity.PoUnit)); + } + if (p_entity.Price != 0) + { + q = q.Where(p => p.Price == p_entity.Price); + } + if (!string.IsNullOrEmpty(p_entity.Currency)) + { + q = q.Where(p => p.Currency.Contains(p_entity.Currency)); + } + if (p_entity.PackQty != null) + { + q = q.Where(p => p.PackQty == p_entity.PackQty); + } + if (p_entity.State != null) + { + q = q.Where(p => p.State == p_entity.State); + } + if (!string.IsNullOrEmpty(p_entity.InvoiceNum)) + { + q = q.Where(p => p.InvoiceNum.Contains(p_entity.InvoiceNum)); + } + if (!string.IsNullOrEmpty(p_entity.ExpressNum)) + { + q = q.Where(p => p.ExpressNum.Contains(p_entity.ExpressNum)); + } + if (!string.IsNullOrEmpty(p_entity.VendId)) + { + q = q.Where(p => p.VendId.Contains(p_entity.VendId)); + } + if (!string.IsNullOrEmpty(p_entity.CurrencyDesc)) + { + q = q.Where(p => p.CurrencyDesc.Contains(p_entity.CurrencyDesc)); + } + if (!string.IsNullOrEmpty(p_entity.Site)) + { + q = q.Where(p => p.Site.Contains(p_entity.Site)); + } + if (p_entity.Tax != null) + { + q = q.Where(p => p.Tax == p_entity.Tax); + } + if (!string.IsNullOrEmpty(p_entity.RecvBillNum)) + { + q = q.Where(p => p.RecvBillNum.Contains(p_entity.RecvBillNum)); + } + if (!string.IsNullOrEmpty(p_entity.PartDesc1)) + { + q = q.Where(p => p.PartDesc1.Contains(p_entity.PartDesc1)); + } + if (!string.IsNullOrEmpty(p_entity.CreateUser)) + { + q = q.Where(p => p.CreateUser.Contains(p_entity.CreateUser)); + } + q = q.Where(p => p.IsRed == p_entity.IsRed); + + _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_INVOICE_CONTROLLER), "Get_V_TB_INVOICE_DETAIL_List_BYInvcBillNum", 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_INVOICE_CONTROLLER), "Get_V_TB_INVOICE_DETAIL_List_BYInvcBillNum", 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_INVOICE_CONTROLLER), "Get_V_TB_INVOICE_DETAIL_List_BYInvcBillNum", 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_INVOICE_CONTROLLER), "Get_V_TB_INVOICE_DETAIL_List_BYInvcBillNum", e.Message); + } + + } public static void Get_V_TB_INVOICE_DETAIL_List(List p_list, Action>> p_action) { diff --git a/北京北汽/Models/ExchangeCenterTables/TED_INVOICE_MSTR.cs b/北京北汽/Models/ExchangeCenterTables/TED_INVOICE_MSTR.cs index d64c269..1f8d669 100644 --- a/北京北汽/Models/ExchangeCenterTables/TED_INVOICE_MSTR.cs +++ b/北京北汽/Models/ExchangeCenterTables/TED_INVOICE_MSTR.cs @@ -29,7 +29,7 @@ namespace CK.SCP.Models.ExchangeCenterTables public int Invoice_ID { get; set; } [Description("Ʊ")] - [StringLength(50)] + [StringLength(255)] public string InvoiceReference { get; set; } [Description("ɹ")] diff --git a/北京北汽/Models/ScpEntity/TB_INVOICE.cs b/北京北汽/Models/ScpEntity/TB_INVOICE.cs index 552d255..53291cd 100644 --- a/北京北汽/Models/ScpEntity/TB_INVOICE.cs +++ b/北京北汽/Models/ScpEntity/TB_INVOICE.cs @@ -15,7 +15,7 @@ namespace CK.SCP.Models.ScpEntity public string InvcBillNum { get; set; } [StringLength(50)] public string Site { get; set; } - [StringLength(50)] + [StringLength(255)] public string InvoiceNum { get; set; } [StringLength(50)] public string ExpressNum { get; set; } diff --git a/北京北汽/SCP/Views/SupplierData/SCP_INVOICE_EDIT.aspx b/北京北汽/SCP/Views/SupplierData/SCP_INVOICE_EDIT.aspx index ba4d7fa..af56832 100644 --- a/北京北汽/SCP/Views/SupplierData/SCP_INVOICE_EDIT.aspx +++ b/北京北汽/SCP/Views/SupplierData/SCP_INVOICE_EDIT.aspx @@ -77,7 +77,7 @@ - + diff --git a/北京北汽/SCP/Views/SupplierData/SCP_INVOICE_EDIT.aspx.cs b/北京北汽/SCP/Views/SupplierData/SCP_INVOICE_EDIT.aspx.cs index f2ca8f9..2bbba14 100644 --- a/北京北汽/SCP/Views/SupplierData/SCP_INVOICE_EDIT.aspx.cs +++ b/北京北汽/SCP/Views/SupplierData/SCP_INVOICE_EDIT.aspx.cs @@ -525,9 +525,9 @@ namespace SCP.Views.SupplierData if (p_state == InvoiceState.Mail) { - if (InvoiceNumber.Length > 22) + if (InvoiceNumber.Length > 255) { - Alert.Show(GetResourceKey("金税票号最多22位!")); + Alert.Show(GetResourceKey("金税票号最多255位!")); return; } if (string.IsNullOrEmpty(InvoiceNumber)) diff --git a/北京北汽/SCP/Views/WarehouseData/SCP_INVOICE_CONFIRM_DETAIL.aspx.cs b/北京北汽/SCP/Views/WarehouseData/SCP_INVOICE_CONFIRM_DETAIL.aspx.cs index 115ffe7..d08c5e7 100644 --- a/北京北汽/SCP/Views/WarehouseData/SCP_INVOICE_CONFIRM_DETAIL.aspx.cs +++ b/北京北汽/SCP/Views/WarehouseData/SCP_INVOICE_CONFIRM_DETAIL.aspx.cs @@ -48,12 +48,12 @@ namespace SCP.WarehouseData { string id = GetQueryValue("ID"); - SCP_INVOICE_CONTROLLER.Get_V_TB_INVOICE_List(new V_TB_INVOICE { InvcBillNum = id }, (ret) => + SCP_INVOICE_CONTROLLER.Get_V_TB_INVOICE_List_BYInvcBillNum(new V_TB_INVOICE { InvcBillNum = id }, (ret) => { if (ret.State == ReturnStatus.Succeed) { - var _ls = ret.Result.ToList(); + var _ls = ret.Result.Take(1).ToList(); if (_ls != null && _ls.Count > 0) { var _Model = _ls[0]; @@ -99,7 +99,7 @@ namespace SCP.WarehouseData string id = GetQueryValue("ID"); V_TB_INVOICE_DETAIL _tb = new V_TB_INVOICE_DETAIL(); _tb.InvcBillNum = id; - SCP_INVOICE_CONTROLLER.Get_V_TB_INVOICE_DETAIL_List(_tb, (ret) => + SCP_INVOICE_CONTROLLER.Get_V_TB_INVOICE_DETAIL_List_BYInvcBillNum(_tb, (ret) => { if (ret.State == ReturnStatus.Succeed) @@ -115,7 +115,7 @@ namespace SCP.WarehouseData Search(ret => { Grid1.RecordCount = ret.Count(); - var list = SortAndPage(ret, Grid1); + var list = SortAndPage(ret, Grid1).ToList(); foreach (V_TB_INVOICE_DETAIL rec in list) { diff --git a/北京北汽/UniApiWpf/MainWindow.xaml.cs b/北京北汽/UniApiWpf/MainWindow.xaml.cs index ee3daca..1d1b844 100644 --- a/北京北汽/UniApiWpf/MainWindow.xaml.cs +++ b/北京北汽/UniApiWpf/MainWindow.xaml.cs @@ -176,7 +176,7 @@ namespace UniApiWpf { TimeSpan nowDt = DateTime.Now.TimeOfDay; TimeSpan workstartDT = DateTime.Parse("1:00").TimeOfDay; - TimeSpan workendDT = DateTime.Parse("2:00").TimeOfDay; + TimeSpan workendDT = DateTime.Parse("3:00").TimeOfDay; if (nowDt < workstartDT || nowDt > workendDT) { SCP_DC_UNI_CONTROLLER.WriteService((rs) => @@ -205,7 +205,7 @@ namespace UniApiWpf { TimeSpan nowDt = DateTime.Now.TimeOfDay; TimeSpan workstartDT = DateTime.Parse("1:00").TimeOfDay; - TimeSpan workendDT = DateTime.Parse("2:00").TimeOfDay; + TimeSpan workendDT = DateTime.Parse("3:00").TimeOfDay; if (nowDt < workstartDT || nowDt > workendDT) { #region