Exemplo n.º 1
0
        public int UpdatePointDelay(SalePointDelayInfo oParam)
        {
            string sql = @"UPDATE Sale_PointDelay SET
                           Status=@Status
                           WHERE SysNo=@SysNo";
            SqlCommand cmd = new SqlCommand(sql);

            SqlParameter paramSysNo = new SqlParameter("@SysNo", SqlDbType.Int,4);
            SqlParameter paramStatus = new SqlParameter("@Status", SqlDbType.Int,4);

            if ( oParam.SysNo != AppConst.IntNull)
                paramSysNo.Value = oParam.SysNo;
            else
                paramSysNo.Value = System.DBNull.Value;
            if ( oParam.Status != AppConst.IntNull)
                paramStatus.Value = oParam.Status;
            else
                paramStatus.Value = System.DBNull.Value;

            cmd.Parameters.Add(paramSysNo);
            cmd.Parameters.Add(paramStatus);

            return SqlHelper.ExecuteNonQuery(cmd);
        }
Exemplo n.º 2
0
        public void OutStock(SOInfo soInfo)
        {
            TransactionOptions options = new TransactionOptions();
            options.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted;
            options.Timeout = TransactionManager.DefaultTimeout;

            using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, options))
            {
                ////���¶���״̬
                //1 �鿴������ǰ״̬
                //2 ���ø���ֵ������status
                int currentStatus = this.getCurrentSOStatus(soInfo.SysNo);

                if (currentStatus != (int)AppEnum.SOStatus.WaitingOutStock)
                    throw new BizException("outstock so: the current status is not WaitingOutStock, operation of OutStock SO failed");

                //this.UpdateSO(soInfo);
                soInfo.Status = (int)AppEnum.SOStatus.OutStock;
                //���¶���״̬
                UpdateSOStatus(soInfo.SysNo, soInfo.Status, soInfo.OutUserSysNo);
                //������Ʒ���
                foreach(SOItemInfo item in soInfo.ItemHash.Values)
                {
                    InventoryManager.GetInstance().SetSOOutStockQty(soInfo.StockSysNo,item.ProductSysNo,item.Quantity);
                }
                //���¶���������ϸ�ɱ�
                this.SetSOItemCost(soInfo.SysNo);

                //�������Ч���տ-->����soincome(normal, origin)
                SOIncomeInfo soIncome = SOIncomeManager.GetInstance().LoadValid((int)AppEnum.SOIncomeOrderType.SO,soInfo.SysNo);
                if(soIncome==null)//����Ч�տ�������տ
                {
                    soIncome = new SOIncomeInfo();
                    soIncome.OrderType = (int)AppEnum.SOIncomeOrderType.SO;
                    soIncome.OrderSysNo = soInfo.SysNo;
                    soIncome.OrderAmt = soIncome.IncomeAmt = Util.TruncMoney(soInfo.GetTotalAmt());
                    soIncome.IncomeStyle = (int)AppEnum.SOIncomeStyle.Normal;
                    soIncome.IncomeUserSysNo = soInfo.OutUserSysNo;
                    soIncome.IncomeTime = DateTime.Now;
                    soIncome.Status = (int)AppEnum.SOIncomeStatus.Origin;
                    SOIncomeManager.GetInstance().Insert(soIncome);
                    LogInfo log = new LogInfo();
                    log.OptIP = AppConst.SysIP;
                    log.OptUserSysNo = AppConst.SysUser;
                    log.OptTime = DateTime.Now;
                    log.TicketType = (int)AppEnum.LogType.Finance_SOIncome_Add;
                    log.TicketSysNo = soIncome.SysNo;
                    LogManager.GetInstance().Write(log);
                }

                //���������������pointDelay
                if(soInfo.PointAmt>0)
                {
                    SalePointDelayInfo spInfo = new SalePointDelayInfo();
                    spInfo.SOSysNo = soInfo.SysNo;
                    spInfo.CreateTime = DateTime.Now;
                    spInfo.Status = (int)AppEnum.TriStatus.Origin;
                    PointManager.GetInstance().InsertPointDelay(spInfo);
                }

                //��ⶩ�����Ա������м�¼����£�û�������

                WhProductShelvingInspectionInfo oWhpsi = new WhProductShelvingInspectionInfo();
                Hashtable ht = new Hashtable();
                ht.Add("BillSysNo", soInfo.SysNo);
                ht.Add("WorkType", (int)AppEnum.WhWorkType.ProductInspection);
                ht.Add("BillType", (int)AppEnum.WhWorkBillType.SO);
                ht.Add("top", "select top 1 ");

                int whpsiSysNo = WhProductShelvingInspectionManager.GetInstance().GetSysNo(ht);

                if (whpsiSysNo == 0)
                {
                    oWhpsi.BillSysNo = soInfo.SysNo;
                    oWhpsi.WorkType = (int)AppEnum.WhWorkType.ProductInspection;
                    oWhpsi.BillType = (int)AppEnum.WhWorkBillType.SO;
                    oWhpsi.AllocatedUserSysNo = UserRatioManager.GetInstance().GetSOInspectionAllocatedMan(soInfo.SysNo);
                    oWhpsi.RealUserSysNo = oWhpsi.AllocatedUserSysNo;
                    oWhpsi.UpdateUserSysNo = 33;//IASϵͳ
                    oWhpsi.UpdateTime = DateTime.Now;
                    WhProductShelvingInspectionManager.GetInstance().Insert(oWhpsi);
                }
                else
                {
                    oWhpsi.SysNo = whpsiSysNo;
                    oWhpsi.BillSysNo = soInfo.SysNo;
                    oWhpsi.WorkType = (int)AppEnum.WhWorkType.ProductInspection;
                    oWhpsi.BillType = (int)AppEnum.WhWorkBillType.SO;
                    oWhpsi.AllocatedUserSysNo = UserRatioManager.GetInstance().GetSOInspectionAllocatedMan(soInfo.SysNo);
                    oWhpsi.RealUserSysNo = oWhpsi.AllocatedUserSysNo;
                    oWhpsi.UpdateUserSysNo = 33;//IASϵͳ
                    oWhpsi.UpdateTime = DateTime.Now;
                    WhProductShelvingInspectionManager.GetInstance().Update(oWhpsi);
                }

                scope.Complete();
            }
        }
Exemplo n.º 3
0
        public int InsertPointDelay(SalePointDelayInfo oParam)
        {
            string sql = @"INSERT INTO Sale_PointDelay
                            (
                            SOSysNo, CreateTime, Status
                            )
                            VALUES (
                            @SOSysNo, @CreateTime, @Status
                            )";

            SqlCommand cmd = new SqlCommand(sql);

            SqlParameter paramSOSysNo = new SqlParameter("@SOSysNo", SqlDbType.Int,4);
            SqlParameter paramCreateTime = new SqlParameter("@CreateTime", SqlDbType.DateTime);
            SqlParameter paramStatus = new SqlParameter("@Status", SqlDbType.Int,4);

            if ( oParam.SOSysNo != AppConst.IntNull)
                paramSOSysNo.Value = oParam.SOSysNo;
            else
                paramSOSysNo.Value = System.DBNull.Value;
            if ( oParam.CreateTime != AppConst.DateTimeNull)
                paramCreateTime.Value = oParam.CreateTime;
            else
                paramCreateTime.Value = System.DBNull.Value;
            if ( oParam.Status != AppConst.IntNull)
                paramStatus.Value = oParam.Status;
            else
                paramStatus.Value = System.DBNull.Value;

            cmd.Parameters.Add(paramSOSysNo);
            cmd.Parameters.Add(paramCreateTime);
            cmd.Parameters.Add(paramStatus);

            return SqlHelper.ExecuteNonQuery(cmd);
        }
Exemplo n.º 4
0
 private void map(SalePointDelayInfo oParam, DataRow tempdr)
 {
     oParam.SysNo = Util.TrimIntNull(tempdr["SysNo"]);
     oParam.SOSysNo = Util.TrimIntNull(tempdr["SOSysNo"]);
     oParam.CreateTime = Util.TrimDateNull(tempdr["CreateTime"]);
     oParam.Status = Util.TrimIntNull(tempdr["Status"]);
 }
Exemplo n.º 5
0
        public void CancelInStockSR(SRInfo oParam)
        {
            TransactionOptions options = new TransactionOptions();
            options.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted;
            options.Timeout = TransactionManager.DefaultTimeout;

            using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, options))
            {
                //�����˻���
                this.UpdateSRMaster(oParam);

                //������Ʒ��������Ϣ
                foreach (SRItemInfo item in oParam.ItemHash.Values)
                {
                    InventoryManager.GetInstance().SetInStockQty2(oParam.StockSysNo, item.ProductSysNo, -1 * item.Quantity);
                }

                SOInfo soInfo = SaleManager.GetInstance().LoadSO(oParam.SOSysNo);

                //�۳��ͻ�֧������
                if (soInfo.Status == (int)AppEnum.SOStatus.Return)//ȫ���˻��۳�����,�����˻����۳�����
                {
                    PointManager.GetInstance().SetScore(soInfo.CustomerSysNo, soInfo.PointPay * (-1), (int)AppEnum.PointLogType.CancelReturn, soInfo.SysNo.ToString());
                }

                //����л������������pointDelay,���޸Ķ������ͻ���
                int PointAmt = 0;
                foreach (SOItemInfo oItem in soInfo.ItemHash.Values)
                {
                    if (oItem.ReturnQty > 0 && oItem.Point > 0)
                    {
                        PointAmt += oItem.ReturnQty * oItem.Point;
                    }
                }
                if (PointAmt > 0)
                {
                    int soPointAmt = soInfo.PointAmt + PointAmt;
                    Hashtable ht = new Hashtable();
                    ht.Add("SysNo", soInfo.SysNo);
                    ht.Add("PointAmt", soPointAmt);
                    SaleManager.GetInstance().UpdateSOMaster(ht);
                }

                SalePointDelayInfo spInfo = new SalePointDelayInfo();
                spInfo.SOSysNo = soInfo.SysNo;
                spInfo.CreateTime = DateTime.Now;
                spInfo.Status = (int)AppEnum.TriStatus.Origin;
                PointManager.GetInstance().InsertPointDelay(spInfo);

                scope.Complete();
            }
        }
Exemplo n.º 6
0
 public void UpdatePointDelay(SalePointDelayInfo oParam)
 {
     new PointDac().UpdatePointDelay(oParam);
 }
Exemplo n.º 7
0
        private void doDelayPoint(SalePointDelayInfo spInfo,int pointDelt,int customerSysNo)
        {
            TransactionOptions options = new TransactionOptions();
            options.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted;
            options.Timeout = TransactionManager.DefaultTimeout;

            using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, options))
            {
                //����point delay״̬
                spInfo.Status = (int)AppEnum.TriStatus.Handled;
                this.UpdatePointDelay(spInfo);
                //�����û�����
                PointManager.GetInstance().SetScore(customerSysNo, pointDelt, (int)AppEnum.PointLogType.AddPointLater, spInfo.SOSysNo.ToString());
                scope.Complete();
            }
        }
Exemplo n.º 8
0
 public SalePointDelayInfo LoadValid(int soSysNo)
 {
     SalePointDelayInfo spInfo = null;
     string sql = @"select * from sale_pointdelay where status<>"+(int)AppEnum.TriStatus.Abandon+" and sosysno="+soSysNo;
     DataSet ds = SqlHelper.ExecuteDataSet(sql);
     if(Util.HasMoreRow(ds))
     {
         spInfo = new SalePointDelayInfo();
         this.map(spInfo,ds.Tables[0].Rows[0]);
     }
     return spInfo;
 }
Exemplo n.º 9
0
 public void InsertPointDelay(SalePointDelayInfo oParam)
 {
     string sql = @"select * from sale_pointdelay where status>"+(int)AppEnum.TriStatus.Abandon+" and sosysno ="+oParam.SOSysNo;
     DataSet ds = SqlHelper.ExecuteDataSet(sql);
     if(Util.HasMoreRow(ds))
         throw new BizException("A valid delaypoint record of this SO already exists,can't add another.'");
     new PointDac().InsertPointDelay(oParam);
 }
Exemplo n.º 10
0
        public void ImportPointDelay()
        {
            if ( !AppConfig.IsImportable)
                throw new BizException("Is Importable is false");
            string sql = " select top 1 * from Sale_PointDelay ";
            DataSet ds = SqlHelper.ExecuteDataSet(sql);
            if ( Util.HasMoreRow(ds) )
                throw new BizException("the table Point Delay is not empty");

            TransactionOptions options = new TransactionOptions();
            options.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted;
            options.Timeout = TransactionManager.DefaultTimeout;

            using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, options))
            {
                string sqlOld = @"select * from ipp2003..PointPayDelay ";
                DataSet dsOld = SqlHelper.ExecuteDataSet(sqlOld);
                if(Util.HasMoreRow(dsOld))
                {
                    foreach(DataRow dr in dsOld.Tables[0].Rows)
                    {
                        SalePointDelayInfo spInfo = new SalePointDelayInfo();
                        this.map(spInfo,dr);
                        new PointDac().InsertPointDelay(spInfo);
                    }
                }
                scope.Complete();
            }
        }
Exemplo n.º 11
0
 /// <summary>
 /// �������Ӷ�Ӧ�����Ļ���
 /// </summary>
 /// <param name="soSysNo"></param>
 public void DoDelayPointSingle(int soSysNo)
 {
     string sql = @"select sp.* ,sm.pointamt,sm.customersysno from sale_pointdelay sp
                    inner join so_master sm on sm.sysno = sp.sosysno
                    where sm.pointamt <> 0 and sm.status = "+(int)AppEnum.SOStatus.OutStock+" and sp.status = "+(int)AppEnum.TriStatus.Origin+" and sm.sysno ="+soSysNo;
     DataSet ds = SqlHelper.ExecuteDataSet(sql);
     if(Util.HasMoreRow(ds))
     {
         SalePointDelayInfo spInfo = new SalePointDelayInfo();
         DataRow dr = ds.Tables[0].Rows[0];
         this.map(spInfo,dr);
         this.doDelayPoint(spInfo,(int)dr["PointAmt"],(int)dr["CustomerSysNo"]);
     }
 }
Exemplo n.º 12
0
        public void DoDelayPoint()
        {
            string sql = @"select sp.* ,sm.pointamt,sm.customersysno from sale_pointdelay sp(nolock)
                           inner join so_master sm(nolock) on sm.sysno = sp.sosysno
                           inner join finance_soincome fs(nolock) on sm.sysno=fs.ordersysno
                           where sm.pointamt <> 0 and sm.status = "+(int)AppEnum.SOStatus.OutStock+" and sp.status = "+(int)AppEnum.TriStatus.Origin+" and createtime<="+ Util.ToSqlString( DateTime.Now.AddDays(-3).ToString(AppConst.DateFormatLong))  + " and fs.ordertype=" + (int)AppEnum.SOIncomeOrderType.SO + " and fs.status=" + (int)AppEnum.SOIncomeStatus.Confirmed;
            DataSet ds = SqlHelper.ExecuteDataSet(sql);

            if(Util.HasMoreRow(ds))
            {
                Hashtable failHash = new Hashtable();
                foreach(DataRow dr in ds.Tables[0].Rows)
                {
                    SalePointDelayInfo spInfo = new SalePointDelayInfo();
                    this.map(spInfo,dr);
                    try
                    {
                        this.doDelayPoint(spInfo,(int)dr["PointAmt"],(int)dr["CustomerSysNo"]);
                    }
                    catch
                    {
                        failHash.Add(spInfo.SysNo,spInfo);
                    }
                }

                TCPMail oMail = new TCPMail();
                if(failHash.Count>0)
                {
                    StringBuilder sb = new StringBuilder();
                    sb.Append("<table align='center' border='1' cellpadding='0' cellspacing='0'>");
                    sb.Append(" <tr>");
                    sb.Append("  <td>SysNo</td>");
                    sb.Append("  <td>SOSysNo</td>");
                    sb.Append("  <td>CreateTime</td>");
                    sb.Append(" </tr>");
                    foreach(SalePointDelayInfo failInfo in failHash.Values)
                    {
                        sb.Append("<tr>");
                        sb.Append(" <td>"+failInfo.SysNo+"</td>");
                        sb.Append(" <td>"+failInfo.SOSysNo+"</td>");
                        sb.Append(" <td>"+failInfo.CreateTime+"</td>");
                        sb.Append("</tr>");
                    }
                    sb.Append("</table>");
                    oMail.Send(AppConfig.AdminEmail,"Add Delay Point---Failed : "+DateTime.Now.ToString(AppConst.DateFormatLong),sb.ToString());
                }
                else
                    oMail.Send(AppConfig.AdminEmail,"Add Delay Point---OK : "+DateTime.Now.ToString(AppConst.DateFormatLong), "");
            }
            else
            {
                TCPMail oMail = new TCPMail();
                oMail.Send(AppConfig.AdminEmail, "Add Delay Point None---: " + DateTime.Now.ToString(AppConst.DateFormatLong), "");
            }
        }