示例#1
0
        public static bool ConfirmPuechaseOrder(string CompanyCD, string ID, string FromType, string OrderNo, out string Reason, List<ProductModel> ProductMList, List<ProductModel> ProductMStorList)
        {
            try
            {

                if (!PurchaseOrderDBHelper.CanConfirm(CompanyCD, OrderNo, int.Parse(ID), FromType, out Reason))
                    return false;
                ArrayList lstConfirm = new ArrayList();
                //写确认人,确认时间,单据状态
                lstConfirm.Add(PurchaseOrderDBHelper.ConfirmPurchaseOrder(ID));
                //回写合同表
                if (FromType == "4")
                {
                    foreach (ProductModel ProductM in ProductMList)
                    {
                        lstConfirm.Add(PurchaseOrderDBHelper.WritePurContract(ProductM));
                    }
                }
                else if (FromType == "2")
                {//回写计划表
                    foreach (ProductModel ProductM in ProductMList)
                    {
                        lstConfirm.Add(PurchaseOrderDBHelper.WritePurPlanConfirm(ProductM));
                    }
                }
                //回写库存分仓存量表
                foreach (ProductModel ProductM in ProductMStorList)
                {
                    lstConfirm.Add(PurchaseOrderDBHelper.WriteStorge(ProductM));
                }

                //获取登陆用户信息
                UserInfoUtil userInfo = (UserInfoUtil)SessionUtil.Session["UserInfo"];
                //定义返回变量
                bool isSucc = false;
                /* 
                 * 定义日志内容变量 
                 * 增删改相关的日志,需要输出操作日志,该类型日志插入到数据库
                 * 其他的 如出现异常时,需要输出系统日志,该类型日志保存到日志文件
                 */

                //执行插入操作
                try
                {
                    isSucc = SqlHelper.ExecuteTransWithArrayList(lstConfirm);
                }
                catch (Exception ex)
                {
                    //输出日志
                    WriteSystemLog(userInfo, ex);
                }
                //定义变量
                string remark;
                //成功时
                if (isSucc)
                {
                    //设置操作成功标识
                    remark = ConstUtil.LOG_PROCESS_SUCCESS;
                }
                else
                {
                    //设置操作成功标识 
                    remark = ConstUtil.LOG_PROCESS_FAILED;
                }

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

                //登陆日志
                LogDBHelper.InsertLog(logModel);
                return isSucc;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#2
0
        /// <summary>
        /// 更新采购订单
        /// </summary>
        /// <param name="PurchaseOrderM">主表model</param>
        /// <param name="PurchaseOrderDetailMList">明细表modellist</param>
        /// <param name="ProductMStorList">用于回写库存的物品modellist</param>
        /// <param name="ProductMList">用于回写计划或是合同的物品modellist</param>
        /// <returns>DataTable</returns>
        public static bool UpdatePurchaseOrder(PurchaseOrderModel PurchaseOrderM, List<PurchaseOrderDetailModel> PurchaseOrderDetailMList
            , List<ProductModel> ProductMStorList, List<ProductModel> ProductMList, out string Reason, Hashtable htExtAttr)
        {
            try
            {
                //判断引用源单数量有没有超过,超过了就不让保存
                if (!PurchaseOrderDBHelper.CanSave(PurchaseOrderDetailMList, out Reason))
                    return false;
                //判断该单据有没有确认


                //判断该单据是不是可以确认,包括引用的源单数量是不是合法,有没有到达库存报警上限



                ArrayList lstUpdate = new ArrayList();

                //更新主表
                SqlCommand UpdatePri = PurchaseOrderDBHelper.UpdatePurchaseOrder(PurchaseOrderM);
                lstUpdate.Add(UpdatePri);
                #region 拓展属性
                SqlCommand cmd = new SqlCommand();
                GetExtAttrCmd(PurchaseOrderM, htExtAttr, cmd);
                if (htExtAttr.Count > 0)
                    lstUpdate.Add(cmd);
                #endregion

                string OrderNo = PurchaseOrderM.OrderNo;
                //删除明细
                SqlCommand DeleteDetail = PurchaseOrderDBHelper.DeletePurchaseOrderDetailSingle(OrderNo);
                lstUpdate.Add(DeleteDetail);

                //插入明细
                foreach (PurchaseOrderDetailModel PurchaseOrderDetailM in PurchaseOrderDetailMList)
                {
                    SqlCommand AddDetail = PurchaseOrderDBHelper.InsertPurchaseOrderDetail(PurchaseOrderDetailM, OrderNo);
                    lstUpdate.Add(AddDetail);
                }
                //获取登陆用户信息
                UserInfoUtil userInfo = (UserInfoUtil)SessionUtil.Session["UserInfo"];
                //定义返回变量
                bool isSucc = false;
                /* 
                 * 定义日志内容变量 
                 * 增删改相关的日志,需要输出操作日志,该类型日志插入到数据库
                 * 其他的 如出现异常时,需要输出系统日志,该类型日志保存到日志文件
                 */

                //执行插入操作
                try
                {
                    isSucc = SqlHelper.ExecuteTransWithArrayList(lstUpdate);
                }
                catch (Exception ex)
                {
                    //输出日志
                    WriteSystemLog(userInfo, ex);
                }
                //定义变量
                string remark;
                //成功时
                if (isSucc)
                {
                    //设置操作成功标识
                    remark = ConstUtil.LOG_PROCESS_SUCCESS;
                }
                else
                {
                    //设置操作成功标识 
                    remark = ConstUtil.LOG_PROCESS_FAILED;
                }

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

                //登陆日志
                LogDBHelper.InsertLog(logModel);
                return isSucc;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#3
0
        public static bool DeletePurchaseOrder(string IDs, string OrderNos)
        {
            try
            {
                ArrayList lstDelete = new ArrayList();
                SqlCommand DelPri = PurchaseOrderDBHelper.DeletePurchaseOrder(IDs);
                lstDelete.Add(DelPri);
                SqlCommand DelDtl = PurchaseOrderDBHelper.DeletePurchaseOrderDetail(OrderNos);
                lstDelete.Add(DelDtl);

                //获取登陆用户信息
                UserInfoUtil userInfo = (UserInfoUtil)SessionUtil.Session["UserInfo"];
                //定义返回变量
                bool isSucc = false;
                /* 
                 * 定义日志内容变量 
                 * 增删改相关的日志,需要输出操作日志,该类型日志插入到数据库
                 * 其他的 如出现异常时,需要输出系统日志,该类型日志保存到日志文件
                 */

                //执行删除操作
                try
                {
                    isSucc = SqlHelper.ExecuteTransWithArrayList(lstDelete);
                }
                catch (Exception ex)
                {
                    //输出日志
                    WriteSystemLog(userInfo, ex);
                }


                //定义变量
                string remark;
                //成功时
                if (isSucc)
                {
                    //设置操作成功标识
                    remark = ConstUtil.LOG_PROCESS_SUCCESS;
                }
                else
                {
                    //设置操作成功标识 
                    remark = ConstUtil.LOG_PROCESS_FAILED;
                }

                //获取删除的编号列表
                string[] noList = OrderNos.Split(',');
                //遍历所有编号,登陆操作日志
                for (int i = 0; i < noList.Length; i++)
                {
                    //获取编号
                    string no = noList[i];
                    //替换两边的 '
                    no = no.Replace("'", string.Empty);

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

                    //登陆日志
                    LogDBHelper.InsertLog(logModel);
                }
                return isSucc;

            }
            catch (Exception ex)
            {

                throw ex;
            }

        }
示例#4
0
 /// <summary>
 /// 采购物品分析
 /// </summary>
 public static DataTable GetPurchaseOrderProductDetail(string ProviderID, string DeptID, string BeginDate, string EndDate, string DateType, string DateValue, string ProductID, int pageIndex, int pageCount, string OrderBy, ref int totalCount)
 {
     return PurchaseOrderDBHelper.GetPurchaseOrderProductDetail(ProviderID, DeptID, BeginDate, EndDate, DateType, DateValue, ProductID, pageIndex, pageCount, OrderBy, ref totalCount);
 }
示例#5
0
        public static bool InsertPurchaseOrder(PurchaseOrderModel PurchaseOrderM, List<PurchaseOrderDetailModel> PurchaseOrderDetailMList, out int IndexIDentity, out string Reason, Hashtable htExtAttr)
        {
            try
            {
                IndexIDentity = 0;
                //判断引用源单数量有没有超过,超过了就不让保存
                if (!PurchaseOrderDBHelper.CanSave(PurchaseOrderDetailMList, out Reason))
                    return false;
                ArrayList lstAdd = new ArrayList();
                //插入主表
                SqlCommand AddPri = PurchaseOrderDBHelper.InsertPurchaseOrder(PurchaseOrderM);
                lstAdd.Add(AddPri);
                string OrderNo = PurchaseOrderM.OrderNo;
                //插入明细
                foreach (PurchaseOrderDetailModel PurchaseOrderDetailM in PurchaseOrderDetailMList)
                {
                    SqlCommand AddDetail = PurchaseOrderDBHelper.InsertPurchaseOrderDetail(PurchaseOrderDetailM, OrderNo);
                    lstAdd.Add(AddDetail);
                }
                #region 拓展属性
                SqlCommand cmd = new SqlCommand();
                GetExtAttrCmd(PurchaseOrderM, htExtAttr, cmd);
                if (htExtAttr.Count > 0)
                    lstAdd.Add(cmd);
                #endregion
                //获取登陆用户信息
                UserInfoUtil userInfo = (UserInfoUtil)SessionUtil.Session["UserInfo"];
                //定义返回变量
                bool isSucc = false;
                /* 
                 * 定义日志内容变量 
                 * 增删改相关的日志,需要输出操作日志,该类型日志插入到数据库
                 * 其他的 如出现异常时,需要输出系统日志,该类型日志保存到日志文件
                 */

                //执行插入操作
                try
                {
                    isSucc = SqlHelper.ExecuteTransWithArrayList(lstAdd);
                }
                catch (Exception ex)
                {
                    //输出日志
                    WriteSystemLog(userInfo, ex);
                }


                //定义变量
                string remark;
                //成功时
                if (isSucc)
                {
                    //设置操作成功标识
                    remark = ConstUtil.LOG_PROCESS_SUCCESS;
                    IndexIDentity = int.Parse(((SqlCommand)AddPri).Parameters["@IndexID"].Value.ToString());
                }
                else
                {
                    //设置操作成功标识 
                    remark = ConstUtil.LOG_PROCESS_FAILED;
                    IndexIDentity = 0;
                }

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

                //登陆日志
                LogDBHelper.InsertLog(logModel);
                return isSucc;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#6
0
 public static DataTable GetPurchaseOrderDetail(string OrderStatus, string FlowStatus, string FromType, string Type, string DateType, string BeginDate, string EndDate, string DeptId, string ProviderId, string DateValue, int pageIndex, int pageCount, string OrderBy, ref int totalCount)
 {
     return PurchaseOrderDBHelper.GetPurchaseOrderDetail(OrderStatus, FlowStatus, FromType, Type, DateType, BeginDate, EndDate, DeptId, ProviderId, DateValue, pageIndex, pageCount, OrderBy, ref totalCount);
 }
示例#7
0
 /// <summary>
 /// 采购物品走势
 /// </summary>
 public static DataTable GetOrderByProductTrend(string ProviderID, string DeptID, string BeginDate, string EndDate, string DateType, string StatType, string ProductID)
 {
     return PurchaseOrderDBHelper.GetOrderByProductTrend(ProviderID, DeptID, BeginDate, EndDate, DateType, StatType, ProductID);
 }
示例#8
0
 /// <summary>
 /// 采购金额走势
 /// </summary>
 public static DataTable GetOrderByTrendPrice(string OrderStatus, string FlowStatus, string FromType, string Type, string DateType, string BeginDate, string EndDate)
 {
     return PurchaseOrderDBHelper.GetOrderByTrendPrice(OrderStatus, FlowStatus, FromType, Type, DateType, BeginDate, EndDate);
 }
示例#9
0
 /// <summary>
 /// 采购数量供应商分布
 /// </summary>
 public static DataTable GetOrderByProviderNum(string OrderStatus, string FlowStatus, string FromType, string BeginDate, string EndDate)
 {
     return PurchaseOrderDBHelper.GetOrderByProviderNum(OrderStatus, FlowStatus, FromType, BeginDate, EndDate);
 }
示例#10
0
 /// <summary>
 /// 获得采购订单编号
 /// </summary>
 /// <param name="pageIndex">当前页</param>
 /// <param name="pageCount">每页记录数</param>
 /// <param name="orderBy">排序方法</param>
 /// <param name="TotalCount">总记录数</param>
 /// <param name="userInfo">用户信息实体类</param>
 /// <returns></returns>
 public static DataTable SelectPurchaseOrder(int pageIndex, int pageCount, string orderBy, ref int TotalCount
     , UserInfoUtil userInfo)
 {
     return PurchaseOrderDBHelper.SelectPurchaseOrder(pageIndex, pageCount, orderBy, ref TotalCount, userInfo);
 }
示例#11
0
 public static DataTable SelectPurchaseOrder(string CompanyCD, string OrderBy, string BillStatus, string StartDate, string EndDate)
 {
     return PurchaseOrderDBHelper.SelectPurchaseOrder(CompanyCD, OrderBy, BillStatus, StartDate, EndDate);
 }
示例#12
0
 //采购订单报表
 public static DataTable SelectPurchaseOrder(string CompanyCD, string BillStatus, string StartDate, string EndDate, int pageIndex, int pageCount, string OrderBy, ref int totalCount)
 {
     return PurchaseOrderDBHelper.SelectPurchaseOrder(CompanyCD, BillStatus, StartDate, EndDate, pageIndex, pageCount, OrderBy, ref totalCount);
 }