private void btnNext_Click(object sender, EventArgs e) { DialogResult dr = MessageBox.Show("确定跳过验证吗?\n点击『确定』将跳过验证并立即开始生产!\n点击『取消』即可返回验证!", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (dr == DialogResult.OK) { //录入计划实际开始时间 string json = Helpers.HttpHelper.GetJSON("http://" + Program.IP + "/api/Mms/WinFormClient/GetPlanActualStartTime?ppdID=" + ID + "&dTime=" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); var data = JsonConvert.DeserializeObject <dynamic>(json); if (Convert.ToBoolean(data["result"])) { //物料出库 OutputStorage(); } DrawingsShowForm form = new DrawingsShowForm(ID); DialogResult drB = form.ShowDialog(); if (drB == DialogResult.OK) { string str = System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName; System.Diagnostics.Process.Start(str, Program.WorkGroupInfo.data.GetWorkGroupInfo.TeamCode); Application.Exit(); } } }
private void txtPartCode_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar.Equals((char)13)) { TextBox textBox = sender as TextBox; if (string.IsNullOrEmpty(textBox.Text)) { return; } Panel panel = (Panel)textBox.Parent; int n = Convert.ToInt32(textBox.Tag); Models.MaterialDetailModel.DataModel model = panel.Tag as Models.MaterialDetailModel.DataModel; if (n.Equals(model.GetMaterialDetail.PartQuantity)) { if (MessageBox.Show("已录入正确的数量,是否继续录入?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { return; } } n++; textBox.Tag = n; panel.Controls[5].Text = string.Format("{0}/{1}", n, model.GetMaterialDetail.PartQuantity); if (n.Equals(model.GetMaterialDetail.PartQuantity)) { panel.BackColor = Color.FromArgb(220, 255, 220); } if (n > model.GetMaterialDetail.PartQuantity) { panel.BackColor = Color.FromArgb(255, 220, 220); } bool verify = false; foreach (var item in pnlVerifyProductMaterial.Controls) { if (item is Panel) { Panel pnl = item as Panel; foreach (var control in pnl.Controls) { if ((pnl.Tag as Models.MaterialDetailModel.DataModel).GetMaterialDetail.PartQuantity.Equals(Convert.ToInt32(((TextBox)pnl.Controls[6]).Tag))) { verify = true; } else { verify = false; return; } } } } if (verify) { DialogResult dr = MessageBox.Show("验证通过!是否立即开始?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dr == DialogResult.Yes) { //录入计划实际开始时间 string json = Helpers.HttpHelper.GetJSON("http://" + Program.IP + "/api/Mms/WinFormClient/GetPlanActualStartTime?ppdID=" + ID + "&dTime=" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); var data = JsonConvert.DeserializeObject <dynamic>(json); if (Convert.ToBoolean(data["result"])) { //物料出库 OutputStorage(); } DrawingsShowForm form = new DrawingsShowForm(ID); DialogResult drB = form.ShowDialog(); if (drB == DialogResult.OK) { string str = System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName; System.Diagnostics.Process.Start(str, Program.WorkGroupInfo.data.GetWorkGroupInfo.TeamCode); Application.Exit(); } } } } }
static void Main(string[] args) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); IP = ConfigurationManager.AppSettings["API"].ToString(); Form formLogin = new Form(); if (args.Length > 0 && !string.IsNullOrEmpty(args[0])) { //新身份登录 WorkGroupIDTemp = args[0]; formLogin = new Content.LoginForm(Content.LoginForm.ActivateTypeEnum.NewIdentity); } else { //运行程序登录 formLogin = new Content.LoginForm(Content.LoginForm.ActivateTypeEnum.Normal); } formLogin.ShowDialog(); if (formLogin.DialogResult == DialogResult.OK) { //登录成功的班组编号 string teamCode = WorkGroupInfo.data.GetWorkGroupInfo.TeamCode; //获取任务计划 string json = Helpers.HttpHelper.GetJSON("http://" + IP + "/api/Mms/WinFormClient/GetProducePlanInfoByTCode?teamCode=" + teamCode); ProducePlanInfo = JsonConvert.DeserializeObject <Models.ProducePlanInfoModel>(json); //如果有正在进行的计划,则直接进入下一个页面 //查找正在进行的任务计划 var planList = ProducePlanInfo.data.Where(item => item.GetProducePlanInfo.ActualStartTime != null && item.GetProducePlanInfo.ActualFinishTime == null).ToList(); if (planList.Count > 0) { //如果刚好有一个计划正在进行中,则直接进入工艺图纸界面 if (planList.Count.Equals(1)) { //获取计划的ID int planID = planList[0].GetProducePlanInfo.ID; //获取该计划的详情 ProducePlanInfoModel = ProducePlanInfo.data.SingleOrDefault(item => item.GetProducePlanInfo.ID.Equals(planID)); //该计划生产的物料详情 string jsonB = Helpers.HttpHelper.GetJSON("http://" + IP + "/api/Mms/WinFormClient/GetMaterialDetailByPartCode?partCode=" + ProducePlanInfoModel.GetProducePlanInfo.PartCode); MaterialDetailModel = JsonConvert.DeserializeObject <Models.MaterialDetailModel>(jsonB); MaterialDetail = MaterialDetailModel.data.FirstOrDefault(item => item.GetPart.PartCode.Equals(ProducePlanInfoModel.GetProducePlanInfo.PartCode)); //直接进入工艺图纸界面 Form formDrawingsShow = new Content.DrawingsShowForm(planID); formDrawingsShow.ShowDialog(); //如果生产完毕,重新选择计划 if (formDrawingsShow.DialogResult == DialogResult.OK) { string str = System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName; System.Diagnostics.Process.Start(str, WorkGroupInfo.data.GetWorkGroupInfo.TeamCode); Application.Exit(); } } else { MessageBox.Show("已经开始进行多个计划任务!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } else { Application.Run(new Content.ProducePlanForm()); } } }