예제 #1
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;
            }
        }
예제 #2
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;
            }
        }