Пример #1
0
        public RMASendAccessoryInfo BuildfromSO(int soSysNo)
        {
            RMASendAccessoryInfo rmaInfo = new RMASendAccessoryInfo();
            SOInfo soInfo = SaleManager.GetInstance().LoadSO(soSysNo);
            if (soInfo != null && soInfo.Status == (int)AppEnum.SOStatus.OutStock)
            {
                rmaInfo.SOSysNo = soInfo.SysNo;
                rmaInfo.CustomerSysNo = soInfo.CustomerSysNo;
                CustomerInfo oCustomer = CustomerManager.GetInstance().Load(soInfo.CustomerSysNo);
                rmaInfo.Address = soInfo.ReceiveAddress != AppConst.StringNull ? soInfo.ReceiveAddress : (oCustomer.ReceiveAddress != AppConst.StringNull ? oCustomer.ReceiveAddress : (oCustomer.DwellAddress != AppConst.StringNull ? oCustomer.DwellAddress : "无"));
                rmaInfo.Contact = soInfo.ReceiveContact != AppConst.StringNull ? soInfo.ReceiveContact : (oCustomer.ReceiveContact != AppConst.StringNull ? oCustomer.ReceiveContact : (oCustomer.CustomerName != AppConst.StringNull ? oCustomer.CustomerName : "无"));
                rmaInfo.CreateTime = DateTime.Now;
                if (soInfo.ReceivePhone != AppConst.StringNull)
                    rmaInfo.Phone = soInfo.ReceivePhone;
                if (soInfo.ReceiveCellPhone != AppConst.StringNull)
                    rmaInfo.Phone += "  " + soInfo.ReceiveCellPhone;
                rmaInfo.AreaSysNo = soInfo.ReceiveAreaSysNo;
                if (soInfo.ItemHash.Count > 0)
                {
                    int j = 0;
                    foreach (SOItemInfo soItem in soInfo.ItemHash.Values)
                    {
                        if (soItem.ProductType == (int)AppEnum.SOItemType.Promotion)
                            continue;  //这里排除优惠券。

                        if (soItem.Quantity > 0)
                        {
                            Hashtable htTemp = new Hashtable(1);
                            htTemp.Add("SOItemSysNo", soItem.SysNo.ToString());
                            DataSet dsTemp = SaleManager.GetInstance().GetSOProductIDSysNoList(htTemp);

                            int rowCount = 0;
                            if (Util.HasMoreRow(dsTemp))
                                rowCount = dsTemp.Tables[0].Rows.Count;

                            for (int i = 1; i <= soItem.Quantity; i++)
                            {
                                RMASendAccessoryItemInfo rmaItem = new RMASendAccessoryItemInfo();
                                rmaItem.ProductSysNo = soItem.ProductSysNo;
                                rmaItem.AccessoryType=
                                rmaItem.AccessoryType = (int)AppEnum.RMAAccessoryType.Accessory;

                                if (i <= rowCount)
                                {
                                    int POSysNo = Util.TrimIntNull(dsTemp.Tables[0].Rows[i - 1]["posysno"].ToString());
                                    int ProductIDSysNo = Util.TrimIntNull(dsTemp.Tables[0].Rows[i - 1]["ProductIDSysNo"]);
                                    if (POSysNo > 0)
                                    {
                                        rmaItem.SOItemPODesc = "采购单号:<a href=\"javascript:openWindowS2('../Purchase/POSheet.aspx?sysno=" + POSysNo + "&opt=view')" + "\" >" + POSysNo + "</a><br>";
                                    }
                                    else if (ProductIDSysNo > 0)
                                    {
                                        rmaItem.SOItemPODesc = "商品序列号:<a href=\"javascript:openWindowS2('../Basic/ProductID.aspx?sysno=" + ProductIDSysNo + "')" + "\" >" + ProductIDSysNo + "</a><br>";
                                    }
                                    rmaItem.ProductIDSysNo = ProductIDSysNo;
                                    rmaItem.AccessoryType =(int) AppEnum.RMAAccessoryType.Accessory;
                                }
                                rmaInfo.ItemHash.Add(j, rmaItem);
                                j = j + 1;
                            }
                        }
                    }
                }
            }
            else
                rmaInfo = null;
            return rmaInfo;
        }
Пример #2
0
 public void UpdateItem(RMASendAccessoryItemInfo oParam)
 {
     new RMASendAccessoryDac().UpdateItem(oParam);
 }
Пример #3
0
 private void mapItem(RMASendAccessoryItemInfo oParam, DataRow tempdr)
 {
     oParam.SysNo = Util.TrimIntNull(tempdr["SysNo"]);
        oParam.SendAccessorySysNo = Util.TrimIntNull(tempdr["SendAccessorySysNo"]);
        oParam.SOSysNo = Util.TrimIntNull(tempdr["SOSysNo"]);
        oParam.ProductSysNo = Util.TrimIntNull(tempdr["ProductSysNo"]);
        oParam.ProductIDSysNo = Util.TrimIntNull(tempdr["ProductIDSysNo"]);
        oParam.NewProductSysNo = Util.TrimIntNull(tempdr["NewProductSysNo"]);
        oParam.NewProductQty = Util.TrimIntNull(tempdr["NewProductQty"]);
        oParam.NewProductIDSysNo = Util.TrimIntNull(tempdr["NewProductIDSysNo"]);
        oParam.AccessoryType = Util.TrimIntNull(tempdr["AccessoryType"]);
        oParam.AccessoryName = Util.TrimNull(tempdr["AccessoryName"]);
        oParam.SOItemPODesc = Util.TrimNull(tempdr["SOItemPODesc"]);
        oParam.Note = Util.TrimNull(tempdr["Note"]);
 }
Пример #4
0
 public RMASendAccessoryItemInfo LoadItem(int productSysNo, int saSysNo)
 {
     try
        {
        RMASendAccessoryItemInfo oInfo = new RMASendAccessoryItemInfo();
        string sql = "select * from RMA_SendAccessory_Item (NOLOCK) where productSysNo=" + productSysNo + "and SendAccessorySysNo=" + saSysNo;
        DataSet ds = SqlHelper.ExecuteDataSet(sql);
        if (Util.HasMoreRow(ds))
        {
            DataRow dr = ds.Tables[0].Rows[0];
            mapItem(oInfo, dr);
        }
        return oInfo;
        }
        catch
        {
        throw new BizException("Load RMASendAccessoryItemInfo Error!");
        }
 }
Пример #5
0
 public RMASendAccessoryInfo Load(int sysno)
 {
     try
        {
        RMASendAccessoryInfo oInfo = new RMASendAccessoryInfo();
        string sql = "select * from RMA_SendAccessory (NOLOCK) where sysno=" + sysno;
        DataSet ds = SqlHelper.ExecuteDataSet(sql);
        if (Util.HasMoreRow(ds))
        {
            DataRow dr = ds.Tables[0].Rows[0];
             map(oInfo,dr);
            string itemSql = @"select RMA_SendAccessory_Item.*
                                from   RMA_SendAccessory_Item (NOLOCK)
                                inner join  RMA_SendAccessory (NOLOCK) on RMA_SendAccessory_Item.SendAccessorySysNo = RMA_SendAccessory.SysNo
                                where RMA_SendAccessory.sysno=" + sysno;
            DataSet itemds = SqlHelper.ExecuteDataSet(itemSql);
            if (Util.HasMoreRow(itemds))
            {
                foreach (DataRow itemdr in itemds.Tables[0].Rows)
                {
                    RMASendAccessoryItemInfo oSAItem = new RMASendAccessoryItemInfo();
                    mapItem(oSAItem, itemdr);
                    oInfo.ItemHash.Add(Util.TrimIntNull(itemdr["SysNo"]), oSAItem);
                }
            }
        }
        return oInfo;
        }
        catch
        {
        throw new BizException("Load RMASendAccessoryInfo Error!");
        }
 }
Пример #6
0
 public void InsertSentAccessoryItem(RMASendAccessoryItemInfo oInfo)
 {
     new RMASendAccessoryDac().InsertItem(oInfo);
 }
Пример #7
0
        public int UpdateItem(RMASendAccessoryItemInfo oParam)
        {
            string sql = @"UPDATE RMA_SendAccessory_Item SET
                            SendAccessorySysNo=@SendAccessorySysNo, SOSysNo=@SOSysNo,
                            ProductSysNo=@ProductSysNo, ProductIDSysNo=@ProductIDSysNo,
                            NewProductSysNo=@NewProductSysNo, NewProductQty=@NewProductQty,
                            NewProductIDSysNo=@NewProductIDSysNo, AccessoryType=@AccessoryType,
                            AccessoryName=@AccessoryName, SOItemPODesc=@SOItemPODesc,
                            Note=@Note
                            WHERE SysNo=@SysNo";
              SqlCommand cmd = new SqlCommand(sql);

              SqlParameter paramSysNo = new SqlParameter("@SysNo", SqlDbType.Int, 4);
              SqlParameter paramSendAccessorySysNo = new SqlParameter("@SendAccessorySysNo", SqlDbType.Int, 4);
              SqlParameter paramSOSysNo = new SqlParameter("@SOSysNo", SqlDbType.Int, 4);
              SqlParameter paramProductSysNo = new SqlParameter("@ProductSysNo", SqlDbType.Int, 4);
              SqlParameter paramProductIDSysNo = new SqlParameter("@ProductIDSysNo", SqlDbType.Int, 4);
              SqlParameter paramNewProductSysNo = new SqlParameter("@NewProductSysNo", SqlDbType.Int, 4);
              SqlParameter paramNewProductQty = new SqlParameter("@NewProductQty", SqlDbType.Int, 4);
              SqlParameter paramNewProductIDSysNo = new SqlParameter("@NewProductIDSysNo", SqlDbType.Int, 4);
              SqlParameter paramAccessoryType = new SqlParameter("@AccessoryType", SqlDbType.Int, 4);
              SqlParameter paramAccessoryName = new SqlParameter("@AccessoryName", SqlDbType.NVarChar, 100);
              SqlParameter paramSOItemPODesc = new SqlParameter("@SOItemPODesc", SqlDbType.NVarChar, 200);
              SqlParameter paramNote = new SqlParameter("@Note", SqlDbType.NVarChar, 200);

              if (oParam.SysNo != AppConst.IntNull)
              paramSysNo.Value = oParam.SysNo;
              else
              paramSysNo.Value = System.DBNull.Value;
              if (oParam.SendAccessorySysNo != AppConst.IntNull)
              paramSendAccessorySysNo.Value = oParam.SendAccessorySysNo;
              else
              paramSendAccessorySysNo.Value = System.DBNull.Value;
              if (oParam.SOSysNo != AppConst.IntNull)
              paramSOSysNo.Value = oParam.SOSysNo;
              else
              paramSOSysNo.Value = System.DBNull.Value;
              if (oParam.ProductSysNo != AppConst.IntNull)
              paramProductSysNo.Value = oParam.ProductSysNo;
              else
              paramProductSysNo.Value = System.DBNull.Value;
              if (oParam.ProductIDSysNo != AppConst.IntNull)
              paramProductIDSysNo.Value = oParam.ProductIDSysNo;
              else
              paramProductIDSysNo.Value = System.DBNull.Value;
              if (oParam.NewProductSysNo != AppConst.IntNull)
              paramNewProductSysNo.Value = oParam.NewProductSysNo;
              else
              paramNewProductSysNo.Value = System.DBNull.Value;
              if (oParam.NewProductQty != AppConst.IntNull)
              paramNewProductQty.Value = oParam.NewProductQty;
              else
              paramNewProductQty.Value = System.DBNull.Value;
              if (oParam.NewProductIDSysNo != AppConst.IntNull)
              paramNewProductIDSysNo.Value = oParam.NewProductIDSysNo;
              else
              paramNewProductIDSysNo.Value = System.DBNull.Value;
              if (oParam.AccessoryType != AppConst.IntNull)
              paramAccessoryType.Value = oParam.AccessoryType;
              else
              paramAccessoryType.Value = System.DBNull.Value;
              if (oParam.AccessoryName != AppConst.StringNull)
              paramAccessoryName.Value = oParam.AccessoryName;
              else
              paramAccessoryName.Value = System.DBNull.Value;
              if (oParam.SOItemPODesc != AppConst.StringNull)
              paramSOItemPODesc.Value = oParam.SOItemPODesc;
              else
              paramSOItemPODesc.Value = System.DBNull.Value;
              if (oParam.Note != AppConst.StringNull)
              paramNote.Value = oParam.Note;
              else
              paramNote.Value = System.DBNull.Value;

              cmd.Parameters.Add(paramSysNo);
              cmd.Parameters.Add(paramSendAccessorySysNo);
              cmd.Parameters.Add(paramSOSysNo);
              cmd.Parameters.Add(paramProductSysNo);
              cmd.Parameters.Add(paramProductIDSysNo);
              cmd.Parameters.Add(paramNewProductSysNo);
              cmd.Parameters.Add(paramNewProductQty);
              cmd.Parameters.Add(paramNewProductIDSysNo);
              cmd.Parameters.Add(paramAccessoryType);
              cmd.Parameters.Add(paramAccessoryName);
              cmd.Parameters.Add(paramSOItemPODesc);
              cmd.Parameters.Add(paramNote);

              return SqlHelper.ExecuteNonQuery(cmd);
        }
Пример #8
0
        public int InsertItem(RMASendAccessoryItemInfo oParam)
        {
            string sql = @"INSERT INTO RMA_SendAccessory_Item
                            (
                            SendAccessorySysNo, SOSysNo, ProductSysNo, ProductIDSysNo,
                            NewProductSysNo, NewProductQty, NewProductIDSysNo, AccessoryType,
                            AccessoryName, SOItemPODesc, Note
                            )
                            VALUES (
                            @SendAccessorySysNo, @SOSysNo, @ProductSysNo, @ProductIDSysNo,
                            @NewProductSysNo, @NewProductQty, @NewProductIDSysNo, @AccessoryType,
                            @AccessoryName, @SOItemPODesc, @Note
                            );set @SysNo = SCOPE_IDENTITY();";
              SqlCommand cmd = new SqlCommand(sql);

              SqlParameter paramSysNo = new SqlParameter("@SysNo", SqlDbType.Int, 4);
              SqlParameter paramSendAccessorySysNo = new SqlParameter("@SendAccessorySysNo", SqlDbType.Int, 4);
              SqlParameter paramSOSysNo = new SqlParameter("@SOSysNo", SqlDbType.Int, 4);
              SqlParameter paramProductSysNo = new SqlParameter("@ProductSysNo", SqlDbType.Int, 4);
              SqlParameter paramProductIDSysNo = new SqlParameter("@ProductIDSysNo", SqlDbType.Int, 4);
              SqlParameter paramNewProductSysNo = new SqlParameter("@NewProductSysNo", SqlDbType.Int, 4);
              SqlParameter paramNewProductQty = new SqlParameter("@NewProductQty", SqlDbType.Int, 4);
              SqlParameter paramNewProductIDSysNo = new SqlParameter("@NewProductIDSysNo", SqlDbType.Int, 4);
              SqlParameter paramAccessoryType = new SqlParameter("@AccessoryType", SqlDbType.Int, 4);
              SqlParameter paramAccessoryName = new SqlParameter("@AccessoryName", SqlDbType.NVarChar, 100);
              SqlParameter paramSOItemPODesc = new SqlParameter("@SOItemPODesc", SqlDbType.NVarChar, 200);
              SqlParameter paramNote = new SqlParameter("@Note", SqlDbType.NVarChar, 200);
              paramSysNo.Direction = ParameterDirection.Output;
              if (oParam.SendAccessorySysNo != AppConst.IntNull)
              paramSendAccessorySysNo.Value = oParam.SendAccessorySysNo;
              else
              paramSendAccessorySysNo.Value = System.DBNull.Value;
              if (oParam.SOSysNo != AppConst.IntNull)
              paramSOSysNo.Value = oParam.SOSysNo;
              else
              paramSOSysNo.Value = System.DBNull.Value;
              if (oParam.ProductSysNo != AppConst.IntNull)
              paramProductSysNo.Value = oParam.ProductSysNo;
              else
              paramProductSysNo.Value = System.DBNull.Value;
              if (oParam.ProductIDSysNo != AppConst.IntNull)
              paramProductIDSysNo.Value = oParam.ProductIDSysNo;
              else
              paramProductIDSysNo.Value = System.DBNull.Value;
              if (oParam.NewProductSysNo != AppConst.IntNull)
              paramNewProductSysNo.Value = oParam.NewProductSysNo;
              else
              paramNewProductSysNo.Value = System.DBNull.Value;
              if (oParam.NewProductQty != AppConst.IntNull)
              paramNewProductQty.Value = oParam.NewProductQty;
              else
              paramNewProductQty.Value = System.DBNull.Value;
              if (oParam.NewProductIDSysNo != AppConst.IntNull)
              paramNewProductIDSysNo.Value = oParam.NewProductIDSysNo;
              else
              paramNewProductIDSysNo.Value = System.DBNull.Value;
              if (oParam.AccessoryType != AppConst.IntNull)
              paramAccessoryType.Value = oParam.AccessoryType;
              else
              paramAccessoryType.Value = System.DBNull.Value;
              if (oParam.AccessoryName != AppConst.StringNull)
              paramAccessoryName.Value = oParam.AccessoryName;
              else
              paramAccessoryName.Value = System.DBNull.Value;
              if (oParam.SOItemPODesc != AppConst.StringNull)
              paramSOItemPODesc.Value = oParam.SOItemPODesc;
              else
              paramSOItemPODesc.Value = System.DBNull.Value;
              if (oParam.Note != AppConst.StringNull)
              paramNote.Value = oParam.Note;
              else
              paramNote.Value = System.DBNull.Value;

              cmd.Parameters.Add(paramSysNo);
              cmd.Parameters.Add(paramSendAccessorySysNo);
              cmd.Parameters.Add(paramSOSysNo);
              cmd.Parameters.Add(paramProductSysNo);
              cmd.Parameters.Add(paramProductIDSysNo);
              cmd.Parameters.Add(paramNewProductSysNo);
              cmd.Parameters.Add(paramNewProductQty);
              cmd.Parameters.Add(paramNewProductIDSysNo);
              cmd.Parameters.Add(paramAccessoryType);
              cmd.Parameters.Add(paramAccessoryName);
              cmd.Parameters.Add(paramSOItemPODesc);
              cmd.Parameters.Add(paramNote);

              return SqlHelper.ExecuteNonQuery(cmd, out oParam.SysNo);
        }