Exemple #1
0
        public void DataBind()
        {
            StringBuilder    sb          = new StringBuilder();
            List <XMProject> projectList = null;

            var data = XMOrderInfoService.getUnusualOrder();

            if (HozestERPContext.Current.User.CustomerID == 7 || HozestERPContext.Current.User.CustomerID == 84 || HozestERPContext.Current.User.CustomerID == 658 || HozestERPContext.Current.User.CustomerID == 682 || HozestERPContext.Current.User.CustomerID == 670)
            {
                projectList = base.XMProjectService.GetXMProjectList();
            }
            else
            {
                projectList = base.XMProjectService.GetXMProjectListSS(HozestERPContext.Current.User.CustomerID, 0);
            }

            foreach (var item in projectList)
            {
                int count = data.Where(a => a.ProjectId == item.Id).Count();
                if (count != 0)
                {
                    //sb.Append("<label>"+ item .ProjectName+"异常订单:"+ count + "</label><button type='button' value='test'>详情</button></br>");
                    sb.Append("<input type=\"image\" name=\"setBarCode\" id=\"setBarCodes\"  title=\"查看条形码\" src=\"../App_Themes/Blue/Image/ButtonImages/meeting.gif\"  onclick=\"return ShowWindowDetail('查看商品条形码','" + CommonHelper.GetStoreLocation() + "ManageInventory/ProductBarCodeList.aspx?Status=Storage&&ID=" + 0 + "',400,600, this);\"/>");
                }
            }

            str = "";
        }
        private void BindGrid()
        {
            var data = XMOrderInfoService.getUnusualOrder();

            StoreWorker.DataSource = data.Where(a => a.ProjectId == projectID);
            StoreWorker.DataBind();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!X.IsAjaxRequest)
            {
                string   OrderID = CommonHelper.QueryString("ID");
                string[] status  = new string[] { "TRADE_FINISHED", "TRADE_CLOSED", "TRADE_CLOSED_BY_TAOBAO",
                                                  "FINISHED_L", "TRADE_CANCELED", "FINISHED_L", "TRADE_CANCELED", "STATUS_97", "STATUS_25",
                                                  "ORDER_FINISH", "ORDER_CANCEL", "已取消", "30", "40", "DS_DEAL_END_NORMAL", "已完成" };

                XMOrderInfo entityOrderInfo = XMOrderInfoService.GetXMOrderInfoByID(int.Parse(OrderID));
                if (status.Contains(entityOrderInfo.OrderStatus))
                {
                    btn_SaveClick.Enabled        = false;
                    btn_ReCalculateClick.Enabled = false;
                }
            }
        }
Exemple #4
0
        public void ToSave(string OrderCode, string wangwang, string ApplicationTypeId, string PaymentPerson, bool chk, int ID, string note, int NickId)
        {
            using (TransactionScope scope = new TransactionScope())
            {
                try
                {
                    string msg = "";
                    if (chk)
                    {
                        if (string.IsNullOrEmpty(OrderCode))
                        {
                            msg = "订单号不能为空!";
                            base.ShowMessage(msg);
                            return;
                        }
                        else
                        {
                            var OrderInfo = XMOrderInfoService.GetXMOrderByOrderCode(OrderCode);
                            if (OrderInfo == null)
                            {
                                msg = "该订单号的订单不存在!";
                                base.ShowMessage(msg);
                                return;
                            }
                        }
                    }
                    else
                    {
                        if (NickId == -1)
                        {
                            msg = "无订单号赠品,赔付单必须选择店铺!";
                            base.ShowMessage(msg);
                            return;
                        }
                    }

                    if (ApplicationTypeId == Convert.ToInt32(StatusEnum.ChildPayment).ToString() && PaymentPerson == "-1")
                    {
                        msg = "请先选择赔付方!";
                        base.ShowMessage(msg);
                        return;
                    }

                    //财务未审核
                    bool FinanceIsAudit = false;
                    //项目未审核
                    int ManagerStatus = 3;
                    //项目id
                    int projectID = 0;
                    //平台id
                    int platformTypeId = 0;

                    if (ID == 0)
                    {
                        List <XMPremiumsDetails> list = new List <XMPremiumsDetails>();
                        if (Session["PremiumsDetailList"] != null)
                        {
                            list = (List <XMPremiumsDetails>)Session["PremiumsDetailList"];
                        }

                        decimal priceAmount = (decimal)list.Sum(a => a.FactoryPrice * a.ProductNum);

                        XMPremiums XMPremium = new XMPremiums();
                        if (chk)
                        {
                            XMPremium.OrderCode = OrderCode; //订单号
                            XMPremium.WantId    = wangwang;  //旺旺号
                            var OrderInfo = XMOrderInfoService.GetXMOrderByOrderCode(OrderCode);
                            projectID      = OrderInfo.ProjectId;
                            platformTypeId = (int)OrderInfo.PlatformTypeId;
                        }
                        else
                        {
                            XMPremium.OrderCode     = "NoOrder" + DateTime.Now.ToString("yyMMddHHmmssfff");;
                            XMPremium.WantId        = "";
                            XMPremium.NoOrderNickId = NickId;
                            var xmNick = XMNickService.GetXMNickByID(NickId);
                            projectID      = (int)xmNick.ProjectId;
                            platformTypeId = (int)xmNick.PlatformTypeId;
                        }

                        var XMDeductionSetUp = XMDeductionSetUpService.GetXMDeductionSetUpByProjectAndPlatformTypeId(projectID, 476, platformTypeId);
                        if (XMDeductionSetUp != null)
                        {
                            //根据项目限额,平台限额,自动设置审核进度
                            if (priceAmount <= XMDeductionSetUp.Deduction)
                            {
                                FinanceIsAudit = true;
                                //项目审核
                                ManagerStatus = 4;
                            }
                            else if (priceAmount > XMDeductionSetUp.Deduction && priceAmount <= XMDeductionSetUp.Finance)
                            {
                                FinanceIsAudit = true;
                            }
                        }
                        else
                        {
                            //通用
                            var XMDeductionSetUpUsually = XMDeductionSetUpService.GetXMDeductionSetUpByProjectAndPlatformTypeId(projectID, 476, 508);
                            if (XMDeductionSetUpUsually != null)
                            {
                                //根据项目限额,平台限额,自动设置审核进度
                                if (priceAmount <= XMDeductionSetUpUsually.Deduction)
                                {
                                    FinanceIsAudit = true;
                                    //项目审核
                                    ManagerStatus = 4;
                                }
                                else if (priceAmount > XMDeductionSetUpUsually.Deduction && priceAmount <= XMDeductionSetUpUsually.Finance)
                                {
                                    FinanceIsAudit = true;
                                }
                            }
                        }

                        if (ApplicationTypeId == Convert.ToInt32(StatusEnum.ChildPayment).ToString() && PaymentPerson != "-1")
                        {
                            XMPremium.PaymentPerson = int.Parse(PaymentPerson);//赔付方
                        }
                        else
                        {
                            XMPremium.PaymentPerson = null;
                        }

                        XMPremium.PremiumsTypeId = int.Parse(ApplicationTypeId);//申请类型
                        XMPremium.ManagerStatus  = ManagerStatus;
                        XMPremium.PremiumsStatus = Convert.ToInt32(StatusEnum.PremiumsNoHair);
                        XMPremium.FinanceIsAudit = FinanceIsAudit;
                        XMPremium.IsEnable       = false;
                        XMPremium.IsEvaluation   = false;
                        XMPremium.IsSingleRow    = false;
                        XMPremium.CreatorID      = HozestERPContext.Current.User.CustomerID;
                        XMPremium.CreateTime     = DateTime.Now;
                        XMPremium.UpdatorID      = HozestERPContext.Current.User.CustomerID;
                        XMPremium.UpdateTime     = DateTime.Now;
                        XMPremium.Note           = note;
                        base.XMPremiumsService.InsertXMPremiums(XMPremium);


                        //更新ActivityExplanation
                        string p = "";
                        foreach (XMPremiumsDetails one in list)
                        {
                            one.PremiumsId  = XMPremium.Id;
                            one.IsSingleRow = false;
                            base.XMPremiumsDetailsService.InsertXMPremiumsDetails(one);

                            if (one.Specifications != "")
                            {
                                p += one.PrdouctName + "(" + one.Specifications + ")" + "*" + one.ProductNum + "+";
                            }
                            else
                            {
                                p += one.PrdouctName + "*" + one.ProductNum + "+";
                            }
                        }
                        if (p.Length > 0)
                        {
                            p = p.Substring(0, p.Length - 1);
                        }

                        XMPremium.ActivityExplanation = p;
                        base.XMPremiumsService.UpdateXMPremiums(XMPremium);

                        if (XMPremium.PremiumsTypeId == Convert.ToInt32(StatusEnum.ChildPayment))//赔付
                        {
                            if (!AddClaimInfo(XMPremium, NickId))
                            {
                                msg = "理赔管理中已有该理赔,不能新增修改;若要操作,请先删除!";
                                base.ShowMessage(msg);
                                return;
                            }
                        }

                        if (ApplicationTypeId != Convert.ToInt32(StatusEnum.ChildPayment).ToString())
                        {
                            this.wangwang.Value        = wangwang;
                            this.btnSave.Visible       = false;
                            this.txtScalpingCode.Value = XMPremium.OrderCode;
                            BindGrid();
                        }

                        msg = "保存成功!";
                        base.ShowMessage(msg);
                        scope.Complete();
                    }
                    else
                    {
                        string p = "";
                        var    premiumdetails = base.XMPremiumsDetailsService.GetXMPremiumsDetailsListByPremiumsId(ID);
                        foreach (var a in premiumdetails)
                        {
                            if (a.Specifications != "")
                            {
                                p += a.PrdouctName + "(" + a.Specifications + ")" + "*" + a.ProductNum + "+";
                            }
                            else
                            {
                                p += a.PrdouctName + "*" + a.ProductNum + "+";
                            }
                        }
                        if (p.Length > 0)
                        {
                            p = p.Substring(0, p.Length - 1);
                        }

                        decimal priceAmount = (decimal)premiumdetails.Sum(a => a.FactoryPrice);

                        var OrderInfo           = XMOrderInfoService.GetXMOrderByOrderCode(OrderCode);
                        int paramPlatformTypeId = -1;
                        int paramProjectId      = -1;
                        if (OrderInfo != null)
                        {
                            paramPlatformTypeId = (int)OrderInfo.PlatformTypeId;
                            paramProjectId      = OrderInfo.ProjectId;
                        }
                        var XMDeductionSetUp = XMDeductionSetUpService.GetXMDeductionSetUpByProjectAndPlatformTypeId(paramProjectId, 476, paramPlatformTypeId);

                        //根据项目限额,平台限额,自动设置审核进度
                        if (XMDeductionSetUp != null)
                        {
                            if (priceAmount <= XMDeductionSetUp.Deduction)
                            {
                                FinanceIsAudit = true;
                                //项目审核
                                ManagerStatus = 4;
                            }
                            else if (priceAmount > XMDeductionSetUp.Deduction && priceAmount <= XMDeductionSetUp.Finance)
                            {
                                FinanceIsAudit = true;
                            }
                        }
                        else
                        {
                            //通用
                            var XMDeductionSetUpUsually = XMDeductionSetUpService.GetXMDeductionSetUpByProjectAndPlatformTypeId(projectID, 476, 508);
                            if (XMDeductionSetUpUsually != null)
                            {
                                //根据项目限额,平台限额,自动设置审核进度
                                if (priceAmount <= XMDeductionSetUpUsually.Deduction)
                                {
                                    FinanceIsAudit = true;
                                    //项目审核
                                    ManagerStatus = 4;
                                }
                                else if (priceAmount > XMDeductionSetUpUsually.Deduction && priceAmount <= XMDeductionSetUpUsually.Finance)
                                {
                                    FinanceIsAudit = true;
                                }
                            }
                        }


                        var XMPremium = base.XMPremiumsService.GetXMPremiumsById(ID);
                        XMPremium.OrderCode           = OrderCode; //订单号
                        XMPremium.WantId              = wangwang;  //旺旺号
                        XMPremium.ActivityExplanation = p;

                        if (ApplicationTypeId == Convert.ToInt32(StatusEnum.ChildPayment).ToString() && PaymentPerson != "-1")
                        {
                            XMPremium.PaymentPerson = int.Parse(PaymentPerson);//赔付方
                        }
                        else
                        {
                            XMPremium.PaymentPerson = null;
                        }

                        if (!chk)
                        {
                            XMPremium.NoOrderNickId = NickId;
                        }

                        XMPremium.PremiumsTypeId = int.Parse(ApplicationTypeId);//申请类型
                        XMPremium.UpdatorID      = HozestERPContext.Current.User.CustomerID;
                        XMPremium.UpdateTime     = DateTime.Now;
                        XMPremium.Note           = note;
                        XMPremium.ManagerStatus  = ManagerStatus;
                        XMPremium.FinanceIsAudit = FinanceIsAudit;
                        base.XMPremiumsService.UpdateXMPremiums(XMPremium);

                        if (XMPremium.PremiumsTypeId == Convert.ToInt32(StatusEnum.ChildPayment))
                        {
                            if (!AddClaimInfo(XMPremium, NickId))
                            {
                                msg = "理赔管理中已有该理赔,不能新增修改;若要操作,请先删除!";
                                base.ShowMessage(msg);
                                return;
                            }
                        }

                        if (ApplicationTypeId != Convert.ToInt32(StatusEnum.ChildPayment).ToString())
                        {
                            this.wangwang.Value = wangwang;
                        }

                        base.ShowMessage("修改成功!");
                        scope.Complete();
                    }
                }
                catch (Exception err)
                {
                    this.ProcessException(err);
                }
            }
        }
        protected void btnCalculate_Click(object sender, DirectEventArgs e)
        {
            string OrderID = CommonHelper.QueryString("ID");

            XMOrderInfo entity_Order = XMOrderInfoService.GetXMOrderInfoByID(int.Parse(OrderID));

            if (entity_Order == null)
            {
                ExtNet.Msg.Alert("提示", "订单信息不存在").Show();
                return;
            }

            XMProject entity_Project = XMProjectService.GetXMProjectById(entity_Order.ProjectId);

            if (entity_Project == null)
            {
                ExtNet.Msg.Alert("提示", "项目信息不存在").Show();
                return;
            }

            if (entity_Project.ProjectName == "曲美")
            {
                //干线费用
                decimal mainMoney = 0;
                //支线费用
                decimal  branchMoney = 0;
                string   province    = entity_Order.Province;
                string   city        = entity_Order.City;
                string   region      = entity_Order.County;
                string[] mes         = entity_Order.CustomerServiceRemark.Split(new string[] { "///" }, StringSplitOptions.RemoveEmptyEntries);
                if (mes.Count() <= 0)
                {
                    ExtNet.Msg.Alert("提示", "解析错误").Show();
                    return;
                }
                string[] mes1 = mes[0].Split(new string[] { "+" }, StringSplitOptions.RemoveEmptyEntries);
                if (mes1.Count() <= 0)
                {
                    ExtNet.Msg.Alert("提示", "解析错误").Show();
                    return;
                }
                //查询干线物流公司信息
                List <CodeList> codeList = CodeService.GetCodeListInfoByCodeTypeIDAndCodeName(243, mes1[0]);
                if (codeList.Count <= 0)
                {
                    ExtNet.Msg.Alert("提示", "找不到干线物流公司信息").Show();
                    return;
                }

                int logisticsMainID = codeList[0].CodeID;
                //查询干线物流单价费率
                BusinessLogic.ManageProject.XMLogisticsFeeMain entityMain = XMLogisticsFeeMainService.
                                                                            getSingle(a => a.ProjectID == entity_Project.Id && a.WareHouseID == 758 && province.StartsWith(a.Province) && city.StartsWith(a.City) && region.StartsWith(a.Area) && a.LogisticsID == logisticsMainID);
                if (entityMain == null)
                {
                    ExtNet.Msg.Alert("提示", "找不到对应干线单价费率").Show();
                    return;
                }

                //只计算干线费用
                if (mes1.Count() == 1)
                {
                    //对应干线单价费率
                    decimal main = (decimal)entityMain.Fee;

                    List <XMOrderInfoProductDetails> list_OrderProductDetails = XMOrderInfoProductDetailsService.GetXMOrderInfoProductDetailsList(entity_Order.ID);
                    foreach (var item in list_OrderProductDetails)
                    {
                        string ProductVolume = string.IsNullOrEmpty(item.ProductVolume) ? "0" : item.ProductVolume;
                        mainMoney = mainMoney + main * decimal.Parse(ProductVolume) * (int)item.ProductNum;
                    }
                }
                //计算干线和支线费用
                else if (mes1.Count() == 2)
                {
                    //对应干线单价费率
                    decimal main = (decimal)entityMain.Fee;
                    //查询支线物流公司信息
                    List <CodeList> codeList1 = CodeService.GetCodeListInfoByCodeTypeIDAndCodeName(244, mes1[1]);
                    if (codeList.Count <= 0)
                    {
                        ExtNet.Msg.Alert("提示", "找不到支线物流公司信息").Show();
                        return;
                    }

                    List <XMOrderInfoProductDetails> list_OrderProductDetails = XMOrderInfoProductDetailsService.GetXMOrderInfoProductDetailsList(entity_Order.ID);
                    foreach (var item in list_OrderProductDetails)
                    {
                        //对应支线单价费率
                        decimal          Branch               = 0;
                        XMProduct        entityProduct        = XMProductService.getXMProductByManufacturersCode(item.TManufacturersCode);
                        XMProductDetails entityProductDetails = XMProductDetailsService.GetXMProductDetailsListByProductId(entityProduct.Id)[0];
                        //查询支线物流单价费率
                        int logisticsBranchID = codeList1[0].CodeID;
                        BusinessLogic.ManageProject.XMLogisticsFeeBranch entityBranch = XMLogisticsFeeBranchService.
                                                                                        getSingle(a => a.ProjectID == entity_Project.Id && a.LogisticsID == logisticsBranchID && a.ProductCategoryID == entityProductDetails.ProductTypeId);
                        if (entityBranch == null)
                        {
                            ExtNet.Msg.Alert("提示", "找不到对应支线单价费率").Show();
                            return;
                        }

                        Branch = (decimal)entityBranch.Fee;
                        //商品体积
                        string ProductVolume = string.IsNullOrEmpty(entityProduct.ProductVolume) ? "0" : entityProduct.ProductVolume;
                        mainMoney   = mainMoney + main * decimal.Parse(ProductVolume) * (int)item.ProductNum;
                        branchMoney = branchMoney + Branch * (int)item.ProductNum;
                    }
                }
                //事务
                using (TransactionScope scope = new TransactionScope())
                {
                    List <BusinessLogic.ManageProject.XMLogisticsFeeDetail> list = XMLogisticsFeeDetailService.getList(a => a.Type != 3);
                    foreach (var item in list)
                    {
                        XMLogisticsFeeDetailService.delete(item);
                    }

                    if (mainMoney >= 0)
                    {
                        XMLogisticsFeeDetailService.InsertXMLogisticsFeeDetail(new BusinessLogic.ManageProject.XMLogisticsFeeDetail()
                        {
                            OrderID    = entity_Order.ID,
                            Type       = 1,
                            Fee        = mainMoney,
                            CreateID   = HozestERPContext.Current.User.CustomerID,
                            CreateDate = DateTime.Now,
                        });
                    }
                    if (branchMoney >= 0)
                    {
                        XMLogisticsFeeDetailService.InsertXMLogisticsFeeDetail(new BusinessLogic.ManageProject.XMLogisticsFeeDetail()
                        {
                            OrderID    = entity_Order.ID,
                            Type       = 2,
                            Fee        = branchMoney,
                            CreateID   = HozestERPContext.Current.User.CustomerID,
                            CreateDate = DateTime.Now,
                        });
                    }

                    scope.Complete();
                }
            }
            else
            {
                ExtNet.Msg.Alert("提示", "不在计算范围内").Show();
                return;
            }
        }