Пример #1
0
        /// <summary>
        /// OBA工站創建LOT,返回LOT信息
        /// </summary>
        /// <param name="user"></param>
        /// <param name="packNo"></param>
        /// <param name="DB"></param>
        public R_LOT_STATUS CreateLotByPackno(User user, string packNo, OleExec DB)
        {
            T_R_PACKING   tRPacking   = new T_R_PACKING(DB, this.DBType);
            Row_R_PACKING rowRPacking = tRPacking.GetRPackingByPackNo(DB, packNo);
            PalletBase    palletBase  = new PalletBase(rowRPacking);

            T_C_SKU        tCSku       = new T_C_SKU(DB, this.DBType);
            T_R_LOT_STATUS tRLotStatus = new T_R_LOT_STATUS(DB, this.DBType);
            T_C_AQLTYPE    tCAqlType   = new T_C_AQLTYPE(DB, this.DBType);
            T_R_LOT_PACK   tRLotPack   = new T_R_LOT_PACK(DB, this.DBType);
            T_C_SKU_AQL    tCSkuAql    = new T_C_SKU_AQL(DB, this.DBType);
            C_SKU_AQL      cSkuAql     = tCSkuAql.GetSkuAql(DB, rowRPacking.SKUNO);

            List <C_AQLTYPE> cAqlTypeList = tCAqlType.GetAqlTypeBySkunoAndLevel(rowRPacking.SKUNO, cSkuAql.DEFAULLEVEL, DB);

            if (cAqlTypeList.Count == 0)
            {
                throw new Exception(MESDataObject.MESReturnMessage.GetMESReturnMessage("MSGCODE20180625165842",
                                                                                       new string[] { }));
            }
            Row_C_SKU        rCSku         = tCSku.GetSku(rowRPacking.SKUNO, DB, this.DBType);
            Row_R_LOT_STATUS rowRLotStatus = (Row_R_LOT_STATUS)tRLotStatus.NewRow();

            rowRLotStatus.ID              = tRLotStatus.GetNewID(user.BU, DB, this.DBType);
            rowRLotStatus.LOT_NO          = SNMaker.SNmaker.GetNextSN("OBALOT", DB);
            rowRLotStatus.SKUNO           = rowRPacking.SKUNO;
            rowRLotStatus.AQL_TYPE        = cSkuAql.AQLTYPE;
            rowRLotStatus.LOT_QTY         = palletBase.GetSnCount(DB);
            rowRLotStatus.REJECT_QTY      = cAqlTypeList.Where(t => t.LOT_QTY > rowRLotStatus.LOT_QTY).OrderBy(t => t.LOT_QTY).Take(1).ToList <C_AQLTYPE>()[0].REJECT_QTY;
            rowRLotStatus.SAMPLE_QTY      = cAqlTypeList.Where(t => t.LOT_QTY > rowRLotStatus.LOT_QTY).OrderBy(t => t.LOT_QTY).Take(1).ToList <C_AQLTYPE>()[0].SAMPLE_QTY;
            rowRLotStatus.SAMPLE_QTY      = rowRLotStatus.SAMPLE_QTY > rowRLotStatus.LOT_QTY ? rowRLotStatus.LOT_QTY : rowRLotStatus.SAMPLE_QTY;
            rowRLotStatus.PASS_QTY        = 0;
            rowRLotStatus.FAIL_QTY        = 0;
            rowRLotStatus.CLOSED_FLAG     = "0";
            rowRLotStatus.LOT_STATUS_FLAG = "0";
            rowRLotStatus.SAMPLE_STATION  = "OBA";
            rowRLotStatus.AQL_LEVEL       = cSkuAql.DEFAULLEVEL;
            rowRLotStatus.LINE            = "";
            rowRLotStatus.EDIT_EMP        = user.EMP_NO;
            rowRLotStatus.EDIT_TIME       = tRPacking.GetDBDateTime(DB);

            Row_R_LOT_PACK rowRLotPack = (Row_R_LOT_PACK)tRLotPack.NewRow();

            rowRLotPack.ID        = tRLotPack.GetNewID(user.BU, DB, this.DBType);
            rowRLotPack.LOTNO     = rowRLotStatus.LOT_NO;
            rowRLotPack.PACKNO    = packNo;
            rowRLotPack.EDIT_EMP  = user.EMP_NO;
            rowRLotPack.EDIT_TIME = rowRLotStatus.EDIT_TIME;
            DB.ThrowSqlExeception = true;
            DB.ExecSQL(rowRLotStatus.GetInsertString(this.DBType));
            DB.ExecSQL(rowRLotPack.GetInsertString(this.DBType));
            DB.ThrowSqlExeception = false;
            return(rowRLotStatus.GetDataObject());
        }
Пример #2
0
        /// <summary>
        /// OBA工站InLot,返回LOT信息
        /// </summary>
        /// <param name="user"></param>
        /// <param name="packNo"></param>
        /// <param name="DB"></param>
        public R_LOT_STATUS ObaInLotByPackno(User user, R_LOT_STATUS rLotStatus, string packNo, string AqlLevel, OleExec DB)
        {
            T_R_PACKING   tRPacking   = new T_R_PACKING(DB, this.DBType);
            Row_R_PACKING rowRPacking = tRPacking.GetRPackingByPackNo(DB, packNo);
            PalletBase    palletBase  = new PalletBase(rowRPacking);

            T_R_LOT_STATUS tRLotStatus = new T_R_LOT_STATUS(DB, this.DBType);
            T_C_AQLTYPE    tCAqlType   = new T_C_AQLTYPE(DB, this.DBType);
            T_R_LOT_PACK   tRLotPack   = new T_R_LOT_PACK(DB, this.DBType);

            List <C_AQLTYPE> cAqlTypeList  = tCAqlType.GetAqlTypeBySkunoAndLevel(rowRPacking.SKUNO, AqlLevel, DB);
            Row_R_LOT_STATUS rowRLotStatus = (Row_R_LOT_STATUS)tRLotStatus.NewRow();

            rowRLotStatus.ID              = rLotStatus.ID;
            rowRLotStatus.LOT_NO          = rLotStatus.LOT_NO;
            rowRLotStatus.SKUNO           = rLotStatus.SKUNO;
            rowRLotStatus.AQL_TYPE        = rLotStatus.AQL_TYPE;
            rowRLotStatus.LOT_QTY         = rLotStatus.LOT_QTY + palletBase.GetSnCount(DB);
            rowRLotStatus.REJECT_QTY      = cAqlTypeList.Where(t => t.LOT_QTY > rowRLotStatus.LOT_QTY).OrderBy(t => t.LOT_QTY).Take(1).ToList <C_AQLTYPE>()[0].REJECT_QTY;
            rowRLotStatus.SAMPLE_QTY      = cAqlTypeList.Where(t => t.LOT_QTY > rowRLotStatus.LOT_QTY).OrderBy(t => t.LOT_QTY).Take(1).ToList <C_AQLTYPE>()[0].SAMPLE_QTY;
            rowRLotStatus.SAMPLE_QTY      = rowRLotStatus.SAMPLE_QTY > rowRLotStatus.LOT_QTY ? rowRLotStatus.LOT_QTY : rowRLotStatus.SAMPLE_QTY;
            rowRLotStatus.PASS_QTY        = rLotStatus.PASS_QTY;
            rowRLotStatus.FAIL_QTY        = rLotStatus.FAIL_QTY;
            rowRLotStatus.CLOSED_FLAG     = rLotStatus.CLOSED_FLAG;
            rowRLotStatus.LOT_STATUS_FLAG = rLotStatus.LOT_STATUS_FLAG;
            rowRLotStatus.SAMPLE_STATION  = rLotStatus.SAMPLE_STATION;
            rowRLotStatus.LINE            = rLotStatus.LINE;
            rowRLotStatus.AQL_LEVEL       = AqlLevel;
            rowRLotStatus.EDIT_EMP        = user.EMP_NO;
            rowRLotStatus.EDIT_TIME       = tRPacking.GetDBDateTime(DB);

            Row_R_LOT_PACK rowRLotPack = (Row_R_LOT_PACK)tRLotPack.NewRow();

            rowRLotPack.ID        = tRLotPack.GetNewID(user.BU, DB, this.DBType);
            rowRLotPack.LOTNO     = rowRLotStatus.LOT_NO;
            rowRLotPack.PACKNO    = packNo;
            rowRLotPack.EDIT_EMP  = user.EMP_NO;
            rowRLotPack.EDIT_TIME = rowRLotStatus.EDIT_TIME;
            DB.ThrowSqlExeception = true;
            DB.ExecSQL(rowRLotStatus.GetUpdateString(this.DBType) + ";" + rowRLotPack.GetInsertString(this.DBType));
            DB.ThrowSqlExeception = false;
            return(rowRLotStatus.GetDataObject());
        }