public ActionResult DeleteConfirmed(string id) { Jig jig = db.Jig.Find(id); db.Jig.Remove(jig); db.SaveChanges(); return(RedirectToAction("Index")); }
private void Jig_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Return) { //信息输入文本框 TextBox txtInput = (TextBox)sender; //Jig数据 Label label = (Label)txtInput.Parent.Controls[txtInput.Name.Replace("txt", "")]; if (label.Tag == null) { Jig jig = new Jig() { ID = txtInput.Text, Machine = txtInput.Parent.Name, Location = label.Name }; label.Tag = jig; label.Text = string.Format("{0}\r\n{1}", jig.ID, jig.StartTime.ToString("yy/MM/dd\r\nHH:mm:ss")); label.BackColor = Control.DefaultBackColor; txtInput.Text = ""; string sql = String.Format(@"INSERT INTO operate_history (jig_id,machine_id,location,oven_time,creat_time,operate_type) VALUES('{0}','{1}', '{2}', {3}, DATETIME('now','localtime'), 'IN')", jig.ID, jig.Machine, jig.Location, jig.OvenTime); SQLiteHelper.ExecuteNonQuery(jigDB, sql, null); } else { Jig jig = (Jig)label.Tag; if (txtInput.Text == (jig.ID)) { if (!jig.TimeOut) { DialogResult dr = MessageBox.Show("该Jig未到烘烤时间,确认是否强制解锁", "Jig解锁失败", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2); if (dr != DialogResult.Yes) { return; } } jig.EndTime = DateTime.Now; string sql = String.Format(@"INSERT INTO operate_history (jig_id,machine_id,location,oven_time,creat_time,operate_type) VALUES('{0}','{1}', '{2}', {3}, DATETIME('now','localtime'), 'OUT')", jig.ID, jig.Machine, jig.Location, jig.OvenTime); SQLiteHelper.ExecuteNonQuery(jigDB, sql, null); label.Tag = null; label.Text = ""; txtInput.Text = ""; } else { MessageBox.Show("两次Jig的ID不相同", "Jig解锁失败", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } }
public ActionResult Edit([Bind(Include = "Code,Name,FamilyID,FamilyName,Model,PartNo,WorkcellID,WorkcellName,UsedFor,UPL,OwnerID,OwnerName,PMPeriod,AddDate,AddUserID,AddUserName,EditDate,EditUserID,EditUserName,Remark")] Jig jig) { if (ModelState.IsValid) { db.Entry(jig).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(jig)); }
void ShowTimeOut(GroupBox groupBox) { foreach (Control con in groupBox.Controls) { if (con is Label && con.Tag != null) { Jig jig = (Jig)con.Tag; con.BackColor = jig.TimeOut ? Color.Red : Control.DefaultBackColor; } } }
// GET: Jigs/Edit/5 public ActionResult Edit(string id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Jig jig = db.Jig.Find(id); if (jig == null) { return(HttpNotFound()); } return(View(jig)); }
public MeteorControl(Sim actor, Sim target) : base(15, TimeUnit.Minutes) { mActor = actor; mTarget = target; Vector3 empty = Vector3.Empty; Vector3 fwd = Vector3.Empty; Jig jig = GlobalFunctions.CreateObject("MeteorImpactJig", ProductVersion.EP2, Vector3.OutOfWorld, 0x0, Vector3.UnitZ, "Sims3.Gameplay.Core.Jig", null) as Jig; FindGoodLocationBooleans booleans = FindGoodLocationBooleans.AllowOnBridges | FindGoodLocationBooleans.AllowOnSideWalks | FindGoodLocationBooleans.AllowOnStreets | FindGoodLocationBooleans.TemporaryPlacement; World.FindGoodLocationParams fglParams = new World.FindGoodLocationParams(target.PositionOnFloor); fglParams.BooleanConstraints = booleans; fglParams.PlacementCheckFunc = Sims3.Gameplay.Objects.Miscellaneous.Meteor.IsValidMeteorPosition; if (GlobalFunctions.FindGoodLocation(jig, fglParams, out empty, out fwd)) { mMeteor = GlobalFunctions.CreateObject("MeteorImpactShadow", ProductVersion.EP2, empty, 0x0, fwd, "Sims3.Gameplay.Objects.Miscellaneous.Meteor", null) as Sims3.Gameplay.Objects.Miscellaneous.Meteor; mMeteor.SetHiddenFlags(HiddenFlags.Footprint); } jig.Destroy(); if ((actor != null) && (mMeteor != null)) { mTarget.InteractionQueue.AddNext(Sims3.Gameplay.Objects.Miscellaneous.Meteor.ReactToMeteor.Singleton.CreateInstance(mMeteor, mTarget, mTarget.InheritedPriority(), false, true)); mActor.InteractionQueue.CancelAllInteractions(); Vector3 position = actor.Position; Vector3 forwardVector = actor.ForwardVector; if (GlobalFunctions.FindGoodLocationNearby(actor, ref position, ref forwardVector, Sims3.Gameplay.Objects.Miscellaneous.Meteor.kMeteorBlastZoneRadius, GlobalFunctions.FindGoodLocationStrategies.All, FindGoodLocationBooleans.None)) { InteractionInstance interaction = Terrain.GoHere.GetSingleton(actor, position).CreateInstanceWithCallbacks(Terrain.Singleton, actor, new InteractionPriority(InteractionPriorityLevel.UserDirected), true, true, null, null, OnGoHereFailure); interaction.RequestWalkStyle(Sim.WalkStyle.Run); actor.InteractionQueue.AddNext(interaction); } else { mActor.InteractionQueue.AddNext(Sims3.Gameplay.Objects.Miscellaneous.Meteor.ReactToMeteor.Singleton.CreateInstance(mMeteor, mActor, mActor.InheritedPriority(), false, true)); } } }
// GET: Jigitems //xuewei public ActionResult Index(String code, String name, String location, String model, String partNo) { var jigitem = from m in this.db.Jigitem select m; jigitem = jigitem.Where(p => p.State == "库存"); if (!String.IsNullOrEmpty(code)) { jigitem = jigitem.Where(h => h.Code.Contains(code)); } if (!String.IsNullOrEmpty(location)) { jigitem = jigitem.Where(h => h.Location.Contains(location)); } //lgx OutJigList outJigList = new OutJigList(); outJigList.OutModelList = new List <OutJig>(); foreach (var jigmodel in jigitem) { Jig jig = db.Jig.Find(jigmodel.Code); if (!String.IsNullOrEmpty(name) && jig.Name != name) { continue; } if (!String.IsNullOrEmpty(model) && jig.Model != model) { continue; } if (!String.IsNullOrEmpty(partNo) && jig.PartNo != partNo) { continue; } outJigList.OutModelList.Add( new OutJig { Code = jigmodel.Code, Name = jig.Name, Model = jig.Model, PartNo = jig.PartNo, State = jigmodel.State, Location = jigmodel.Location, ItemID = jigmodel.ItemID } ); } return(View(outJigList)); }
public Main() { InitializeComponent(); Text = Application.ProductName + " " + Application.ProductVersion; timerCheckJig.Interval = 1000 * Convert.ToUInt16(ConfigurationManager.AppSettings["refreshTime"]); #region UI //测试模式 if (ConfigurationManager.AppSettings["testMode"] == "SQLite") { new DBView().Show(); } //gbLeft gbOvenLeft.Text = gbOvenLeft.Name = ConfigurationManager.AppSettings["ovenLeftName"]; int[] ovenLeftLocationArr = Array.ConvertAll(ConfigurationManager.AppSettings["ovenLeftLocation"].Split(','), int.Parse); int[] ovenLeftSizeArr = Array.ConvertAll(ConfigurationManager.AppSettings["ovenLeftSize"].Split(','), int.Parse); Point ovenLeftLocation = new Point(ovenLeftLocationArr[0], ovenLeftLocationArr[1]); Size ovenLeftSize = new Size(ovenLeftSizeArr[0], ovenLeftSizeArr[1]); int ovenLeftRow = Convert.ToUInt16(ConfigurationManager.AppSettings["ovenLeftRow"]); int ovenLeftColumn = Convert.ToUInt16(ConfigurationManager.AppSettings["ovenLeftColumn"]); CreatOvenUI(gbOvenLeft, ovenLeftLocation, ovenLeftSize, ovenLeftRow, ovenLeftColumn); //gbRight gbOvenRight.Text = gbOvenRight.Name = ConfigurationManager.AppSettings["ovenRightName"]; int[] ovenRightLocationArr = Array.ConvertAll(ConfigurationManager.AppSettings["ovenRightLocation"].Split(','), int.Parse); int[] ovenRightSizeArr = Array.ConvertAll(ConfigurationManager.AppSettings["ovenRightSize"].Split(','), int.Parse); Point ovenRightLocation = new Point(ovenRightLocationArr[0], ovenRightLocationArr[1]); Size ovenRightSize = new Size(ovenRightSizeArr[0], ovenRightSizeArr[1]); int ovenRightRow = Convert.ToUInt16(ConfigurationManager.AppSettings["ovenRightRow"]); int ovenRightColumn = Convert.ToUInt16(ConfigurationManager.AppSettings["ovenRightColumn"]); CreatOvenUI(gbOvenRight, ovenRightLocation, ovenRightSize, ovenRightRow, ovenRightColumn); if (gbOvenLeft.Name == gbOvenRight.Name) { MessageBox.Show("配置文件中的ovenLeftName与ovenRightName值不可相同", "配置错误", MessageBoxButtons.OK, MessageBoxIcon.Error); Environment.Exit(0); } //lblRunningState lblRunningState.Text = ConfigurationManager.AppSettings["runningStateText"]; lblRunningState.Location = new Point(gbOvenRight.Location.X, gbOvenRight.Location.Y + gbOvenRight.Height); lblRunningState.Font = new Font(lblRunningState.Font.FontFamily.Name, Convert.ToSingle(ConfigurationManager.AppSettings["runningStateFontSize"])); //导入没完成的数据 string sql = @"WITH alldata AS( SELECT*,ROW_NUMBER() OVER (PARTITION BY jig_id,machine_id,location ORDER BY creat_time DESC) IS 1 AS last_operate FROM operate_history ) SELECT jig_id,machine_id,location,oven_time,creat_time FROM alldata WHERE last_operate is TRUE AND operate_type='IN'"; DataSet ds = SQLiteHelper.ExecuteDataSet(jigDB, sql, null); DataTable dt = ds.Tables[0]; foreach (DataRow dr in dt.Rows) { Jig jig = new Jig(dr); GroupBox oven = (GroupBox)Controls[jig.Machine]; Label label = (Label)oven.Controls[jig.Location]; label.Tag = jig; label.Text = string.Format("{0}\r\n{1}", jig.ID, jig.StartTime.ToString("yy/MM/dd\r\nHH:mm:ss")); label.BackColor = jig.TimeOut ? Color.Red : Control.DefaultBackColor; } #endregion }