当前位置: 首页>>代码示例>>C#>>正文


C# PDT_ProductBLL.GetProductExtInfo方法代码示例

本文整理汇总了C#中PDT_ProductBLL.GetProductExtInfo方法的典型用法代码示例。如果您正苦于以下问题:C# PDT_ProductBLL.GetProductExtInfo方法的具体用法?C# PDT_ProductBLL.GetProductExtInfo怎么用?C# PDT_ProductBLL.GetProductExtInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PDT_ProductBLL的用法示例。


在下文中一共展示了PDT_ProductBLL.GetProductExtInfo方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: bt_In_Click

    protected void bt_In_Click(object sender, EventArgs e)
    {
        Save();

        foreach (GridViewRow row in gv_NotInList.Rows)
        {
            CheckBox cb_check = (CheckBox)row.FindControl("cb_Check");
            if (cb_check.Checked)
            {
                PDT_StandardPriceBLL _bll;
                if ((int)ViewState["ID"] != 0)
                    _bll = new PDT_StandardPriceBLL((int)ViewState["ID"]);
                else
                    return;

                PDT_StandardPrice_Detail pd = new PDT_StandardPrice_Detail();
                pd.Product = int.Parse(gv_NotInList.DataKeys[row.RowIndex]["ID"].ToString());

                PDT_ProductBLL productbll = new PDT_ProductBLL(pd.Product);
                PDT_ProductExtInfo extinfo = productbll.GetProductExtInfo((int)Session["OwnerClient"]);
                if (extinfo != null)
                    pd.Price = extinfo.SalesPrice;
                else
                    pd.Price = productbll.Model.StdPrice;
                _bll.AddDetail(pd);
            }
        }
        Response.Redirect("StandardPriceDetail.aspx?ID=" + ViewState["ID"].ToString());
    }
开发者ID:fuhongliang,项目名称:GraduateProject,代码行数:29,代码来源:StandardPriceDetail.aspx.cs

示例2: bt_OK_Click

    protected void bt_OK_Click(object sender, EventArgs e)
    {
        PDT_ProductBLL _Product = null;
        PDT_ProductExtInfo extinfo = null;

        if ((int)ViewState["ID"] == 0)
        {
            _Product = new PDT_ProductBLL();
        }
        else
        {
            _Product = new PDT_ProductBLL((int)ViewState["ID"]);
            extinfo = _Product.GetProductExtInfo((int)Session["OwnerClient"]);
        }

        if (extinfo == null)
        {
            extinfo = new PDT_ProductExtInfo();
            extinfo.Supplier = (int)Session["OwnerClient"];
        }

        pl_detail.GetData(_Product.Model);
        pl_detail.GetData(extinfo);

        if ((int)ViewState["ID"] == 0)
        {
            _Product.Model.Category = extinfo.Category;
            _Product.Model.State = 1;
            _Product.Model.ApproveFlag = 1;
            _Product.Model.InsertStaff = (int)Session["UserID"];
            _Product.Model.OwnerType = 3;
            _Product.Model.OwnerClient = (int)Session["OwnerClient"];
            extinfo.InsertStaff = (int)Session["UserID"];

            ViewState["ID"] = _Product.Add();
        }
        else
        {
            if ((int)Session["OwnerClient"] == _Product.Model.OwnerClient)
            {
                _Product.Model.UpdateStaff = (int)Session["UserID"];
                _Product.Update();
            }
        }
        #region 将价格折算为最小单位
        extinfo.BuyPrice = extinfo.BuyPrice / _Product.Model.ConvertFactor;
        extinfo.SalesPrice = extinfo.SalesPrice / _Product.Model.ConvertFactor;
        extinfo.MaxSalesPrice = extinfo.MaxSalesPrice / _Product.Model.ConvertFactor;
        extinfo.MinSalesPrice = extinfo.MinSalesPrice / _Product.Model.ConvertFactor;
        #endregion

        _Product.SetProductExtInfo(extinfo);

        Response.Redirect("ProductList.aspx?Category=" + extinfo.Category.ToString());
    }
开发者ID:fuhongliang,项目名称:GraduateProject,代码行数:55,代码来源:ProductDetail.aspx.cs

示例3: select_Product_SelectChange

    protected void select_Product_SelectChange(object sender, MCSControls.MCSWebControls.SelectChangeEventArgs e)
    {
        int product = 0;
        int.TryParse(select_Product.SelectValue, out product);
        //int.TryParse(RadComboBox1.SelectedValue, out product);
        if (product != 0)
        {
            PDT_ProductBLL productbll = new PDT_ProductBLL(product);
            if (productbll.Model == null) return;
            PDT_Product p = productbll.Model;

            Dictionary<string, Dictionary_Data> dic = DictionaryBLL.GetDicCollections("PDT_Packaging");
            string _T = dic[p.TrafficPackaging.ToString()].Name;
            string _P = dic[p.Packaging.ToString()].Name;

            #region 显示批号及库存信息
            ddl_LotNumber.Items.Clear();
            //调拨,仅获取指定仓库可销售的批号
            foreach (INV_Inventory item in INV_InventoryBLL.GetInventoryListByProduct((int)ViewState["WareHouse"], product).OrderBy(t => t.LotNumber))
            {
                string invstr = (item.Quantity / p.ConvertFactor).ToString() + _T;
                if (item.Quantity % p.ConvertFactor > 0)
                    invstr += " " + (item.Quantity % p.ConvertFactor).ToString() + _P;

                ddl_LotNumber.Items.Add(new ListItem((item.LotNumber == "" ? "无批号" : item.LotNumber) +
                    " -【库存量:" + invstr + "】", item.LotNumber));
            }

            if (ddl_LotNumber.Items.Count == 0)
            {
                ddl_LotNumber.Items.Add(new ListItem("无批号", ""));
            }
            ddl_LotNumber_SelectedIndexChanged(null, null);
            #endregion

            #region 显示产品包装信息
            lb_TrafficPackagingName.Text = "元/" + _T + "(" + p.ConvertFactor.ToString() + _P + ")";
            #endregion

            #region 调拨价格为商品默认销售价
            decimal saleprice = 0;
            try
            {
                saleprice = productbll.GetProductExtInfo((int)Session["OwnerClient"]).SalesPrice;
            }
            catch { }

            if (saleprice > 0)
            {
                if (ddl_Unit.SelectedValue == "T")
                    tbx_Price.Text = (saleprice * p.ConvertFactor).ToString("0.###");
                else
                    tbx_Price.Text = saleprice.ToString("0.###");
                tbx_Price.Enabled = false;
            }
            else
            {
                tbx_Price.Text = "0";
                tbx_Price.Enabled = true;
            }
            #endregion

        }
    }
开发者ID:fuhongliang,项目名称:GraduateProject,代码行数:64,代码来源:TransferDetail.aspx.cs

示例4: TransWithVehicle

        /// <summary>
        /// 移库调拨申请
        /// </summary>
        /// <param name="User"></param>
        /// <param name="DeliveryInfo">移库单信息</param>
        /// <param name="ErrorInfo">出错消息</param>
        /// <returns></returns>
        public static int TransWithVehicle(UserInfo User, Delivery DeliveryInfo, out string ErrorInfo)
        {
            ErrorInfo = "";
            LogWriter.WriteLog("PBMIFService.TransWithVehicle:UserName=" + User.UserName +
                ",DeliveryInfo=" + JsonConvert.SerializeObject(DeliveryInfo));

            //经销商级人员,供货商只能是自己所属的经销商
            if (User.OwnerType == 3)
            {
                DeliveryInfo.Supplier = User.ClientID;
                DeliveryInfo.Client = User.ClientID;
            }

            if (DeliveryInfo.Classify != 5 && DeliveryInfo.Classify != 6)
            {
                ErrorInfo = "单据类别无效";
                return -1;
            }

            #region 根据车辆设置调入或调出车仓库
            //如果有送货车辆,默认出货仓库为该车辆所关联仓库
            if (DeliveryInfo.DeliveryVehicle != 0)
            {
                CM_Vehicle v = new CM_VehicleBLL(DeliveryInfo.DeliveryVehicle).Model;
                if (v == null) { ErrorInfo = "送货车辆无效!"; return -1; }

                if (DeliveryInfo.Classify == 5)
                {
                    //车销移库
                    DeliveryInfo.ClientWareHouse = v.RelateWareHouse;
                }
                else if (DeliveryInfo.Classify == 6)
                {
                    //车销退库
                    DeliveryInfo.SupplierWareHouse = v.RelateWareHouse;
                }
            }
            #endregion

            //默认业务人员为当前员工
            if (DeliveryInfo.SalesMan == 0) DeliveryInfo.SalesMan = User.StaffID;

            #region 必填字段校验
            if (DeliveryInfo.Supplier == 0 && DeliveryInfo.SupplierWareHouse != 0)
            {
                DeliveryInfo.Supplier = new CM_WareHouseBLL(DeliveryInfo.SupplierWareHouse).Model.Client;
            }
            if (DeliveryInfo.Supplier == 0) { ErrorInfo = "无效的客户!"; return -2; }
            if (DeliveryInfo.SupplierWareHouse == 0) { ErrorInfo = "无效的调出仓库!"; return -2; }
            if (DeliveryInfo.Client == 0) { DeliveryInfo.Client = DeliveryInfo.Supplier; }
            if (DeliveryInfo.ClientWareHouse == 0) { ErrorInfo = "无效的调入仓库!"; return -2; }
            if (DeliveryInfo.Items == null || DeliveryInfo.Items.Count == 0) { ErrorInfo = "无调拨产品明细!"; return -10; }
            #endregion

            PBM_DeliveryBLL bll = new PBM_DeliveryBLL();

            #region 保存发货单头信息
            bll.Model.SheetCode = "";
            bll.Model.Supplier = DeliveryInfo.Supplier;
            bll.Model.SupplierWareHouse = DeliveryInfo.SupplierWareHouse;
            bll.Model.Client = DeliveryInfo.Client;
            bll.Model.ClientWareHouse = DeliveryInfo.ClientWareHouse;
            bll.Model.Classify = DeliveryInfo.Classify;              //5:车销移库 6:车销退库
            bll.Model.SalesMan = User.StaffID;
            bll.Model.PrepareMode = 1;           //1:快捷模式
            bll.Model.State = 1;                 //默认制单状态
            bll.Model.DeliveryVehicle = DeliveryInfo.DeliveryVehicle;
            bll.Model.Remark = DeliveryInfo.Remark;
            bll.Model.ApproveFlag = 2;
            bll.Model.InsertStaff = User.StaffID;
            #endregion

            #region 循环处理每个发货单明细
            foreach (Delivery.DeliveryDetail item in DeliveryInfo.Items)
            {
                if (item.Product == 0) continue;
                if (item.DeliveryQuantity <= 0 && item.SignInQuantity <= 0) continue;

                string lotnumber = item.LotNumber.Trim();
                int quantity = item.DeliveryQuantity <= 0 ? item.SignInQuantity : item.DeliveryQuantity;

                PDT_ProductBLL productbll = new PDT_ProductBLL(item.Product);
                if (productbll.Model == null) { ErrorInfo = "无效产品项,产品ID:" + item.Product; return -11; }
                PDT_ProductExtInfo extinfo = productbll.GetProductExtInfo(bll.Model.Supplier);
                if (productbll.Model == null) { ErrorInfo = "产品不在销售商的经营目录中," + productbll.Model.FullName; return -11; }

                //判断库存是否够销售
                int inv_quantity = INV_InventoryBLL.GetProductQuantity(bll.Model.SupplierWareHouse, item.Product, lotnumber);
                if (quantity > inv_quantity)
                {
                    ErrorInfo = "产品[" + productbll.Model.FullName + "]库存不足,当前库存:" + inv_quantity.ToString();
                    return -11;
                }
//.........这里部分代码省略.........
开发者ID:fuhongliang,项目名称:GraduateProject,代码行数:101,代码来源:PBMService.cs

示例5: SaleOut_Update

        /// <summary>
        /// 验证销售单,当在执行预售送货时,或在收款单变更了销售单明细时,需要调用此接口更新销售单
        /// </summary>
        /// <param name="User"></param>
        /// <param name="DeliveryInfo"></param>
        /// <param name="ErrorInfo"></param>
        /// <returns></returns>
        public static int SaleOut_Update(UserInfo User, Delivery DeliveryInfo, out string ErrorInfo)
        {
            ErrorInfo = "";
            LogWriter.WriteLog("PBMIFService.SaleOut_Update:UserName=" + User.UserName +
                ",DeliveryInfo=" + JsonConvert.SerializeObject(DeliveryInfo));

            if (DeliveryInfo.ID == 0) { ErrorInfo = "销售单不存在,请先新增销售单!"; return -1; }

            PBM_DeliveryBLL bll = new PBM_DeliveryBLL(DeliveryInfo.ID);
            if (bll.Model == null) { ErrorInfo = "销售单不存在,请先新增销售单!"; return -1; }
            if (bll.Model.State > 3 || bll.Model.ApproveFlag == 1) { ErrorInfo = "销售单状态不允许执行此操作!"; return -1; }

            if (bll.Model.Supplier == 0) bll.Model.Supplier = DeliveryInfo.Supplier;
            if (bll.Model.Client == 0) bll.Model.Client = DeliveryInfo.Client;

            //如果有送货车辆,默认出货仓库为该车辆所关联仓库
            if (DeliveryInfo.DeliveryVehicle != 0 && DeliveryInfo.SupplierWareHouse == 0)
            {
                CM_Vehicle v = new CM_VehicleBLL(DeliveryInfo.DeliveryVehicle).Model;
                if (v == null) { ErrorInfo = "送货车辆无效!"; return -1; }

                DeliveryInfo.SupplierWareHouse = v.RelateWareHouse;
            }

            //默认业务人员为当前员工
            if (DeliveryInfo.SalesMan == 0) DeliveryInfo.SalesMan = User.StaffID;

            #region 必填字段校验
            if (bll.Model.Supplier == 0) { ErrorInfo = "无效的供货客户!"; return -2; }
            if (User.OwnerType == 3 && bll.Model.Supplier != User.ClientID) { ErrorInfo = "无效的供货客户!"; return -2; }
            if (bll.Model.Client == 0) { ErrorInfo = "无效的购买客户!"; return -2; }

            if (DeliveryInfo.SupplierWareHouse == 0) { ErrorInfo = "无效的供货仓库!"; return -2; }
            if (DeliveryInfo.Items == null || DeliveryInfo.Items.Count == 0) { ErrorInfo = "无销售产品明细!"; return -10; }
            #endregion

            #region 保存销售单头信息
            bll.Model.SalesMan = DeliveryInfo.SalesMan;
            bll.Model.DeliveryVehicle = DeliveryInfo.DeliveryVehicle;
            bll.Model.SupplierWareHouse = DeliveryInfo.SupplierWareHouse;
            bll.Model.WipeAmount = DeliveryInfo.WipeAmount;

            bll.Model.WorkList = DeliveryInfo.WorkList;
            bll.Model.Remark = DeliveryInfo.Remark;
            #endregion

            #region 循环处理每个订单明细
            foreach (Delivery.DeliveryDetail item in DeliveryInfo.Items)
            {
                if (item.Product == 0) continue;
                if (item.DeliveryQuantity <= 0 && item.SignInQuantity <= 0)
                {
                    if (item.DetailID == 0)
                        continue;
                    else
                        bll.DeleteDetail(item.DetailID);
                }

                string lotnumber = item.LotNumber.Trim();

                int quantity = 0;
                if (bll.Model.State == 1)
                    quantity = item.DeliveryQuantity == 0 ? item.SignInQuantity : item.DeliveryQuantity;
                else
                    quantity = item.SignInQuantity;

                string remark = item.Remark;

                PDT_ProductBLL productbll = new PDT_ProductBLL(item.Product);
                if (productbll.Model == null) { ErrorInfo = "无效产品项,产品ID:" + item.Product; return -11; }
                PDT_ProductExtInfo extinfo = productbll.GetProductExtInfo(bll.Model.Supplier);
                if (productbll.Model == null) { ErrorInfo = "产品不在销售商的经营目录中," + productbll.Model.FullName; return -11; }

                if (bll.Model.Classify != 2)
                {
                    //不为退货单时,判断车库存是否够销售
                    int inv_quantity = INV_InventoryBLL.GetProductQuantity(bll.Model.SupplierWareHouse, item.Product, lotnumber);
                    if (quantity > inv_quantity)
                    {
                        ErrorInfo = "产品[" + productbll.Model.FullName + "]库存不足,当前库存:" + inv_quantity.ToString();
                        return -11;
                    }
                }

                if (item.DetailID > 0)
                {
                    PBM_DeliveryDetail d = bll.GetDetailModel(item.DetailID);

                    if (bll.Model.State == 1) d.DeliveryQuantity = quantity;
                    d.SignInQuantity = item.SignInQuantity;
                    d.LotNumber = lotnumber;
                    d.Remark = item.Remark;
                    bll.UpdateDetail(d);
//.........这里部分代码省略.........
开发者ID:fuhongliang,项目名称:GraduateProject,代码行数:101,代码来源:PBMService.cs

示例6: SaleOut_Add

        /// <summary>
        /// 新增销售发货单
        /// </summary>
        /// <param name="User"></param>
        /// <param name="DeliveryInfo">发货单信息</param>
        /// <param name="ErrorInfo">出错消息</param>
        /// <returns></returns>
        public static int SaleOut_Add(UserInfo User, Delivery DeliveryInfo, out string ErrorInfo)
        {
            ErrorInfo = "";
            LogWriter.WriteLog("PBMIFService.SaleOut_Add:UserName=" + User.UserName +
                ",DeliveryInfo=" + JsonConvert.SerializeObject(DeliveryInfo));

            //经销商级人员,供货商只能是自己所属的经销商
            if (User.OwnerType == 3) DeliveryInfo.Supplier = User.ClientID;

            //如果有送货车辆,默认出货仓库为该车辆所关联仓库
            if (DeliveryInfo.DeliveryVehicle != 0 && DeliveryInfo.SupplierWareHouse == 0)
            {
                CM_Vehicle v = new CM_VehicleBLL(DeliveryInfo.DeliveryVehicle).Model;
                if (v == null) { ErrorInfo = "送货车辆无效!"; return -1; }

                DeliveryInfo.SupplierWareHouse = v.RelateWareHouse;
            }

            //默认业务人员为当前员工
            if (DeliveryInfo.SalesMan == 0) DeliveryInfo.SalesMan = User.StaffID;

            #region 必填字段校验
            if (DeliveryInfo.Supplier == 0) { ErrorInfo = "无效的供货客户!"; return -2; }
            if (DeliveryInfo.Client == 0) { ErrorInfo = "无效的购买客户!"; return -2; }
            if (DeliveryInfo.SupplierWareHouse == 0) { ErrorInfo = "无效的供货仓库!"; return -2; }
            if (DeliveryInfo.Items == null || DeliveryInfo.Items.Count == 0) { ErrorInfo = "无销售产品明细!"; return -10; }
            #endregion

            PBM_DeliveryBLL bll = new PBM_DeliveryBLL();

            #region 保存销售单头信息
            bll.Model.SheetCode = "";
            bll.Model.Supplier = DeliveryInfo.Supplier;
            bll.Model.SupplierWareHouse = DeliveryInfo.SupplierWareHouse;
            bll.Model.Client = DeliveryInfo.Client;
            bll.Model.SalesMan = DeliveryInfo.SalesMan;
            bll.Model.Classify = (DeliveryInfo.Classify == 0 ? 1 : DeliveryInfo.Classify);              //默认销售单
            bll.Model.PrepareMode = (DeliveryInfo.PrepareMode == 0 ? 2 : DeliveryInfo.PrepareMode);     //默认车销模式
            bll.Model.State = 1;        //默认制单状态
            bll.Model.StandardPrice = DeliveryInfo.StandardPrice;
            bll.Model.OrderId = DeliveryInfo.OrderID;
            bll.Model.WipeAmount = DeliveryInfo.WipeAmount;
            bll.Model.DeliveryVehicle = DeliveryInfo.DeliveryVehicle;
            bll.Model.WorkList = DeliveryInfo.WorkList;
            bll.Model.Remark = DeliveryInfo.Remark;
            bll.Model.ApproveFlag = 2;
            bll.Model.InsertStaff = User.StaffID;
            #endregion

            #region 循环处理每个订单明细
            foreach (Delivery.DeliveryDetail item in DeliveryInfo.Items)
            {
                if (item.Product == 0) continue;
                if (item.DeliveryQuantity <= 0 && item.SignInQuantity <= 0) continue;

                string lotnumber = item.LotNumber.Trim();
                int deliveryquantity = item.DeliveryQuantity <= 0 ? item.SignInQuantity : item.DeliveryQuantity;

                PDT_ProductBLL productbll = new PDT_ProductBLL(item.Product);
                if (productbll.Model == null) { ErrorInfo = "无效产品项,产品ID:" + item.Product; return -11; }
                PDT_ProductExtInfo extinfo = productbll.GetProductExtInfo(bll.Model.Supplier);
                if (productbll.Model == null) { ErrorInfo = "产品不在销售商的经营目录中," + productbll.Model.FullName; return -11; }

                if (bll.Model.Classify != 2)
                {
                    //不为退货单时,判断车库存是否够销售
                    int inv_quantity = INV_InventoryBLL.GetProductQuantity(bll.Model.SupplierWareHouse, item.Product, lotnumber);
                    if (deliveryquantity > inv_quantity)
                    {
                        ErrorInfo = "产品[" + productbll.Model.FullName + "]库存不足,当前库存:" + inv_quantity.ToString();
                        return -11;
                    }
                }

                #region 新增销售明细
                PBM_DeliveryDetail d = new PBM_DeliveryDetail();

                d.Product = item.Product;
                d.LotNumber = lotnumber;
                d.SalesMode = item.SalesMode == 0 ? 1 : item.SalesMode;     //默认为“销售”

                if (item.Price > 0)
                    d.Price = item.Price;
                else
                    d.Price = PDT_StandardPriceBLL.GetSalePrice(bll.Model.Client, bll.Model.Supplier, d.Product);       //默认销售价

                if (d.SalesMode == 1)
                    d.DiscountRate = (item.DiscountRate <= 0 || item.DiscountRate > 1) ? 1 : item.DiscountRate;
                else
                    d.DiscountRate = 0;     //非销售时,0折销售

                d.ConvertFactor = productbll.Model.ConvertFactor == 0 ? 1 : productbll.Model.ConvertFactor;
                d.DeliveryQuantity = deliveryquantity;
//.........这里部分代码省略.........
开发者ID:fuhongliang,项目名称:GraduateProject,代码行数:101,代码来源:PBMService.cs

示例7: Order_Update

        /// <summary>
        /// 更新预售订单
        /// </summary>
        /// <param name="User"></param>
        /// <param name="OrderInfo"></param>
        /// <param name="ErrorInfo"></param>
        /// <returns></returns>
        public static int Order_Update(UserInfo User, Order OrderInfo, out string ErrorInfo)
        {
            ErrorInfo = "";
            LogWriter.WriteLog("PBMIFService.Order_Update:UserName=" + User.UserName +
                ",OrderInfo=" + JsonConvert.SerializeObject(OrderInfo));

            if (OrderInfo.ID == 0) { ErrorInfo = "销售订单不存在,请先新增销售订单!"; return -1; }

            PBM_OrderBLL bll = new PBM_OrderBLL(OrderInfo.ID);
            if (bll.Model == null) { ErrorInfo = "订货单不存在,请先新增订货单!"; return -1; }
            if (bll.Model.State > 1 || bll.Model.ApproveFlag == 1) { ErrorInfo = "订货单状态不允许执行此操作!"; return -1; }

            if (bll.Model.Supplier == 0) bll.Model.Supplier = OrderInfo.Supplier;
            if (bll.Model.Client == 0) bll.Model.Client = OrderInfo.Client;

            //默认业务人员为当前员工
            if (OrderInfo.SalesMan == 0) OrderInfo.SalesMan = User.StaffID;

            #region 必填字段校验
            if (bll.Model.Supplier == 0) { ErrorInfo = "无效的供货客户!"; return -2; }
            if (User.OwnerType == 3 && bll.Model.Supplier != User.ClientID) { ErrorInfo = "无效的供货客户!"; return -2; }
            if (bll.Model.Client == 0) { ErrorInfo = "无效的购买客户!"; return -2; }

            if (OrderInfo.Items == null || OrderInfo.Items.Count == 0) { ErrorInfo = "无订货产品明细!"; return -10; }
            #endregion

            #region 保存订货单头信息
            bll.Model.SalesMan = OrderInfo.SalesMan;
            bll.Model.WipeAmount = OrderInfo.WipeAmount;
            bll.Model.ArriveTime = OrderInfo.ArriveTime < DateTime.Today ? DateTime.Today.AddDays(1) : OrderInfo.ArriveTime;
            bll.Model.WorkList = OrderInfo.WorkList;
            bll.Model.Remark = OrderInfo.Remark;
            #endregion

            #region 循环处理每个订单明细
            foreach (Order.OrderDetail item in OrderInfo.Items)
            {
                if (item.Product == 0) continue;
                if (item.BookQuantity <= 0 && item.ConfirmQuantity <= 0)
                {
                    if (item.DetailID == 0)
                        continue;
                    else
                        bll.DeleteDetail(item.DetailID);
                }

                int quantity = item.BookQuantity == 0 ? item.ConfirmQuantity : item.BookQuantity;

                string remark = item.Remark;

                PDT_ProductBLL productbll = new PDT_ProductBLL(item.Product);
                if (productbll.Model == null) { ErrorInfo = "无效产品项,产品ID:" + item.Product; return -11; }
                PDT_ProductExtInfo extinfo = productbll.GetProductExtInfo(bll.Model.Supplier);
                if (productbll.Model == null) { ErrorInfo = "产品不在销售商的经营目录中," + productbll.Model.FullName; return -11; }

                if (item.DetailID > 0)
                {
                    PBM_OrderDetail d = bll.GetDetailModel(item.DetailID);

                    d.ConvertFactor = productbll.Model.ConvertFactor == 0 ? 1 : productbll.Model.ConvertFactor;
                    d.BookQuantity = quantity;
                    d.ConfirmQuantity = quantity;
                    d.Remark = item.Remark;
                    bll.UpdateDetail(d);
                }
                else
                {
                    #region 新增商品明细品项
                    PBM_OrderDetail d = new PBM_OrderDetail();

                    d.Product = item.Product;
                    d.SalesMode = item.SalesMode == 0 ? 1 : item.SalesMode;     //默认为“销售”

                    d.Price = PDT_StandardPriceBLL.GetSalePrice(bll.Model.Client, bll.Model.Supplier, d.Product);
                    if (d.SalesMode == 1)
                        d.DiscountRate = (item.DiscountRate <= 0 || item.DiscountRate > 1) ? 1 : item.DiscountRate;
                    else
                        d.DiscountRate = 0;

                    d.BookQuantity = quantity;
                    d.ConfirmQuantity = d.BookQuantity;
                    d.Remark = item.Remark;

                    bll.AddDetail(d);
                    #endregion
                }
            }
            #endregion

            //计算折扣金额
            bll.Model.DiscountAmount = bll.Items.Sum(p => (1 - p.DiscountRate) *
                Math.Round(p.Price * p.ConvertFactor, 2) * p.ConfirmQuantity / p.ConvertFactor);

//.........这里部分代码省略.........
开发者ID:fuhongliang,项目名称:GraduateProject,代码行数:101,代码来源:PBMService.cs

示例8: Order_Add

        /// <summary>
        /// 新增预售订单
        /// </summary>
        /// <param name="User"></param>
        /// <param name="OrderInfo">发货单信息</param>
        /// <param name="ErrorInfo">出错消息</param>
        /// <returns></returns>
        public static int Order_Add(UserInfo User, Order OrderInfo, out string ErrorInfo)
        {
            ErrorInfo = "";
            LogWriter.WriteLog("PBMIFService.Order_Add:UserName=" + User.UserName +
                ",OrderInfo=" + JsonConvert.SerializeObject(OrderInfo));

            //经销商级人员,供货商只能是自己所属的经销商
            if (User.OwnerType == 3) OrderInfo.Supplier = User.ClientID;

            //默认业务人员为当前员工
            if (OrderInfo.SalesMan == 0) OrderInfo.SalesMan = User.StaffID;

            #region 必填字段校验
            if (OrderInfo.Supplier == 0) { ErrorInfo = "无效的供货客户!"; return -2; }
            if (OrderInfo.Client == 0) { ErrorInfo = "无效的购买客户!"; return -2; }
            if (OrderInfo.Items == null || OrderInfo.Items.Count == 0) { ErrorInfo = "无销售产品明细!"; return -10; }
            #endregion

            PBM_OrderBLL bll = new PBM_OrderBLL();

            #region 保存销售单头信息
            bll.Model.SheetCode = "";
            bll.Model.Supplier = OrderInfo.Supplier;
            bll.Model.Client = OrderInfo.Client;
            bll.Model.SalesMan = OrderInfo.SalesMan;
            bll.Model.Classify = (OrderInfo.Classify == 0 ? 1 : OrderInfo.Classify);              //默认销售单
            bll.Model.State = 1;        //默认制单状态
            bll.Model.StandardPrice = OrderInfo.StandardPrice;

            bll.Model.WipeAmount = OrderInfo.WipeAmount;
            bll.Model.ArriveTime = OrderInfo.ArriveTime < DateTime.Today ? DateTime.Today.AddDays(1) : OrderInfo.ArriveTime;
            bll.Model.WorkList = OrderInfo.WorkList;
            bll.Model.Remark = OrderInfo.Remark;
            bll.Model.ApproveFlag = 2;
            bll.Model.InsertStaff = User.StaffID;

            //订单来源
            bll.Model["OrderSource"] = OrderInfo.OrderSource > 0 ? OrderInfo.OrderSource.ToString() : "2";

            #endregion

            #region 循环处理每个订单明细
            foreach (Order.OrderDetail item in OrderInfo.Items)
            {
                if (item.Product == 0) continue;
                if (item.BookQuantity <= 0 && item.ConfirmQuantity <= 0) continue;

                int bookquantity = item.BookQuantity <= 0 ? item.ConfirmQuantity : item.BookQuantity;

                PDT_ProductBLL productbll = new PDT_ProductBLL(item.Product);
                if (productbll.Model == null) { ErrorInfo = "无效产品项,产品ID:" + item.Product; return -11; }
                PDT_ProductExtInfo extinfo = productbll.GetProductExtInfo(bll.Model.Supplier);
                if (productbll.Model == null) { ErrorInfo = "产品不在销售商的经营目录中," + productbll.Model.FullName; return -11; }

                #region 新增商品明细
                PBM_OrderDetail d = new PBM_OrderDetail();

                d.Product = item.Product;
                d.SalesMode = item.SalesMode == 0 ? 1 : item.SalesMode;     //默认为“销售”

                if (item.Price > 0)
                    d.Price = item.Price;
                else
                    d.Price = PDT_StandardPriceBLL.GetSalePrice(bll.Model.Client, bll.Model.Supplier, d.Product);       //默认销售价

                if (d.SalesMode == 1)
                    d.DiscountRate = (item.DiscountRate <= 0 || item.DiscountRate > 1) ? 1 : item.DiscountRate;
                else
                    d.DiscountRate = 0;     //非销售时,0折销售

                d.ConvertFactor = productbll.Model.ConvertFactor == 0 ? 1 : productbll.Model.ConvertFactor;
                d.BookQuantity = bookquantity;
                d.ConfirmQuantity = d.BookQuantity;
                d.Remark = item.Remark;

                bll.Items.Add(d);
                #endregion
            }
            #endregion

            //计算折扣金额
            bll.Model.DiscountAmount = bll.Items.Sum(p => (1 - p.DiscountRate) *
                Math.Round(p.Price * p.ConvertFactor, 2) * p.ConfirmQuantity / p.ConvertFactor);

            //计算实际销售金额
            bll.Model.ActAmount = Math.Round((bll.Model.Classify == 2 ? -1 : 1) *
                bll.Items.Sum(p => p.DiscountRate * Math.Round(p.Price * p.ConvertFactor, 2) * p.ConfirmQuantity / p.ConvertFactor)
                - bll.Model.WipeAmount, 2);

            int orderid = bll.Add();
            if (orderid <= 0) { ErrorInfo = "销售订单保存失败!"; return orderid; }

            #region 判断订单是否直接提交
//.........这里部分代码省略.........
开发者ID:fuhongliang,项目名称:GraduateProject,代码行数:101,代码来源:PBMService.cs

示例9: ImportSAPService


//.........这里部分代码省略.........
                            bll.Model.InsertStaff = 1;
                            DateTime _prearrivaldate = DateTime.Today;
                            DateTime.TryParse(item.WadatIst, out _prearrivaldate);
                            bll.Model.PreArrivalDate = _prearrivaldate;
                            #endregion
                        }

                        #region 新增商品明细
                        string productcode = item.Matnr.Substring(item.Matnr.Length - 6);
                        IList<PDT_Product> _products = PDT_ProductBLL.GetModelList("FactoryCode='" + productcode + "' AND State=1");
                        if (_products.Count == 0)
                        {
                            SendMessage("ImportSAPService", "商品编码无效,单据号" + item.Vgbel + ",商品编号:" + productcode);
                            continue;
                        }
                        int productid = _products[0].ID;
                        PDT_ProductBLL productbll = new PDT_ProductBLL(productid);

                        PBM_DeliveryDetail d = new PBM_DeliveryDetail();
                        d.Product = productid;
                        d.ConvertFactor = _products[0].ConvertFactor == 0 ? 1 : _products[0].ConvertFactor;
                        d.SalesMode = 1;
                        d.DeliveryQuantity = (int)Math.Round(item.Fkimg * d.ConvertFactor, 0);

                        if (d.DeliveryQuantity < 0)
                        {
                            bll.Model.Classify = 12;        //采购退库单
                            d.DeliveryQuantity = 0 - d.DeliveryQuantity;
                        }

                        d.SignInQuantity = d.DeliveryQuantity;
                        d.CostPrice = Math.Round(item.Kzwi / d.DeliveryQuantity, 4);
                        d.Price = d.CostPrice;
                        d.DiscountRate = Math.Round(item.Kzwi5 / item.Kzwi, 4);
                        d.LotNumber = item.Charg;
                        totalamount += item.Kzwi5;

                        DateTime _productdate = new DateTime(1900, 1, 1);
                        DateTime.TryParse(item.Hsdat, out _productdate);

                        if (_productdate.Year < 1900) _productdate = new DateTime(1900, 1, 1);
                        d.ProductDate = _productdate;
                        d.Remark = item.Fkart;

                        bll.Items.Add(d);
                        #endregion

                        #region 判断是否在默认价表中
                        PDT_ProductExtInfo extinfo = productbll.GetProductExtInfo(bll.Model.Client);
                        if (extinfo == null)
                        {
                            extinfo = new PDT_ProductExtInfo();
                            extinfo.Supplier = bll.Model.Client;
                            extinfo.Product = productid;
                            extinfo.Category = productbll.Model.Category;
                            extinfo.Code = productbll.Model.FactoryCode;
                            extinfo.SalesState = 1;
                            extinfo.BuyPrice = d.Price;
                            extinfo.SalesPrice = d.Price;
                            new PDT_ProductBLL(productid).SetProductExtInfo(extinfo);
                        }
                        #endregion
                    }

                    #region 更新发货单
                    if (bll.Model.SheetCode != "" && bll.Items.Count > 0)
                    {
                        //计算折扣金额
                        bll.Model.DiscountAmount = bll.Items.Sum(p => (1 - p.DiscountRate) *
                            Math.Round(p.Price * p.ConvertFactor, 2) * p.DeliveryQuantity / p.ConvertFactor);

                        //计算实际销售金额
                        bll.Model.ActAmount = Math.Round((bll.Model.Classify == 12 ? -1 : 1) *
            bll.Items.Sum(p => p.DiscountRate * Math.Round(p.Price * p.ConvertFactor, 2) * p.SignInQuantity / p.ConvertFactor)
            - bll.Model.WipeAmount, 2);

                        int ret = bll.Add();
                        if (ret > 0)
                            SendMessage("ImportSAPService", "单据号" + bll.Model.SheetCode + ",提交成功,总金额" + bll.Model.ActAmount.ToString("0.##") + "!");
                        else
                            SendMessage("ImportSAPService", "单据号" + bll.Model.SheetCode + ",提交失败!Ret=" + ret.ToString());
                    }
                    #endregion

                    Thread.Sleep(3600 * 1000);
                }
                catch (ThreadAbortException e)
                {
                    this.SendMessage("ImportSAPService.ThreadAbortException", e.Message);
                    Thread.Sleep(10000);
                    continue;
                }
                catch (Exception ex)
                {
                    this.SendMessage("ImportSAPService.Exception", ex.Message);
                    Thread.Sleep(10000);
                    continue;
                }
            }
        }
开发者ID:fuhongliang,项目名称:GraduateProject,代码行数:101,代码来源:ImportExcel.cs

示例10: rbl_ln_SelectedIndexChanged

    protected void rbl_ln_SelectedIndexChanged(object sender, EventArgs e)
    {
        ddl_LotNumber.Visible = rbl_ln.SelectedValue != "N";
        tbx_LotNumber.Visible = rbl_ln.SelectedValue == "N";
        tbx_ProductDate.Enabled = rbl_ln.SelectedValue == "N";

        if (rbl_ln.SelectedValue == "Y")
        {
            int product = 0;
            int.TryParse(select_Product.SelectValue, out product);
            //int.TryParse(RadComboBox1.SelectedValue, out product);
            if (product != 0)
            {
                PDT_ProductBLL productbll = new PDT_ProductBLL(product, true);
                if (productbll.Model == null) return;
                PDT_Product p = productbll.Model;

                Dictionary<string, Dictionary_Data> dic = DictionaryBLL.GetDicCollections("PDT_Packaging");
                string _T = dic[p.TrafficPackaging.ToString()].Name;
                string _P = dic[p.Packaging.ToString()].Name;

                #region 显示批号及库存信息
                ddl_LotNumber.Items.Clear();
                foreach (INV_Inventory item in INV_InventoryBLL.GetInventoryListByProduct((int)ViewState["WareHouse"], product))
                {
                    //ddl_LotNumber.Items.Add(new ListItem((item.LotNumber == "" ? "无批号" : item.LotNumber), item.LotNumber));
                    string invstr = (item.Quantity / p.ConvertFactor).ToString() + _T;
                    if (item.Quantity % p.ConvertFactor > 0)
                        invstr += " " + (item.Quantity % p.ConvertFactor).ToString() + _P;
                    ddl_LotNumber.Items.Add(new ListItem((item.LotNumber == "" ? "无批号" : item.LotNumber) + "-【库存量:" + invstr + "】", item.LotNumber));
                }
                #endregion

                ddl_LotNumber_SelectedIndexChanged(null, null);
            }
        }
        else
        {
            tbx_LotNumber.Text = "";
            tbx_ProductDate.Text = "";

            int product = 0;
            int.TryParse(select_Product.SelectValue, out product);
            //int.TryParse(RadComboBox1.SelectedValue, out product);
            if (product != 0)
            {
                PDT_ProductBLL productbll = new PDT_ProductBLL(product, true);
                if (productbll.Model == null) return;

                PDT_ProductExtInfo extinfo = productbll.GetProductExtInfo((int)Session["OwnerClient"]);
                if (extinfo == null) return;

                if (ddl_Unit.SelectedValue == "T")
                    tbx_Price.Text = (extinfo.BuyPrice * productbll.Model.ConvertFactor).ToString("0.##");
                else
                    tbx_Price.Text = extinfo.BuyPrice.ToString("0.##");
            }
        }
    }
开发者ID:fuhongliang,项目名称:GraduateProject,代码行数:59,代码来源:PurchaseDetail.aspx.cs

示例11: BindData

    private void BindData()
    {
        PDT_ProductBLL bll = new PDT_ProductBLL((int)ViewState["ID"]);
        if (bll.Model == null)
        {
            Response.Redirect("ProductList.aspx.aspx");
            return;
        }
        if (bll.Model.ConvertFactor == 0) bll.Model.ConvertFactor = 1;
        pl_detail.BindData(bll.Model);

        PDT_ProductExtInfo extinfo = bll.GetProductExtInfo((int)Session["OwnerClient"]);
        if (extinfo != null)
        {
            #region 将价格折算为整件单位
            extinfo.BuyPrice = extinfo.BuyPrice * bll.Model.ConvertFactor;
            extinfo.SalesPrice = extinfo.SalesPrice * bll.Model.ConvertFactor;
            extinfo.MaxSalesPrice = extinfo.MaxSalesPrice * bll.Model.ConvertFactor;
            extinfo.MinSalesPrice = extinfo.MinSalesPrice * bll.Model.ConvertFactor;
            #endregion
            pl_detail.BindData(extinfo);
        }

        if (bll.Model.OwnerClient != (int)Session["OwnerClient"])
        {
            pl_detail.SetPanelEnable("Panel_TDP_PDT_Product_Detail_01", false);
        }

        bt_OK.Text = "修改";
        bt_OK.ForeColor = System.Drawing.Color.Red;
    }
开发者ID:fuhongliang,项目名称:GraduateProject,代码行数:31,代码来源:ProductDetail.aspx.cs

示例12: Save

    private bool Save()
    {
        PDT_StandardPriceBLL _bll;
        if ((int)ViewState["ID"] != 0)
        {
            //修改
            _bll = new PDT_StandardPriceBLL((int)ViewState["ID"]);
        }
        else
        {
            //新增
            _bll = new PDT_StandardPriceBLL();
        }

        pl_detail.GetData(_bll.Model);

        #region 判断必填项

        #endregion

        #region 判断是否与默认价表重复
        if (_bll.Model.IsDefault.ToUpper() == "Y")
        {
            int _priceid = PDT_StandardPriceBLL.GetDefaultPrice((int)Session["OwnerClient"]);
            if (_priceid != _bll.Model.ID)
            {
                MessageBox.Show(this, "对不起,不能重复新增默认价表,新增的价表必须限制区域或渠道!");
                return false;
            }
        }

        #endregion

        if ((int)ViewState["ID"] != 0)
        {
            //修改
            _bll.Model.UpdateStaff = (int)Session["UserID"];
            _bll.Update();
        }
        else
        {
            //新增
            _bll.Model.Supplier = (int)Session["OwnerClient"];
            _bll.Model.ApproveFlag = 2;
            _bll.Model.InsertStaff = (int)Session["UserID"];
            ViewState["ID"] = _bll.Add();
        }

        #region 保存修改明细
        foreach (GridViewRow row in gv_List.Rows)
        {
            PDT_StandardPrice_Detail item = new PDT_StandardPrice_Detail();
            item.PriceID = _bll.Model.ID;
            item.ID = int.Parse(gv_List.DataKeys[row.RowIndex]["ID"].ToString());
            item.Product = int.Parse(gv_List.DataKeys[row.RowIndex]["Product"].ToString());

            PDT_Product p = new PDT_ProductBLL(item.Product).Model;

            if (row.FindControl("tbx_Price") != null)
            {
                decimal d = 0;
                if (decimal.TryParse(((TextBox)row.FindControl("tbx_Price")).Text, out d)) item.Price = d;

                PDT_ProductBLL productbll = new PDT_ProductBLL(item.Product);
                item.Price = item.Price / productbll.Model.ConvertFactor;

                PDT_ProductExtInfo extinfo = productbll.GetProductExtInfo((int)Session["OwnerClient"]);
                if (extinfo != null)
                {
                    if (extinfo.MinSalesPrice > 0 && item.Price < extinfo.MinSalesPrice)
                    {
                        MessageBox.Show(this, "对不起,您发布的价格不能小于建议零售价!");
                        return false;
                    }
                    else if (extinfo.MaxSalesPrice > 0 && item.Price > extinfo.MaxSalesPrice)
                    {
                        MessageBox.Show(this, "对不起,您发布的价格不能过高于建议零售价!");
                        return false;
                    }
                }
            }

            if (row.FindControl("tbx_Remark") != null)
                item.Remark = ((TextBox)row.FindControl("tbx_Remark")).Text;

            _bll.UpdateDetail(item);
        }

        #endregion

        return true;
    }
开发者ID:fuhongliang,项目名称:GraduateProject,代码行数:92,代码来源:StandardPriceDetail.aspx.cs


注:本文中的PDT_ProductBLL.GetProductExtInfo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。