Ejemplo n.º 1
0
 /// <summary>
 /// 根据关键字段的值获取记录
 /// </summary>
 /// <param name="Id">关键字段的值</param>
 /// <returns>符合查询条件的记录</returns>
 public QmsCheckParam GetQmsCheckParamById(string Id)
 {
     using (IQmsCheckParamBLL QmsCheckParamBLL = BLLContainer.Resolve <IQmsCheckParamBLL>())
     {
         QmsCheckParam model = QmsCheckParamBLL.GetFirstOrDefault(Id);
         return(model);
     }
 }
Ejemplo n.º 2
0
        private void CmbCheckparamInfo_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            QmsCheckParam qmsRoutingCheck = CmbCheckparamInfo.SelectedItem as QmsCheckParam;

            if (qmsRoutingCheck != null)
            {
                Param_Name.Text = qmsRoutingCheck.CHECK_NAME;
                Param_type.Text = qmsRoutingCheck.CHECK_TYPE;
            }
        }
Ejemplo n.º 3
0
 /// <summary>
 /// 修改
 /// </summary>
 /// <param name="mQmsCheckParam">模型</param>
 /// <returns>是否成功</returns>
 public bool UpdateQmsCheckParam(QmsCheckParam mQmsCheckParam)
 {
     if (mQmsCheckParam == null)
     {
         return(false);
     }
     using (IQmsCheckParamBLL QmsCheckParamBLL = BLLContainer.Resolve <IQmsCheckParamBLL>())
     {
         return(QmsCheckParamBLL.Update(mQmsCheckParam));
     }
 }
Ejemplo n.º 4
0
 /// <summary>
 /// 按照关键字段删除
 /// </summary>
 /// <param name="Id">关键字段</param>
 /// <returns>是否成功</returns>
 public bool DelQmsCheckParam(string Id)
 {
     using (IQmsCheckParamBLL QmsCheckParamBLL = BLLContainer.Resolve <IQmsCheckParamBLL>())
     {
         try
         {
             QmsCheckParam item = QmsCheckParamBLL.GetFirstOrDefault(Id);
             return(QmsCheckParamBLL.Delete(item));
         }
         catch { return(false); }
     }
 }
Ejemplo n.º 5
0
        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;
        }
Ejemplo n.º 6
0
 /// <summary>
 /// 按照关键字段删除
 /// </summary>
 /// <param name="Ids">关键字段数组</param>
 /// <returns>是否成功</returns>
 public bool DelQmsCheckParams(string[] Ids)
 {
     using (IQmsCheckParamBLL QmsCheckParamBLL = BLLContainer.Resolve <IQmsCheckParamBLL>())
     {
         try
         {
             List <QmsCheckParam> entitys = new List <QmsCheckParam>();
             foreach (string id in Ids)
             {
                 QmsCheckParam item = QmsCheckParamBLL.GetFirstOrDefault(id);
                 entitys.Add(item);
             }
             return(QmsCheckParamBLL.Delete(entitys));
         }
         catch { return(false); }
     }
 }
Ejemplo n.º 7
0
        private void BtnAdd_Click(object sender, RoutedEventArgs e)
        {
            //新增
            #region

            //TODO: 校验

            #endregion
            QmsCheckParam qmsCheckParam = new QmsCheckParam()
            {
                COMPANY_CODE = "",
                USE_FLAG     = 1, //启用
            };
            gbItem.DataContext = qmsCheckParam;

            dictBasic.Header   = $"{HeaderName}  【新增】";
            gbItem.IsCollapsed = false;
            gbItem.Visibility  = Visibility.Visible;
        }
Ejemplo n.º 8
0
        private void BtnDel_Click(object sender, RoutedEventArgs e)
        {
            //删除
            QmsCheckParam qmsCheckParam = gridItem.SelectedItem as QmsCheckParam;

            if (qmsCheckParam == null)
            {
                return;
            }

            if (System.Windows.Forms.MessageBox.Show($"确定删除计划【{qmsCheckParam.CHECK_NAME}】吗?",
                                                     @"删除信息",
                                                     MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
            {
                ws.UseService(s => s.DelQmsCheckParam(qmsCheckParam.PKNO));

                //删除成功.
                GetPage();
            }
        }
Ejemplo n.º 9
0
        private void BtnSave_Click(object sender, RoutedEventArgs e)
        {
            //保存
            QmsCheckParam qmsCheckParam = gbItem.DataContext as QmsCheckParam;

            if (qmsCheckParam == null)
            {
                return;
            }

            #region  TODO: 校验

            //TODO: 校验

            #endregion

            if (string.IsNullOrEmpty(qmsCheckParam.PKNO)) //新增
            {
                qmsCheckParam.PKNO             = Guid.NewGuid().ToString("N");
                qmsCheckParam.CREATED_BY       = CBaseData.LoginName;
                qmsCheckParam.CREATION_DATE    = DateTime.Now;
                qmsCheckParam.LAST_UPDATE_DATE = DateTime.Now;

                ws.UseService(s => s.AddQmsCheckParam(qmsCheckParam));
            }
            else  //修改
            {
                qmsCheckParam.UPDATED_BY       = CBaseData.LoginName;
                qmsCheckParam.LAST_UPDATE_DATE = DateTime.Now;
                ws.UseService(s => s.UpdateQmsCheckParam(qmsCheckParam));
            }

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

            //保存成功
            gbItem.IsCollapsed = true;
            gbItem.Visibility  = Visibility.Collapsed;
        }
Ejemplo n.º 10
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();
            //准备完成
            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

            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,
                LAST_UPDATE_DATE    = DateTime.Now, //最后修改日期
                USE_FLAG            = 1,
                REMARK              = "",
            };

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

            int iProcessIndex = 0;

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

                //if (string.IsNullOrEmpty(item.PROCESS_ACTION_PKNO))
                //{
                //    MessageBox.Show($"工序【{item.OP_NAME}】指令动作不能为空,请选择指令动作!",
                //        "完成生产准备", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                //    return;
                //}


                MesProcessCtrol mesProcess = new MesProcessCtrol();
                mesProcess.PKNO             = Guid.NewGuid().ToString("N");
                mesProcess.COMPANY_CODE     = "";
                mesProcess.ITEM_PKNO        = jobOrder.ITEM_PKNO;
                mesProcess.JOB_ORDER_PKNO   = jobOrder.PKNO;
                mesProcess.SUB_JOB_ORDER_NO = jobOrder.JOB_ORDER_NO + "-" + iProcessIndex;

                mesProcess.ROUTING_DETAIL_PKNO = item.PKNO;   //工序PKNO
                mesProcess.PROCESS_DEVICE_PKNO = item.WC_ABV; //设备信息
                mesProcess.PROCESS_INDEX       = iProcessIndex;

                mesProcess.PROCESS_ACTION_TYPE         = item.PROCESS_ACTION_TYPE;
                mesProcess.PROCESS_ACTION_PKNO         = item.PROCESS_ACTION_PKNO;
                mesProcess.PROCESS_ACTION_PARAM1_VALUE = item.PROCESS_ACTION_PARAM1_VALUE;   //控制参数1
                mesProcess.PROCESS_ACTION_PARAM2_VALUE = item.PROCESS_ACTION_PARAM2_VALUE;   //控制参数2

                mesProcess.PROCESS_QTY   = 0;
                mesProcess.COMPLETE_QTY  = 0;
                mesProcess.QUALIFIED_QTY = 0;
                mesProcess.PROCESS_STATE = 1;  //准备完成

                mesProcess.CREATED_BY       = CBaseData.LoginName;
                mesProcess.CREATION_DATE    = DateTime.Now;
                mesProcess.LAST_UPDATE_DATE = DateTime.Now;  //最后修改日期
                mesProcess.USE_FLAG         = 1;

                iProcessIndex++;
                newMesProcessCtrols.Add(mesProcess);
            }

            wsPLM.UseService(s => s.AddMesJobOrder(jobOrder));  //添加工单
            foreach (MesProcessCtrol mesProcessCtrol in newMesProcessCtrols)
            {
                wsPLM.UseService(s => s.AddMesProcessCtrol(mesProcessCtrol));  //添加具体工序
            }

            #endregion

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

            tbLiftQty.Text              = "";
            cmbTask.SelectedIndex       = -1;
            gridProcessInfo.ItemsSource = null;
            tbTaskQty.Text              = "";
            lbBatchIndex.Content        = "";
            if (System.Windows.Forms.MessageBox.Show($"确定生成质检计划吗?",
                                                     @"生成质检信息",
                                                     MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
            {
                QmsCheckParam qmsCheckParam = wsQMS.UseService(s =>
                                                               s.GetQmsCheckParams(" USE_FLAG = 1 AND ITEM_PKNO = " + taskLine.ITEM_PKNO + "")).FirstOrDefault();
                if (qmsCheckParam == null)
                {
                    return;
                }

                List <QmsRoutingCheck> qmsRoutingChecks = wsQMS.UseService(s =>
                                                                           s.GetQmsRoutingChecks(" USE_FLAG = 1 AND CHECK_PARAM_PKNO = " + qmsCheckParam.PKNO + ""));
                if (qmsRoutingChecks.Count <= 0)
                {
                    return;
                }
                foreach (var itemRoutingCheck in qmsRoutingChecks)
                {
                    //创建质检主表内容
                    if (itemRoutingCheck.CHK_MODE == "首检" || itemRoutingCheck.CHK_MODE == "尾检")//首尾检
                    {
                        QmsCheckMaster qmsCheckMaster = new QmsCheckMaster();
                        qmsCheckMaster.PKNO = Guid.NewGuid().ToString("N");
                        if (itemRoutingCheck.CHK_MODE == "首检")
                        {
                            qmsCheckMaster.CHECK_NO = "ZJ" + jobOrder.JOB_ORDER_NO + (1 * 1000).ToString("0000");
                        }
                        else
                        {
                            qmsCheckMaster.CHECK_NO = "ZJ" + jobOrder.JOB_ORDER_NO + (2 * 1000).ToString("0000");
                        }

                        qmsCheckMaster.CHECK_PARAM_PKNO   = itemRoutingCheck.CHECK_PARAM_PKNO;
                        qmsCheckMaster.ROUTING_CHECK_PKNO = itemRoutingCheck.PKNO;
                        qmsCheckMaster.CREATION_DATE      = DateTime.Now;
                        qmsCheckMaster.LAST_UPDATE_DATE   = DateTime.Now; //最后修改日期
                        qmsCheckMaster.USE_FLAG           = 1;
                        qmsCheckMaster.CHECK_STATUS       = "1";
                        qmsCheckMaster.TASKLINE_PKNO      = jobOrder.JOB_ORDER_NO;//以工单编号应用为关联
                        qmsCheckMaster.PROCESS_PKNO       = itemRoutingCheck.PROCESS_PKNO;
                        qmsCheckMaster.CHK_MODE           = itemRoutingCheck.CHK_MODE;
                        wsQMS.UseService(s => s.AddQmsCheckMaster(qmsCheckMaster));
                    }
                    else
                    {
                        //todo:未判断首尾检对批次检测影响
                        if (itemRoutingCheck.CHK_FREQ_VALUE == String.Empty)
                        {
                            return;
                        }
                        int count = int.Parse(jobOrder.TASK_QTY.ToString()) / int.Parse(itemRoutingCheck.CHK_FREQ_VALUE);
                        for (int i = 1; i <= count; i++)
                        {
                            QmsCheckMaster qmsCheckMaster = new QmsCheckMaster();
                            qmsCheckMaster.PKNO               = Guid.NewGuid().ToString("N");
                            qmsCheckMaster.CHECK_PARAM_PKNO   = itemRoutingCheck.CHECK_PARAM_PKNO;
                            qmsCheckMaster.ROUTING_CHECK_PKNO = itemRoutingCheck.PKNO;
                            qmsCheckMaster.CHECK_NO           = "ZJ" + jobOrder.JOB_ORDER_NO + ((3 * 1000) + i).ToString("0000"); //3为批次检测,抽检需要另外规则定制生成
                            qmsCheckMaster.CREATION_DATE      = DateTime.Now;
                            qmsCheckMaster.LAST_UPDATE_DATE   = DateTime.Now;                                                     //最后修改日期
                            qmsCheckMaster.USE_FLAG           = 1;
                            qmsCheckMaster.CHECK_STATUS       = "1";
                            qmsCheckMaster.TASKLINE_PKNO      = jobOrder.JOB_ORDER_NO;//以工单编号应用为关联
                            qmsCheckMaster.PROCESS_PKNO       = itemRoutingCheck.PROCESS_PKNO;
                            qmsCheckMaster.CHK_MODE           = itemRoutingCheck.CHK_MODE;
                            wsQMS.UseService(s => s.AddQmsCheckMaster(qmsCheckMaster));
                        }
                    }
                }
            }
            GetPage();
        }