Esempio n. 1
0
        private void BtnItemUse_Click(object sender, RoutedEventArgs e)
        {
            FmsActionFormulaMain main = tvMain.SelectedItem as FmsActionFormulaMain;

            if ((main == null) || (string.IsNullOrEmpty(main.PKNO)))
            {
                return;
            }
            //可用明细
            FmsActionFormulaDetail detail = gridItem.SelectedItem as FmsActionFormulaDetail;

            if (detail == null)
            {
                return;
            }

            if (WPFMessageBox.ShowConfirm($"确定[{BtnItemUse.Content}]动作配方明细信息【{detail.FORMULA_DETAIL_NAME}】吗?", @"删除信息") == WPFMessageBoxResult.OK)
            {
                detail.USE_FLAG = (detail.USE_FLAG == 1) ? 0 : 1;
                ws.UseService(s => s.UpdateFmsActionFormulaDetail(detail));

                //可用成功.
                List <FmsActionFormulaDetail> details =
                    ws.UseService(s => s.GetFmsActionFormulaDetails($"FORMULA_CODE = {main.FORMULA_CODE} AND USE_FLAG >= 0"))
                    .OrderBy(c => c.PROCESS_INDEX)
                    .ToList();
                gridItem.ItemsSource = details;

                BindHelper.SetDictDataBindingGridItem(gbItem, gridItem);
            }
        }
Esempio n. 2
0
        //重做当前
        private void bReWork_click(object sender, RoutedEventArgs e)
        {
            MesJobOrder mesJobOrder = gridorder.GetFocusedRow() as MesJobOrder;

            if (mesJobOrder == null)
            {
                return;
            }

            if (WPFMessageBox.ShowConfirm("确定要重做当前工序吗?", "重做工序") != WPFMessageBoxResult.OK)
            {
                return;
            }

            MesProcessCtrol processCtrol =
                ws.UseService(s =>
                              s.GetMesProcessCtrols($"JOB_ORDER_PKNO = '{mesJobOrder.PKNO}' AND PROCESS_STATE < 10 "))
                .OrderBy(c => c.PROCESS_INDEX).FirstOrDefault();      //正在执行的

            if (processCtrol == null)
            {
                return;
            }

            processCtrol.PROCESS_STATE = 1;    //重新执行
            ws.UseService(s => s.UpdateMesProcessCtrol(processCtrol));

            gridItem.ItemsSource = ws.UseService(s =>
                                                 s.GetMesProcessCtrols($"JOB_ORDER_PKNO = '{mesJobOrder.PKNO}' "))
                                   .OrderBy(c => c.PROCESS_INDEX).ThenBy(c => c.CREATION_DATE).ToList();
        }
Esempio n. 3
0
        //删除主信息,已禁用
        private void BtnMainDel_Click(object sender, RoutedEventArgs e)
        {
            FmsActionFormulaMain main = tvMain.SelectedItem as FmsActionFormulaMain;

            if ((main == null) || (string.IsNullOrEmpty(main.PKNO)))
            {
                return;
            }

            if (WPFMessageBox.ShowConfirm($"确定要删除该主配方[{main.FORMULA_NAME}]吗?", "删除") != WPFMessageBoxResult.OK)
            {
                return;
            }

            main.LAST_UPDATE_DATE = DateTime.Now;
            main.UPDATED_BY       = CBaseData.LoginNO;
            main.UPDATED_INTROD   = "删除";
            main.USE_FLAG         = -1; //已删除

            ws.UseService(s => s.UpdateFmsActionFormulaMain(main));

            List <FmsActionFormulaDetail> details = gridItem.ItemsSource as List <FmsActionFormulaDetail>;

            if (details != null)
            {
                foreach (var detail in details)
                {
                    detail.USE_FLAG = -1; //已删除
                    ws.UseService(s => s.UpdateFmsActionFormulaDetail(detail));
                }
            }

            GetMainData();
        }
Esempio n. 4
0
        private void MenuDelete_Click(object sender, RoutedEventArgs e)
        {
            if (this.treeList.SelectedItem != null)
            {
                SysMenuItem        m_SysMenuItem  = this.treeList.SelectedItem as SysMenuItem;
                List <SysMenuItem> d_SysMenuItems = _SDMService.UseService(s => s.GetSysMenuItems("")).
                                                    Where(c => c.PARENT_PKNO == m_SysMenuItem.PKNO).ToList();

                if (WPFMessageBox.ShowConfirm("是否删除该菜单与子项?", "删除菜单") != WPFMessageBoxResult.OK)
                {
                    return;
                }

                foreach (SysMenuItem item in d_SysMenuItems)
                {
                    _SDMService.UseService(s => s.DelSysMenuItem(item.PKNO));
                }
                bool isSuccss = _SDMService.UseService(s => s.DelSysMenuItem(m_SysMenuItem.PKNO));
                if (isSuccss)
                {
                    System.Windows.Forms.MessageBox.Show("删除完成。");
                }
            }
            List <SysMenuItem> m_SysMenuItems =
                _SDMService.UseService(s => s.GetSysMenuItems("TARGET_NAME = 'WPF'")).OrderBy(c => c.ITEM_SEQ).ToList();

            this.treeList.ItemsSource = m_SysMenuItems;
        }
Esempio n. 5
0
        private void BtnDeletnPc(object sender, RoutedEventArgs e)
        {
            if (this.ListProgramLocal.Items.Count <= 0)
            {
                WPFMessageBox.ShowError("路径中无文件!", "删除程序");
                return;
            }

            if (this.ListProgramLocal.SelectedIndex == -1)
            {
                WPFMessageBox.ShowError("请选中要删除的文件!", "程序");
                return;
            }
            string str = (string)ListProgramLocal.SelectedItem;

            string path = System.Environment.CurrentDirectory + "//NC_Programe//" + str;


            if (WPFMessageBox.ShowConfirm("确定该删除选中的文件吗?", "程序删除") != WPFMessageBoxResult.OK)
            {
                return;
            }

            if (File.Exists(path))
            {
                File.Delete(path);  //删除
            }
        }
Esempio n. 6
0
        private void btnCancelAll_Click(object sender, RoutedEventArgs e)
        {
            List <MesJobOrder> mesJobOrders = gridorder.ItemsSource as List <MesJobOrder>;

            if (mesJobOrders == null)
            {
                return;
            }

            if (WPFMessageBox.ShowConfirm("确定要取消所有订单吗?", "取消所有订单") != WPFMessageBoxResult.OK)
            {
                return;
            }

            new Thread(new ThreadStart(delegate()
            {
                WaitLoading.SetWait(this);

                DeviceProcessControl.PauseByLine(CBaseData.CurLinePKNO); //暂停,防止任务直接执行
                Thread.Sleep(1000);
                List <MesJobOrder> jobs =
                    ws.UseService(s =>
                                  s.GetMesJobOrders(
                                      $"USE_FLAG = 1 AND RUN_STATE < 100 AND LINE_PKNO = '{CBaseData.CurLinePKNO}'"))
                    .OrderBy(c => c.CREATION_DATE).ToList();
                foreach (MesJobOrder job in jobs)
                {
                    job.ACT_FINISH_TIME = DateTime.Now;
                    job.RUN_STATE       = 102; //手动取消
                    ////mesJobOrder.ONCE_QTY = 1;//默认订单为1
                    ////mesJobOrder.COMPLETE_QTY = 1;
                    ws.UseService(s => s.UpdateMesJobOrder(job));

                    Thread.Sleep(100);

                    List <MesProcessCtrol> mesProcessCtrols =
                        ws.UseService(s => s.GetMesProcessCtrols("JOB_ORDER_PKNO = " + job.PKNO + ""));
                    if (mesProcessCtrols.Count < 0)
                    {
                        WaitLoading.SetDefault(this);
                        return;
                    }

                    foreach (var processCtrol in mesProcessCtrols)
                    {
                        processCtrol.PROCESS_STATE = 20; //不执行
                        ws.UseService(s => s.UpdateMesProcessCtrol(processCtrol));
                        Thread.Sleep(100);
                    }
                }

                DeviceProcessControl.RunByLine(CBaseData.CurLinePKNO); //启动动作流程

                GetPage();

                WaitLoading.SetDefault(this);
            })).Start();
        }
Esempio n. 7
0
        //完成当前
        private void bFinishThis_click(object sender, RoutedEventArgs e)
        {
            MesJobOrder mesJobOrder = gridorder.GetFocusedRow() as MesJobOrder;

            if (mesJobOrder == null)
            {
                return;
            }

            if (WPFMessageBox.ShowConfirm("确定要完成当前工序吗?", "完成当前工序") != WPFMessageBoxResult.OK)
            {
                return;
            }

            List <MesProcessCtrol> processCtrols = ws.UseService(s => s.GetMesProcessCtrols($"PROCESS_STATE < 10 "))
                                                   .OrderBy(c => c.PROCESS_INDEX).ThenBy(c => c.CREATION_DATE).ToList(); //执行的动作

            MesProcessCtrol processCtrol = processCtrols.FirstOrDefault(c => c.JOB_ORDER_PKNO == mesJobOrder.PKNO);

            if (processCtrol == null)
            {
                return;
            }

            var result = DeviceProcessControl.FinishCurBusiness(processCtrol);

            if (result != "OK")
            {
                WPFMessageBox.ShowError("当前工序的业务层完成错误,请核实。\r\n错误为:" + result, "完成当前工序");
                return;
            }
            processCtrol.PROCESS_STATE = 10;    //执行完成
            ws.UseService(s => s.UpdateMesProcessCtrol(processCtrol));


            if (processCtrol == processCtrols.LastOrDefault())
            {
                mesJobOrder.PROCESS_INFO    = "手动完成当前过程"; //生产执行信息
                mesJobOrder.ACT_FINISH_TIME = DateTime.Now;
                mesJobOrder.RUN_STATE       = 101;        //手动完成
                mesJobOrder.ONCE_QTY        = 1;          //默认订单为1
                mesJobOrder.COMPLETE_QTY    = 1;
            }
            else
            {
                mesJobOrder.PROCESS_INFO = "手动完成当前订单";  //生产执行信息
            }

            ws.UseService(s => s.UpdateMesJobOrder(mesJobOrder));

            gridItem.ItemsSource = ws.UseService(s =>
                                                 s.GetMesProcessCtrols($"JOB_ORDER_PKNO = '{mesJobOrder.PKNO}' "))
                                   .OrderBy(c => c.PROCESS_INDEX).ThenBy(c => c.CREATION_DATE).ToList();
        }
Esempio n. 8
0
        private void BtnDel_Click(object sender, RoutedEventArgs e)
        {
            //删除
            AmPartsMasterN PartsMasterN = gridItem.SelectedItem as AmPartsMasterN;

            if (PartsMasterN == null)
            {
                return;
            }

            if (WPFMessageBox.ShowConfirm($"确定删除部件【{PartsMasterN.DEPARTMENT_NAME}】吗?", "删除信息") == WPFMessageBoxResult.OK)
            {
                ws.UseService(s => s.DelAmAssetMasterN(PartsMasterN.PKNO));

                //删除成功.
                GetPage();
            }
        }
Esempio n. 9
0
        private void BtnDel_Click(object sender, RoutedEventArgs e)
        {
            //删除
            AmAssetMasterN AssetMasterN = gridItem.SelectedItem as AmAssetMasterN;

            if (AssetMasterN == null)
            {
                return;
            }

            if (WPFMessageBox.ShowConfirm($"确定删除设备【{AssetMasterN.ASSET_NAME}】吗?", "删除信息") == WPFMessageBoxResult.OK)
            {
                ws.UseService(s => s.DelAmAssetMasterN(AssetMasterN.ASSET_CODE));

                //删除成功.
                GetPage();
            }
        }
Esempio n. 10
0
        private void ImageButtonWithIcon_Click_1(object sender, RoutedEventArgs e)
        {
            #region 检验

            if (this.ListProgramLocal.Items.Count <= 0)
            {
                WPFMessageBox.ShowError("当前路径中无文件!", "提醒");
                return;
            }

            if (this.ListProgramLocal.SelectedIndex == -1)
            {
                WPFMessageBox.ShowError("未选中文件!", "提醒");
                return;
            }

            #endregion

            string pathrestorefile = System.Environment.CurrentDirectory + "//NC_Back//";
            if (!Directory.Exists(pathrestorefile))
            {
                Directory.CreateDirectory(pathrestorefile);
            }
            string fileName = pathrestorefile + this.ListProgramLocal.SelectedItem.ToString();
            if (File.Exists(fileName))
            {
                if (WPFMessageBox.ShowConfirm($"确定要删除备份文件[{fileName}]吗?", "删除文件") != WPFMessageBoxResult.OK)
                {
                    return;
                }

                try
                {
                    File.Delete(fileName);

                    GetPcProgram();
                }
                catch (Exception exception)
                {
                    Console.WriteLine(exception);
                }
            }
        }
Esempio n. 11
0
        //取消订单: 订单标记取消,标记process结束。
        private void BtnCancle_click(object sender, RoutedEventArgs e)
        {
            MesJobOrder mesJobOrder = gridorder.GetFocusedRow() as MesJobOrder;

            if (mesJobOrder == null)
            {
                return;
            }

            if (WPFMessageBox.ShowConfirm("确定要取消该订单吗?", "取消订单") != WPFMessageBoxResult.OK)
            {
                return;
            }

            Cursor = Cursors.Wait;

            mesJobOrder.ACT_FINISH_TIME = DateTime.Now;
            mesJobOrder.RUN_STATE       = 102; //手动取消
            ////mesJobOrder.ONCE_QTY = 1;//默认订单为1
            ////mesJobOrder.COMPLETE_QTY = 1;
            ws.UseService(s => s.UpdateMesJobOrder(mesJobOrder));

            Thread.Sleep(500);

            List <MesProcessCtrol> mesProcessCtrols =
                ws.UseService(s => s.GetMesProcessCtrols("JOB_ORDER_PKNO = " + mesJobOrder.PKNO + ""));

            if (mesProcessCtrols.Count < 0)
            {
                Cursor = Cursors.Arrow;
                return;
            }
            foreach (var processCtrol in mesProcessCtrols)
            {
                processCtrol.PROCESS_STATE = 20;//不执行
                ws.UseService(s => s.UpdateMesProcessCtrol(processCtrol));
            }

            GetPage();

            Cursor = Cursors.Arrow;
        }
Esempio n. 12
0
        private void BtnDel_Click(object sender, RoutedEventArgs e)
        {
            //删除
            FmsActionControl actionControl = gridItem.SelectedItem as FmsActionControl;

            if (actionControl == null)
            {
                return;
            }

            if (
                WPFMessageBox.ShowConfirm($"确定要删除 指令动作【{actionControl.ACTION_NAME}】的配置信息吗?", "删除") != WPFMessageBoxResult.OK)
            {
                return;
            }
            _fmsClient.UseService(s => s.DelFmsActionControl(actionControl.PKNO));

            WPFMessageBox.ShowTips("指令动作配置已删除!", "删除提示");

            GetPage();  //重新刷新数据,根据需求是否进行刷新数据
        }
Esempio n. 13
0
        private void BtnDel_Click(object sender, RoutedEventArgs e)
        {
            AmAssetMasterN asset = cmbDeviceInfo.SelectedItem as AmAssetMasterN;

            if (asset == null)
            {
                return;
            }
            //删除
            TmsDeviceToolsPos m_TmsDeviceToolsPos = gridItem.SelectedItem as TmsDeviceToolsPos;

            if (m_TmsDeviceToolsPos == null)
            {
                return;
            }
            if (WPFMessageBox.ShowConfirm($"确定删除设备刀位【{m_TmsDeviceToolsPos.TOOLS_POS_NO}】的信息吗?", @"删除信息") == WPFMessageBoxResult.OK)
            {
                m_TmsDeviceToolsPos.USE_FLAG = -1;
                ws.UseService(s => s.UpdateTmsDeviceToolsPos(m_TmsDeviceToolsPos));

                //删除成功.
                GetPage();  //重新加载
            }
        }
Esempio n. 14
0
        private const int ReWriteCount = 3;  //数据重写次数

        //下发刀补
        private void btnWriteToolsSet_Click(object sender, RoutedEventArgs e)
        {
            AmAssetMasterN asset = cmbDeviceInfo.SelectedItem as AmAssetMasterN;

            if (asset == null)
            {
                return;
            }
            TmsDeviceToolsPos mTmsDeviceToolsPos = gridItem.SelectedItem as TmsDeviceToolsPos;

            if (mTmsDeviceToolsPos == null)
            {
                return;
            }
            TmsToolsMaster tools = ws.UseService(s => s.GetTmsToolsMasterById(mTmsDeviceToolsPos.TOOLS_PKNO));

            if (tools == null)
            {
                return;
            }

            if (WPFMessageBox.ShowConfirm($"确定要将机床【{asset.ASSET_NAME}】上刀号【{mTmsDeviceToolsPos.TOOLS_POS_NO}】的补偿值覆盖吗?",
                                          "下发刀补") != WPFMessageBoxResult.OK)
            {
                return;
            }

            Cursor = Cursors.Wait;

            string tagName = "写入刀补";

            FmsAssetTagSetting tag = DeviceMonitor.GetTagSettings($"ASSET_CODE = '{asset.ASSET_CODE}' AND TAG_NAME = '{tagName}'").FirstOrDefault();

            if (tag == null)
            {
                Cursor = Cursors.Arrow;
                return;
            }

            //0:长度(形状);1:长度(磨损);2:半径(形状);3:半径(磨损)
            List <string> values = new List <string>();

            values.Add(mTmsDeviceToolsPos.TOOLS_POS_NO);              //机床刀号
            values.Add(tools.COMPENSATION_SHAPE_LENGTH.ToString());   //长度(形状)
            //values.Add(tools.COMPENSATION_ABRASION_LENGTH.ToString()); //长度(磨损)
            values.Add(tools.COMPENSATION_SHAPE_DIAMETER.ToString()); //半径(形状)
            //values.Add(tools.COMPENSATION_ABRASION_DIAMETER.ToString());  //半径(磨损)

            string offSetValue = string.Join("|", values.ToArray());

            #region  发刀补

            int    iWrite = 0;
            int    ret    = 0;
            string error  = "";

            while (iWrite < ReWriteCount)
            {
                ret = DeviceMonitor.WriteTagToDevice(tag.PKNO, offSetValue, out error);
                if (ret == 0)
                {
                    break;
                }
                iWrite++;
                Thread.Sleep(100);
            }

            #endregion

            Cursor = Cursors.Arrow;

            if (ret == 0)
            {
                WPFMessageBox.ShowTips("刀补值下发成功!", "下发刀补");
            }
        }
Esempio n. 15
0
        private void Btn_Start2Click(object sender, RoutedEventArgs e)
        {
            WcfClient <IPLMService> ws2     = new WcfClient <IPLMService>();
            string             LineCode     = CBaseData.CurLinePKNO;//加工单元
            List <MesJobOrder> mesJobOrders =
                ws2.UseService(s =>
                               s.GetMesJobOrders(
                                   $"USE_FLAG = 1 AND RUN_STATE < 100 AND LINE_PKNO = '{LineCode}'"))
                .OrderBy(c => c.CREATION_DATE).ToList();

            if (mesJobOrders.Count > 20)
            {
                WaitLoading.SetDefault(this);
                WPFMessageBox.ShowError("当前订单过多,请等待加工完成", "加工工单");
                return;
            }

            if (WPFMessageBox.ShowConfirm("确定下达加工工单么吗?\r\n" +
                                          "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\r\n",
                                          "加工工单") != WPFMessageBoxResult.OK)
            {
                return;
            }

            //后台执行添加
            new Thread(delegate()
            {
                WaitLoading.SetWait(this);
                Thread.Sleep(1000);

                DateTime jobOrderTime = DateTime.Now.AddSeconds(-10);
                int iJobOrderIndex    = 0;

                List <MesJobOrder> jobOrders             = new List <MesJobOrder>();       //所有订单
                List <MesProcessCtrol> processCtrols     = new List <MesProcessCtrol>();   //控制流程
                List <WmsAllocationInfo> allocationInfos = new List <WmsAllocationInfo>(); //需要修改的货位

                Dictionary <string, string> ParamValues = new Dictionary <string, string>();
                MesJobOrder job     = null;
                string sFormulaCode = "";
                List <FmsActionFormulaDetail> formulaDetails;
                List <RsItemMaster> items = wsRsm.UseService(s => s.GetRsItemMasters("USE_FLAG = 1"));

                RsItemMaster gyroscope = items.FirstOrDefault(c => c.ITEM_NAME == "指尖陀螺"); //产品信息


                #region 2.车床上料



                job = BuildNewJobOrder(gyroscope.PKNO, 2, "陀螺生产", jobOrderTime.AddSeconds(iJobOrderIndex++)); //--形成订单--
                jobOrders.Add(job);

                #region --设定参数--

                ParamValues.Clear();
                ParamValues.Add("{图片名称}", LaserPicName); //定制图片
                                                         //ParamValues.Add("{加工数量}", this.txt_Qty2.Text);

                #endregion

                sFormulaCode = "车床上料";

                #region 形成过程控制

                formulaDetails = wsFms.UseService(s =>
                                                  s.GetFmsActionFormulaDetails($"FORMULA_CODE = '{sFormulaCode}' AND USE_FLAG= 1"))
                                 .OrderBy(c => c.PROCESS_INDEX)
                                 .ToList();

                foreach (var detail in formulaDetails) //配方
                {
                    MesProcessCtrol process = BuildNewProcess(job, detail, ParamValues);

                    processCtrols.Add(process);
                }

                #endregion

                #endregion

                #region 3.加工中心上料



                job = BuildNewJobOrder(gyroscope.PKNO, 2, "陀螺生产", jobOrderTime.AddSeconds(iJobOrderIndex++)); //--形成订单--
                jobOrders.Add(job);

                #region --设定参数--

                ParamValues.Clear();
                ParamValues.Add("{图片名称}", LaserPicName); //定制图片
                                                         //ParamValues.Add("{加工数量}", this.txt_Qty2.Text);

                #endregion

                sFormulaCode = "加工中心上料";

                #region 形成过程控制

                formulaDetails = wsFms.UseService(s =>
                                                  s.GetFmsActionFormulaDetails($"FORMULA_CODE = '{sFormulaCode}' AND USE_FLAG= 1"))
                                 .OrderBy(c => c.PROCESS_INDEX)
                                 .ToList();

                foreach (var detail in formulaDetails) //配方
                {
                    MesProcessCtrol process = BuildNewProcess(job, detail, ParamValues);

                    processCtrols.Add(process);
                }

                #endregion

                #endregion

                #region 4.1.AGV充电



                job = BuildNewJobOrder(gyroscope.PKNO, 2, "陀螺生产", jobOrderTime.AddSeconds(iJobOrderIndex++)); //--形成订单--
                jobOrders.Add(job);

                #region --设定参数--

                ParamValues.Clear();
                ParamValues.Add("{图片名称}", LaserPicName); //定制图片
                                                         //ParamValues.Add("{加工数量}", this.txt_Qty2.Text);

                #endregion

                sFormulaCode = "AGV充电";

                #region 形成过程控制

                formulaDetails = wsFms.UseService(s =>
                                                  s.GetFmsActionFormulaDetails($"FORMULA_CODE = '{sFormulaCode}' AND USE_FLAG= 1"))
                                 .OrderBy(c => c.PROCESS_INDEX)
                                 .ToList();

                foreach (var detail in formulaDetails) //配方
                {
                    MesProcessCtrol process = BuildNewProcess(job, detail, ParamValues);

                    processCtrols.Add(process);
                }

                #endregion

                #endregion

                #region 4.2 加工中心先下料再上料



                job = BuildNewJobOrder(gyroscope.PKNO, 2, "陀螺生产", jobOrderTime.AddSeconds(iJobOrderIndex++)); //--形成订单--
                jobOrders.Add(job);

                #region --设定参数--

                ParamValues.Clear();
                ParamValues.Add("{图片名称}", LaserPicName); //定制图片
                                                         //ParamValues.Add("{加工数量}", this.txt_Qty2.Text); //生产设备

                #endregion

                sFormulaCode = "加工中心先下料再上料";

                #region 形成过程控制

                formulaDetails = wsFms.UseService(s =>
                                                  s.GetFmsActionFormulaDetails($"FORMULA_CODE = '{sFormulaCode}' AND USE_FLAG= 1"))
                                 .OrderBy(c => c.PROCESS_INDEX)
                                 .ToList();

                foreach (var detail in formulaDetails) //配方
                {
                    MesProcessCtrol process = BuildNewProcess(job, detail, ParamValues);

                    processCtrols.Add(process);
                }

                #endregion

                #endregion

                #region 4.3.AGV充电



                job = BuildNewJobOrder(gyroscope.PKNO, 2, "陀螺生产", jobOrderTime.AddSeconds(iJobOrderIndex++)); //--形成订单--
                jobOrders.Add(job);

                #region --设定参数--

                ParamValues.Clear();
                ParamValues.Add("{图片名称}", LaserPicName); //定制图片
                //ParamValues.Add("{加工数量}", this.txt_Qty2.Text); //生产设备

                #endregion

                sFormulaCode = "AGV充电";

                #region 形成过程控制

                formulaDetails = wsFms.UseService(s =>
                                                  s.GetFmsActionFormulaDetails($"FORMULA_CODE = '{sFormulaCode}' AND USE_FLAG= 1"))
                                 .OrderBy(c => c.PROCESS_INDEX)
                                 .ToList();

                foreach (var detail in formulaDetails) //配方
                {
                    MesProcessCtrol process = BuildNewProcess(job, detail, ParamValues);

                    processCtrols.Add(process);
                }

                #endregion

                #endregion

                #region 4.4 加工中心先下料再上料



                job = BuildNewJobOrder(gyroscope.PKNO, 2, "陀螺生产", jobOrderTime.AddSeconds(iJobOrderIndex++)); //--形成订单--
                jobOrders.Add(job);

                #region --设定参数--

                ParamValues.Clear();
                ParamValues.Add("{图片名称}", LaserPicName); //定制图片
                //ParamValues.Add("{加工数量}", this.txt_Qty2.Text); //生产设备

                #endregion

                sFormulaCode = "加工中心先下料再上料";

                #region 形成过程控制

                formulaDetails = wsFms.UseService(s =>
                                                  s.GetFmsActionFormulaDetails($"FORMULA_CODE = '{sFormulaCode}' AND USE_FLAG= 1"))
                                 .OrderBy(c => c.PROCESS_INDEX)
                                 .ToList();

                foreach (var detail in formulaDetails) //配方
                {
                    MesProcessCtrol process = BuildNewProcess(job, detail, ParamValues);

                    processCtrols.Add(process);
                }

                #endregion

                #endregion


                #region 4.3.AGV充电



                job = BuildNewJobOrder(gyroscope.PKNO, 2, "陀螺生产", jobOrderTime.AddSeconds(iJobOrderIndex++)); //--形成订单--
                jobOrders.Add(job);

                #region --设定参数--

                ParamValues.Clear();
                ParamValues.Add("{图片名称}", LaserPicName); //定制图片
                //ParamValues.Add("{加工数量}", this.txt_Qty2.Text); //生产设备

                #endregion

                sFormulaCode = "AGV充电";

                #region 形成过程控制

                formulaDetails = wsFms.UseService(s =>
                                                  s.GetFmsActionFormulaDetails($"FORMULA_CODE = '{sFormulaCode}' AND USE_FLAG= 1"))
                                 .OrderBy(c => c.PROCESS_INDEX)
                                 .ToList();

                foreach (var detail in formulaDetails) //配方
                {
                    MesProcessCtrol process = BuildNewProcess(job, detail, ParamValues);

                    processCtrols.Add(process);
                }

                #endregion

                #endregion

                #region 4.4 加工中心先下料再上料



                job = BuildNewJobOrder(gyroscope.PKNO, 2, "陀螺生产", jobOrderTime.AddSeconds(iJobOrderIndex++)); //--形成订单--
                jobOrders.Add(job);

                #region --设定参数--

                ParamValues.Clear();
                ParamValues.Add("{图片名称}", LaserPicName); //定制图片
                //ParamValues.Add("{加工数量}", this.txt_Qty2.Text); //生产设备

                #endregion

                sFormulaCode = "加工中心先下料再上料";

                #region 形成过程控制

                formulaDetails = wsFms.UseService(s =>
                                                  s.GetFmsActionFormulaDetails($"FORMULA_CODE = '{sFormulaCode}' AND USE_FLAG= 1"))
                                 .OrderBy(c => c.PROCESS_INDEX)
                                 .ToList();

                foreach (var detail in formulaDetails) //配方
                {
                    MesProcessCtrol process = BuildNewProcess(job, detail, ParamValues);

                    processCtrols.Add(process);
                }

                #endregion

                #endregion

                #region 4.3.AGV充电



                job = BuildNewJobOrder(gyroscope.PKNO, 2, "陀螺生产", jobOrderTime.AddSeconds(iJobOrderIndex++)); //--形成订单--
                jobOrders.Add(job);

                #region --设定参数--

                ParamValues.Clear();
                ParamValues.Add("{图片名称}", LaserPicName); //定制图片
                //ParamValues.Add("{加工数量}", this.txt_Qty2.Text); //生产设备

                #endregion

                sFormulaCode = "AGV充电";

                #region 形成过程控制

                formulaDetails = wsFms.UseService(s =>
                                                  s.GetFmsActionFormulaDetails($"FORMULA_CODE = '{sFormulaCode}' AND USE_FLAG= 1"))
                                 .OrderBy(c => c.PROCESS_INDEX)
                                 .ToList();

                foreach (var detail in formulaDetails) //配方
                {
                    MesProcessCtrol process = BuildNewProcess(job, detail, ParamValues);

                    processCtrols.Add(process);
                }

                #endregion

                #endregion

                #region 5.加工中心下料



                job = BuildNewJobOrder(gyroscope.PKNO, 2, "陀螺生产", jobOrderTime.AddSeconds(iJobOrderIndex++)); //--形成订单--
                jobOrders.Add(job);

                #region --设定参数--

                ParamValues.Clear();
                ParamValues.Add("{图片名称}", LaserPicName); //定制图片
                                                         //ParamValues.Add("{加工数量}", this.txt_Qty2.Text);

                #endregion

                sFormulaCode = "加工中心下料";

                #region 形成过程控制

                formulaDetails = wsFms.UseService(s =>
                                                  s.GetFmsActionFormulaDetails($"FORMULA_CODE = '{sFormulaCode}' AND USE_FLAG= 1"))
                                 .OrderBy(c => c.PROCESS_INDEX)
                                 .ToList();

                foreach (var detail in formulaDetails) //配方
                {
                    MesProcessCtrol process = BuildNewProcess(job, detail, ParamValues);

                    processCtrols.Add(process);
                }

                #endregion

                #endregion

                #region 6.车床下料



                job = BuildNewJobOrder(gyroscope.PKNO, 2, "陀螺生产", jobOrderTime.AddSeconds(iJobOrderIndex++)); //--形成订单--
                jobOrders.Add(job);

                #region --设定参数--

                ParamValues.Clear();
                ParamValues.Add("{图片名称}", LaserPicName); //定制图片
                                                         //ParamValues.Add("{加工数量}", this.txt_Qty2.Text);

                #endregion

                sFormulaCode = "车床下料";

                #region 形成过程控制

                formulaDetails = wsFms.UseService(s =>
                                                  s.GetFmsActionFormulaDetails($"FORMULA_CODE = '{sFormulaCode}' AND USE_FLAG= 1"))
                                 .OrderBy(c => c.PROCESS_INDEX)
                                 .ToList();

                foreach (var detail in formulaDetails) //配方
                {
                    MesProcessCtrol process = BuildNewProcess(job, detail, ParamValues);

                    processCtrols.Add(process);
                }

                #endregion

                #endregion



                DeviceProcessControl.PauseByLine(CBaseData.CurLinePKNO); //暂停,防止任务直接执行

                #region 保存数据

                foreach (var allocationInfo in allocationInfos)
                {
                    ws.UseService(s => s.UpdateWmsAllocationInfo(allocationInfo));
                    Thread.Sleep(100);
                }

                foreach (var ctrol in processCtrols)
                {
                    wsPlm.UseService(s => s.AddMesProcessCtrol(ctrol));
                    Thread.Sleep(100);
                }

                foreach (var jobOrder in jobOrders) //订单
                {
                    wsPlm.UseService(s => s.AddMesJobOrder(jobOrder));
                    Thread.Sleep(100);
                }

                #endregion

                DeviceProcessControl.RunByLine(CBaseData.CurLinePKNO); //启动动作流程

                WaitLoading.SetDefault(this);

                WPFMessageBox.ShowInfo("FCS订单已下达", "指尖陀螺加工");
            }).Start();
        }
Esempio n. 16
0
        private void bTestMessageBoxConfirm_Click(object sender, RoutedEventArgs e)
        {
            WPFMessageBoxResult result = WPFMessageBox.ShowConfirm((sender as Button).Content.ToString(), "测试");

            WPFMessageBox.ShowInfo((result == WPFMessageBoxResult.OK ? "OK" : "Cancel"), "结果");
        }