Ejemplo n.º 1
0
    public static ALOModel.ALOCommon.PERIODWithChanSale GetPeriodWithSalesItem(ALOModel.ALOCommon.PERIODWithChanSale PERIODWithChanSaleObject)
    {
        try
        {
            ALOModel.QueryALOCommon PeriodProc = new ALOModel.QueryALOCommon(ConnectionDB);

            #region 輸入變數

            ArrayList ParameterList = new ArrayList();//20091113

            ParameterList.Clear();
            //品號
            ParameterList.Add(PERIODWithChanSaleObject.Item);
            //期別
            ParameterList.Add(PERIODWithChanSaleObject.Period);
            //通路
            ParameterList.Add(PERIODWithChanSaleObject.ChanNO);

            #endregion

            DataTable Dt = PeriodProc.QueryItemPeriodChanSalesInfo(ParameterList);

            if (Dt.Rows.Count == 0)
            {
                PERIODWithChanSaleObject.NoDataErrorMsg = "查無銷售實績,不可做為參考品項!";
            }
            else
            {
                //進貨
                PERIODWithChanSaleObject.AcceptQty = Dt.Rows[0]["ACCEPT_QTY"].ToString();
                //退貨
                PERIODWithChanSaleObject.BackWardQty = Dt.Rows[0]["BACKWARD_QTY"].ToString();
                //實績
                int iRealSale = int.Parse(PERIODWithChanSaleObject.AcceptQty) -
                                int.Parse(PERIODWithChanSaleObject.BackWardQty);

                PERIODWithChanSaleObject.RealSale = iRealSale.ToString();
                //實銷率
                double iRealSalePercent = double.Parse(PERIODWithChanSaleObject.RealSale) /
                                          double.Parse(PERIODWithChanSaleObject.AcceptQty) * 100;

                PERIODWithChanSaleObject.RealSalePercent = Math.Round(iRealSalePercent, 0).ToString();
                //錯誤訊息
                PERIODWithChanSaleObject.NoDataErrorMsg = "";
            }

            return PERIODWithChanSaleObject;
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
Ejemplo n.º 2
0
    public static ALOModel.ALOCommon.PERIODWithSTOCK GetPeriodWithStock(ALOModel.ALOCommon.PERIODWithSTOCK PeriodStockObject,
                                                                        string ProcessUID,
                                                                        string RootNo,
                                                                        string StAcceptDate
                                                                        )
    {

        try
        {

            #region 期別處理

            ALOModel.MaintainDisRecord PeriodProc = new ALOModel.MaintainDisRecord(ConnectionDB);
            string ErrorMsg = "";
            string AlertMsg = "";

            #region 輸入變數
            ArrayList ParameterList = new ArrayList();

            ParameterList.Clear();
            //品號
            ParameterList.Add(PeriodStockObject.Item);
            //期別
            ParameterList.Add(PeriodStockObject.Period);
            //門市進貨日 2009-07-02 cyhsu add
            ParameterList.Add(StAcceptDate);
            #endregion

            Hashtable ht = PeriodProc.CheckItemPeriodDisStateInfo(ParameterList, ref ErrorMsg, ref AlertMsg);

            if (ErrorMsg == "")//無錯誤
            {
                if (ht != null)
                {
                    //期別存在判斷
                    PeriodStockObject.PeriodExist = ht["PERIODEXIST"].ToString();
                    //配本日期
                    PeriodStockObject.DisDate = ht["DIS_DATE"].ToString();
                    //前一期別
                    PeriodStockObject.Period1 = ht["P_B1"].ToString();
                    //前二期別
                    PeriodStockObject.Period2 = ht["P_B2"].ToString();
                    //前三期別
                    PeriodStockObject.Period3 = ht["P_B3"].ToString();
                    //前四期別
                    PeriodStockObject.Period4 = ht["P_B4"].ToString();
                    //前五期別
                    PeriodStockObject.Period5 = ht["P_B5"].ToString();
                    //前六期別
                    PeriodStockObject.Period6 = ht["P_B6"].ToString();
                }
                //期別錯誤訊息
                PeriodStockObject.PeriodErrorMsg = ErrorMsg;
                //期別提示訊息
                PeriodStockObject.PeriodAlertMsg = AlertMsg;
            }

            #endregion

            #region 庫存處理

            if (ErrorMsg == "") //無錯誤
            {
                CRMModel.QueryCRMCommon StockProc = new CRMModel.QueryCRMCommon(ConnectionDB);

                #region 輸入變數

                ParameterList.Clear();
                //品號
                ParameterList.Add(PeriodStockObject.Item);
                //期別
                ParameterList.Add(PeriodStockObject.Period);
                //儲區類別(進貨)
                ParameterList.Add((int)PeriodStockLOCATEATTR.ToStockWithGoods);
                //使用者代碼            
                ParameterList.Add(ProcessUID);

                #endregion

                DataTable StockDt = StockProc.QueryItemPeriodStock(ParameterList);

                if (StockDt.Rows.Count > 0)
                {
                    //到貨數
                    PeriodStockObject.AcceptQTY = (StockDt.Rows[0]["ONHD_QTY"] == null) ? "0" : StockDt.Rows[0]["ONHD_QTY"].ToString();
                    //保留數
                    PeriodStockObject.ReserveQTY = (StockDt.Rows[0]["RESERVE_QTY"] == null) ? "0" : StockDt.Rows[0]["RESERVE_QTY"].ToString();
                    //實配數
                    PeriodStockObject.DISQTY = "0";
                    //預留數 = 到貨數 - 實配數 - 保留數 
                    int DISMDCQTY = int.Parse(PeriodStockObject.AcceptQTY) -
                                    int.Parse(PeriodStockObject.DISQTY) -
                                    int.Parse(PeriodStockObject.ReserveQTY);

                    PeriodStockObject.DISMDCQTY = DISMDCQTY.ToString();
                }
                else
                {
                    //到貨數
                    PeriodStockObject.AcceptQTY = "0";
                    //保留數
                    PeriodStockObject.ReserveQTY = "0";
                    //實配數
                    PeriodStockObject.DISQTY = "0";
                    //預留數 = 到貨數 - 實配數 - 保留數 
                    PeriodStockObject.DISMDCQTY = "0";
                }
            }

            #endregion

            #region 採購數處理

            if (ErrorMsg == "") //無錯誤
            {
                ALOModel.QueryALOCommon OrderQTYProc = new ALOModel.QueryALOCommon(ConnectionDB);

                #region 輸入變數

                ParameterList.Clear();
                //品號
                ParameterList.Add(PeriodStockObject.Item);
                //期別
                ParameterList.Add(PeriodStockObject.Period);
                //群分類代號
                ParameterList.Add(RootNo);

                #endregion

                PeriodStockObject.DISISUQTY = OrderQTYProc.QueryPurchaseQty(ParameterList).ToString();

            }

            #endregion

            return PeriodStockObject;
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
Ejemplo n.º 3
0
    public static ALOModel.ALOCommon.StoreChainInfo GetStoreChainInfo(ALOModel.ALOCommon.StoreChainInfo StoreChainObject)
    {
        try
        {
            STMModel.MaintainStoreChain MSC = new STMModel.MaintainStoreChain(ConnectionDB);

            #region 輸入變數
            ArrayList ParameterList = new ArrayList();

            ParameterList.Clear();
            //通路代號
            ParameterList.Add(StoreChainObject.StoreChainID);

            #endregion

            DataTable Dt = MSC.QuerySwitch(PIC.VDS2G.GFM.STM.STMCommon.QueryType.CODE,
                                           ParameterList
                                           );

            if (Dt.Rows.Count > 0)
            {
                StoreChainObject.StoreChainGroup = StoreChainObject.StoreChainID.Substring(0, 1);
                StoreChainObject.StoreChainName = Dt.Rows[0]["NAME"].ToString();
            }
            else
            {
                StoreChainObject.StoreChainGroup = "";
                StoreChainObject.StoreChainName = "查無資料";
            }

            return StoreChainObject;
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
Ejemplo n.º 4
0
    public static ALOModel.ALOCommon.SKUITEM GetITEMInfo(ALOModel.ALOCommon.SKUITEM ItemObject,
                                                         string StAcceptDate)
    {
        try
        {
            ALOModel.QueryALOCommon SKUProc = new ALOModel.QueryALOCommon(ConnectionDB);

            #region 輸入變數
            ArrayList ParameterList = new ArrayList();

            ParameterList.Clear();
            //品號
            ParameterList.Add(ItemObject.Item);
            // 2009-10-08 cyhsu add 門市進貨日
            ParameterList.Add(StAcceptDate);

            #endregion

            DataTable Dt = SKUProc.QueryItemInfo2(ParameterList);

            if (Dt.Rows.Count > 0)
            {
                ItemObject.RootNo = Dt.Rows[0]["ROOT_NO"].ToString();
                ItemObject.PMA = Dt.Rows[0]["PMA"].ToString();
                ItemObject.PatternNo = Dt.Rows[0]["PATTERN_NO"].ToString();
            }

            return ItemObject;

        }
        catch (Exception ex)
        {
            throw ex;
        }
    }