Пример #1
0
        public void GetLineByID(Newtonsoft.Json.Linq.JObject requestValue, Newtonsoft.Json.Linq.JObject Data, MESStationReturn StationReturn)
        {
            OleExec  sfcdb = null;
            C_LINE   resultline;
            T_C_LINE line;
            string   LineId = Data["ID"].ToString().Trim();

            try
            {
                sfcdb      = this.DBPools["SFCDB"].Borrow();
                line       = new T_C_LINE(sfcdb, DBTYPE);
                resultline = line.GetLineById(LineId, sfcdb);
                if (resultline != null)
                {
                    StationReturn.Status      = StationReturnStatusValue.Pass;
                    StationReturn.MessageCode = "MES00000026";
                    StationReturn.Data        = resultline;
                }
                else
                {
                    StationReturn.Status      = StationReturnStatusValue.Fail;
                    StationReturn.MessageCode = "MES00000007";
                    StationReturn.MessagePara.Add("Line Id:" + LineId);
                }
                this.DBPools["SFCDB"].Return(sfcdb);
            }
            catch (Exception e)
            {
                if (sfcdb != null)
                {
                    this.DBPools["SFCDB"].Return(sfcdb);
                }
                throw e;
            }
        }
Пример #2
0
        public void DeleteLine(Newtonsoft.Json.Linq.JObject requestValue, Newtonsoft.Json.Linq.JObject Data, MESStationReturn StationReturn)
        {
            OleExec  sfcdb = null;
            T_C_LINE line;
            C_LINE   checkLine;
            string   deleteid = "";

            Newtonsoft.Json.Linq.JArray ID = (Newtonsoft.Json.Linq.JArray)Data["ID"];
            try
            {
                sfcdb = this.DBPools["SFCDB"].Borrow();
                line  = new T_C_LINE(sfcdb, DBTYPE);
                bool isallOK = true;
                sfcdb.BeginTrain();
                for (int i = 0; i < ID.Count; i++)
                {
                    deleteid  = ID[i].ToString();
                    checkLine = line.GetLineById(deleteid, sfcdb);
                    if (checkLine == null)
                    {
                        StationReturn.Status      = StationReturnStatusValue.Fail;
                        StationReturn.MessageCode = "MES00000007";
                        StationReturn.MessagePara.Add("Line Id:" + deleteid);
                        isallOK = false;
                        break;
                    }
                    else
                    {
                        int result = line.deleteById(deleteid, sfcdb);
                        if (result <= 0)
                        {
                            StationReturn.Status      = StationReturnStatusValue.Fail;
                            StationReturn.MessageCode = "MES00000023";
                            StationReturn.MessagePara.Add("Line Id:" + deleteid);
                            isallOK = false;
                            break;
                        }
                    }
                }
                if (isallOK)
                {
                    sfcdb.CommitTrain();
                    StationReturn.Status      = StationReturnStatusValue.Pass;
                    StationReturn.MessageCode = "MES00000001";
                }
                else
                {
                    sfcdb.RollbackTrain();
                }
                this.DBPools["SFCDB"].Return(sfcdb);
            }
            catch (Exception e)
            {
                if (sfcdb != null)
                {
                    this.DBPools["SFCDB"].Return(sfcdb);
                }
                throw e;
            }
        }