Пример #1
0
        public void AddWO(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.NewRow();
                r.ID              = wo.GetNewID(BU, sfcdb, DBTYPE);
                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 = r.MIN_SYSSERIALNO;
                r.MAX_SYSSERIALNO = (Data["MAX_SN"].ToString()).Trim();
                r.EDIT_EMP        = LoginUser.EMP_NO;
                r.EDIT_TIME       = GetDBDateTime();
                string strRet = sfcdb.ExecSQL(r.GetInsertString(DB_TYPE_ENUM.Oracle));
                if (Convert.ToInt32(strRet) > 0)
                {
                    StationReturn.Status      = StationReturnStatusValue.Pass;
                    StationReturn.MessageCode = "MES00000002";
                    StationReturn.Data        = strRet;
                }
                else
                {
                    StationReturn.Status      = StationReturnStatusValue.Fail;
                    StationReturn.MessageCode = "UpdateNoData";
                    StationReturn.Data        = "";
                }
                this.DBPools["SFCDB"].Return(sfcdb);
            }
            catch (Exception e)
            {
                this.DBPools["SFCDB"].Return(sfcdb);
                throw e;
            }
        }
Пример #2
0
        public void AddWORange(Newtonsoft.Json.Linq.JObject requestValue, Newtonsoft.Json.Linq.JObject Data, MESStationReturn StationReturn)
        {
            OleExec sfcdb = null;

            try
            {
                sfcdb = this.DBPools["SFCDB"].Borrow();
                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);
                T_R_WO_REGION wo       = new T_R_WO_REGION(sfcdb, DB_TYPE_ENUM.Oracle);
                string        minSN    = (Data["MIN_SN"].ToString()).Trim();
                string        maxSN    = (Data["MAX_SN"].ToString()).Trim();
                string        checkOut = "";

                if (!wo.InputIsStringOrNum(minSN, out checkOut))
                {
                    StationReturn.MessageCode = "MES00000258";
                    StationReturn.Status      = StationReturnStatusValue.Fail;
                    StationReturn.Data        = "";
                    return;
                }
                if (!wo.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 (!wo.InputIsMatchSkuRule(minSN, objectSku))
                {
                    StationReturn.MessageCode = "MES00000259";
                    StationReturn.Status      = StationReturnStatusValue.Fail;
                    StationReturn.Data        = "";
                    return;
                }
                if (!wo.InputIsMatchSkuRule(maxSN, objectSku))
                {
                    StationReturn.MessageCode = "MES00000259";
                    StationReturn.Status      = StationReturnStatusValue.Fail;
                    StationReturn.Data        = "";
                    return;
                }

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