public string BindingTermSection(IList <CV_PM_BPM_TERMINAL_SECTION> param)
        {
            //检查该工段是否已经绑定该工位
            try
            {
                string alreadyBindTerm = "";
                foreach (var item in param)
                {
                    PM_BPM_TERMINAL_SECTION_QueryParam chkModel = new PM_BPM_TERMINAL_SECTION_QueryParam();
                    chkModel.TerminalGuid = item.TerminalGuid;
                    IList <PM_BPM_TERMINAL_SECTION> bindList = term_sectionBO.GetEntities(chkModel);

                    string sql = "SELECT SectionName FROM PM_BPM_SECTION WHERE  SectionGuid='{0}'";
                    sql = string.Format(sql, item.SectionGuid.ToString());
                    ICO_BSC_BO _CO_BSC_BO = ObjectContainer.BuildUp <ICO_BSC_BO>();
                    DataTable  dt         = _CO_BSC_BO.GetDataTableBySql(sql);
                    if (dt == null || dt.Rows.Count == 0)
                    {
                        alreadyBindTerm += "工位:" + item.TerminalID + ",已绑定";
                    }

                    else
                    {
                        if (bindList.Count != 0)
                        {
                            //如果该工位已经进行了绑定,则记录
                            alreadyBindTerm += "工位:" + item.TerminalID + ",已绑定至:" + dt.Rows[0][0].ToString() + "工段";
                        }
                        else
                        {
                            //如果没有绑定,则添加
                            PM_BPM_TERMINAL_SECTION insrtModel = new PM_BPM_TERMINAL_SECTION();
                            insrtModel.TermSectionGuid = Guid.NewGuid();
                            insrtModel.TerminalGuid    = item.TerminalGuid;
                            insrtModel.SectionGuid     = item.SectionGuid;
                            insrtModel.CreatedOn       = SSGlobalConfig.Now;
                            insrtModel.UpdatedOn       = insrtModel.CreatedOn;
                            term_sectionBO.Insert(insrtModel);
                        }
                    }
                }
                if (!string.IsNullOrEmpty(alreadyBindTerm))
                {
                    //除去末位的逗号
                    alreadyBindTerm.Substring(0, alreadyBindTerm.Length - 2);
                    return("[" + alreadyBindTerm + "],如需要修改,请先解绑!");
                }
                else
                {
                    return("绑定成功!");
                }
            }
            catch (Exception ex)
            {
                return("系统异常:" + ex.Message);
            }
        }
        public IList <PM_BPM_LINE> GetAllLine()
        {
            IList <PM_BPM_LINE> list = new List <PM_BPM_LINE>();
            //list = LineBO.GetAll();
            string     sql        = @"SELECT [LineID], [LineName], [LineType], [LineDesc] FROM dbo.PM_BPM_LINE  WHERE RowDeleted = '0' OR RowDeleted is null ";
            ICO_BSC_BO _CO_BSC_BO = ObjectContainer.BuildUp <ICO_BSC_BO>();
            DataTable  dt         = _CO_BSC_BO.GetDataTableBySql(sql);

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                PM_BPM_LINE line = new PM_BPM_LINE();
                line.LineID   = dt.Rows[i]["LineID"].ToString();
                line.LineName = dt.Rows[i]["LineName"].ToString();
                line.LineType = dt.Rows[i]["LineType"].ToString();
                line.LineDesc = dt.Rows[i]["LineDesc"].ToString();
                list.Add(line);
            }
            //log.Debug(JsonConvert.SerializeObject(list));
            return(list);
        }
Exemplo n.º 3
0
        public object GetFeedingLocationByTerminalID(string terminalID)
        {
            IList <MM_FEEDING_LOCATION> list = new List <MM_FEEDING_LOCATION>();
            ICO_BSC_BO co_BSC_BO             = ObjectContainer.BuildUp <ICO_BSC_BO>();
            string     sql;

            if (terminalID.Length > 7)
            {
                terminalID = terminalID.Substring(0, 7);
                sql        = @"SELECT * FROM dbo.MM_FEEDING_LOCATION  WHERE FeedingLocation like '{0}_%'";
                sql        = string.Format(sql, terminalID);
            }
            else
            {
                sql = @"SELECT *  FROM dbo.MM_FEEDING_LOCATION ";
                sql = string.Format(sql);
            }
            DataTable dtMaterial = co_BSC_BO.GetDataTableBySql(sql);

            if (dtMaterial == null)
            {
                sql        = @"SELECT *  FROM dbo.MM_FEEDING_LOCATION ";
                sql        = string.Format(sql);
                dtMaterial = co_BSC_BO.GetDataTableBySql(sql);
            }
            foreach (DataRow dr in dtMaterial.Rows)
            {
                MM_FEEDING_LOCATION model = new MM_FEEDING_LOCATION();
                model.ID = Convert.ToInt32(dr["ID"]);
                model.FeedingLocation     = dr["FeedingLocation"].ToString();
                model.Note                = dr["Note"].ToString();
                model.FeedingLocationDesc = dr["FeedingLocationDesc"].ToString();
                list.Add(model);
            }
            return(list);
        }
Exemplo n.º 4
0
        /// 单条报工
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public string GetEXCPtimeByOrderId(string orderid, string excpTimeGuid) //传入的参数是OrderId
        {
            string retmes = "";

            try
            {
                IAPI_SAP_BO sapBO     = ObjectContainer.BuildUp <IAPI_SAP_BO>();
                ICO_BSC_BO  co_BSC_BO = ObjectContainer.BuildUp <ICO_BSC_BO>();
                //------------------------------------

                string sqlSL = @" SELECT SapOrderID,PersonSdt,Day,StepID FROM CV_POM_ORDERTIME where  excpTimeGuid='" + excpTimeGuid + "'";

                DataTable datatable = co_BSC_BO.GetDataTableBySql(sqlSL);
                if (datatable == null || datatable.Rows.Count == 0)
                {
                    return("未查询到需要报工记录!");
                }
                ModelHandler <Expt> MH            = new ModelHandler <Expt>();
                List <Expt>         listStopOrder = new List <Expt>();
                listStopOrder = MH.FillModel(datatable);
                for (int j = 0; j < listStopOrder.Count; j++)
                {
                    POMOrder_CompletedByTime li         = new POMOrder_CompletedByTime();
                    POM_ORDER_EXCP_TIME      POM_TIME   = new POM_ORDER_EXCP_TIME();
                    IPOM_ORDER_EXCP_TIMEBO   POM_TIMEBO = ObjectContainer.BuildUp <IPOM_ORDER_EXCP_TIMEBO>();


                    string retmessage = "";
                    //获取当前工单的多个BOPID进行多次报工
//                    string FrID = @" SELECT  BOPID FROM dbo.POM_ORDER_EXT  t
//                                    LEFT JOIN dbo.PLM_BOP_LINE_STD b on b.OrderID=t.PomOrderID
//                                    WHERE SapOrderID='" + listStopOrder[j].SapOrderID + @"'
//                                    GROUP BY BOPID ";
//                    DataTable FrIDdt = co_BSC_BO.GetDataTableBySql(FrID);
//                    foreach (DataRow item in FrIDdt.Rows)
//                    {
                    List <POMOrder_CompletedByTime> list = new List <POMOrder_CompletedByTime>();
                    li.SapOrderID = listStopOrder[j].SapOrderID;
                    li.PK         = Guid.NewGuid().ToString();
                    li.PersonSdt  = Convert.ToDecimal(listStopOrder[j].PersonSdt);
                    li.Unit       = "s";
                    li.MachineSdt = 0;
                    li.OtherSdt   = 0;
                    li.DepretSdt  = 0;
                    li.Day        = listStopOrder[j].Day.ToString("yyyy-MM-dd HH:mm:ss");;
                    li.SapStepID  = listStopOrder[j].StepID.ToUpper();
                    list.Add(li);

                    //掉SAP接口
                    ReturnValue rv = sapBO.OrderCompleteByTime(list[j]);
                    if (rv.Success)
                    {
                        POM_TIME.Status = 1;
                        #region MyRegion
                        //POM_TIME.ExcpTimeGuid = Guid.NewGuid();
                        //POM_TIME.Day = date;
                        //POM_TIME.SapOrderID = listStopOrder[j].SapOrderID;
                        //POM_TIME.PersonSdt = Convert.ToDecimal(listStopOrder[j].PersonSdt);
                        //POM_TIME.Message = rv.Message;
                        //POM_TIME.CreatedOn = DateTime.Now;
                        //POM_TIME.Status = 1;
                        //POM_TIMEBO.Insert(POM_TIME);
                        ////StopLineBO.UpdateSome();
                        //for (int i = 0; i < stoplineGuid.Count; i++)
                        //{

                        //    POM_STOPLINE.ExcpStopLineGuid = Guid.NewGuid();
                        //    POM_STOPLINE.ExcpTimeGuid = POM_TIME.ExcpTimeGuid;
                        //    POM_STOPLINE.StopLineGuid = stoplineGuid[i].StopLineGuid;
                        //    POM_STOPLINEBO.Insert(POM_STOPLINE);
                        //    //stopline表的是否报工为true。
                        //    pM_EM_TS_STOPLINE.StopLineGuid = stoplineGuid[i].StopLineGuid;
                        //    pM_EM_TS_STOPLINE.IsReleased = true;
                        //    StopLineBO.UpdateSome(pM_EM_TS_STOPLINE);
                        //}
                        #endregion
                    }
                    else
                    {
                        retmes         += rv.Message;
                        POM_TIME.Status = -1;
                        #region MyRegion
                        //POM_TIME.ExcpTimeGuid = Guid.NewGuid();
                        //POM_TIME.Day = date;
                        //POM_TIME.SapOrderID = listStopOrder[j].SapOrderID;
                        //POM_TIME.PersonSdt = Convert.ToDecimal(listStopOrder[j].PersonSdt);
                        //POM_TIME.Message = rv.Message;
                        //POM_TIME.CreatedOn = DateTime.Now;
                        //POM_TIME.Status = -1;
                        //POM_TIMEBO.Insert(POM_TIME);

                        //for (int i = 0; i < stoplineGuid.Count; i++)
                        //{
                        //    POM_STOPLINE.ExcpStopLineGuid = Guid.NewGuid();
                        //    POM_STOPLINE.ExcpTimeGuid = POM_TIME.ExcpTimeGuid;
                        //    POM_STOPLINE.StopLineGuid = stoplineGuid[i].StopLineGuid;
                        //    POM_STOPLINEBO.Insert(POM_STOPLINE);
                        //    //stopline表的是否报工为true。
                        //    pM_EM_TS_STOPLINE.StopLineGuid = stoplineGuid[i].StopLineGuid;
                        //    pM_EM_TS_STOPLINE.IsReleased = true;
                        //    StopLineBO.UpdateSome(pM_EM_TS_STOPLINE);
                        //}
                        #endregion
                    }
                    // }

                    if (retmes == "")
                    {
                        retmes = "true";
                    }

                    POM_TIME.ExcpTimeGuid = new Guid(excpTimeGuid);
                    POM_TIME.SapOrderID   = listStopOrder[j].SapOrderID;
                    POM_TIME.PersonSdt    = Convert.ToDecimal(listStopOrder[j].PersonSdt);
                    POM_TIME.Message      = retmes;
                    POM_TIMEBO.UpdateSome(POM_TIME);
                }

                return(retmes);
            }
            catch (Exception ex)
            {
                log.Error(ex.Message);
                return("报工异常:" + ex.Message);
            }
        }