Example #1
0
        /// <summary>
        /// 插入库存报损和库存报损明细
        /// </summary>
        /// <param name="model"></param>
        /// <param name="modelList"></param>
        /// <returns></returns>
        public static bool InsertStorageLoss(StorageLossModel model, List <StorageLossDetailModel> modelList, Hashtable ht, out int IndexIDentity)
        {
            IndexIDentity = 0;
            //获取登陆用户信息
            UserInfoUtil userInfo = (UserInfoUtil)SessionUtil.Session["UserInfo"];

            //设置公司代码
            model.CompanyCD = userInfo.CompanyCD;
            //定义返回变量
            bool isSucc = false;

            /*
             * 定义日志内容变量
             * 增删改相关的日志,需要输出操作日志,该类型日志插入到数据库
             * 其他的 如出现异常时,需要输出系统日志,该类型日志保存到日志文件
             */
            //获取公司代码
            string companyCD = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).CompanyCD;

            //执行删除操作
            try
            {
                //执行更新
                isSucc = StorageLossDBHelper.InsertStorageLoss(model, modelList, ht, out IndexIDentity);
            }
            catch (Exception ex)
            {
                //输出日志
                WriteSystemLog(userInfo, ex);
            }
            //定义变量
            string remark;

            //成功时
            if (isSucc)
            {
                //设置操作成功标识
                remark = ConstUtil.LOG_PROCESS_SUCCESS;
            }
            else
            {
                //设置操作成功标识
                remark = ConstUtil.LOG_PROCESS_FAILED;
            }
            //操作日志
            LogInfoModel logModel = InitLogInfo(model.LossNo);

            //涉及关键元素 这个需要根据每个页面具体设置,本页面暂时设置为空
            logModel.Element = ConstUtil.LOG_PROCESS_INSERT;
            //设置操作成功标识
            logModel.Remark = remark;

            //登陆日志
            LogDBHelper.InsertLog(logModel);
            return(isSucc);
        }
Example #2
0
        /// <summary>
        /// 确认
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public static bool CancelCloseBill(StorageLossModel model)
        {
            //获取登陆用户信息
            UserInfoUtil userInfo = (UserInfoUtil)SessionUtil.Session["UserInfo"];

            //设置公司代码
            model.CompanyCD = userInfo.CompanyCD;
            //定义返回变量
            bool isSucc = false;

            /*
             * 定义日志内容变量
             * 增删改相关的日志,需要输出操作日志,该类型日志插入到数据库
             * 其他的 如出现异常时,需要输出系统日志,该类型日志保存到日志文件
             */
            //获取公司代码
            string companyCD = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).CompanyCD;

            //执行删除操作
            try
            {
                //执行更新
                isSucc = StorageLossDBHelper.CancelCloseBill(model);
            }
            catch (Exception ex)
            {
                //输出日志
                WriteSystemLog(userInfo, ex);
            }

            //定义变量
            string remark;

            //成功时
            if (isSucc)
            {
                //设置操作成功标识
                remark = ConstUtil.LOG_PROCESS_SUCCESS;
            }
            else
            {
                //设置操作成功标识
                remark = ConstUtil.LOG_PROCESS_FAILED;
            }
            //操作日志
            LogInfoModel logModel = InitLogInfo(model.ID);

            //涉及关键元素 这个需要根据每个页面具体设置,本页面暂时设置为空
            logModel.Element = "取消结单";
            //设置操作成功标识
            logModel.Remark = remark;

            //登陆日志
            LogDBHelper.InsertLog(logModel);
            return(isSucc);
        }
Example #3
0
    protected void btnImport_Click(object sender, ImageClickEventArgs e)
    {
        StorageLossModel model = new StorageLossModel();

        model.CompanyCD = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).CompanyCD;
        string LossDateStart   = string.Empty;
        string LossDateEnd     = string.Empty;
        string TotalPriceStart = string.Empty;
        string TotalPriceEnd   = string.Empty;
        string FlowStatus      = string.Empty;

        model.LossNo     = txtLossNo.Value;
        model.Title      = txtTitle.Value;
        model.DeptID     = txtDeptID.Value;
        model.StorageID  = ddlStorage.SelectedValue;
        model.Executor   = txtExecutorID.Value;
        model.ReasonType = ddlReason.SelectedValue;
        model.BillStatus = sltBillStatus.Value;
        FlowStatus       = sltFlowStatus.Value;
        LossDateStart    = txtLossDateStart.Value;
        LossDateEnd      = txtLossDateEnd.Value;
        TotalPriceStart  = txtTotalPriceStart.Value;
        TotalPriceEnd    = txtTotalPriceEnd.Value;

        string orderBy = txtorderBy.Value;

        if (!string.IsNullOrEmpty(orderBy))
        {
            if (orderBy.Split('_')[1] == "a")
            {
                orderBy = orderBy.Split('_')[0] + " asc";
            }
            else
            {
                orderBy = orderBy.Split('_')[0] + " desc";
            }
        }
        string IndexValue = GetBillExAttrControl1.GetExtIndexValue;
        string TxtValue   = GetBillExAttrControl1.GetExtTxtValue;
        string BatchNo    = this.txtBatchNo.Value.ToString();

        DataTable dt = StorageLossBus.GetStorageLossTableBycondition(model, IndexValue, TxtValue, LossDateStart, LossDateEnd, TotalPriceStart, TotalPriceEnd, FlowStatus, BatchNo, orderBy);

        OutputToExecl.ExportToTableFormat(this, dt,
                                          new string[] { "报损单编号", "报损单主题", "经办人", "报损部门", "报损仓库", "报损时间", "报损原因", "成本金额合计", "单据状态", "审批状态" },
                                          new string[] { "LossNo", "Title", "Executor", "DeptName", "StorageName", "LossDate", "ReasonTypeName", "TotalPrice", "BillStatusName", "FlowStatus" },
                                          "库存报损列表");
    }
Example #4
0
    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_LOSS;

        StorageLossModel LossM_ = new StorageLossModel();

        LossM_.CompanyCD = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).CompanyCD;
        LossM_.ID        = this.intMrpID.ToString();
        string[,] aDetail;
        /*此处需注意在模板设置表里的字段和取基本信息的字段是否一致*/
        string[,] aBase =
        {
            { "{ExtField1}",  "ExtField1"        },
            { "{ExtField2}",  "ExtField2"        },
            { "{ExtField3}",  "ExtField3"        },
            { "{ExtField4}",  "ExtField4"        },
            { "{ExtField5}",  "ExtField5"        },
            { "{ExtField6}",  "ExtField6"        },
            { "{ExtField7}",  "ExtField7"        },
            { "{ExtField8}",  "ExtField8"        },
            { "{ExtField9}",  "ExtField9"        },
            { "{ExtField10}", "ExtField10"       },
            { "报损单编号",        "LossNo"           },
            { "报损单主题",        "Title"            },
            { "经办人",          "ExecutorName"     },
            { "报损部门",         "DeptName"         },
            { "仓库",           "StorageName"      },
            { "报损原因",         "ReasonTypeName"   },
            { "报损日期",         "LossDate"         },
            { "报损数量合计",       "CountTotal"       },
            { "报损金额合计",       "A_TotalPrice"     },
            { "制单人",          "CreatorName"      },
            { "制单日期",         "CreateDate"       },
            { "确认人",          "ConfirmorName"    },
            { "确认日期",         "ConfirmDate"      },
            { "结单人",          "CloserName"       },
            { "结单日期",         "CloseDate"        },
            { "最后更新人",        "ModifiedUserName" },
            { "最后更新日期",       "ModifiedDate"     },
            { "单据状态",         "BillStatusName"   },
            { "备注",           "Remark"           },
            { "摘要",           "Summary"          },
        };

        if (HiddenMoreUnit.Value == "True")
        {
            aDetail = new string[, ] {
                { "序号", "SortNo" },
                { "物品编号", "ProductNo" },
                { "物品名称", "ProductName" },
                { "批次", "BatchNo" },
                { "规格", "Specification" },
                { "基本单位", "UnitID" },
                { "基本数量", "ProductCount" },
                { "单位", "UsedUnitName" },
                { "报损数量", "UsedUnitCount" },
                { "成本单价", "UsedPrice" },
                { "报损金额", "B_TotalPrice" },
                { "备注", "DetaiRemark" },
            };
        }
        else
        {
            aDetail = new string[, ] {
                { "序号", "SortNo" },
                { "物品编号", "ProductNo" },
                { "物品名称", "ProductName" },
                { "批次", "BatchNo" },
                { "规格", "Specification" },
                { "单位", "UnitID" },
                { "报损数量", "ProductCount" },
                { "成本单价", "UnitPrice" },
                { "报损金额", "B_TotalPrice" },
                { "备注", "DetaiRemark" },
            };
        }



        #region 1.扩展属性
        int       countExt   = 0;
        DataTable dtExtTable = XBase.Business.Office.SupplyChain.TableExtFieldsBus.GetAllList(((UserInfoUtil)SessionUtil.Session["UserInfo"]).CompanyCD, "", "officedba.StorageLoss");
        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
        DataTable dbPrint = XBase.Business.Common.PrintParameterSettingBus.GetPrintParameterSettingInfo(model);
        DataTable dtMain  = StorageLossBus.GetStorageLossDetailInfo(LossM_);
        // DataTable dtDetail = MRPBus.GetMRPDetailInfo(modelMRP);
        string strBaseFields   = "";
        string strDetailFields = "";

        if (dbPrint.Rows.Count > 0)
        {
            isSeted.Value   = "1";
            strBaseFields   = dbPrint.Rows[0]["BaseFields"].ToString();
            strDetailFields = dbPrint.Rows[0]["DetailFields"].ToString();
        }
        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 主表信息
        if (!string.IsNullOrEmpty(strBaseFields))
        {
            tableBase.InnerHtml = WritePrintPageTable("库存报损单", strBaseFields.TrimEnd('|'), strDetailFields.TrimEnd('|'), aBase, aDetail, dtMain, dtMain, true);
        }
        #endregion

        #region 明细信息
        if (!string.IsNullOrEmpty(strDetailFields))
        {
            tableDetail.InnerHtml = WritePrintPageTable("库存报损单", strBaseFields.TrimEnd('|'), strDetailFields.TrimEnd('|'), aBase, aDetail, dtMain, dtMain, false);
        }
        #endregion
    }
Example #5
0
 /// <summary>
 /// 获取库存报损详细信息(加载页面的时候)
 /// </summary>
 /// <returns>DataTable</returns>
 public static DataTable GetStorageLossDetailInfo(StorageLossModel model)
 {
     return(StorageLossDBHelper.GetStorageLossDetailInfo(model));
 }
Example #6
0
 public static DataTable GetStorageLossTableBycondition(StorageLossModel model, string IndexValue, string TxtValue, string timeStart, string timeEnd, string TotalPriceStart, string TotalPriceEnd, string FlowStatus, string BatchNo, string orderby)
 {
     return(StorageLossDBHelper.GetStorageLossTableBycondition(model, IndexValue, TxtValue, timeStart, timeEnd, TotalPriceStart, TotalPriceEnd, FlowStatus, BatchNo, orderby));
 }
Example #7
0
 public static bool CancelConfirmBill(StorageLossModel model)
 {
     return(StorageLossDBHelper.CancelConfirmBill(model));
 }
Example #8
0
 /// <summary>
 /// 查询库存报损单
 /// </summary>
 /// <returns>DataTable</returns>
 public static DataTable GetStorageLossTableBycondition(StorageLossModel model, string timeStart, string timeEnd, string TotalPriceStart, string TotalPriceEnd, string FlowStatus, string EFIndex, string EFDesc, int pageIndex, int pageCount, string ord, ref int TotalCount)
 {
     return(StorageLossDBHelper.GetStorageLossTableBycondition(model, timeStart, timeEnd, TotalPriceStart, TotalPriceEnd, FlowStatus, EFIndex, EFDesc, pageIndex, pageCount, ord, ref TotalCount));
 }
        /// <summary>
        /// 查询库存报损单
        /// </summary>
        /// <returns>DataTable</returns>
        public static DataTable GetStorageLossTableBycondition(StorageLossModel model, string timeStart, string timeEnd, string TotalPriceStart, string TotalPriceEnd, string FlowStatus, int pageIndex, int pageCount, string ord, ref int TotalCount, bool iflist)
        {
            StringBuilder sql = new StringBuilder();

            sql.AppendLine("SELECT a.ID                                                                        ");
            sql.AppendLine(",a.LossNo                                                                          ");
            sql.AppendLine(",a.Title                                                                           ");
            sql.AppendLine(",ISNULL(e.EmployeeName,'') as Executor                                             ");
            sql.AppendLine(",CASE isnull(i.FlowStatus,0)                                                       ");
            sql.AppendLine("WHEN 0 THEN ''                                                               ");
            sql.AppendLine("WHEN 1 THEN '待审批'                                                               ");
            sql.AppendLine("WHEN 2 THEN '审批中'                                                               ");
            sql.AppendLine("WHEN 3 THEN '审批通过'                                                             ");
            sql.AppendLine("WHEN 4 THEN '审批不通过'                                                       ");
            sql.AppendLine("WHEN 5 THEN '撤销审批' else ''                                                     ");
            sql.AppendLine("END FlowStatus                                                                     ");
            sql.AppendLine(",ISNULL(f.DeptName,'') as DeptName                                                 ");
            sql.AppendLine(",ISNULL(g.StorageName,'') as StorageName                                           ");
            sql.AppendLine(",ISNULL(CONVERT(VARCHAR(10),a.LossDate,21),'') AS LossDate                         ");
            sql.AppendLine(",ISNull(h.CodeName,'') as ReasonTypeName                                           ");
            sql.AppendLine(",ISNULL(a.TotalPrice,0) as TotalPrice                                              ");
            sql.AppendLine(",case a.billStatus when  '1' then '制单' when '2' then '执行' when '3' then '变更' ");
            sql.AppendLine("when '4' then '手工结单' when '5' then '自动结单' else '' end as BillStatusName    ");
            sql.AppendLine("FROM officedba.StorageLoss a                                                 ");
            sql.AppendLine("left join officedba.EmployeeInfo e on e.ID=a.Executor                              ");
            sql.AppendLine("left join officedba.DeptInfo f on f.ID=a.DeptID                                    ");
            sql.AppendLine("left join officedba.StorageInfo g on g.ID=a.StorageID                              ");
            sql.AppendLine("left join officedba.CodeReasonType h on h.ID=a.ReasonType                          ");
            sql.AppendLine("LEFT OUTER JOIN officedba.FlowInstance i ON a.LossNo=i.BillNo AND i.BillTypeFlag=" + ConstUtil.CODING_RULE_Storage_NO + "");
            sql.AppendLine("AND i.BillTypeCode='" + ConstUtil.CODING_RULE_StorageLoss_NO + "'							         ");
            sql.AppendLine(" AND i.ID=(SELECT max(ID) FROM officedba.FlowInstance AS j");
            sql.AppendLine(" WHERE a.ID = j.BillID AND j.BillTypeFlag = " + ConstUtil.CODING_RULE_Storage_NO + " AND j.BillTypeCode = " + ConstUtil.CODING_RULE_StorageLoss_NO + " )");
            sql.AppendLine("where a.CompanyCD=@CompanyCD");

            // 库存报损单编号、库存报损单主题、报损部门(弹出窗口选择)、报损仓库(选择)、经办人(弹出窗口选择)、报损时间(日期段,日期控件)
            //、报损原因(下拉列表)、成本金额合计(区间)、单据状态(下拉列表)、审批状态(下拉列表)
            SqlCommand comm = new SqlCommand();

            //添加公司代码参数
            comm.Parameters.Add(SqlHelper.GetParameterFromString("@CompanyCD", model.CompanyCD));

            if (!string.IsNullOrEmpty(model.LossNo))
            {
                sql.AppendLine("	and a.LossNo like '%'+ @LossNo +'%' ");
                comm.Parameters.Add(SqlHelper.GetParameterFromString("@LossNo", model.LossNo));
            }
            if (!string.IsNullOrEmpty(model.Title))
            {
                sql.AppendLine(" and a.Title like '%'+ @Title +'%'");
                comm.Parameters.Add(SqlHelper.GetParameterFromString("@Title", model.Title));
            }
            if (!string.IsNullOrEmpty(model.DeptID))
            {
                sql.AppendLine(" and a.DeptID=@DeptID");
                comm.Parameters.Add(SqlHelper.GetParameterFromString("@DeptID", model.DeptID));
            }
            if (!string.IsNullOrEmpty(model.StorageID))
            {
                sql.AppendLine(" and a.StorageID = @StorageID");
                comm.Parameters.Add(SqlHelper.GetParameterFromString("@StorageID", model.StorageID));
            }
            if (!string.IsNullOrEmpty(model.Executor))
            {
                sql.AppendLine(" and a.Executor = @Executor");
                comm.Parameters.Add(SqlHelper.GetParameterFromString("@Executor", model.Executor));
            }
            if (!string.IsNullOrEmpty(FlowStatus))
            {
                if (FlowStatus == "0")
                {
                    sql.AppendLine(" and i.FlowStatus is null");
                }
                else
                {
                    sql.AppendLine(" and i.FlowStatus=@FlowStatus");
                    comm.Parameters.Add(SqlHelper.GetParameterFromString("@FlowStatus", FlowStatus));
                }
            }
            if (!string.IsNullOrEmpty(timeStart))
            {
                sql.AppendLine(" and a.LossDate>=@timeStart");
                comm.Parameters.Add(SqlHelper.GetParameterFromString("@timeStart", timeStart));
            }

            if (!string.IsNullOrEmpty(timeEnd))
            {
                sql.AppendLine(" and a.LossDate<=@timeEnd");
                comm.Parameters.Add(SqlHelper.GetParameterFromString("@timeEnd", timeEnd));
            }
            if (!string.IsNullOrEmpty(model.ReasonType))
            {
                sql.AppendLine(" and a.ReasonType=@ReasonType");
                comm.Parameters.Add(SqlHelper.GetParameterFromString("@ReasonType", model.ReasonType));
            }
            if (!string.IsNullOrEmpty(model.BillStatus))
            {
                sql.AppendLine(" and a.BillStatus=@BillStatus");
                comm.Parameters.Add(SqlHelper.GetParameterFromString("@BillStatus", model.BillStatus));
            }
            if (!string.IsNullOrEmpty(TotalPriceStart))
            {
                sql.AppendLine(" and a.TotalPrice>=@TotalPriceStart");
                comm.Parameters.Add(SqlHelper.GetParameterFromString("@TotalPriceStart", TotalPriceStart));
            }

            if (!string.IsNullOrEmpty(TotalPriceEnd))
            {
                sql.AppendLine(" and a.TotalPrice<=@TotalPriceEnd");
                comm.Parameters.Add(SqlHelper.GetParameterFromString("@TotalPriceEnd", TotalPriceEnd));
            }

            comm.CommandText = sql.ToString();
            if (!iflist)
            {
                if (!string.IsNullOrEmpty(ord))
                {
                    sql.AppendLine(" order by " + ord);
                }
                return(SqlHelper.ExecuteSearch(comm));
            }
            else
            {
                return(SqlHelper.PagerWithCommand(comm, pageIndex, pageCount, ord, ref TotalCount));
            }
        }