Beispiel #1
0
        public void AddReplaceKpWithSku(Newtonsoft.Json.Linq.JObject requestValue, Newtonsoft.Json.Linq.JObject Data, MESStationReturn StationReturn)
        {
            string         Sku = Data["SKUNO"].ToString().Trim(), PartNo = Data["PARTNO"].ToString().Trim(), ReplacePartno = Data["REPLACEPARTNO"].ToString().Trim();
            OleExec        oleDB      = null;
            T_C_KP_Replace cKpReplace = null;
            T_C_SKU        cSku       = null;

            try
            {
                oleDB      = this.DBPools["SFCDB"].Borrow();
                cKpReplace = new T_C_KP_Replace(oleDB, DBTYPE);
                cSku       = new T_C_SKU(oleDB, DBTYPE);
                if (!cSku.SkuIsExist(Sku, oleDB))
                {
                    StationReturn.Status      = StationReturnStatusValue.Fail;
                    StationReturn.MessageCode = "MES00000244";
                    StationReturn.MessagePara = new List <object>()
                    {
                        Sku
                    };
                }
                else if (cKpReplace.IsExists(oleDB, Sku, PartNo, ReplacePartno))
                {
                    StationReturn.Status      = StationReturnStatusValue.Fail;
                    StationReturn.MessageCode = "MES00000005";
                    StationReturn.Data        = "";
                }
                else
                {
                    Row_C_KP_Replace rowCKpReplace = (Row_C_KP_Replace)cKpReplace.NewRow();
                    rowCKpReplace.ID            = cKpReplace.GetNewID(this.BU, oleDB, DBTYPE);
                    rowCKpReplace.SKUNO         = Sku;
                    rowCKpReplace.PARTNO        = PartNo;
                    rowCKpReplace.REPLACEPARTNO = ReplacePartno;
                    rowCKpReplace.EDIT_EMP      = this.LoginUser.EMP_NO;
                    rowCKpReplace.EDIT_TIME     = GetDBDateTime();;
                    oleDB.ThrowSqlExeception    = true;
                    oleDB.ExecSQL(rowCKpReplace.GetInsertString(DBTYPE));
                    StationReturn.Status      = StationReturnStatusValue.Pass;
                    StationReturn.MessageCode = "MES00000002";
                    StationReturn.Data        = "";
                }
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                this.DBPools["SFCDB"].Return(oleDB);
            }
        }
Beispiel #2
0
        public void UpdateReplaceKpWithSku(Newtonsoft.Json.Linq.JObject requestValue, Newtonsoft.Json.Linq.JObject Data, MESStationReturn StationReturn)
        {
            string id                 = Data["ID"].ToString().Trim(),
                   sku                = Data["SKUNO"].ToString().Trim(),
                   partNo             = Data["PARTNO"].ToString().Trim(),
                   replacePartno      = Data["REPLACEPARTNO"].ToString().Trim();
            OleExec        oleDB      = null;
            T_C_KP_Replace cKpReplace = null;

            try
            {
                oleDB      = this.DBPools["SFCDB"].Borrow();
                cKpReplace = new T_C_KP_Replace(oleDB, DBTYPE);
                Row_C_KP_Replace rowCKpReplace = (Row_C_KP_Replace)cKpReplace.GetObjByID(id, oleDB, DBTYPE);
                if (cKpReplace.IsExists(oleDB, sku, partNo, replacePartno))
                {
                    StationReturn.Status      = StationReturnStatusValue.Fail;
                    StationReturn.MessageCode = "MES00000005";
                    StationReturn.Data        = "";
                }
                else if (rowCKpReplace != null)
                {
                    rowCKpReplace.SKUNO         = sku;
                    rowCKpReplace.PARTNO        = partNo;
                    rowCKpReplace.REPLACEPARTNO = replacePartno;
                    rowCKpReplace.EDIT_EMP      = this.LoginUser.EMP_NO;
                    rowCKpReplace.EDIT_TIME     = GetDBDateTime();
                    oleDB.ThrowSqlExeception    = true;
                    oleDB.ExecSQL(rowCKpReplace.GetUpdateString(DBTYPE));
                    StationReturn.Status      = StationReturnStatusValue.Pass;
                    StationReturn.MessageCode = "MES00000004";
                }
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                oleDB.ThrowSqlExeception = false;
                this.DBPools["SFCDB"].Return(oleDB);
            }
        }