diff --git a/Controller/SCP_ASK_CONTROLLER.cs b/Controller/SCP_ASK_CONTROLLER.cs index 2fbf00a..8b34cda 100644 --- a/Controller/SCP_ASK_CONTROLLER.cs +++ b/Controller/SCP_ASK_CONTROLLER.cs @@ -805,7 +805,7 @@ namespace CK.SCP.Controller throw e; } return _ret; - } + } public static ResultObject Save_TB_ASK_DETAIL(List p_entitys, AskState p_state) { ResultObject _ret = new ResultObject(); @@ -920,12 +920,87 @@ namespace CK.SCP.Controller } return _ret; } - /// - /// - /// - /// - /// - public static ResultObject Save_TB_PO(List p_entitys) + public static ResultObject Update_TB_ASK(TB_ASK p_entitys) + { + ResultObject _ret = new ResultObject(); + try + { + using (ScpEntities db = EntitiesFactory.CreateScpInstance()) + { + + var ret= db.TB_ASK.Where(p => p.AskBillNum == p_entitys.AskBillNum).FirstOrDefault(); + ret.Extend1 = p_entitys.Extend1; + + db.TB_ASK.AddOrUpdate(ret); + if (db.SaveChanges() != -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_TB_ASK_DETAIL", 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_TB_ASK_DETAIL", 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_TB_ASK_DETAIL", 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_TB_ASK_DETAIL", e.Message); + _ret.Result = false; + _ret.ErrorList.Add(e); + throw e; + } + return _ret; + } + + /// + /// + /// + /// + /// + public static ResultObject Save_TB_PO(List p_entitys) { ResultObject _ret = new ResultObject(); try @@ -1558,7 +1633,7 @@ namespace CK.SCP.Controller } } - + public static void Get_V_TB_ASK_DETAIL_Sum(V_TB_ASK_DETAIL p_entity, Action>> p_action) { @@ -1807,7 +1882,7 @@ namespace CK.SCP.Controller try { using (ScpEntities db = EntitiesFactory.CreateScpInstance()) - { + { if (p_state == AskState.Close) { var _ls = db.TB_ASK.Where(p => p_list.Contains(p.AskBillNum)).ToList(); @@ -1877,19 +1952,19 @@ namespace CK.SCP.Controller if (p_state == AskState.Confirm) { var _ls = db.TB_ASK.Where(p => p_list.Contains(p.AskBillNum)).ToList(); - int count = _ls.Count(p => p.State == (int)AskState.Release); + int count = _ls.Count(p => p.State == (int)AskState.Release); if (count == _ls.Count && _ls.Count > 0) { _ls.ForEach(p => { - p.State = (int)AskState.Confirm; + p.State = (int)AskState.Confirm; var _list = db.TB_ASK_DETAIL.Where(itm => itm.AskBillNum == p.AskBillNum).ToList(); _list.ForEach(itm => { itm.State = (int)AskState.Confirm; - itm.UpdateTime = DateTime.Now; + itm.UpdateTime = DateTime.Now; } ); @@ -1945,7 +2020,7 @@ namespace CK.SCP.Controller { _ls.ForEach(p => { - p.State = (int)AskState.Release; + p.State = (int)AskState.Release; var _list = db.TB_ASK_DETAIL.Where(itm => itm.AskBillNum == p.AskBillNum).ToList(); _list.ForEach(itm => { @@ -2089,7 +2164,7 @@ namespace CK.SCP.Controller _ret.Message = "选择的记录,有不是新建或发布状态记录!"; } - } + } if (p_state == AskState.NoConfirm) { var _ls = db.TB_ASN.Where(p => p_list.Contains(p.AskBillNum) && p.IsDeleted == false).ToList(); diff --git a/SCP/Views/PlanData/SCP_PO_CREATE_ASK.aspx b/SCP/Views/PlanData/SCP_PO_CREATE_ASK.aspx index a719f5d..b8aca09 100644 --- a/SCP/Views/PlanData/SCP_PO_CREATE_ASK.aspx +++ b/SCP/Views/PlanData/SCP_PO_CREATE_ASK.aspx @@ -60,7 +60,7 @@ <%-- --%> - + diff --git a/SCP/Views/PlanData/SCP_PO_CREATE_ASK.aspx.cs b/SCP/Views/PlanData/SCP_PO_CREATE_ASK.aspx.cs index 1db3211..c504439 100644 --- a/SCP/Views/PlanData/SCP_PO_CREATE_ASK.aspx.cs +++ b/SCP/Views/PlanData/SCP_PO_CREATE_ASK.aspx.cs @@ -72,9 +72,8 @@ namespace SCP.PlanData this.TXT_Site.Text = _result.Site_Desc; this.TXT_State_DESC.Text = _result.State_DESC; this.TXT_VendName.Text = _result.VendName; - this.txtRemark.Text = _result.Remark; - this.TXT_SubSite.Text = _result.SubSite; - this.TXT_Extend1.Text = _result.Extend1; + this.TXT_Remark.Text = _result.Extend1; + this.TXT_SubSite.Text = _result.SubSite; this.TXT_Extend2.Text = _result.Extend2; this.TXT_Extend3.Text = _result.Extend3; @@ -157,7 +156,7 @@ namespace SCP.PlanData { var qadOrder = Session["order"] as V_TB_PO; qadOrder.SubSite =TXT_SubSite.Text; - qadOrder.Extend1 = TXT_Extend1.Text; + qadOrder.Extend1 = TXT_Remark.Text; qadOrder.Extend2 = TXT_Extend2.Text; qadOrder.Extend3 = TXT_Extend3.Text; //qadOrder.ReceivedPort = DDL_PORT.SelectedValue; diff --git a/SCP/Views/PlanData/SCP_PO_CREATE_ASK.aspx.designer.cs b/SCP/Views/PlanData/SCP_PO_CREATE_ASK.aspx.designer.cs index fe135d1..3423c35 100644 --- a/SCP/Views/PlanData/SCP_PO_CREATE_ASK.aspx.designer.cs +++ b/SCP/Views/PlanData/SCP_PO_CREATE_ASK.aspx.designer.cs @@ -159,13 +159,13 @@ namespace SCP.PlanData protected global::FineUI.TextBox TXT_Site; /// - /// txtRemark 控件。 + /// TXT_Remark 控件。 /// /// /// 自动生成的字段。 /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// - protected global::FineUI.TextBox txtRemark; + protected global::FineUI.TextBox TXT_Remark; /// /// gp1 控件。 diff --git a/SCP/Views/SupplierData/SCP_ASN_CREATE.aspx b/SCP/Views/SupplierData/SCP_ASN_CREATE.aspx index 1086d43..b1003cc 100644 --- a/SCP/Views/SupplierData/SCP_ASN_CREATE.aspx +++ b/SCP/Views/SupplierData/SCP_ASN_CREATE.aspx @@ -40,7 +40,7 @@