/// <summary>
        /// 按钮点击事件-查询出入信息
        /// </summary>
        /// <param name="sender">事件源</param>
        /// <param name="e">事件参数</param>
        private void QueryBtn_Click(object sender, RoutedEventArgs e)
        {
            if (!string.IsNullOrEmpty(moldNR))
            {
                ConditionServiceClient conditionclient = new ConditionServiceClient();
                BasicMessage           msg             = new BasicMessage();

                if (!conditionclient.MoldExist(moldNR))
                {
                    msg.Result = false;
                    msg.MsgContent.Add("模具");
                }
                if (applicantNRTB.Text.Length != 0 && !conditionclient.EmpExist(applicantNRTB.Text))
                {
                    msg.Result = false;
                    msg.MsgContent.Add("员工");
                }
                if (msg.Result == false)
                {
                    MessageBox.Show(msg.MsgText + " 不存在,请重新输入");
                    return;
                }
                MoldPartInfoServiceClient client = new MoldPartInfoServiceClient();
                DateTime?startDT = null;
                DateTime?endDT   = null;
                startDT = startDateDP.Text.Length == 0 ? startDT : DateTime.Parse(startDateDP.Text);
                endDT   = endDateDP.Text.Length == 0 ? endDT : DateTime.Parse(endDateDP.Text);
                List <StorageRecord> storageRecord = client.GetMoldApplyRecords(moldNR, applicantNRTB.Text, startDT, endDT);
                MoldInOutInfoDG.ItemsSource = storageRecord;
            }
        }
Beispiel #2
0
        /// <summary>
        /// 链接点击事件-查看文件
        /// </summary>
        /// <param name="sender">事件源</param>
        /// <param name="e">事件参数</param>
        private void link_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            Attachment attach = (sender as Label).DataContext as Attachment;

            ConfigUtil config    = new ConfigUtil("FILEPATH");
            string     directory = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, config.Get("FILEPATH"));

            if (!Directory.Exists(directory))
            {
                Directory.CreateDirectory(directory);
            }
            string filepath = System.IO.Path.Combine(directory, attach.Path);

            if (!File.Exists(filepath))
            {
                MoldPartInfoServiceClient client = new MoldPartInfoServiceClient();
                byte[] data = client.GetFileByName(attach.Path);
                if (data == null)
                {
                    MessageBox.Show("文件不存在");
                    return;
                }
                FileUtil.SavaFIle(filepath, data);
            }
            if (File.Exists(filepath))
            {
                Process.Start(filepath);
            }
        }
        /// <summary>
        /// 按钮点击事件-查询出入信息
        /// </summary>
        /// <param name="sender">事件源</param>
        /// <param name="e">事件参数</param>
        private void QueryBtn_Click(object sender, RoutedEventArgs e)
        {
            if (!string.IsNullOrEmpty(moldNR))
            {
                ConditionServiceClient conditionclient = new ConditionServiceClient();
                BasicMessage msg = new BasicMessage();

                if (!conditionclient.MoldExist(moldNR))
                {
                    msg.Result = false;
                    msg.MsgContent.Add("模具");
                }
                if (applicantNRTB.Text.Length != 0&&!conditionclient.EmpExist(applicantNRTB.Text))
                {
                    msg.Result = false;
                    msg.MsgContent.Add("员工");
                }
                if (msg.Result == false)
                {
                    MessageBox.Show(msg.MsgText+" 不存在,请重新输入");
                    return;
                }
                MoldPartInfoServiceClient client = new MoldPartInfoServiceClient();
                DateTime? startDT = null;
                DateTime? endDT = null;
                startDT = startDateDP.Text.Length == 0 ? startDT : DateTime.Parse(startDateDP.Text);
                endDT = endDateDP.Text.Length == 0 ? endDT : DateTime.Parse(endDateDP.Text);
                List<StorageRecord> storageRecord = client.GetMoldApplyRecords(moldNR, applicantNRTB.Text, startDT, endDT);
                MoldInOutInfoDG.ItemsSource = storageRecord;
            }
        }
Beispiel #4
0
 /// <summary>
 /// 页面加载事件
 /// </summary>
 /// <param name="sender">事件源</param>
 /// <param name="e">事件参数</param>
 private void Page_Loaded(object sender, RoutedEventArgs e)
 {
     if (!string.IsNullOrEmpty(moldNR))
     {
         ConditionServiceClient conditionclient = new ConditionServiceClient();
         if (!conditionclient.MoldExist(moldNR))
         {
             MessageBox.Show("此磨具不存在");
             return;
         }
         MoldPartInfoServiceClient client = new MoldPartInfoServiceClient();
         MoldBaseInfo moldBaseInfo        = client.GetMoldBaseInfoByNR(moldNR);
         BasicInfoGrid.DataContext = moldBaseInfo;
         List <Attachment> attach = moldBaseInfo.Attach;
         int i = 1;
         foreach (Attachment at in attach)
         {
             Label link = new Label()
             {
                 Content = i.ToString() + ". " + at.Name + "  ", Foreground = System.Windows.Media.Brushes.DarkGreen
             };
             link.MouseLeftButtonUp  += new MouseButtonEventHandler(link_MouseLeftButtonUp);
             link.MouseRightButtonUp += new MouseButtonEventHandler(link_MouseRightButtonUp);
             link.MouseEnter         += new MouseEventHandler(link_MouseEnter);
             link.MouseLeave         += new MouseEventHandler(link_MouseLeave);
             link.DataContext         = at;
             AttachmentTB.Inlines.Add(link);
             i += 1;
         }
     }
 }
        /// <summary>
        /// 链接点击事件-查看文件
        /// </summary>
        /// <param name="sender">事件源</param>
        /// <param name="e">事件参数</param>
        private void Hyperlink_Click(object sender, RoutedEventArgs e)
        {
            Attachment attach = (sender as Hyperlink).DataContext as Attachment;

            ConfigUtil config = new ConfigUtil("FILEPATH");
            string directory = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, config.Get("FILEPATH"));
            if (!Directory.Exists(directory))
                Directory.CreateDirectory(directory);
            string filepath = System.IO.Path.Combine(directory, attach.Path);
            if (!File.Exists(filepath))
            {
                MoldPartInfoServiceClient client = new MoldPartInfoServiceClient();
                byte[] data = client.GetFileByName(attach.Path);
                if (data == null)
                {
                    MessageBox.Show("文件不存在");
                    return;
                }
                FileUtil.SavaFIle(filepath, data);
                //if (FileUtil.SavaFIle(filepath, data))
                //    MessageBox.Show("文件保存成功,目录为:" + filepath);
                //else
                //    MessageBox.Show("文件保存失败");
            }
            if (File.Exists(filepath))
                Process.Start(filepath);
        }
Beispiel #6
0
 private void ExportBtn_Click(object sender, RoutedEventArgs e)
 {
     saveFileDialog.FileName = DateTime.Now.ToString("yyyyMMddHHmmss") + ".xls";
     if ((bool)saveFileDialog.ShowDialog())
     {
         MoldPartInfoServiceClient client    = new MoldPartInfoServiceClient();
         List <MoldWarnInfo>       warnInfos = client.GetMoldWarnInfo((MoldWarnType)(int.Parse(WarnCB.SelectedValue.ToString())));
         string[] headers = { "模具号", "借出员工", "成本中心", "当前位置", "维护周期", "借出时间", "应还时间", "相距时间" };
         string[] pathes  = { "MoldNR", "ApplicantId", "ProjectName", "CurrentPosition", "MaxLendHour", "LendTime", "ShouldReTime", "DisTimeText" };
         if (warnInfos.Count > 0)
         {
             if (GenExcelHelper.GenExcel <MoldWarnInfo>(saveFileDialog.FileName, "超期数据", headers, pathes, warnInfos))
             {
                 MessageBox.Show("数据导出成功,请到保存路径查看");
             }
             else
             {
                 MessageBox.Show("数据导出失败(可能指定文件已经打开),请重试");
             }
         }
         else
         {
             MessageBox.Show("不存在记录数据");
         }
     }
 }
Beispiel #7
0
        /// <summary>
        /// 按钮点击事件-模具警报信息搜索
        /// </summary>
        /// <param name="sender">事件源</param>
        /// <param name="e">事件参数</param>
        private void SearchBtn_Click(object sender, RoutedEventArgs e)
        {
            MoldPartInfoServiceClient client    = new MoldPartInfoServiceClient();
            List <MoldWarnInfo>       warnInfos = client.GetMoldWarnInfo((MoldWarnType)(int.Parse(WarnCB.SelectedValue.ToString())));

            MoldBaseInfoDG.ItemsSource = warnInfos;
        }
 private void DataTimer_Tick(object sender, EventArgs e)
 {
     if (!WarnAlert.Shown)
     {
         MoldPartInfoServiceClient client = new MoldPartInfoServiceClient();
         List<MoldWarnInfo> warnInfos = client.GetMoldWarnInfo(MoldWarnType.OutTime);
         if (warnInfos.Count > 0)
         {
             new WarnAlert(warnInfos).Show();
         }
     }
 }
Beispiel #9
0
 private void DataTimer_Tick(object sender, EventArgs e)
 {
     if (!WarnAlert.Shown)
     {
         MoldPartInfoServiceClient client    = new MoldPartInfoServiceClient();
         List <MoldWarnInfo>       warnInfos = client.GetMoldWarnInfo(MoldWarnType.OutTime);
         if (warnInfos.Count > 0)
         {
             new WarnAlert(warnInfos).Show();
         }
     }
 }
 /// <summary>
 /// 页面加载事件
 /// </summary>
 /// <param name="sender">事件源</param>
 /// <param name="e">事件参数</param>
 private void Page_Loaded(object sender, RoutedEventArgs e)
 {
     if (!string.IsNullOrEmpty(moldNR))
     {
         ConditionServiceClient conditionclient = new ConditionServiceClient();
         if (!conditionclient.MoldExist(moldNR))
         {
             MessageBox.Show("此磨具不存在");
             return;
         }
         MoldPartInfoServiceClient client          = new MoldPartInfoServiceClient();
         MoldDynamicInfo           moldDynamicInfo = client.GetMoldDynamicInfoByMoldNR(moldNR);
         MoldDynamicInfoGrid.DataContext = moldDynamicInfo;
     }
 }
Beispiel #11
0
        /// <summary>
        /// 按钮点击事件-搜索模具
        /// </summary>
        /// <param name="sender">事件源</param>
        /// <param name="e">事件参数</param>
        private void SearchBtn_Click(object sender, RoutedEventArgs e)
        {
            MoldSearchCondition condition = new MoldSearchCondition();

            condition.MoldNR     = MoldNRTB.Text + ";" + PositionTB.Text;
            condition.MoldTypeId = MoldTypeCB.SelectedIndex < 1 ? string.Empty : MoldTypeCB.SelectedValue.ToString();
            condition.ProjectId  = ProjectCB.SelectedIndex < 1 ? string.Empty :ProjectCB.SelectedValue.ToString();
            condition.State      = StateCB.SelectedIndex < 1 ? ToolingManWPF.MoldPartInfoServiceReference.MoldStateType.NULL : (ToolingManWPF.MoldPartInfoServiceReference.MoldStateType)(int.Parse(StateCB.SelectedValue.ToString()));
            //condition.Warn = WarnCB.SelectedIndex < 1 ? MoldWarnType.NULL : (MoldWarnType)(int.Parse(WarnCB.SelectedValue.ToString()));

            MoldPartInfoServiceClient client       = new MoldPartInfoServiceClient();
            List <MoldBaseInfo>       moldBaseInfo = client.GetMoldByMutiConditions(condition);

            MoldBaseInfoDG.ItemsSource = moldBaseInfo;
        }
 /// <summary>
 /// 按钮点击事件-判断模具移库合法性
 /// </summary>
 /// <param name="sender">事件源</param>
 /// <param name="e">事件参数</param>
 private void CheckMoldBtn_Click(object sender, RoutedEventArgs e)
 {
     if (DesiPosiNRTB.Text.Length > 0)
     {
         MoldPartInfoServiceClient client = new MoldPartInfoServiceClient();
         string moldNr = client.GetMoldNrByPosiNr(DesiPosiNRTB.Text);
         if (moldNr.Length > 0)
         {
             DesiPosiMoldNrLab.Content = moldNr + "        >>移库将调换两个模具库位";
         }
         else {
             DesiPosiMoldNrLab.Content = "目标位置不存在模具";
         }
         OKBtn.IsEnabled = true;
     }
 }
Beispiel #13
0
 private void link_MouseRightButtonUp(object sender, MouseButtonEventArgs e)
 {
     if (MessageBox.Show("确定删除?", "确认提示", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes)
     {
         Attachment attach = (sender as Label).DataContext as Attachment;
         MoldPartInfoServiceClient client = new MoldPartInfoServiceClient();
         if (client.DelAttachmentById(attach.AttachmentId, attach.Path))
         {
             ConfigUtil config    = new ConfigUtil("FILEPATH");
             string     directory = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, config.Get("FILEPATH"));
             string     filepath  = System.IO.Path.Combine(directory, attach.Path);
             File.Delete(filepath);
             (sender as Label).Visibility = Visibility.Hidden;
         }
     }
 }
        /// <summary>
        /// 页面加载事件
        /// </summary>
        /// <param name="sender">事件源</param>
        /// <param name="e">事件参数</param>
        private void Page_Loaded(object sender, RoutedEventArgs e)
        {
            if (!string.IsNullOrEmpty(moldNR))
            {
                ConditionServiceClient conditionclient = new ConditionServiceClient();
                if (!conditionclient.MoldExist(moldNR))
                {
                    MessageBox.Show("此磨具不存在");
                    return;
                }
                MoldPartInfoServiceClient client = new MoldPartInfoServiceClient();
                MoldDynamicInfo moldDynamicInfo = client.GetMoldDynamicInfoByMoldNR(moldNR);
                MoldDynamicInfoGrid.DataContext = moldDynamicInfo;

            }
        }
 /// <summary>
 /// 按钮点击事件-判断模具移库合法性
 /// </summary>
 /// <param name="sender">事件源</param>
 /// <param name="e">事件参数</param>
 private void CheckMoldBtn_Click(object sender, RoutedEventArgs e)
 {
     if (DesiPosiNRTB.Text.Length > 0)
     {
         MoldPartInfoServiceClient client = new MoldPartInfoServiceClient();
         string moldNr = client.GetMoldNrByPosiNr(DesiPosiNRTB.Text);
         if (moldNr.Length > 0)
         {
             DesiPosiMoldNrLab.Content = moldNr + "        >>移库将调换两个模具库位";
         }
         else
         {
             DesiPosiMoldNrLab.Content = "目标位置不存在模具";
         }
         OKBtn.IsEnabled = true;
     }
 }
        /// <summary>
        /// query the part storage
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void QueryBtn_Click(object sender, RoutedEventArgs e)
        {
            MoldPartInfoServiceClient client = new MoldPartInfoServiceClient();
            DateTime?startDT = null;
            DateTime?endDT   = null;

            startDT = startDateDP.Text.Length == 0 ? startDT : DateTime.Parse(startDateDP.Text);
            endDT   = endDateDP.Text.Length == 0 ? endDT : DateTime.Parse(endDateDP.Text);
            string partGroupNR = PartGroupCB.SelectedIndex > 0 ? PartGroupCB.SelectedValue.ToString() : string.Empty;
            string partNR      = PartCB.SelectedIndex > 0 ? PartCB.SelectedValue.ToString() : string.Empty;
            string warehouseNR = WarehouseCB.SelectedIndex > 0 ? WarehouseCB.SelectedValue.ToString() : string.Empty;
            string positionNR  = PositionNRTB.Text;

            List <PartView> parts = client.GetPartsByMutiConditions(partGroupNR, partNR, warehouseNR, positionNR, startDT, endDT);

            PartStorageDG.ItemsSource = parts;
        }
 private void ExportBtn_Click(object sender, RoutedEventArgs e)
 {
     saveFileDialog.FileName = DateTime.Now.ToString("yyyyMMddHHmmss") + ".xls";
      if ((bool)saveFileDialog.ShowDialog())
      {
          MoldPartInfoServiceClient client = new MoldPartInfoServiceClient();
          List<MoldWarnInfo> warnInfos = client.GetMoldWarnInfo((MoldWarnType)(int.Parse(WarnCB.SelectedValue.ToString())));
          string[] headers = { "模具号","借出员工", "成本中心", "当前位置", "维护周期","借出时间","应还时间","相距时间"};
          string[] pathes = { "MoldNR", "ApplicantId", "ProjectName", "CurrentPosition", "MaxLendHour", "LendTime", "ShouldReTime", "DisTimeText" };
          if (warnInfos.Count > 0)
              if (GenExcelHelper.GenExcel<MoldWarnInfo>(saveFileDialog.FileName, "超期数据", headers, pathes, warnInfos))
                  MessageBox.Show("数据导出成功,请到保存路径查看");
              else
                  MessageBox.Show("数据导出失败(可能指定文件已经打开),请重试");
          else
              MessageBox.Show("不存在记录数据");
      }
 }
Beispiel #18
0
        /// <summary>
        /// 显示模具位置
        /// </summary>
        private void ShowMoldPosition()
        {
            ConditionServiceClient conditionclient = new ConditionServiceClient();
            BasicMessage           bmsg            = new BasicMessage();

            if (!conditionclient.MoldExist(MoldNRTB.Text))
            {
                bmsg.Result       = false;
                MoldPosiNRTB.Text = string.Empty;
            }
            if (bmsg.Result == false)
            {
                return;
            }
            MoldPartInfoServiceClient moldpartClient = new MoldPartInfoServiceClient();

            MoldPosiNRTB.Text = moldpartClient.GetMoldPositionByNr(MoldNRTB.Text).PositionNR;
        }
 /// <summary>
 /// 按钮点击事件-查询放行信息
 /// </summary>
 /// <param name="sender">事件源</param>
 /// <param name="e">事件参数</param>
 private void QueryBtn_Click(object sender, RoutedEventArgs e)
 {
     if (!string.IsNullOrEmpty(moldNR))
     {
         ConditionServiceClient conditionclient = new ConditionServiceClient();
         if (!conditionclient.MoldExist(moldNR))
         {
             MessageBox.Show("此磨具不存在");
             return;
         }
         MoldPartInfoServiceClient client = new MoldPartInfoServiceClient();
         DateTime?startDT = null;
         DateTime?endDT   = null;
         startDT = startDateDP.Text.Length == 0 ? startDT : DateTime.Parse(startDateDP.Text);
         endDT   = endDateDP.Text.Length == 0 ? endDT : DateTime.Parse(endDateDP.Text);
         List <MoldReleaseInfo> moldReleaseInfos = client.GetMoldReleaseInfoByMoldNR(moldNR, TesterNRTB.Text, startDT, endDT);
         MoldReleaseInfoDG.ItemsSource = moldReleaseInfos;
     }
     AttachmentTB.Inlines.Clear();
 }
        /// <summary>
        /// 按钮点击事件-模具归还
        /// </summary>
        /// <param name="sender">事件源</param>
        /// <param name="e">事件参数</param>
        private void ReturnMoldBtn_Click(object sender, RoutedEventArgs e)
        {
            if (!string.IsNullOrWhiteSpace(MoldNRTB.Text) && !string.IsNullOrWhiteSpace(ApplicantNRTB.Text))
            {
                ConditionServiceClient conditionclient = new ConditionServiceClient();
                BasicMessage           bmsg            = new BasicMessage();

                if (!conditionclient.MoldExist(MoldNRTB.Text))
                {
                    bmsg.Result = false;
                    bmsg.MsgContent.Add("模具");
                }
                if (ApplicantNRTB.Text.Length != 0 && !conditionclient.EmpExist(ApplicantNRTB.Text))
                {
                    bmsg.Result = false;
                    bmsg.MsgContent.Add("退料员工");
                }
                if (bmsg.Result == false)
                {
                    MessageBox.Show(bmsg.MsgText + " 不存在,请重新输入");
                    return;
                }


                StorageManageServiceClient client = new StorageManageServiceClient();
                Message msg = client.ReturnMold(MoldNRTB.Text, ApplicantNRTB.Text, "", RemarkTB.Text, (MoldReturnStateType)int.Parse(MoldSateCB.SelectedValue.ToString()));
                MessageBox.Show(msg.Content);
                if (msg.MsgType == MsgType.OK)
                {
                    MoldPosiSP.Visibility = Visibility.Visible;
                    MoldPartInfoServiceClient moldpartClient = new MoldPartInfoServiceClient();
                    MoldPosiNRTB.Text        = moldpartClient.GetMoldPositionByNr(MoldNRTB.Text).PositionNR;
                    MoldInStoreBtn.IsEnabled = true;
                }
            }
            else
            {
                MessageBox.Show("请将 模具号,退料员工号 填写完整");
            }
        }
        /// <summary>
        /// 按钮点击事件-模具归还
        /// </summary>
        /// <param name="sender">事件源</param>
        /// <param name="e">事件参数</param>
        private void ReturnMoldBtn_Click(object sender, RoutedEventArgs e)
        {
            if (!string.IsNullOrWhiteSpace(MoldNRTB.Text) && !string.IsNullOrWhiteSpace(ApplicantNRTB.Text))
            {
                ConditionServiceClient conditionclient = new ConditionServiceClient();
                BasicMessage bmsg = new BasicMessage();

                if (!conditionclient.MoldExist(MoldNRTB.Text))
                {
                    bmsg.Result = false;
                    bmsg.MsgContent.Add("模具");
                }
                if (ApplicantNRTB.Text.Length != 0 && !conditionclient.EmpExist(ApplicantNRTB.Text))
                {
                    bmsg.Result = false;
                    bmsg.MsgContent.Add("退料员工");
                }
                if (bmsg.Result == false)
                {
                    MessageBox.Show(bmsg.MsgText + " 不存在,请重新输入");
                    return;
                }

                StorageManageServiceClient client = new StorageManageServiceClient();
                Message msg = client.ReturnMold(MoldNRTB.Text, ApplicantNRTB.Text, "", RemarkTB.Text, (MoldReturnStateType)int.Parse(MoldSateCB.SelectedValue.ToString()));
                MessageBox.Show(msg.Content);
                if (msg.MsgType == MsgType.OK)
                {
                    MoldPosiSP.Visibility = Visibility.Visible;
                    MoldPartInfoServiceClient moldpartClient = new MoldPartInfoServiceClient();
                    MoldPosiNRTB.Text = moldpartClient.GetMoldPositionByNr(MoldNRTB.Text).PositionNR;
                    MoldInStoreBtn.IsEnabled = true;
                }
            }
            else
            {
                MessageBox.Show("请将 模具号,退料员工号 填写完整");
            }
        }
        /// <summary>
        /// query the part storage
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void QueryBtn_Click(object sender, RoutedEventArgs e)
        {
            MoldPartInfoServiceClient client = new MoldPartInfoServiceClient();
            DateTime? startDT = null;
            DateTime? endDT = null;
            startDT = startDateDP.Text.Length == 0 ? startDT : DateTime.Parse(startDateDP.Text);
            endDT = endDateDP.Text.Length == 0 ? endDT : DateTime.Parse(endDateDP.Text);
            string partGroupNR = PartGroupCB.SelectedIndex > 0 ? PartGroupCB.SelectedValue.ToString() : string.Empty;
            string partNR = PartCB.SelectedIndex > 0 ? PartCB.SelectedValue.ToString() : string.Empty;
            string warehouseNR = WarehouseCB.SelectedIndex > 0 ? WarehouseCB.SelectedValue.ToString() : string.Empty;
            string positionNR = PositionNRTB.Text;

            List<PartView> parts = client.GetPartsByMutiConditions(partGroupNR, partNR, warehouseNR, positionNR, startDT, endDT);
            PartStorageDG.ItemsSource = parts;
        }
 /// <summary>
 /// 页面加载事件
 /// </summary>
 /// <param name="sender">事件源</param>
 /// <param name="e">事件参数</param>
 private void Page_Loaded(object sender, RoutedEventArgs e)
 {
     if (!string.IsNullOrEmpty(moldNR))
     {
         ConditionServiceClient conditionclient = new ConditionServiceClient();
         if (!conditionclient.MoldExist(moldNR))
         {
             MessageBox.Show("此磨具不存在");
             return;
         }
         MoldPartInfoServiceClient client = new MoldPartInfoServiceClient();
         MoldBaseInfo moldBaseInfo = client.GetMoldBaseInfoByNR(moldNR);
         BasicInfoGrid.DataContext = moldBaseInfo;
         List<Attachment> attach = moldBaseInfo.Attach;
         int i = 1;
         foreach (Attachment at in attach)
         {
             Label link = new Label() { Content =i.ToString()+". "+ at.Name + "  ", Foreground = System.Windows.Media.Brushes.DarkGreen };
             link.MouseLeftButtonUp +=new MouseButtonEventHandler(link_MouseLeftButtonUp);
             link.MouseRightButtonUp+=new MouseButtonEventHandler(link_MouseRightButtonUp);
             link.MouseEnter+=new MouseEventHandler(link_MouseEnter);
             link.MouseLeave+=new MouseEventHandler(link_MouseLeave);
             link.DataContext = at;
             AttachmentTB.Inlines.Add(link);
             i += 1;
         }
     }
 }
 private void link_MouseRightButtonUp(object sender, MouseButtonEventArgs e)
 {
     if (MessageBox.Show("确定删除?", "确认提示", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes) {
         Attachment attach = (sender as Label).DataContext as Attachment;
         MoldPartInfoServiceClient client = new MoldPartInfoServiceClient();
         if (client.DelAttachmentById(attach.AttachmentId,attach.Path)) {
             ConfigUtil config = new ConfigUtil("FILEPATH");
             string directory = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, config.Get("FILEPATH"));
             string filepath = System.IO.Path.Combine(directory, attach.Path);
             File.Delete(filepath);
             (sender as Label).Visibility=Visibility.Hidden;
         }
     }
 }
 /// <summary>
 /// 按钮点击事件-查询放行信息
 /// </summary>
 /// <param name="sender">事件源</param>
 /// <param name="e">事件参数</param>
 private void QueryBtn_Click(object sender, RoutedEventArgs e)
 {
     if (!string.IsNullOrEmpty(moldNR))
     {
         ConditionServiceClient conditionclient = new ConditionServiceClient();
         if (!conditionclient.MoldExist(moldNR))
         {
             MessageBox.Show("此磨具不存在");
             return;
         }
         MoldPartInfoServiceClient client = new MoldPartInfoServiceClient();
         DateTime? startDT = null;
         DateTime? endDT = null;
         startDT = startDateDP.Text.Length == 0 ? startDT : DateTime.Parse(startDateDP.Text);
         endDT = endDateDP.Text.Length == 0 ? endDT : DateTime.Parse(endDateDP.Text);
         List<MoldReleaseInfo> moldReleaseInfos = client.GetMoldReleaseInfoByMoldNR(moldNR, TesterNRTB.Text, startDT, endDT);
         MoldReleaseInfoDG.ItemsSource = moldReleaseInfos;
     }
     AttachmentTB.Inlines.Clear();
 }
        /// <summary>
        /// 按钮点击事件-搜索模具
        /// </summary>
        /// <param name="sender">事件源</param>
        /// <param name="e">事件参数</param>
        private void SearchBtn_Click(object sender, RoutedEventArgs e)
        {
            MoldSearchCondition condition = new MoldSearchCondition();
            condition.MoldNR = MoldNRTB.Text+";"+PositionTB.Text;
            condition.MoldTypeId = MoldTypeCB.SelectedIndex < 1 ? string.Empty : MoldTypeCB.SelectedValue.ToString();
            condition.ProjectId = ProjectCB.SelectedIndex <1 ? string.Empty :ProjectCB.SelectedValue.ToString();
            condition.State = StateCB.SelectedIndex < 1 ? ToolingManWPF.MoldPartInfoServiceReference.MoldStateType.NULL : (ToolingManWPF.MoldPartInfoServiceReference.MoldStateType)(int.Parse(StateCB.SelectedValue.ToString()));
            //condition.Warn = WarnCB.SelectedIndex < 1 ? MoldWarnType.NULL : (MoldWarnType)(int.Parse(WarnCB.SelectedValue.ToString()));

            MoldPartInfoServiceClient client=new MoldPartInfoServiceClient ();
            List<MoldBaseInfo> moldBaseInfo = client.GetMoldByMutiConditions(condition);
            MoldBaseInfoDG.ItemsSource = moldBaseInfo;
        }
        /// <summary>
        /// 显示模具位置
        /// </summary>
        private void ShowMoldPosition()
        {
            ConditionServiceClient conditionclient = new ConditionServiceClient();
            BasicMessage bmsg = new BasicMessage();
            if (!conditionclient.MoldExist(MoldNRTB.Text))
            {
                bmsg.Result = false;
                MoldPosiNRTB.Text = string.Empty;
            }
            if (bmsg.Result == false)
            {

                return;
            }
            MoldPartInfoServiceClient moldpartClient = new MoldPartInfoServiceClient();
            MoldPosiNRTB.Text = moldpartClient.GetMoldPositionByNr(MoldNRTB.Text).PositionNR;
        }
 /// <summary>
 /// 按钮点击事件-模具警报信息搜索
 /// </summary>
 /// <param name="sender">事件源</param>
 /// <param name="e">事件参数</param>
 private void SearchBtn_Click(object sender, RoutedEventArgs e)
 {
     MoldPartInfoServiceClient client = new MoldPartInfoServiceClient();
     List<MoldWarnInfo> warnInfos=client.GetMoldWarnInfo((MoldWarnType)(int.Parse(WarnCB.SelectedValue.ToString())));
     MoldBaseInfoDG.ItemsSource = warnInfos;
 }