/// <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); } } }
/// <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); } }