CY_ECommercePlatform/CY.WebForm/Pages/business/AgSpecialOrderEdit.aspx.cs
@@ -13,6 +13,7 @@
using CY.Model.Inquiry;
using CY.BLL.OA;
using CY.SQLDAL;
using CY.BLL.Inquiry;
namespace CY.WebForm.Pages.business
{
@@ -39,6 +40,14 @@
        public string xialapr = "";
        public string orderIdstrrrr = "";
        public string shukuanhuace = "";
        public string shukuanhuaceneiye1 = "";
        public string shukuanhuaceneiye2 = "";
        public string shukuanhuaceneiye3 = "";
        public string shukuanhuaceneiye4 = "";
        public string shukuanhuaceneiye5 = "";
        public string PrintTypeId = "";
        AfterParameterInfoBLL _afterParameterInfoBLL = null;
        //初始化
        public AgSpecialOrderEdit()
        {
@@ -47,6 +56,7 @@
            bll_OA_InventoryBLL = new OA_InventoryBLL();
            bll_OA_OutOfStorageBLL = new OA_OutOfStorageBLL();
            bll_EC_CuttingPaperSpecBLL = new EC_CuttingPaperSpecBLL();
            _afterParameterInfoBLL = new AfterParameterInfoBLL();
        }
        //页面加载
@@ -169,6 +179,7 @@
                return false;
            }
            orderIdstrrrr = orderIdStr;
            EC_OrderPrintParameterBLL _eC_OrderPrintParameterBLL = new EC_OrderPrintParameterBLL();
            EC_OrderPrintParameter _eC_OrderPrintParameter = _eC_OrderPrintParameterBLL.GetModel(orderId.Value);
@@ -181,13 +192,65 @@
            {
                _inquiryCommonModel = SerializationHelper.DeSerialize(typeof(InquiryCommonModel), _eC_OrderPrintParameter.PrintParameter) as InquiryCommonModel;
            }
            PrintTypeId = _eC_OrderBasic.PrintTypeId.ToString();
            this.txtOrderNum.Value = _eC_OrderBasic.OrderExtend.SurplusPrintNum.ToString2();
            #endregion
            EC_SpecialOrders m_EC_SpecialOrders = bll_EC_SpecialOrdersBLL.GetModelByOrderId(orderId);
            if (m_EC_SpecialOrders == null)
            {
                m_EC_SpecialOrders = new EC_SpecialOrders();
                if (_eC_OrderBasic.PrintTypeId == 15 || _eC_OrderBasic.PrintTypeId == 6)
                {
                    shukuanhuace = "true";
                    if (_inquiryCommonModel.InquiryInsideList != null && _inquiryCommonModel.InquiryInsideList.Count > 0)
                    {
                        if (_inquiryCommonModel.InquiryInsideList.Count == 1)
                        {
                            shukuanhuaceneiye1 = _inquiryCommonModel.InquiryInsideList[0].PageNum.ToString();
                        }
                        else if (_inquiryCommonModel.InquiryInsideList.Count == 2)
                        {
                            shukuanhuaceneiye1 = _inquiryCommonModel.InquiryInsideList[0].PageNum.ToString();
                            shukuanhuaceneiye2 = _inquiryCommonModel.InquiryInsideList[1].PageNum.ToString();
                        }
                        else if (_inquiryCommonModel.InquiryInsideList.Count == 3)
                        {
                            shukuanhuaceneiye1 = _inquiryCommonModel.InquiryInsideList[0].PageNum.ToString();
                            shukuanhuaceneiye2 = _inquiryCommonModel.InquiryInsideList[1].PageNum.ToString();
                            shukuanhuaceneiye3 = _inquiryCommonModel.InquiryInsideList[2].PageNum.ToString();
                        }
                        else if (_inquiryCommonModel.InquiryInsideList.Count == 4)
                        {
                            shukuanhuaceneiye1 = _inquiryCommonModel.InquiryInsideList[0].PageNum.ToString();
                            shukuanhuaceneiye2 = _inquiryCommonModel.InquiryInsideList[1].PageNum.ToString();
                            shukuanhuaceneiye3 = _inquiryCommonModel.InquiryInsideList[2].PageNum.ToString();
                            shukuanhuaceneiye4 = _inquiryCommonModel.InquiryInsideList[3].PageNum.ToString();
                        }
                        else if (_inquiryCommonModel.InquiryInsideList.Count == 5)
                        {
                            shukuanhuaceneiye1 = _inquiryCommonModel.InquiryInsideList[0].PageNum.ToString();
                            shukuanhuaceneiye2 = _inquiryCommonModel.InquiryInsideList[1].PageNum.ToString();
                            shukuanhuaceneiye3 = _inquiryCommonModel.InquiryInsideList[2].PageNum.ToString();
                            shukuanhuaceneiye4 = _inquiryCommonModel.InquiryInsideList[3].PageNum.ToString();
                            shukuanhuaceneiye5 = _inquiryCommonModel.InquiryInsideList[4].PageNum.ToString();
                        }
                    }
                }
                else
                {
                    shukuanhuace = "false";
                }
            }
            else
            {
                this.txtOrderNum.Value = m_EC_SpecialOrders.OrderNum.ToString2(); ;
            }
            keyid = m_EC_SpecialOrders.Keyid.ToString2();
@@ -244,9 +307,92 @@
                m_EC_SpecialForums.PSF_CTPCount = 1;
                m_EC_SpecialForumsList.Add(m_EC_SpecialForums);
                this.txtPSO_Work.InnerText = _inquiryCommonModel.AfterWorksDemand;
                if (_eC_OrderBasic.PrintTypeId == 7)
                {
                    m_EC_SpecialForums.PSF_PNum = _inquiryCommonModel.PageNum;
                    m_EC_SpecialForums.PSF_Component = _inquiryCommonModel.PrintSizeName;
                }
            }
            this.RepClientList.DataSource = m_EC_SpecialForumsList;
            this.RepClientList.DataBind();
            List<EC_SpecialHoudaos> m_EC_SpecialHoudaosList = bll_EC_SpecialOrdersBLL.GetEC_SpecialHoudaosListByKeyid(m_EC_SpecialOrders.Keyid) as List<EC_SpecialHoudaos>;
            if (m_EC_SpecialHoudaosList == null || m_EC_SpecialHoudaosList.Count == 0)
            {
                m_EC_SpecialHoudaosList = new List<EC_SpecialHoudaos>();
                EC_SpecialHoudaos m_EC_SpecialHoudaos = new EC_SpecialHoudaos();
                m_EC_SpecialHoudaosList.Add(m_EC_SpecialHoudaos);
            }
            var ssssss = _inquiryCommonModel.AfterWorkList;
            var inquiryInsideModels = _inquiryCommonModel.InquiryInsideList;
            foreach (var c_SpecialHoudaos in m_EC_SpecialHoudaosList)
            {
                List<int> houdaolist = new List<int>();
                string select = "<option value=''>无</option>";
                if (ssssss != null && ssssss.Count > 0)
                {
                    if (_eC_OrderBasic.PrintTypeId != 27)
                    {
                        foreach (var aaaaa in ssssss)
                        {
                            houdaolist.Add(aaaaa);
                        }
                    }
                }
                if (inquiryInsideModels != null && inquiryInsideModels.Count > 0)
                {
                        foreach (var inquiryInsideModel in inquiryInsideModels)
                        {
                            var afterWorkList = inquiryInsideModel.AfterWorkList;
                            if (afterWorkList != null && afterWorkList.Count > 0)
                            {
                                foreach (var aaaaa in afterWorkList)
                                {
                                    houdaolist.Add(aaaaa);
                                }
                            }
                        }
                }
                var sysInquiry_Afters = _afterParameterInfoBLL.GetModelList().Where(x => houdaolist.Contains(x.KeyId)).ToList();
                if (sysInquiry_Afters != null && sysInquiry_Afters.Count > 0)
                {
                    foreach (var item in sysInquiry_Afters)
                    {
                        if (item.ParameterName == c_SpecialHoudaos.PSF_Houdaogongxu)
                        {
                            select += "<option value='" + item.ParameterName + "'  selected=\"selected\" >" + item.ParameterName + "</option>";
                        }
                        else
                        {
                            select += "<option value='" + item.ParameterName + "'>" + item.ParameterName + "</option>";
                        }
                    }
                }
                if (_eC_OrderBasic.PrintTypeId == 29 || _eC_OrderBasic.PrintTypeId == 27)
                {
                    if (_inquiryCommonModel.JTWZ == c_SpecialHoudaos.PSF_Houdaogongxu)
                    {
                        select += "<option value='" + _inquiryCommonModel.JTWZ + "' selected=\"selected\" >" + _inquiryCommonModel.JTWZ + "</option>";
                    }
                    else
                    {
                        select += "<option value='" + _inquiryCommonModel.JTWZ + "' >" + _inquiryCommonModel.JTWZ + "</option>";
                    }
                }
                c_SpecialHoudaos.PSF_Houdaogongxu = select;
            }
            this.RepeaterHoudaoList.DataSource = m_EC_SpecialHoudaosList;
            this.RepeaterHoudaoList.DataBind();
            //获取开料尺寸
            EC_CuttingPaperSpec model = new EC_CuttingPaperSpec();
@@ -354,12 +500,14 @@
                }
                string[] PSF_Component = Request["PSF_Component"].ToString2().Split(',');
                string[] PSF_Chengpinchicun = Request["PSF_Chengpinchicun"].ToString2().Split(',');
                string[] PSF_PNum = Request["PSF_PNum"].ToString2().Split(',');
                string[] PSF_PressesDesk = Request["PSF_PressesDesk"].ToString2().Split(',');
                string[] PSF_PrintedColorPositive = Request["PSF_PrintedColorPositive"].ToString2().Split(',');
                string[] PSF_PrintedColorRear = Request["PSF_PrintedColorRear"].ToString2().Split(',');
                string[] PSF_Typesetting = Request["PSF_Typesetting"].ToString2().Split(',');
                string[] PSF_Typesettinghide = Request["PSF_Typesettinghide"].ToString2().Split(',');
                string[] PSF_Fabantaoshu = Request["PSF_Fabantaoshu"].ToString2().Split(',');
                string[] PSF_PrintedCount = Request["PSF_PrintedCount"].ToString2().Split(',');
                string[] PSF_PrintedPositive = Request["PSF_PrintedPositive"].ToString2().Split(',');
                string[] PSF_LastNum = Request["PSF_LastNum"].ToString2().Split(',');
@@ -378,6 +526,7 @@
                string[] PSF_BigPaperCount = Request["PSF_BigPaperCount"].ToString2().Split(',');
                string[] PSF_OpenSpecifications = Request["PSF_OpenSpecifications"].ToString2().Split(',');
                string[] PSF_Qitadingdanhao = Request["PSF_Qitadingdanhao"].ToString2().Split(',');
                string[] PSF_OpenWidth = Request["PSF_OpenWidth"].ToString2().Split(',');
                string[] PSF_OpenWidthName = Request["PSF_OpenWidthName"].ToString2().Split(',');
                string[] PSF_OpenLength = Request["PSF_OpenLength"].ToString2().Split(',');
@@ -396,6 +545,13 @@
                string[] oldPSF_PaperId = Request["oldPSF_PaperId"].ToString2().Split(',');
                string[] oldPSF_BigPaperCount = Request["oldPSF_BigPaperCount"].ToString2().Split(',');
                string[] selHoudaogongxu = Request["selHoudaogongxu"].ToString2().Split(',');
                string[] txtShuliang = Request["txtShuliang"].ToString2().Split(',');
                string[] txtBeishu = Request["txtBeishu"].ToString2().Split(',');
                string[] txtJichang = Request["txtJichang"].ToString2().Split(',');
                string[] txtYaoqiu = Request["txtYaoqiu"].ToString2().Split(',');
                //if (PSF_Forumsid.Length != PSF_Component.Length || PSF_Forumsid.Length != PSF_PNum.Length || PSF_Forumsid.Length != PSF_PressesDesk.Length || PSF_Forumsid.Length != PSF_PrintedColorPositive.Length || PSF_Forumsid.Length != PSF_PrintedColorRear.Length || PSF_Forumsid.Length != PSF_Typesetting.Length || PSF_Forumsid.Length != PSF_PrintedCount.Length || PSF_Forumsid.Length != PSF_PrintedPositive.Length || PSF_Forumsid.Length != PSF_LastNum.Length || PSF_Forumsid.Length != PSF_SheetSource.Length || PSF_Forumsid.Length != PSF_SpecificationsSheet.Length || PSF_Forumsid.Length != PSF_EditionCount.Length || PSF_Forumsid.Length != PSF_PaperSource.Length || PSF_Forumsid.Length != PSF_PaperId.Length || PSF_Forumsid.Length != PSF_PaperName.Length || PSF_Forumsid.Length != PSF_MaterialSpecifications.Length || PSF_Forumsid.Length != PSF_BigPaperCount.Length || PSF_Forumsid.Length != PSF_OpenSpecifications.Length || PSF_Forumsid.Length != PSF_OpenWidth.Length || PSF_Forumsid.Length != PSF_OpenLength.Length || PSF_Forumsid.Length != PSF_Note.Length)
                //{
@@ -434,11 +590,16 @@
                List<EC_SpecialForums> m_EC_SpecialForumsList = new List<EC_SpecialForums>();
                List<OA_Inventory> m_OA_InventoryList = new List<OA_Inventory>();
                List<OA_OutOfStorage> m_OA_OutOfStorageList = new List<OA_OutOfStorage>();
                List<EC_SpecialHoudaos> m_EC_SpecialHoudaosList = new List<EC_SpecialHoudaos>();
                for (int i = 0; i < PSF_Forumsid.Length; i++)
                {
                    EC_SpecialForums m_EC_SpecialForums = new EC_SpecialForums();
                    m_EC_SpecialForums.PSF_Component = PSF_Component[i].ToString2().Replace(",+-+,", ",");
                    if (_eC_OrderBasic.PrintTypeId == 7 )
                    {
                        m_EC_SpecialForums.PSF_Component = PSF_Chengpinchicun[i];
                    }
                    if (PSF_PNum[i].ToInt32() == null)
                    {
                        m_EC_SpecialForums.PSF_PNum = 0;
@@ -458,8 +619,8 @@
                    {
                        m_EC_SpecialForums.PSF_Typesetting = PSF_Typesetting[i].ToString2().Replace(",+-+,", ",");
                    }
                    m_EC_SpecialForums.PSF_Fabantaoshu = PSF_Fabantaoshu[i];
                    if (PSF_PrintedCount[i].ToInt32() == null)
                    {
                        m_EC_SpecialForums.PSF_PrintedCount = 0;
@@ -507,7 +668,12 @@
                    //}
                    m_EC_SpecialForums.PSF_BigPaperCount = 0;
                    m_EC_SpecialForums.PSF_OpenSpecifications = PSF_OpenSpecifications[i].ToString2().Replace(",+-+,", ",");
                    if (PSF_PressesDesk[i].IndexOf("轮转")>=0)
                    if (PSF_PressesDesk[i].IndexOf("与其他订单合版") >= 0  )
                    {
                        m_EC_SpecialForums.PSF_PaperName = PSF_Qitadingdanhao[i];
                    }
                    if (PSF_PressesDesk[i].IndexOf("轮转") >= 0 || PSF_PressesDesk[i].IndexOf("黑白") >= 0)
                    {
                        if (PSF_OpenWidthName[i].ToInt32() == null)
                        {
@@ -516,6 +682,11 @@
                        else
                        {
                            m_EC_SpecialForums.PSF_OpenWidth = PSF_OpenWidthName[i].ToInt32();
                        }
                        if(PSF_PressesDesk[i].IndexOf("轮转") >= 0)
                        {
                            m_EC_SpecialForums.PSF_OpenWidth = 0;
                        }
                    }
                    else
@@ -543,8 +714,8 @@
                    if (m_EC_SpecialForums.PSF_PlateSource == "本厂CTP")
                    {
                        m_EC_SpecialForums.PSF_CTPSpecType = CTPSpecName[i].ToString2().Replace(",+-+,", ",");
                        if(CTPCount[i].ToInt32() == null)
                        if (CTPCount[i].ToInt32() == null)
                        {
                            m_EC_SpecialForums.PSF_CTPCount = 0;
                        }
@@ -562,6 +733,16 @@
                    {
                        m_EC_SpecialForums.PSF_CTPSpecType = selFilmSpec[i].ToString2().Replace(",+-+,", ",");
                        m_EC_SpecialForums.PSF_CTPCount = 0;
                    }
                    m_EC_SpecialForums.PSF_CTPSpecType = CTPSpecName[i].ToString2().Replace(",+-+,", ",");
                    if (CTPCount[i].ToInt32() == null)
                    {
                        m_EC_SpecialForums.PSF_CTPCount = 0;
                    }
                    else
                    {
                        m_EC_SpecialForums.PSF_CTPCount = CTPCount[i].ToInt32();
                    }
                    m_EC_SpecialForums.PSF_FilmType = "";   
                    m_EC_SpecialForums.PSF_PSSpec = PSF_PSBan[i].ToString2().Replace(",+-+,", ",");
@@ -664,15 +845,35 @@
                        }
                    }
                 }
                for (int i = 0; i < selHoudaogongxu.Length; i++)
                {
                    EC_SpecialHoudaos m_EC_SpecialHoudaos = new EC_SpecialHoudaos();
                    m_EC_SpecialHoudaos.PSF_Houdaogongxu = selHoudaogongxu[i].ToString2().Replace(",+-+,", ",");
                    m_EC_SpecialHoudaos.PSF_Shuliang = txtShuliang[i] ;
                    m_EC_SpecialHoudaos.PSF_Beishu = txtBeishu[i];
                    m_EC_SpecialHoudaos.PSF_Jichang = txtJichang[i];
                    m_EC_SpecialHoudaos.PSF_Yaoqiu = txtYaoqiu[i].Trim();
                    if(!string.IsNullOrEmpty(m_EC_SpecialHoudaos.PSF_Houdaogongxu)
                        || !string.IsNullOrEmpty(m_EC_SpecialHoudaos.PSF_Shuliang)
                        || !string.IsNullOrEmpty(m_EC_SpecialHoudaos.PSF_Beishu)
                        || !string.IsNullOrEmpty(m_EC_SpecialHoudaos.PSF_Jichang)
                        || !string.IsNullOrEmpty(m_EC_SpecialHoudaos.PSF_Yaoqiu)){
                        m_EC_SpecialHoudaosList.Add(m_EC_SpecialHoudaos);
                    }
                }
                m_EC_SpecialOrders.LastUpdateTime = DateTime.Now;
                m_EC_SpecialOrders.Operator = CurrentUser.ShortName;
                m_EC_SpecialOrders.PSO_Remarks = this.txtPSO_Remarks.InnerText;
                m_EC_SpecialOrders.PSO_Work = this.txtPSO_Work.InnerText;
                m_EC_SpecialOrders.OrderNum = this.txtOrderNum.Value.ToInt32();
                if (m_EC_SpecialOrders.Keyid > 0)
                {
                    if (bll_EC_SpecialOrdersBLL.UpdateSpecialForums(m_EC_SpecialOrders, m_EC_SpecialForumsList, m_OA_InventoryList, m_OA_OutOfStorageList))
                    if (bll_EC_SpecialOrdersBLL.UpdateSpecialForums(m_EC_SpecialOrders, m_EC_SpecialForumsList, m_OA_InventoryList, m_OA_OutOfStorageList, m_EC_SpecialHoudaosList))
                        //JavaScript.MessageBox("操作成功", this);
                        JavaScript.RefreshDIVOpener(this);
                    else
@@ -684,7 +885,7 @@
                else
                {
                    m_EC_SpecialOrders.Memberid = CurrentUser.MemberId;
                    m_EC_SpecialOrders.OrderNum = 0;
                    m_EC_SpecialOrders.OrderNum = this.txtOrderNum.Value.ToInt32();
                    m_EC_SpecialOrders.PO_OrderId = orderId;
                    m_EC_SpecialOrders.PO_OrderNum = _eC_OrderBasic.SellerOrderId;
                    m_EC_SpecialOrders.PSO_OrderNum = bll_EC_SpecialOrdersBLL.GetPSO_OrderNum(CurrentUser.MemberId);
@@ -705,7 +906,7 @@
                    m_OA_OrderWorkListRelation.RelationTypeId = 1; //专版1,合版2,后道外协3,整单外协4
                    //bll_EC_SpecialOrdersBLL.AddSpecialForums(m_EC_OrderOperate, m_EC_SpecialOrders, m_OA_OrderWorkListRelation, m_EC_SpecialForumsList, m_OA_InventoryList, m_OA_OutOfStorageList)
                    if (bll_EC_SpecialOrdersBLL.AddSpecialForums(m_EC_OrderOperate, m_EC_SpecialOrders, m_OA_OrderWorkListRelation, m_EC_SpecialForumsList, m_OA_InventoryList, m_OA_OutOfStorageList))
                    if (bll_EC_SpecialOrdersBLL.AddSpecialForums(m_EC_OrderOperate, m_EC_SpecialOrders, m_OA_OrderWorkListRelation, m_EC_SpecialForumsList, m_OA_InventoryList, m_OA_OutOfStorageList, m_EC_SpecialHoudaosList))
                    {
                        //JavaScript.MessageBox("操作成功", this);
                        JavaScript.RefreshDIVOpener(this);