Ejemplo n.º 1
0
 /// <summary>
 /// 新建门店销售退货单
 /// </summary>
 /// <param name="model"></param>
 /// <param name="htExtAttr">扩展属性</param>
 /// <param name="DetailProductID"></param>
 /// <param name="DetailProductNo"></param>
 /// <param name="DetailProductName"></param>
 /// <param name="DetailUnitID"></param>
 /// <param name="DetailProductCount"></param>
 /// <param name="DetailBackCount"></param>
 /// <param name="DetailUnitPrice"></param>
 /// <param name="DetailTaxPrice"></param>
 /// <param name="DetailDiscount"></param>
 /// <param name="DetailTaxRate"></param>
 /// <param name="DetailTotalPrice"></param>
 /// <param name="DetailTotalFee"></param>
 /// <param name="DetailTotalTax"></param>
 /// <param name="DetailStorageID"></param>
 /// <param name="DetailFromBillID"></param>
 /// <param name="DetailFromLineNo"></param>
 /// <param name="DetailRemark"></param>
 /// <param name="length"></param>
 /// <param name="ID"></param>
 /// <returns></returns>
 public static bool InsertSubSellBack(SubSellBackModel model, Hashtable htExtAttr, string DetailProductID, string DetailProductNo, string DetailProductName, string DetailUnitID, string DetailProductCount, string DetailBackCount, string DetailUnitPrice, string DetailTaxPrice, string DetailDiscount, string DetailTaxRate, string DetailTotalPrice, string DetailTotalFee, string DetailTotalTax, string DetailStorageID, string DetailFromBillID, string DetailFromLineNo, string DetailRemark, string DetailUsedUnitID, string DetailUsedUnitCount, string DetailUsedPrice, string DetailExRate, string DetailBatchNo, string length, out string ID)
 {
     try
     {
         bool succ = false;
         LogInfoModel logModel = InitLogInfo(model.BackNo);
         logModel.Element = ConstUtil.LOG_PROCESS_INSERT;
         //设置模块ID 模块ID请在ConstUtil中定义,以便维护
         logModel.ModuleID = ConstUtil.MODULE_ID_SUBSTOREMANAGER_SUBSELLBACKADD;
         succ = SubSellBackDBHelper.InsertSubSellBack(model, htExtAttr, DetailProductID, DetailProductNo, DetailProductName, DetailUnitID, DetailProductCount, DetailBackCount, DetailUnitPrice, DetailTaxPrice, DetailDiscount, DetailTaxRate, DetailTotalPrice, DetailTotalFee, DetailTotalTax, DetailStorageID, DetailFromBillID, DetailFromLineNo, DetailRemark, DetailUsedUnitID, DetailUsedUnitCount, DetailUsedPrice, DetailExRate, DetailBatchNo, length, out ID);
         if (!succ)
             logModel.Remark = ConstUtil.LOG_PROCESS_FAILED;
         else
             logModel.Remark = ConstUtil.LOG_PROCESS_SUCCESS;
         LogDBHelper.InsertLog(logModel);
         return succ;
     }
     catch (System.Exception ex)
     {
         throw ex;
     }
 }
Ejemplo n.º 2
0
        public static bool JiesuanubSellBack(SubSellBackModel model)
        {
            #region 结算单据
            ArrayList listADD = new ArrayList();
            bool result = false;
            StringBuilder strSql = new StringBuilder();
            if (model.PayedTotal != model.WairPayTotal)
            {
                strSql.AppendLine("update officedba.SubSellBack set ");
                strSql.AppendLine(" SttlUserID=@SttlUserID");
                strSql.AppendLine(" ,SttlDate=@SttlDate");
                strSql.AppendLine(" ,BillStatus=@BillStatus");
                strSql.AppendLine(" ,BusiStatus=@BusiStatus");
                strSql.AppendLine(" ,PayedTotal=@PayedTotal");
                strSql.AppendLine(" ,WairPayTotal=@WairPayTotal");
                strSql.AppendLine(" where");
                strSql.AppendLine(" CompanyCD=@CompanyCD");
                strSql.AppendLine(" and ID=@ID");
                SqlCommand comm = new SqlCommand();
                comm.Parameters.Add(SqlHelper.GetParameter("@SttlUserID", model.SttlUserID));
                comm.Parameters.Add(SqlHelper.GetParameter("@SttlDate", model.SttlDate == null
                                                            ? SqlDateTime.Null
                                                            : SqlDateTime.Parse(model.SttlDate.ToString())));
                comm.Parameters.Add(SqlHelper.GetParameter("@BillStatus", model.BillStatus));
                comm.Parameters.Add(SqlHelper.GetParameter("@BusiStatus", model.BusiStatus));
                comm.Parameters.Add(SqlHelper.GetParameter("@PayedTotal", model.PayedTotal));
                comm.Parameters.Add(SqlHelper.GetParameter("@WairPayTotal", model.WairPayTotal));
                comm.Parameters.Add(SqlHelper.GetParameter("@CompanyCD", model.CompanyCD));
                comm.Parameters.Add(SqlHelper.GetParameter("@ID", model.ID));
                comm.CommandText = strSql.ToString();

                listADD.Add(comm);
            }
            else
            {
                strSql.AppendLine("update officedba.SubSellBack set ");
                strSql.AppendLine(" SttlUserID=@SttlUserID");
                strSql.AppendLine(" ,SttlDate=@SttlDate");
                strSql.AppendLine(" ,BillStatus=@BillStatus");
                strSql.AppendLine(" ,BusiStatus=@BusiStatus");
                strSql.AppendLine(" ,PayedTotal=@PayedTotal");
                strSql.AppendLine(" ,WairPayTotal=@WairPayTotal");
                strSql.AppendLine(" ,Closer=@Closer");
                strSql.AppendLine(" ,CloseDate=getdate()");
                strSql.AppendLine(" where");
                strSql.AppendLine(" CompanyCD=@CompanyCD");
                strSql.AppendLine(" and ID=@ID");
                SqlCommand comm = new SqlCommand();
                comm.Parameters.Add(SqlHelper.GetParameter("@SttlUserID", model.SttlUserID));
                comm.Parameters.Add(SqlHelper.GetParameter("@SttlDate", model.SttlDate == null
                                                            ? SqlDateTime.Null
                                                            : SqlDateTime.Parse(model.SttlDate.ToString())));
                comm.Parameters.Add(SqlHelper.GetParameter("@BillStatus", model.BillStatus));
                comm.Parameters.Add(SqlHelper.GetParameter("@BusiStatus", model.BusiStatus));
                comm.Parameters.Add(SqlHelper.GetParameter("@PayedTotal", model.PayedTotal));
                comm.Parameters.Add(SqlHelper.GetParameter("@WairPayTotal", model.WairPayTotal));
                comm.Parameters.Add(SqlHelper.GetParameter("@Closer", model.Closer));
                comm.Parameters.Add(SqlHelper.GetParameter("@CompanyCD", model.CompanyCD));
                comm.Parameters.Add(SqlHelper.GetParameter("@ID", model.ID));
                comm.CommandText = strSql.ToString();

                listADD.Add(comm);
            }
            #endregion


            try
            {
                if (SqlHelper.ExecuteTransWithArrayList(listADD))
                {
                    //ID = comm.Parameters["@ID"].Value.ToString();
                    result = true;
                }
                return result;
            }
            catch (Exception ex)
            {
                throw ex;
            }

        }
Ejemplo n.º 3
0
        public static bool RukuSubSellBack(SubSellBackModel model, string DetailBackCount, string DetailStorageID, string DetailProductID, string DetailUnitPrice, string DetailBatchNo, string length)
        {
            #region 入库单据
            ArrayList listADD = new ArrayList();
            bool result = false;
            StringBuilder strSql = new StringBuilder();
            if (model.PayedTotal != model.WairPayTotal)
            {
                strSql.AppendLine("update officedba.SubSellBack set ");
                strSql.AppendLine(" InUserID=@InUserID");
                strSql.AppendLine(" ,InDate=@InDate");
                strSql.AppendLine(" ,BillStatus=@BillStatus");
                strSql.AppendLine(" ,BusiStatus=@BusiStatus");
                strSql.AppendLine(" ,PayedTotal=@PayedTotal");
                strSql.AppendLine(" ,WairPayTotal=@WairPayTotal");
                strSql.AppendLine(" where");
                strSql.AppendLine(" CompanyCD=@CompanyCD");
                strSql.AppendLine(" and ID=@ID");
                SqlCommand comm = new SqlCommand();
                comm.Parameters.Add(SqlHelper.GetParameter("@InUserID", model.InUserID));
                comm.Parameters.Add(SqlHelper.GetParameter("@InDate", model.InDate == null
                                                            ? SqlDateTime.Null
                                                            : SqlDateTime.Parse(model.InDate.ToString())));
                comm.Parameters.Add(SqlHelper.GetParameter("@BillStatus", model.BillStatus));
                comm.Parameters.Add(SqlHelper.GetParameter("@BusiStatus", model.BusiStatus));
                comm.Parameters.Add(SqlHelper.GetParameter("@PayedTotal", model.PayedTotal));
                comm.Parameters.Add(SqlHelper.GetParameter("@WairPayTotal", model.WairPayTotal));
                comm.Parameters.Add(SqlHelper.GetParameter("@CompanyCD", model.CompanyCD));
                comm.Parameters.Add(SqlHelper.GetParameter("@ID", model.ID));
                comm.CommandText = strSql.ToString();

                listADD.Add(comm);
            }
            else
            {
                strSql.AppendLine("update officedba.SubSellBack set ");
                strSql.AppendLine(" InUserID=@InUserID");
                strSql.AppendLine(" ,InDate=@InDate");
                strSql.AppendLine(" ,Closer=@Closer");
                strSql.AppendLine(" ,CloseDate=getdate()");
                strSql.AppendLine(" ,BillStatus=@BillStatus");
                strSql.AppendLine(" ,BusiStatus=@BusiStatus");
                strSql.AppendLine(" ,PayedTotal=@PayedTotal");
                strSql.AppendLine(" ,WairPayTotal=@WairPayTotal");
                strSql.AppendLine(" where");
                strSql.AppendLine(" CompanyCD=@CompanyCD");
                strSql.AppendLine(" and ID=@ID");
                SqlCommand comm = new SqlCommand();
                comm.Parameters.Add(SqlHelper.GetParameter("@InUserID", model.InUserID));
                comm.Parameters.Add(SqlHelper.GetParameter("@InDate", model.InDate == null
                                                            ? SqlDateTime.Null
                                                            : SqlDateTime.Parse(model.InDate.ToString())));
                comm.Parameters.Add(SqlHelper.GetParameter("@Closer", model.Closer));
                comm.Parameters.Add(SqlHelper.GetParameter("@BillStatus", model.BillStatus));
                comm.Parameters.Add(SqlHelper.GetParameter("@BusiStatus", model.BusiStatus));
                comm.Parameters.Add(SqlHelper.GetParameter("@PayedTotal", model.PayedTotal));
                comm.Parameters.Add(SqlHelper.GetParameter("@WairPayTotal", model.WairPayTotal));
                comm.Parameters.Add(SqlHelper.GetParameter("@CompanyCD", model.CompanyCD));
                comm.Parameters.Add(SqlHelper.GetParameter("@ID", model.ID));
                comm.CommandText = strSql.ToString();

                listADD.Add(comm);
            }
            #endregion

            #region 入库时回写响应模块的退货数量
            try
            {

                int id = 0;
                decimal count = 0m;
                if (model.SendMode == "1")
                {//分店发货,更新分店的存量表中的现有存量,增加相应物品的退货数量
                    int lengs = Convert.ToInt32(length);
                    if (lengs > 0)
                    {
                        string[] BackCount = DetailBackCount.Split(',');
                        string[] ProductID = DetailProductID.Split(',');
                        string[] UnitPrice = DetailUnitPrice.Split(',');
                        string[] BatchNo = DetailBatchNo.Split(',');
                        for (int i = 0; i < lengs; i++)
                        {
                            #region 添加门店库存流水帐
                            SubStorageAccountModel aModel = new SubStorageAccountModel();
                            aModel.BatchNo = BatchNo[i];
                            aModel.BillNo = model.BackNo;
                            aModel.BillType = 4;
                            aModel.CompanyCD = model.CompanyCD;
                            aModel.Creator = model.Closer;
                            aModel.DeptID = model.DeptID;
                            aModel.HappenDate = DateTime.Now;
                            if (int.TryParse(ProductID[i], out id))
                            {
                                aModel.ProductID = id;
                            }
                            if (decimal.TryParse(UnitPrice[i], out count))
                            {
                                aModel.Price = count;
                            }
                            if (decimal.TryParse(BackCount[i], out count))
                            {
                                aModel.HappenCount = count;
                            }
                            aModel.PageUrl = model.Remark;
                            listADD.Add(XBase.Data.Office.SubStoreManager.SubStorageAccountDBHelper.GetCountAndInsertCommand(aModel));
                            #endregion

                            // 更新库存
                            listADD.Add(XBase.Data.Office.LogisticsDistributionManager.StorageProductQueryDBHelper.UpdateProductCount(model.CompanyCD
                                        , ProductID[i], model.DeptID.ToString(), BatchNo[i], count));
                        }
                    }
                }
                else
                {//总部发货,更新总部的分仓存量表中的现有存量,增加相应物品的退货数量
                    int lengs = Convert.ToInt32(length);
                    if (lengs > 0)
                    {
                        string[] BackCount = DetailBackCount.Split(',');
                        string[] StorageID = DetailStorageID.Split(',');
                        string[] ProductID = DetailProductID.Split(',');
                        string[] UnitPrice = DetailUnitPrice.Split(',');
                        string[] BatchNo = DetailBatchNo.Split(',');
                        for (int i = 0; i < lengs; i++)
                        {
                            #region 添加库存流水帐

                            XBase.Model.Office.StorageManager.StorageAccountModel sModel = new XBase.Model.Office.StorageManager.StorageAccountModel();
                            sModel.BatchNo = BatchNo[i];
                            sModel.BillNo = model.BackNo;
                            sModel.BillType = 22;
                            sModel.CompanyCD = model.CompanyCD;
                            sModel.Creator = model.Closer;
                            if (int.TryParse(StorageID[i], out id))
                            {
                                sModel.StorageID = id;
                            }
                            if (int.TryParse(ProductID[i], out id))
                            {
                                sModel.ProductID = id;
                            }
                            if (decimal.TryParse(UnitPrice[i], out count))
                            {
                                sModel.Price = count;
                            }
                            if (decimal.TryParse(BackCount[i], out count))
                            {
                                sModel.HappenCount = count;
                            }
                            sModel.HappenDate = DateTime.Now;
                            sModel.PageUrl = model.Remark;
                            listADD.Add(XBase.Data.Office.StorageManager.StorageAccountDBHelper.InsertStorageAccountCommand(sModel, "0"));

                            #endregion

                            // 更新库存
                            listADD.Add(XBase.Data.Office.StorageManager.StorageSearchDBHelper.UpdateProductCount(model.CompanyCD, ProductID[i], StorageID[i], BatchNo[i], count));

                        }
                    }
                }

                if (SqlHelper.ExecuteTransWithArrayList(listADD))
                {
                    result = true;
                }
                return result;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            #endregion

        }
Ejemplo n.º 4
0
        public static bool QxConfirmSubSellBack(SubSellBackModel model, string DetailBackCount, string DetailFromBillNo, string DetailFromLineNo, string length)
        {
            #region 确认单据
            ArrayList listADD = new ArrayList();
            bool result = false;
            StringBuilder strSql = new StringBuilder();
            strSql.AppendLine("update officedba.SubSellBack set ");
            strSql.AppendLine(" Confirmor=@Confirmor");
            strSql.AppendLine(" ,BillStatus=1");
            strSql.AppendLine(" ,BusiStatus=1");
            strSql.AppendLine(" ,ConfirmDate=@ConfirmDate");
            strSql.AppendLine(" where");
            strSql.AppendLine(" CompanyCD=@CompanyCD");
            strSql.AppendLine(" and ID=@ID");
            SqlCommand comm = new SqlCommand();
            comm.Parameters.Add(SqlHelper.GetParameter("@Confirmor", model.Confirmor));
            comm.Parameters.Add(SqlHelper.GetParameter("@ConfirmDate", model.ConfirmDate == null
                                                        ? SqlDateTime.Null
                                                        : SqlDateTime.Parse(model.ConfirmDate.ToString())));
            comm.Parameters.Add(SqlHelper.GetParameter("@CompanyCD", model.CompanyCD));
            comm.Parameters.Add(SqlHelper.GetParameter("@ID", model.ID));
            comm.CommandText = strSql.ToString();

            listADD.Add(comm);
            #endregion

            #region 确认时回填门店销售订单中的退货数量
            try
            {

                int lengs = Convert.ToInt32(length);
                if (lengs > 0)
                {
                    string[] BackCount = DetailBackCount.Split(',');
                    string[] FromBillNo = DetailFromBillNo.Split(',');
                    string[] FromLineNo = DetailFromLineNo.Split(',');
                    for (int i = 0; i < lengs; i++)
                    {
                        System.Text.StringBuilder cmdsql = new System.Text.StringBuilder();
                        SqlCommand comms = new SqlCommand();
                        cmdsql.AppendLine("Update  Officedba.SubSellOrderDetail set BackCount=isnull(BackCount,0)-@BackCount");
                        cmdsql.AppendLine(" where CompanyCD=@CompanyCD and OrderNo=@FromBillNo and SortNo=@FromLineNo");

                        comms.Parameters.Add(SqlHelper.GetParameter("@CompanyCD", model.CompanyCD));
                        comms.Parameters.Add(SqlHelper.GetParameter("@BackCount", BackCount[i].ToString()));
                        comms.Parameters.Add(SqlHelper.GetParameter("@FromBillNo", FromBillNo[i].ToString()));
                        comms.Parameters.Add(SqlHelper.GetParameter("@FromLineNo", FromLineNo[i].ToString()));
                        comms.CommandText = cmdsql.ToString();
                        listADD.Add(comms);
                    }
                }



                if (SqlHelper.ExecuteTransWithArrayList(listADD))
                {
                    result = true;
                }
                return result;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            #endregion

        }
Ejemplo n.º 5
0
        public static bool InsertSubSellBack(SubSellBackModel model, Hashtable htExtAttr, string DetailProductID, string DetailProductNo, string DetailProductName, string DetailUnitID, string DetailProductCount, string DetailBackCount, string DetailUnitPrice, string DetailTaxPrice, string DetailDiscount, string DetailTaxRate, string DetailTotalPrice, string DetailTotalFee, string DetailTotalTax, string DetailStorageID, string DetailFromBillID, string DetailFromLineNo, string DetailRemark, string DetailUsedUnitID, string DetailUsedUnitCount, string DetailUsedPrice, string DetailExRate, string DetailBatchNo, string length, out string ID)
        {

            ArrayList listADD = new ArrayList();
            bool result = false;
            ID = "0";

            #region  门店销售退货单添加SQL语句
            StringBuilder sqlArrive = new StringBuilder();


            sqlArrive.AppendLine("INSERT INTO officedba.SubSellBack");
            sqlArrive.AppendLine("(CompanyCD,DeptID,BackNo,Title,OrderID,SendMode,Seller,CustName,CustTel,CustMobile,CustAddr,BackDate,BackReason,");
            sqlArrive.AppendLine("BusiStatus,CurrencyType,Rate,TotalPrice,Tax,TotalFee,Discount,DiscountTotal,RealTotal,PayedTotal,WairPayTotal,");
            sqlArrive.AppendLine("isAddTax,CountTotal,Remark,Attachment,BillStatus,Creator,CreateDate,Confirmor,ConfirmDate,OutUserID,OutDate,");
            sqlArrive.AppendLine("ModifiedDate,ModifiedUserID,FromType)");
            sqlArrive.AppendLine("VALUES (@CompanyCD,@DeptID,@BackNo,@Title,@OrderID,@SendMode,@Seller,@CustName,@CustTel,@CustMobile,@CustAddr,@BackDate,@BackReason,");
            sqlArrive.AppendLine("@BusiStatus,@CurrencyType,@Rate,@TotalPrice,@Tax,@TotalFee,@Discount,@DiscountTotal,@RealTotal,@PayedTotal,@WairPayTotal,");
            sqlArrive.AppendLine("@isAddTax,@CountTotal,@Remark,@Attachment,@BillStatus,@Creator,@CreateDate,@Confirmor,@ConfirmDate,@OutUserID,@OutDate,");
            sqlArrive.AppendLine("getdate(),@ModifiedUserID,@FromType)");
            sqlArrive.AppendLine("set @ID=@@IDENTITY");

            SqlCommand comm = new SqlCommand();
            comm.Parameters.Add(SqlHelper.GetParameter("@CompanyCD", model.CompanyCD));
            comm.Parameters.Add(SqlHelper.GetParameter("@DeptID", model.DeptID));
            comm.Parameters.Add(SqlHelper.GetParameter("@BackNo", model.BackNo));
            comm.Parameters.Add(SqlHelper.GetParameter("@Title", model.Title));
            comm.Parameters.Add(SqlHelper.GetParameter("@OrderID", model.OrderID));
            comm.Parameters.Add(SqlHelper.GetParameter("@SendMode", model.SendMode));
            comm.Parameters.Add(SqlHelper.GetParameter("@Seller", model.Seller));
            comm.Parameters.Add(SqlHelper.GetParameter("@CustName", model.CustName));
            comm.Parameters.Add(SqlHelper.GetParameter("@CustTel", model.CustTel));
            comm.Parameters.Add(SqlHelper.GetParameter("@CustMobile", model.CustMobile));
            comm.Parameters.Add(SqlHelper.GetParameter("@CustAddr", model.CustAddr));
            comm.Parameters.Add(SqlHelper.GetParameter("@BackDate", model.BackDate == null
                                                        ? SqlDateTime.Null
                                                        : SqlDateTime.Parse(model.BackDate.ToString())));
            comm.Parameters.Add(SqlHelper.GetParameter("@BackReason", model.BackReason));
            comm.Parameters.Add(SqlHelper.GetParameter("@BusiStatus", model.BusiStatus));
            comm.Parameters.Add(SqlHelper.GetParameter("@CurrencyType", model.CurrencyType));
            comm.Parameters.Add(SqlHelper.GetParameter("@Rate", model.Rate));
            comm.Parameters.Add(SqlHelper.GetParameter("@TotalPrice", model.TotalPrice));
            comm.Parameters.Add(SqlHelper.GetParameter("@Tax", model.Tax));
            comm.Parameters.Add(SqlHelper.GetParameter("@TotalFee", model.TotalFee));
            comm.Parameters.Add(SqlHelper.GetParameter("@Discount", model.Discount));
            comm.Parameters.Add(SqlHelper.GetParameter("@DiscountTotal", model.DiscountTotal));
            comm.Parameters.Add(SqlHelper.GetParameter("@RealTotal", model.RealTotal));
            comm.Parameters.Add(SqlHelper.GetParameter("@PayedTotal", model.PayedTotal));
            comm.Parameters.Add(SqlHelper.GetParameter("@WairPayTotal", model.WairPayTotal));
            comm.Parameters.Add(SqlHelper.GetParameter("@isAddTax", model.isAddTax));
            comm.Parameters.Add(SqlHelper.GetParameter("@CountTotal", model.CountTotal));
            comm.Parameters.Add(SqlHelper.GetParameter("@Remark", model.Remark));
            comm.Parameters.Add(SqlHelper.GetParameter("@Attachment", model.Attachment));
            comm.Parameters.Add(SqlHelper.GetParameter("@BillStatus", model.BillStatus));
            comm.Parameters.Add(SqlHelper.GetParameter("@Creator", model.Creator));
            comm.Parameters.Add(SqlHelper.GetParameter("@CreateDate", model.CreateDate == null
                                                        ? SqlDateTime.Null
                                                        : SqlDateTime.Parse(model.CreateDate.ToString())));
            comm.Parameters.Add(SqlHelper.GetParameter("@Confirmor", model.Confirmor));
            comm.Parameters.Add(SqlHelper.GetParameter("@ConfirmDate", model.ConfirmDate == null
                                                        ? SqlDateTime.Null
                                                        : SqlDateTime.Parse(model.ConfirmDate.ToString())));
            comm.Parameters.Add(SqlHelper.GetParameter("@OutUserID", model.OutUserID));
            comm.Parameters.Add(SqlHelper.GetParameter("@OutDate", model.OutDate == null
                                                        ? SqlDateTime.Null
                                                        : SqlDateTime.Parse(model.OutDate.ToString())));
            comm.Parameters.Add(SqlHelper.GetParameter("@SttlUserID", model.SttlUserID));
            comm.Parameters.Add(SqlHelper.GetParameter("@ModifiedUserID", model.ModifiedUserID));
            comm.Parameters.Add(SqlHelper.GetParameter("@FromType", model.FromType));
            comm.Parameters.Add(SqlHelper.GetOutputParameter("@ID", SqlDbType.Int));
            comm.CommandText = sqlArrive.ToString();


            listADD.Add(comm);

            // 更新扩展属性
            SqlCommand commExtAttr = UpdateExtAttr(model, htExtAttr);
            if (commExtAttr != null)
            {
                listADD.Add(commExtAttr);
            }
            #endregion


            try
            {
                #region 门店销售退货单明细
                int lengs = Convert.ToInt32(length);
                if (lengs > 0)
                {
                    string[] ProductID = DetailProductID.Split(',');
                    string[] ProductNo = DetailProductNo.Split(',');
                    string[] ProductName = DetailProductName.Split(',');
                    string[] UnitID = DetailUnitID.Split(',');
                    string[] ProductCount = DetailProductCount.Split(',');
                    string[] BackCount = DetailBackCount.Split(',');
                    string[] UnitPrice = DetailUnitPrice.Split(',');
                    string[] TaxPrice = DetailTaxPrice.Split(',');
                    string[] Discount = DetailDiscount.Split(',');
                    string[] TaxRate = DetailTaxRate.Split(',');
                    string[] TotalPrice = DetailTotalPrice.Split(',');
                    string[] TotalFee = DetailTotalFee.Split(',');
                    string[] TotalTax = DetailTotalTax.Split(',');
                    string[] StorageID = DetailStorageID.Split(',');
                    string[] FromBillID = DetailFromBillID.Split(',');
                    string[] FromLineNo = DetailFromLineNo.Split(',');
                    string[] Remark = DetailRemark.Split(',');
                    string[] UsedUnitID = DetailUsedUnitID.Split(',');
                    string[] UsedUnitCount = DetailUsedUnitCount.Split(',');
                    string[] UsedPrice = DetailUsedPrice.Split(',');
                    string[] ExRate = DetailExRate.Split(',');
                    string[] BatchNo = DetailBatchNo.Split(',');
                    for (int i = 0; i < lengs; i++)
                    {
                        System.Text.StringBuilder cmdsql = new System.Text.StringBuilder();
                        SqlCommand comms = new SqlCommand();
                        cmdsql.AppendLine("INSERT INTO officedba.SubSellBackDetail");
                        cmdsql.AppendLine("(CompanyCD,");
                        cmdsql.AppendLine("DeptID,");
                        if (FromBillID[i].ToString().Length > 0)
                        {
                            if (!string.IsNullOrEmpty(FromBillID[i].ToString().Trim()))
                            {
                                cmdsql.AppendLine("OrderID,");
                            }
                        }
                        cmdsql.AppendLine("SortNo,");
                        cmdsql.AppendLine("BackNo,");
                        cmdsql.AppendLine("ProductID,");
                        if (StorageID[i].ToString().Length > 0)
                        {
                            if (!string.IsNullOrEmpty(StorageID[i].ToString().Trim()))
                            {
                                cmdsql.AppendLine("StorageID,");
                            }
                        }
                        cmdsql.AppendLine("BackCount,");
                        cmdsql.AppendLine("UnitID,");
                        cmdsql.AppendLine("UnitPrice,");
                        cmdsql.AppendLine("TaxPrice,");
                        cmdsql.AppendLine("Discount,");
                        cmdsql.AppendLine("TaxRate,");
                        cmdsql.AppendLine("TotalFee,");
                        cmdsql.AppendLine("TotalPrice,");
                        if (Remark[i].ToString().Length > 0)
                        {
                            if (!string.IsNullOrEmpty(Remark[i].ToString().Trim()))
                            {
                                cmdsql.AppendLine("Remark,");
                            }
                        }
                        if (FromLineNo[i].ToString().Length > 0)
                        {
                            if (!string.IsNullOrEmpty(FromLineNo[i].ToString().Trim()))
                            {
                                cmdsql.AppendLine("FromLineNo,");
                            }
                        }
                        cmdsql.AppendLine("UsedUnitID,");
                        cmdsql.AppendLine("UsedUnitCount,");
                        cmdsql.AppendLine("UsedPrice,");
                        cmdsql.AppendLine("ExRate,");
                        cmdsql.AppendLine("BatchNo,");
                        cmdsql.AppendLine("TotalTax)");


                        cmdsql.AppendLine(" Values(@CompanyCD");
                        cmdsql.AppendLine("            ,@DeptID");
                        if (FromBillID[i].ToString().Length > 0)
                        {
                            if (!string.IsNullOrEmpty(FromBillID[i].ToString().Trim()))
                            {
                                cmdsql.AppendLine("            ,@OrderID");
                            }
                        }
                        cmdsql.AppendLine("            ,@SortNo");
                        cmdsql.AppendLine("            ,@BackNo");
                        cmdsql.AppendLine("            ,@ProductID");
                        if (StorageID[i].ToString().Length > 0)
                        {
                            if (!string.IsNullOrEmpty(StorageID[i].ToString().Trim()))
                            {
                                cmdsql.AppendLine("            ,@StorageID");
                            }
                        }
                        cmdsql.AppendLine("            ,@BackCount");
                        cmdsql.AppendLine("            ,@UnitID");
                        cmdsql.AppendLine("            ,@UnitPrice");
                        cmdsql.AppendLine("            ,@TaxPrice");
                        cmdsql.AppendLine("            ,@Discount");
                        cmdsql.AppendLine("            ,@TaxRate");
                        cmdsql.AppendLine("            ,@TotalFee");
                        cmdsql.AppendLine("            ,@TotalPrice");
                        if (Remark[i].ToString().Length > 0)
                        {
                            if (!string.IsNullOrEmpty(Remark[i].ToString().Trim()))
                            {
                                cmdsql.AppendLine("            ,@Remark");
                            }
                        }
                        if (FromLineNo[i].ToString().Length > 0)
                        {
                            if (!string.IsNullOrEmpty(FromLineNo[i].ToString().Trim()))
                            {
                                cmdsql.AppendLine("            ,@FromLineNo");
                            }
                        }
                        cmdsql.AppendLine("            ,@UsedUnitID");
                        cmdsql.AppendLine("            ,@UsedUnitCount");
                        cmdsql.AppendLine("            ,@UsedPrice");
                        cmdsql.AppendLine("            ,@ExRate");
                        cmdsql.AppendLine("            ,@BatchNo");
                        cmdsql.AppendLine("            ,@TotalTax)");


                        comms.Parameters.Add(SqlHelper.GetParameter("@CompanyCD", model.CompanyCD));
                        comms.Parameters.Add(SqlHelper.GetParameter("@DeptID", model.DeptID));
                        if (FromBillID[i].ToString().Length > 0)
                        {
                            if (!string.IsNullOrEmpty(FromBillID[i].ToString().Trim()))
                            {
                                comms.Parameters.Add(SqlHelper.GetParameter("@OrderID", FromBillID[i].ToString()));
                            }
                        }
                        comms.Parameters.Add(SqlHelper.GetParameter("@SortNo", i + 1));
                        comms.Parameters.Add(SqlHelper.GetParameter("@BackNo", model.BackNo));
                        comms.Parameters.Add(SqlHelper.GetParameter("@ProductID", ProductID[i].ToString()));
                        if (StorageID[i].ToString().Length > 0)
                        {
                            if (!string.IsNullOrEmpty(StorageID[i].ToString().Trim()))
                            {
                                comms.Parameters.Add(SqlHelper.GetParameter("@StorageID", StorageID[i].ToString()));
                            }
                        }
                        comms.Parameters.Add(SqlHelper.GetParameter("@BackCount", BackCount[i].ToString()));
                        comms.Parameters.Add(SqlHelper.GetParameter("@UnitID", UnitID[i].ToString()));
                        comms.Parameters.Add(SqlHelper.GetParameter("@UnitPrice", UnitPrice[i].ToString()));
                        comms.Parameters.Add(SqlHelper.GetParameter("@TaxPrice", TaxPrice[i].ToString()));
                        comms.Parameters.Add(SqlHelper.GetParameter("@Discount", Discount[i].ToString()));
                        comms.Parameters.Add(SqlHelper.GetParameter("@TaxRate", TaxRate[i].ToString()));
                        comms.Parameters.Add(SqlHelper.GetParameter("@TotalFee", TotalFee[i].ToString()));
                        comms.Parameters.Add(SqlHelper.GetParameter("@TotalPrice", TotalPrice[i].ToString()));
                        if (Remark[i].ToString().Length > 0)
                        {
                            if (!string.IsNullOrEmpty(Remark[i].ToString().Trim()))
                            {
                                comms.Parameters.Add(SqlHelper.GetParameter("@Remark", Remark[i].ToString()));
                            }
                        }
                        if (FromLineNo[i].ToString().Length > 0)
                        {
                            if (!string.IsNullOrEmpty(FromLineNo[i].ToString().Trim()))
                            {
                                comms.Parameters.Add(SqlHelper.GetParameter("@FromLineNo", FromLineNo[i].ToString()));
                            }
                        }
                        comms.Parameters.Add(SqlHelper.GetParameter("@UsedUnitID", UsedUnitID[i].ToString()));
                        comms.Parameters.Add(SqlHelper.GetParameter("@UsedUnitCount", UsedUnitCount[i].ToString()));
                        comms.Parameters.Add(SqlHelper.GetParameter("@UsedPrice", UsedPrice[i].ToString()));
                        comms.Parameters.Add(SqlHelper.GetParameter("@ExRate", ExRate[i].ToString()));
                        comms.Parameters.Add(SqlHelper.GetParameter("@BatchNo", BatchNo[i].ToString()));
                        comms.Parameters.Add(SqlHelper.GetParameter("@TotalTax", TotalTax[i].ToString()));
                        comms.CommandText = cmdsql.ToString();
                        listADD.Add(comms);
                    }
                }
                #endregion


                if (SqlHelper.ExecuteTransWithArrayList(listADD))
                {
                    ID = comm.Parameters["@ID"].Value.ToString();
                    result = true;
                }
                return result;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 扩展属性更新命令
        /// </summary>
        /// <param name="model">分店销售退货单</param>
        /// <param name="htExtAttr">扩展属性</param>
        /// <returns></returns>
        public static SqlCommand UpdateExtAttr(SubSellBackModel model, Hashtable htExtAttr)
        {
            SqlCommand sqlcomm = new SqlCommand();
            if (htExtAttr == null || htExtAttr.Count < 1)
            {// 没有属性需要修改
                return null;
            }

            StringBuilder sb = new StringBuilder(" UPDATE officedba.SubSellBack SET ");
            foreach (DictionaryEntry de in htExtAttr)// fileht为一个Hashtable实例
            {
                sb.AppendFormat(" {0}=@{0},", de.Key.ToString());
                sqlcomm.Parameters.Add(SqlHelper.GetParameter(String.Format("@{0}", de.Key.ToString()), de.Value));
            }
            string strSql = sb.ToString();
            strSql = strSql.TrimEnd(',');
            strSql += " WHERE CompanyCD = @CompanyCD  AND BackNo = @BackNo ";
            sqlcomm.Parameters.Add(SqlHelper.GetParameter("@CompanyCD", model.CompanyCD));
            sqlcomm.Parameters.Add(SqlHelper.GetParameter("@BackNo", model.BackNo));
            sqlcomm.CommandText = strSql;

            return sqlcomm;
        }
Ejemplo n.º 7
0
 public static bool JiesuanubSellBack(SubSellBackModel model)
 {
     return SubSellBackDBHelper.JiesuanubSellBack(model);
 }
Ejemplo n.º 8
0
 public static bool RukuSubSellBack(SubSellBackModel model, string DetailBackCount, string DetailStorageID, string DetailProductID, string DetailUnitPrice, string DetailBatchNo, string length)
 {
     return SubSellBackDBHelper.RukuSubSellBack(model, DetailBackCount, DetailStorageID, DetailProductID, DetailUnitPrice, DetailBatchNo, length);
 }
Ejemplo n.º 9
0
 public static bool QxConfirmSubSellBack(SubSellBackModel model, string DetailBackCount, string DetailFromBillNo, string DetailFromLineNo, string length)
 {
     return SubSellBackDBHelper.QxConfirmSubSellBack(model, DetailBackCount, DetailFromBillNo, DetailFromLineNo, length);
 }