Ejemplo n.º 1
0
 public QmsCheckMaster GetQmsCheckMasterById(string Id)
 {
     using (IQmsCheckMasterBLL QmsCheckMasterBLL = BLLContainer.Resolve <IQmsCheckMasterBLL>())
     {
         QmsCheckMaster model = QmsCheckMasterBLL.GetFirstOrDefault(Id);
         return(model);
     }
 }
Ejemplo n.º 2
0
 public CheckRecordView(QmsCheckMaster qmsCheckMaster)
 {
     InitializeComponent();
     if (qmsCheckMaster != null)
     {
         m_qmsCheckMaster = qmsCheckMaster;
         GetPage();
     }
 }
Ejemplo n.º 3
0
 public bool AddQmsCheckMaster(QmsCheckMaster mQmsCheckMaster)
 {
     if (mQmsCheckMaster == null)
     {
         return(false);
     }
     using (IQmsCheckMasterBLL QmsCheckMasterBLL = BLLContainer.Resolve <IQmsCheckMasterBLL>())
     {
         return(QmsCheckMasterBLL.Add(mQmsCheckMaster));
     }
 }
Ejemplo n.º 4
0
 public bool DelQmsCheckMaster(string Id)
 {
     using (IQmsCheckMasterBLL QmsCheckMasterBLL = BLLContainer.Resolve <IQmsCheckMasterBLL>())
     {
         try
         {
             QmsCheckMaster item = QmsCheckMasterBLL.GetFirstOrDefault(Id);
             return(QmsCheckMasterBLL.Delete(item));
         }
         catch { return(false); }
     }
 }
Ejemplo n.º 5
0
 private void BtnCheck_Click(object sender, RoutedEventArgs e)
 {
     //todo:质检页面
     if (gridItem.SelectedItem != null)
     {
         QmsCheckMaster  qmsCheckMaster = gridItem.SelectedItem as QmsCheckMaster;
         CheckRecordView checkRecord    = new CheckRecordView(qmsCheckMaster);
         checkRecord.Width   = 800;
         checkRecord.Height  = 700;
         checkRecord.Closed += CheckRecord_Closed;
         checkRecord.Show();
     }
 }
Ejemplo n.º 6
0
        private void BtnCancle_Click(object sender, RoutedEventArgs e)
        {
            if (gridItem.SelectedItem != null)
            {
                QmsCheckMaster qmsCheckMaster = gridItem.SelectedItem as QmsCheckMaster;

                if (qmsCheckMaster != null)
                {
                    qmsCheckMaster.CHECK_STATUS = "-1";
                    qmsCheckMaster.USE_FLAG     = -1;
                }

                ws.UseService(s => s.UpdateQmsCheckMaster(qmsCheckMaster));
            }

            Getdata();
        }
Ejemplo n.º 7
0
 public bool DelQmsCheckMasters(string[] Ids)
 {
     using (IQmsCheckMasterBLL QmsCheckMasterBLL = BLLContainer.Resolve <IQmsCheckMasterBLL>())
     {
         try
         {
             List <QmsCheckMaster> entitys = new List <QmsCheckMaster>();
             foreach (string id in Ids)
             {
                 QmsCheckMaster item = QmsCheckMasterBLL.GetFirstOrDefault(id);
                 entitys.Add(item);
             }
             return(QmsCheckMasterBLL.Delete(entitys));
         }
         catch { return(false); }
     }
 }
Ejemplo n.º 8
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();
        }