Ejemplo n.º 1
0
        public int GetNextSequenceOfUpperItem(NZString UPPER_ITEM_CD)
        {
            BOMDAO dao    = new BOMDAO(CommonLib.Common.CurrentDatabase);
            int    maxSeq = dao.LoadMaxSequenceOfUpperItem(null, UPPER_ITEM_CD);

            return(maxSeq + 1);
        }
Ejemplo n.º 2
0
        public int AddNew(ItemDTO dtoItem, List <ItemProcessDTO> NewProcess, List <BOMDTO> NewComponent, List <ItemMachineDTO> NewItemMachine)
        {
            ItemValidator validator = new ItemValidator();

            validator.ValidateBeforeSaveNew(dtoItem, null);

            Database db = CommonLib.Common.CurrentDatabase;

            db.KeepConnection = true;
            db.BeginTransaction();
            try
            {
                ItemDAO daoItem = new ItemDAO(CommonLib.Common.CurrentDatabase);
                daoItem.AddNew(null, dtoItem);

                ItemProcessDAO daoItemProcess = new ItemProcessDAO(CommonLib.Common.CurrentDatabase);
                BOMDAO         daoBOM         = new BOMDAO(CommonLib.Common.CurrentDatabase);
                ItemMachineDAO daoItemMachine = new ItemMachineDAO(CommonLib.Common.CurrentDatabase);

                foreach (ItemProcessDTO dto in NewProcess)
                {
                    daoItemProcess.AddNew(null, dto);
                }

                //Component
                foreach (BOMDTO dto in NewComponent)
                {
                    daoBOM.AddNew(null, dto);
                }

                //Item Machine
                foreach (ItemMachineDTO dto in NewItemMachine)
                {
                    daoItemMachine.AddNew(null, dto);
                }

                db.Commit();
                return(1);
            }
            catch (Exception err)
            {
                db.Rollback();
                throw err;
            }
            finally
            {
                if (db.DBConnectionState == ConnectionState.Open)
                {
                    db.Close();
                }
            }
        }
Ejemplo n.º 3
0
        public List <ItemComponentDTO> LoadItemComponentList(NZString ItemCD)
        {
            BOMDAO dao = new BOMDAO(CommonLib.Common.CurrentDatabase);

            return(dao.LoadComponentListByItemCD(null, ItemCD));
        }
Ejemplo n.º 4
0
        public int UpdateWithoutPK(ItemDTO dtoItem, List <ItemProcessDTO> NewProcess, List <ItemProcessDTO> EditProcess, List <ItemProcessDTO> DeleteProcess,
                                   List <BOMDTO> NewComponent, List <BOMDTO> EditComponent, List <BOMDTO> DeleteComponent, List <ItemMachineDTO> ItemMachine)
        {
            ItemValidator validator = new ItemValidator();

            validator.ValidateBeforeSaveUpdate(dtoItem, null);

            Database db = CommonLib.Common.CurrentDatabase;

            db.KeepConnection = true;
            db.BeginTransaction();
            try
            {
                ItemDAO daoItem = new ItemDAO(CommonLib.Common.CurrentDatabase);
                daoItem.UpdateWithoutPK(null, dtoItem);

                ItemProcessDAO daoItemProcess = new ItemProcessDAO(CommonLib.Common.CurrentDatabase);
                BOMDAO         daoBOM         = new BOMDAO(CommonLib.Common.CurrentDatabase);
                ItemMachineDAO daoItemMachine = new ItemMachineDAO(CommonLib.Common.CurrentDatabase);

                foreach (ItemProcessDTO dto in DeleteProcess)
                {
                    daoItemProcess.Delete(null, dto.ITEM_CD, dto.ITEM_SEQ);
                }
                foreach (ItemProcessDTO dto in NewProcess)
                {
                    daoItemProcess.AddNew(null, dto);
                }

                foreach (ItemProcessDTO dto in EditProcess)
                {
                    daoItemProcess.UpdateWithoutPK(null, dto);
                }



                //Component
                foreach (BOMDTO dto in DeleteComponent)
                {
                    daoBOM.Delete(null, dto.UPPER_ITEM_CD, dto.LOWER_ITEM_CD, dto.ITEM_SEQ);
                }
                foreach (BOMDTO dto in NewComponent)
                {
                    daoBOM.AddNew(null, dto);
                }
                foreach (BOMDTO dto in EditComponent)
                {
                    daoBOM.UpdateWithoutPK(null, dto);
                }


                //Item Machine
                daoItemMachine.DelteItemMachineByItemCD(dtoItem.ITEM_CD);
                foreach (ItemMachineDTO dto in ItemMachine)
                {
                    daoItemMachine.AddNew(null, dto);
                }

                db.Commit();
                return(1);
            }
            catch (Exception err)
            {
                db.Rollback();
                throw err;
            }
            finally
            {
                if (db.DBConnectionState == ConnectionState.Open)
                {
                    db.Close();
                }
            }
        }
Ejemplo n.º 5
0
        public int UpdateWithPK(BOMDTO dto, NZString oldUPPER_ITEM_CD, NZString oldLOWER_ITEM_CD, NZInt oldITEM_SEQ)
        {
            BOMDAO dao = new BOMDAO(CommonLib.Common.CurrentDatabase);

            return(dao.UpdateWithPK(null, dto, oldUPPER_ITEM_CD, oldLOWER_ITEM_CD, oldITEM_SEQ));
        }
Ejemplo n.º 6
0
        public int AddNew(BOMDTO dto)
        {
            BOMDAO dao = new BOMDAO(CommonLib.Common.CurrentDatabase);

            return(dao.AddNew(null, dto));
        }
Ejemplo n.º 7
0
        public ItemProcessDTO LoadLocationandMRPFLag(string strItemCode)
        {
            BOMDAO dao = new BOMDAO(CommonLib.Common.CurrentDatabase);

            return(dao.LoadLocationandMRPFlag(null, strItemCode));
        }
Ejemplo n.º 8
0
        public DataTable LoadBOMList()
        {
            BOMDAO dao = new BOMDAO(CommonLib.Common.CurrentDatabase);

            return(dao.LoadBOMList());
        }
Ejemplo n.º 9
0
        public List <BOMSetupViewDTO> LoadBOMByKey(NZString UPPER_ITEM_CD, NZString LOWER_ITEM_CD)
        {
            BOMDAO dao = new BOMDAO(CommonLib.Common.CurrentDatabase);

            return(dao.LoadBOMSetup(null, UPPER_ITEM_CD, LOWER_ITEM_CD));
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Load Child Part With Level Fix
        /// </summary>
        /// <param name="ITEM_CD"></param>
        /// <param name="Level"></param>
        /// <returns></returns>
        public List <BOMSetupViewDTO> LoadChildPartWithLevelFix(NZString ITEM_CD, int Level)
        {
            BOMDAO dao = new BOMDAO(CommonLib.Common.CurrentDatabase);

            return(dao.LoadChildPartWithLevelFix(null, ITEM_CD, Level));
        }
Ejemplo n.º 11
0
        public List <BOMSetupDTO> LoadBOMImplosion(NZString LOWER_ITEM_CD)
        {
            BOMDAO dao = new BOMDAO(CommonLib.Common.CurrentDatabase);

            return(dao.LoadBOMImplosion(null, LOWER_ITEM_CD));
        }
Ejemplo n.º 12
0
        public List <ComponentUsageDTO> LoadComponentUsage(NZString strMasterNo, NZDecimal decQty)
        {
            BOMDAO dao = new BOMDAO(CommonLib.Common.CurrentDatabase);

            return(dao.LoadComponentUsage(null, strMasterNo, decQty));
        }
Ejemplo n.º 13
0
        public string LoadMRPFLag(NZString strMRPFLag)
        {
            BOMDAO dao = new BOMDAO(CommonLib.Common.CurrentDatabase);

            return(dao.LoadMRPFLag(null, strMRPFLag));
        }
Ejemplo n.º 14
0
        public NZString FindMRPFlag(NZString strMRPFlag)
        {
            BOMDAO dao = new BOMDAO(CommonLib.Common.CurrentDatabase);

            return(dao.FindMRPFlag(null, strMRPFlag));
        }
Ejemplo n.º 15
0
        public int Delete(BOMDTO dto)
        {
            BOMDAO dao = new BOMDAO(CommonLib.Common.CurrentDatabase);

            return(dao.Delete(null, dto.UPPER_ITEM_CD, dto.LOWER_ITEM_CD, dto.ITEM_SEQ));
        }