public static bool ConfirmBill(StorageInPurchaseModel model, out string Msg)
        {
            //获取登陆用户信息
            UserInfoUtil userInfo = (UserInfoUtil)SessionUtil.Session["UserInfo"];

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

            Msg = "";

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

            //执行删除操作
            try
            {
                //执行更新
                isSucc = StorageInPurchaseDHHelper.ConfirmBill(model, out Msg);
            }
            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);
        }
        /// <summary>
        /// 采购入库单插入(插入采购入库单及其详细)
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public static bool InsertStorageInPurchase(StorageInPurchaseModel model, List <StorageInPurchaseDetailModel> 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 = StorageInPurchaseDHHelper.InsertStorageInPurchase(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.InNo);

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

            //登陆日志
            LogDBHelper.InsertLog(logModel);
            return(isSucc);
        }
 /// <summary>
 /// 获取采购入库及详细信息
 /// </summary>
 /// <returns>DataTable</returns>
 public static DataTable GetStorageInPurchaseDetailInfo(StorageInPurchaseModel model)
 {
     try
     {
         return(StorageInPurchaseDHHelper.GetStorageInPurchaseDetailInfo(model));
     }
     catch (System.Exception ex)
     {
         throw ex;
     }
 }
 public static DataTable GetStorageInPurchaseTableBycondition(string BatchNo, StorageInPurchaseModel model, string timeStart, string timeEnd, string FromBillNo, string StorageID, string orderby)
 {
     try
     {
         return(StorageInPurchaseDHHelper.GetStorageInPurchaseTableBycondition(BatchNo, model, timeStart, timeEnd, FromBillNo, StorageID, orderby));
     }
     catch (System.Exception ex)
     {
         throw ex;
     }
 }
 /// <summary>
 /// 查询采购入库列表
 /// </summary>
 /// <returns>DataTable</returns>
 public static DataTable GetStorageInPurchaseTableBycondition(string BatchNo, StorageInPurchaseModel model, string timeStart, string timeEnd, string FromBillNo, string StorageID, int pageIndex, int pageCount, string ord, ref int TotalCount)
 {
     try
     {
         return(StorageInPurchaseDHHelper.GetStorageInPurchaseTableBycondition(BatchNo, model, timeStart, timeEnd, FromBillNo, StorageID, pageIndex, pageCount, ord, ref TotalCount));
     }
     catch (System.Exception ex)
     {
         throw ex;
     }
 }
Beispiel #6
0
    protected void btnImport_Click(object sender, ImageClickEventArgs e)
    {
        StorageInPurchaseModel model = new StorageInPurchaseModel();
        string EnterDateStart        = string.Empty;
        string EnterDateEnd          = string.Empty;
        string StorageID             = string.Empty;
        string FromBillNo            = string.Empty;

        model.CompanyCD  = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).CompanyCD;
        model.InNo       = txtInNo.Value;
        model.Title      = txtTitle.Value;
        model.Taker      = txtTakerID.Value;
        model.Executor   = txtExecutorID.Value;
        model.Checker    = txtCheckerID.Value;
        model.DeptID     = txtDeptID.Value;
        StorageID        = ddlStorageID.SelectedValue;
        model.BillStatus = sltBillStatus.Value;
        EnterDateStart   = txtEnterDateStart.Value;
        EnterDateEnd     = txtEnterDateEnd.Value;
        FromBillNo       = txtFromBillID.Value;
        string BatchNo = txtBatchNo.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";
            }
        }
        DataTable dt = StorageInPurchaseBus.GetStorageInPurchaseTableBycondition(BatchNo, model, EnterDateStart, EnterDateEnd, FromBillNo, StorageID, orderBy);

        if (((UserInfoUtil)SessionUtil.Session["UserInfo"]).IsDisplayPrice)
        {
            OutputToExecl.ExportToTableFormat(this, dt,
                                              new string[] { "入库单编号", "入库单主题", "采购到货单", "交货人", "验货人", "入库部门", "入库人", "入库时间", "入库数量", "入库金额", "摘要", "单据状态" },
                                              new string[] { "InNo", "Title", "ArriveNo", "Taker", "Checker", "DeptName", "Executor", "EnterDate", "CountTotal", "TotalPrice", "Summary", "BillStatus" },
                                              "采购入库单列表");
        }
        else
        {
            OutputToExecl.ExportToTableFormat(this, dt,
                                              new string[] { "入库单编号", "入库单主题", "采购到货单", "交货人", "验货人", "入库部门", "入库人", "入库时间", "入库数量", "摘要", "单据状态" },
                                              new string[] { "InNo", "Title", "ArriveNo", "Taker", "Checker", "DeptName", "Executor", "EnterDate", "CountTotal", "Summary", "BillStatus" },
                                              "采购入库单列表");
        }
    }
 /// <summary>
 ///
 /// </summary>
 /// <param name="model">CompanyCD,ID</param>
 /// <returns></returns>
 public static bool ISConfirmBill(StorageInPurchaseModel model)
 {
     return(StorageInPurchaseDHHelper.ISConfirmBill(model));
 }
    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_INPURCHASE;

        StorageInPurchaseModel InPurchaseM_ = new StorageInPurchaseModel();

        InPurchaseM_.CompanyCD = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).CompanyCD;
        InPurchaseM_.ID        = this.intMrpID.ToString();

        /*此处需注意在模板设置表里的字段和取基本信息的字段是否一致*/
        string[,] aBase;
        string[,] aDetail;
        if (GetIsDisplayPrice() != "none")
        {
            aBase = new string[, ] {
                { "{ExtField1}", "ExtField1" },
                { "{ExtField2}", "ExtField2" },
                { "{ExtField3}", "ExtField3" },
                { "{ExtField4}", "ExtField4" },
                { "{ExtField5}", "ExtField5" },
                { "{ExtField6}", "ExtField6" },
                { "{ExtField7}", "ExtField7" },
                { "{ExtField8}", "ExtField8" },
                { "{ExtField9}", "ExtField9" },
                { "{ExtField10}", "ExtField10" },
                { "入库单编号", "InNo" },
                { "入库单主题", "Title" },
                { "源单类型", "FromTypeName" },
                { "采购到货单", "ArriveNo" },
                { "供应商", "ProviderName" },
                { "采购员", "PurchaserName" },
                { "采购部门", "DeptName" },
                { "交货人", "TakerName" },
                { "验收人", "CheckerName" },
                { "入库部门", "InPutDeptName" },
                { "入库人", "ExecutorName" },
                { "入库时间", "EnterDate" },
                { "摘要", "Summary" },
                { "批次", "BatchNo" },
                { "备注", "Remark" },
                { "数量合计", "CountTotal" },
                { "金额合计", "B_TotalPrice" },
                { "制单人", "CreatorName" },
                { "制单日期", "CreateDate" },
                { "确认人", "ConfirmorName" },
                { "确认日期", "ConfirmDate" },
                { "结单人", "CloserName" },
                { "结单日期", "CloseDate" },
                { "最后更新人", "ModifiedUserName" },
                { "最后更新日期", "ModifiedDate" },
                { "单据状态", "BillStatus" },
            };

            if (HiddenMoreUnit.Value == "true")
            {
                aDetail = new string[, ] {
                    { "序号", "SortNo" },
                    { "物品编号", "ProductNo" },
                    { "物品名称", "ProductName" },
                    { "颜色", "ColorName" },
                    { "规格", "Specification" },
                    { "基本单位", "UnitID" },
                    { "单位", "UsedUnitName" },             //++
                    { "仓库", "StorageName" },
                    { "通知数量", "FromBillCount" },
                    { "已入库数量", "InCount" },
                    { "未入库数量", "NotInCount" },
                    { "基本数量", "ProductCount" },
                    { "数量", "UsedUnitCount" },            //++
                    { "单价", "UnitPrice" },
                    { "税率", "TaxRate" },
                    { "金额", "TotalPrice" },
                    { "已退货数量", "BackCount" },
                };
            }
            else
            {
                aDetail = new string[, ] {
                    { "序号", "SortNo" },
                    { "物品编号", "ProductNo" },
                    { "物品名称", "ProductName" },
                    { "颜色", "ColorName" },
                    { "规格", "Specification" },
                    { "单位", "UnitID" },
                    { "仓库", "StorageName" },
                    { "通知数量", "FromBillCount" },
                    { "已入库数量", "InCount" },
                    { "未入库数量", "NotInCount" },
                    { "实收数量", "ProductCount" },
                    { "单价", "UnitPrice" },
                    { "税率", "TaxRate" },
                    { "金额", "TotalPrice" },
                    { "已退货数量", "BackCount" },
                };
            }
        }
        else
        {
            aBase = new string[, ] {
                { "{ExtField1}", "ExtField1" },
                { "{ExtField2}", "ExtField2" },
                { "{ExtField3}", "ExtField3" },
                { "{ExtField4}", "ExtField4" },
                { "{ExtField5}", "ExtField5" },
                { "{ExtField6}", "ExtField6" },
                { "{ExtField7}", "ExtField7" },
                { "{ExtField8}", "ExtField8" },
                { "{ExtField9}", "ExtField9" },
                { "{ExtField10}", "ExtField10" },
                { "入库单编号", "InNo" },
                { "入库单主题", "Title" },
                { "源单类型", "FromTypeName" },
                { "采购到货单", "ArriveNo" },
                { "供应商", "ProviderName" },
                { "采购员", "PurchaserName" },
                { "采购部门", "DeptName" },
                { "交货人", "TakerName" },
                { "验收人", "CheckerName" },
                { "入库部门", "InPutDeptName" },
                { "入库人", "ExecutorName" },
                { "入库时间", "EnterDate" },
                { "摘要", "Summary" },
                { "批次", "BatchNo" },
                { "备注", "Remark" },
                { "数量合计", "CountTotal" },
                { "制单人", "CreatorName" },
                { "制单日期", "CreateDate" },
                { "确认人", "ConfirmorName" },
                { "确认日期", "ConfirmDate" },
                { "结单人", "CloserName" },
                { "结单日期", "CloseDate" },
                { "最后更新人", "ModifiedUserName" },
                { "最后更新日期", "ModifiedDate" },
                { "单据状态", "BillStatus" },
            };

            if (HiddenMoreUnit.Value == "true")
            {
                aDetail = new string[, ] {
                    { "序号", "SortNo" },
                    { "物品编号", "ProductNo" },
                    { "物品名称", "ProductName" },
                    { "颜色", "ColorName" },
                    { "规格", "Specification" },
                    { "基本单位", "UnitID" },
                    { "单位", "UsedUnitName" },             //++
                    { "仓库", "StorageName" },
                    { "通知数量", "FromBillCount" },
                    { "已入库数量", "InCount" },
                    { "未入库数量", "NotInCount" },
                    { "基本数量", "ProductCount" },
                    { "数量", "UsedUnitCount" },            //++
                    { "已退货数量", "BackCount" },
                };
            }
            else
            {
                aDetail = new string[, ] {
                    { "序号", "SortNo" },
                    { "物品编号", "ProductNo" },
                    { "物品名称", "ProductName" },
                    { "颜色", "ColorName" },
                    { "规格", "Specification" },
                    { "单位", "UnitID" },
                    { "仓库", "StorageName" },
                    { "通知数量", "FromBillCount" },
                    { "已入库数量", "InCount" },
                    { "未入库数量", "NotInCount" },
                    { "实收数量", "ProductCount" },
                    { "已退货数量", "BackCount" },
                };
            }
        }

        #region 1.扩展属性
        int       countExt   = 0;
        DataTable dtExtTable = XBase.Business.Office.SupplyChain.TableExtFieldsBus.GetAllList(((UserInfoUtil)SessionUtil.Session["UserInfo"]).CompanyCD, "", "officedba.StorageInPurchase");
        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 dtDetail        = StorageInPurchaseBus.GetStorageInPurchaseDetailInfo(InPurchaseM_.ID, InPurchaseM_.CompanyCD);
        DataTable dtMain          = StorageInPurchaseBus.GetStorageInPurchaseInfo(InPurchaseM_.ID, InPurchaseM_.CompanyCD);
        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, dtDetail, true);
        }
        #endregion

        #region 明细信息
        if (!string.IsNullOrEmpty(strDetailFields))
        {
            tableDetail.InnerHtml = WritePrintPageTable("采购入库单", strBaseFields.TrimEnd('|'), strDetailFields.TrimEnd('|'), aBase, aDetail, dtMain, dtDetail, false);
        }
        #endregion
    }