Exemplo n.º 1
0
        /// <summary>
        /// 创建工单WIP
        /// </summary>
        /// <param name="Order"></param>
        public void CreateOrderWip(Model.BPM_Order Order)
        {
            BPM_Daily bll_Daily = new BPM_Daily();
            var       lsDaily   = bll_Daily.GetModelList("OrderID='" + Order.OrderID + "'");

            if (Order != null && Order.Product != null && Order.Product.ProcessList.Count > 0)
            {
                foreach (var process in Order.Product.ProcessList)
                {
                    var Model = new Model.BPM_WIP()
                    {
                        OrderID            = Order.OrderID,
                        ClientName         = Order.ClientName,
                        ProductName        = Order.ProductName,
                        Spec               = Order.Spec,
                        Count              = Convert.ToInt32(Order.Count),
                        ProcessCount       = Convert.ToInt32(Order.Count) * process.ConnectorQty,
                        ProcessID          = process.ProcessID,
                        ProcessName        = process.ProcessName,
                        StandardHours      = Convert.ToDouble(process.StandardHours),
                        ConnectorQty       = process.ConnectorQty,
                        ProcessSign        = process.ProcessSign,
                        TotalStandatdHours = Order.Count * process.ConnectorQty * Convert.ToDouble(process.StandardHours),
                        Qty_OK             = lsDaily.Where(x => x.ProcessID == process.ProcessID).Sum(p => p.QtyOK),
                        Qty_NG             = lsDaily.Where(x => x.ProcessID == process.ProcessID).Sum(p => p.QtyNG),
                        Qty       = lsDaily.Where(x => x.ProcessID == process.ProcessID).Sum(p => p.Qty),
                        WorkHours = Convert.ToDouble(lsDaily.Where(x => x.ProcessID == process.ProcessID).Sum(p => p.WorkHours)),
                    };
                    Model.Qty_NotInput = Model.ProcessCount - Model.Qty;
                    Model.GetTime      = Model.Qty * Model.StandardHours;
                    if (Model.GetTime == 0 || Model.WorkHours == 0)
                    {
                        Model.Efficiency = 0;
                    }
                    else
                    {
                        Model.Efficiency = Convert.ToDouble(Model.GetTime / Model.WorkHours);
                    }

                    dal.Add(Model);
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 录入日报
        /// </summary>
        /// <param name="Daily"></param>
        public void EnterDaily(Model.BPM_Daily Daily)
        {
            var       orderWipList = GetOrderWIPList(Daily.OrderID);
            var       wip          = orderWipList.FirstOrDefault(x => x.ProcessID == Daily.ProcessID);
            var       WipIdx       = orderWipList.IndexOf(wip);
            BPM_Daily bll_Daily    = new BPM_Daily();
            var       lsDaily      = bll_Daily.GetModelList("OrderID='" + Daily.OrderID + "'");

            if (wip != null)
            {
                wip.Qty_NG     = lsDaily.Where(x => x.ProcessID == Daily.ProcessID).Sum(p => p.QtyNG);
                wip.Qty_OK     = lsDaily.Where(x => x.ProcessID == Daily.ProcessID).Sum(p => p.QtyOK);
                wip.WorkHours += Convert.ToDouble(lsDaily.Where(x => x.ProcessID == Daily.ProcessID).Sum(p => p.WorkHours));

                wip.Qty          = wip.Qty_NG + wip.Qty_OK;
                wip.Qty_NotInput = wip.ProcessCount - wip.Qty;
                wip.GetTime      = wip.Qty * wip.StandardHours;
                wip.Efficiency   = Convert.ToDouble(wip.GetTime / wip.WorkHours);

                Update(wip);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(Model.BPM_Order model)
        {
            if (model.State == "已完工" && model.ActualStartDate.IsNullOrEmpty())
            {
                model.ActualEndDate = DateTime.Now.Date.ToString("yyyyMMdd");
            }

            BPM_Daily daily = new BPM_Daily();

            daily.UpdateOrderState(model);
            if (!dal.Exists(model.OrderID))
            {
                model.IsRemind = true;
                model.Relax    = 1.2;
                return(dal.Add(model));
            }
            else
            {
                //if (!MyMessage.IsOkMessage("本地已存在此工单,继续将更新本地工单,是否继续!")) return false;
                return(dal.Update(model));
            }
        }