/// <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 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; } }
/// <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; } }
/// <summary> /// 加载模具使用类型条件 /// </summary> private void LoadMoldUseTypeCondition() { ConditionServiceClient conditionClient = new ConditionServiceClient(); List <EnumItem> moldUseTypeItems = conditionClient.GetEnumItems(typeof(MoldUseType).ToString()); MoldUseWayCB.ItemsSource = moldUseTypeItems; }
/// <summary> /// 加载模具归还状态条件 /// </summary> private void LoadMoldReturnStateCondition() { ConditionServiceClient conditionClient = new ConditionServiceClient(); List<EnumItem> moldReturnState = conditionClient.GetEnumItems(typeof(MoldReturnStateType).ToString()); // .ItemsSource = moldUseTypeItems; MoldSateCB.ItemsSource = moldReturnState; }
/// <summary> /// 加载模具警报条件 /// </summary> private void LoadConditions() { ConditionServiceClient conditionClient = new ConditionServiceClient(); List <EnumItem> warnItems = conditionClient.GetEnumItems(typeof(MoldWarnType).ToString()); WarnCB.ItemsSource = warnItems; }
/// <summary> /// 加载模具归还状态条件 /// </summary> private void LoadMoldReturnStateCondition() { ConditionServiceClient conditionClient = new ConditionServiceClient(); List <EnumItem> moldReturnState = conditionClient.GetEnumItems(typeof(MoldReturnStateType).ToString()); // .ItemsSource = moldUseTypeItems; MoldSateCB.ItemsSource = moldReturnState; }
/// <summary> /// 加载选择条件 /// </summary> private void LoadConditions() { ConditionServiceClient conditionClient = new ConditionServiceClient(); ConfigUtil config = new ConfigUtil("partgroup"); // load the select conditions List <EnumItem> reportTypes = conditionClient.GetEnumItems(typeof(ToolingManWPF.MoldPartInfoServiceReference.ReportType).ToString()); MaintainTypeCB.ItemsSource = reportTypes; }
/// <summary> /// load conditions /// </summary> private void LoadConditions() { ConditionServiceClient conditionClient = new ConditionServiceClient(); List<PartGroup> partGroups = conditionClient.GetPartGroups(); partGroups.Insert(0, new PartGroup() { PartGroupNR = "", Name = "--------全部-------" }); PartGroupCB.ItemsSource = partGroups; List<Warehouse> warehouses = conditionClient.GetWarehousesByType(WarehouseType.PartWarehouse); warehouses.Insert(0, new Warehouse() { WarehouseNR = "", Name = "--------全部-------" }); WarehouseCB.ItemsSource = warehouses; }
/// <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 MoldApplyBtn_Click(object sender, RoutedEventArgs e) { if ((ToolingManWPF.ConditionServiceReference.MoldStateType)moldBaseInfo.State != ToolingManWPF.ConditionServiceReference.MoldStateType.Normal && (MoldUseType)int.Parse(MoldUseWayCB.SelectedValue.ToString()) == MoldUseType.Produce) { MessageBox.Show("模具目前状态不可用作正产!"); return; } if (!string.IsNullOrWhiteSpace(EnsureMoldNRTB.Text) && !string.IsNullOrWhiteSpace(ApplicantNRTB.Text) && !string.IsNullOrWhiteSpace(WorkstationNRTB.Text)) { if (MoldNRTB.Text.Equals(EnsureMoldNRTB.Text)) { ConditionServiceClient conditionclient = new ConditionServiceClient(); BasicMessage bmsg = new BasicMessage(); if (!conditionclient.EmpExist(ApplicantNRTB.Text)) { bmsg.Result = false; bmsg.MsgContent.Add("申领员工"); } if (!conditionclient.WorkstationExist(WorkstationNRTB.Text)) { bmsg.Result = false; bmsg.MsgContent.Add("工作台"); } if (bmsg.Result == false) { MessageBox.Show(bmsg.MsgText + " 不存在,请重新输入"); return; } StorageManageServiceClient client = new StorageManageServiceClient(); Message msg = client.ApplyMold((MoldUseType)int.Parse(MoldUseWayCB.SelectedValue.ToString()), MoldNRTB.Text, ApplicantNRTB.Text, "", WorkstationNRTB.Text); MessageBoxResult result = MessageBox.Show(msg.Content); if (result == MessageBoxResult.OK) { this.Close(); } } else { MessageBox.Show("确认模具号 与 模具号不一致"); } } else { MessageBox.Show("请完整填写 申领员工号,压接机号,确认模具号"); } }
/// <summary> /// change the part when part group changed /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void PartGroupCB_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (PartGroupCB.SelectedIndex > 0) { ConditionServiceClient conditionClient = new ConditionServiceClient(); List<Part> parts = conditionClient.GetPartsByGroupNR(PartGroupCB.SelectedValue.ToString()); parts.Insert(0, new Part() { PartNR = "--------全部-------", Name = "" }); PartCB.ItemsSource = parts; PartCB.SelectedIndex = 0; PartCB.IsEnabled = true; } else { PartCB.SelectedIndex = 0; PartCB.IsEnabled = false; } }
/// <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; }
private void Window_Loaded(object sender, RoutedEventArgs e) { saveFileDialog = new SaveFileDialog(); saveFileDialog.Filter = "导出Excel (*.xls)|*.xls"; saveFileDialog.FilterIndex = 0; saveFileDialog.Title = "导出文件保存路径"; ConditionServiceClient conditionClient = new ConditionServiceClient(); List <EnumItem> types = conditionClient.GetEnumItems(typeof(ToolingManWPF.ConditionServiceReference.ReportType).ToString()); ReportTypeCB.ItemsSource = types; ReportTypeCB.SelectedIndex = 0; List <EnumItem> storeTypes = new List <EnumItem>() { new EnumItem() { Value = "0", Description = "申领汇总记录" }, new EnumItem() { Value = "3", Description = "正常生产申领记录" }, new EnumItem() { Value = "4", Description = "维护申领记录" }, new EnumItem() { Value = "5", Description = "测试申领记录" }, new EnumItem() { Value = "1", Description = "归还记录" }, new EnumItem() { Value = "2", Description = "移动工作台记录" } }; StorageRecordTypeCB.ItemsSource = storeTypes; StorageRecordTypeCB.SelectedIndex = 0; }
/// <summary> /// load conditions /// </summary> private void LoadConditions() { ConditionServiceClient conditionClient = new ConditionServiceClient(); List <PartGroup> partGroups = conditionClient.GetPartGroups(); partGroups.Insert(0, new PartGroup() { PartGroupNR = "", Name = "--------全部-------" }); PartGroupCB.ItemsSource = partGroups; List <Warehouse> warehouses = conditionClient.GetWarehousesByType(WarehouseType.PartWarehouse); warehouses.Insert(0, new Warehouse() { WarehouseNR = "", Name = "--------全部-------" }); WarehouseCB.ItemsSource = warehouses; }
/// <summary> /// 按钮点击事件-模具添库 /// </summary> /// <param name="sender">事件源</param> /// <param name="e">事件参数</param> private void OKBtn_Click(object sender, RoutedEventArgs e) { if (string.IsNullOrWhiteSpace(MoldNRTB.Text) || string.IsNullOrWhiteSpace(WarehouseNRTB.Text) || string.IsNullOrWhiteSpace(PositionNRTB.Text)) { MessageBox.Show("请将数据填写完整"); } else { ConditionServiceClient conditionclient = new ConditionServiceClient(); if (!conditionclient.MoldExist(MoldNRTB.Text)) { MessageBox.Show("此磨具不存在"); return; } StorageManageServiceClient client = new StorageManageServiceClient(); Message msg = client.MoldInStore(MoldNRTB.Text, OperatorTB.Text, WarehouseNRTB.Text, PositionNRTB.Text); MessageBox.Show(msg.Content); } }
/// <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> /// change the part when part group changed /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void PartGroupCB_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (PartGroupCB.SelectedIndex > 0) { ConditionServiceClient conditionClient = new ConditionServiceClient(); List <Part> parts = conditionClient.GetPartsByGroupNR(PartGroupCB.SelectedValue.ToString()); parts.Insert(0, new Part() { PartNR = "--------全部-------", Name = "" }); PartCB.ItemsSource = parts; PartCB.SelectedIndex = 0; PartCB.IsEnabled = true; } else { PartCB.SelectedIndex = 0; PartCB.IsEnabled = false; } }
/// <summary> /// 按钮点击事件-模具入库 /// </summary> /// <param name="sender">事件源</param> /// <param name="e">事件参数</param> private void MoldInStoreBtn_Click(object sender, RoutedEventArgs e) { if (string.IsNullOrWhiteSpace(MoldNRTB.Text) || string.IsNullOrWhiteSpace(ApplicantNRTB.Text)) { MessageBox.Show("请将 模具号,退料员工号 填写完整"); } else { BasicMessage bmsg = new BasicMessage(); ConditionServiceClient conditionclient = new ConditionServiceClient(); 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.MoldInStore(MoldNRTB.Text, OperatorTB.Text, WarehouseNRTB.Text, PositionNRTB.Text); Message msg = client.ReturnMoldInPosition(MoldNRTB.Text, ApplicantNRTB.Text, RemarkTB.Text); MessageBoxResult result = MessageBox.Show(msg.Content); if (result == MessageBoxResult.OK) { this.Close(); } if (msg.MsgType == MsgType.OK) { MoldInStoreBtn.IsEnabled = false; } } }
/// <summary> /// 加载选择条件 /// </summary> private void LoadConditions() { ConditionServiceClient conditionClient = new ConditionServiceClient(); ConfigUtil config = new ConfigUtil("partgroup"); // load the select conditions //List<MoldCategory> moldTypes = conditionClient.GetMoldTypes(); //moldTypes.Insert(0, new MoldCategory() { MoldCateID = string.Empty, Name = "--------全部-------" }); //MoldTypeCB.ItemsSource = moldTypes; List <MoldType> moldTypes = conditionClient.GetMoldTypes(); moldTypes.Insert(0, new MoldType() { MoldTypeID = string.Empty, Name = "--------全部-------" }); MoldTypeCB.ItemsSource = moldTypes; List <Project> projects = conditionClient.GetProjects(); projects.Insert(0, new Project() { ProjectID = string.Empty, Name = "--------全部-------" }); ProjectCB.ItemsSource = projects; List <EnumItem> stateItems = conditionClient.GetEnumItems(typeof(ToolingManWPF.ConditionServiceReference.MoldStateType).ToString()); stateItems.Insert(0, new EnumItem() { Value = "-1", Description = "--------全部-------" }); StateCB.ItemsSource = stateItems; //List<EnumItem> warnItems = conditionClient.GetEnumItems(typeof(MoldWarnType).ToString()); //warnItems.Insert(0,new EnumItem() { Value = "-1", Description = "--------全部-------" }); //WarnCB.ItemsSource = warnItems; }
/// <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 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> private void LoadConditions() { ConditionServiceClient conditionClient = new ConditionServiceClient(); ConfigUtil config = new ConfigUtil("partgroup"); // load the select conditions //List<MoldCategory> moldTypes = conditionClient.GetMoldTypes(); //moldTypes.Insert(0, new MoldCategory() { MoldCateID = string.Empty, Name = "--------全部-------" }); //MoldTypeCB.ItemsSource = moldTypes; List<MoldType> moldTypes = conditionClient.GetMoldTypes(); moldTypes.Insert(0, new MoldType() { MoldTypeID = string.Empty, Name = "--------全部-------" }); MoldTypeCB.ItemsSource = moldTypes; List<Project> projects = conditionClient.GetProjects(); projects.Insert(0, new Project() { ProjectID = string.Empty, Name = "--------全部-------" }); ProjectCB.ItemsSource = projects; List<EnumItem> stateItems = conditionClient.GetEnumItems(typeof(ToolingManWPF.ConditionServiceReference.MoldStateType).ToString()); stateItems.Insert(0,new EnumItem() { Value = "-1", Description = "--------全部-------" }); StateCB.ItemsSource = stateItems; //List<EnumItem> warnItems = conditionClient.GetEnumItems(typeof(MoldWarnType).ToString()); //warnItems.Insert(0,new EnumItem() { Value = "-1", Description = "--------全部-------" }); //WarnCB.ItemsSource = warnItems; }
private void Window_Loaded(object sender, RoutedEventArgs e) { saveFileDialog = new SaveFileDialog(); saveFileDialog.Filter = "导出Excel (*.xls)|*.xls"; saveFileDialog.FilterIndex = 0; saveFileDialog.Title = "导出文件保存路径"; ConditionServiceClient conditionClient = new ConditionServiceClient(); List<EnumItem> types = conditionClient.GetEnumItems(typeof(ToolingManWPF.ConditionServiceReference.ReportType).ToString()); ReportTypeCB.ItemsSource = types; ReportTypeCB.SelectedIndex = 0; List<EnumItem> storeTypes = new List<EnumItem>() { new EnumItem() { Value = "0", Description = "申领汇总记录" }, new EnumItem(){Value="3",Description="正常生产申领记录"}, new EnumItem(){Value="4",Description="维护申领记录"}, new EnumItem(){Value="5",Description="测试申领记录"}, new EnumItem() { Value = "1", Description = "归还记录" }, new EnumItem() { Value = "2", Description = "移动工作台记录" } }; StorageRecordTypeCB.ItemsSource = storeTypes; StorageRecordTypeCB.SelectedIndex = 0; }
/// <summary> /// 加载模具使用类型条件 /// </summary> private void LoadMoldUseTypeCondition() { ConditionServiceClient conditionClient = new ConditionServiceClient(); List<EnumItem> moldUseTypeItems = conditionClient.GetEnumItems(typeof(MoldUseType).ToString()); MoldUseWayCB.ItemsSource = moldUseTypeItems; }
/// <summary> /// 加载选择条件 /// </summary> private void LoadConditions() { ConditionServiceClient conditionClient = new ConditionServiceClient(); ConfigUtil config = new ConfigUtil("partgroup"); // load the select conditions List<EnumItem> reportTypes = conditionClient.GetEnumItems(typeof(ToolingManWPF.MoldPartInfoServiceReference.ReportType).ToString()); MaintainTypeCB.ItemsSource = reportTypes; }
/// <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> private void LoadConditions() { ConditionServiceClient conditionClient = new ConditionServiceClient(); List<EnumItem> warnItems = conditionClient.GetEnumItems(typeof(MoldWarnType).ToString()); WarnCB.ItemsSource = warnItems; }
/// <summary> /// 按钮点击事件-上传报告 /// </summary> /// <param name="sender">事件源</param> /// <param name="e">事件参数</param> private void UpReportBtn_Click(object sender, RoutedEventArgs e) { if (MoldNRTB.Text.Length > 0 && OperatorNRTB.Text.Length > 0) { StorageManageServiceClient client = new StorageManageServiceClient(); ConditionServiceClient conditionclient = new ConditionServiceClient(); BasicMessage bmsg = new BasicMessage(); if (!conditionclient.MoldExist(MoldNRTB.Text)) { bmsg.Result = false; bmsg.MsgContent.Add("模具"); } if (OperatorNRTB.Text.Length != 0 && !conditionclient.EmpExist(OperatorNRTB.Text)) { bmsg.Result = false; bmsg.MsgContent.Add("试验员"); } if (bmsg.Result == false) { MessageBox.Show(bmsg.MsgText + " 不存在,请重新输入"); return; } // MoldPartInfoServiceClient bclient = new MoldPartInfoServiceClient(); //MoldBaseInfo moldBaseInfo = bclient.GetMoldBaseInfoByNR(MoldNRTB.Text); //if (moldBaseInfo.State == ToolingManWPF.MoldPartInfoServiceReference.MoldStateType.NotReturned) //{ // MessageBox.Show("模具还未归还!"); // return; //} List <FileUP> files = null; long fileTotalLength = 0; if (FileNameList.Items.Count > 0) { files = new List <FileUP>(); UserListBoxItem userListBoxItem; imageFilter = FileFilterUtil.GetImageFilters(); documentFilter = FileFilterUtil.GetDocumentFilters(); foreach (object item in FileNameList.Items) { userListBoxItem = item as UserListBoxItem; string path = userListBoxItem.Value; if (File.Exists(path)) { string fileType = path.Substring(path.LastIndexOf('.'), path.Length - path.LastIndexOf('.')); string fileName = userListBoxItem.Display; Stream stream = File.Open(path, FileMode.Open, FileAccess.Read); byte[] data = new byte[stream.Length]; stream.Read(data, 0, data.Length); stream.Seek(0, SeekOrigin.Begin); fileTotalLength += stream.Length; ToolingManWPF.StorageManageServiceReference.AttachmentType attachType = ToolingManWPF.StorageManageServiceReference.AttachmentType.PICTURE; if (imageFilter.Contains(fileType)) { attachType = ToolingManWPF.StorageManageServiceReference.AttachmentType.PICTURE; } else if (documentFilter.Contains(fileType)) { attachType = ToolingManWPF.StorageManageServiceReference.AttachmentType.DOCUMENT; } files.Add(new FileUP() { Name = fileName, FileType = fileType, Type = attachType, Data = data }); } } } if (fileTotalLength < long.Parse((new ConfigUtil("MAXFILELENGTH")).Get("MAXLENGTH"))) { Message msg = new Message(); switch ((ToolingManWPF.MoldPartInfoServiceReference.ReportType) int.Parse(MaintainTypeCB.SelectedValue.ToString())) { case ToolingManWPF.MoldPartInfoServiceReference.ReportType.MaintainReport: // msg = client.MoldMaintain(MoldNRTB.Text, OperatorNRTB.Text, files, (bool)MoldStateCheckBox.IsChecked); msg = client.MoldMaintain(MoldNRTB.Text, OperatorNRTB.Text, files, false); break; case ToolingManWPF.MoldPartInfoServiceReference.ReportType.TestReport: int c = 0; //int.TryParse(CurrentCutTimeTB.Text,out c); msg = client.MoldTest(MoldNRTB.Text, OperatorNRTB.Text, files, c, false); //msg = client.MoldTest(MoldNRTB.Text, OperatorNRTB.Text, files, c, (bool)MoldStateCheckBox.IsChecked); break; } MessageBox.Show(msg.Content); } else { MessageBox.Show("一次上传文件大小不可大于50M", "", MessageBoxButton.OK, MessageBoxImage.Information); } } }
/// <summary> /// 按钮点击事件-模具入库 /// </summary> /// <param name="sender">事件源</param> /// <param name="e">事件参数</param> private void OKBtn_Click(object sender, RoutedEventArgs e) { if (string.IsNullOrWhiteSpace(MoldNRTB.Text) || string.IsNullOrWhiteSpace(OperatorTB.Text) ) { MessageBox.Show("请将 模具号,操作员号 填写完整"); } else { ConditionServiceClient conditionclient = new ConditionServiceClient(); BasicMessage bmsg = new BasicMessage(); if (!conditionclient.MoldExist(MoldNRTB.Text)) { bmsg.Result = false; bmsg.MsgContent.Add("模具"); } if (OperatorTB.Text.Length != 0 && !conditionclient.EmpExist(OperatorTB.Text)) { bmsg.Result = false; bmsg.MsgContent.Add("操作员"); } if (bmsg.Result == false) { MessageBox.Show(bmsg.MsgText + " 不存在,请重新输入"); return; } StorageManageServiceClient client = new StorageManageServiceClient(); // Message msg = client.MoldInStore(MoldNRTB.Text, OperatorTB.Text, WarehouseNRTB.Text, PositionNRTB.Text); Message msg = client.ReturnMoldInPosition(MoldNRTB.Text, OperatorTB.Text, RemarkTB.Text); MessageBoxResult result = MessageBox.Show(msg.Content); if (result == MessageBoxResult.OK) { this.Close(); } } }
/// <summary> /// 按钮点击事件-上传报告 /// </summary> /// <param name="sender">事件源</param> /// <param name="e">事件参数</param> private void UpReportBtn_Click(object sender, RoutedEventArgs e) { if (MoldNRTB.Text.Length > 0 && OperatorNRTB.Text.Length > 0) { StorageManageServiceClient client = new StorageManageServiceClient(); ConditionServiceClient conditionclient = new ConditionServiceClient(); BasicMessage bmsg = new BasicMessage(); if (!conditionclient.MoldExist(MoldNRTB.Text)) { bmsg.Result = false; bmsg.MsgContent.Add("模具"); } if (OperatorNRTB.Text.Length != 0 && !conditionclient.EmpExist(OperatorNRTB.Text)) { bmsg.Result = false; bmsg.MsgContent.Add("试验员"); } if (bmsg.Result == false) { MessageBox.Show(bmsg.MsgText + " 不存在,请重新输入"); return; } // MoldPartInfoServiceClient bclient = new MoldPartInfoServiceClient(); //MoldBaseInfo moldBaseInfo = bclient.GetMoldBaseInfoByNR(MoldNRTB.Text); //if (moldBaseInfo.State == ToolingManWPF.MoldPartInfoServiceReference.MoldStateType.NotReturned) //{ // MessageBox.Show("模具还未归还!"); // return; //} List<FileUP> files = null; long fileTotalLength = 0; if (FileNameList.Items.Count > 0) { files = new List<FileUP>(); UserListBoxItem userListBoxItem; imageFilter = FileFilterUtil.GetImageFilters(); documentFilter = FileFilterUtil.GetDocumentFilters(); foreach (object item in FileNameList.Items) { userListBoxItem = item as UserListBoxItem; string path = userListBoxItem.Value; if (File.Exists(path)) { string fileType = path.Substring(path.LastIndexOf('.'), path.Length - path.LastIndexOf('.')); string fileName = userListBoxItem.Display; Stream stream = File.Open(path, FileMode.Open, FileAccess.Read); byte[] data = new byte[stream.Length]; stream.Read(data, 0, data.Length); stream.Seek(0, SeekOrigin.Begin); fileTotalLength += stream.Length; ToolingManWPF.StorageManageServiceReference.AttachmentType attachType = ToolingManWPF.StorageManageServiceReference.AttachmentType.PICTURE; if (imageFilter.Contains(fileType)) { attachType = ToolingManWPF.StorageManageServiceReference.AttachmentType.PICTURE; } else if (documentFilter.Contains(fileType)) { attachType = ToolingManWPF.StorageManageServiceReference.AttachmentType.DOCUMENT; } files.Add(new FileUP() { Name = fileName, FileType = fileType, Type = attachType, Data = data }); } } } if (fileTotalLength < long.Parse((new ConfigUtil("MAXFILELENGTH")).Get("MAXLENGTH"))) { Message msg = new Message(); switch ((ToolingManWPF.MoldPartInfoServiceReference.ReportType)int.Parse(MaintainTypeCB.SelectedValue.ToString())) { case ToolingManWPF.MoldPartInfoServiceReference.ReportType.MaintainReport: // msg = client.MoldMaintain(MoldNRTB.Text, OperatorNRTB.Text, files, (bool)MoldStateCheckBox.IsChecked); msg = client.MoldMaintain(MoldNRTB.Text, OperatorNRTB.Text, files, false); break; case ToolingManWPF.MoldPartInfoServiceReference.ReportType.TestReport: int c = 0; //int.TryParse(CurrentCutTimeTB.Text,out c); msg = client.MoldTest(MoldNRTB.Text, OperatorNRTB.Text, files, c, false); //msg = client.MoldTest(MoldNRTB.Text, OperatorNRTB.Text, files, c, (bool)MoldStateCheckBox.IsChecked); break; } MessageBox.Show(msg.Content); } else MessageBox.Show("一次上传文件大小不可大于50M", "", MessageBoxButton.OK, MessageBoxImage.Information); } }