コード例 #1
0
        public void DeleteCKpRule(Newtonsoft.Json.Linq.JObject requestValue, Newtonsoft.Json.Linq.JObject Data, MESStationReturn StationReturn)
        {
            string    RWOKPREPLACEIDS = Data["IDS"].ToString().Trim();
            ArrayList DelIds          = new ArrayList(RWOKPREPLACEIDS.Split(','));

            DelIds.Remove("");
            OleExec     oleDB   = null;
            T_C_KP_Rule cKpRule = null;

            try
            {
                oleDB   = this.DBPools["SFCDB"].Borrow();
                cKpRule = new T_C_KP_Rule(oleDB, DBTYPE);
                oleDB.BeginTrain();
                foreach (var VARIABLE in (string[])DelIds.ToArray(typeof(string)))
                {
                    oleDB.ThrowSqlExeception = true;
                    Row_C_KP_Rule row = (Row_C_KP_Rule)cKpRule.GetObjByID(VARIABLE, oleDB, DBTYPE);
                    oleDB.ExecSQL(row.GetDeleteString(DBTYPE));
                }
                oleDB.CommitTrain();
                StationReturn.Status      = StationReturnStatusValue.Pass;
                StationReturn.MessageCode = "MES00000004";
            }
            catch (Exception e)
            {
                oleDB.RollbackTrain();
                throw e;
            }
            finally
            {
                this.DBPools["SFCDB"].Return(oleDB);
            }
        }
コード例 #2
0
        public void QueryCKpRule(Newtonsoft.Json.Linq.JObject requestValue, Newtonsoft.Json.Linq.JObject Data, MESStationReturn StationReturn)
        {
            string           Partno = Data["PARTNO"].ToString().Trim();
            OleExec          oleDB  = null;
            T_C_KP_Rule      T      = null;
            List <C_KP_Rule> CList  = new List <C_KP_Rule>();

            try
            {
                oleDB = this.DBPools["SFCDB"].Borrow();
                T     = new T_C_KP_Rule(oleDB, DBTYPE);
                CList = T.GetCKpRule(oleDB, Partno);
                if (CList.Count > 0)
                {
                    StationReturn.Status      = StationReturnStatusValue.Pass;
                    StationReturn.MessageCode = "MES00000033";
                    StationReturn.MessagePara.Add(CList.Count);
                    StationReturn.Data = CList;
                }
                else
                {
                    StationReturn.Status      = StationReturnStatusValue.Fail;
                    StationReturn.MessageCode = "MES00000034";
                    StationReturn.Data        = "";
                }
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                this.DBPools["SFCDB"].Return(oleDB);
            }
        }
コード例 #3
0
        public void AddCKpRule(Newtonsoft.Json.Linq.JObject requestValue, Newtonsoft.Json.Linq.JObject Data, MESStationReturn StationReturn)
        {
            string      Partno = Data["PARTNO"].ToString().Trim(), Mpn = Data["MPN"].ToString().Trim(), ScanType = Data["SCANTYPE"].ToString().Trim(), REGEX = Data["REGEX"].ToString().Trim();
            OleExec     oleDB   = null;
            T_C_KP_Rule cKpRule = null;

            try
            {
                oleDB   = this.DBPools["SFCDB"].Borrow();
                cKpRule = new T_C_KP_Rule(oleDB, DBTYPE);
                if (cKpRule.IsExists(oleDB, Partno, Mpn, ScanType))
                {
                    StationReturn.Status      = StationReturnStatusValue.Fail;
                    StationReturn.MessageCode = "MES00000005";
                    StationReturn.Data        = "";
                }
                else
                {
                    Row_C_KP_Rule row = (Row_C_KP_Rule)cKpRule.NewRow();
                    row.ID                   = cKpRule.GetNewID(this.BU, oleDB, DBTYPE);
                    row.PARTNO               = Partno;
                    row.MPN                  = Mpn;
                    row.SCANTYPE             = ScanType;
                    row.REGEX                = REGEX;
                    row.EDIT_EMP             = this.LoginUser.EMP_NO;
                    row.EDIT_TIME            = GetDBDateTime();;
                    oleDB.ThrowSqlExeception = true;
                    oleDB.ExecSQL(row.GetInsertString(DBTYPE));
                    StationReturn.Status      = StationReturnStatusValue.Pass;
                    StationReturn.MessageCode = "MES00000002";
                    StationReturn.Data        = "";
                }
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                this.DBPools["SFCDB"].Return(oleDB);
            }
        }
コード例 #4
0
        public void ModifyCKpRule(Newtonsoft.Json.Linq.JObject requestValue, Newtonsoft.Json.Linq.JObject Data, MESStationReturn StationReturn)
        {
            string id            = Data["ID"].ToString().Trim(),
                   REGEX         = Data["REGEX"].ToString().Trim();
            OleExec     oleDB    = null;
            T_C_KP_Rule cKpCheck = null;

            try
            {
                oleDB    = this.DBPools["SFCDB"].Borrow();
                cKpCheck = new T_C_KP_Rule(oleDB, DBTYPE);
                Row_C_KP_Rule row = (Row_C_KP_Rule)cKpCheck.GetObjByID(id, oleDB, DBTYPE);
                if (row == null)
                {
                    StationReturn.Status      = StationReturnStatusValue.Fail;
                    StationReturn.MessageCode = "MES00000005";
                    StationReturn.Data        = "";
                }
                else
                {
                    row.REGEX                = REGEX;
                    row.EDIT_EMP             = this.LoginUser.EMP_NO;
                    row.EDIT_TIME            = GetDBDateTime();
                    oleDB.ThrowSqlExeception = true;
                    oleDB.ExecSQL(row.GetUpdateString(DBTYPE));
                    StationReturn.Status      = StationReturnStatusValue.Pass;
                    StationReturn.MessageCode = "MES00000003";
                }
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                oleDB.ThrowSqlExeception = false;
                this.DBPools["SFCDB"].Return(oleDB);
            }
        }
コード例 #5
0
ファイル: SN.cs プロジェクト: maoyongjun/cloudMES_L5
        public void UpdateSNKP(WorkOrder woObject, List <R_SN> snList, BaseClass.MESStationBase Station)
        {
            T_C_KP_LIST             t_c_kp_list             = new T_C_KP_LIST(Station.SFCDB, Station.DBType);
            T_C_KP_List_Item        t_c_kp_list_item        = new T_C_KP_List_Item(Station.SFCDB, Station.DBType);
            T_C_KP_List_Item_Detail t_c_kp_list_item_detail = new T_C_KP_List_Item_Detail(Station.SFCDB, Station.DBType);
            T_R_SN_KP   t_r_sn_kp   = new T_R_SN_KP(Station.SFCDB, Station.DBType);
            T_C_SKU_MPN t_c_sku_mpn = new T_C_SKU_MPN(Station.SFCDB, Station.DBType);
            T_C_KP_Rule c_kp_rule   = new T_C_KP_Rule(Station.SFCDB, Station.DBType);
            Row_R_SN_KP rowSNKP;

            List <C_KP_List_Item>        kpItemList     = new List <C_KP_List_Item>();
            List <C_SKU_MPN>             skuMpnList     = new List <C_SKU_MPN>();
            List <C_KP_List_Item_Detail> itemDetailList = new List <C_KP_List_Item_Detail>();
            C_KP_Rule kpRule  = new C_KP_Rule();
            int       scanseq = 0;
            int       result;
            string    skuMpn = "";

            try
            {
                kpItemList = t_c_kp_list_item.GetItemObjectByListId(woObject.KP_LIST_ID, Station.SFCDB);
                if (kpItemList == null || kpItemList.Count == 0)
                {
                    throw new MESDataObject.MESReturnMessage(MESDataObject.MESReturnMessage.GetMESReturnMessage("MES00000255", new string[] { woObject.SkuNO }));
                }

                foreach (R_SN r_sn in snList)
                {
                    result = t_r_sn_kp.DeleteBySNID(r_sn.ID, Station.SFCDB);
                    if (result <= 0)
                    {
                        throw new MESDataObject.MESReturnMessage(MESDataObject.MESReturnMessage.GetMESReturnMessage("MES00000083", new string[] { "R_SN_KP:" + r_sn.SN, "DELETE" }));
                    }

                    foreach (C_KP_List_Item kpItem in kpItemList)
                    {
                        itemDetailList = t_c_kp_list_item_detail.GetItemDetailObjectByItemId(kpItem.ID, Station.SFCDB);
                        if (itemDetailList == null || itemDetailList.Count == 0)
                        {
                            throw new MESDataObject.MESReturnMessage(MESDataObject.MESReturnMessage.GetMESReturnMessage("MES00000255", new string[] { woObject.SkuNO }));
                        }

                        skuMpnList = t_c_sku_mpn.GetMpnBySkuAndPartno(Station.SFCDB, woObject.SkuNO, kpItem.KP_PARTNO);
                        if (skuMpnList.Count != 0)
                        {
                            skuMpn = skuMpnList[0].MPN;
                        }


                        foreach (C_KP_List_Item_Detail itemDetail in itemDetailList)
                        {
                            scanseq = scanseq + 1;
                            kpRule  = c_kp_rule.GetKPRule(Station.SFCDB, kpItem.KP_PARTNO, skuMpn, itemDetail.SCANTYPE);
                            if (kpRule == null)
                            {
                                throw new MESDataObject.MESReturnMessage(MESDataObject.MESReturnMessage.GetMESReturnMessage("MES00000256", new string[] { kpItem.KP_PARTNO, skuMpn, itemDetail.SCANTYPE }));
                            }
                            if (kpRule.REGEX == "")
                            {
                                throw new MESDataObject.MESReturnMessage(MESDataObject.MESReturnMessage.GetMESReturnMessage("MES00000256", new string[] { kpItem.KP_PARTNO, skuMpn, itemDetail.SCANTYPE }));
                            }
                            rowSNKP            = (Row_R_SN_KP)t_r_sn_kp.NewRow();
                            rowSNKP.ID         = t_r_sn_kp.GetNewID(Station.BU, Station.SFCDB);
                            rowSNKP.R_SN_ID    = r_sn.ID;
                            rowSNKP.SN         = r_sn.SN;
                            rowSNKP.VALUE      = "";
                            rowSNKP.PARTNO     = kpItem.KP_PARTNO;
                            rowSNKP.KP_NAME    = kpItem.KP_NAME;
                            rowSNKP.MPN        = skuMpn;
                            rowSNKP.SCANTYPE   = itemDetail.SCANTYPE;
                            rowSNKP.ITEMSEQ    = kpItem.SEQ;
                            rowSNKP.SCANSEQ    = scanseq;
                            rowSNKP.DETAILSEQ  = itemDetail.SEQ;
                            rowSNKP.STATION    = kpItem.STATION;
                            rowSNKP.REGEX      = kpRule.REGEX;
                            rowSNKP.VALID_FLAG = 1;
                            rowSNKP.EXKEY1     = "";
                            rowSNKP.EXVALUE1   = "";
                            rowSNKP.EXKEY2     = "";
                            rowSNKP.EXVALUE2   = "";
                            rowSNKP.EDIT_EMP   = Station.LoginUser.EMP_NO;
                            rowSNKP.EDIT_TIME  = Station.GetDBDateTime();
                            result             = Convert.ToInt32(Station.SFCDB.ExecSQL(rowSNKP.GetInsertString(Station.DBType)));
                            if (result <= 0)
                            {
                                throw new MESDataObject.MESReturnMessage(MESDataObject.MESReturnMessage.GetMESReturnMessage("MES00000083", new string[] { "R_SN_KP:" + r_sn.SN, "ADD" }));
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #6
0
        public SN_KP(List <R_SN_KP> _Value, string Wo, string Skuno, OleExec SFCDB)
        {
            KPS = _Value;

            T_C_SKU_MPN TCSM = new T_C_SKU_MPN(SFCDB, DB_TYPE_ENUM.Oracle);

            MPNs = TCSM.GetMpnBySku(SFCDB, Skuno);
            T_R_WO_KP_Repalce TRWKR = new T_R_WO_KP_Repalce(SFCDB, DB_TYPE_ENUM.Oracle);

            List <R_WO_KP_Repalce> Repalce1 = TRWKR.GetWoRepalceKP(Wo, SFCDB);

            T_C_KP_Rule TCKR = new T_C_KP_Rule(SFCDB, DB_TYPE_ENUM.Oracle);

            KPRule = TCKR.GetDataBySkuWo(Wo, Skuno, SFCDB);
            for (int i = 0; i < Repalce1.Count; i++)
            {
                if (!Repalce.ContainsKey(Repalce1[i].PARTNO))
                {
                    Repalce.Add(Repalce1[i].PARTNO, new List <R_WO_KP_Repalce>());
                }
                Repalce[Repalce1[i].PARTNO].Add(Repalce1[i]);
            }

            for (int i = 0; i < KPS.Count; i++)
            {
                if (KPS[i].VALUE == "" || KPS[i].VALUE == null)
                {
                    C_KP_Rule rule = KPRule.Find(T => T.PARTNO == KPS[i].PARTNO && T.SCANTYPE == KPS[i].SCANTYPE);
                    if (rule == null)
                    {
                        List <R_WO_KP_Repalce> rep = null;
                        try
                        {
                            rep = Repalce[KPS[i].PARTNO];
                        } catch
                        { }
                        if (rep != null)
                        {
                            for (int j = 0; j < rep.Count; j++)
                            {
                                rule = KPRule.Find(T => T.PARTNO == rep[j].REPALCEPARTNO && T.SCANTYPE == KPS[i].SCANTYPE);
                                if (rule == null)
                                {
                                    continue;
                                }
                                else
                                {
                                    break;
                                }
                            }

                            if (rule == null)
                            {
                                throw new Exception(KPS[i].PARTNO + "的替代料" + rep[i].REPALCEPARTNO + "," + KPS[i].SCANTYPE + "未配置規則!");
                            }
                        }

                        throw new Exception(KPS[i].PARTNO + "," + KPS[i].SCANTYPE + "未配置規則!");
                    }
                }
            }
        }