private void InfoBind() { ProductionLine model = db.ProductionLine.FirstOrDefault(t => t.ID == ID); if (model != null) { this.txt_Name.Text = model.Name; } }
public static ProductionLine Instance() { if (instance == null) { instance = GameObject.FindObjectOfType <ProductionLine>(); } return(instance); }
public IDictionary <string, object> CalibrateLine(Character character, long calibrationEid, Container container) { var lineCount = ProductionLine.CountLinesForCharacter(character, Eid); var maxSlots = RealMaxSlotsPerCharacter(character); lineCount.ThrowIfGreaterOrEqual(maxSlots, ErrorCodes.MaximumAmountOfProducionsReached); var calibrationItem = (CalibrationProgram)container.GetItemOrThrow(calibrationEid); calibrationItem.Quantity.ThrowIfNotEqual(1, ErrorCodes.ServerError); var targetDefinition = calibrationItem.TargetDefinition; targetDefinition.ThrowIfEqual(0, ErrorCodes.CPRGNotProducible); var targetDefault = EntityDefault.Get(targetDefinition); calibrationItem.HasComponents.ThrowIfFalse(ErrorCodes.CPRGNotProducible); //no mission stuff here if (calibrationItem.IsMissionRelated || targetDefault.CategoryFlags.IsCategory(CategoryFlags.cf_random_items)) { if (this.GetDockingBase().IsOnGammaZone()) { throw new PerpetuumException(ErrorCodes.MissionItemCantBeProducedOnGamma); } } ProductionLine.CreateCalibratedLine(character, Eid, calibrationItem); //remove from container container.RemoveItemOrThrow(calibrationItem); //parent the cprg to the facility this.GetStorage().AddChild(calibrationItem); calibrationItem.Save(); container.Save(); ProductionHelper.ProductionLogInsert(character, targetDefinition, 1, ProductionInProgressType.inserCT, 0, 0, false); var informDict = container.ToDictionary(); var linesList = GetLinesList(character); var facilityInfo = GetFacilityInfo(character); var replyDict = new Dictionary <string, object> { { k.lines, linesList }, { k.lineCount, linesList.Count }, { k.sourceContainer, informDict }, { k.facility, facilityInfo } }; return(replyDict); }
private void btn_SwitchLine_Click(object sender, EventArgs e) { DialogResult diaresult = SpMessageBox.Show("确定要切线吗?", "切线操作", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning); if (diaresult == DialogResult.OK) { if (UserInfos.GetRoleByUser(Login.UserName) == (byte)LoginAuthority.SuperAdmin || UserInfos.GetRoleByUser(Login.UserName) == (byte)LoginAuthority.Administrator) { try { if (ProductionLineMaterial.GetMaterialsTotalRemainConsump(Login.CurrentProductionLineNumber, this.txtOrderNo.Text.Trim()) > 0) //切线前,先判断是否已经扣料了 { SpMessageBox.Show("该订单生产还没有进行扣料,请先进行扣料然后再切线.", "生产切线"); try { Program.S.SendMessageToWS(Login.CurrentProductionLineNumber.ToString(), this.txtOrderNo.Text.Trim() + "|" + this.textProdNo.Text.Trim() + "|" + this.textOrderCount.Text.Trim(), AH.Network.MsgType.Deduct); } catch (Exception excpt) { SpMessageBox.Show("告警:" + excpt.Message, "通信-库房"); } return; } } catch (Exception excpt) { SpMessageBox.Show("告警:" + excpt.Message, "生产切线"); return; } SystemLogs.WriteSystemLog(Login.UserName, "Switch order from " + this.txtOrderNo.Text.Trim() + "to other order at " + Login.CurrentProductionLine, DateTime.Now); ProductionLine.RemoveOrderAndProductionLineInfo(Login.CurrentProductionLineNumber, this.txtOrderNo.Text.Trim()); //切线时,没有必要删除database里这个order..... this.listView_CurrentOrder.Items.Clear(); this.txtOrderNo.Clear(); this.textOrderCount.Clear(); this.textProdNo.Clear(); CurrentOrderMaterialsList.Clear(); // stop the timer when switch orders/producitonline MainForm.timer_ReadSensors.Enabled = false; } else { SpMessageBox.Show("当前用户没有权限执行切线操作,请联系 Administrator.", "切线操作"); } } }
public ActionResult <ProductionLine> GetProductionLine(int id) { ProductionLine productionLine = _productionLineRepository.GetBy(id); if (productionLine == null) { return(NotFound()); } return(productionLine); }
public async Task <ProductionLine> GetProductionLineById(Guid id) { ProductionLine ProductionLine = await _productionLineRepository.GetById(id); if (ProductionLine == null) { throw new KeyNotFoundException(); } return(ProductionLine); }
private void SelectProductionLineChanges() { if (lb_ProductionLine.SelectedItem == null) { return; } SelectedProductionLine = lb_ProductionLine.SelectedItem as ProductionLine; UpdateEKanbanDevices(); }
public ActionResult <ProductionLine> PostProductionLine(ProductionLineDTO DTO) { ProductionLine productionLine = new ProductionLine(DTO.Name); productionLine.Machines = DTO.Machines; _productionLineRepository.Add(productionLine); _productionLineRepository.SaveChanges(); return(CreatedAtAction(nameof(GetProductionLine), new { id = productionLine.Id }, productionLine)); }
public IActionResult PutProductionLine(int id, ProductionLine productionLine) { if (id != productionLine.Id) { return(BadRequest()); } _productionLineRepository.Update(productionLine); _productionLineRepository.SaveChanges(); return(NoContent()); }
private void GetDDLAssemblySections(int prodLineId, int defaultValue = 0) { if (prodLineId == 0) { cmbAssemblySections.Items.Clear(); cmbAssemblySections.SelectedItem = null; return; } int assemblySectionType = 0; ProductionLine line = GetProductionLine(prodLineId); if (line == null) { return; } if (line.LineNumber < AppConfiguration.PRODUCTION_SUBASSY_LINENUMBER) { assemblySectionType = (int)EAssemblySectionType.MainLine; } else if (line.LineNumber == AppConfiguration.PRODUCTION_SUBASSY_LINENUMBER) { assemblySectionType = (int)EAssemblySectionType.SubAssemblyLine; } else if (line.LineNumber == AppConfiguration.PRODUCTION_ENDOFLINE_LINENUMBER) { assemblySectionType = (int)EAssemblySectionType.EndOfLine; } else if (line.LineNumber == AppConfiguration.PRODUCTION_FINISHLINE_LINENUMBER) { assemblySectionType = (int)EAssemblySectionType.FinishLine; } else { return; } SqlDataSource ds = cmbAssemblySections.DataSource as SqlDataSource; ds.SelectParameters["AssemblySectionType"].DefaultValue = assemblySectionType.ToString(); cmbAssemblySections.DataBind(); //if (ds.SelectParameters["AssemblySectionType"].DefaultValue != assemblySectionType.ToString()) //{ // ds.SelectParameters["AssemblySectionType"].DefaultValue = assemblySectionType.ToString(); // cmbAssemblySections.DataBind(); //} if (defaultValue > 0) { ListEditItem item = cmbAssemblySections.Items.FindByValue(defaultValue.ToString()); cmbAssemblySections.SelectedItem = item; } }
public async Task UpdateProductionLine(Guid Id, ProductionLineDTO productionLineDTO) { ProductionLine productionLine = await GetProductionLineById(Id); List <Machine> machines = ValidateMachines(productionLineDTO.Machines).Result; //Machine machine = await _machineService.GetMachineById(machineGuid); productionLine.Description = new ProductionLineDescription(productionLineDTO.description); productionLine.Machines = machines; await _productionLineRepository.Update(Id, productionLine); }
public void IWidgetBuilder_GetWidgets_ReturnWidgetsFromBuilder() { var builder = Substitute.For <IWidgetBuilder>(); builder.ReturnsForAll <IWidgetBuilder>(builder); var line = new ProductionLine(builder); var result = line.Run(); Assert.That(result, Is.EqualTo(builder.GetWidgets())); }
public ActionResult Edit([Bind(Include = "Id,DeviceId,ProductGenreId,Description,Comments,Code")] ProductionLine productionLine) { if (ModelState.IsValid) { db.Entry(productionLine).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.DeviceId = new SelectList(db.Devices, "Id", "Name", productionLine.DeviceId); ViewBag.ProductGenreId = new SelectList(db.ProductGenres, "Id", "Name", productionLine.ProductGenreId); return(View(productionLine)); }
public ActionResult <ProductionLine> DeleteProductionLine(int id) { ProductionLine productionLine = _productionLineRepository.GetBy(id); if (productionLine == null) { return(NotFound()); } _productionLineRepository.Delete(productionLine); _productionLineRepository.SaveChanges(); return(productionLine); }
public static ProductionLineDTO generateDto(ProductionLine productionLine) { List <int> list = new List <int>(); foreach (Machine item in productionLine.machineList) { list.Add(item.Id); } ProductionLineDTO p = new ProductionLineDTO(productionLine.Id, list); return(p); }
public ICollection <Schedule> GetSchedules(ProductionLine _productionLine) { try { using (ScheduleContext = new ScheduleContext(database)) { return(ScheduleContext.Schedules .Where(i => i.ProductionLine_Id == _productionLine.id) .ToList()); } } catch { return(null); } }
public async Task <ActionResult <ProductionLineDTO> > GetProductionLineById(Guid id) { try { ProductionLine productionLine = await _serviceProductionLine.GetProductionLineById(id); return(productionLine.toDTO()); } catch (KeyNotFoundException e) { return(NotFound(e.Message)); } }
private void GetSelectedSchedule() { if (lbSchedule.SelectedItem == null) { return; } SelectedSchedule = lbSchedule.SelectedItem as Schedule; SelectedProductionLine = BuildingQuery.GetProductionLine(ShareFuncs.GetInt(SelectedSchedule.ProductionLine_Id)); txtProductionLine.Text = SelectedProductionLine.LineName; UpdateOgiginalSequence(); }
public IActionResult PutProductionLine(int id, ProductionLineDTO DTO) { if (id != _productionLineRepository.GetBy(id).Id) { return(BadRequest()); } ProductionLine productionLine = new ProductionLine(DTO.Name); productionLine.Machines = DTO.Machines; _productionLineRepository.Update(productionLine); _productionLineRepository.SaveChanges(); return(NoContent()); }
protected void btn_Sumbit_Click(object sender, EventArgs e) { try { using (TransactionScope ts = new TransactionScope()) { try { ProductionLine model = db.ProductionLine.FirstOrDefault(t => t.ID == ID); if (model == null) { model = new ProductionLine(); model.IsDel = false; model.CreateDate = DateTime.Now; model.Name = txt_Name.Text; if (db.ProductionLine.FirstOrDefault(t => t.Name == model.Name) != null) { ShowMessage("生产线名称重复"); return; } db.ProductionLine.Add(model); } else { if (db.ProductionLine.FirstOrDefault(t => t.Name == model.Name && t.ID != ID) != null) { ShowMessage("生产线名称重复"); return; } model.Name = txt_Name.Text; } db.SaveChanges(); ShowMessage(); LogType log = (ID == -1 ? LogType.操作日志_添加 : LogType.操作日志_修改); new SysLogDAO().AddLog(log, (ID == -1 ? "增加" : "修改") + "生产线信息"); ts.Complete(); } catch { ShowMessage("提交失败"); ts.Dispose(); } } } catch (Exception ex) { ShowMessage(ex.Message); new SysLogDAO().AddLog(LogType.系统日志, ex.Message, UserID); } }
// GET: Production/ProductionLines/Details/5 public ActionResult Details(Guid?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ProductionLine productionLine = db.ProductionLines.Find(id); if (productionLine == null) { return(HttpNotFound()); } return(View(productionLine)); }
public ActionResult <ProductionLineDTO> PostProductionLine(ProductionLineDTO productionLineDTO) { List <Machine> machines = new List <Machine>(); foreach (int item in productionLineDTO.machineList) { machines.Add(_IMachineRepository.Select(item)); } ProductionLine productionLine = new ProductionLine(machines); _IProductionLineRepository.Insert(productionLine); return(CreatedAtAction(nameof(GetAllProductionLine), new { id = productionLine.Id }, productionLine)); }
public ActionResult Create([Bind(Include = "Id,DeviceId,ProductGenreId,Description,Comments,Code")] ProductionLine productionLine) { if (ModelState.IsValid) { productionLine.Id = Guid.NewGuid(); db.ProductionLines.Add(productionLine); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.DeviceId = new SelectList(db.Devices, "Id", "Name", productionLine.DeviceId); ViewBag.ProductGenreId = new SelectList(db.ProductGenres, "Id", "Name", productionLine.ProductGenreId); return(View(productionLine)); }
public ICollection <OriginalPO> GetOriginalPo(ProductionLine _productionLine) { try { using (SequenceContext = new SequenceContext(database)) { return(SequenceContext.OriginalPOes .Include("OriginalPOsequences") .Where(i => i.ProductionLine_Id == _productionLine.id) .ToList()); } } catch { return(null); } }
public Dictionary <string, object> QueryMaterialAndTime(CalibrationProgram calibrationProgram, Character character, int targetDefintion, int lineOrCPRGMaterialPoints, int lineOrCPRGTimePoints, bool forNextRound = false) { var result = new Dictionary <string, object>(); if (forNextRound) { var decalibration = ProductionDataAccess.GetDecalibration(targetDefintion); double newMaterialEfficiency = 0; double newTimeEfficiency = 0; ProductionLine.GetDecalibratedEfficiencies(lineOrCPRGMaterialPoints, lineOrCPRGTimePoints, decalibration.decrease, ref newMaterialEfficiency, ref newTimeEfficiency); lineOrCPRGMaterialPoints = (int)newMaterialEfficiency; lineOrCPRGTimePoints = (int)newTimeEfficiency; } bool hasBonus; var materialMultiplier = CalculateFinalMaterialMultiplier(character, lineOrCPRGMaterialPoints, targetDefintion, out hasBonus); if (calibrationProgram.IsMissionRelated) { materialMultiplier = materialMultiplier.Clamp(); //never ask more than what we have in the mission } var materials = ProductionDescription.GetRequiredComponentsInfo(ProductionInProgressType.massProduction, 1, materialMultiplier, calibrationProgram.Components); materials.Count.ThrowIfEqual(0, ErrorCodes.WTFErrorMedicalAttentionSuggested); var productionTimeSeconds = CalculateFinalProductionTimeSeconds(character, targetDefintion, lineOrCPRGTimePoints); var price = CalculateProductionPrice(productionTimeSeconds); if (calibrationProgram.IsMissionRelated) { //mission stuff is fixed price = 0; productionTimeSeconds = 10; } result.Add(k.materials, materials); result.Add(k.productionTime, productionTimeSeconds); result.Add(k.price, price); result.Add(k.definition, targetDefintion); result.Add(k.materialMultiplier, materialMultiplier); result.Add(k.hasBonus, hasBonus); result.Add(k.targetQuantity, calibrationProgram.TargetQuantity); return(result); }
public AppEvent DeleteProductionLine(ProductionLine entity, ClaimsPrincipal principal) { string username = principal.FindFirstValue(AppClaimType.UserName); var ev = new AppEvent { Data = null, Description = $"User {username} deleted production line id: {entity.Id}", Type = Data.Constants.AppEventType.DeleteProductionLine, UserId = principal.Identity.Name }; PrepareCreate(ev); return(context.AppEvent.Add(ev).Entity); }
public AppEvent ChangeProductionLineStatus(ProductionLine entity, ClaimsPrincipal principal) { string username = principal.FindFirstValue(AppClaimType.UserName); var ev = new AppEvent { Data = null, Description = $"User {username} changed production line disabled status: {entity.Disabled} - id: {entity.Id}", Type = Data.Constants.AppEventType.ChangeProductionLineStatus, UserId = principal.Identity.Name }; PrepareCreate(ev); return(context.AppEvent.Add(ev).Entity); }
public ActionResult CreateProductionLine([Bind(Include = "ProductionLineId,DateOfCreation,Name,User,EquipmentContent")] ProductionLine productionLine, List <string> equipments, List <int> capacitys, List <double> delays) { if (ModelState.IsValid) { productionLine.ProductionLineId = Guid.NewGuid(); productionLine.DateOfCreation = DateTime.Now; productionLine.User = User.Identity.Name; List <string> equipmentsNotNull = new List <string>(); foreach (string e in equipments) { if (!String.IsNullOrEmpty(e)) { equipmentsNotNull.Add(e); } } productionLine.EquipmentContent = equipmentsNotNull; int itemsCount = equipmentsNotNull.Count; List <int> capacitysNotNull = new List <int>(); List <double> delaysAll = new List <double>(); for (int i = 0; i < itemsCount; i++) { if (capacitys.ElementAt(i) != 0) { capacitysNotNull.Add(capacitys.ElementAt(i)); } } for (int i = 0; i < itemsCount; i++) { delaysAll.Add(delays.ElementAt(i)); } productionLine.CapacityContent = capacitysNotNull; productionLine.DelayContent = delaysAll; if (capacitysNotNull.Count != 0 && equipmentsNotNull.Count != 0 && delaysAll.Count != 0) { db.ProductionLines.Add(productionLine); db.SaveChanges(); } return(RedirectToAction("ListOfProductionLines")); } return(View(productionLine)); }
public async Task <IActionResult> Create([Bind("ProductionLineId,ProductionId,branchId,warehouseId,productId,qty,createdAt")] ProductionLine productionLine) { if (ModelState.IsValid) { _context.Add(productionLine); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["ProductionId"] = new SelectList(_context.Production, "ProductionId", "ProductionId", productionLine.ProductionId); ViewData["branchId"] = new SelectList(_context.Branch, "branchId", "branchId", productionLine.branchId); ViewData["productId"] = new SelectList(_context.Product, "productId", "productId", productionLine.productId); ViewData["warehouseId"] = new SelectList(_context.Warehouse, "warehouseId", "warehouseId", productionLine.warehouseId); return(View(productionLine)); }
public IDictionary <string, object> GetProductionLineDynamic( ProductionLine row, ProductionLineQueryProjection projection, ProductionLineQueryOptions options) { var obj = new Dictionary <string, object>(); foreach (var f in projection.GetFieldsArr()) { switch (f) { case ProductionLineQueryProjection.INFO: { var entity = row; obj["id"] = entity.Id; obj["code"] = entity.Code; obj["info"] = entity.Info; var time = entity.CreatedTime .ToDefaultTimeZone(); var timeStr = time.ToString(options.date_format); obj["created_time"] = new { display = timeStr, iso = $"{time.ToUniversalTime():s}Z" }; time = entity.LastUpdated .ToDefaultTimeZone(); timeStr = time.ToString(options.date_format); obj["last_updated"] = new { display = timeStr, iso = $"{time.ToUniversalTime():s}Z" }; obj["disabled"] = entity.Disabled; } break; case ProductionLineQueryProjection.SELECT: { var entity = row; obj["id"] = entity.Id; obj["code"] = entity.Code; obj["disabled"] = entity.Disabled; } break; } } return(obj); }