private void BtnDel_Click(object sender, RoutedEventArgs e) { RsRoutingDetail m_RsRoutingDetail = gbItemContent.DataContext as RsRoutingDetail; if (m_RsRoutingDetail == null) { return; } RsRoutingTools routingTools = gridTools.SelectedItem as RsRoutingTools; if (routingTools == null) { return; } if ( System.Windows.Forms.MessageBox.Show($"确定要删除工序所需要的刀具{routingTools.TOOLS_NC_CODE}", "删除", MessageBoxButtons.OKCancel) != DialogResult.OK) { return; } ws.UseService(s => s.DelRsRoutingTools(routingTools.PKNO)); gridTools.ItemsSource = ws.UseService(s => s.GetRsRoutingToolss($"ROUTING_DETAIL_PKNO = '{m_RsRoutingDetail.PKNO}")); }
/// <summary> /// 根据关键字段的值获取记录 /// </summary> /// <param name="Id">关键字段的值</param> /// <returns>符合查询条件的记录</returns> public RsRoutingDetail GetRsRoutingDetailById(string Id) { using (IRsRoutingDetailBLL RsRoutingDetailBLL = BLLContainer.Resolve <IRsRoutingDetailBLL>()) { RsRoutingDetail model = RsRoutingDetailBLL.GetFirstOrDefault(Id); return(model); } }
private void btnOK_Click(object sender, RoutedEventArgs e) { RoutingDetail = gpAction.DataContext as RsRoutingDetail; if (RoutingDetail != null) { RoutingDetail.REMARK = cmbAction.Text; } Close(); }
public ProcessActionSetting(RsRoutingDetail routingDetail, string assetCode) { InitializeComponent(); RoutingDetail = routingDetail; cmbAction.ItemsSource = wsFMS.UseService(s => s.GetFmsActionControls($"ASSET_CODE = '{assetCode}'")); gpAction.DataContext = routingDetail; //原始的Detail; }
/// <summary> /// 修改 /// </summary> /// <param name="mRsRoutingDetail">模型</param> /// <returns>是否成功</returns> public bool UpdateRsRoutingDetail(RsRoutingDetail mRsRoutingDetail) { if (mRsRoutingDetail == null) { return(false); } using (IRsRoutingDetailBLL RsRoutingDetailBLL = BLLContainer.Resolve <IRsRoutingDetailBLL>()) { return(RsRoutingDetailBLL.Update(mRsRoutingDetail)); } }
private void ButtonEditSettings_OnDefaultButtonClick(object sender, System.Windows.RoutedEventArgs e) { RsRoutingDetail routingDetail = gridProcessInfo.SelectedItem as RsRoutingDetail; if (routingDetail != null) { DeviceSelect deviceSelect = new DeviceSelect(routingDetail); deviceSelect.Closed += DeviceSelect_Closed; deviceSelect.Show(); } }
private void BtnCancel_Click(object sender, RoutedEventArgs e) { RsRoutingDetail m_RsRoutingDetail = gbItemContent.DataContext as RsRoutingDetail; if (m_RsRoutingDetail == null) { return; } gridTools.IsEnabled = true; dictToolsInfo.Visibility = Visibility.Collapsed; }
private void BarItem_OnItemClick(object sender, RoutedEventArgs e) { //保存 RsRoutingDetail m_RsRoutingDetail = gbItemContent.DataContext as RsRoutingDetail; if (m_RsRoutingDetail == null) { return; } m_RsRoutingDetail.USE_FLAG = 1; bool isSucces = ws.UseService(s => s.UpdateRsRoutingDetail(m_RsRoutingDetail)); }
/// <summary> /// 按照关键字段删除 /// </summary> /// <param name="Id">关键字段</param> /// <returns>是否成功</returns> public bool DelRsRoutingDetail(string Id) { using (IRsRoutingDetailBLL RsRoutingDetailBLL = BLLContainer.Resolve <IRsRoutingDetailBLL>()) { try { RsRoutingDetail item = RsRoutingDetailBLL.GetFirstOrDefault(Id); return(RsRoutingDetailBLL.Delete(item)); } catch { return(false); } } }
//保存 private void BarItem_OnItemClick(object sender, RoutedEventArgs e) { RsBom m_RsBom = gbMenuContent.DataContext as RsBom; RsRoutingDetail m_RsRoutingDetail = this.combo_Op.SelectedItem as RsRoutingDetail; if (m_RsRoutingDetail != null) { m_RsBom.OP_NO = m_RsRoutingDetail.OP_NO; } _RSMService.UseService(s => s.UpdateRsBom(m_RsBom)); }
private void ActionSelectOnClosed(object sender, EventArgs eventArgs) { ProcessActionSetting actionSelect = sender as ProcessActionSetting; RsRoutingDetail routingDetail = gridProcessInfo.SelectedItem as RsRoutingDetail; if ((actionSelect != null) && (routingDetail != null)) { routingDetail.PROCESS_ACTION_TYPE = actionSelect.RoutingDetail.PROCESS_ACTION_TYPE; routingDetail.PROCESS_ACTION_PKNO = actionSelect.RoutingDetail.PROCESS_ACTION_PKNO; routingDetail.PROCESS_ACTION_PARAM1_VALUE = actionSelect.RoutingDetail.PROCESS_ACTION_PARAM1_VALUE; routingDetail.PROCESS_ACTION_PARAM2_VALUE = actionSelect.RoutingDetail.PROCESS_ACTION_PARAM2_VALUE; routingDetail.REMARK = actionSelect.RoutingDetail.REMARK; } }
private void GetPage() { QmsCheckParam qmsCheckParam = ws.UseService(s => s.GetQmsCheckParamById(m_qmsCheckMaster.CHECK_PARAM_PKNO)); QmsRoutingCheck qmsRoutingCheck = ws.UseService(s => s.GetQmsRoutingCheckById(m_qmsCheckMaster.ROUTING_CHECK_PKNO)); RsItemMaster rsItemMaster = ws2.UseService(s => s.GetRsItemMasterById(qmsCheckParam.ITEM_PKNO)); RsRoutingDetail rsRoutingDetail = ws2.UseService(s => s.GetRsRoutingDetailById(qmsRoutingCheck.PROCESS_PKNO)); TextCheckMode.Text = m_qmsCheckMaster.CHK_MODE; TextName.Text = m_qmsCheckMaster.CHECK_NO + System.Environment.NewLine + rsItemMaster.ITEM_NAME; TextCheckSize.Text = qmsCheckParam.MIN_SIZE + "-" + qmsCheckParam.MAX_SIZE; TextRoutingName.Text = rsRoutingDetail.OP_NO + " " + rsRoutingDetail.OP_NAME + " / " + qmsCheckParam.CHECK_NAME; TextDevice.Text = qmsCheckParam.CHECK_DEVICE; }
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; } } }
private void ProcessAction_OnDefaultButtonClick(object sender, System.Windows.RoutedEventArgs e) { //选择指令动作 RsRoutingDetail routingDetail = gridProcessInfo.SelectedItem as RsRoutingDetail; if (routingDetail != null) { if (string.IsNullOrEmpty(routingDetail.WC_ABV)) { MessageBox.Show("请先确定加工设备!", "选择指令动作", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } ProcessActionSetting actionSelect = new ProcessActionSetting(routingDetail, routingDetail.OP_TYPE); actionSelect.Closed += ActionSelectOnClosed; actionSelect.Show(); } }
/// <summary> /// 按照关键字段删除 /// </summary> /// <param name="Ids">关键字段数组</param> /// <returns>是否成功</returns> public bool DelRsRoutingDetails(string[] Ids) { using (IRsRoutingDetailBLL RsRoutingDetailBLL = BLLContainer.Resolve <IRsRoutingDetailBLL>()) { try { List <RsRoutingDetail> entitys = new List <RsRoutingDetail>(); foreach (string id in Ids) { RsRoutingDetail item = RsRoutingDetailBLL.GetFirstOrDefault(id); entitys.Add(item); } return(RsRoutingDetailBLL.Delete(entitys)); } catch { return(false); } } }
private void BarItemShop_OnItemClick(object sender, RoutedEventArgs e) { //添加工序 NameMode m_namemode = this.treeList.SelectedItem as NameMode; gbItemContent.Visibility = Visibility.Visible; if (m_namemode.TYPE == 1) { RsRoutingDetail m_RsRoutingDetail = new RsRoutingDetail(); m_RsRoutingDetail.PKNO = Guid.NewGuid().ToString("N"); m_RsRoutingDetail.ROUTING_PKNO = m_namemode.PKNO; m_RsRoutingDetail.OP_INDEX = ws.UseService(s => s.GetRsRoutingDetailCount($"ROUTING_PKNO = '{m_namemode.PKNO}'")) + 1; bool isSuccss = ws.UseService(s => s.AddRsRoutingDetail(m_RsRoutingDetail)); gbItemContent.DataContext = m_RsRoutingDetail; } }
private void treeList_SelectedItemChanged(object sender, SelectedItemChangedEventArgs e) { NameMode m_NameMode = this.treeList.SelectedItem as NameMode; gbItemContent.Visibility = Visibility.Visible; RsRoutingDetail m_RsRoutingDetail = ws.UseService(s => s.GetRsRoutingDetailById(m_NameMode.PKNO)); gbItemContent.DataContext = m_RsRoutingDetail; gridTools.ItemsSource = null; if (m_RsRoutingDetail == null) { return; } gridTools.ItemsSource = ws.UseService(s => s.GetRsRoutingToolss($"ROUTING_DETAIL_PKNO = '{m_RsRoutingDetail.PKNO}")); }
private void gridItem_MouseDoubleClick(object sender, MouseButtonEventArgs e) { RsRoutingDetail m_RsRoutingDetail = gbItemContent.DataContext as RsRoutingDetail; if (m_RsRoutingDetail == null) { return; } RsRoutingTools routingTools = gridTools.SelectedItem as RsRoutingTools; if (routingTools == null) { return; } gridTools.IsEnabled = false; dictToolsInfo.Visibility = Visibility.Visible; dictToolsInfo.DataContext = routingTools; }
private void BtnAdd_Click(object sender, RoutedEventArgs e) { RsRoutingDetail m_RsRoutingDetail = gbItemContent.DataContext as RsRoutingDetail; if (m_RsRoutingDetail == null) { return; } gridTools.IsEnabled = false; dictToolsInfo.Visibility = Visibility.Visible; RsRoutingTools routingTools = new RsRoutingTools() { COMPANY_CODE = "", ROUTING_DETAIL_PKNO = m_RsRoutingDetail.PKNO, USE_FLAG = 1, }; dictToolsInfo.DataContext = routingTools; }
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 }
private void GetPage() { gridToolsRequst.ItemsSource = null; gridToolsInv.ItemsSource = null; gridToolsFinal.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; } List <RsRoutingTools> requsts = wsRSM.UseService( s => s.GetRsRoutingToolss($"USE_FLAG = 1 AND ROUTING_DETAIL_PKNO = '{routingDetail.PKNO}'")); gridToolsRequst.ItemsSource = requsts; AmAssetMasterN wcDevice = cmbDevice.SelectedItem as AmAssetMasterN; if (wcDevice == null) { return; } #region 机床刀具清单 var devcieTools = wsTMS.UseService(s => s.GetTmsDeviceToolsPoss($"USE_FLAG = 1 AND DEVICE_PKNO = '{wcDevice.PKNO}'")) .OrderBy(c => c.TOOLS_POS_NO) .Select(c => new { c.PKNO, c.DEVICE_PKNO, c.TOOLS_POS_NO, c.POS_INTROD, c.TOOLS_STATE, TOOLS_PKNO = (c.TOOLS_STATE == 10 || c.TOOLS_STATE == 2) ? c.NEW_TOOLS_PKNO : c.TOOLS_PKNO, c.REMARK, }) .ToList(); gridToolsFinal.ItemsSource = devcieTools; #endregion #region 刀具需求 List <TmsToolsMaster> toolsMasters = wsTMS.UseService(s => s.GetTmsToolsMasters("USE_FLAG = 1")); var allToolTypes = (from c in devcieTools join d in toolsMasters on c.TOOLS_PKNO equals d.PKNO select new { d.TOOLS_TYPE_PKNO, c.TOOLS_STATE }) .GroupBy(c => c.TOOLS_TYPE_PKNO) .Select(a => new { TOOLS_TYPE_PKNO = a.Key, TOOLS_STATE = a.Min(c => c.TOOLS_STATE) }); //选择所有在库或已排入的刀 var newRequest = from c in requsts join d in allToolTypes on c.TOOLS_TYPE_PKNO equals d.TOOLS_TYPE_PKNO into temp from tt in temp.DefaultIfEmpty() select new { c.TOOLS_TYPE_PKNO, c.TOOLS_NC_CODE, REQUEST = (tt == null) ? "未排刀" : (tt.TOOLS_STATE == 1 ? "在刀位" : "已排入"), c.INTROD, }; gridToolsRequst.ItemsSource = newRequest; #region 钮可用性 #endregion #endregion }
private WcfClient <IEAMService> wsEAM = new WcfClient <IEAMService>(); //设备 public DeviceSelect(RsRoutingDetail routingDetail) { InitializeComponent(); gridItem.ItemsSource = wsEAM.UseService(s => s.GetAmAssetMasterNs($"ASSET_GROUP = '{routingDetail.WC_CODE}'")); }
//完成 private void bFinishPrepare_Click(object sender, System.Windows.RoutedEventArgs e) { MesJobOrder jobOrder = cmbTask.SelectedItem as MesJobOrder; if (jobOrder == null) { return; } string itemPKNO = cmbProduct.SelectedValue.ToString(); if (string.IsNullOrEmpty(itemPKNO)) { return; } #region 检验是否排刀 List <MesProcessCtrol> processCtrols = wsPLM.UseService(s => s.GetMesProcessCtrols( $"USE_FLAG = 1 AND JOB_ORDER_PKNO = '{jobOrder.PKNO}' AND ITEM_PKNO = '{itemPKNO}' ")); foreach (MesProcessCtrol processCtrol in processCtrols) { string detailPKNO = processCtrol.ROUTING_DETAIL_PKNO; RsRoutingDetail detail = wsRSM.UseService(s => s.GetRsRoutingDetailById(detailPKNO)); List <RsRoutingTools> requestTools = wsRSM.UseService( s => s.GetRsRoutingToolss($"USE_FLAG = 1 AND ROUTING_DETAIL_PKNO = '{detail.PKNO}'")); AmAssetMasterN device = wsEAM.UseService(s => s.GetAmAssetMasterNs($"USE_FLAG = 1 AND ASSET_CODE = '{processCtrol.PROCESS_DEVICE_PKNO}'")) .FirstOrDefault(); if (device == null) { continue; } List <TmsDeviceToolsPos> deviceTools = wsTMS.UseService( s => s.GetTmsDeviceToolsPoss( $"USE_FLAG = 1 AND DEVICE_PKNO = '{device.PKNO}' AND TOOLS_STATE <> 0 AND TOOLS_STATE <> 3")); List <TmsToolsMaster> toolsMasters = wsTMS.UseService(s => s.GetTmsToolsMasters("USE_FLAG = 1")); var allToolsTypes = from c in deviceTools join d in toolsMasters on((c.TOOLS_STATE == 10 || c.TOOLS_STATE == 2) ?c.NEW_TOOLS_PKNO : c.TOOLS_PKNO) equals d.PKNO select new { d.TOOLS_TYPE_PKNO }; //选择所有在库或已排入的刀 var check = from c in requestTools join d in allToolsTypes on c.TOOLS_TYPE_PKNO equals d.TOOLS_TYPE_PKNO into temp from tt in temp.DefaultIfEmpty() where (tt == null) select c; if (check.Any()) { MessageBox.Show($"工序[{detail.OP_NAME}]还有没有排产的刀具,不能完成。", "完成生产准备", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } } #endregion jobOrder.RUN_STATE = 2; //完成刀具准备 jobOrder.UPDATED_BY = CBaseData.LoginName; jobOrder.UPDATED_INTROD += DateTime.Now + "完成排刀. "; jobOrder.LAST_UPDATE_DATE = DateTime.Now; wsPLM.UseService(s => s.UpdateMesJobOrder(jobOrder)); cmbTask.SelectedIndex = -1; cmbTask.ItemsSource = null; cmbTask.ItemsSource = wsPLM.UseService(s => s.GetMesJobOrders($"USE_FLAG = 1 AND RUN_STATE = 1 AND LINE_PKNO = '{CBaseData.CurLinePKNO}'")) //生产准备完成 尚未执行的任务 .OrderBy(c => c.CREATION_DATE) .ToList(); //工单 GetPage(); //刷新数据 }
private void BtnSave_Click(object sender, RoutedEventArgs e) { RsRoutingDetail m_RsRoutingDetail = gbItemContent.DataContext as RsRoutingDetail; if (m_RsRoutingDetail == null) { return; } RsRoutingTools routingTools = dictToolsInfo.DataContext as RsRoutingTools; if (routingTools == null) { return; } if (string.IsNullOrEmpty(routingTools.TOOLS_NC_CODE)) { System.Windows.Forms.MessageBox.Show($"请输入NC程序对应的刀号", "保存", MessageBoxButtons.OK); return; } if (string.IsNullOrEmpty(routingTools.TOOLS_TYPE_PKNO)) { System.Windows.Forms.MessageBox.Show($"请选择刀具类型", "保存", MessageBoxButtons.OK); return; } if (string.IsNullOrEmpty(routingTools.PKNO)) { List <RsRoutingTools> sameToolsType = ws.UseService( s => s.GetRsRoutingToolss( $"ROUTING_DETAIL_PKNO = '{m_RsRoutingDetail.PKNO}' AND TOOLS_TYPE_PKNO = '{routingTools.TOOLS_TYPE_PKNO} AND USE_FLAG = 1")); if (sameToolsType.Count > 0) { System.Windows.Forms.MessageBox.Show($"该刀具类型{cmbToolsType.Text}已经存在不能再添加", "添加", MessageBoxButtons.OK); return; } List <RsRoutingTools> sameToolsType2 = ws.UseService( s => s.GetRsRoutingToolss( $"ROUTING_DETAIL_PKNO = '{m_RsRoutingDetail.PKNO}' AND TOOLS_NC_CODE = '{routingTools.TOOLS_NC_CODE} AND USE_FLAG = 1")); if (sameToolsType2.Count > 0) { System.Windows.Forms.MessageBox.Show($"该NC程序刀号{routingTools.TOOLS_NC_CODE}已经存在不能再添加", "添加", MessageBoxButtons.OK); return; } routingTools.PKNO = Guid.NewGuid().ToString("N"); routingTools.CREATED_BY = CBaseData.LoginName; routingTools.CREATION_DATE = DateTime.Now; routingTools.LAST_UPDATE_DATE = DateTime.Now; //最后修改日期 ws.UseService(s => s.AddRsRoutingTools(routingTools)); } else { List <RsRoutingTools> sameToolsType = ws.UseService( s => s.GetRsRoutingToolss( $"PKNO <> '{m_RsRoutingDetail.PKNO}' AND ROUTING_DETAIL_PKNO = '{m_RsRoutingDetail.PKNO}' AND TOOLS_TYPE_PKNO = '{routingTools.TOOLS_TYPE_PKNO} AND USE_FLAG = 1")); if (sameToolsType.Count > 0) { System.Windows.Forms.MessageBox.Show($"该刀具类型{cmbToolsType.Text}已经存在不能修改为该类型", "修改", MessageBoxButtons.OK); return; } List <RsRoutingTools> sameToolsType2 = ws.UseService( s => s.GetRsRoutingToolss( $"PKNO <> '{m_RsRoutingDetail.PKNO}' AND ROUTING_DETAIL_PKNO = '{m_RsRoutingDetail.PKNO}' AND TOOLS_NC_CODE = '{routingTools.TOOLS_NC_CODE} AND USE_FLAG = 1")); if (sameToolsType2.Count > 0) { System.Windows.Forms.MessageBox.Show($"该NC程序刀号{routingTools.TOOLS_NC_CODE}已经存在不能再修改为该刀号", "修改", MessageBoxButtons.OK); return; } routingTools.UPDATED_BY = CBaseData.LoginName; routingTools.LAST_UPDATE_DATE = DateTime.Now; ws.UseService(s => s.UpdateRsRoutingTools(routingTools)); } gridTools.IsEnabled = true; dictToolsInfo.Visibility = Visibility.Collapsed; gridTools.ItemsSource = ws.UseService(s => s.GetRsRoutingToolss($"ROUTING_DETAIL_PKNO = '{m_RsRoutingDetail.PKNO}")); }