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
{
@@ -46,7 +47,7 @@
        public string shukuanhuaceneiye4 = "";
        public string shukuanhuaceneiye5 = "";
        public string PrintTypeId = "";
        AfterParameterInfoBLL _afterParameterInfoBLL = null;
        //初始化
        public AgSpecialOrderEdit()
        {
@@ -55,6 +56,7 @@
            bll_OA_InventoryBLL = new OA_InventoryBLL();
            bll_OA_OutOfStorageBLL = new OA_OutOfStorageBLL();
            bll_EC_CuttingPaperSpecBLL = new EC_CuttingPaperSpecBLL();
            _afterParameterInfoBLL = new AfterParameterInfoBLL();
        }
        //页面加载
@@ -191,7 +193,7 @@
                _inquiryCommonModel = SerializationHelper.DeSerialize(typeof(InquiryCommonModel), _eC_OrderPrintParameter.PrintParameter) as InquiryCommonModel;
            }
            PrintTypeId = _eC_OrderBasic.PrintTypeId.ToString();
            this.txtOrderNum.Value = _eC_OrderBasic.OrderExtend.SurplusPrintNum.ToString2();
            #endregion
@@ -243,6 +245,10 @@
                {
                    shukuanhuace = "false";
                }
            }
            else
            {
                this.txtOrderNum.Value = m_EC_SpecialOrders.OrderNum.ToString2(); ;
            }
               
@@ -301,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();
@@ -411,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(',');
@@ -455,6 +546,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)
                //{
                //    JavaScript.MessageBox("提交失败", this);
@@ -492,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;
@@ -516,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;
@@ -611,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;
                        }
@@ -630,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(",+-+,", ",");
@@ -677,7 +790,7 @@
                                        m_OA_OutOfStorageOld.GoodsId = m_OA_InventoryOld.GoodsId;
                                        m_OA_OutOfStorageOld.CargoSpaceId = 0;
                                        m_OA_OutOfStorageOld.WarehouseId = m_OA_InventoryOld.WarehouseId;
                                        m_OA_OutOfStorageOld.InfoType = "确认出库";
                                        m_OA_OutOfStorageOld.InfoType = "出库";
                                        m_OA_OutOfStorageOld.SuppliersId = 0;
                                        m_OA_OutOfStorageOld.Price = 0;
                                        m_OA_OutOfStorageOld.Quantity = PMS_PaperCount1_NEW[Array.IndexOf(PSF_PaperId_NEW, item)].ToInt32() ?? 0;
@@ -689,7 +802,10 @@
                                        m_OA_OutOfStorageOld.BrandId = m_OA_InventoryOld.BrandId;
                                        m_OA_OutOfStorageOld.PaperWeightId = m_OA_InventoryOld.PaperWeightId;
                                        m_OA_OutOfStorageOld.SpecificationId = m_OA_InventoryOld.SpecificationId;
                                        m_OA_OutOfStorageOld.InventoryId = m_OA_InventoryOld.Keyid;
                                        m_OA_OutOfStorageList.Add(m_OA_OutOfStorageOld);
                                        m_OA_InventoryOld.InventoryCount = m_OA_InventoryOld.InventoryCount - m_OA_OutOfStorageOld.Quantity;
                                        m_OA_InventoryList.Add(m_OA_InventoryOld);
                                    }
                                }
                            }
@@ -703,7 +819,7 @@
                                    m_OA_OutOfStorage.GoodsId = m_OA_Inventory.GoodsId;
                                    m_OA_OutOfStorage.CargoSpaceId = 0;
                                    m_OA_OutOfStorage.WarehouseId = m_OA_Inventory.WarehouseId;
                                    m_OA_OutOfStorage.InfoType = "确认出库";
                                    m_OA_OutOfStorage.InfoType = "出库";
                                    m_OA_OutOfStorage.SuppliersId = 0;
                                    m_OA_OutOfStorage.Price = 0;
                                    if (j == 0)
@@ -726,21 +842,80 @@
                                    m_OA_OutOfStorage.BrandId = m_OA_Inventory.BrandId;
                                    m_OA_OutOfStorage.PaperWeightId = m_OA_Inventory.PaperWeightId;
                                    m_OA_OutOfStorage.SpecificationId = m_OA_Inventory.SpecificationId;
                                    m_OA_OutOfStorage.InventoryId = m_OA_Inventory.Keyid;
                                    m_OA_OutOfStorageList.Add(m_OA_OutOfStorage);
                                    m_OA_Inventory.InventoryCount = m_OA_Inventory.InventoryCount - m_OA_OutOfStorage.Quantity;
                                    m_OA_InventoryList.Add(m_OA_Inventory);
                                }
                            }
                        }
                        var CTPSpecNamei = CTPSpecName[i];
                        var CTPCounti = CTPCount[i];
                        var PSF_Fabantaoshui = PSF_Fabantaoshu[i];
                        if (!string.IsNullOrEmpty(CTPCounti))
                        {
                            OA_Inventory m_OA_InventoryOld = bll_OA_InventoryBLL.SelecetModelDetailInfoList(CurrentUser.MemberId, "", "", "板材", "", CTPSpecNamei).FirstOrDefault();
                            if (m_OA_InventoryOld != null)
                            {
                                OA_OutOfStorage m_OA_OutOfStorageOld = new OA_OutOfStorage();
                                m_OA_OutOfStorageOld.FirmId = CurrentUser.MemberId;
                                m_OA_OutOfStorageOld.GoodsId = m_OA_InventoryOld.GoodsId;
                                m_OA_OutOfStorageOld.CargoSpaceId = 0;
                                m_OA_OutOfStorageOld.WarehouseId = m_OA_InventoryOld.WarehouseId;
                                m_OA_OutOfStorageOld.InfoType = "出库";
                                m_OA_OutOfStorageOld.SuppliersId = 0;
                                m_OA_OutOfStorageOld.Price = 0;
                                m_OA_OutOfStorageOld.Quantity = CTPCounti.ToInt32() ?? 0;
                                if (!string.IsNullOrEmpty(PSF_Fabantaoshui))
                                {
                                    m_OA_OutOfStorageOld.Quantity = m_OA_OutOfStorageOld.Quantity * (PSF_Fabantaoshui.ToInt32() ?? 0);
                                }
                                m_OA_OutOfStorageOld.AllMoney = 0;
                                m_OA_OutOfStorageOld.LastUpdateTime = DateTime.Now;
                                m_OA_OutOfStorageOld.Operator = CurrentUser.ShortName;
                                m_OA_OutOfStorageOld.Remark = "";
                                m_OA_OutOfStorageOld.TanPrice = 0;
                                m_OA_OutOfStorageOld.BrandId = m_OA_InventoryOld.BrandId;
                                m_OA_OutOfStorageOld.PaperWeightId = m_OA_InventoryOld.PaperWeightId;
                                m_OA_OutOfStorageOld.SpecificationId = m_OA_InventoryOld.SpecificationId;
                                m_OA_OutOfStorageOld.InventoryId = m_OA_InventoryOld.Keyid;
                                m_OA_OutOfStorageList.Add(m_OA_OutOfStorageOld);
                                m_OA_InventoryOld.InventoryCount = m_OA_InventoryOld.InventoryCount - m_OA_OutOfStorageOld.Quantity;
                                m_OA_InventoryList.Add(m_OA_InventoryOld);
                            }
                        }
                    }
                 }
                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
@@ -752,7 +927,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);
@@ -773,7 +948,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);