Пример #1
0
        public void AddMpnWithSku(Newtonsoft.Json.Linq.JObject requestValue, Newtonsoft.Json.Linq.JObject Data, MESStationReturn StationReturn)
        {
            string      Sku = Data["SKUNO"].ToString().Trim(), PartNo = Data["PARTNO"].ToString().Trim(), Mpn = Data["MPN"].ToString().Trim();
            OleExec     oleDB   = null;
            T_C_SKU_MPN cSkuMpn = null;
            T_C_SKU     cSku    = null;

            try
            {
                oleDB   = this.DBPools["SFCDB"].Borrow();
                cSkuMpn = new T_C_SKU_MPN(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 (cSkuMpn.IsExists(oleDB, Sku, PartNo, Mpn))
                {
                    StationReturn.Status      = StationReturnStatusValue.Fail;
                    StationReturn.MessageCode = "MES00000005";
                    StationReturn.Data        = "";
                }
                else
                {
                    Row_C_SKU_MPN rowCSkuMpn = (Row_C_SKU_MPN)cSkuMpn.NewRow();
                    rowCSkuMpn.ID            = cSkuMpn.GetNewID(this.BU, oleDB, DBTYPE);
                    rowCSkuMpn.SKUNO         = Sku;
                    rowCSkuMpn.PARTNO        = PartNo;
                    rowCSkuMpn.MPN           = Mpn;
                    rowCSkuMpn.EDIT_EMP      = this.LoginUser.EMP_NO;
                    rowCSkuMpn.EDIT_TIME     = GetDBDateTime();;
                    oleDB.ThrowSqlExeception = true;
                    oleDB.ExecSQL(rowCSkuMpn.GetInsertString(DBTYPE));
                    StationReturn.Status      = StationReturnStatusValue.Pass;
                    StationReturn.MessageCode = "MES00000002";
                    StationReturn.Data        = "";
                }
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                this.DBPools["SFCDB"].Return(oleDB);
            }
        }
Пример #2
0
        public void UpdateMpnWithSku(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(),
                   mpn          = Data["MPN"].ToString().Trim();
            OleExec     oleDB   = null;
            T_C_SKU_MPN cSkuMpn = null;

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