using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using CY.BLL.EC; using CY.Model; using CY.BLL.Sys; using CY.Infrastructure.Common; using CY.BLL; using CY.Model.Inquiry; using CY.BLL.OA; using CY.Infrastructure.Query; using CY.WebForm.Pages.common; namespace CY.WebForm.Pages.business { //吴辉 //修改后道外协 public partial class AgOutsourcSingleAfterUpdate : BasePage { EC_SpecialOrdersBLL bll_EC_SpecialOrdersBLL = null; OA_CorporateClientsBLL bll_OA_CorporateClientsBLL = null; EC_OrderBLL bll_EC_OrderBLL = null; EC_OrderPrintParameterBLL _eC_OrderPrintParameterBLL = null; public Guid targetid = Guid.Empty; //初始化 public AgOutsourcSingleAfterUpdate() { bll_EC_SpecialOrdersBLL = new EC_SpecialOrdersBLL(); bll_OA_CorporateClientsBLL = new OA_CorporateClientsBLL(); bll_EC_OrderBLL = new EC_OrderBLL(); _eC_OrderPrintParameterBLL = new EC_OrderPrintParameterBLL(); } //页面加载 protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { InitData(); } } /// /// 加载后道外协单信息 /// private bool InitData() { targetid = CurrentUser.MemberId; #region 获取订单及其相关 EC_OrderBasicBLL _eC_OrderBasicBLL = new EC_OrderBasicBLL(); string orderIdStr = Request["orderid"]; string oldidStr = Request["oldid"]; if (string.IsNullOrEmpty(orderIdStr) || string.IsNullOrEmpty(oldidStr)) { CY.WebForm.BasePage.JavaScript.MessageBox("未传递参数!", this); return false; } int? orderId = MyConvert.ConvertToInt32(orderIdStr); int? oldid = MyConvert.ConvertToInt32(oldidStr); if (!orderId.HasValue || !oldid.HasValue) { CY.WebForm.BasePage.JavaScript.MessageBox("未传递参数!", this); return false; } EC_OrderBasic _eC_OrderBasic = _eC_OrderBasicBLL.SelectModelById(orderId.Value); EC_OrderBasic _Old_eC_OrderBasic = _eC_OrderBasicBLL.SelectModelById(oldid.Value); if (null == _eC_OrderBasic || null == _Old_eC_OrderBasic) { CY.WebForm.BasePage.JavaScript.MessageBox("数据不存在!", this); return false; } EC_OrderPrintParameter _eC_OrderPrintParameter = _eC_OrderPrintParameterBLL.GetModel(orderId.Value); InquiryCommonModel _inquiryCommonModel = null; if (null == _eC_OrderPrintParameter) { _inquiryCommonModel = new InquiryCommonModel(); } else { _inquiryCommonModel = SerializationHelper.DeSerialize(typeof(InquiryCommonModel), _eC_OrderPrintParameter.PrintParameter) as InquiryCommonModel; } #endregion this.txtAfterWorksDemand.InnerText = _inquiryCommonModel.AfterWorksDemand; //this.txtPrintDemand.InnerText = _inquiryCommonModel.PrintDemand; this.txtPrintDemand.Visible = false; this.spanOrderNum.InnerText = _eC_OrderBasic.SellerOrderId; this.spanOrderType.InnerText = _eC_OrderBasic.OrderType.Name; this.spanOrderTitle.InnerText = _eC_OrderBasic.DocumentName; this.txtPrintCount.Value = _eC_OrderBasic.OrderExtend.PrintNum.ToString2(); this.txtAllMoney.Value = (_eC_OrderBasic.SumPrice??0).ToString("0.00"); this.txtUnitPrice.Value = (_eC_OrderBasic.UnitPrice??0).ToString("0.00"); this.spanCustomName.InnerText = _Old_eC_OrderBasic.BuyerName; Pagination pa = new Pagination(); pa.PageSize = 500; pa.PageIndex = 1; this.selOutFirm.DataSource = bll_OA_CorporateClientsBLL.SelectModelPage(pa, CurrentUser.MemberId, ""); this.selOutFirm.DataTextField = "OutVendorName"; this.selOutFirm.DataValueField = "FirmId"; this.selOutFirm.DataBind(); this.selOutFirm.Value = _eC_OrderBasic.SellerId.ToString2(); return true; } //提交事件 protected void btn_Submit_form(object sender, EventArgs e) { try { if (SaveOrder()) JavaScript.RefreshDIVOpener(this); else JavaScript.MessageBox("操作失败", this); } catch (Exception ex) { PAGEHandleException(ex); JavaScript.MessageBox("操作失败", this); } } /// /// 保存订单 /// private bool SaveOrder() { EC_OrderBasicBLL _eC_OrderBasicBLL = new EC_OrderBasicBLL(); string orderIdStr = Request["orderid"]; if (string.IsNullOrEmpty(orderIdStr) || "0".Equals(orderIdStr)) return false; if (string.IsNullOrEmpty(orderIdStr)) { JavaScript.MessageBox("未传递参数!", this); return false; } int? orderid = MyConvert.ConvertToInt32(orderIdStr); if (!orderid.HasValue) { JavaScript.MessageBox("未传递参数!", this); return false; } OA_CorporateClients m_OA_CorporateClients_Out = bll_OA_CorporateClientsBLL.SelectModelByFirmIdandMemberId(this.selOutFirm.Value.ToGuid2(), CurrentUser.MemberId); EC_OrderBasic m_EC_OrderBasicNew = _eC_OrderBasicBLL.SelectModelById(orderid.Value); m_EC_OrderBasicNew.SellerId = this.selOutFirm.Value.ToGuid2(); m_EC_OrderBasicNew.Creater = CurrentUser.ShortName; m_EC_OrderBasicNew.Operator = CurrentUser.ShortName; m_EC_OrderBasicNew.SellerName = m_OA_CorporateClients_Out.OutVendorName; m_EC_OrderBasicNew.SumPrice = this.txtAllMoney.Value.ToDecimal2(); m_EC_OrderBasicNew.UnitPrice = this.txtUnitPrice.Value.ToDecimal2(); m_EC_OrderBasicNew.OrderExtend.PrintNum = this.txtPrintCount.Value.ToInt32(); m_EC_OrderBasicNew.OrderExtend.SurplusPrintNum = this.txtPrintCount.Value.ToInt32(); InquiryCommonModel m_InquiryCommonModel = new InquiryCommonModel(); m_InquiryCommonModel.PrintDemand = ""; m_InquiryCommonModel.PrintTypeId = m_EC_OrderBasicNew.PrintTypeId.Value; m_InquiryCommonModel.PrintTypeName = m_EC_OrderBasicNew.PrintType.PrintName; m_InquiryCommonModel.AfterWorksDemand = this.txtAfterWorksDemand.Value; EC_OrderPrintParameter _eC_OrderPrintParameter = _eC_OrderPrintParameterBLL.GetModel(m_EC_OrderBasicNew.Keyid.Value); EC_OrderPrintParameter m_EC_OrderPrintParameter = new EC_OrderPrintParameter()//订单印刷参数 { PrintParameter = SerializationHelper.Serialize(m_InquiryCommonModel) }; m_EC_OrderPrintParameter.OrderId = _eC_OrderPrintParameter.OrderId; return bll_EC_OrderBLL.UpdateOutOrderInfo(m_EC_OrderBasicNew, m_EC_OrderBasicNew.OrderExtend, m_EC_OrderPrintParameter); } } }