Exemple #1
0
        public void QueryMpnBySku(Newtonsoft.Json.Linq.JObject requestValue, Newtonsoft.Json.Linq.JObject Data, MESStationReturn StationReturn)
        {
            string           Sku         = Data["SKUNO"].ToString().Trim();
            OleExec          oleDB       = null;
            T_C_SKU_MPN      cSkuMpn     = null;
            List <C_SKU_MPN> cSkuMpnList = new List <C_SKU_MPN>();

            try
            {
                oleDB       = this.DBPools["SFCDB"].Borrow();
                cSkuMpn     = new T_C_SKU_MPN(oleDB, DBTYPE);
                cSkuMpnList = cSkuMpn.GetMpnBySku(oleDB, Sku);
                if (cSkuMpnList.Count > 0)
                {
                    StationReturn.Status      = StationReturnStatusValue.Pass;
                    StationReturn.MessageCode = "MES00000033";
                    StationReturn.MessagePara.Add(cSkuMpnList.Count);
                    StationReturn.Data = cSkuMpnList;
                }
                else
                {
                    StationReturn.Status      = StationReturnStatusValue.Fail;
                    StationReturn.MessageCode = "MES00000034";
                    StationReturn.Data        = "";
                }
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                this.DBPools["SFCDB"].Return(oleDB);
            }
        }
Exemple #2
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 + "未配置規則!");
                    }
                }
            }
        }