示例#1
0
文件: RMAManager.cs 项目: ue96/ue96
        /// <summary>
        /// ����rma��
        /// </summary>
        /// <param name="rmaInfo"></param>
        public void AddRMA(RMAInfo rmaInfo)
        {
            TransactionOptions options = new TransactionOptions();
            options.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted;
            options.Timeout = TransactionManager.DefaultTimeout;

            using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, options))
            {
                if(!this.IfExistOpenedRMA(rmaInfo.SOSysNo))
                {
                    Hashtable leftHash = this.GetLeftRMAQty(rmaInfo.SOSysNo);
                    foreach(RMAItemInfo item in rmaInfo.ItemHash.Values)
                    {
                        if(item.RMAQty>(int)leftHash[item.ProductSysNo])
                            throw new BizException("����д�ı�����Ʒ�����������۵���ʵ�ʹ�����������ȷ���豣�޵���Ʒ��Ϊ�˵�����");
                    }
                    rmaInfo.SysNo = SequenceDac.GetInstance().Create("RMA_Sequence");
                    rmaInfo.RMAID = this.BuildRMAID(rmaInfo.SysNo);
                    rmaInfo.SubmitInfo = this.GetRMASnapShot(rmaInfo);
                    rmaInfo.Status = (int)AppEnum.RMAStatus.Origin;
                    this.InsertMaster(rmaInfo);
                    foreach(RMAItemInfo rmaItem in rmaInfo.ItemHash.Values)
                    {
                        rmaItem.RMASysNo = rmaInfo.SysNo;
                        this.InsertItem(rmaItem);
                    }
                }
                else
                    throw new BizException("�����۵��Ѿ�����һ�ű��޵��ڴ����У�������������ύ�µı������룬����ϵORS�̳ǿͷ�");
                scope.Complete();
            }
        }
示例#2
0
 public void Init()
 {
     Catalog = AppConst.StringNull;
     sCustomer = null;
     sSO = null;
     sRMA = null;
     GiftHash = new Hashtable(5);
     BrowseHistoryList = new ArrayList(5);
 }
示例#3
0
文件: RMAManager.cs 项目: ue96/ue96
        public void AbandonRMA(RMAInfo oRMA)
        {
            TransactionOptions options = new TransactionOptions();
            options.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted;
            options.Timeout = TransactionManager.DefaultTimeout;

            using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, options))
            {
                int currentStatus = this.GetRMACurrentStatus(oRMA.SysNo);
                if(currentStatus!=(int)AppEnum.RMAStatus.Origin&&currentStatus!=(int)AppEnum.RMAStatus.Received)
                    throw new BizException("�˵��Ѿ����������������");
                Hashtable paramHash = new Hashtable(2);
                paramHash.Add("LastUserSysNo",oRMA.LastUserSysNo);
                paramHash.Add("Status",oRMA.Status);
                paramHash.Add("SysNo",oRMA.SysNo);
                RMAManager.GetInstance().UpdateRMAMaster(paramHash);
                scope.Complete();
            }
        }
示例#4
0
文件: RMAManager.cs 项目: ue96/ue96
 private void map(RMAInfo oParam,DataRow tempdr)
 {
     oParam.SysNo = Util.TrimIntNull(tempdr["SysNo"]);
     oParam.RMAID = Util.TrimNull(tempdr["RMAID"]);
     oParam.SOSysNo = Util.TrimIntNull(tempdr["SOSysNo"]);
     oParam.CustomerSysNo = Util.TrimIntNull(tempdr["CustomerSysNo"]);
     oParam.Status = Util.TrimIntNull(tempdr["Status"]);
     oParam.AuditUserSysNo = Util.TrimIntNull(tempdr["AuditUserSysNo"]);
     oParam.AuditTime = Util.TrimDateNull(tempdr["AuditTime"]);
     oParam.ReceiveUserSysNo = Util.TrimIntNull(tempdr["ReceiveUserSysNo"]);
     oParam.ReceiveTime = Util.TrimDateNull(tempdr["ReceiveTime"]);
     oParam.CloseUserSysNo = Util.TrimIntNull(tempdr["CloseUserSysNo"]);
     oParam.CloseTime = Util.TrimDateNull(tempdr["CloseTime"]);
     oParam.RMAUserSysNo = Util.TrimIntNull(tempdr["RMAUserSysNo"]);
     oParam.RMATime = Util.TrimDateNull(tempdr["RMATime"]);
     oParam.LastUserSysNo = Util.TrimIntNull(tempdr["LastUserSysNo"]);
     oParam.UserChangedTime = Util.TrimDateNull(tempdr["UserChangedTime"]);
     oParam.RMANote = Util.TrimNull(tempdr["RMANote"]);
     oParam.CCNote = Util.TrimNull(tempdr["CCNote"]);
     oParam.SubmitInfo = Util.TrimNull(tempdr["SubmitInfo"]);
     oParam.ReceiveInfo = Util.TrimNull(tempdr["ReceiveInfo"]);
     oParam.UserStatus = Util.TrimIntNull(tempdr["UserStatus"]);
     oParam.CreateTime = Util.TrimDateNull(tempdr["CreateTime"]);
 }
示例#5
0
文件: RMAManager.cs 项目: ue96/ue96
        private void InsertMaster(RMAInfo oRMA)
        {
            TransactionOptions options = new TransactionOptions();
            options.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted;
            options.Timeout = TransactionManager.DefaultTimeout;

            using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, options))
            {
                new RMADac().InsertMaster(oRMA);
                scope.Complete();
            }
        }
示例#6
0
文件: RMAManager.cs 项目: ue96/ue96
        public void UpdateRMAMaster(RMAInfo rmaInfo)
        {
            TransactionOptions options = new TransactionOptions();
            options.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted;
            options.Timeout = TransactionManager.DefaultTimeout;

            using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, options))
            {
                Hashtable paramHash = new Hashtable();
                paramHash.Add("CCNote",rmaInfo.CCNote);
                paramHash.Add("LastUserSysNo",rmaInfo.LastUserSysNo);
                paramHash.Add("RMANote",rmaInfo.RMANote);
                paramHash.Add("SysNo",rmaInfo.SysNo);
                paramHash.Add("UserChangedTime",rmaInfo.UserChangedTime);
                paramHash.Add("UserStatus",rmaInfo.UserStatus);
                this.UpdateRMAMaster(paramHash);
                scope.Complete();
            }
        }
示例#7
0
文件: RMAManager.cs 项目: ue96/ue96
        public void UpdateRMA(RMAInfo rmaInfo)
        {
            TransactionOptions options = new TransactionOptions();
            options.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted;
            options.Timeout = TransactionManager.DefaultTimeout;

            using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, options))
            {
                this.UpdateRMAMaster(rmaInfo);
                if(rmaInfo.ItemHash.Count>0)
                {
                    foreach(RMAItemInfo item in rmaInfo.ItemHash.Values)
                    {
                        this.UpdateRMAItem(item);
                    }
                }
                scope.Complete();
            }
        }
示例#8
0
文件: RMAManager.cs 项目: ue96/ue96
 public RMAInfo LoadMaster(int rmaSysNo)
 {
     string sql = "select * from RMA_Master where sysno ="+rmaSysNo;
     DataSet ds = SqlHelper.ExecuteDataSet(sql);
     if(!Util.HasMoreRow(ds))
         return null;
     RMAInfo oRMA = new RMAInfo();
     this.map(oRMA,ds.Tables[0].Rows[0]);
     return oRMA;
 }
示例#9
0
文件: RMAManager.cs 项目: ue96/ue96
        public void Import()
        {
            string sql = @"select top 1 * from rma_master;
                           select top 1 * from rma_item;";
            DataSet ds = SqlHelper.ExecuteDataSet(sql);
            foreach(DataTable dt in ds.Tables)
            {
                if(Util.HasMoreRow(dt))
                    throw new BizException("The target 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))
            {
                //Insert RMA_Master
                string sqlMaster = @"select rm.sysno, rmaid, sosysno, customsysno as customersysno, approvetime as audittime, suau.newsysno as auditusersysno, status, rmatime as createtime,
                                     note as rmanote,note as ccnote
                                     from ipp2003..rma_master rm
                                     left join ippconvert..sys_user suau on suau.oldsysno = rm.approversysno";
                DataSet dsMaster = SqlHelper.ExecuteDataSet(sqlMaster);
                if(Util.HasMoreRow(dsMaster))
                {
                    foreach(DataRow dr in dsMaster.Tables[0].Rows)
                    {
                        RMAInfo oRMA = new RMAInfo();
                        oRMA.SysNo = Util.TrimIntNull(dr["SysNo"]);
                        oRMA.RMAID = Util.TrimNull(dr["RMAID"]);
                        oRMA.SOSysNo = Util.TrimIntNull(dr["SOSysNo"]);
                        oRMA.CustomerSysNo = Util.TrimIntNull(dr["CustomerSysNo"]);
                        oRMA.AuditTime = Util.TrimDateNull(dr["AuditTime"]);
                        oRMA.AuditUserSysNo = Util.TrimIntNull(dr["AuditUserSysNo"]);
                        switch((int)dr["Status"])
                        {
                            case -1:
                                oRMA.Status = (int)AppEnum.RMAStatus.Abandon;
                                break;
                            case 0:
                                oRMA.Status = (int)AppEnum.RMAStatus.Origin;
                                break;
                            case 1:
                                oRMA.Status = (int)AppEnum.RMAStatus.Closed;
                                break;
                        }
                        oRMA.CreateTime = Util.TrimDateNull(dr["CreateTime"]);
                        oRMA.RMANote = Util.TrimNull(dr["RMANote"]);
                        oRMA.CCNote = Util.TrimNull(dr["CCNote"]);
                        oRMA.UserStatus = 1;
                        new RMADac().InsertMaster(oRMA);
                    }
                }
                //Insert RMA_Item
                string sqlItem = @"select 1 as sysno,rmasysno,case realrmatype when 3 then "+(int)AppEnum.RMAType.Overrule+@" when 1 then "+(int)AppEnum.RMAType.Return
                                +@" when 2 then "+(int)AppEnum.RMAType.Maintain+@" end as rmatype, realrmaquantity as rmaqty,
                                   realrmareason as rmadesc,pb.newsysno as productsysno
                                   from ipp2003..rma_item ri
                                   inner join ippconvert..productbasic pb on pb.oldsysno = ri.productsysno";
                DataSet dsItem = SqlHelper.ExecuteDataSet(sqlItem);
                if(Util.HasMoreRow(dsItem))
                {
                    foreach(DataRow dr in dsItem.Tables[0].Rows)
                    {
                        RMAItemInfo oRMAItem = new RMAItemInfo();
                        this.map(oRMAItem,dr);
                        new RMADac().InsertItem(oRMAItem);
                    }
                }
                //Insert SnapShot
                string sqlSnapShot = @"select rmasysno,rmaid,case rmatype when 0 then "+(int)AppEnum.RMAType.Unsure+@" when 1 then "+(int)AppEnum.RMAType.Return
                                    +@" when 2 then "+(int)AppEnum.RMAType.Maintain+@" end as rmatype, rmaquantity as rmaqty,
                                       rmareason as rmadesc,pb.newsysno as productsysno,pl.productname,p.productid
                                       from ipp2003..rma_item ri
                                       inner join ippconvert..productbasic pb on pb.oldsysno = ri.productsysno
                                       inner join ipp2003..product_language pl on pl.productsysno = ri.productsysno and pl.languageid = 'cn'
                                       inner join ipp2003..product p on p.sysno = ri.productsysno
                                       inner join ipp2003..rma_master rm on rm.sysno = ri.rmasysno
                                       order by rmasysno";
                DataSet dsSnapShot = SqlHelper.ExecuteDataSet(sqlSnapShot);
                if(Util.HasMoreRow(dsSnapShot))
                {
                    StringBuilder sb = new StringBuilder();
                    int tempSysNo = 0;
                    foreach(DataRow dr in dsSnapShot.Tables[0].Rows)
                    {
                        if(tempSysNo!=(int)dr["RMASysNo"])
                        {
                            if(tempSysNo!=0)
                            {
                                sb.Append("</table>");
                                Hashtable updateht = new Hashtable();
                                updateht.Add("SysNo",tempSysNo);
                                updateht.Add("SubmitInfo",sb.ToString());
                                updateht.Add("ReceiveInfo",sb.ToString());
                                new RMADac().UpdateMaster(updateht);
                                sb.Remove(0,sb.Length);
                            }
                            sb.Append("<table width='100%' border='1' cellpadding='0' cellspacing='0'>");
                            sb.Append("	<tr>");
                            sb.Append("	 <td>"+dr["RMAID"].ToString()+"</td>");
                            sb.Append("	 <td>��Ʒ����</td>");
                            sb.Append("  <td>��������</td>");
                            sb.Append("	 <td>��������</td>");
                            sb.Append("  <td>����ԭ��</td>");
                            sb.Append(" </tr>");
                        }
                        sb.Append("<tr>");
                        sb.Append(" <td>"+dr["ProductID"].ToString()+"</td>");
                        sb.Append(" <td>"+dr["ProductName"].ToString()+"</td>");
                        sb.Append(" <td>"+dr["RMAQty"].ToString()+"</td>");
                        sb.Append(" <td>"+AppEnum.GetRMAType(Util.TrimIntNull(dr["RMAType"]))+"</td>");
                        sb.Append(" <td>"+dr["RMADesc"].ToString()+"</td>");
                        sb.Append("</tr>");
                        tempSysNo = (int)dr["RMASysNo"];
                    }
                }
                //Insert Sequence
                string sqlMaxSysNo = @"select max(sysno) as sysno from rma_master";
                DataSet dsMaxSysNo = SqlHelper.ExecuteDataSet(sqlMaxSysNo);
                int n = 0;
                while(n<Util.TrimIntNull(dsMaxSysNo.Tables[0].Rows[0][0]))
                {
                    n = SequenceDac.GetInstance().Create("RMA_Sequence");
                }
                scope.Complete();
            }
        }
示例#10
0
文件: RMAManager.cs 项目: ue96/ue96
        public void HandleRMA(RMAInfo rmaInfo,SessionInfo sInfo)
        {
            TransactionOptions options = new TransactionOptions();
            options.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted;
            options.Timeout = TransactionManager.DefaultTimeout;

            using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, options))
            {
                if(this.GetRMACurrentStatus(rmaInfo.SysNo)!=(int)AppEnum.RMAStatus.Received)
                    throw new BizException("This rma sheet is not received now,can't be handled");
                Hashtable paramHash = new Hashtable(4);
                paramHash.Add("Status",rmaInfo.Status);
                paramHash.Add("RMATime",rmaInfo.RMATime);
                paramHash.Add("RMAUserSysNo",rmaInfo.RMAUserSysNo);
                paramHash.Add("SysNo",rmaInfo.SysNo);
                this.UpdateRMAMaster(paramHash);
                //������˻����͵���Ʒ���Զ������˻���
                foreach(RMAItemInfo rmaItem in rmaInfo.ItemHash.Values)
                {
                    if(rmaItem.RMAType==(int)AppEnum.RMAType.Return)
                    {
                        ROInfo roInfo = ROManager.GetInstance().BuildROFromRMA(rmaInfo);
                        ROManager.GetInstance().AddRO(roInfo);
                        LogManager.GetInstance().Write(new LogInfo(roInfo.SysNo,(int)AppEnum.LogType.Sale_RO_Create,sInfo));
                        break;
                    }
                }
                LogManager.GetInstance().Write(new LogInfo(rmaInfo.SysNo,(int)AppEnum.LogType.Sale_RMA_Handle,sInfo));
                scope.Complete();
            }
        }
示例#11
0
文件: RMAManager.cs 项目: ue96/ue96
 public string GetRMASnapShot(RMAInfo oParam)
 {
     StringBuilder sb = new StringBuilder();
     if(oParam.ItemHash.Count>0)
     {
         sb.Append("<table class=\"GridViewStyle\" cellspacing=\"0\" rules=\"all\" border=\"1\" id=\"Table99\" style=\"width: 100%;border-collapse: collapse;\">");
         sb.Append("	<tr class=\"GridViewHeaderStyle\">");
         sb.Append("	 <td>"+oParam.RMAID+"</td>");
         sb.Append("	 <td>��Ʒ����</td>");
         sb.Append("  <td>��������</td>");
         sb.Append("	 <td>��������</td>");
         sb.Append("  <td>����ԭ��</td>");
         sb.Append(" </tr>");
         Hashtable SysnoHt = new Hashtable();
         foreach(RMAItemInfo item in oParam.ItemHash.Values)
         {
             SysnoHt.Add(item.ProductSysNo,item.ProductSysNo);
         }
         Hashtable PbHt = Icson.BLL.Basic.ProductManager.GetInstance().GetProductBoundle(SysnoHt);
         int i = 1;
         foreach(RMAItemInfo item in oParam.ItemHash.Values)
         {
             if ((i % 2) != 0 )
             {
                 sb.Append("<tr class=\"GridViewRowStyle\" onmouseout=\"this.style.backgroundColor=currentcolor,this.style.fontWeight=&quot;&quot;;\" onmouseover=\"currentcolor=this.style.backgroundColor;this.style.backgroundColor=&quot;#d8e3e7&quot;,this.style.fontWeight=&quot;&quot;;jquery_Tools_showthis(this);\">");
             }
             else
             {
                 sb.Append("<tr class=\"GridViewAlternatingRowStyle\" onmouseout=\"this.style.backgroundColor=currentcolor,this.style.fontWeight=&quot;&quot;;\" onmouseover=\"currentcolor=this.style.backgroundColor;this.style.backgroundColor=&quot;#d8e3e7&quot;,this.style.fontWeight=&quot;&quot;;jquery_Tools_showthis(this);\">");
             }
             i++;
             foreach(ProductBasicInfo PbInfo in PbHt.Values)
             {
                 if(PbInfo.SysNo==item.ProductSysNo)
                 {
                     sb.Append("<td>");
                     sb.Append(PbInfo.ProductID);
                     sb.Append("</td>");
                     sb.Append("<td>");
                     sb.Append(PbInfo.ProductName);
                     sb.Append("</td>");
                     break;
                 }
             }
             sb.Append(" <td>"+item.RMAQty.ToString()+"</td>");
             sb.Append(" <td>"+AppEnum.GetRMAType(item.RMAType)+"</td>");
             sb.Append(" <td>"+item.RMADesc+"</td>");
             sb.Append("</tr>");
         }
         sb.Append("</table>");
     }
     return sb.ToString();
 }
示例#12
0
文件: RMAManager.cs 项目: ue96/ue96
        public void CancelHandleRMA(RMAInfo rmaInfo,SessionInfo sInfo)
        {
            TransactionOptions options = new TransactionOptions();
            options.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted;
            options.Timeout = TransactionManager.DefaultTimeout;

            using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, options))
            {
                if(this.GetRMACurrentStatus(rmaInfo.SysNo)!=(int)AppEnum.RMAStatus.Handled)
                    throw new BizException("This rma sheet is not handled now,can't cancel handle");
                //��������˻�����������
                ROInfo roInfo = ROManager.GetInstance().LoadROfromRMA(rmaInfo.SysNo);
                if(roInfo!=null)
                {
                    ROManager.GetInstance().AbandonRO(roInfo);
                    LogManager.GetInstance().Write(new LogInfo(roInfo.SysNo,(int)AppEnum.LogType.Sale_RO_Abandon,sInfo));
                }
                Hashtable paramHash = new Hashtable(4);
                paramHash.Add("Status",rmaInfo.Status);
                paramHash.Add("RMATime",rmaInfo.RMATime);
                paramHash.Add("RMAUserSysNo",rmaInfo.RMAUserSysNo);
                paramHash.Add("SysNo",rmaInfo.SysNo);
                this.UpdateRMAMaster(paramHash);
                LogManager.GetInstance().Write(new LogInfo(rmaInfo.SysNo,(int)AppEnum.LogType.Sale_RMA_CancelHandle,sInfo));
                scope.Complete();
            }
        }
示例#13
0
文件: RMAManager.cs 项目: ue96/ue96
        public RMAInfo BuildRMAfromSO(int soSysNo)
        {
            if(!this.IfExistOpenedRMA(soSysNo))
            {
                RMAInfo rmaInfo = new RMAInfo();
                SOInfo soInfo  = SaleManager.GetInstance().LoadSO(soSysNo);
                if(soInfo!=null&&soInfo.Status==(int)AppEnum.SOStatus.OutStock)
                {
                    rmaInfo.SOSysNo = soInfo.SysNo;
                    rmaInfo.CustomerSysNo = soInfo.CustomerSysNo;
                    if(soInfo.ItemHash.Count>0)
                    {
                        foreach(SOItemInfo soItem in soInfo.ItemHash.Values)
                        {
                            RMAItemInfo rmaItem = new RMAItemInfo();
                            rmaItem.ProductSysNo = soItem.ProductSysNo;
                            rmaItem.RMAType = (int)AppEnum.RMAType.Unsure;
                            rmaItem.RMAQty = soItem.Quantity;
                            rmaInfo.ItemHash.Add(rmaItem.ProductSysNo,rmaItem);

                            string SOItemPODesc = "";
                            Hashtable ht = SaleManager.GetInstance().LoadSOItemPOList(soItem.SysNo);
                            if(ht != null)
                            {
                                foreach(SOItemPOInfo soItemPO in ht.Keys)
                                {
                                    if (soItemPO.POSysNo > 0)
                                    {
                                        POInfo poInfo = PurchaseManager.GetInstance().LoadPO(soItemPO.POSysNo);
                                        int VendorSysNo = poInfo.VendorSysNo;
                                        SOItemPODesc += "�ɹ�����:<a href=\"javascript:openWindowS2('../Purchase/POSheet.aspx?sysno=" + soItemPO.POSysNo + "&opt=view')" + "\" >" + soItemPO.POSysNo + "</a>, " + "��Ӧ�̱��:<a href=\"javascript:openWindowS2('../Basic/VendorOpt.aspx?sysno=" + VendorSysNo + "&opt=update')" + "\">" + VendorSysNo + "</a><br>";
                                    }
                                    else if(soItemPO.ProductIDSysNo > 0)
                                    {
                                        SOItemPODesc += "��Ʒ���к�:<a href=\"javascript:openWindowS2('../Basic/ProductID.aspx?sysno=" + soItemPO.ProductIDSysNo + "')" + "\" >" + soItemPO.ProductIDSysNo + "</a><br>";
                                    }
                                }
                            }
                            rmaItem.SOItemPODesc = SOItemPODesc;
                        }
                    }
                }
                else
                    rmaInfo = null;
                return rmaInfo;
            }
            else
                throw new BizException("�����۵��Ѿ�����һ�ű��޵��ڴ����У�������������ύ�µı������룬����ϵORS�̳ǿͷ�");
        }
示例#14
0
文件: RMADac.cs 项目: ue96/ue96
        public int InsertMaster(RMAInfo oParam)
        {
            string sql = @"INSERT INTO RMA_Master
                           (
                           SysNo, RMAID, SOSysNo, CustomerSysNo,
                           Status, AuditUserSysNo, AuditTime, ReceiveUserSysNo,
                           ReceiveTime, CloseUserSysNo, CloseTime, RMAUserSysNo, RMATime,
                           LastUserSysNo, UserChangedTime, RMANote, CCNote,
                           SubmitInfo, ReceiveInfo, UserStatus
                           )
                           VALUES (
                           @SysNo, @RMAID, @SOSysNo, @CustomerSysNo,
                           @Status, @AuditUserSysNo, @AuditTime, @ReceiveUserSysNo,
                           @ReceiveTime, @CloseUserSysNo, @CloseTime, @RMAUserSysNo, @RMATime,
                           @LastUserSysNo, @UserChangedTime, @RMANote, @CCNote,
                           @SubmitInfo, @ReceiveInfo, @UserStatus
                           )";
            SqlCommand cmd = new SqlCommand(sql);

            SqlParameter paramSysNo = new SqlParameter("@SysNo", SqlDbType.Int,4);
            SqlParameter paramRMAID = new SqlParameter("@RMAID", SqlDbType.NVarChar,20);
            SqlParameter paramSOSysNo = new SqlParameter("@SOSysNo", SqlDbType.Int,4);
            SqlParameter paramCustomerSysNo = new SqlParameter("@CustomerSysNo", SqlDbType.Int,4);
            SqlParameter paramStatus = new SqlParameter("@Status", SqlDbType.Int,4);
            SqlParameter paramAuditUserSysNo = new SqlParameter("@AuditUserSysNo", SqlDbType.Int,4);
            SqlParameter paramAuditTime = new SqlParameter("@AuditTime", SqlDbType.DateTime);
            SqlParameter paramReceiveUserSysNo = new SqlParameter("@ReceiveUserSysNo", SqlDbType.Int,4);
            SqlParameter paramReceiveTime = new SqlParameter("@ReceiveTime", SqlDbType.DateTime);
            SqlParameter paramCloseUserSysNo = new SqlParameter("@CloseUserSysNo", SqlDbType.Int,4);
            SqlParameter paramCloseTime = new SqlParameter("@CloseTime", SqlDbType.DateTime);
            SqlParameter paramRMAUserSysNo = new SqlParameter("@RMAUserSysNo", SqlDbType.Int);
            SqlParameter paramRMATime = new SqlParameter("@RMATime", SqlDbType.DateTime);
            SqlParameter paramLastUserSysNo = new SqlParameter("@LastUserSysNo", SqlDbType.Int,4);
            SqlParameter paramUserChangedTime = new SqlParameter("@UserChangedTime", SqlDbType.DateTime);
            SqlParameter paramRMANote = new SqlParameter("@RMANote", SqlDbType.NVarChar,500);
            SqlParameter paramCCNote = new SqlParameter("@CCNote", SqlDbType.NVarChar,500);
            SqlParameter paramSubmitInfo = new SqlParameter("@SubmitInfo", SqlDbType.NText);
            SqlParameter paramReceiveInfo = new SqlParameter("@ReceiveInfo", SqlDbType.NText);
            SqlParameter paramUserStatus = new SqlParameter("@UserStatus", SqlDbType.Int,4);

            if ( oParam.SysNo != AppConst.IntNull)
                paramSysNo.Value = oParam.SysNo;
            else
                paramSysNo.Value = System.DBNull.Value;
            if ( oParam.RMAID != AppConst.StringNull)
                paramRMAID.Value = oParam.RMAID;
            else
                paramRMAID.Value = System.DBNull.Value;
            if ( oParam.SOSysNo != AppConst.IntNull)
                paramSOSysNo.Value = oParam.SOSysNo;
            else
                paramSOSysNo.Value = System.DBNull.Value;
            if ( oParam.CustomerSysNo != AppConst.IntNull)
                paramCustomerSysNo.Value = oParam.CustomerSysNo;
            else
                paramCustomerSysNo.Value = System.DBNull.Value;
            if ( oParam.Status != AppConst.IntNull)
                paramStatus.Value = oParam.Status;
            else
                paramStatus.Value = System.DBNull.Value;
            if ( oParam.AuditUserSysNo != AppConst.IntNull)
                paramAuditUserSysNo.Value = oParam.AuditUserSysNo;
            else
                paramAuditUserSysNo.Value = System.DBNull.Value;
            if ( oParam.AuditTime != AppConst.DateTimeNull)
                paramAuditTime.Value = oParam.AuditTime;
            else
                paramAuditTime.Value = System.DBNull.Value;
            if ( oParam.ReceiveUserSysNo != AppConst.IntNull)
                paramReceiveUserSysNo.Value = oParam.ReceiveUserSysNo;
            else
                paramReceiveUserSysNo.Value = System.DBNull.Value;
            if ( oParam.ReceiveTime != AppConst.DateTimeNull)
                paramReceiveTime.Value = oParam.ReceiveTime;
            else
                paramReceiveTime.Value = System.DBNull.Value;
            if ( oParam.CloseUserSysNo != AppConst.IntNull)
                paramCloseUserSysNo.Value = oParam.CloseUserSysNo;
            else
                paramCloseUserSysNo.Value = System.DBNull.Value;
            if ( oParam.CloseTime != AppConst.DateTimeNull)
                paramCloseTime.Value = oParam.CloseTime;
            else
                paramCloseTime.Value = System.DBNull.Value;
            if ( oParam.RMAUserSysNo != AppConst.IntNull)
                paramRMAUserSysNo.Value = oParam.RMAUserSysNo;
            else
                paramRMAUserSysNo.Value = System.DBNull.Value;
            if ( oParam.RMATime != AppConst.DateTimeNull)
                paramRMATime.Value = oParam.RMATime;
            else
                paramRMATime.Value = System.DBNull.Value;
            if ( oParam.LastUserSysNo != AppConst.IntNull)
                paramLastUserSysNo.Value = oParam.LastUserSysNo;
            else
                paramLastUserSysNo.Value = System.DBNull.Value;
            if ( oParam.UserChangedTime != AppConst.DateTimeNull)
                paramUserChangedTime.Value = oParam.UserChangedTime;
            else
                paramUserChangedTime.Value = System.DBNull.Value;
            if ( oParam.RMANote != AppConst.StringNull)
                paramRMANote.Value = oParam.RMANote;
            else
                paramRMANote.Value = System.DBNull.Value;
            if ( oParam.CCNote != AppConst.StringNull)
                paramCCNote.Value = oParam.CCNote;
            else
                paramCCNote.Value = System.DBNull.Value;
            if ( oParam.SubmitInfo != AppConst.StringNull)
                paramSubmitInfo.Value = oParam.SubmitInfo;
            else
                paramSubmitInfo.Value = System.DBNull.Value;
            if ( oParam.ReceiveInfo != AppConst.StringNull)
                paramReceiveInfo.Value = oParam.ReceiveInfo;
            else
                paramReceiveInfo.Value = System.DBNull.Value;
            if ( oParam.UserStatus != AppConst.IntNull)
                paramUserStatus.Value = oParam.UserStatus;
            else
                paramUserStatus.Value = System.DBNull.Value;

            cmd.Parameters.Add(paramSysNo);
            cmd.Parameters.Add(paramRMAID);
            cmd.Parameters.Add(paramSOSysNo);
            cmd.Parameters.Add(paramCustomerSysNo);
            cmd.Parameters.Add(paramStatus);
            cmd.Parameters.Add(paramAuditUserSysNo);
            cmd.Parameters.Add(paramAuditTime);
            cmd.Parameters.Add(paramReceiveUserSysNo);
            cmd.Parameters.Add(paramReceiveTime);
            cmd.Parameters.Add(paramCloseUserSysNo);
            cmd.Parameters.Add(paramCloseTime);
            cmd.Parameters.Add(paramRMAUserSysNo);
            cmd.Parameters.Add(paramRMATime);
            cmd.Parameters.Add(paramLastUserSysNo);
            cmd.Parameters.Add(paramUserChangedTime);
            cmd.Parameters.Add(paramRMANote);
            cmd.Parameters.Add(paramCCNote);
            cmd.Parameters.Add(paramSubmitInfo);
            cmd.Parameters.Add(paramReceiveInfo);
            cmd.Parameters.Add(paramUserStatus);

            return SqlHelper.ExecuteNonQuery(cmd);
        }
示例#15
0
文件: ROManager.cs 项目: ue96/ue96
        public ROInfo BuildROFromRMA(RMAInfo rmaInfo)
        {
            ROInfo roInfo = new ROInfo();
            SOInfo soInfo = SaleManager.GetInstance().LoadSO(rmaInfo.SOSysNo);
            roInfo.RMASysNo = rmaInfo.SysNo;
            roInfo.CreateTime = DateTime.Now;
            roInfo.CreateUserSysNo = rmaInfo.RMAUserSysNo;
            roInfo.StockSysNo = soInfo.StockSysNo;
            roInfo.Status = (int)AppEnum.ROStatus.Origin;
            roInfo.ReceiveName = soInfo.ReceiveName;
            roInfo.ReceivePhone = soInfo.ReceivePhone;
            roInfo.ReceiveAddress = soInfo.ReceiveAddress;
            roInfo.PointAmt = 0;
            roInfo.CashAmt = 0m;
            roInfo.RedeemAmt = 0m;
            Hashtable leftHash = RMAManager.GetInstance().GetLeftRMAQty(rmaInfo.SOSysNo);
            decimal originCashAmt = 0m;
            int originPointAmt = 0;
            foreach (RMAItemInfo rmaItem in rmaInfo.ItemHash.Values)
            {
                if (rmaItem.RMAType == (int)AppEnum.RMAType.Return)
                {
                    ROItemInfo roItem = new ROItemInfo();
                    roItem.ProductSysNo = rmaItem.ProductSysNo;
                    roItem.Quantity = rmaItem.RMAQty;
                    if (roItem.Quantity > (int)leftHash[(int)roItem.ProductSysNo])
                        throw new BizException("Too many item(" + roItem.ProductSysNo + ") to return");
                    foreach (SOItemInfo soItem in soInfo.ItemHash.Values)
                    {
                        if (soItem.ProductSysNo == rmaItem.ProductSysNo)
                        {
                            roItem.Price = soItem.Price;
                            roItem.Point = soItem.Point;
                            roItem.Cost = soItem.Cost;
                            roItem.Weight = soItem.Weight;
                            roItem.RefundPoint = soItem.Point;
                            roItem.RefundCash = soItem.Price;
                            roItem.ReturnPriceType = (int)AppEnum.ReturnPriceType.InputPrice;
                            roItem.ReturnType = (int)AppEnum.ReturnType.SecondHand;
                            originCashAmt += roItem.Price * roItem.Quantity;
                            originPointAmt += roItem.Point * roItem.Quantity;
                            break;
                        }
                    }
                    roInfo.ItemHash.Add(roItem.ProductSysNo, roItem);
                }
            }
            roInfo.OriginPointAmt = originPointAmt;
            roInfo.OriginCashAmt = originCashAmt;

            return roInfo;
        }