Beispiel #1
0
 public AmAssetMasterNEdit(AmAssetMasterN m_AmAssetMasterN)
 {
     InitializeComponent();
     m_AssetMaster = m_AmAssetMasterN;
     this.gridLayout.DataContext = m_AssetMaster;
     IsNew = false;
 }
Beispiel #2
0
        private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            _EAMClient = new WcfClient <IEAMService>();

            if (IsNew)
            {
                try
                {
                    m_AssetMaster      = this.gridLayout.DataContext as AmAssetMasterN;
                    m_AssetMaster.PKNO = Guid.NewGuid().ToString();
                    _EAMClient.UseService(s => s.AddAmAssetMasterN(m_AssetMaster));
                }
                catch (Exception ex)
                {
                    MessageUtil.ShowError(ex.Message);
                }
            }
            else
            {
                try
                {
                    m_AssetMaster = this.gridLayout.DataContext as AmAssetMasterN;
                    _EAMClient.UseService(s => s.UpdateAmAssetMasterN(m_AssetMaster));
                }
                catch (Exception ex)
                {
                    MessageUtil.ShowError(ex.Message);
                }
            }

            this.Close();
        }
Beispiel #3
0
        private void getRouting(string routingMainPKNO)
        {
            //选择工艺路线 => 获取工艺路线



            if (string.IsNullOrEmpty(routingMainPKNO))
            {
                return;
            }

            List <RsRoutingDetail> m_rsRoutingDetails =
                wsRSM.UseService(s => s.GetRsRoutingDetails($"ROUTING_PKNO = '{routingMainPKNO}' AND USE_FLAG = 1"))
                .OrderBy(c => c.OP_INDEX)
                .ToList();

            foreach (RsRoutingDetail detail in m_rsRoutingDetails)
            {
                detail.OP_TYPE = ""; //临时存放 Asset Code 用
                detail.REMARK  = ""; //临时存放 指令动作名称 用
                //提取设备,唯一的设备
                List <AmAssetMasterN> assets =
                    wsEAM.UseService(s => s.GetAmAssetMasterNs($"ASSET_GROUP = '{detail.WC_CODE}'"));
                AmAssetMasterN assetMaster = assets.FirstOrDefault();
                if ((assetMaster != null) && (assets.Count == 1))
                {
                    detail.WC_ABV  = assetMaster.ASSET_CODE;
                    detail.OP_TYPE = assetMaster.ASSET_NAME;
                }
            }
            gridProcessInfo.ItemsSource = m_rsRoutingDetails;
        }
Beispiel #4
0
        private void gridItem_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            AmAssetMasterN amAssetMasterN = gridItem.SelectedItem as AmAssetMasterN;

            this.Tag = amAssetMasterN;
            this.Close();
        }
Beispiel #5
0
 /// <summary>
 /// 根据关键字段的值获取记录
 /// </summary>
 /// <param name="Id">关键字段的值</param>
 /// <returns>符合查询条件的记录</returns>
 public AmAssetMasterN GetAmAssetMasterNById(string Id)
 {
     using (IAmAssetMasterNBLL AmAssetMasterNBLL = BLLContainer.Resolve <IAmAssetMasterNBLL>())
     {
         AmAssetMasterN model = AmAssetMasterNBLL.GetFirstOrDefault(Id);
         return(model);
     }
 }
Beispiel #6
0
        private void GridControl_SelectedItemChanged(object sender, DevExpress.Xpf.Grid.SelectedItemChangedEventArgs e)
        {
            try
            {
                ListProgram.Items.Clear();
                AmAssetMasterN amAssetMasterN = e.NewItem as AmAssetMasterN;
                amAssetMasterN_temp = amAssetMasterN;
                FmsAssetCommParam fmsAssetCommParams = new FmsAssetCommParam();
                string stra = " ASSET_CODE = " + amAssetMasterN.ASSET_CODE + " AND INTERFACE_TYPE = 1";
                fmsAssetCommParams = _FMSClient.UseService(s => s.GetFmsAssetCommParams(" ASSET_CODE = " + amAssetMasterN.ASSET_CODE + " AND INTERFACE_TYPE = 1")).FirstOrDefault();
                if (fmsAssetCommParams != null)
                {
                    IP = fmsAssetCommParams.COMM_ADDRESS;
                    //this.lstbx_CNCProgramPath.Items.Clear();

                    string ip = IP;
                    ushort Flibhndl = 0;
                    short ret = Focas1.cnc_allclibhndl3(ip, 8193, 3, out Flibhndl);
                    if (ret != Focas1.EW_OK)
                    {
                        Flibhndl = 0;
                        return;
                    }
                    string drive = "";
                    Focas1.ODBPDFDRV odbpdfdrv = new Focas1.ODBPDFDRV();
                    ret = Focas1.cnc_rdpdf_drive(Flibhndl, odbpdfdrv);
                    switch (odbpdfdrv.max_num)
                    {
                        case 1:
                            drive = "//" + odbpdfdrv.drive1 + "/";// 
                            break;
                    }
                    //this.lbCNCPath.Text = drive;//"//CNC_MEM/"

                    GetProgramDir(drive);
                    foreach (var item in array_Folder)
                    {
                        ListProgram.Items.Add(item.ToString());
                        //this.lstbx_CNCProgramPath.Items.Add(item.ToString());
                    }
                    foreach (var item in array_File)
                    {
                        ListProgram.Items.Add(item.ToString());
                        //this.lstbx_CNCProgramPath.Items.Add(item.ToString());
                    }

                }
            }
            catch (Exception)
            {

                
            }


        }
Beispiel #7
0
 public AmAssetMasterNEdit()
 {
     InitializeComponent();
     m_AssetMaster = new AmAssetMasterN()
     {
         ASSET_CODE = TableNOHelper.GetNewNO("AM_ASSET_MASTER_N.ASSET_CODE")
     };
     this.gridLayout.DataContext = m_AssetMaster;
     IsNew = true;
 }
Beispiel #8
0
        private void Btn_File(object sender, RoutedEventArgs e)
        {
            if (this.gridItem.SelectedItem == null)
            {
                return;
            }
            AmAssetMasterN selectItem = this.gridItem.SelectedItem as AmAssetMasterN;

            DocumentManageInvoke.NewDocumentManage("设备管理", selectItem.PKNO, "", 0, DocumentMangMode.CanUpLoad);
        }
Beispiel #9
0
 /// <summary>
 /// 修改
 /// </summary>
 /// <param name="mAmAssetMasterN">模型</param>
 /// <returns>是否成功</returns>
 public bool UpdateAmAssetMasterN(AmAssetMasterN mAmAssetMasterN)
 {
     if (mAmAssetMasterN == null)
     {
         return(false);
     }
     using (IAmAssetMasterNBLL AmAssetMasterNBLL = BLLContainer.Resolve <IAmAssetMasterNBLL>())
     {
         return(AmAssetMasterNBLL.Update(mAmAssetMasterN));
     }
 }
Beispiel #10
0
        private void Selector_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            AmAssetMasterN asset = cmbAssetInfo.SelectedItem as AmAssetMasterN;

            if (asset != null)
            {
                cmbAssetInfo.Tag =
                    _fmsClient.UseService(
                        s => s.GetFmsAssetTagSettings($"USE_FLAG = 1 AND ASSET_CODE = '{asset.ASSET_CODE}'"));
            }
        }
Beispiel #11
0
 /// <summary>
 /// 按照关键字段删除
 /// </summary>
 /// <param name="Id">关键字段</param>
 /// <returns>是否成功</returns>
 public bool DelAmAssetMasterN(string Id)
 {
     using (IAmAssetMasterNBLL AmAssetMasterNBLL = BLLContainer.Resolve <IAmAssetMasterNBLL>())
     {
         try
         {
             AmAssetMasterN item = AmAssetMasterNBLL.GetFirstOrDefault(Id);
             return(AmAssetMasterNBLL.Delete(item));
         }
         catch { return(false); }
     }
 }
Beispiel #12
0
        private void BtnAdd_Click(object sender, RoutedEventArgs e)
        {
            MaintainStandard_NingBo d = new MaintainStandard_NingBo();

            d.Show();
            return;

            //绑定
            //todo: 未对判重进行逻辑操作。
            RsMaintainStandardsRelate m_RsMaintainStandardsRelate = new RsMaintainStandardsRelate();

            AmAssetMasterN m_AssetMaster = new AmAssetMasterN();

            m_AssetMaster = GridControl.SelectedItem as AmAssetMasterN;
            RsMaintainStandards a_RSMaintainStandars = ComStandard.SelectedItem as RsMaintainStandards;
            List <RsMaintainStandardsDetail> m_RsMaintainStandardsDetail = new List <RsMaintainStandardsDetail>();

            m_RsMaintainStandardsDetail = GridControl_Standards.ItemsSource as List <RsMaintainStandardsDetail>;
            if (m_RsMaintainStandardsDetail == null)
            {
                System.Windows.Forms.MessageBox.Show("请选择维护规程!!!");
                return;
            }
            //解除之前绑定的规程
            List <RsMaintainStandardsRelate> del_RsMaintainStandardsRelate = new List <RsMaintainStandardsRelate>();

            del_RsMaintainStandardsRelate = _EAMClient.UseService(s => s.GetRsMaintainStandardsRelates(""));
            //List<string> delstr = new List<string>();
            foreach (RsMaintainStandardsRelate item in del_RsMaintainStandardsRelate)
            {
                if (item.ASSET_CODE == m_AssetMaster.ASSET_CODE)
                {
                    //delstr.Add(item.PKNO);
                    _EAMClient.UseService(s => s.DelRsMaintainStandardsRelate(item.PKNO));
                }
            }

            int i = 0;

            foreach (RsMaintainStandardsDetail item in m_RsMaintainStandardsDetail)
            {
                m_RsMaintainStandardsRelate.PKNO                 = Guid.NewGuid().ToString("N");
                m_RsMaintainStandardsRelate.ASSET_CODE           = m_AssetMaster.ASSET_CODE;
                m_RsMaintainStandardsRelate.STANDARD_DETAIL_PKNO = item.PKNO;
                m_RsMaintainStandardsRelate.LAST_MAINTAIN_TIME   = DateTime.Now;
                m_RsMaintainStandardsRelate.CREATION_DATE        = DateTime.Now;
                m_RsMaintainStandardsRelate.LAST_UPDATE_DATE     = DateTime.Now;
                _EAMClient.UseService(s => s.AddRsMaintainStandardsRelate(m_RsMaintainStandardsRelate));
                i++;
            }
            System.Windows.Forms.MessageBox.Show("绑定完成");
        }
Beispiel #13
0
        private void cmbAssetInfo_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            AmAssetMasterN asset = cmbAssetInfo.SelectedItem as AmAssetMasterN;

            if (asset == null)
            {
                return;
            }

            FmsAssetCommParam comm = _fmsClient
                                     .UseService(s => s.GetFmsAssetCommParams($"ASSET_CODE = '{asset.ASSET_CODE}' AND USE_FLAG = 1"))
                                     .FirstOrDefault();

            tbAddressIntrod.DataContext = comm;
        }
Beispiel #14
0
        private void DeviceSelect_Closed(object sender, EventArgs e)
        {
            DeviceSelect    deviceSelect  = sender as DeviceSelect;
            AmAssetMasterN  amAssetMaster = deviceSelect.Tag as AmAssetMasterN;
            RsRoutingDetail routingDetail = gridProcessInfo.SelectedItem as RsRoutingDetail;

            if (routingDetail != null && amAssetMaster != null)
            {
                if (routingDetail.WC_ABV != amAssetMaster.ASSET_CODE)
                {
                    routingDetail.WC_ABV  = amAssetMaster.ASSET_CODE;
                    routingDetail.OP_TYPE = amAssetMaster.ASSET_NAME;
                }
            }
        }
Beispiel #15
0
        private void ComAsset_SelectedIndexChanged(object sender, RoutedEventArgs e)
        {
            AmAssetMasterN asset = ComAsset.SelectedItem as AmAssetMasterN;

            if (asset == null)
            {
                GridControlDeviceTool.ItemsSource = null;
            }
            else
            {
                GridControlDeviceTool.ItemsSource =
                    ws.UseService(s => s.GetTmsDeviceToolsPoss($"USE_FLAG = 1 AND DEVICE_PKNO = '{asset.PKNO}'"))
                    .OrderBy(c => c.TOOLS_POS_NO)
                    .ToList();
            }
        }
Beispiel #16
0
        private void GetPage()
        {
            AmAssetMasterN asset = cmbDeviceInfo.SelectedItem as AmAssetMasterN;

            if (asset == null)
            {
                gridItem.ItemsSource = null;
            }
            else
            {
                gridItem.ItemsSource =
                    ws.UseService(s => s.GetTmsDeviceToolsPoss($"USE_FLAG = 1 AND DEVICE_PKNO = '{asset.PKNO}'"))
                    .OrderBy(c => c.TOOLS_POS_NO)
                    .ToList();
            }
        }
Beispiel #17
0
 /// <summary>
 /// 按照关键字段删除
 /// </summary>
 /// <param name="Ids">关键字段数组</param>
 /// <returns>是否成功</returns>
 public bool DelAmAssetMasterNs(string[] Ids)
 {
     using (IAmAssetMasterNBLL AmAssetMasterNBLL = BLLContainer.Resolve <IAmAssetMasterNBLL>())
     {
         try
         {
             List <AmAssetMasterN> entitys = new List <AmAssetMasterN>();
             foreach (string id in Ids)
             {
                 AmAssetMasterN item = AmAssetMasterNBLL.GetFirstOrDefault(id);
                 entitys.Add(item);
             }
             return(AmAssetMasterNBLL.Delete(entitys));
         }
         catch { return(false); }
     }
 }
Beispiel #18
0
        private void BtnSave_Click(object sender, RoutedEventArgs e)
        {
            //保存
            AmAssetMasterN    asset     = cmbAssetInfo.SelectedItem as AmAssetMasterN;
            FmsAssetCommParam assetComm = gbItem.DataContext as FmsAssetCommParam;

            if (assetComm == null)
            {
                return;
            }

            #region

            //TODO: 校验;保存
            if (asset == null)
            {
                MessageBox.Show("请选择设备!", "保存", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                return;
            }

            if (assetComm.PKNO == "")
            {
                assetComm.PKNO             = CBaseData.NewGuid();
                assetComm.CREATED_BY       = CBaseData.LoginName;
                assetComm.CREATION_DATE    = DateTime.Now;
                assetComm.LAST_UPDATE_DATE = DateTime.Now;  //最后修改日期
                _fmsClient.UseService(s => s.AddFmsAssetCommParam(assetComm));
            }
            else
            {
                assetComm.UPDATED_BY       = CBaseData.LoginName;
                assetComm.LAST_UPDATE_DATE = DateTime.Now;
                _fmsClient.UseService(s => s.UpdateFmsAssetCommParam(assetComm));
            }
            NotificationInvoke.NewNotification("保存", "设备通讯配置信息已保存。");

            #endregion

            GetPage();  //重新刷新数据,根据需求是否进行刷新数据

            //保存成功
            gbItem.IsCollapsed = true;
            gbItem.Visibility  = Visibility.Collapsed;
            BindHelper.SetDictDataBindingGridItem(gbItem, gridItem);
        }
Beispiel #19
0
        private void BtnSave_Click(object sender, RoutedEventArgs e)
        {
            //保存
            AmAssetMasterN   asset         = cmbAssetInfo.SelectedItem as AmAssetMasterN;
            FmsActionControl actionControl = gbItem.DataContext as FmsActionControl;

            if (actionControl == null)
            {
                return;
            }

            #region

            //TODO: 校验;保存
            if (asset == null)
            {
                WPFMessageBox.ShowError("请选择设备!", "保存");
                return;
            }
            if (string.IsNullOrEmpty(actionControl.ACTION_NAME))
            {
                WPFMessageBox.ShowError("请输入指令动作名称!", "保存");
                return;
            }

            if (actionControl.PKNO == "")
            {
                actionControl.PKNO = CBaseData.NewGuid();
                _fmsClient.UseService(s => s.AddFmsActionControl(actionControl));
            }
            else
            {
                _fmsClient.UseService(s => s.UpdateFmsActionControl(actionControl));
            }
            WPFMessageBox.ShowTips("指令动作配置信息已保存。", "保存");

            #endregion

            GetPage();  //重新刷新数据,根据需求是否进行刷新数据

            //保存成功
            gbItem.IsCollapsed = true;
            gbItem.Visibility  = Visibility.Collapsed;
            BindHelper.SetDictDataBindingGridItem(gbItem, gridItem);
        }
Beispiel #20
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();
            }
        }
Beispiel #21
0
        private void BtnRefreshCnc(object sender, RoutedEventArgs e)
        {
            ListProgram.Items.Clear();
            AmAssetMasterN amAssetMasterN = amAssetMasterN_temp as AmAssetMasterN;
            FmsAssetCommParam fmsAssetCommParams = new FmsAssetCommParam();
            fmsAssetCommParams = _FMSClient.UseService(s => s.GetFmsAssetCommParams(" ASSET_CODE = " + amAssetMasterN.ASSET_CODE + "")).FirstOrDefault();
            if (fmsAssetCommParams != null)
            {
                IP = fmsAssetCommParams.COMM_ADDRESS;
                //this.lstbx_CNCProgramPath.Items.Clear();

                string ip = IP;
                ushort Flibhndl = 0;
                short ret = Focas1.cnc_allclibhndl3(ip, 8193, 3, out Flibhndl);
                if (ret != Focas1.EW_OK)
                {
                    Flibhndl = 0;
                    return;
                }
                string drive = "";
                Focas1.ODBPDFDRV odbpdfdrv = new Focas1.ODBPDFDRV();
                ret = Focas1.cnc_rdpdf_drive(Flibhndl, odbpdfdrv);
                switch (odbpdfdrv.max_num)
                {
                    case 1:
                        drive = "//" + odbpdfdrv.drive1 + "/";// 
                        break;
                }
                //this.lbCNCPath.Text = drive;//"//CNC_MEM/"

                GetProgramDir(drive);
                foreach (var item in array_Folder)
                {
                    ListProgram.Items.Add(item.ToString());
                    //this.lstbx_CNCProgramPath.Items.Add(item.ToString());
                }
                foreach (var item in array_File)
                {
                    ListProgram.Items.Add(item.ToString());
                    //this.lstbx_CNCProgramPath.Items.Add(item.ToString());
                }

            }
        }
Beispiel #22
0
        private void gridItem_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            AmAssetMasterN asset = cmbDeviceInfo.SelectedItem as AmAssetMasterN;

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

            if (m_TmsDeviceToolsPos == null)
            {
                return;
            }
            //修改
            gbItem.IsCollapsed  = false;
            dictInfo.Header     = "设备刀位信息  【修改】";
            dictInfo.Visibility = Visibility.Visible;

            dictInfo.DataContext = m_TmsDeviceToolsPos;
        }
Beispiel #23
0
        private void BtnMod_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;
            }
            //修改
            gbItem.IsCollapsed  = false;
            dictInfo.Header     = "设备刀位信息  【修改】";
            dictInfo.Visibility = Visibility.Visible;

            dictInfo.DataContext = m_TmsDeviceToolsPos;
        }
Beispiel #24
0
        private void GetPage()
        {
            gridChangeTools.ItemsSource = null;

            MesJobOrder jobOrder = cmbTask.SelectedItem as MesJobOrder;

            if (jobOrder == null)
            {
                return;
            }

            string itemPKNO = cmbProduct.SelectedValue.ToString();

            if (string.IsNullOrEmpty(itemPKNO))
            {
                return;                                 //产品
            }
            string          processPKNO   = cmbProcess.SelectedValue.ToString();
            RsRoutingDetail routingDetail = wsRSM.UseService(s => s.GetRsRoutingDetailById(processPKNO));

            if (routingDetail == null)
            {
                return;
            }

            AmAssetMasterN wcDevice = cmbDevice.SelectedItem as AmAssetMasterN;

            if (wcDevice == null)
            {
                return;
            }

            #region 换刀清单

            gridChangeTools.ItemsSource =
                wsTMS.UseService(s => s.GetTmsDeviceToolsPoss($"USE_FLAG = 1 AND DEVICE_PKNO = '{wcDevice.PKNO}'"))
                .OrderBy(c => c.TOOLS_POS_NO)
                .ToList();
            #endregion
        }
Beispiel #25
0
        private void BtnSave_Click(object sender, RoutedEventArgs e)
        {
            //保存
            AmAssetMasterN AssetMasterN = gbItem.DataContext as AmAssetMasterN;

            if (AssetMasterN == null)
            {
                return;
            }

            #region  TODO: 校验

            //TODO: 校验

            #endregion

            if (string.IsNullOrEmpty(AssetMasterN.PKNO)) //新增
            {
                AssetMasterN.PKNO             = Guid.NewGuid().ToString("N");
                AssetMasterN.CREATED_BY       = CBaseData.LoginName;
                AssetMasterN.CREATION_DATE    = DateTime.Now;
                AssetMasterN.LAST_UPDATE_DATE = DateTime.Now; //最后修改日期

                ws.UseService(s => s.AddAmAssetMasterN(AssetMasterN));
            }
            else //修改
            {
                AssetMasterN.UPDATED_BY       = CBaseData.LoginName;
                AssetMasterN.LAST_UPDATE_DATE = DateTime.Now;
                ws.UseService(s => s.UpdateAmAssetMasterN(AssetMasterN));
            }

            GetPage(); //重新刷新数据,根据需求是否进行刷新数据

            //保存成功
            gbItem.IsCollapsed = true;
            gbItem.Visibility  = Visibility.Collapsed;
        }
Beispiel #26
0
        private void GridControl_SelectedItemChanged(object sender, DevExpress.Xpf.Grid.SelectedItemChangedEventArgs e)
        {
            List <RsMaintainStandardsRelate> m_RsMaintainStandardsRelate = new List <RsMaintainStandardsRelate>();
            AmAssetMasterN m_AssetMaster = new AmAssetMasterN();

            m_AssetMaster = GridControl.SelectedItem as AmAssetMasterN;
            List <RsMaintainStandardsDetail> m_RsMaintainStandardsDetail = new List <RsMaintainStandardsDetail>();

            m_RsMaintainStandardsRelate = _EAMClient.UseService(s => s.GetRsMaintainStandardsRelates("ASSET_CODE = " + m_AssetMaster.ASSET_CODE + ""));
            if (m_RsMaintainStandardsRelate.Count > 0)
            {
                m_RsMaintainStandardsDetail = _EAMClient.UseService(s => s.GetRsMaintainStandardsDetails("PKNO = " + m_RsMaintainStandardsRelate[0].STANDARD_DETAIL_PKNO + ""));
                //GridControl_Standards.ItemsSource = m_RsMaintainStandardsDetail;
                if (m_RsMaintainStandardsDetail.Count > 0)
                {
                    RsMaintainStandards a_RSMaintainStandars = _EAMClient.UseService(s => s.GetRsMaintainStandardsById(m_RsMaintainStandardsDetail[0].STANDARD_PKNO));

                    for (int i = 0; i < ComStandard.Items.Count; i++)
                    {
                        RsMaintainStandards temp = ComStandard.Items[i] as RsMaintainStandards;
                        if (temp.STANDARD_NAME == a_RSMaintainStandars.STANDARD_NAME)
                        {
                            ComStandard.SelectedIndex = 0;
                            ComStandard.SelectedIndex = i;
                        }
                    }
                    this.ComStandard.SelectedText = a_RSMaintainStandars.STANDARD_NAME;
                }


                //this.ComStandard.SelectedIndex();
            }
            else
            {
                this.ComStandard.Text             = "";
                GridControl_Standards.ItemsSource = null;
            }
        }
Beispiel #27
0
        private void BtnAdd_Click(object sender, RoutedEventArgs e)
        {
            AmAssetMasterN asset = cmbDeviceInfo.SelectedItem as AmAssetMasterN;

            if (asset == null)
            {
                return;
            }
            gbItem.IsCollapsed = false;
            //新增
            dictInfo.Header     = "设备刀位信息  【新增】";
            dictInfo.Visibility = Visibility.Visible;

            TmsDeviceToolsPos m_TmsDeviceToolsPos = new TmsDeviceToolsPos()
            {
                DEVICE_PKNO = asset.PKNO,
                TOOLS_PKNO  = "",
                TOOLS_STATE = 0,  //空
                USE_FLAG    = 1,
            };

            dictInfo.DataContext = m_TmsDeviceToolsPos;
        }
Beispiel #28
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();  //重新加载
            }
        }
Beispiel #29
0
        private void BtnAdd_Click(object sender, RoutedEventArgs e)
        {
            //新增

            #region

            //TODO: 校验

            #endregion

            AmAssetMasterN AssetMasterN = new AmAssetMasterN()
            {
                COMPANY_CODE     = "",
                CREATION_DATE    = DateTime.Now,
                LAST_UPDATE_DATE = DateTime.Now, //最后修改日期
                USE_FLAG         = 1,            //启用
            };
            gbItem.DataContext = AssetMasterN;

            //dictBasic.Header = $"{HeaderName}  【新增】";
            gbItem.IsCollapsed     = false;
            gbItem.Visibility      = Visibility.Visible;
            tbAssetCode.IsReadOnly = false;
        }
Beispiel #30
0
        private void bSave_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            if (cmbRoutingMain.SelectedValue == null)
            {
                return;
            }

            #region 创建生产过程

            //生产线数据
            PmTaskLine taskLine = cmbTask.SelectedItem as PmTaskLine;
            //产品数据
            string       itemPKNO = cmbProduct.SelectedValue.ToString();
            RsItemMaster product  = wsRSM.UseService(s => s.GetRsItemMasterById(itemPKNO));
            if (product == null)
            {
                MessageBox.Show("产品信息不存在,请核实.", "完成生产准备", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            //准备完成
            List <MesProcessCtrol> processCtrols    = new List <MesProcessCtrol>();
            List <RsRoutingDetail> rsRoutingDetails = gridProcessInfo.ItemsSource as List <RsRoutingDetail>;

            //已创建加工数量
            int     qty         = CheckPlanQTY(taskLine.TASK_NO);
            decimal preparedQty = 0;
            decimal.TryParse(tbTaskQty.Text.ToString(), out preparedQty);
            if (preparedQty <= 0)
            {
                MessageBox.Show("请输入正确的任务数量.", "完成生产准备", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            #region 判断加工数量

            if (tbTaskQty.Text.ToString() == "")
            {
                MessageBox.Show($"请输入数量", "未输入数量", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (int.Parse(tbTaskQty.Text.ToString()) + qty > taskLine.TASK_QTY)
            {
                MessageBox.Show($"输入数量超出订单加工数量", "数量超限", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            #endregion

            AmAssetMasterN mainDevice = cmbAssetInfo.SelectedItem as AmAssetMasterN;

            if (mainDevice == null)
            {
                MessageBox.Show("请选择主控PLC", "完成生产准备", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            #region 创建工单表

            MesJobOrder jobOrder = new MesJobOrder()
            {
                PKNO                = Guid.NewGuid().ToString("N"),
                COMPANY_CODE        = "",
                LINE_PKNO           = taskLine.LINE_PKNO, //产线信息
                LINE_TASK_PKNO      = taskLine.PKNO,
                ITEM_PKNO           = itemPKNO,
                JOB_ORDER_NO        = taskLine.TASK_NO + lbBatchIndex.Content.ToString(),
                BATCH_NO            = lbBatchIndex.Content.ToString(),
                ROUTING_DETAIL_PKNO = cmbRoutingMain.SelectedValue.ToString(),
                TASK_QTY            = preparedQty,
                COMPLETE_QTY        = 0,
                ONLINE_QTY          = 0,
                ONCE_QTY            = 0,
                RUN_STATE           = 1, //准备完成
                CREATION_DATE       = DateTime.Now,
                CREATED_BY          = CBaseData.LoginName,
                USE_FLAG            = 1,
                REMARK              = "",
            };

            #endregion

            List <MesProcessCtrol> newMesProcessCtrols = new List <MesProcessCtrol>();

            int iProcessIndex = 0;

            string DeviceInfos = "";
            string Programs    = "";

            #region 获取加工设备、程序号

            foreach (RsRoutingDetail item in rsRoutingDetails)
            {
                if (string.IsNullOrEmpty(item.WC_ABV))
                {
                    MessageBox.Show($"工序【{item.OP_NAME}】加工设备不能为空,请选择加工设备!",
                                    "完成生产准备", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }

                AmAssetMasterN device = wsEAM.UseService(s => s.GetAmAssetMasterNById(item.WC_ABV));
                if (device == null)
                {
                    MessageBox.Show($"工序【{item.OP_NAME}】加工设备,请选择加工设备!",
                                    "完成生产准备", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }

                DeviceInfos += device.ASSET_LABEL;  //设备
                Programs    += item.NC_PRO_NAME;    //程序号
            }

            #endregion

            wsPLM.UseService(s => s.AddMesJobOrder(jobOrder));  //添加工单

            #region 添加加工工序,共5步

            FmsActionControl ctrl1 =
                wsFMS.UseService(s => s.GetFmsActionControls($"ASSET_CODE = '{mainDevice.ASSET_CODE}' AND ACTION_NAME = '发送产品信息'"))
                .FirstOrDefault();      //
            FmsActionControl ctrl2 =
                wsFMS.UseService(s => s.GetFmsActionControls($"ASSET_CODE = '{mainDevice.ASSET_CODE}' AND ACTION_NAME = '发送数量'"))
                .FirstOrDefault();      //
            FmsActionControl ctrl3 =
                wsFMS.UseService(s => s.GetFmsActionControls($"ASSET_CODE = '{mainDevice.ASSET_CODE}' AND ACTION_NAME = '发送设备及程序号'"))
                .FirstOrDefault();      //
            FmsActionControl ctrl4 =
                wsFMS.UseService(s => s.GetFmsActionControls($"ASSET_CODE = '{mainDevice.ASSET_CODE}' AND ACTION_NAME = '订单确认'"))
                .FirstOrDefault();      //
            FmsActionControl ctrl5 =
                wsFMS.UseService(s => s.GetFmsActionControls($"ASSET_CODE = '{mainDevice.ASSET_CODE}' AND ACTION_NAME = '订单完成'"))
                .FirstOrDefault();      //

            #region 1.第一步发送产品信息

            MesProcessCtrol step1 = new MesProcessCtrol()
            {
                PKNO                        = CBaseData.NewGuid(),
                COMPANY_CODE                = "",
                JOB_ORDER_PKNO              = jobOrder.PKNO,
                JOB_ORDER                   = cmbTask.Text + lbBatchIndex.Content, //工单编号
                ITEM_PKNO                   = jobOrder.ITEM_PKNO,                  //产品PKNO
                SUB_JOB_ORDER_NO            = "",
                ROUTING_DETAIL_PKNO         = "",                                  //工序编号(工艺路线明细)为空,不按照工艺进行控制
                PROCESS_DEVICE_PKNO         = mainDevice.PKNO,                     //加工设备为 主控PLC
                PROCESS_INDEX               = 0,
                PROCESS_ACTION_TYPE         = 0,
                PROCESS_ACTION_PKNO         = (ctrl1 == null) ? "" : ctrl1.PKNO,
                PROCESS_ACTION_PARAM1_VALUE = product.ITEM_ABV, //产品简称
                PROCESS_ACTION_PARAM2_VALUE = "",
                CUR_PRODUCT_CODE_PKNO       = "",
                PROCESS_QTY                 = preparedQty,
                COMPLETE_QTY                = 0,
                QUALIFIED_QTY               = 0,
                PROCESS_STATE               = 1,
                CREATION_DATE               = DateTime.Now,
                CREATED_BY                  = CBaseData.LoginName,
                USE_FLAG                    = 1,
                REMARK                      = "系统自动形成",
            };

            #endregion end 1

            #region 2.第二步发送数量

            MesProcessCtrol step2 = new MesProcessCtrol()
            {
                PKNO                        = CBaseData.NewGuid(),
                COMPANY_CODE                = "",
                JOB_ORDER_PKNO              = jobOrder.PKNO,
                JOB_ORDER                   = cmbTask.Text + lbBatchIndex.Content, //工单编号
                ITEM_PKNO                   = jobOrder.ITEM_PKNO,                  //产品PKNO
                SUB_JOB_ORDER_NO            = "",
                ROUTING_DETAIL_PKNO         = "",                                  //工序编号(工艺路线明细)为空,不按照工艺进行控制
                PROCESS_DEVICE_PKNO         = mainDevice.PKNO,                     //加工设备为 主控PLC
                PROCESS_INDEX               = 1,
                PROCESS_ACTION_TYPE         = 0,
                PROCESS_ACTION_PKNO         = (ctrl2 == null) ? "" : ctrl2.PKNO,
                PROCESS_ACTION_PARAM1_VALUE = preparedQty.ToString(), //数量
                PROCESS_ACTION_PARAM2_VALUE = "",
                CUR_PRODUCT_CODE_PKNO       = "",
                PROCESS_QTY                 = preparedQty,
                COMPLETE_QTY                = 0,
                QUALIFIED_QTY               = 0,
                PROCESS_STATE               = 1,
                CREATION_DATE               = DateTime.Now,
                CREATED_BY                  = CBaseData.LoginName,
                USE_FLAG                    = 1,
                REMARK                      = "系统自动形成",
            };

            #endregion end 2

            #region 3.第三步发送设备及程序号

            MesProcessCtrol step3 = new MesProcessCtrol()
            {
                PKNO                        = CBaseData.NewGuid(),
                COMPANY_CODE                = "",
                JOB_ORDER_PKNO              = jobOrder.PKNO,
                JOB_ORDER                   = cmbTask.Text + lbBatchIndex.Content, //工单编号
                ITEM_PKNO                   = jobOrder.ITEM_PKNO,                  //产品PKNO
                SUB_JOB_ORDER_NO            = "",
                ROUTING_DETAIL_PKNO         = "",                                  //工序编号(工艺路线明细)为空,不按照工艺进行控制
                PROCESS_DEVICE_PKNO         = mainDevice.PKNO,                     //加工设备为 主控PLC
                PROCESS_INDEX               = 2,
                PROCESS_ACTION_TYPE         = 0,
                PROCESS_ACTION_PKNO         = (ctrl3 == null) ? "" : ctrl3.PKNO,
                PROCESS_ACTION_PARAM1_VALUE = DeviceInfos, //设备ID
                PROCESS_ACTION_PARAM2_VALUE = Programs,    //程序号
                CUR_PRODUCT_CODE_PKNO       = "",
                PROCESS_QTY                 = preparedQty,
                COMPLETE_QTY                = 0,
                QUALIFIED_QTY               = 0,
                PROCESS_STATE               = 1,
                CREATION_DATE               = DateTime.Now,
                CREATED_BY                  = CBaseData.LoginName,
                USE_FLAG                    = 1,
                REMARK                      = "系统自动形成",
            };

            #endregion end 3

            #region 4.第四步发送订单确认

            MesProcessCtrol step4 = new MesProcessCtrol()
            {
                PKNO                        = CBaseData.NewGuid(),
                COMPANY_CODE                = "",
                JOB_ORDER_PKNO              = jobOrder.PKNO,
                JOB_ORDER                   = cmbTask.Text + lbBatchIndex.Content, //工单编号
                ITEM_PKNO                   = jobOrder.ITEM_PKNO,                  //产品PKNO
                SUB_JOB_ORDER_NO            = "",
                ROUTING_DETAIL_PKNO         = "",                                  //工序编号(工艺路线明细)为空,不按照工艺进行控制
                PROCESS_DEVICE_PKNO         = mainDevice.PKNO,                     //加工设备为 主控PLC
                PROCESS_INDEX               = 3,
                PROCESS_ACTION_TYPE         = 0,
                PROCESS_ACTION_PKNO         = (ctrl4 == null) ? "" : ctrl4.PKNO,
                PROCESS_ACTION_PARAM1_VALUE = cmbTask.Text + lbBatchIndex.Content, //订单ID
                PROCESS_ACTION_PARAM2_VALUE = "",                                  //
                CUR_PRODUCT_CODE_PKNO       = "",
                PROCESS_QTY                 = preparedQty,
                COMPLETE_QTY                = 0,
                QUALIFIED_QTY               = 0,
                PROCESS_STATE               = 1,
                CREATION_DATE               = DateTime.Now,
                CREATED_BY                  = CBaseData.LoginName,
                USE_FLAG                    = 1,
                REMARK                      = "系统自动形成",
            };

            #endregion end 4

            #region 5.第五步订单完成

            MesProcessCtrol step5 = new MesProcessCtrol()
            {
                PKNO                        = CBaseData.NewGuid(),
                COMPANY_CODE                = "",
                JOB_ORDER_PKNO              = jobOrder.PKNO,
                JOB_ORDER                   = cmbTask.Text + lbBatchIndex.Content, //工单编号
                ITEM_PKNO                   = jobOrder.ITEM_PKNO,                  //产品PKNO
                SUB_JOB_ORDER_NO            = "",
                ROUTING_DETAIL_PKNO         = "",                                  //工序编号(工艺路线明细)为空,不按照工艺进行控制
                PROCESS_DEVICE_PKNO         = mainDevice.PKNO,                     //加工设备为 主控PLC
                PROCESS_INDEX               = 4,
                PROCESS_ACTION_TYPE         = 0,
                PROCESS_ACTION_PKNO         = (ctrl5 == null) ? "" : ctrl5.PKNO,
                PROCESS_ACTION_PARAM1_VALUE = "", //
                PROCESS_ACTION_PARAM2_VALUE = "", //
                CUR_PRODUCT_CODE_PKNO       = "",
                PROCESS_QTY                 = preparedQty,
                COMPLETE_QTY                = 0,
                QUALIFIED_QTY               = 0,
                PROCESS_STATE               = 1,
                CREATION_DATE               = DateTime.Now,
                CREATED_BY                  = CBaseData.LoginName,
                USE_FLAG                    = 1,
                REMARK                      = "系统自动形成",
            };

            #endregion end 5

            wsPLM.UseService(s => s.AddMesProcessCtrol(step1));
            wsPLM.UseService(s => s.AddMesProcessCtrol(step2));
            wsPLM.UseService(s => s.AddMesProcessCtrol(step3));
            wsPLM.UseService(s => s.AddMesProcessCtrol(step4));
            wsPLM.UseService(s => s.AddMesProcessCtrol(step5));

            #endregion

            #endregion

            //修改产线任务的完成数量
            taskLine.PREPARED_QTY += preparedQty;
            if (taskLine.RUN_STATE == 0)
            {
                taskLine.RUN_STATE = 1;
            }
            wsPLM.UseService(s => s.UpdatePmTaskLine(taskLine));

            cmbTask.ItemsSource =
                wsPLM.UseService(s => s.GetPmTaskLines("USE_FLAG = 1 AND RUN_STATE < 10 ")) //未完成的
                .Where(c => c.TASK_QTY > c.PREPARED_QTY)
                .OrderBy(c => c.CREATION_DATE)
                .ToList();     //生产线任务

            cmbTask.SelectedIndex       = -1;
            gridProcessInfo.ItemsSource = null;
        }