/// <summary> /// 扩展属性保存操作 /// </summary> /// <returns></returns> private static void GetExtAttrCmd(PurchaseRejectModel model, Hashtable htExtAttr, SqlCommand cmd) { try { string strSql = string.Empty; strSql = "UPDATE officedba.PurchaseReject set "; foreach (DictionaryEntry de in htExtAttr)// fileht为一个Hashtable实例 { strSql += de.Key.ToString().Trim() + "=@" + de.Key.ToString().Trim() + ","; cmd.Parameters.AddWithValue("@" + de.Key.ToString().Trim(), de.Value.ToString().Trim()); } int iLength = strSql.Length - 1; strSql = strSql.Substring(0, iLength); strSql += " where CompanyCD = @CompanyCD AND RejectNo = @RejectNo"; cmd.Parameters.AddWithValue("@CompanyCD", model.CompanyCD); cmd.Parameters.AddWithValue("@RejectNo", model.RejectNo); cmd.CommandText = strSql; } catch (Exception) { } }
public static bool UpdatePurchaseReject(PurchaseRejectModel model, string DetailProductID , string DetailProductNo, string DetailProductName, string DetailUnitID , string DetailProductCount, string DetailBackCount, string DetailApplyReason , string DetailUnitPrice, string DetailTaxPrice, string DetailDiscount , string DetailTaxRate, string DetailTotalPrice, string DetailTotalFee , string DetailTotalTax, string DetailRemark, string DetailFromBillID , string DetailFromBillNo, string DetailFromLineNo, string DetailUsedUnitCount, string DetailUsedUnitID , string DetailUsedPrice, string length, string fflag2, string no, Hashtable htExtAttr) { if (model.ID <= 0) { return false; } ArrayList listADD = new ArrayList(); bool result = false; #region 修改采购退货单 StringBuilder sqlArrive = new StringBuilder(); sqlArrive.AppendLine("Update Officedba.PurchaseReject set CompanyCD=@CompanyCD,"); sqlArrive.AppendLine("Title=@Title,FromType=@FromType,RejectDate=@RejectDate,Purchaser=@Purchaser,DeptID=@DeptID,"); sqlArrive.AppendLine("CurrencyType=@CurrencyType,Rate=@Rate,PayType=@PayType,MoneyType=@MoneyType,SendAddress=@SendAddress,"); sqlArrive.AppendLine("ReceiveOverAddress=@ReceiveOverAddress,ReceiveMan=@ReceiveMan,ReceiveTel=@ReceiveTel,remark=@remark,TotalPrice=@TotalPrice,"); sqlArrive.AppendLine("TotalTax=@TotalTax,TotalFee=@TotalFee,Discount=@Discount,DiscountTotal=@DiscountTotal,RealTotal=@RealTotal,"); sqlArrive.AppendLine("isAddTax=@isAddTax,CountTotal=@CountTotal,BillStatus=@BillStatus,Creator=@Creator,CreateDate=@CreateDate,"); sqlArrive.AppendLine("Confirmor=@Confirmor,ConfirmDate=@ConfirmDate,Closer=@Closer,CloseDate=@CloseDate,"); sqlArrive.AppendLine("ModifiedDate=getdate(),ModifiedUserID=@ModifiedUserID,TypeID=@TypeID,ProviderID=@ProviderID,"); sqlArrive.AppendLine("TakeType=@TakeType,CarryType=@CarryType,TotalDyfzk=@TotalDyfzk,TotalYthkhj=@TotalYthkhj,ProjectID=@ProjectID where CompanyCD=@CompanyCD and RejectNo=@RejectNo and ID=@ID"); SqlCommand comm = new SqlCommand(); comm.Parameters.Add(SqlHelper.GetParameter("@CompanyCD", model.CompanyCD)); comm.Parameters.Add(SqlHelper.GetParameter("@Title", model.Title)); comm.Parameters.Add(SqlHelper.GetParameter("@FromType", model.FromType)); comm.Parameters.Add(SqlHelper.GetParameter("@RejectDate", model.RejectDate == null ? SqlDateTime.Null : SqlDateTime.Parse(model.RejectDate.ToString()))); comm.Parameters.Add(SqlHelper.GetParameter("@Purchaser", model.Purchaser)); comm.Parameters.Add(SqlHelper.GetParameter("@DeptID", model.DeptID)); comm.Parameters.Add(SqlHelper.GetParameter("@CurrencyType", model.CurrencyType)); comm.Parameters.Add(SqlHelper.GetParameter("@Rate", model.Rate)); comm.Parameters.Add(SqlHelper.GetParameter("@PayType", model.PayType)); comm.Parameters.Add(SqlHelper.GetParameter("@MoneyType", model.MoneyType)); comm.Parameters.Add(SqlHelper.GetParameter("@SendAddress", model.SendAddress)); comm.Parameters.Add(SqlHelper.GetParameter("@ReceiveOverAddress", model.ReceiveOverAddress)); comm.Parameters.Add(SqlHelper.GetParameter("@ReceiveMan", model.ReceiveMan)); comm.Parameters.Add(SqlHelper.GetParameter("@ReceiveTel", model.ReceiveTel)); comm.Parameters.Add(SqlHelper.GetParameter("@remark", model.remark)); comm.Parameters.Add(SqlHelper.GetParameter("@TotalPrice", model.TotalPrice)); comm.Parameters.Add(SqlHelper.GetParameter("@TotalTax", model.TotalTax)); 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("@isAddTax", model.isAddTax)); comm.Parameters.Add(SqlHelper.GetParameter("@CountTotal", model.CountTotal)); 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("@Closer", model.Closer)); comm.Parameters.Add(SqlHelper.GetParameter("@CloseDate", model.CloseDate == null ? SqlDateTime.Null : SqlDateTime.Parse(model.CloseDate.ToString()))); comm.Parameters.Add(SqlHelper.GetParameter("@ModifiedUserID", model.ModifiedUserID)); comm.Parameters.Add(SqlHelper.GetParameter("@TypeID", model.TypeID)); comm.Parameters.Add(SqlHelper.GetParameter("@ProviderID", model.ProviderID)); comm.Parameters.Add(SqlHelper.GetParameter("@TakeType", model.TakeType)); comm.Parameters.Add(SqlHelper.GetParameter("@CarryType", model.CarryType)); comm.Parameters.Add(SqlHelper.GetParameter("@TotalDyfzk", model.TotalDyfzk)); comm.Parameters.Add(SqlHelper.GetParameter("@TotalYthkhj", model.TotalYthkhj)); comm.Parameters.Add(SqlHelper.GetParameter("@RejectNo", model.RejectNo)); comm.Parameters.Add(SqlHelper.GetParameter("@ProjectID", model.ProjectID.HasValue ? SqlInt32.Parse(model.ProjectID.Value.ToString()) : SqlInt32.Null)); comm.Parameters.Add(SqlHelper.GetParameter("@ID", model.ID)); comm.CommandText = sqlArrive.ToString(); listADD.Add(comm); #endregion #region 拓展属性 SqlCommand cmd = new SqlCommand(); GetExtAttrCmd(model, htExtAttr, cmd); if (htExtAttr.Count > 0) listADD.Add(cmd); #endregion #region 保存修改时,判断是否由变更到执行,即确认后再修改的,则对采购到货明细字段回写减操作 if (fflag2 == "1") { int lengs = Convert.ToInt32(length); if (lengs > 0) { string[] BackCount = DetailBackCount.Split(','); string[] FromBillNo = DetailFromBillNo.Split(','); string[] FromLineNo = DetailFromLineNo.Split(','); string[] ProductTempID = DetailProductID.Split(','); for (int i = 0; i < lengs; i++) { System.Text.StringBuilder cmdsql = new System.Text.StringBuilder(); SqlCommand commp = new SqlCommand(); cmdsql.AppendLine("Update Officedba.PurchaseArriveDetail set BackCount=isnull(BackCount,0)-@BackCount"); cmdsql.AppendLine(" where CompanyCD=@CompanyCD and ArriveNo=@FromBillNo and SortNo=@FromLineNo"); commp.Parameters.Add(SqlHelper.GetParameter("@CompanyCD", model.CompanyCD)); commp.Parameters.Add(SqlHelper.GetParameter("@BackCount", BackCount[i].ToString())); commp.Parameters.Add(SqlHelper.GetParameter("@FromBillNo", FromBillNo[i].ToString())); commp.Parameters.Add(SqlHelper.GetParameter("@FromLineNo", FromLineNo[i].ToString())); commp.CommandText = cmdsql.ToString(); listADD.Add(commp); if (model.FromType == "1") { if (FromBillNo[i].ToString() != "") { listADD.Add(WriteAddStorge(ProductTempID[i].ToString(), BackCount[i].ToString())); } } } } } #endregion #region 删除退货单明细 System.Text.StringBuilder cmdddetail = new System.Text.StringBuilder(); cmdddetail.AppendLine("DELETE FROM officedba.PurchaseRejectDetail WHERE CompanyCD=@CompanyCD and RejectNo=@RejectNo"); SqlCommand comn = new SqlCommand(); comn.Parameters.Add(SqlHelper.GetParameter("@CompanyCD", model.CompanyCD)); comn.Parameters.Add(SqlHelper.GetParameter("@RejectNo", model.RejectNo)); comn.CommandText = cmdddetail.ToString(); listADD.Add(comn); #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[] ApplyReason = DetailApplyReason.Split(','); string[] UnitPrice = DetailUnitPrice.Split(',');//单价 string[] TaxPrice = DetailTaxPrice.Split(',');//含税价 string[] TaxRate = DetailTaxRate.Split(',');//税率 string[] TotalPrice = DetailTotalPrice.Split(',');//金额 string[] TotalFee = DetailTotalFee.Split(',');//含税金额 string[] TotalTax = DetailTotalTax.Split(',');//税额 string[] Remark = DetailRemark.Split(','); string[] FromBillID = DetailFromBillID.Split(','); string[] FromLineNo = DetailFromLineNo.Split(','); string[] UsedUnitCount = DetailUsedUnitCount.Split(','); string[] UsedUnitID = DetailUsedUnitID.Split(','); string[] UsedPrice = DetailUsedPrice.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.PurchaseRejectDetail"); cmdsql.AppendLine("(CompanyCD,"); cmdsql.AppendLine("RejectNo,"); cmdsql.AppendLine("FromType,"); cmdsql.AppendLine("SortNo,"); if (FromBillID[i].ToString().Length > 0) { if (!string.IsNullOrEmpty(FromBillID[i].ToString().Trim())) { cmdsql.AppendLine("FromBillID,"); } } if (FromLineNo[i].ToString().Length > 0) { if (!string.IsNullOrEmpty(FromLineNo[i].ToString().Trim())) { cmdsql.AppendLine("FromLineNo,"); } } cmdsql.AppendLine("ProductID,"); cmdsql.AppendLine("ProductNo,"); cmdsql.AppendLine("ProductName,"); if (ProductCount[i].ToString().Length > 0) { if (!string.IsNullOrEmpty(ProductCount[i].ToString().Trim())) { cmdsql.AppendLine("ProductCount,"); } } cmdsql.AppendLine("BackCount,"); cmdsql.AppendLine("UnitID,"); cmdsql.AppendLine("TaxPrice,"); cmdsql.AppendLine("TaxRate,"); cmdsql.AppendLine("TotalFee,"); cmdsql.AppendLine("TotalTax,"); cmdsql.AppendLine("UnitPrice,"); cmdsql.AppendLine("TotalPrice,"); if (Remark[i].ToString().Length > 0) { if (!string.IsNullOrEmpty(Remark[i].ToString().Trim())) { cmdsql.AppendLine("Remark,"); } } cmdsql.AppendLine("ApplyReason,UsedUnitCount,UsedUnitID,ExRate,UsedPrice)"); cmdsql.AppendLine(" Values(@CompanyCD"); cmdsql.AppendLine(" ,@RejectNo"); cmdsql.AppendLine(" ,@FromType"); cmdsql.AppendLine(" ,@SortNo"); if (FromBillID[i].ToString().Length > 0) { if (!string.IsNullOrEmpty(FromBillID[i].ToString().Trim())) { cmdsql.AppendLine(" ,@FromBillID"); } } if (FromLineNo[i].ToString().Length > 0) { if (!string.IsNullOrEmpty(FromLineNo[i].ToString().Trim())) { cmdsql.AppendLine(" ,@FromLineNo"); } } cmdsql.AppendLine(" ,@ProductID"); cmdsql.AppendLine(" ,@ProductNo"); cmdsql.AppendLine(" ,@ProductName"); if (ProductCount[i].ToString().Length > 0) { if (!string.IsNullOrEmpty(ProductCount[i].ToString().Trim())) { cmdsql.AppendLine(" ,@ProductCount"); } } cmdsql.AppendLine(" ,@BackCount"); cmdsql.AppendLine(" ,@UnitID"); cmdsql.AppendLine(" ,@TaxPrice"); cmdsql.AppendLine(" ,@TaxRate"); cmdsql.AppendLine(" ,@TotalFee"); cmdsql.AppendLine(" ,@TotalTax"); cmdsql.AppendLine(" ,@UnitPrice"); cmdsql.AppendLine(" ,@TotalPrice"); if (Remark[i].ToString().Length > 0) { if (!string.IsNullOrEmpty(Remark[i].ToString().Trim())) { cmdsql.AppendLine(" ,@Remark2"); } } cmdsql.AppendLine(" ,@ApplyReason,@UsedUnitCount,@UsedUnitID,@ExRate,@UsedPrice)"); comms.Parameters.Add(SqlHelper.GetParameter("@CompanyCD", model.CompanyCD)); comms.Parameters.Add(SqlHelper.GetParameter("@RejectNo", model.RejectNo)); comms.Parameters.Add(SqlHelper.GetParameter("@FromType", model.FromType)); comms.Parameters.Add(SqlHelper.GetParameter("@SortNo", i + 1)); if (FromBillID[i].ToString().Length > 0) { if (!string.IsNullOrEmpty(FromBillID[i].ToString().Trim())) { comms.Parameters.Add(SqlHelper.GetParameter("@FromBillID", FromBillID[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("@ProductID", ProductID[i].ToString())); comms.Parameters.Add(SqlHelper.GetParameter("@ProductNo", ProductNo[i].ToString())); comms.Parameters.Add(SqlHelper.GetParameter("@ProductName", ProductName[i].ToString())); if (ProductCount[i].ToString().Length > 0) { if (!string.IsNullOrEmpty(ProductCount[i].ToString().Trim())) { comms.Parameters.Add(SqlHelper.GetParameter("@ProductCount", ProductCount[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("@TaxPrice", TaxPrice[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("@TotalTax", TotalTax[i].ToString())); comms.Parameters.Add(SqlHelper.GetParameter("@UnitPrice", UnitPrice[i].ToString())); comms.Parameters.Add(SqlHelper.GetParameter("@TotalPrice", TotalPrice[i].ToString())); if (UsedUnitCount.Length == lengs && !string.IsNullOrEmpty(UsedUnitCount[i])) { comms.Parameters.Add(SqlHelper.GetParameter("@UsedUnitCount", UsedUnitCount[i])); } else { comms.Parameters.Add(SqlHelper.GetParameter("@UsedUnitCount", DBNull.Value)); } if (UsedPrice.Length == lengs && !string.IsNullOrEmpty(UsedPrice[i])) { comms.Parameters.Add(SqlHelper.GetParameter("@UsedPrice", UsedPrice[i])); } else { comms.Parameters.Add(SqlHelper.GetParameter("@UsedPrice", DBNull.Value)); } if (UsedUnitID.Length == lengs && !string.IsNullOrEmpty(UsedUnitID[i].Split('|')[0])) { comms.Parameters.Add(SqlHelper.GetParameter("@UsedUnitID", UsedUnitID[i].Split('|')[0])); } else { comms.Parameters.Add(SqlHelper.GetParameter("@UsedUnitID", DBNull.Value)); } if (UsedUnitID.Length == lengs && UsedUnitID[i].Split('|').Length == 2 && !string.IsNullOrEmpty(UsedUnitID[i].Split('|')[1])) { comms.Parameters.Add(SqlHelper.GetParameter("@ExRate", UsedUnitID[i].Split('|')[1])); } else { comms.Parameters.Add(SqlHelper.GetParameter("@ExRate", DBNull.Value)); } if (Remark[i].ToString().Length > 0) { if (!string.IsNullOrEmpty(Remark[i].ToString().Trim())) { comms.Parameters.Add(SqlHelper.GetParameter("@Remark2", Remark[i].ToString())); } } comms.Parameters.Add(SqlHelper.GetParameter("@ApplyReason", ApplyReason[i].ToString())); comms.CommandText = cmdsql.ToString(); listADD.Add(comms); } } #endregion if (SqlHelper.ExecuteTransWithArrayList(listADD)) { result = true; } return result; } catch (Exception ex) { throw ex; } }
public static bool ConfirmPurchaseReject(PurchaseRejectModel Model, string DetailBackCount, string DetailFromBillNo, string DetailFromLineNo, string DetailProductNo, string length, out string strMsg) { strMsg = ""; bool result = true; if (isCanDo(Model.ID, "1")) { #region 确认 ArrayList listADD = new ArrayList(); StringBuilder strSql = new StringBuilder(); strSql.AppendLine("update officedba.PurchaseReject set "); strSql.AppendLine(" Confirmor=@Confirmor"); strSql.AppendLine(" ,BillStatus=2"); strSql.AppendLine(" ,ConfirmDate=getdate()"); 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("@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(','); string[] ProductID = DetailProductNo.Split(','); string pp = ""; for (int i = 0; i < lengs; i++) { if (FromLineNo[i].ToString() != "") { if (IsCanConfirm(FromBillNo[i].ToString(), FromLineNo[i].ToString(), Model.CompanyCD, BackCount[i].ToString(), Model.FromType)) { System.Text.StringBuilder cmdsql = new System.Text.StringBuilder(); SqlCommand comms = new SqlCommand(); if (Model.FromType == "1") { cmdsql.AppendLine("Update Officedba.PurchaseArriveDetail set BackCount=isnull(BackCount,0)+@BackCount"); cmdsql.AppendLine(" where CompanyCD=@CompanyCD and ArriveNo=@FromBillNo and SortNo=@FromLineNo"); } else if (Model.FromType == "2") { cmdsql.AppendLine("Update Officedba.StorageInPurchaseDetail set BackCount=isnull(BackCount,0)+@BackCount"); cmdsql.AppendLine(" where CompanyCD=@CompanyCD and InNo=@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 (Model.FromType == "1") { if (getOriginalType(Model.CompanyCD, FromBillNo[i].ToString(), FromLineNo[i].ToString())) { listADD.Add(WriteStorge(ProductID[i].ToString(), BackCount[i].ToString())); } } } else { if (pp != "") { pp += "," + (i + 1); } else { pp = "" + (i + 1); } decimal temp = GetEnableCount(FromBillNo[i].ToString(), FromLineNo[i].ToString(), Model.CompanyCD, BackCount[i].ToString(), Model.FromType); strMsg += "第" + pp + "行的退货数量不能大于当前可用的退货数量" + Convert.ToString(temp) + ",确认失败!"; //strMsg = "数据溢出,确认失败!"; result = false; } } } } if (result) { if (SqlHelper.ExecuteTransWithArrayList(listADD)) { //ID = comm.Parameters["@ID"].Value.ToString(); strMsg = "确认成功!"; result = true; } else { strMsg = "确认失败!"; result = false; } } return result; } catch (Exception ex) { strMsg = "确认失败!"; result = false; return result; throw ex; } #endregion } else {//已经被其他人确认 strMsg = "已经确认的单据不可再次确认!"; result = false; return result; } }
public static bool InsertPurchaseReject(PurchaseRejectModel model, string DetailProductID , string DetailProductNo, string DetailProductName, string DetailUnitID , string DetailProductCount, string DetailBackCount, string DetailApplyReason , string DetailUnitPrice, string DetailTaxPrice, string DetailDiscount , string DetailTaxRate, string DetailTotalPrice, string DetailTotalFee , string DetailTotalTax, string DetailRemark, string DetailFromBillID , string DetailFromLineNo, string DetailUsedUnitCount, string DetailUsedUnitID , string DetailUsedPrice, string length, out string ID, Hashtable htExtAttr) { ArrayList listADD = new ArrayList(); bool result = false; ID = "0"; #region 采购退货单添加SQL语句 StringBuilder sqlArrive = new StringBuilder(); sqlArrive.AppendLine("INSERT INTO officedba.PurchaseReject"); sqlArrive.AppendLine("(CompanyCD,RejectNo,Title,FromType,RejectDate,Purchaser,DeptID,CurrencyType,Rate,PayType,"); sqlArrive.AppendLine("MoneyType,SendAddress,ReceiveOverAddress,ReceiveMan,ReceiveTel,remark,TotalPrice,"); sqlArrive.AppendLine("TotalTax,TotalFee,Discount,DiscountTotal,RealTotal,isAddTax,CountTotal,BillStatus,"); sqlArrive.AppendLine("Creator,CreateDate,Confirmor,ConfirmDate,Closer,CloseDate,ModifiedDate,"); sqlArrive.AppendLine("ModifiedUserID,TypeID,ProviderID,TakeType,CarryType,TotalDyfzk,TotalYthkhj,ProjectID)"); sqlArrive.AppendLine("VALUES (@CompanyCD,@RejectNo,@Title,@FromType,@RejectDate,@Purchaser,@DeptID,@CurrencyType,@Rate,@PayType,"); sqlArrive.AppendLine("@MoneyType,@SendAddress,@ReceiveOverAddress,@ReceiveMan,@ReceiveTel,@remark,@TotalPrice,"); sqlArrive.AppendLine("@TotalTax,@TotalFee,@Discount,@DiscountTotal,@RealTotal,@isAddTax,@CountTotal,@BillStatus,"); sqlArrive.AppendLine("@Creator,@CreateDate,@Confirmor,@ConfirmDate,@Closer,@CloseDate,getdate(),"); sqlArrive.AppendLine("@ModifiedUserID,@TypeID,@ProviderID,@TakeType,@CarryType,@TotalDyfzk,@TotalYthkhj,@ProjectID)"); sqlArrive.AppendLine("set @ID=@@IDENTITY"); SqlCommand comm = new SqlCommand(); comm.Parameters.Add(SqlHelper.GetParameter("@CompanyCD", model.CompanyCD)); comm.Parameters.Add(SqlHelper.GetParameter("@RejectNo", model.RejectNo)); comm.Parameters.Add(SqlHelper.GetParameter("@Title", model.Title)); comm.Parameters.Add(SqlHelper.GetParameter("@FromType", model.FromType)); comm.Parameters.Add(SqlHelper.GetParameter("@RejectDate", model.RejectDate == null ? SqlDateTime.Null : SqlDateTime.Parse(model.RejectDate.ToString()))); comm.Parameters.Add(SqlHelper.GetParameter("@Purchaser", model.Purchaser)); comm.Parameters.Add(SqlHelper.GetParameter("@DeptID", model.DeptID)); comm.Parameters.Add(SqlHelper.GetParameter("@CurrencyType", model.CurrencyType)); comm.Parameters.Add(SqlHelper.GetParameter("@Rate", model.Rate)); comm.Parameters.Add(SqlHelper.GetParameter("@PayType", model.PayType)); comm.Parameters.Add(SqlHelper.GetParameter("@MoneyType", model.MoneyType)); comm.Parameters.Add(SqlHelper.GetParameter("@SendAddress", model.SendAddress)); comm.Parameters.Add(SqlHelper.GetParameter("@ReceiveOverAddress", model.ReceiveOverAddress)); comm.Parameters.Add(SqlHelper.GetParameter("@ReceiveMan", model.ReceiveMan)); comm.Parameters.Add(SqlHelper.GetParameter("@ReceiveTel", model.ReceiveTel)); comm.Parameters.Add(SqlHelper.GetParameter("@remark", model.remark)); comm.Parameters.Add(SqlHelper.GetParameter("@TotalPrice", model.TotalPrice)); comm.Parameters.Add(SqlHelper.GetParameter("@TotalTax", model.TotalTax)); 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("@isAddTax", model.isAddTax)); comm.Parameters.Add(SqlHelper.GetParameter("@CountTotal", model.CountTotal)); 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("@Closer", model.Closer)); comm.Parameters.Add(SqlHelper.GetParameter("@CloseDate", model.CloseDate == null ? SqlDateTime.Null : SqlDateTime.Parse(model.CloseDate.ToString()))); comm.Parameters.Add(SqlHelper.GetParameter("@ModifiedUserID", model.ModifiedUserID)); comm.Parameters.Add(SqlHelper.GetParameter("@TypeID", model.TypeID)); comm.Parameters.Add(SqlHelper.GetParameter("@ProviderID", model.ProviderID)); comm.Parameters.Add(SqlHelper.GetParameter("@TakeType", model.TakeType)); comm.Parameters.Add(SqlHelper.GetParameter("@CarryType", model.CarryType)); comm.Parameters.Add(SqlHelper.GetParameter("@TotalDyfzk", model.TotalDyfzk)); comm.Parameters.Add(SqlHelper.GetParameter("@TotalYthkhj", model.TotalYthkhj)); comm.Parameters.Add(SqlHelper.GetParameter("@ProjectID", model.ProjectID.HasValue ? SqlInt32.Parse(model.ProjectID.Value.ToString()) : SqlInt32.Null)); comm.Parameters.Add(SqlHelper.GetOutputParameter("@ID", SqlDbType.Int)); comm.CommandText = sqlArrive.ToString(); listADD.Add(comm); #endregion #region 拓展属性 SqlCommand cmd = new SqlCommand(); GetExtAttrCmd(model, htExtAttr, cmd); if (htExtAttr.Count > 0) listADD.Add(cmd); #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[] ApplyReason = DetailApplyReason.Split(','); string[] UnitPrice = DetailUnitPrice.Split(',');//单价 string[] TaxPrice = DetailTaxPrice.Split(',');//含税价 string[] TaxRate = DetailTaxRate.Split(',');//税率 string[] TotalPrice = DetailTotalPrice.Split(',');//金额 string[] TotalFee = DetailTotalFee.Split(',');//含税金额 string[] TotalTax = DetailTotalTax.Split(',');//税额 string[] Remark = DetailRemark.Split(','); string[] FromBillID = DetailFromBillID.Split(','); string[] FromLineNo = DetailFromLineNo.Split(','); string[] UsedUnitCount = DetailUsedUnitCount.Split(','); string[] UsedUnitID = DetailUsedUnitID.Split(','); string[] UsedPrice = DetailUsedPrice.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.PurchaseRejectDetail"); cmdsql.AppendLine("(CompanyCD,"); cmdsql.AppendLine("RejectNo,"); cmdsql.AppendLine("FromType,"); cmdsql.AppendLine("SortNo,"); if (FromBillID[i].ToString().Length > 0) { if (!string.IsNullOrEmpty(FromBillID[i].ToString().Trim())) { cmdsql.AppendLine("FromBillID,"); } } if (FromLineNo[i].ToString().Length > 0) { if (!string.IsNullOrEmpty(FromLineNo[i].ToString().Trim())) { cmdsql.AppendLine("FromLineNo,"); } } cmdsql.AppendLine("ProductID,"); cmdsql.AppendLine("ProductNo,"); cmdsql.AppendLine("ProductName,"); if (ProductCount[i].ToString().Length > 0) { if (!string.IsNullOrEmpty(ProductCount[i].ToString().Trim())) { cmdsql.AppendLine("ProductCount,"); } } cmdsql.AppendLine("BackCount,"); cmdsql.AppendLine("UnitID,"); cmdsql.AppendLine("TaxPrice,"); cmdsql.AppendLine("TaxRate,"); cmdsql.AppendLine("TotalFee,"); cmdsql.AppendLine("TotalTax,"); cmdsql.AppendLine("UnitPrice,"); cmdsql.AppendLine("TotalPrice,"); if (Remark[i].ToString().Length > 0) { if (!string.IsNullOrEmpty(Remark[i].ToString().Trim())) { cmdsql.AppendLine("Remark,"); } } cmdsql.AppendLine("ApplyReason,UsedUnitCount,UsedUnitID,ExRate,UsedPrice)"); cmdsql.AppendLine(" Values(@CompanyCD"); cmdsql.AppendLine(" ,@RejectNo"); cmdsql.AppendLine(" ,@FromType"); cmdsql.AppendLine(" ,@SortNo"); if (FromBillID[i].ToString().Length > 0) { if (!string.IsNullOrEmpty(FromBillID[i].ToString().Trim())) { cmdsql.AppendLine(" ,@FromBillID"); } } if (FromLineNo[i].ToString().Length > 0) { if (!string.IsNullOrEmpty(FromLineNo[i].ToString().Trim())) { cmdsql.AppendLine(" ,@FromLineNo"); } } cmdsql.AppendLine(" ,@ProductID"); cmdsql.AppendLine(" ,@ProductNo"); cmdsql.AppendLine(" ,@ProductName"); if (ProductCount[i].ToString().Length > 0) { if (!string.IsNullOrEmpty(ProductCount[i].ToString().Trim())) { cmdsql.AppendLine(" ,@ProductCount"); } } cmdsql.AppendLine(" ,@BackCount"); cmdsql.AppendLine(" ,@UnitID"); cmdsql.AppendLine(" ,@TaxPrice"); cmdsql.AppendLine(" ,@TaxRate"); cmdsql.AppendLine(" ,@TotalFee"); cmdsql.AppendLine(" ,@TotalTax"); cmdsql.AppendLine(" ,@UnitPrice"); cmdsql.AppendLine(" ,@TotalPrice"); if (Remark[i].ToString().Length > 0) { if (!string.IsNullOrEmpty(Remark[i].ToString().Trim())) { cmdsql.AppendLine(" ,@Remark2"); } } cmdsql.AppendLine(" ,@ApplyReason,@UsedUnitCount,@UsedUnitID,@ExRate,@UsedPrice)"); comms.Parameters.Add(SqlHelper.GetParameter("@CompanyCD", model.CompanyCD)); comms.Parameters.Add(SqlHelper.GetParameter("@RejectNo", model.RejectNo)); comms.Parameters.Add(SqlHelper.GetParameter("@FromType", model.FromType)); comms.Parameters.Add(SqlHelper.GetParameter("@SortNo", i + 1)); if (FromBillID[i].ToString().Length > 0) { if (!string.IsNullOrEmpty(FromBillID[i].ToString().Trim())) { comms.Parameters.Add(SqlHelper.GetParameter("@FromBillID", FromBillID[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("@ProductID", ProductID[i].ToString())); comms.Parameters.Add(SqlHelper.GetParameter("@ProductNo", ProductNo[i].ToString())); comms.Parameters.Add(SqlHelper.GetParameter("@ProductName", ProductName[i].ToString())); if (ProductCount[i].ToString().Length > 0) { if (!string.IsNullOrEmpty(ProductCount[i].ToString().Trim())) { comms.Parameters.Add(SqlHelper.GetParameter("@ProductCount", ProductCount[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("@TaxPrice", TaxPrice[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("@TotalTax", TotalTax[i].ToString())); comms.Parameters.Add(SqlHelper.GetParameter("@UnitPrice", UnitPrice[i].ToString())); comms.Parameters.Add(SqlHelper.GetParameter("@TotalPrice", TotalPrice[i].ToString())); if (UsedUnitCount.Length == lengs && !string.IsNullOrEmpty(UsedUnitCount[i])) { comms.Parameters.Add(SqlHelper.GetParameter("@UsedUnitCount", UsedUnitCount[i])); } else { comms.Parameters.Add(SqlHelper.GetParameter("@UsedUnitCount", DBNull.Value)); } if (UsedPrice.Length == lengs && !string.IsNullOrEmpty(UsedPrice[i])) { comms.Parameters.Add(SqlHelper.GetParameter("@UsedPrice", UsedPrice[i])); } else { comms.Parameters.Add(SqlHelper.GetParameter("@UsedPrice", DBNull.Value)); } if (UsedUnitID.Length == lengs && !string.IsNullOrEmpty(UsedUnitID[i].Split('|')[0])) { comms.Parameters.Add(SqlHelper.GetParameter("@UsedUnitID", UsedUnitID[i].Split('|')[0])); } else { comms.Parameters.Add(SqlHelper.GetParameter("@UsedUnitID", DBNull.Value)); } if (UsedUnitID.Length == lengs && UsedUnitID[i].Split('|').Length == 2 && !string.IsNullOrEmpty(UsedUnitID[i].Split('|')[1])) { comms.Parameters.Add(SqlHelper.GetParameter("@ExRate", UsedUnitID[i].Split('|')[1])); } else { comms.Parameters.Add(SqlHelper.GetParameter("@ExRate", DBNull.Value)); } if (Remark[i].ToString().Length > 0) { if (!string.IsNullOrEmpty(Remark[i].ToString().Trim())) { comms.Parameters.Add(SqlHelper.GetParameter("@Remark2", Remark[i].ToString())); } } comms.Parameters.Add(SqlHelper.GetParameter("@ApplyReason", ApplyReason[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; } }
public static bool CancelClosePurchaseReject(PurchaseRejectModel Model) { #region SQL文 StringBuilder strSql = new StringBuilder(); strSql.AppendLine("update officedba.PurchaseReject set "); strSql.AppendLine(" Closer = @Closer"); strSql.AppendLine(" ,BillStatus=2"); strSql.AppendLine(" ,CloseDate=getdate()"); strSql.AppendLine(" where"); strSql.AppendLine(" CompanyCD= @CompanyCD"); strSql.AppendLine(" and ID= @ID"); #endregion #region 参数 SqlParameter[] param = new SqlParameter[3]; param[0] = SqlHelper.GetParameter("@Closer", Model.Closer); param[1] = SqlHelper.GetParameter("@CompanyCD", Model.CompanyCD); param[2] = SqlHelper.GetParameter("@ID", Model.ID); #endregion SqlHelper.ExecuteTransSql(strSql.ToString(), param); return SqlHelper.Result.OprateCount > 0 ? true : false; }
public static bool CancelConfirmPurchaseReject(PurchaseRejectModel Model, string DetailBackCount, string DetailFromBillNo, string DetailFromLineNo, string DetailProductNo, string length, out string strMsg) { bool isSuc = false; strMsg = ""; //判断单据是否为执行状态,非执行状态不能取消确认 SqlCommand comm = new SqlCommand(); String sql = "SELECT [isOpenbill] FROM [officedba].[PurchaseReject] WHERE ID=@ID AND CompanyCD=@CompanyCD AND isOpenBill='1'"; comm.Parameters.Add(SqlHelper.GetParameterFromString("@ID", Model.ID.ToString())); comm.Parameters.Add(SqlHelper.GetParameterFromString("@CompanyCD", Model.CompanyCD.ToString())); comm.CommandText = sql; DataTable dt = SqlHelper.ExecuteSearch(comm); if (dt != null && dt.Rows.Count != 0) { strMsg = "已建单的单据不能取消确认!"; return false; } if (isCanDo(Model.ID, "2")) { if (!IsCitePurchaseReject(Model.ID)) { string strSq = string.Empty; //bool isSuc = false; int iEmployeeID = 0;//员工id string strUserID = string.Empty;//用户id string strCompanyCD = string.Empty;//单位编码 SqlParameter[] paras = new SqlParameter[5]; iEmployeeID = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).EmployeeID; strUserID = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).UserID; strCompanyCD = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).CompanyCD; strSq = "update officedba.PurchaseReject set BillStatus='1' "; strSq += " , Confirmor=@Confirmor, ConfirmDate=@ConfirmDate, ModifiedDate=getdate() ,ModifiedUserID=@UserID "; strSq += " WHERE ID = @ID and CompanyCD=@CompanyCD"; paras[0] = new SqlParameter("@Confirmor", DBNull.Value); paras[1] = new SqlParameter("@UserID", strUserID); paras[2] = new SqlParameter("@CompanyCD", Model.CompanyCD); paras[3] = new SqlParameter("@ID", Model.ID); paras[4] = new SqlParameter("@ConfirmDate", DBNull.Value); TransactionManager tran = new TransactionManager(); tran.BeginTransaction(); try { int lengs = Convert.ToInt32(length); if (lengs > 0) { string[] BackCount = DetailBackCount.Split(','); string[] FromBillNo = DetailFromBillNo.Split(','); string[] FromLineNo = DetailFromLineNo.Split(','); string[] ProductID = DetailProductNo.Split(','); for (int i = 0; i < lengs; i++) { StringBuilder cmdsql = new StringBuilder(); if (Model.FromType == "1") { cmdsql.Append("Update Officedba.PurchaseArriveDetail set BackCount=isnull(BackCount,0)-@BackCount"); cmdsql.Append(" where CompanyCD=@CompanyCD and ArriveNo=@FromBillNo and SortNo=@FromLineNo"); } else if (Model.FromType == "2") { cmdsql.AppendLine("Update Officedba.StorageInPurchaseDetail set BackCount=isnull(BackCount,0)-@BackCount"); cmdsql.AppendLine(" where CompanyCD=@CompanyCD and InNo=@FromBillNo and SortNo=@FromLineNo"); } SqlParameter[] param = { new SqlParameter("@CompanyCD", Model.CompanyCD), new SqlParameter("@BackCount", BackCount[i].ToString()), new SqlParameter("@FromBillNo", FromBillNo[i].ToString()), new SqlParameter("@FromLineNo", FromLineNo[i].ToString()) }; if (cmdsql.Length > 0) { SqlHelper.ExecuteNonQuery(tran.Trans, CommandType.Text, cmdsql.ToString(), param); } if (Model.FromType == "1") { if (FromBillNo[i].ToString() != "") { StringBuilder sqlComand = new StringBuilder(); string TempStr = ProductID[i].ToString(); if (IsExistInStorge(TempStr)) { sqlComand.AppendLine("UPDATE officedba.StorageProduct "); sqlComand.AppendLine(" SET RoadCount = isnull(RoadCount,0)+@RoadCount"); sqlComand.AppendLine(" WHERE ProductID = @ProductID "); sqlComand.AppendLine(" AND StorageID = (SELECT StorageID FROM officedba.ProductInfo WHERE ID=@ProductID)"); sqlComand.AppendLine(" AND CompanyCD = @CompanyCD"); SqlParameter[] param1 = { new SqlParameter("@ProductID", ProductID[i].ToString ()), new SqlParameter("@RoadCount", BackCount[i].ToString()), new SqlParameter("@CompanyCD", ((UserInfoUtil)SessionUtil.Session["UserInfo"]).CompanyCD) }; SqlHelper.ExecuteNonQuery(tran.Trans, CommandType.Text, sqlComand.ToString(), param1); } } } } } FlowDBHelper.OperateCancelConfirm(Model.CompanyCD, Convert.ToInt32(ConstUtil.CODING_RULE_PURCHASE), Convert.ToInt32(ConstUtil.BILL_TYPEFLAG_PURCHASE_REJECT), Model.ID, strUserID, tran);//撤销审批 SqlHelper.ExecuteNonQuery(tran.Trans, CommandType.Text, strSq, paras); tran.Commit(); isSuc = true; strMsg = "取消确认成功!"; } catch (Exception ex) { tran.Rollback(); strMsg = "取消确认失败!"; isSuc = false; throw ex; } } else {//单据被调用了,不可以取消确认 isSuc = false; strMsg = "该单据已被其它单据调用了,不允许取消确认!"; } } else {//单据被别人抢先取消确认了 isSuc = false; strMsg = "该单据已被其他用户取消确认,不可再次取消确认!"; } return isSuc; }
public static bool CancelClosePurchaseReject(PurchaseRejectModel Model) { return PurchaseRejectDBHelper.CancelClosePurchaseReject(Model); }
public static bool CancelConfirmPurchaseReject(PurchaseRejectModel Model, string DetailBackCount, string DetailFromBillNo, string DetailFromLineNo, string DetailProductNo, string length, out string strMsg) { return PurchaseRejectDBHelper.CancelConfirmPurchaseReject(Model, DetailBackCount, DetailFromBillNo, DetailFromLineNo, DetailProductNo, length, out strMsg); }
public static bool UpdatePurchaseReject(PurchaseRejectModel model, string DetailProductID, string DetailProductNo, string DetailProductName, string DetailUnitID, string DetailProductCount, string DetailBackCount, string DetailApplyReason, string DetailUnitPrice, string DetailTaxPrice, string DetailDiscount, string DetailTaxRate, string DetailTotalPrice, string DetailTotalFee, string DetailTotalTax, string DetailRemark, string DetailFromBillID, string DetailFromBillNo, string DetailFromLineNo, string DetailUsedUnitCount, string DetailUsedUnitID, string DetailUsedPrice, string length, string fflag2, string no, Hashtable ht) { UserInfoUtil userInfo = (UserInfoUtil)SessionUtil.Session["UserInfo"]; if (model.ID <= 0) { return false; } try { bool succ = false; LogInfoModel logModel = InitLogInfo(no); logModel.Element = ConstUtil.LOG_PROCESS_UPDATE; //设置模块ID 模块ID请在ConstUtil中定义,以便维护 logModel.ModuleID = ConstUtil.MODULE_ID_PurchaseReject_Add; succ = PurchaseRejectDBHelper.UpdatePurchaseReject(model, DetailProductID, DetailProductNo, DetailProductName, DetailUnitID, DetailProductCount, DetailBackCount, DetailApplyReason, DetailUnitPrice, DetailTaxPrice, DetailDiscount, DetailTaxRate, DetailTotalPrice, DetailTotalFee, DetailTotalTax, DetailRemark, DetailFromBillID, DetailFromBillNo, DetailFromLineNo, DetailUsedUnitCount, DetailUsedUnitID, DetailUsedPrice, length, fflag2, no, ht); 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; } }
public static bool InsertPurchaseReject(PurchaseRejectModel model, string DetailProductID, string DetailProductNo, string DetailProductName, string DetailUnitID, string DetailProductCount, string DetailBackCount, string DetailApplyReason, string DetailUnitPrice, string DetailTaxPrice, string DetailDiscount, string DetailTaxRate, string DetailTotalPrice, string DetailTotalFee, string DetailTotalTax, string DetailRemark, string DetailFromBillID, string DetailFromLineNo, string DetailUsedUnitCount, string DetailUsedUnitID, string DetailUsedPrice, string length, out string ID, Hashtable hd) { try { bool succ = false; LogInfoModel logModel = InitLogInfo(model.RejectNo); logModel.Element = ConstUtil.LOG_PROCESS_INSERT; //设置模块ID 模块ID请在ConstUtil中定义,以便维护 logModel.ModuleID = ConstUtil.MODULE_ID_PurchaseReject_Add; succ = PurchaseRejectDBHelper.InsertPurchaseReject(model, DetailProductID, DetailProductNo, DetailProductName, DetailUnitID, DetailProductCount, DetailBackCount, DetailApplyReason, DetailUnitPrice, DetailTaxPrice, DetailDiscount, DetailTaxRate, DetailTotalPrice, DetailTotalFee, DetailTotalTax, DetailRemark, DetailFromBillID, DetailFromLineNo, DetailUsedUnitCount, DetailUsedUnitID, DetailUsedPrice, length, out ID, hd); 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; } }