示例#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);
        }