public static async Task <string> RunWIPClearing(int useDuration, bool runAsTest) { int x = 0; bool success = false; try { do { success = false; foreach (string company in pCompanies) { if (IsSAPClearingDue(useDuration)) { WIP wip = SetupHeader(company, false); SAPWebService.WIPService.AccountingWIPClearingRunClient client = SAPWebService.WebService.SetUpClient(ConnectionInfo.user, ConnectionInfo.password); var response = await SAPWebService.WebService.CreateWIP(client, wip); var result = response.WIPRunResponse.ToString(); return(result); } } }while (x == 0); } catch (Exception ex) { Console.WriteLine(ex.Message.ToString()); } return(null); }
protected virtual void TriggerGet(Event @event = null) { var current = GetQueue.First; while (current != null) { var get = current.Value; DoGet(get); if (get.IsTriggered) { var next = current.Next; GetQueue.Remove(current); current = next; TriggerWhenEmpty(); TriggerWhenChange(); } else { current = current.Next; } if (Items.Count == 0) { break; } } Utilization?.UpdateTo(Count / (double)Capacity); WIP?.UpdateTo(Count + PutQueue.Count + GetQueue.Count); GetQueueLength?.UpdateTo(GetQueue.Count); }
protected virtual void TriggerRelease(Event @event = null) { while (ReleaseQueue.Count > 0) { var release = ReleaseQueue.Peek(); if (release.Request.IsAlive) { if (!RequestQueue.Remove(release.Request)) { throw new InvalidOperationException("Failed to cancel a request."); } BreakOffTime?.Add(Environment.ToDouble(Environment.Now - release.Request.Time)); release.Succeed(); ReleaseQueue.Dequeue(); } else { DoRelease(release); if (release.IsTriggered) { ReleaseQueue.Dequeue(); TriggerWhenAny(); TriggerWhenFull(); TriggerWhenChange(); } else { break; } } } Utilization?.UpdateTo(InUse / (double)Capacity); WIP?.UpdateTo(InUse + RequestQueue.Count); QueueLength?.UpdateTo(RequestQueue.Count); }
protected virtual void TriggerRequest(Event @event = null) { var current = RequestQueue.First; while (current != null) { var request = current.Value; DoRequest(request); if (request.IsTriggered) { var next = current.Next; RequestQueue.Remove(current); current = next; TriggerWhenEmpty(); TriggerWhenChange(); } else { current = current.Next; } if (Resources.Count == 0) { break; } } Utilization?.UpdateTo(InUse / (double)Capacity); WIP?.UpdateTo(InUse + RequestQueue.Count); QueueLength?.UpdateTo(RequestQueue.Count); }
/// <summary> /// SetupHeader /// </summary> /// <param name="company"></param> /// <param name="runAsTest"></param> /// <returns>WIP object</returns> private static WIP SetupHeader(string company, bool runAsTest) { WIP wip = new WIP(); wip.RunDescription = "WIPClearing " + company + "On: " + DateTime.Now.ToShortDateString(); wip.AccountingPeriodID = PadNumber((DateTime.Now.AddMonths(1).Month), 3); wip.FiscalYearID = DateTime.Now.Year.ToString(); wip.AccountingClosingStepCode = ClosingStepCode; wip.TestRunIndicator = runAsTest; wip.CompanyID = company; return(wip); }
private void Wip_see_Click(object sender, RoutedEventArgs e) { // See Browse.cs try { var repairTracking = new requestRepair((int)id, username_global); WIP selected_id = (WIP)current_repairs.SelectedItems[0]; repairTracking.tracking_show((int)selected_id.ID); } catch (Exception Ex) { MessageBox.Show("You must have selected an item before proceeding!" /*Error: " + Ex + ". Actual Error Message: " + Ex.Message*/, "Alert!", MessageBoxButton.OK, MessageBoxImage.Exclamation); } }
private void see_more(object sender, RoutedEventArgs e) { try { WIP selected_id = (WIP)current_repairs.SelectedItems[0]; RepairInfo repairInfo_nav = new RepairInfo((int)selected_id.ID); repairInfo_nav.Show(); this.Close(); } catch { MessageBox.Show("You need to select an item first!", "Alert!", MessageBoxButton.OK, MessageBoxImage.Exclamation); } }
protected virtual void TriggerGet(Event @event = null) { while (GetQueue.Count > 0) { var get = GetQueue.Peek(); DoGet(get); if (get.IsTriggered) { GetQueue.Dequeue(); TriggerWhenEmpty(); TriggerWhenChange(); } else { break; } } Utilization?.UpdateTo(Count / (double)Capacity); WIP?.UpdateTo(Count + PutQueue.Count + GetQueue.Count); GetQueueLength?.UpdateTo(GetQueue.Count); }
protected virtual void TriggerRequest(Event @event = null) { while (RequestQueue.Count > 0) { var request = RequestQueue.First.Value; DoRequest(request); if (request.IsTriggered) { RequestQueue.RemoveFirst(); TriggerWhenEmpty(); TriggerWhenChange(); } else { break; } } Utilization?.UpdateTo(InUse / (double)Capacity); WIP?.UpdateTo(InUse + RequestQueue.Count); QueueLength?.UpdateTo(RequestQueue.Count); }
//Using SOAP 1.1 public string GetClientRequest(WIP wip) { var sr = "<?xml version='1.0' encoding='utf-8'?>" + "<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/' xmlns:glob='http://sap.com/xi/SAPGlobal20/Global'>" + "<soapenv:Header/>" + "<soapenv:Body>" + "<glob:WIPCreateRequest>" + "<WIPRun>" + "<RunDescription>" + wip.RunDescription + "</RunDescription>" + "<AccountingPeriodID>" + wip.AccountingPeriodID + "</AccountingPeriodID>" + "<FiscalYearID>" + wip.FiscalYearID + "</FiscalYearID>" + "<AccountingClosingStepCode>" + wip.AccountingClosingStepCode + "</AccountingClosingStepCode>" + "<CompanyID>" + wip.CompanyID + "</CompanyID>" + "<TestRunIndicator>" + wip.TestRunIndicator + "</TestRunIndicator>" + "</WIPRun>" + "</glob:WIPCreateRequest>" + "</soapenv:Body>" + "</soapenv:Envelope>"; return(sr); }
protected virtual void TriggerPickup(Event @event = null) { while (PickupQueue.Count > 0) { var get = PickupQueue.First.Value; DoPickup(get); if (get.IsTriggered) { PickupQueue.RemoveFirst(); TriggerWhenEmpty(); TriggerWhenChange(); } else { break; } } Utilization?.UpdateTo(Location.Height / (double)Location.MaxHeight); WIP?.UpdateTo(Location.Height + DropoffQueue.Count + PickupQueue.Count); PickupQueueLength?.UpdateTo(PickupQueue.Count); }
protected virtual void TriggerPut(Event @event = null) { while (PutQueue.Count > 0) { var put = PutQueue.Peek(); DoPut(put); if (put.IsTriggered) { PutQueue.Dequeue(); TriggerWhenNew(); TriggerWhenAny(); TriggerWhenFull(); TriggerWhenChange(); } else { break; } } Utilization?.UpdateTo(Count / (double)Capacity); WIP?.UpdateTo(Count + PutQueue.Count + GetQueue.Count); PutQueueLength?.UpdateTo(PutQueue.Count); }
protected virtual void TriggerDropoff(Event @event = null) { while (DropoffQueue.Count > 0) { var put = DropoffQueue.First.Value; DoDropoff(put); if (put.IsTriggered) { DropoffQueue.RemoveFirst(); TriggerWhenNew(); TriggerWhenAny(); TriggerWhenFull(); TriggerWhenChange(); } else { break; } } Utilization?.UpdateTo(Location.Height / (double)Location.MaxHeight); WIP?.UpdateTo(Location.Height + DropoffQueue.Count + PickupQueue.Count); DropoffQueueLength?.UpdateTo(DropoffQueue.Count); }
public async Task <IActionResult> ApproveChange(int changeRequestID) { var changeRequest = await _applicationDbContext.ChangeRequests.SingleOrDefaultAsync(c => c.ID == changeRequestID); switch (changeRequest.ChangeRequestType) { case ChangeRequestType.DELETE: if (changeRequest.TableName == TableType.CELEBRATION) { var toRemove = _applicationDbContext.Celebrations.SingleOrDefault(c => c.ID == changeRequest.AssociatedID); _applicationDbContext.Celebrations.Remove(toRemove); } if (changeRequest.TableName == TableType.WIP) { var toRemove = _applicationDbContext.WIPs.SingleOrDefault(c => c.ID == changeRequest.AssociatedID); _applicationDbContext.WIPs.Remove(toRemove); } if (changeRequest.TableName == TableType.NEWIMPOP) { var toRemove = _applicationDbContext.NewImpOps.SingleOrDefault(c => c.ID == changeRequest.AssociatedID); _applicationDbContext.NewImpOps.Remove(toRemove); } if (changeRequest.TableName == TableType.IMPIDEAS) { var toRemove = _applicationDbContext.NewImpOps.SingleOrDefault(c => c.ID == changeRequest.AssociatedID); _applicationDbContext.NewImpOps.Remove(toRemove); } break; case ChangeRequestType.MODIFY: if (changeRequest.TableName == TableType.CELEBRATION) { var celebration = await _applicationDbContext.Celebrations.Where(c => c.ID == changeRequest.AssociatedID).FirstOrDefaultAsync(); var proptery = celebration.GetType().GetProperty(changeRequest.AssociatedName, BindingFlags.IgnoreCase | BindingFlags.Public | BindingFlags.Instance); var memberType = proptery.PropertyType; var nonNullType = Nullable.GetUnderlyingType(memberType); if (nonNullType != null) { memberType = nonNullType; } var converted = ConvertHelper.ConvertType(memberType, JObject.Parse(changeRequest.Values).GetValue("Value").ToString()); if (converted != null) { proptery.SetValue(celebration, Convert.ChangeType(converted, memberType), null); } } if (changeRequest.TableName == TableType.WIP) { var wip = await _applicationDbContext.WIPs.Where(c => c.ID == changeRequest.AssociatedID).FirstOrDefaultAsync(); var proptery = wip.GetType().GetProperty(changeRequest.AssociatedName, BindingFlags.IgnoreCase | BindingFlags.Public | BindingFlags.Instance); var memberType = proptery.PropertyType; var nonNullType = Nullable.GetUnderlyingType(memberType); if (nonNullType != null) { memberType = nonNullType; } var converted = ConvertHelper.ConvertType(memberType, JObject.Parse(changeRequest.Values).GetValue("Value").ToString()); if (converted != null) { proptery.SetValue(wip, Convert.ChangeType(converted, memberType), null); } } if (changeRequest.TableName == TableType.NEWIMPOP) { var newImp = await _applicationDbContext.NewImpOps.Where(c => c.ID == changeRequest.AssociatedID).FirstOrDefaultAsync(); var proptery = newImp.GetType().GetProperty(changeRequest.AssociatedName, BindingFlags.IgnoreCase | BindingFlags.Public | BindingFlags.Instance); var memberType = proptery.PropertyType; var nonNullType = Nullable.GetUnderlyingType(memberType); if (nonNullType != null) { memberType = nonNullType; } var converted = ConvertHelper.ConvertType(memberType, JObject.Parse(changeRequest.Values).GetValue("Value").ToString()); if (converted != null) { proptery.SetValue(newImp, Convert.ChangeType(converted, memberType), null); } } if (changeRequest.TableName == TableType.IMPIDEAS) { var impIdeasImplemented = await _applicationDbContext.ImpIdeasImplemented.Where(c => c.ID == changeRequest.AssociatedID).FirstOrDefaultAsync(); var proptery = impIdeasImplemented.GetType().GetProperty(changeRequest.AssociatedName, BindingFlags.IgnoreCase | BindingFlags.Public | BindingFlags.Instance); var memberType = proptery.PropertyType; var nonNullType = Nullable.GetUnderlyingType(memberType); if (nonNullType != null) { memberType = nonNullType; } var converted = ConvertHelper.ConvertType(memberType, JObject.Parse(changeRequest.Values).GetValue("Value").ToString()); if (converted != null) { proptery.SetValue(impIdeasImplemented, Convert.ChangeType(converted, memberType), null); } } break; case ChangeRequestType.ADD: var json = JObject.Parse(changeRequest.Values); if (changeRequest.TableName == TableType.CELEBRATION) { _applicationDbContext.Celebrations.Add(new Celebration { Who = json.GetValue("who").ToString() ?? HttpUtility.HtmlEncode(json.GetValue("who").ToString()), What = json.GetValue("what").ToString() ?? HttpUtility.HtmlEncode(json.GetValue("what").ToString()), Why = json.GetValue("why").ToString() ?? HttpUtility.HtmlEncode(json.GetValue("why").ToString()), Date = DateTime.Parse(json.GetValue("date").ToString()), BoardID = changeRequest.BoardID }); } if (changeRequest.TableName == TableType.WIP) { var wip = new WIP { BoardID = changeRequest.BoardID, Saftey = json.GetValue("saftey").ToString() ?? HttpUtility.HtmlEncode(json.GetValue("saftey").ToString()), Name = json.GetValue("name").ToString() ?? HttpUtility.HtmlEncode(json.GetValue("name").ToString()), Date = DateTime.Parse(json.GetValue("date").ToString()), Problem = json.GetValue("problem").ToString() ?? HttpUtility.HtmlEncode(json.GetValue("problem").ToString()), EightWs = json.GetValue("eightWs").ToString() ?? HttpUtility.HtmlEncode(json.GetValue("eightWs").ToString()), StrategicGoals = json.GetValue("strategicGoals").ToString(), StaffWorkingOnOpportunity = json.GetValue("staffWorkingOnOpportunity").ToString() ?? HttpUtility.HtmlEncode(json.GetValue("staffWorkingOnOpportunity").ToString()), Why = json.GetValue("why").ToString() ?? HttpUtility.HtmlEncode(json.GetValue("why").ToString()), JustDoIt = json.GetValue("justDoIt").ToString() ?? HttpUtility.HtmlEncode(json.GetValue("justDoIt").ToString()), Updates = json.GetValue("updates").ToString() ?? HttpUtility.HtmlEncode(json.GetValue("updates").ToString()) }; if (json.GetValue("isPtFamilyInvovlmentOpportunity").HasValues) { wip.IsPtFamilyInvovlmentOpportunity = bool.Parse(json.GetValue("isPtFamilyInvovlmentOpportunity").ToString()); } if (json.GetValue("pickChart").HasValues) { wip.PickChart = (PickChart)int.Parse(json.GetValue("pickChart").ToString()); } if (json.GetValue("dateAssigned").HasValues) { wip.DateAssigned = DateTime.Parse(json.GetValue("dateAssigned").ToString()); } _applicationDbContext.WIPs.Add(wip); } if (changeRequest.TableName == TableType.NEWIMPOP) { var newImp = new NewImpOp { BoardID = changeRequest.BoardID, Legend = json.GetValue("legend").ToString() ?? HttpUtility.HtmlEncode(json.GetValue("legend").ToString()), PersonIdentifyingOpportunity = json.GetValue("personIdentifyingOpportunity").ToString() ?? HttpUtility.HtmlEncode(json.GetValue("personIdentifyingOpportunity").ToString()), DateIdentified = DateTime.Parse(json.GetValue("dateIdentified").ToString()), Problem = json.GetValue("problem").ToString() ?? HttpUtility.HtmlEncode(json.GetValue("problem").ToString()), StaffWorkingOnOpportunity = json.GetValue("staffWorkingOnOpportunity").ToString() ?? HttpUtility.HtmlEncode(json.GetValue("staffWorkingOnOpportunity").ToString()), StrategicGoals = json.GetValue("strategicGoals").ToString(), EightWs = json.GetValue("eightWs").ToString() ?? HttpUtility.HtmlEncode(json.GetValue("eightWs").ToString()), JustDoIt = json.GetValue("justDoIt").ToString() ?? HttpUtility.HtmlEncode(json.GetValue("justDoIt").ToString()), }; if (json.GetValue("isPtFamilyInvovlmentOpportunity").HasValues) { newImp.IsPtFamilyInvovlmentOpportunity = bool.Parse(json.GetValue("isPtFamilyInvovlmentOpportunity").ToString()); } if (json.GetValue("pickChart").HasValues) { newImp.PickChart = (PickChart)int.Parse(json.GetValue("pickChart").ToString()); } _applicationDbContext.NewImpOps.Add(newImp); } if (changeRequest.TableName == TableType.IMPIDEAS) { var impIdeas = new ImpIdeasImplemented { BoardID = changeRequest.BoardID, Name = json.GetValue("name").ToString() ?? HttpUtility.HtmlEncode(json.GetValue("name").ToString()), Date = DateTime.Parse(json.GetValue("date").ToString()), Owner = json.GetValue("owner").ToString() ?? HttpUtility.HtmlEncode(json.GetValue("owner").ToString()), Pillar = json.GetValue("pillar").ToString() ?? HttpUtility.HtmlEncode(json.GetValue("pillar").ToString()), EightWs = json.GetValue("eightWs").ToString() ?? HttpUtility.HtmlEncode(json.GetValue("eightWs").ToString()), JustDoIt = json.GetValue("justDoIt").ToString() ?? HttpUtility.HtmlEncode(json.GetValue("justDoIt").ToString()), Solution = json.GetValue("solution").ToString() ?? HttpUtility.HtmlEncode(json.GetValue("solution").ToString()), DateEnterIntoDatabase = json.GetValue("dateEnterIntoDatabase").ToString() ?? HttpUtility.HtmlEncode(json.GetValue("dateEnterIntoDatabase").ToString()), }; if (json.GetValue("isPtFamilyInvovlmentOpportunity").HasValues) { impIdeas.IsPtFamilyInvovlmentOpportunity = bool.Parse(json.GetValue("isPtFamilyInvovlmentOpportunity").ToString()); } if (json.GetValue("pickChart").HasValues) { impIdeas.PickChart = (PickChart)int.Parse(json.GetValue("pickChart").ToString()); } if (json.GetValue("dateComplete").HasValues) { impIdeas.DateComplete = DateTime.Parse(json.GetValue("dateComplete").ToString()); } if (json.GetValue("workCreated").HasValues) { impIdeas.WorkCreated = bool.Parse(json.GetValue("workCreated").ToString()); } if (json.GetValue("processObservationCreated").HasValues) { impIdeas.ProcessObservationCreated = bool.Parse(json.GetValue("processObservationCreated").ToString()); } _applicationDbContext.ImpIdeasImplemented.Add(impIdeas); } break; } _applicationDbContext.ChangeRequests.Remove(changeRequest); await _applicationDbContext.SaveChangesAsync(); return(Json("Approved.")); }
static void Main(string[] args) { Console.WriteLine("Hello World!"); Part part = new Part(); Part part1 = new Part(); Part part2 = new Part(); Part part3 = new Part(); WIP w = new WIP(); w.Part = new Part(); w.Part.PartNumber = "Part1"; List <Stage> stages = new List <Stage>(); stages.Add(new Stage()); stages[0].Name = "KITTING"; stages[0].NextStage = "MANUFACTURING"; stages[0].Sequence = 0; stages[0].Time = 1.0; HpStageStrategycs ks = new HpStageStrategycs(); ks.Part = w.Part; ks.PartNumber = w.Part.PartNumber; stages[0].StageStrategy = ks; stages.Add(new Stage()); stages[1].Name = "MANUFACTURING"; stages[1].NextStage = "TEST"; stages[1].PreviousStage = "KITTING"; stages[1].Sequence = 1; stages[1].Time = 1.0; HpStageStrategycs ks1 = new HpStageStrategycs(); ks1.Part = w.Part; ks1.PartNumber = w.Part.PartNumber; stages[1].StageStrategy = ks1; w.Part.Stages = stages; HpPartStrategy wp = new HpPartStrategy(); wp.PartNumber = w.Part.PartNumber; w.Part.PartStartegy = wp; w.Barcode = "666"; w.CurrentStage = w.Part.Stages[1]; // w.CurrentStage = new Stage(); // w.CurrentStage.Name = "TEST"; // w.CurrentStage.NextStage = "FQC"; // w.CurrentStage.PreviousStage = "MANUFACTURING"; // w.CurrentStage.Sequence = 2; // HpStageStrategycs ws = new HpStageStrategycs(); // ws.PartNumber = w.Part.PartNumber; // ws.Stage = w.CurrentStage; // w.CurrentStage.StageStrategy = ws; w.ItemNo = 1; w.Release = 0; w.So = 777; WIP w1 = new WIP(); w1.Part = new Part(); w1.Barcode = "666"; w1.CurrentStage = new Stage(); w1.ItemNo = 1; w1.Release = 0; w1.So = 777; WIP w2 = new WIP(); w2.Part = new Part(); w2.Barcode = "666"; w2.CurrentStage = new Stage(); w2.ItemNo = 1; w2.Release = 0; w2.So = 777; WIP w3 = new WIP(); w3.Part = new Part(); w3.Barcode = "666"; w3.CurrentStage = new Stage(); w3.ItemNo = 1; w3.Release = 0; w3.So = 777; List <WIP> wips = new List <WIP>(); wips.Add(w); foreach (var p in wips) { p.Part.PartStartegy.execute(); p.CurrentStage.StageStrategy.allocate(); } }