Ejemplo n.º 1
0
        public static List <KPListBase> GetKPListBySkuNo(string Skuno, MESDBHelper.OleExec SFCDB)
        {
            List <KPListBase> ret = new List <KPListBase>();
            T_C_KP_LIST       T   = new T_C_KP_LIST(SFCDB, MESDataObject.DB_TYPE_ENUM.Oracle);
            List <string>     IDS = T.GetListIDBySkuno(Skuno, SFCDB);

            for (int i = 0; i < IDS.Count; i++)
            {
                KPListBase I = new KPListBase(IDS[i], SFCDB);
                ret.Add(I);
            }

            return(ret);
        }
Ejemplo n.º 2
0
 public void GetKPListBySkuno(Newtonsoft.Json.Linq.JObject requestValue, Newtonsoft.Json.Linq.JObject Data, MESStationReturn StationReturn)
 {
     MESDBHelper.OleExec SFCDB = this.DBPools["SFCDB"].Borrow();
     try
     {
         string            Skuno = Data["SKUNO"].ToString();
         List <KPListBase> list  = KPListBase.GetKPListBySkuNo(Skuno, SFCDB);
         StationReturn.Data   = list;
         StationReturn.Status = StationReturnStatusValue.Pass;
     } catch (Exception ee)
     {
         this.DBPools["SFCDB"].Return(SFCDB);
         StationReturn.Status      = StationReturnStatusValue.Fail;
         StationReturn.MessageCode = "MES00000037";
         StationReturn.MessagePara.Add(ee.Message);
         return;
     }
     this.DBPools["SFCDB"].Return(SFCDB);
 }
Ejemplo n.º 3
0
 public void GetAllKPList(Newtonsoft.Json.Linq.JObject requestValue, Newtonsoft.Json.Linq.JObject Data, MESStationReturn StationReturn)
 {
     MESDBHelper.OleExec SFCDB = this.DBPools["SFCDB"].Borrow();
     try
     {
         List <MESDataObject.Module.C_KP_LIST> list = KPListBase.getAllData(SFCDB);
         StationReturn.Data   = list;
         StationReturn.Status = StationReturnStatusValue.Pass;
     }
     catch (Exception ee)
     {
         this.DBPools["SFCDB"].Return(SFCDB);
         StationReturn.Status      = StationReturnStatusValue.Fail;
         StationReturn.MessageCode = "MES00000037";
         StationReturn.MessagePara.Add(ee.Message);
         return;
     }
     this.DBPools["SFCDB"].Return(SFCDB);
 }
Ejemplo n.º 4
0
        public void GetKPListByListName(Newtonsoft.Json.Linq.JObject requestValue, Newtonsoft.Json.Linq.JObject Data, MESStationReturn StationReturn)
        {
            MESDBHelper.OleExec SFCDB = this.DBPools["SFCDB"].Borrow();
            string ListName           = Data["ListName"].ToString();

            try
            {
                KPListBase ret = KPListBase.GetKPListByListName(ListName, SFCDB);
                StationReturn.Data   = ret;
                StationReturn.Status = StationReturnStatusValue.Pass;
            }
            catch (Exception ee)
            {
                //this.DBPools["SFCDB"].Return(SFCDB);
                StationReturn.Status      = StationReturnStatusValue.Fail;
                StationReturn.MessageCode = "MES00000037";
                StationReturn.MessagePara.Add(ee.Message);
            }
            this.DBPools["SFCDB"].Return(SFCDB);
        }
Ejemplo n.º 5
0
        public KPListItem(string ID, KPListBase _KPListBase, OleExec sfcdb)
        {
            KPList = _KPListBase;
            T_C_KP_List_Item   T = new T_C_KP_List_Item(sfcdb, MESDataObject.DB_TYPE_ENUM.Oracle);
            Row_C_KP_List_Item R = (Row_C_KP_List_Item)T.GetObjByID(ID, sfcdb);

            if (R != null)
            {
                value = R.GetDataObject();
            }
            else
            {
                throw new Exception($@"查詢不到ID為:{ID} KP_List_Item");
            }
            List <string> itemID = T.GetItemDetailID(ID, sfcdb);

            for (int i = 0; i < itemID.Count; i++)
            {
                KPListDetail I = new KPListDetail(itemID[i], this, sfcdb);
                Detail.Add(I);
            }
        }
Ejemplo n.º 6
0
        public void RemoveKPList(Newtonsoft.Json.Linq.JObject requestValue, Newtonsoft.Json.Linq.JObject Data, MESStationReturn StationReturn)
        {
            MESDBHelper.OleExec SFCDB = this.DBPools["SFCDB"].Borrow();
            List <string>       ret   = new List <string>();

            try
            {
                Newtonsoft.Json.Linq.JToken names = Data["ListNames"];
                for (int i = 0; i < names.Count(); i++)
                {
                    KPListBase list = KPListBase.GetKPListByListName(names[i].ToString(), SFCDB);
                    try
                    {
                        SFCDB.BeginTrain();
                        list.ReMoveFromDB(SFCDB);
                        ret.Add(names[i].ToString());
                        SFCDB.CommitTrain();
                    }
                    catch
                    {
                        SFCDB.RollbackTrain();
                    }
                }
                StationReturn.Data   = ret;
                StationReturn.Status = StationReturnStatusValue.Pass;
            }
            catch (Exception ee)
            {
                this.DBPools["SFCDB"].Return(SFCDB);
                StationReturn.Status      = StationReturnStatusValue.Fail;
                StationReturn.MessageCode = "MES00000037";
                StationReturn.MessagePara.Add(ee.Message);
                return;
            }
            this.DBPools["SFCDB"].Return(SFCDB);
        }
Ejemplo n.º 7
0
        public void UpLoadKPList(Newtonsoft.Json.Linq.JObject requestValue, Newtonsoft.Json.Linq.JObject Data, MESStationReturn StationReturn)
        {
            MESDBHelper.OleExec SFCDB = this.DBPools["SFCDB"].Borrow();
            SFCDB.BeginTrain();
            try
            {
                string Skuno    = Data["SkuNo"].ToString();
                string ListName = Data["ListName"].ToString();
                Newtonsoft.Json.Linq.JToken ListData = Data["ListData"];
                T_C_KP_LIST   T         = new T_C_KP_LIST(SFCDB, MESDataObject.DB_TYPE_ENUM.Oracle);
                string        NewListID = T.GetNewID(this.BU, SFCDB);
                Row_C_KP_LIST R         = (Row_C_KP_LIST)T.NewRow();
                DateTime      Now       = DateTime.Now;

                T_C_KP_List_Item   TItem = new T_C_KP_List_Item(SFCDB, MESDataObject.DB_TYPE_ENUM.Oracle);
                Row_C_KP_List_Item RItem = (Row_C_KP_List_Item)TItem.NewRow();

                T_C_KP_List_Item_Detail   TDetail = new T_C_KP_List_Item_Detail(SFCDB, MESDataObject.DB_TYPE_ENUM.Oracle);
                Row_C_KP_List_Item_Detail RDetail = (Row_C_KP_List_Item_Detail)TDetail.NewRow();

                KPListBase oldList = KPListBase.GetKPListByListName(ListName, SFCDB);
                if (oldList != null)
                {
                    oldList.ReMoveFromDB(SFCDB);
                }

                R.ID        = NewListID;
                R.SKUNO     = Skuno.Trim();
                R.LISTNAME  = ListName;
                R.EDIT_EMP  = this.LoginUser.EMP_NO;
                R.EDIT_TIME = Now;

                SFCDB.ExecSQL(R.GetInsertString(MESDataObject.DB_TYPE_ENUM.Oracle));
                //Item	PartNO	KPName	Station	QTY	ScanType
                DataTable dt = new DataTable();
                dt.Columns.Add("Item");
                dt.Columns.Add("PartNO");
                dt.Columns.Add("KPName");
                dt.Columns.Add("Station");
                dt.Columns.Add("QTY");
                dt.Columns.Add("ScanType");
                List <DataRow> ListItem = new List <DataRow>();
                for (int i = 0; i < ListData.Count(); i++)
                {
                    DataRow dr = dt.NewRow();
                    dr["Item"]     = ListData[i]["Item"].ToString();
                    dr["PartNO"]   = ListData[i]["PartNO"].ToString();
                    dr["KPName"]   = ListData[i]["KPName"].ToString();
                    dr["Station"]  = ListData[i]["Station"].ToString();
                    dr["QTY"]      = ListData[i]["QTY"].ToString();
                    dr["ScanType"] = ListData[i]["ScanType"].ToString();
                    dt.Rows.Add(dr);
                    ListItem.Add(dr);
                }
                Dictionary <string, string> Item = new Dictionary <string, string>();
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    if (!Item.ContainsKey(dt.Rows[i]["Item"].ToString()))
                    {
                        Item.Add(dt.Rows[i]["Item"].ToString(), dt.Rows[i]["PartNO"].ToString());
                    }
                }
                string[] itemNo = new string[Item.Keys.Count];
                Item.Keys.CopyTo(itemNo, 0);
                for (int i = 0; i < itemNo.Length; i++)
                {
                    List <DataRow> Items = ListItem.FindAll(TT => TT["Item"].ToString() == itemNo[i]);
                    for (int j = 0; j < Items.Count; j++)
                    {
                        if (j == 0)
                        {
                            RItem.ID        = TItem.GetNewID(BU, SFCDB);
                            RItem.LIST_ID   = NewListID;
                            RItem.KP_NAME   = Items[j]["KPName"].ToString();
                            RItem.KP_PARTNO = Items[j]["PartNO"].ToString();
                            RItem.STATION   = Items[j]["Station"].ToString();
                            RItem.QTY       = double.Parse(Items[j]["QTY"].ToString());
                            RItem.SEQ       = i;
                            RItem.EDIT_EMP  = this.LoginUser.EMP_NO;
                            RItem.EDIT_TIME = Now;
                            SFCDB.ExecSQL(RItem.GetInsertString(MESDataObject.DB_TYPE_ENUM.Oracle));
                        }

                        RDetail.ID        = TDetail.GetNewID(BU, SFCDB);
                        RDetail.ITEM_ID   = RItem.ID;
                        RDetail.SCANTYPE  = Items[j]["ScanType"].ToString();
                        RDetail.SEQ       = j + 1;
                        RDetail.EDIT_EMP  = RItem.EDIT_EMP;
                        RDetail.EDIT_TIME = Now;
                        SFCDB.ExecSQL(RDetail.GetInsertString(MESDataObject.DB_TYPE_ENUM.Oracle));
                    }
                }

                StationReturn.Status = StationReturnStatusValue.Pass;
            }
            catch (Exception ee)
            {
                SFCDB.RollbackTrain();
                this.DBPools["SFCDB"].Return(SFCDB);
                StationReturn.Status      = StationReturnStatusValue.Fail;
                StationReturn.MessageCode = "MES00000037";
                StationReturn.MessagePara.Add(ee.Message);
                return;
            }
            SFCDB.CommitTrain();
            this.DBPools["SFCDB"].Return(SFCDB);
        }