Exemplo n.º 1
0
        private void BindGrid()
        {
            var data = XMProductService.getProductByMinPriceUnSet(brandTypeId);

            StoreWorker.DataSource = data;
            StoreWorker.DataBind();
        }
Exemplo n.º 2
0
        protected void btnExportProduct_Click(object sender, EventArgs e)
        {
            try
            {
                string fileName = string.Format("Exports_{0}_{1}.xls", DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss"), CommonHelper.GenerateRandomDigitCode(4));
                string filePath = string.Format("{0}Upload\\Product\\{1}", HttpContext.Current.Request.PhysicalApplicationPath, fileName);

                //产品名称
                string ProductName = this.txtProductName.Text.Trim();
                //厂家编码
                string FactoryCode = this.txtFactoryCode.Text.Trim();
                //商品编码
                string ProductCode = this.txtProductCode.Text.Trim();
                int    BrandTypeId = this.CCBrandTypeList.SelectedValue;

                List <XMProduct> list = XMProductService.GetXMProducts(BrandTypeId, ProductName, FactoryCode, ProductCode);

                ExportManager.ExportProductExcel(filePath, list);
                CommonHelper.WriteResponseXls(filePath, fileName);
            }
            catch (Exception exc)
            {
                ProcessException(exc);
            }
        }
Exemplo n.º 3
0
        private void BindGrid(int saleReturnID)
        {
            //绑定收款方式
            var codeList = base.CodeService.GetCodeListInfoByCodeTypeID(228, false);

            this.ddlPayment.DataSource     = codeList;
            this.ddlPayment.DataTextField  = "CodeName";
            this.ddlPayment.DataValueField = "CodeID";
            this.ddlPayment.DataBind();
            StringBuilder str = new StringBuilder();

            str.Append("<table class='table' id='MyPurchaseProductList'  style=\"width:100%\">");
            str.Append("<tr >");
            str.Append("<th>厂家编码</th><th>商品名称</th><th>尺寸规格</th><th>可退货数量</th><th>退货数量</th><th>单位</th><th>退货单价</th><th>退货金额</th><th>操作</th></tr>");
            //绑定退货入库单主表和产品明细表
            var saleReturn = base.XMSaleReturnService.GetXMSaleReturnById(saleReturnID);

            if (saleReturn != null)
            {
                lblRef.Text = saleReturn.Ref;
                var saleReturnDetails = base.XMSaleReturnProductDetailsService.GetXMSaleReturnProductDetailsListBySaleReturnID(saleReturnID);
                if (!string.IsNullOrEmpty(saleReturn.ProjectId.ToString()))
                {
                    ddXMProject.Value = saleReturn.ProjectId.ToString();
                }

                ddlPayment.SelectedValue = saleReturn.PaymentType.ToString();
                this.BindddXMProject();//项目
                if (saleReturn.ProjectId == -1)
                {
                    ddXMProject.SelectedIndex = 0;
                }
                else
                {
                    ddXMProject.Value = saleReturn.ProjectId.ToString();
                }
                this.ddXMProject_SelectedIndexChanged(null, null);//店铺
                ddlwareHouses.Value  = saleReturn.WarehouseId.ToString();
                txtNote.Text         = saleReturn.Remarks;
                txtStorageDate.Value = saleReturn.BizDt.ToString() == "" ? DateTime.Now.ToShortDateString() : saleReturn.BizDt.ToString();
                if (saleReturnDetails != null && saleReturnDetails.Count > 0)
                {
                    foreach (XMSaleReturnProductDetails info in saleReturnDetails)
                    {
                        string PlatformMerchantCode = "";
                        int    kSaleReturnCount     = 0;
                        if (info.DeliveryProductsDetailID != null && info.DeliveryProductsDetailID.ToString() != "")
                        {
                            //var deliveryp = base.XMSaleDeliveryProductDetailsService.GetXMSaleDeliveryProductDetailsById(info.DeliveryProductsDetailID.Value);
                            //var applicationExchange = XMApplicationExchangeService.GetXMApplicationExchangeByID((int)info.DeliveryProductsDetailID);
                            var product = XMProductService.GetXMProductById((int)info.ProductId);
                            if (product != null)
                            {
                                PlatformMerchantCode = product.ManufacturersCode;
                                //kSaleReturnCount = GetKReturnCount(deliveryp.SaleCount.Value, deliveryp.Id);
                            }
                        }
                        str.Append("<tr  id=\"mytr\">");
                        str.Append("<td id=\"PlatformMerchantCode\">" + PlatformMerchantCode + "</td><td id=\"ProductName\">" + info.ProductName + "</td><td>" + info.Specifications + "</td><td id=\"counts\"><input runat=\"server\" id=\"txtKCount\" class=\"TextBox\" style=\"text-align: left;width: 90%\" type=\"text\" value='" + kSaleReturnCount.ToString() + "'  readonly=\"readonly\"/></td><td id=\"count\"><input runat=\"server\" id=\"txtProductCount\" class=\"TextBox\" style=\"text-align: left;width: 90%\" type=\"text\" value='" + info.RejectionProdcutsCount.ToString() + "' /></td><td>" + info.ProductUnit + "</td><td id=\"Price\">" + info.RejectionProductsPrice.ToString() + "</td><td id=\"ProductMoney\">" + info.RejectionsaleMoney.ToString() + "</td>");
                        str.Append("<td id=\"PID\"><input id=\"hiddPID\"  type=\"hidden\"  value='" + info.Id + "'  /><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=SaleReturn&&ID=" + info.Id + "',400,600, this);\"/></td>");
                        str.Append("</tr>");
                    }
                }
                str.Append("</table>");
                TableStr = str.ToString();
            }
        }
        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;
            }
        }