public static string AddStorageTransfer(StorageTransfer st, List<StorageTransferDetail> stdList, Hashtable ht) { //return "1|" + ((SqlCommand)SqlCmdList[0]).Parameters["@ID"].Value.ToString() + "#" + st.TransferNo; //定义返回变量 string res = string.Empty; /* * 定义日志内容变量 * 增删改相关的日志,需要输出操作日志,该类型日志插入到数据库 * 其他的 如出现异常时,需要输出系统日志,该类型日志保存到日志文件 */ //获取当前用户信息 UserInfoUtil userInfo = (UserInfoUtil)SessionUtil.Session["UserInfo"]; //执行操作 try { //执行操作 res = XBase.Data.Office.StorageManager.StorageTransferDBHelper.AddStorageTransfer(st, stdList,ht); } catch (Exception ex) { //输出日志 WriteSystemLog(userInfo, ex); } //定义变量 string remark; //成功时 if (res.Split('|')[0] == "1") { //设置操作成功标识 remark = ConstUtil.LOG_PROCESS_SUCCESS; } else { //设置操作成功标识 remark = ConstUtil.LOG_PROCESS_FAILED; } //操作日志 LogInfoModel logModel = InitLogInfo(st.TransferNo); //涉及关键元素 这个需要根据每个页面具体设置,本页面暂时设置为空 logModel.Element = ConstUtil.LOG_PROCESS_INSERT; ; //设置操作成功标识 logModel.Remark = remark; //登陆日志 LogDBHelper.InsertLog(logModel); return res; }
/*提供打印*/ public static DataTable GetStorageTransferInfoPrint(StorageTransfer st) { return XBase.Data.Office.StorageManager.StorageTransferDBHelper.GetStorageTransferInfoPrint(st); }
public static DataTable GetStorageTransferInfo(StorageTransfer st) { StringBuilder sbSql = new StringBuilder(); sbSql.Append("select st.ID,st.TransferNo,st.Title,st.ApplyUserID,"); sbSql.Append("(SELECT ei1.EmployeeName from officedba.EmployeeInfo as ei1 where st.ApplyUserID=ei1.ID) AS ApplyUserIDName,"); sbSql.Append("st.ApplyDeptID,"); sbSql.Append("(SELECT di1.DeptName from officedba.DeptInfo as di1 where st.ApplyDeptID=di1.ID) AS ApplyDeptIDName,"); sbSql.Append("st.InStorageID,st.RequireInDate,st.ReasonType,"); sbSql.Append("st.OutDeptID,"); sbSql.Append("(SELECT di2.DeptName from officedba.DeptInfo as di2 where st.OutDeptID=di2.ID) AS OutDeptIDName,"); sbSql.Append("st.OutStorageID,st.OutDate,st.BusiStatus,st.Summary,st.TransferCount,st.TransferPrice,st.TransferFeeSum,"); sbSql.Append("st.Creator,"); sbSql.Append("(SELECT ei2.EmployeeName from officedba.EmployeeInfo as ei2 where st.Creator=ei2.ID) as CreatorName,"); sbSql.Append("st.CreateDate,st.BillStatus,st.Remark,"); sbSql.Append("(SELECT ei3.EmployeeName from officedba.EmployeeInfo as ei3 where st.Confirmor=ei3.ID) as ConfirmorName,"); sbSql.Append("st.ConfirmDate,st.Closer,"); sbSql.Append("(SELECT ei4.EmployeeName from officedba.EmployeeInfo as ei4 where st.Closer=ei4.ID) as CloserName,"); sbSql.Append("st.CloseDate,st.ModifiedDate,st.ModifiedUserID,st.OutFeeSum,st.InFeeSum,st.OutCount, st.InCount,st.OutUserID,"); sbSql.Append("(SELECT ei5.EmployeeName from officedba.EmployeeInfo as ei5 where st.OutUserID=ei5.ID) as OutUserIDName,"); sbSql.Append("st.OutDate,st.InUserID,st.InDate,"); sbSql.Append("(SELECT ei6.EmployeeName from officedba.EmployeeInfo as ei6 where st.InUserID=ei6.ID) as InUserIDName, "); sbSql.Append("isnull(ExtField1,'')ExtField1,isnull(ExtField2,'')ExtField2,isnull(ExtField3,'')ExtField3,isnull(ExtField4,'')ExtField4,"); sbSql.Append("isnull(ExtField5,'')ExtField5,isnull(ExtField6,''),ExtField6,isnull(ExtField7,'')ExtField7,isnull(ExtField8,'')ExtField8,"); sbSql.Append(" isnull(ExtField9,'')ExtField9,isnull(ExtField10,'')ExtField10 "); sbSql.Append("from officedba.StorageTransfer as st "); sbSql.Append(" where ID=@ID"); SqlParameter[] Paras = { new SqlParameter("@ID",SqlDbType.Int) }; Paras[0].Value = st.ID; return SqlHelper.ExecuteSql(sbSql.ToString(), Paras); }
/*提供打印*/ public static DataTable GetStorageTransferInfoPrint(StorageTransfer st) { StringBuilder sbSql = new StringBuilder(); sbSql.Append(" "); sbSql.Append(" SELECT ID, TransferNo, Title, ApplyUserID, "); sbSql.Append(" (SELECT DeptName "); sbSql.Append(" FROM officedba.DeptInfo AS di "); sbSql.Append(" WHERE (ID = st.InStorageID)) AS InStorageName, "); sbSql.Append(" (SELECT DeptName "); sbSql.Append(" FROM officedba.DeptInfo AS di1 "); sbSql.Append(" WHERE (ID = st.OutStorageID)) AS OutStorageName, "); sbSql.Append(" (CASE st.BusiStatus WHEN '1' THEN '调拨申请' WHEN '2' THEN '调拨出库' WHEN '3' THEN '调拨入库' WHEN '4' THEN '调拨完成' END) "); sbSql.Append(" AS BusiStatusText, "); sbSql.Append(" (SELECT CodeName "); sbSql.Append(" FROM officedba.CodeReasonType AS crt "); sbSql.Append(" WHERE (ID = st.ReasonType)) AS Reason, "); sbSql.Append(" (SELECT EmployeeName "); sbSql.Append(" FROM officedba.EmployeeInfo AS ei1 "); sbSql.Append(" WHERE (st.ApplyUserID = ID)) AS ApplyUserIDName, ApplyDeptID, "); sbSql.Append(" (SELECT DeptName "); sbSql.Append(" FROM officedba.DeptInfo AS di1 "); sbSql.Append(" WHERE (st.ApplyDeptID = ID)) AS ApplyDeptIDName, InStorageID,CONVERT(VARCHAR(10),RequireInDate, 21)RequireInDate , ReasonType, OutDeptID, "); sbSql.Append(" (SELECT DeptName "); sbSql.Append(" FROM officedba.DeptInfo AS di2 "); sbSql.Append(" WHERE (st.OutDeptID = ID)) AS OutDeptIDName, OutStorageID, CONVERT(VARCHAR(10),OutDate, 21)OutDate, BusiStatus, Summary, TransferCount, TransferPrice, TransferFeeSum, "); sbSql.Append(" Creator, "); sbSql.Append(" (SELECT EmployeeName "); sbSql.Append(" FROM officedba.EmployeeInfo AS ei2 "); sbSql.Append(" WHERE (st.Creator = ID)) AS CreatorName, CONVERT(VARCHAR(10),CreateDate, 21)CreateDate, BillStatus, Remark, "); sbSql.Append(" (SELECT EmployeeName "); sbSql.Append(" FROM officedba.EmployeeInfo AS ei3 "); sbSql.Append(" WHERE (st.Confirmor = ID)) AS ConfirmorName, CONVERT(VARCHAR(10),ConfirmDate, 21)ConfirmDate , Closer, "); sbSql.Append(" (SELECT EmployeeName "); sbSql.Append(" FROM officedba.EmployeeInfo AS ei4 "); sbSql.Append(" WHERE (st.Closer = ID)) AS CloserName, CONVERT(VARCHAR(10),CloseDate, 21)CloseDate , CONVERT(VARCHAR(10),ModifiedDate, 21)ModifiedDate, ModifiedUserID, OutFeeSum, InFeeSum, OutCount, InCount, OutUserID, "); sbSql.Append(" (SELECT EmployeeName "); sbSql.Append(" FROM officedba.EmployeeInfo AS ei5 "); sbSql.Append(" WHERE (st.OutUserID = ID)) AS OutUserIDName, OutDate AS Expr1, InUserID,CONVERT(VARCHAR(10),InDate, 21)InDate , "); sbSql.Append(" (SELECT EmployeeName "); sbSql.Append(" FROM officedba.EmployeeInfo AS ei6 "); sbSql.Append(" WHERE (st.InUserID = ID)) AS InUserIDName, "); sbSql.Append(" (CASE st.BillStatus WHEN '1' THEN '制单' WHEN '2' THEN '执行' WHEN '4' THEN '手工结单' WHEN '5' THEN '自动结单' END) "); sbSql.Append(" AS BillStatusText, "); sbSql.Append("isnull(st.ExtField1,'')ExtField1,isnull(st.ExtField2,'')ExtField2,isnull(st.ExtField3,'')ExtField3,isnull(st.ExtField4,'')ExtField4,"); sbSql.Append("isnull(st.ExtField5,'')ExtField5,isnull(st.ExtField6,''),ExtField6,isnull(st.ExtField7,'')ExtField7,isnull(st.ExtField8,'')ExtField8,"); sbSql.Append(" isnull(st.ExtField9,'')ExtField9,isnull(st.ExtField10,'')ExtField10 "); sbSql.Append(" FROM officedba.StorageTransfer AS st "); sbSql.Append(" where ID=@ID"); SqlParameter[] Paras = { new SqlParameter("@ID",SqlDbType.Int) }; Paras[0].Value = st.ID; return SqlHelper.ExecuteSql(sbSql.ToString(), Paras); }
public static string UpdateStorageTransfer(StorageTransfer st, List<StorageTransferDetail> stdList, Hashtable ht) { #region 构造调拨单SQL字符串 StringBuilder strSql = new StringBuilder(); strSql.Append("update officedba.StorageTransfer set "); strSql.Append("Title=@Title,"); strSql.Append("ReasonType=@ReasonType,"); strSql.Append("InStorageID=@InStorageID,"); strSql.Append("OutStorageID=@OutStorageID,"); strSql.Append("ApplyUserID=@ApplyUserID,"); strSql.Append("ApplyDeptID=@ApplyDeptID,"); strSql.Append("OutDeptID=@OutDeptID,"); strSql.Append("RequireInDate=@RequireInDate,"); strSql.Append("TransferCount=@TransferCount,"); strSql.Append("TransferFeeSum=@TransferFeeSum,"); strSql.Append("Remark=@Remark,"); strSql.Append("ModifiedDate=@ModifiedDate,"); strSql.Append("ModifiedUserID=@ModifiedUserID"); strSql.Append(",Summary=@Summary "); strSql.Append(" where ID=@ID "); SqlParameter[] parameters = { new SqlParameter("@ID", SqlDbType.Int,4), new SqlParameter("@Title", SqlDbType.VarChar,100), new SqlParameter("@ReasonType", SqlDbType.Int,4), new SqlParameter("@InStorageID", SqlDbType.Int,4), new SqlParameter("@OutStorageID", SqlDbType.Int,4), new SqlParameter("@ApplyUserID", SqlDbType.Int,4), new SqlParameter("@ApplyDeptID", SqlDbType.Int,4), new SqlParameter("@OutDeptID", SqlDbType.Int,4), new SqlParameter("@RequireInDate", SqlDbType.DateTime), new SqlParameter("@TransferPrice", SqlDbType.Decimal,9), new SqlParameter("@TransferCount", SqlDbType.Decimal,9), new SqlParameter("@TransferFeeSum",SqlDbType.Decimal,9), new SqlParameter("@Remark", SqlDbType.VarChar,800), new SqlParameter("@ModifiedDate", SqlDbType.DateTime), new SqlParameter("@ModifiedUserID", SqlDbType.VarChar,50), new SqlParameter("@Summary",SqlDbType.VarChar) }; parameters[0].Value = st.ID; parameters[1].Value = st.Title; parameters[2].Value = st.ReasonType; parameters[3].Value = st.InStorageID; parameters[4].Value = st.OutStorageID; parameters[5].Value = st.ApplyUserID; parameters[6].Value = st.ApplyDeptID; parameters[7].Value = st.OutDeptID; parameters[8].Value = st.RequireInDate; parameters[9].Value = st.TransferPrice; parameters[10].Value = st.TransferCount; parameters[11].Value = st.TransferFeeSum; parameters[12].Value = st.Remark; parameters[13].Value = st.ModifiedDate; parameters[14].Value = st.ModifiedUserID; parameters[15].Value = st.Summary; #endregion SqlCommand SqlMainCmd = new SqlCommand(); SqlMainCmd.CommandText = strSql.ToString(); SqlMainCmd.Parameters.AddRange(parameters); ArrayList SqlCmdList = new ArrayList(); SqlCmdList.Add(SqlMainCmd); #region 拓展属性 SqlCommand cmd = new SqlCommand(); GetExtAttrCmd(st, ht, cmd); if (ht.Count > 0) SqlCmdList.Add(cmd); #endregion #region 构造调拨单明细SQL字符串 StringBuilder sbDel = new StringBuilder(); sbDel.Append("DELETE officedba.StorageTransferDetail WHERE TransferNo=@TransferNo AND CompanyCD=@CompanyCD"); SqlParameter[] Paras = { new SqlParameter("@TransferNo",SqlDbType.VarChar), new SqlParameter("@CompanyCD",SqlDbType.VarChar) }; Paras[0].Value = st.TransferNo; Paras[1].Value = st.CompanyCD; SqlCommand sqlDelCmd = new SqlCommand(); sqlDelCmd.CommandText = sbDel.ToString(); sqlDelCmd.Parameters.AddRange(Paras); SqlCmdList.Add(sqlDelCmd); foreach (StorageTransferDetail std in stdList) { StringBuilder strSubSql = new StringBuilder(); strSubSql.Append("insert into officedba.StorageTransferDetail("); strSubSql.Append("CompanyCD,TransferNo,SortNo,ProductID,UnitID,TranCount,TranPrice,TranPriceTotal,Remark,ModifiedDate,ModifiedUserID,UsedUnitID,UsedUnitCount,UsedPrice,ExRate,BatchNo)"); strSubSql.Append(" values ("); strSubSql.Append("@CompanyCD,@TransferNo,@SortNo,@ProductID,@UnitID,@TranCount,@TranPrice,@TranPriceTotal,@Remark,@ModifiedDate,@ModifiedUserID,@UsedUnitID,@UsedUnitCount,@UsedPrice,@ExRate,@BatchNo)"); SqlParameter[] subparas = { new SqlParameter("@CompanyCD", SqlDbType.VarChar,8), new SqlParameter("@TransferNo", SqlDbType.VarChar,50), new SqlParameter("@SortNo", SqlDbType.Int,4), new SqlParameter("@ProductID", SqlDbType.Int,4), new SqlParameter("@UnitID", SqlDbType.Int,4), new SqlParameter("@TranCount", SqlDbType.Decimal,9), new SqlParameter("@TranPrice", SqlDbType.Decimal,9), new SqlParameter("@TranPriceTotal", SqlDbType.Decimal,9), new SqlParameter("@Remark", SqlDbType.VarChar,800), new SqlParameter("@ModifiedDate", SqlDbType.DateTime), new SqlParameter("@ModifiedUserID", SqlDbType.VarChar,50), new SqlParameter("@UsedUnitID", SqlDbType.Int,4), new SqlParameter("@UsedUnitCount", SqlDbType.Decimal,9), new SqlParameter("@UsedPrice", SqlDbType.Decimal,9), new SqlParameter("@ExRate", SqlDbType.Decimal,9), new SqlParameter("@BatchNo",SqlDbType.VarChar)}; subparas[0].Value = std.CompanyCD; subparas[1].Value = std.TransferNo; subparas[2].Value = std.SortNo; subparas[3].Value = std.ProductID; if (std.UnitID != null) subparas[4].Value = std.UnitID; else subparas[4].Value = DBNull.Value; subparas[5].Value = std.TranCount; subparas[6].Value = std.TranPrice; subparas[7].Value = std.TranPriceTotal; subparas[8].Value = std.Remark; subparas[9].Value = std.ModifiedDate; subparas[10].Value = std.ModifiedUserID; subparas[11].Value = std.UsedUnitID; subparas[12].Value = std.UsedUnitCount; subparas[13].Value = std.UsedPrice; subparas[14].Value = std.ExRate; subparas[15].Value = std.BatchNo; SqlCommand sqlSubCmd = new SqlCommand(); sqlSubCmd.Parameters.AddRange(subparas); sqlSubCmd.CommandText = strSubSql.ToString(); SqlCmdList.Add(sqlSubCmd); } #endregion bool result = SqlHelper.ExecuteTransWithArrayList(SqlCmdList); if (result) return "1|"; else return "3|"; }
/// <summary> /// 扩展属性保存操作 /// </summary> /// <returns></returns> private static void GetExtAttrCmd(StorageTransfer model, Hashtable htExtAttr, SqlCommand cmd) { try { string strSql = string.Empty; strSql = "UPDATE officedba.StorageTransfer 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 TransferNo = @TransferNo"; cmd.Parameters.AddWithValue("@CompanyCD", model.CompanyCD); cmd.Parameters.AddWithValue("@TransferNo", model.TransferNo); cmd.CommandText = strSql; } catch (Exception) { } }
public static string AddStorageTransfer(StorageTransfer st, List<StorageTransferDetail> stdList, Hashtable ht) { #region 构造SQL字符串 StringBuilder strMainSql = new StringBuilder(); strMainSql.Append("insert into officedba.StorageTransfer("); strMainSql.Append("CompanyCD,TransferNo,Title,ReasonType,InStorageID,OutStorageID,ApplyUserID,ApplyDeptID,OutDeptID,RequireInDate,TransferPrice,TransferFeeSum,TransferCount,BusiStatus,Remark,Creator,CreateDate,BillStatus,ModifiedDate,ModifiedUserID,Summary)"); strMainSql.Append(" values ("); strMainSql.Append("@CompanyCD,@TransferNo,@Title,@ReasonType,@InStorageID,@OutStorageID,@ApplyUserID,@ApplyDeptID,@OutDeptID,@RequireInDate,@TransferPrice,@TransferFeeSum,@TransferCount,@BusiStatus,@Remark,@Creator,@CreateDate,@BillStatus,@ModifiedDate,@ModifiedUserID,@Summary)"); strMainSql.Append(";select @ID=@@IDENTITY"); SqlParameter[] MainParas = { new SqlParameter("@CompanyCD", SqlDbType.VarChar,8), new SqlParameter("@TransferNo", SqlDbType.VarChar,50), new SqlParameter("@Title", SqlDbType.VarChar,100), new SqlParameter("@ReasonType", SqlDbType.Int,4), new SqlParameter("@InStorageID", SqlDbType.Int,4), new SqlParameter("@OutStorageID", SqlDbType.Int,4), new SqlParameter("@ApplyUserID", SqlDbType.Int,4), new SqlParameter("@ApplyDeptID", SqlDbType.Int,4), new SqlParameter("@OutDeptID", SqlDbType.Int,4), new SqlParameter("@RequireInDate", SqlDbType.DateTime), new SqlParameter("@TransferPrice", SqlDbType.Decimal,9), new SqlParameter("@TransferFeeSum",SqlDbType.Decimal,9), new SqlParameter("@TransferCount", SqlDbType.Decimal,9), new SqlParameter("@BusiStatus", SqlDbType.Char,1), new SqlParameter("@Remark", SqlDbType.VarChar,800), new SqlParameter("@Creator", SqlDbType.Int,4), new SqlParameter("@CreateDate", SqlDbType.DateTime), new SqlParameter("@BillStatus", SqlDbType.Char,1), new SqlParameter("@ModifiedDate", SqlDbType.DateTime), new SqlParameter("@ModifiedUserID", SqlDbType.VarChar,50), new SqlParameter("@Summary",SqlDbType.VarChar), new SqlParameter("@ID",SqlDbType.Int)}; MainParas[0].Value = st.CompanyCD; MainParas[1].Value = st.TransferNo; MainParas[2].Value = st.Title; MainParas[3].Value = st.ReasonType; MainParas[4].Value = st.InStorageID; MainParas[5].Value = st.OutStorageID; MainParas[6].Value = st.ApplyUserID; MainParas[7].Value = st.ApplyDeptID; MainParas[8].Value = st.OutDeptID; MainParas[9].Value = st.RequireInDate; MainParas[10].Value = st.TransferPrice; MainParas[11].Value = st.TransferFeeSum; MainParas[12].Value = st.TransferCount; MainParas[13].Value = st.BusiStatus; MainParas[14].Value = st.Remark; MainParas[15].Value = st.Creator; MainParas[16].Value = st.CreateDate; MainParas[17].Value = st.BillStatus; MainParas[18].Value = st.ModifiedDate; MainParas[19].Value = st.ModifiedUserID; MainParas[20].Value = st.Summary; MainParas[21].Direction = ParameterDirection.Output; #endregion SqlCommand sqlMainCmd = new SqlCommand(); sqlMainCmd.CommandText = strMainSql.ToString(); sqlMainCmd.Parameters.AddRange(MainParas); ArrayList SqlCmdList = new ArrayList(); SqlCmdList.Add(sqlMainCmd); #region 拓展属性 SqlCommand cmd = new SqlCommand(); GetExtAttrCmd(st, ht, cmd); if (ht.Count > 0) SqlCmdList.Add(cmd); #endregion #region 构造明细SQL字符串 foreach (StorageTransferDetail std in stdList) { StringBuilder strSubSql = new StringBuilder(); strSubSql.Append("insert into officedba.StorageTransferDetail("); strSubSql.Append("CompanyCD,TransferNo,SortNo,ProductID,UnitID,TranCount,TranPrice,TranPriceTotal,Remark,ModifiedDate,ModifiedUserID,UsedUnitID,UsedUnitCount,UsedPrice,ExRate,BatchNo)"); strSubSql.Append(" values ("); strSubSql.Append("@CompanyCD,@TransferNo,@SortNo,@ProductID,@UnitID,@TranCount,@TranPrice,@TranPriceTotal,@Remark,@ModifiedDate,@ModifiedUserID,@UsedUnitID,@UsedUnitCount,@UsedPrice,@ExRate,@BatchNo)"); SqlParameter[] parameters = { new SqlParameter("@CompanyCD", SqlDbType.VarChar,8), new SqlParameter("@TransferNo", SqlDbType.VarChar,50), new SqlParameter("@SortNo", SqlDbType.Int,4), new SqlParameter("@ProductID", SqlDbType.Int,4), new SqlParameter("@UnitID", SqlDbType.Int,4), new SqlParameter("@TranCount", SqlDbType.Decimal,9), new SqlParameter("@TranPrice", SqlDbType.Decimal,9), new SqlParameter("@TranPriceTotal", SqlDbType.Decimal,9), new SqlParameter("@Remark", SqlDbType.VarChar,800), new SqlParameter("@ModifiedDate", SqlDbType.DateTime), new SqlParameter("@ModifiedUserID", SqlDbType.VarChar,50), new SqlParameter("@UsedUnitID", SqlDbType.Int,4), new SqlParameter("@UsedUnitCount", SqlDbType.Decimal,9), new SqlParameter("@UsedPrice", SqlDbType.Decimal,9), new SqlParameter("@ExRate", SqlDbType.Decimal,9), new SqlParameter("@BatchNo",SqlDbType.VarChar)}; parameters[0].Value = std.CompanyCD; parameters[1].Value = std.TransferNo; parameters[2].Value = std.SortNo; parameters[3].Value = std.ProductID; if (std.UnitID != null) parameters[4].Value = std.UnitID; else parameters[4].Value = DBNull.Value; parameters[5].Value = std.TranCount; parameters[6].Value = std.TranPrice; parameters[7].Value = std.TranPriceTotal; parameters[8].Value = std.Remark; parameters[9].Value = std.ModifiedDate; parameters[10].Value = std.ModifiedUserID; parameters[11].Value = std.UsedUnitID; parameters[12].Value = std.UsedUnitCount; parameters[13].Value = std.UsedPrice; parameters[14].Value = std.ExRate; parameters[15].Value = std.BatchNo; SqlCommand sqlSubCmd = new SqlCommand(); sqlSubCmd.Parameters.AddRange(parameters); sqlSubCmd.CommandText = strSubSql.ToString(); SqlCmdList.Add(sqlSubCmd); } #endregion bool result = SqlHelper.ExecuteTransWithArrayList(SqlCmdList); if (result) { return "1|" + ((SqlCommand)SqlCmdList[0]).Parameters["@ID"].Value.ToString() + "#" + st.TransferNo; } else return "3|保存数据失败"; }
protected void LoadPrintInfo() { PrintParameterSettingModel model = new PrintParameterSettingModel(); model.CompanyCD = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).CompanyCD; model.BillTypeFlag = int.Parse(ConstUtil.BILL_TYPEFLAG_STORAGE); model.PrintTypeFlag = ConstUtil.PRINTBILL_TYPEFLAG_TRANSFER; StorageInitailModel OutSellM_ = new StorageInitailModel(); OutSellM_.CompanyCD = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).CompanyCD; OutSellM_.ID = this.intMrpID.ToString(); /*此处需注意在模板设置表里的字段和取基本信息的字段是否一致*/ string[,] aBase = { { "{ExtField1}", "ExtField1"}, { "{ExtField2}", "ExtField2"}, { "{ExtField3}", "ExtField3"}, { "{ExtField4}", "ExtField4"}, { "{ExtField5}", "ExtField5"}, { "{ExtField6}", "ExtField6"}, { "{ExtField7}", "ExtField7"}, { "{ExtField8}", "ExtField8"}, { "{ExtField9}", "ExtField9"}, { "{ExtField10}", "ExtField10"}, { "调拨单编号", "TransferNo"}, { "调拨单主题", "Title"}, { "调拨申请人", "ApplyUserIDName" }, { "要货部门", "ApplyDeptIDName" }, { "调入仓库", "InStorageName"}, { "要求到货日期", "RequireInDate"}, { "调拨原因 ", "Reason"}, { "调货部门 ", "OutDeptIDName"}, { "调出仓库 ", "OutStorageName"}, { "业务状态", "BusiStatusText"}, { "摘要", "Summary"}, { "调拨数量合计 ", "TransferCount"}, { "调拨金额合计 ", "TransferPrice"}, { "调拨费用 ", "TransferFeeSum"}, { "制单人", "CreatorName"}, { "制单日期", "CreateDate"}, { "单据状态", "BillStatusText"}, { "确认人", "ConfirmorName"}, { "确认日期", "ConfirmDate"}, { "结单人", "CloserName"}, { "结单日期", "CloseDate"}, { "最后更新人", "ModifiedUserID"}, { "最后更新日期", "ModifiedDate"}, { "备注", "Remark"}, }; string[,] aDetail =null; if(!UserInfo.IsMoreUnit) aDetail= new string[,] { { "序号", "SortNo"}, { "物品编号", "ProdNo"}, { "物品名称", "ProductName" }, {"批次","BatchNo"}, { "规格", "Specification" }, { "单位", "UnitName"}, { "调拨单价", "TranPrice"}, { "调拨数量 ", "TranCount"}, { "调拨金额 ", "TranPriceTotal"}, { "已出库数量 ", "OutCount"}, { "已入库数量 ", "InCount"}, { "备注 ", "Remark"}, }; else aDetail = new string[,] { { "序号", "SortNo"}, { "物品编号", "ProdNo"}, { "物品名称", "ProductName" }, {"批次","BatchNo"}, { "规格", "Specification" }, { "基本单位", "UnitName"}, {"基本数量","TranCount"}, { "单位", "UsedUnitName"}, { "调拨单价", "TranPrice"}, { "调拨数量 ", "UsedUnitCount"}, { "调拨金额 ", "TranPriceTotal"}, { "已出库数量 ", "OutCount"}, { "已入库数量 ", "InCount"}, { "备注 ", "Remark"}, }; #region 1.扩展属性 int countExt = 0; DataTable dtExtTable = XBase.Business.Office.SupplyChain.TableExtFieldsBus.GetAllList(((UserInfoUtil)SessionUtil.Session["UserInfo"]).CompanyCD, "", "officedba.StorageTransfer"); if (dtExtTable.Rows.Count > 0) { for (int i = 0; i < dtExtTable.Rows.Count; i++) { for (int x = 0; x < (aBase.Length / 2) - 15; x++) { if (x == i) { aBase[x, 0] = dtExtTable.Rows[i]["EFDesc"].ToString(); countExt++; } } } } #endregion string No = Request.QueryString["No"].ToString(); DataTable dbPrint = XBase.Business.Common.PrintParameterSettingBus.GetPrintParameterSettingInfo(model); XBase.Model.Office.StorageManager.StorageTransfer st = new XBase.Model.Office.StorageManager.StorageTransfer(); st.ID = intMrpID; XBase.Model.Office.StorageManager.StorageTransferDetail std = new XBase.Model.Office.StorageManager.StorageTransferDetail(); std.CompanyCD = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).CompanyCD; std.TransferNo = No; /*读取数据*/ DataTable dtMRP = XBase.Business.Office.StorageManager.StorageTransferBus.GetStorageTransferInfoPrint(st); DataTable dtDetail = XBase.Business.Office.StorageManager.StorageTransferBus.GetStorageTransferDetailInfo(std); string strBaseFields = ""; string strDetailFields = ""; if (dbPrint.Rows.Count > 0) { #region 设置过打印模板设置时 直接取出表里设置的值 isSeted.Value = "1"; strBaseFields = dbPrint.Rows[0]["BaseFields"].ToString(); strDetailFields = dbPrint.Rows[0]["DetailFields"].ToString(); #endregion } else { #region 未设置过打印模板设置 默认显示所有的 isSeted.Value = "0"; /*未设置过打印模板设置时,默认显示的字段 基本信息字段*/ for (int m = 10; m < aBase.Length / 2; m++) { strBaseFields = strBaseFields + aBase[m, 1] + "|"; } /*未设置过打印模板设置时,默认显示的字段 基本信息字段+扩展信息字段*/ if (countExt > 0) { for (int i = 0; i < countExt; i++) { strBaseFields = strBaseFields + "ExtField" + (i + 1) + "|"; } } /*未设置过打印模板设置时,默认显示的字段 明细信息字段*/ for (int n = 0; n < aDetail.Length / 2; n++) { strDetailFields = strDetailFields + aDetail[n, 1] + "|"; } #endregion } #region 2.主表信息 if (!string.IsNullOrEmpty(strBaseFields)) { tableBase.InnerHtml = WritePrintPageTable("库存调拨单", strBaseFields.TrimEnd('|'), strDetailFields.TrimEnd('|'), aBase, aDetail, dtMRP, dtDetail, true); } #endregion #region 3.明细信息 if (!string.IsNullOrEmpty(strDetailFields)) { tableDetail.InnerHtml = WritePrintPageTable("库存调拨单", strBaseFields.TrimEnd('|'), strDetailFields.TrimEnd('|'), aBase, aDetail, dtMRP, dtDetail, false); } #endregion }
protected void LoadPrintInfo() { PrintParameterSettingModel model = new PrintParameterSettingModel(); model.CompanyCD = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).CompanyCD; model.BillTypeFlag = int.Parse(ConstUtil.BILL_TYPEFLAG_STORAGE); model.PrintTypeFlag = ConstUtil.PRINTBILL_TYPEFLAG_TRANSFER; StorageInitailModel OutSellM_ = new StorageInitailModel(); OutSellM_.CompanyCD = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).CompanyCD; OutSellM_.ID = this.intMrpID.ToString(); /*此处需注意在模板设置表里的字段和取基本信息的字段是否一致*/ string[,] aBase = { { "{ExtField1}", "ExtField1" }, { "{ExtField2}", "ExtField2" }, { "{ExtField3}", "ExtField3" }, { "{ExtField4}", "ExtField4" }, { "{ExtField5}", "ExtField5" }, { "{ExtField6}", "ExtField6" }, { "{ExtField7}", "ExtField7" }, { "{ExtField8}", "ExtField8" }, { "{ExtField9}", "ExtField9" }, { "{ExtField10}", "ExtField10" }, { "调拨单编号", "TransferNo" }, { "调拨单主题", "Title" }, { "调拨申请人", "ApplyUserIDName" }, { "要货部门", "ApplyDeptIDName" }, { "调入仓库", "InStorageName" }, { "要求到货日期", "RequireInDate" }, { "调拨原因 ", "Reason" }, { "调货部门 ", "OutDeptIDName" }, { "调出仓库 ", "OutStorageName" }, { "业务状态", "BusiStatusText" }, { "摘要", "Summary" }, { "调拨数量合计 ", "TransferCount" }, { "调拨金额合计 ", "TransferPrice" }, { "调拨费用 ", "TransferFeeSum" }, { "制单人", "CreatorName" }, { "制单日期", "CreateDate" }, { "单据状态", "BillStatusText" }, { "确认人", "ConfirmorName" }, { "确认日期", "ConfirmDate" }, { "结单人", "CloserName" }, { "结单日期", "CloseDate" }, { "最后更新人", "ModifiedUserID" }, { "最后更新日期", "ModifiedDate" }, { "备注", "Remark" }, }; string[,] aDetail = null; if (!UserInfo.IsMoreUnit) { aDetail = new string[, ] { { "序号", "SortNo" }, { "物品编号", "ProdNo" }, { "物品名称", "ProductName" }, { "批次", "BatchNo" }, { "规格", "Specification" }, { "单位", "UnitName" }, { "调拨单价", "TranPrice" }, { "调拨数量 ", "TranCount" }, { "调拨金额 ", "TranPriceTotal" }, { "已出库数量 ", "OutCount" }, { "已入库数量 ", "InCount" }, { "备注 ", "Remark" }, } } ; else { aDetail = new string[, ] { { "序号", "SortNo" }, { "物品编号", "ProdNo" }, { "物品名称", "ProductName" }, { "批次", "BatchNo" }, { "规格", "Specification" }, { "基本单位", "UnitName" }, { "基本数量", "TranCount" }, { "单位", "UsedUnitName" }, { "调拨单价", "TranPrice" }, { "调拨数量 ", "UsedUnitCount" }, { "调拨金额 ", "TranPriceTotal" }, { "已出库数量 ", "OutCount" }, { "已入库数量 ", "InCount" }, { "备注 ", "Remark" }, } }; #region 1.扩展属性 int countExt = 0; DataTable dtExtTable = XBase.Business.Office.SupplyChain.TableExtFieldsBus.GetAllList(((UserInfoUtil)SessionUtil.Session["UserInfo"]).CompanyCD, "", "officedba.StorageTransfer"); if (dtExtTable.Rows.Count > 0) { for (int i = 0; i < dtExtTable.Rows.Count; i++) { for (int x = 0; x < (aBase.Length / 2) - 15; x++) { if (x == i) { aBase[x, 0] = dtExtTable.Rows[i]["EFDesc"].ToString(); countExt++; } } } } #endregion string No = Request.QueryString["No"].ToString(); DataTable dbPrint = XBase.Business.Common.PrintParameterSettingBus.GetPrintParameterSettingInfo(model); XBase.Model.Office.StorageManager.StorageTransfer st = new XBase.Model.Office.StorageManager.StorageTransfer(); st.ID = intMrpID; XBase.Model.Office.StorageManager.StorageTransferDetail std = new XBase.Model.Office.StorageManager.StorageTransferDetail(); std.CompanyCD = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).CompanyCD; std.TransferNo = No; /*读取数据*/ DataTable dtMRP = XBase.Business.Office.StorageManager.StorageTransferBus.GetStorageTransferInfoPrint(st); DataTable dtDetail = XBase.Business.Office.StorageManager.StorageTransferBus.GetStorageTransferDetailInfo(std); string strBaseFields = ""; string strDetailFields = ""; if (dbPrint.Rows.Count > 0) { #region 设置过打印模板设置时 直接取出表里设置的值 isSeted.Value = "1"; strBaseFields = dbPrint.Rows[0]["BaseFields"].ToString(); strDetailFields = dbPrint.Rows[0]["DetailFields"].ToString(); #endregion } else { #region 未设置过打印模板设置 默认显示所有的 isSeted.Value = "0"; /*未设置过打印模板设置时,默认显示的字段 基本信息字段*/ for (int m = 10; m < aBase.Length / 2; m++) { strBaseFields = strBaseFields + aBase[m, 1] + "|"; } /*未设置过打印模板设置时,默认显示的字段 基本信息字段+扩展信息字段*/ if (countExt > 0) { for (int i = 0; i < countExt; i++) { strBaseFields = strBaseFields + "ExtField" + (i + 1) + "|"; } } /*未设置过打印模板设置时,默认显示的字段 明细信息字段*/ for (int n = 0; n < aDetail.Length / 2; n++) { strDetailFields = strDetailFields + aDetail[n, 1] + "|"; } #endregion } #region 2.主表信息 if (!string.IsNullOrEmpty(strBaseFields)) { tableBase.InnerHtml = WritePrintPageTable("库存调拨单", strBaseFields.TrimEnd('|'), strDetailFields.TrimEnd('|'), aBase, aDetail, dtMRP, dtDetail, true); } #endregion #region 3.明细信息 if (!string.IsNullOrEmpty(strDetailFields)) { tableDetail.InnerHtml = WritePrintPageTable("库存调拨单", strBaseFields.TrimEnd('|'), strDetailFields.TrimEnd('|'), aBase, aDetail, dtMRP, dtDetail, false); } #endregion }