コード例 #1
0
        /// <summary>
        /// 获取工单进度
        /// </summary>
        /// <param name="WorkShopId"></param>
        /// <param name="TenantID"></param>
        /// <returns></returns>
        public dynamic GetOrderNoProgress(string WorkShopId, string TenantID)
        {
            LineBoardController lineboardController = new LineBoardController();

            List <dynamic> result = new List <dynamic>();

            try
            {
                minimes_order_recordService reportService = new minimes_order_recordService();
                List <minimes_order_record> reportList    = reportService.GetModelList(ParamQuery.Instance().AndWhere("WorkShopId", WorkShopId).AndWhere("State", 1).AndWhere("TenantID", TenantID).OrderBy("LineId ASC"));
                foreach (var item in reportList)
                {
                    minimes_order_record row = new minimes_order_record();

                    row.LineId      = item.LineId;      //产线ID
                    row.LineName    = item.LineName;    //产线名称
                    row.OrderNo     = item.OrderNo;     //工单编号
                    row.ProductCode = item.ProductCode; //产品编号
                    row.ProductName = item.ProductName; //产品名称
                    row.Qty         = item.Qty;         //实际产量
                    row.PlanQty     = item.PlanQty;     //计划产量
                    row.StopCount   = item.StopTime;    //停机时间

                    if (row.PlanQty == 0)
                    {
                        row.PlanRatio = "0%";
                    }
                    else
                    {
                        row.PlanRatio = Math.Round((double)row.Qty * 100 / row.PlanQty, 2) + "%";//计划达成率
                    }

                    //生产时间
                    int ProductTime = lineboardController.GetProductTime(row.OrderNo, TenantID) - lineboardController.GetLostTime(row.OrderNo, TenantID);//分钟

                    //稼动率
                    double Utilization = 0;
                    if (ProductTime != 0)
                    {
                        Utilization = Math.Round((double)(ProductTime - row.StopTime) * 100 / (ProductTime), 2);
                    }
                    row.Utilization = Utilization + "%";
                    result.Add(row);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(result);
        }
コード例 #2
0
        public dynamic Get(RequestWrapper query)
        {
            try
            {
                query.LoadSettingXmlString(@"
            <settings defaultOrderBy='OrderPlanDate DESC'>
                <select>WorkShopName,WorkShopId,LineId,LineName,OrderNo,ProductName,ProductCode,
                PlanDate,OrderPlanDate,Qty,PlanQty,ActualMould,StandardMould,StopTime,TenantID, UPH</select>
                <from> minimes_order_record</from>
                <where defaultForAll='true' defaultCp='equal' defaultIgnoreEmpty='true' >
                     <field name='WorkShopId'		cp='equal'></field>   
                     <field name='LineId'		cp='equal'></field>   
                     <field name='OrderPlanDate'		cp='DateRange'></field>   
                     <field name='OrderNo'		cp='equal'></field>   
                     <field name='ProductName'		cp='equal'></field>
                     <field name='ProductCode'		cp='equal'></field>   
                </where>
            </settings>");
                var service = new minimes_order_recordService();
                var pQuery  = query.ToParamQuery();
                var result  = service.GetDynamicListWithPaging(pQuery);
                foreach (var item in result.rows)
                {
                    #region 时间稼动率&实际UPH&生产效率

                    //生产时间
                    int    ProductTime = lineboardController.GetProductTime(item.OrderNo, item.TenantID) - lineboardController.GetLostTime(item.OrderNo, item.TenantID);
                    double Utilization = 0;
                    if (ProductTime != 0)
                    {
                        Utilization = Math.Round((double)(ProductTime - item.StopTime) * 100 / (ProductTime), 2);
                    }
                    //时间稼动率
                    ((IDictionary <string, object>)item).Add("Utilization", Utilization);

                    //生产时间
                    ((IDictionary <string, object>)item).Add("ProductTime", ProductTime);

                    double PlanRatio = 0;
                    int    CurUPH    = 0;
                    if (ProductTime != 0)
                    {
                        CurUPH = item.Qty / ProductTime * 60;
                    }
                    if (item.UPH > 0)
                    {
                        PlanRatio = Math.Round((double)CurUPH * 100 / item.UPH, 2);
                    }
                    //实际UPH
                    ((IDictionary <string, object>)item).Add("CurUPH", CurUPH);

                    //生产效率
                    ((IDictionary <string, object>)item).Add("PlanRatio", PlanRatio);

                    #endregion

                    #region 计划达成率&备存数量&备存计划达成率

                    double RatioQty    = 0;
                    double ReserveRate = 0;
                    int    ReserveQty  = 0;

                    if (item.Qty <= item.PlanQty)
                    {
                        RatioQty    = Math.Round((double)item.Qty * 100 / item.PlanQty, 2);
                        ReserveRate = 0;
                    }
                    else
                    {
                        RatioQty = 100;
                        if (item.Qty > item.PlanQty)//当实际产量>计划产量时,才有备存数量
                        {
                            ReserveQty = item.Qty - item.PlanQty;
                        }
                        ReserveRate = Math.Round((double)ReserveQty * 100 / item.PlanQty, 2);
                    }
                    //计划达成率
                    ((IDictionary <string, object>)item).Add("RatioQty", RatioQty);

                    //备存数量
                    ((IDictionary <string, object>)item).Add("ReserveQty", ReserveQty);

                    //备存计划达成率
                    ((IDictionary <string, object>)item).Add("ReserveRate", ReserveRate);

                    #endregion

                    #region 模穴率

                    //模穴率
                    double MouldRate = 0;
                    if (item.StandardMould != 0)
                    {
                        MouldRate = Math.Round((double)item.ActualMould * 100 / item.StandardMould, 2);
                    }
                    ((IDictionary <string, object>)item).Add("MouldRate", MouldRate);

                    #endregion
                }
                return(result);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }