Esempio n. 1
0
        public void MarkWO(Newtonsoft.Json.Linq.JObject requestValue, Newtonsoft.Json.Linq.JObject Data, MESStationReturn StationReturn)
        {
            OleExec sfcdb = null;

            try
            {
                sfcdb = this.DBPools["SFCDB"].Borrow();
                T_R_WO_REGION   wo     = new T_R_WO_REGION(sfcdb, DB_TYPE_ENUM.Oracle);
                Row_R_WO_REGION r      = (Row_R_WO_REGION)wo.GetObjByID(Data["ID"].ToString(), sfcdb, DB_TYPE_ENUM.Oracle);
                string          strRet = sfcdb.ExecSQL(r.GetDeleteString(DB_TYPE_ENUM.Oracle));
                if (Convert.ToInt32(strRet) > 0)
                {
                    StationReturn.Status      = StationReturnStatusValue.Pass;
                    StationReturn.MessageCode = "MES00000004";
                    StationReturn.Data        = "";
                }
                else
                {
                    StationReturn.Status      = StationReturnStatusValue.Fail;
                    StationReturn.MessageCode = "NotLatestData";
                }
                this.DBPools["SFCDB"].Return(sfcdb);
            }
            catch (Exception e)
            {
                this.DBPools["SFCDB"].Return(sfcdb);
                throw e;
            }
        }
Esempio n. 2
0
        public void DeleteWoRange(Newtonsoft.Json.Linq.JObject requestValue, Newtonsoft.Json.Linq.JObject Data, MESStationReturn StationReturn)
        {
            OleExec sfcdb = null;

            try
            {
                sfcdb = this.DBPools["SFCDB"].Borrow();
                T_R_WO_REGION wo = new T_R_WO_REGION(sfcdb, DB_TYPE_ENUM.Oracle);
                foreach (var item in Data["ID"])
                {
                    Row_R_WO_REGION r      = (Row_R_WO_REGION)wo.GetObjByID(item.ToString(), sfcdb, DB_TYPE_ENUM.Oracle);
                    string          strRet = sfcdb.ExecSQL(r.GetDeleteString(DB_TYPE_ENUM.Oracle));
                    if (Convert.ToInt32(strRet) > 0)
                    {
                        StationReturn.Status      = StationReturnStatusValue.Pass;
                        StationReturn.MessageCode = "MES00000004";
                        StationReturn.Data        = "";
                        //writeLog
                        T_R_MES_LOG   mesLog    = new T_R_MES_LOG(sfcdb, DB_TYPE_ENUM.Oracle);
                        string        id        = mesLog.GetNewID(this.BU, sfcdb);
                        Row_R_MES_LOG rowMESLog = (Row_R_MES_LOG)mesLog.NewRow();
                        rowMESLog.ID             = id;
                        rowMESLog.PROGRAM_NAME   = "Web";
                        rowMESLog.CLASS_NAME     = this.GetType().ToString();
                        rowMESLog.FUNCTION_NAME  = "DeleteWoRange";
                        rowMESLog.LOG_MESSAGE    = "Success";
                        rowMESLog.LOG_SQL        = r.GetDeleteString(DB_TYPE_ENUM.Oracle);
                        rowMESLog.EDIT_EMP       = this.LoginUser.EMP_NO;
                        rowMESLog.EDIT_TIME      = System.DateTime.Now;
                        sfcdb.ThrowSqlExeception = true;
                        sfcdb.ExecSQL(rowMESLog.GetInsertString(DB_TYPE_ENUM.Oracle));
                    }
                    else
                    {
                        StationReturn.Status      = StationReturnStatusValue.Fail;
                        StationReturn.MessageCode = "NotLatestData";
                    }
                }
                this.DBPools["SFCDB"].Return(sfcdb);
            }
            catch (Exception e)
            {
                this.DBPools["SFCDB"].Return(sfcdb);
                throw e;
            }
        }
Esempio n. 3
0
        public void ModifyWO(Newtonsoft.Json.Linq.JObject requestValue, Newtonsoft.Json.Linq.JObject Data, MESStationReturn StationReturn)
        {
            T_R_WO_REGION rWo   = null;
            OleExec       sfcdb = null;

            try
            {
                sfcdb = this.DBPools["SFCDB"].Borrow();
                rWo   = new T_R_WO_REGION(sfcdb, DB_TYPE_ENUM.Oracle);
                Row_R_WO_REGION r = (Row_R_WO_REGION)rWo.NewRow();
                r                 = (Row_R_WO_REGION)rWo.GetObjByID(Data["ID"].ToString(), sfcdb, DB_TYPE_ENUM.Oracle);
                r.WORKORDERNO     = (Data["WO"].ToString()).Trim();
                r.SKUNO           = (Data["SKUNO"].ToString()).Trim();
                r.QTY             = int.Parse(Data["QTY"].ToString());
                r.MIN_SYSSERIALNO = (Data["MIN_SN"].ToString()).Trim();
                //r.MAX_SYSSERIALNO = (Data["MAX_SYSSERIALNO" + "QTY"].ToString()).Trim();
                r.MAX_SYSSERIALNO = (Data["MAX_SN"].ToString()).Trim();
                r.EDIT_EMP        = LoginUser.EMP_NO;
                r.EDIT_TIME       = GetDBDateTime();
                string strRet = sfcdb.ExecSQL(r.GetUpdateString(DB_TYPE_ENUM.Oracle));
                if (Convert.ToInt32(strRet) > 0)
                {
                    StationReturn.MessageCode = "MES00000003";
                    StationReturn.Status      = StationReturnStatusValue.Pass;
                    StationReturn.Data        = "";
                }
                else
                {
                    StationReturn.MessageCode = "UpdateNoData";
                    StationReturn.Status      = StationReturnStatusValue.Fail;
                    StationReturn.Data        = "";
                }
                this.DBPools["SFCDB"].Return(sfcdb);
            }
            catch (Exception e)
            {
                this.DBPools["SFCDB"].Return(sfcdb);
                throw e;
            }
        }
Esempio n. 4
0
        public void ModifyWORange(Newtonsoft.Json.Linq.JObject requestValue, Newtonsoft.Json.Linq.JObject Data, MESStationReturn StationReturn)
        {
            T_R_WO_REGION rWo   = null;
            OleExec       sfcdb = null;

            try
            {
                sfcdb = this.DBPools["SFCDB"].Borrow();
                rWo   = new T_R_WO_REGION(sfcdb, DB_TYPE_ENUM.Oracle);
                Row_R_WO_REGION r         = (Row_R_WO_REGION)rWo.NewRow();
                T_R_WO_BASE     StWoBase  = new T_R_WO_BASE(sfcdb, DB_TYPE_ENUM.Oracle);
                T_C_SKU         t_c_sku   = new T_C_SKU(sfcdb, DB_TYPE_ENUM.Oracle);
                Row_R_WO_BASE   RowWoBase = null;
                RowWoBase = StWoBase.GetWo((Data["WORKORDERNO"].ToString()).Trim(), sfcdb);

                string minSN    = (Data["MIN_SN"].ToString()).Trim();
                string maxSN    = (Data["MAX_SN"].ToString()).Trim();
                string checkOut = "";
                if (!rWo.InputIsStringOrNum(minSN, out checkOut))
                {
                    StationReturn.MessageCode = "MES00000258";
                    StationReturn.Status      = StationReturnStatusValue.Fail;
                    StationReturn.Data        = "";
                    return;
                }
                if (!rWo.InputIsStringOrNum(maxSN, out checkOut))
                {
                    StationReturn.MessageCode = "MES00000258";
                    StationReturn.Status      = StationReturnStatusValue.Fail;
                    StationReturn.Data        = "";
                    return;
                }
                C_SKU objectSku = t_c_sku.GetSku(RowWoBase.SKUNO, sfcdb, DB_TYPE_ENUM.Oracle).GetDataObject();
                if (!rWo.InputIsMatchSkuRule(minSN, objectSku))
                {
                    StationReturn.MessageCode = "MES00000259";
                    StationReturn.Status      = StationReturnStatusValue.Fail;
                    StationReturn.Data        = "";
                    return;
                }
                if (!rWo.InputIsMatchSkuRule(maxSN, objectSku))
                {
                    StationReturn.MessageCode = "MES00000259";
                    StationReturn.Status      = StationReturnStatusValue.Fail;
                    StationReturn.Data        = "";
                    return;
                }

                r             = (Row_R_WO_REGION)rWo.GetObjByID(Data["ID"].ToString(), sfcdb, DB_TYPE_ENUM.Oracle);
                r.ID          = (Data["ID"].ToString()).Trim();
                r.WORKORDERNO = (Data["WORKORDERNO"].ToString()).Trim();
                r.SKUNO       = RowWoBase.SKUNO;
                r.QTY         = RowWoBase.WORKORDER_QTY;
                //r.SKUNO = (Data["SKUNO"].ToString()).Trim();
                //r.QTY = int.Parse(Data["QTY"].ToString());
                r.MIN_SN    = minSN;
                r.MAX_SN    = maxSN;
                r.EDIT_EMP  = LoginUser.EMP_NO;
                r.EDIT_TIME = GetDBDateTime();
                string strRet = sfcdb.ExecSQL(r.GetUpdateString(DB_TYPE_ENUM.Oracle));
                if (Convert.ToInt32(strRet) > 0)
                {
                    StationReturn.MessageCode = "MES00000003";
                    StationReturn.Status      = StationReturnStatusValue.Pass;
                    StationReturn.Data        = "";
                }
                else
                {
                    StationReturn.MessageCode = "MES00000036";
                    StationReturn.Status      = StationReturnStatusValue.Fail;
                    StationReturn.Data        = "";
                }
                this.DBPools["SFCDB"].Return(sfcdb);
            }
            catch (Exception e)
            {
                this.DBPools["SFCDB"].Return(sfcdb);
                throw e;
            }
        }