Esempio n. 1
0
        private void Bind()
        {
            RepairProjectInfo entity = Core.Container.Instance.Resolve <IServiceRepairProjectInfo>().GetEntity(_id);

            txtRemark.Text                 = entity.Remark;
            ddlUnit.SelectedValue          = entity.PayUnit;
            txtDailyRents.Text             = entity.PayPrice.ToString();
            txtVipName.Text                = entity.ProjectName;
            ddlIsUsed.SelectedValue        = entity.IsUsed;
            ddlType.SelectedValue          = entity.ProjectType.ToString();
            ddlUsingType.SelectedValue     = entity.UsingType.ToString();
            ddlContractPrice.SelectedValue = entity.PriceSourceType.ToString();
            ddlIsRegular.SelectedValue     = entity.IsRegular.ToString();
            rbtnIsCreateJob.SelectedValue  = entity.IsCreateJob.ToString();
            tbtnIsSorting.SelectedValue    = entity.IsSorting.ToString();
            if (entity.IsSorting == 1)
            {
                //绑定物品类别
                BindGoodsTypes(1);
            }
            else
            {
                BindGoodsTypes(0);
            }

            if (!string.IsNullOrEmpty(entity.UsingGoods))
            {
                cblGoods.SelectedValueArray = entity.UsingGoods.Split(',');
            }
        }
Esempio n. 2
0
        protected void btnSaveClose_Click(object sender, EventArgs e)
        {
            if (action == "add")
            {
                IList <ICriterion> qryList = new List <ICriterion>();
                qryList.Add(Expression.Eq("ProjectName", txtVipName.Text.Trim()));
                RepairProjectInfo RepairProjectObj = Core.Container.Instance.Resolve <IServiceRepairProjectInfo>().GetEntityByFields(qryList);

                //判断重复
                if (RepairProjectObj != null)
                {
                    Alert.Show("维修项目名称已存在!");
                    return;
                }
            }
            SaveItem();
            PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
        }
Esempio n. 3
0
        /// <summary>
        /// 各类费用项费用计算
        /// </summary>
        /// <param name="costInfo">费用项信息</param>
        private void CalcCost(ContractOrderCostInfo costInfo)
        {
            //获取费用项信息
            RepairProjectInfo costProjectInfo = Core.Container.Instance.Resolve <IServiceRepairProjectInfo>().GetEntity(costInfo.CostID);
            //获取订单信息
            IList <ICriterion> qryList = new List <ICriterion>();

            qryList = new List <ICriterion>();
            qryList.Add(Expression.Eq("OrderNO", costInfo.OrderNO));
            ContractOrderInfo orderInfo = Core.Container.Instance.Resolve <IServiceContractOrderInfo>().GetEntityByFields(qryList);

            //获取费用项单价
            costInfo.PayPrice = GetCostPayPrice(costProjectInfo, orderInfo);
            //获取费用项计价数量
            costInfo.OrderNumber = GetCostPayNumber(costProjectInfo, orderInfo);
            //计算费用金额,更新费用项信息
            costInfo.CostAmount = costInfo.PayPrice * costInfo.OrderNumber;
            Core.Container.Instance.Resolve <IServiceContractOrderCostInfo>().Update(costInfo);
        }
Esempio n. 4
0
        private void SaveItem()
        {
            RepairProjectInfo RepairProjectInfo = new RepairProjectInfo();

            if (action == "edit")
            {
                RepairProjectInfo = Core.Container.Instance.Resolve <IServiceRepairProjectInfo>().GetEntity(_id);
            }
            RepairProjectInfo.ProjectName     = txtVipName.Text.Trim();
            RepairProjectInfo.Remark          = txtRemark.Text.Trim();
            RepairProjectInfo.PayPrice        = !string.IsNullOrEmpty(txtDailyRents.Text) ? Math.Round(decimal.Parse(txtDailyRents.Text), 3) : 0;
            RepairProjectInfo.PayUnit         = ddlUnit.SelectedValue;
            RepairProjectInfo.IsUsed          = ddlIsUsed.SelectedValue;
            RepairProjectInfo.ProjectType     = int.Parse(ddlType.SelectedValue);
            RepairProjectInfo.UsingType       = int.Parse(ddlUsingType.SelectedValue);
            RepairProjectInfo.PriceSourceType = int.Parse(ddlContractPrice.SelectedValue);
            RepairProjectInfo.IsRegular       = int.Parse(ddlIsRegular.SelectedValue);
            RepairProjectInfo.IsCreateJob     = int.Parse(rbtnIsCreateJob.SelectedValue);
            RepairProjectInfo.IsSorting       = int.Parse(tbtnIsSorting.SelectedValue);
            if (cblGoods.SelectedValueArray.Length > 0)
            {
                RepairProjectInfo.UsingGoods = String.Join(",", cblGoods.SelectedValueArray);
            }
            else
            {
                RepairProjectInfo.UsingGoods = "";
            }

            if (action == "edit")
            {
                Core.Container.Instance.Resolve <IServiceRepairProjectInfo>().Update(RepairProjectInfo);
            }
            else
            {
                Core.Container.Instance.Resolve <IServiceRepairProjectInfo>().Create(RepairProjectInfo);
            }
        }
Esempio n. 5
0
        /// <summary>
        /// 根据费用项费用价格获取类型获取价格
        /// </summary>
        /// <param name="costProjectInfo">费用项信息</param>
        /// <param name="orderInfo">订单信息</param>
        /// <returns>价格</returns>
        private decimal GetCostPayPrice(RepairProjectInfo costProjectInfo, ContractOrderInfo orderInfo)
        {
            decimal            payPrice = costProjectInfo.PayPrice;
            IList <ICriterion> qryList  = new List <ICriterion>();

            //获取费用项适用范围
            string[] ids = costProjectInfo.UsingGoods.Split(',');
            //如果费用单价是从合同获取,根据合同获取单价【费用价格获取类型  0:自定义  1:合同客户运费  2:合同司机运费  3:合同单价  4:合同维修单价】
            if (costProjectInfo.PriceSourceType > 0)
            {
                switch (costProjectInfo.PriceSourceType)
                {
                //合同客户运费(获取合同设定运费)
                case 1:
                    //payPrice = orderInfo.ContractInfo.CarCostPrice;
                    break;

                //合同司机运费(获取订单选择的车辆在合同中设定运费)
                case 2:
                    //获取合同车辆信息
                    qryList = new List <ICriterion>();
                    qryList.Add(Expression.Eq("CarID", orderInfo.CarID));
                    qryList.Add(Expression.Eq("ContractID", orderInfo.ContractInfo.ID));
                    ContractCarPriceSetInfo carPriceSetInfo = Core.Container.Instance.Resolve <IServiceContractCarPriceSetInfo>().GetEntityByFields(qryList);
                    payPrice = carPriceSetInfo.TonPayPrice;
                    break;

                //合同单价(获取租赁物品在合同中设定的单价)
                case 3:
                    if (ids.Length > 0)
                    {
                        qryList = new List <ICriterion>();
                        // qryList.Add(Expression.Eq("SetID", orderInfo.ContractInfo.PriceSetID));
                        qryList.Add(Expression.Eq("GoodsTypeID", ids[0]));
                        Order[] orderList = new Order[1];
                        Order   orderli   = new Order("ID", true);
                        orderList[0] = orderli;
                        //获取价格套系中物品设定信息
                        PriceSetGoodsInfo goodsInfo = Core.Container.Instance.Resolve <IServicePriceSetGoodsInfo>().GetFirstEntityByFields(qryList, orderList);
                        //获取物品单价
                        payPrice = goodsInfo.UnitPrice;
                    }
                    break;

                //合同维修单价(获取租赁物品在合同中设定的维修价)
                case 4:
                    if (ids.Length > 0)
                    {
                        qryList = new List <ICriterion>();
                        //qryList.Add(Expression.Eq("SetID", orderInfo.ContractInfo.PriceSetID));
                        qryList.Add(Expression.Eq("GoodsTypeID", int.Parse(ids[0])));
                        Order[] orderList = new Order[1];
                        Order   orderli   = new Order("ID", true);
                        orderList[0] = orderli;
                        //获取价格套系中物品设定信息
                        PriceSetGoodsInfo goodsInfo = Core.Container.Instance.Resolve <IServicePriceSetGoodsInfo>().GetFirstEntityByFields(qryList, orderList);
                        //获取物品维修单价
                        payPrice = goodsInfo.FixPrice;
                    }
                    break;

                default:
                    break;
                }
            }
            return(payPrice);
        }
Esempio n. 6
0
        /// <summary>
        /// 根据费用项计费单位类型获取费用项计价数量
        /// </summary>
        /// <param name="costProjectInfo">费用项信息</param>
        /// <param name="orderInfo">订单信息</param>
        /// <returns>价格</returns>
        private decimal GetCostPayNumber(RepairProjectInfo costProjectInfo, ContractOrderInfo orderInfo)
        {
            decimal            payNumber = 0M;
            IList <ICriterion> qryList   = new List <ICriterion>();
            string             sql       = string.Empty;
            string             orderNO   = orderInfo.OrderNO;

            //1:数量 2:计价单位 3:客户吨位 4:员工吨位 5:司机吨位 6:其他
            switch (costProjectInfo.PayUnit)
            {
            //发货出库数量,发货明细表:GoodsNumber
            case "1":
                //获取运送获取重量信息
                if (!string.IsNullOrEmpty(costProjectInfo.UsingGoods))
                {
                    sql = string.Format(@"select isnull(sum(GoodsNumber),0) as GoodsNumber from ContractOrderDetail where OrderNO ='{0}' and GoodTypeID in ({1}) ", orderNO, costProjectInfo.UsingGoods.TrimEnd(','));
                    DataSet ds = DbHelperSQL.Query(sql);
                    if (ds.Tables[0] != null)
                    {
                        payNumber = decimal.Parse(ds.Tables[0].Rows[0]["GoodsNumber"].ToString());
                    }
                }
                break;

            //发货计价单位,例如米,发货明细表:GoodCalcPriceNumber
            case "2":
                //获取运送获取重量信息
                if (!string.IsNullOrEmpty(costProjectInfo.UsingGoods))
                {
                    sql = string.Format(@"select isnull(sum(GoodCalcPriceNumber),0) as GoodsNumber from ContractOrderDetail where OrderNO ='{0}' and GoodTypeID in ({1}) ", orderNO, costProjectInfo.UsingGoods.TrimEnd(','));
                    DataSet ds = DbHelperSQL.Query(sql);
                    if (ds.Tables[0] != null)
                    {
                        payNumber = decimal.Parse(ds.Tables[0].Rows[0]["GoodsNumber"].ToString());
                    }
                }
                break;

            //客户吨位,发货明细表:GoodsCustomerWeight
            case "3":
                //获取运送获取重量信息
                if (!string.IsNullOrEmpty(costProjectInfo.UsingGoods))
                {
                    sql = string.Format(@"select isnull(sum(GoodsCustomerWeight),0) as GoodsNumber from ContractOrderDetail where OrderNO ='{0}' and GoodTypeID in ({1}) ", orderNO, costProjectInfo.UsingGoods.TrimEnd(','));
                    DataSet ds = DbHelperSQL.Query(sql);
                    if (ds.Tables[0] != null)
                    {
                        payNumber = decimal.Parse(ds.Tables[0].Rows[0]["GoodsNumber"].ToString());
                    }
                }
                break;

            //员工吨位,发货明细表:GoodsStaffWeight
            case "4":
                //获取运送获取重量信息
                if (!string.IsNullOrEmpty(costProjectInfo.UsingGoods))
                {
                    sql = string.Format(@"select isnull(sum(GoodsStaffWeight),0) as GoodsNumber from ContractOrderDetail where OrderNO ='{0}' and GoodTypeID in ({1}) ", orderNO, costProjectInfo.UsingGoods.TrimEnd(','));
                    DataSet ds = DbHelperSQL.Query(sql);
                    if (ds.Tables[0] != null)
                    {
                        payNumber = decimal.Parse(ds.Tables[0].Rows[0]["GoodsNumber"].ToString());
                    }
                }
                break;

            //司机吨位,发货明细表:GoodsDriverWeight
            case "5":
                //获取运送获取重量信息
                if (!string.IsNullOrEmpty(costProjectInfo.UsingGoods))
                {
                    sql = string.Format(@"select isnull(sum(GoodsDriverWeight),0) as GoodsNumber from ContractOrderDetail where OrderNO ='{0}' and GoodTypeID in ({1}) ", orderNO, costProjectInfo.UsingGoods.TrimEnd(','));
                    DataSet ds = DbHelperSQL.Query(sql);
                    if (ds.Tables[0] != null)
                    {
                        payNumber = decimal.Parse(ds.Tables[0].Rows[0]["GoodsNumber"].ToString());
                    }
                }
                break;

            //其他,默认1
            case "6":
                payNumber = 1;
                break;

            default:
                payNumber = 1;
                break;
            }

            return(payNumber);
        }
        /// <summary>
        /// 各类费用计算
        /// </summary>
        /// <param name="costInfo">费用项信息</param>
        private void CalcCost(ContractOrderCostInfo costInfo)
        {
            //获取费用项信息
            RepairProjectInfo costProjectInfo = Core.Container.Instance.Resolve <IServiceRepairProjectInfo>().GetEntity(costInfo.CostID);

            //获取费用项适用范围
            string[] ids = costProjectInfo.UsingGoods.Split(',');
            //获取订单信息
            IList <ICriterion> qryList = new List <ICriterion>();

            qryList = new List <ICriterion>();
            qryList.Add(Expression.Eq("OrderNO", OrderNO));
            ContractOrderInfo orderInfo = Core.Container.Instance.Resolve <IServiceContractOrderInfo>().GetEntityByFields(qryList);

            #region 获取费用项单价

            costInfo.PayPrice = costProjectInfo.PayPrice;
            //如果费用单价是从合同获取,根据合同获取单价【费用价格获取类型  0:自定义  1:合同客户运费  2:合同司机运费  3:合同单价  4:合同维修单价】
            if (costProjectInfo.PriceSourceType > 0)
            {
                switch (costProjectInfo.PriceSourceType)
                {
                //合同客户运费(获取合同设定运费)
                case 1:
                    //costInfo.PayPrice = orderInfo.ContractInfo.CarCostPrice;
                    break;

                //合同司机运费(获取订单选择的车辆在合同中设定运费)
                case 2:
                    //获取合同车辆信息
                    qryList = new List <ICriterion>();
                    qryList.Add(Expression.Eq("CarID", orderInfo.CarID));
                    ContractCarPriceSetInfo carPriceSetInfo = Core.Container.Instance.Resolve <IServiceContractCarPriceSetInfo>().GetEntityByFields(qryList);
                    costInfo.PayPrice = carPriceSetInfo.TonPayPrice;
                    break;

                //合同单价(获取租赁物品在合同中设定的单价)
                case 3:
                    if (ids.Length > 0)
                    {
                        qryList = new List <ICriterion>();
                        //qryList.Add(Expression.Eq("SetID", orderInfo.ContractInfo.PriceSetID));
                        qryList.Add(Expression.Eq("GoodsTypeID", ids[0]));
                        Order[] orderList = new Order[1];
                        Order   orderli   = new Order("ID", true);
                        orderList[0] = orderli;
                        //获取价格套系中物品设定信息
                        PriceSetGoodsInfo goodsInfo = Core.Container.Instance.Resolve <IServicePriceSetGoodsInfo>().GetFirstEntityByFields(qryList, orderList);
                        //获取物品单价
                        costInfo.PayPrice = goodsInfo.UnitPrice;
                    }
                    break;

                //合同维修单价(获取租赁物品在合同中设定的维修价)
                case 4:
                    if (ids.Length > 0)
                    {
                        qryList = new List <ICriterion>();
                        //qryList.Add(Expression.Eq("SetID", orderInfo.ContractInfo.PriceSetID));
                        qryList.Add(Expression.Eq("GoodsTypeID", ids[0]));
                        Order[] orderList = new Order[1];
                        Order   orderli   = new Order("ID", true);
                        orderList[0] = orderli;
                        //获取价格套系中物品设定信息
                        PriceSetGoodsInfo goodsInfo = Core.Container.Instance.Resolve <IServicePriceSetGoodsInfo>().GetFirstEntityByFields(qryList, orderList);
                        //获取物品维修单价
                        costInfo.PayPrice = goodsInfo.FixPrice;
                    }
                    break;

                default:
                    break;
                }
            }

            #endregion 获取费用项单价

            #region 获取费用项计价数量

            string sql = string.Empty;
            //1:数量 2:计价单位 3:客户吨位 4:员工吨位 5:司机吨位 6:其他
            switch (costProjectInfo.PayUnit)
            {
            //收货出库数量,收货明细表:GoodsNumber
            case "1":
                //获取运送获取重量信息
                if (!string.IsNullOrEmpty(costProjectInfo.UsingGoods))
                {
                    sql = string.Format(@"select sum(GoodsNumber) as GoodsNumber from ContractOrderDetail where OrderNO ='{0}' and GoodTypeID in ({1}) ", OrderNO, costProjectInfo.UsingGoods.TrimEnd(','));
                    DataSet ds = DbHelperSQL.Query(sql);
                    if (ds.Tables[0] != null)
                    {
                        costInfo.OrderNumber = decimal.Parse(ds.Tables[0].Rows[0]["GoodsNumber"].ToString());
                    }
                }
                break;

            //收货计价单位,例如米,收货明细表:GoodCalcPriceNumber
            case "2":
                //获取运送获取重量信息
                if (!string.IsNullOrEmpty(costProjectInfo.UsingGoods))
                {
                    sql = string.Format(@"select isnull(sum(GoodCalcPriceNumber),0) as GoodsNumber from ContractOrderDetail where OrderNO ='{0}' and GoodTypeID in ({1}) ", OrderNO, costProjectInfo.UsingGoods.TrimEnd(','));
                    DataSet ds = DbHelperSQL.Query(sql);
                    if (ds.Tables[0] != null)
                    {
                        costInfo.OrderNumber = decimal.Parse(ds.Tables[0].Rows[0]["GoodsNumber"].ToString());
                    }
                }
                break;

            //客户吨位,收货明细表:GoodsCustomerWeight
            case "3":
                //获取运送获取重量信息
                if (!string.IsNullOrEmpty(costProjectInfo.UsingGoods))
                {
                    sql = string.Format(@"select isnull(sum(GoodsCustomerWeight),0) as GoodsNumber from ContractOrderDetail where OrderNO ='{0}' and GoodTypeID in ({1}) ", OrderNO, costProjectInfo.UsingGoods.TrimEnd(','));
                    DataSet ds = DbHelperSQL.Query(sql);
                    if (ds.Tables[0] != null)
                    {
                        costInfo.OrderNumber = decimal.Parse(ds.Tables[0].Rows[0]["GoodsNumber"].ToString());
                    }
                }
                break;

            //员工吨位,收货明细表:GoodsStaffWeight
            case "4":
                //获取运送获取重量信息
                if (!string.IsNullOrEmpty(costProjectInfo.UsingGoods))
                {
                    sql = string.Format(@"select isnull(sum(GoodsStaffWeight),0) as GoodsNumber from ContractOrderDetail where OrderNO ='{0}' and GoodTypeID in ({1}) ", OrderNO, costProjectInfo.UsingGoods.TrimEnd(','));
                    DataSet ds = DbHelperSQL.Query(sql);
                    if (ds.Tables[0] != null)
                    {
                        costInfo.OrderNumber = decimal.Parse(ds.Tables[0].Rows[0]["GoodsNumber"].ToString());
                    }
                }
                break;

            //司机吨位,收货明细表:GoodsDriverWeight
            case "5":
                //获取运送获取重量信息
                if (!string.IsNullOrEmpty(costProjectInfo.UsingGoods))
                {
                    sql = string.Format(@"select isnull(sum(GoodsDriverWeight),0) as GoodsNumber from ContractOrderDetail where OrderNO ='{0}' and GoodTypeID in ({1}) ", OrderNO, costProjectInfo.UsingGoods.TrimEnd(','));
                    DataSet ds = DbHelperSQL.Query(sql);
                    if (ds.Tables[0] != null)
                    {
                        costInfo.OrderNumber = decimal.Parse(ds.Tables[0].Rows[0]["GoodsNumber"].ToString());
                    }
                }
                break;

            //其他,默认1
            case "6":
                costInfo.OrderNumber = 1;
                break;

            default:
                costInfo.OrderNumber = 1;
                break;
            }

            #endregion 获取费用项计价数量

            //更新费用项信息
            costInfo.CostAmount = costInfo.PayPrice * costInfo.OrderNumber;
            Core.Container.Instance.Resolve <IServiceContractOrderCostInfo>().Update(costInfo);
        }