예제 #1
0
파일: BasketFlow.cs 프로젝트: SoftSuite/ABB
        private double UpdateProductBarcode(string UserID, BasketData bkData )
        {
            bool ret = true;
            ProductBarcodeDAL bDAL = new ProductBarcodeDAL();
            bDAL.GetDataByLOID(bkData.LOID, null);
            bDAL.ABBNAME = bkData.ABBNAME;
            bDAL.BARCODE = bkData.BARCODE;
            bDAL.UNIT = bkData.UNITBASKET;
            bDAL.COST = bkData.COST;
            bDAL.PRICE = bkData.PRICE;
            bDAL.ISVAT = bkData.ISVAT;
            bDAL.ISDISCOUNT = bkData.ISDISCOUNT;
            bDAL.ISREFUND = bkData.ISREFUND;
            bDAL.ACTIVE = bkData.ACTIVE;
            bDAL.STDPRICE = bkData.PRICE;
            bDAL.MULTIPLY = 1;

            ret = bDAL.UpdateCurrentData(UserID, null);
            if (ret == false)
            {
                _error = bDAL.ErrorMessage;
                return 0;
            }
            else
            {
                return bDAL.LOID;
            }
        }
예제 #2
0
        public static string GetLotNo(string userID, double productLOID, OracleTransaction zTrans)
        {
            bool LetClose = false;
            string code = "";
            OracleConnection zConn = null;
            if (zTrans == null)
            {
                LetClose = true;
                zConn = OracleDB.GetConnection();
                zTrans = zConn.BeginTransaction(IsolationLevel.ReadCommitted);
            }

            ProductBarcodeDAL _bDAL = new ProductBarcodeDAL();
            if (_bDAL.GetDataByLOID(productLOID, zTrans))
            {
                ProductMasterDAL _dal = new ProductMasterDAL();
                if (_dal.GetDataByLOID(_bDAL.PRODUCTMASTER, zTrans))
                {
                    if (_dal.YEAR == (DateTime.Now.Year + 543).ToString().Substring(2))
                    {
                        if (_dal.RUNNING == "9")
                        {
                            _dal.RUNNING = "1";
                            switch (_dal.LOTNO)
                            {
                                case "A": _dal.LOTNO = "B"; break;
                                case "B": _dal.LOTNO = "C"; break;
                                case "C": _dal.LOTNO = "D"; break;
                                case "D": _dal.LOTNO = "E"; break;
                                case "E": _dal.LOTNO = "F"; break;
                                case "F": _dal.LOTNO = "G"; break;
                                case "G": _dal.LOTNO = "H"; break;
                                case "H": _dal.LOTNO = "I"; break;
                                case "I": _dal.LOTNO = "J"; break;
                                case "J": _dal.LOTNO = "K"; break;
                                case "K": _dal.LOTNO = "L"; break;
                                case "L": _dal.LOTNO = "M"; break;
                                case "M": _dal.LOTNO = "N"; break;
                                case "N": _dal.LOTNO = "O"; break;
                                case "O": _dal.LOTNO = "P"; break;
                                case "P": _dal.LOTNO = "Q"; break;
                                case "Q": _dal.LOTNO = "R"; break;
                                case "R": _dal.LOTNO = "S"; break;
                                case "S": _dal.LOTNO = "T"; break;
                                case "T": _dal.LOTNO = "U"; break;
                                case "U": _dal.LOTNO = "V"; break;
                                case "V": _dal.LOTNO = "W"; break;
                                case "W": _dal.LOTNO = "X"; break;
                                case "X": _dal.LOTNO = "Y"; break;
                                case "Y": _dal.LOTNO = "Z"; break;
                                case "Z": _dal.LOTNO = "A"; break;
                                default: _dal.LOTNO = "A"; break;
                            }
                        }
                        else
                        {
                            _dal.RUNNING = (Convert.ToInt32(_dal.RUNNING == "" ? "0" : _dal.RUNNING) + 1).ToString().Trim();
                        }
                    }
                    else
                    {
                        _dal.LOTNO = "A";
                        _dal.RUNNING = "1";
                        _dal.YEAR = (DateTime.Now.Year + 543).ToString().Substring(2);
                    }

                    if (!_dal.UpdateCurrentData(userID, zTrans))
                    {
                        if (LetClose)
                        {
                            zTrans.Commit();
                            zConn.Close();
                        }
                        throw new ApplicationException(_dal.ErrorMessage);
                    }
                    else
                    {
                        code = (_dal.CODE.Length > 3 ? _dal.CODE.Substring(0, 3) : _dal.CODE) + " " + _dal.LOTNO + _dal.RUNNING + _dal.YEAR;
                    }
                }
            }


            if (LetClose)
            {
                zTrans.Commit();
                zConn.Close();
            }

            return code.ToUpper();
        }
예제 #3
0
파일: BasketFlow.cs 프로젝트: SoftSuite/ABB
        private double InsertProductBarcode(string UserID, BasketData bkData, double ProductMaster)
        {
             bool ret = true;
             ProductBarcodeDAL bDAL = new ProductBarcodeDAL();
             bDAL.PRODUCTMASTER = ProductMaster;
             bDAL.ABBNAME = bkData.ABBNAME;
             bDAL.BARCODE = bkData.BARCODE;
             bDAL.UNIT = bkData.UNITBASKET;
             bDAL.COST = bkData.COST;
             bDAL.PRICE = bkData.PRICE;
             bDAL.ISVAT = bkData.ISVAT;
             bDAL.ISDISCOUNT = bkData.ISDISCOUNT;
             bDAL.ISREFUND = bkData.ISREFUND;
             bDAL.ACTIVE = bkData.ACTIVE;
             bDAL.STDPRICE = bkData.PRICE;
             bDAL.MULTIPLY = 1;
             bDAL.ISEDIT = "Y";
             bDAL.ISDEFAULT = "Y";
             ret = bDAL.InsertCurrentData(UserID, null);
             if (ret == false)
             {                   
                 string sqlDelete = "DELETE FROM PRODUCTMASTER WHERE LOID = " + ProductMaster;
                 OracleDB.ExecNonQueryCmd(sqlDelete);

                 _error = bDAL.ErrorMessage;
                 return 0;
             }
             else
             {
               return bDAL.LOID;
             } 
        }
예제 #4
0
        public bool UpdateItemData(string userID, ProductSearchData data)
        {
            bool ret = true;
            
            OracleDBObj obj = new OracleDBObj();
            obj.CreateConnection();
            obj.CreateTransaction();
            try
            {
                ProductBarcodeDAL itemDAL = new ProductBarcodeDAL();
                ProductBarcodeDAL itemDAL2 = new ProductBarcodeDAL();
                ProductBarcodeDAL itemDAL3 = new ProductBarcodeDAL();
                //itemDAL.DeleteDataByProductMasterExceptDefault(data.LOID, obj.zTrans);
                itemDAL.UpdateActiveByProductMasterExceptDefault(data.LOID, "0", userID, obj.zTrans);
                for (Int16 i = 1; i < data.ITEM.Count; ++i)
                {
                    ProductBarcodeData item = (ProductBarcodeData)data.ITEM[i];
                    itemDAL.OnDB = false;
                    itemDAL.ACTIVE = "";
                    itemDAL.GetDataByBARCODE(item.BARCODE, obj.zTrans);
                    if (itemDAL.ACTIVE != Constz.ActiveStatus.Active)
                    {
                        itemDAL2.GetDataByABBNAME(item.ABBNAME.Trim(), obj.zTrans);
                        if (itemDAL2.ACTIVE == Constz.ActiveStatus.Active)
                        {
                            throw new ApplicationException("ª×èÍÂèÍ " + item.ABBNAME + " ¹ÕéÁÕáÅéÇ");
                        }
                        itemDAL3.GetDataByABBUNIT(item.LOID,item.UNIT, obj.zTrans);
                        if (itemDAL3.ACTIVE == Constz.ActiveStatus.Active)
                        {
                            throw new ApplicationException("ª×èÍ˹èÇ«éÓ");
                        }

                        itemDAL.BARCODE = item.BARCODE;
                        itemDAL.PRODUCTMASTER = data.LOID;
                        itemDAL.ABBNAME = item.ABBNAME;
                        itemDAL.UNIT = item.UNIT;
                        itemDAL.COST = item.COST;
                        itemDAL.PRICE = item.PRICE;
                        itemDAL.STDPRICE = item.STDPRICE;
                        itemDAL.ISDISCOUNT = "0";
                        itemDAL.ISVAT = "1";
                        itemDAL.PACKSIZE = item.PACKSIZE;
                        itemDAL.PACKSIZEUNIT = item.UNITPACK;
                        itemDAL.ISEDIT = "Y";
                        itemDAL.ISREFUND = "N";
                        itemDAL.ACTIVE = Convert.ToString(item.ACTIVE);
                        itemDAL.MULTIPLY = item.MULTIPLY;
                        itemDAL.ISDEFAULT = "N";

                        if (itemDAL.OnDB)
                            ret = itemDAL.UpdateCurrentData(userID, obj.zTrans);
                        else
                            ret = itemDAL.InsertCurrentData(userID, obj.zTrans);

                        if (!ret) throw new ApplicationException(itemDAL.ErrorMessage);
                    }
                    else
                    {
                        throw new ApplicationException("ºÒÃìâ¤é´ " + item.BARCODE + " ¹ÕéÁÕáÅéÇ");
                    }
                }
                _LOID = data.LOID;
                obj.zTrans.Commit();
                obj.CloseConnection();
            }
            catch (Exception ex)
            {
                obj.zTrans.Rollback();
                obj.CloseConnection();
                ret = false;
                _error = ex.Message;
            }

            return ret;
        }