public static bool ConcelConfirm(string ID, string FromType, string OrderNo, List<ProductModel> ProductMList, List<ProductModel> ProductMStorList, out string Reason)
        {
            try
            {
                Reason = string.Empty;
                //不可以确认返回false
                if (!PurchaseOrderDBHelper.CanConcel(ID, out Reason))
                    return false;
                ArrayList lstConcelConfirm = new ArrayList();
                //更新主表
                SqlCommand ConcelPri = PurchaseOrderDBHelper.ConcelConfirm(ID);
                lstConcelConfirm.Add(ConcelPri);

                //更新分仓存量表
                if (ProductMStorList != null)
                {
                    foreach (ProductModel ProductM in ProductMStorList)
                    {
                        SqlCommand comm = PurchaseOrderDBHelper.WriteStorgeDecr(ProductM);
                        lstConcelConfirm.Add(comm);
                    }
                }
                if (ProductMList != null)
                {
                    if (FromType == "2")
                    {//回写采购计划
                        foreach (ProductModel ProductM in ProductMList)
                        {
                            SqlCommand comm = PurchaseOrderDBHelper.WritePurPlanDecr(ProductM);
                            lstConcelConfirm.Add(comm);
                        }
                    }
                    else if (FromType == "4")
                    {//回写采购合同
                        foreach (ProductModel ProductM in ProductMList)
                        {
                            SqlCommand comm = PurchaseOrderDBHelper.WritePurContDecr(ProductM);
                            lstConcelConfirm.Add(comm);
                        }
                    }
                }
                //获取登陆用户信息
                UserInfoUtil userInfo = (UserInfoUtil)SessionUtil.Session["UserInfo"];

                //撤销审批
                string CompanyCD = userInfo.CompanyCD;
                string BillTypeFlag = ConstUtil.CODING_RULE_PURCHASE;
                string BillTypeCode = ConstUtil.CODING_RULE_PURCHASE_ORDER;
                string strUserID = userInfo.UserID; ;
                DataTable dt = FlowDBHelper.GetFlowInstanceInfo(CompanyCD, Convert.ToInt32(BillTypeFlag), Convert.ToInt32(BillTypeCode), Convert.ToInt32(ID));
                if (dt.Rows.Count > 0)
                {
                    string FlowInstanceID = dt.Rows[0]["FlowInstanceID"].ToString();
                    string FlowStatus = dt.Rows[0]["FlowStatus"].ToString();
                    string FlowNo = dt.Rows[0]["FlowNo"].ToString();

                    lstConcelConfirm.Add(FlowDBHelper.CancelConfirmHis(CompanyCD, FlowInstanceID, FlowNo, BillTypeFlag, BillTypeCode, strUserID));
                    lstConcelConfirm.Add(FlowDBHelper.CancelConfirmTsk(CompanyCD, FlowInstanceID, strUserID));
                    lstConcelConfirm.Add(FlowDBHelper.CancelConfirmIns(CompanyCD, FlowNo, BillTypeFlag, BillTypeCode, ID, strUserID));
                }

                //定义返回变量
                bool isSucc = false;
                /* 
                 * 定义日志内容变量 
                 * 增删改相关的日志,需要输出操作日志,该类型日志插入到数据库
                 * 其他的 如出现异常时,需要输出系统日志,该类型日志保存到日志文件
                 */

                //执行插入操作
                try
                {
                    isSucc = SqlHelper.ExecuteTransWithArrayList(lstConcelConfirm);
                }
                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_UNCONFIRM;
                //设置操作成功标识
                logModel.Remark = remark;

                //登陆日志
                LogDBHelper.InsertLog(logModel);
                return isSucc;
            }
            catch (Exception ex)
            {
                throw ex;
            }



        }
        public static bool CancelConfirm(string ID, string No)
        {
            try
            {
                ////已经被引用的采购申请不能取消确认
                //if (IsCitePurApply(ID))
                //{
                //    return false;
                //}
                ArrayList lstCancelConfirm = new ArrayList();
                //更改主表
                lstCancelConfirm.Add(OfficeThingsPurchaseApplyDBHelper.CancelConfirm(ID));
                //获取登陆用户信息
                UserInfoUtil userInfo = (UserInfoUtil)SessionUtil.Session["UserInfo"];

                //撤销审批
                string    CompanyCD    = userInfo.CompanyCD;
                string    BillTypeFlag = ConstUtil.CODING_RULE_PURCHASE;
                string    BillTypeCode = ConstUtil.CODING_RULE_PURCHASE_APPLY;
                string    strUserID    = userInfo.UserID;;
                DataTable dt           = FlowDBHelper.GetFlowInstanceInfo(CompanyCD, Convert.ToInt32(BillTypeFlag), Convert.ToInt32(BillTypeCode), Convert.ToInt32(ID));
                if (dt.Rows.Count > 0)
                {
                    string FlowInstanceID = dt.Rows[0]["FlowInstanceID"].ToString();
                    string FlowStatus     = dt.Rows[0]["FlowStatus"].ToString();
                    string FlowNo         = dt.Rows[0]["FlowNo"].ToString();

                    lstCancelConfirm.Add(FlowDBHelper.CancelConfirmHis(CompanyCD, FlowInstanceID, FlowNo, BillTypeFlag, BillTypeCode, strUserID));
                    lstCancelConfirm.Add(FlowDBHelper.CancelConfirmTsk(CompanyCD, FlowInstanceID, strUserID));
                    lstCancelConfirm.Add(FlowDBHelper.CancelConfirmIns(CompanyCD, FlowNo, BillTypeFlag, BillTypeCode, ID, strUserID));
                }

                //定义返回变量
                bool isSucc = false;

                /*
                 * 定义日志内容变量
                 * 增删改相关的日志,需要输出操作日志,该类型日志插入到数据库
                 * 其他的 如出现异常时,需要输出系统日志,该类型日志保存到日志文件
                 */

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

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

                //登陆日志
                LogDBHelper.InsertLog(logModel);
                return(isSucc);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #3
0
        public static bool CancelConfirm(string ID, string PlanNo, List <ProductModel> ProductMList)
        {
            try
            {
                ArrayList lstCancelConfirm = new ArrayList();
                //更新主表
                lstCancelConfirm.Add(PurchasePlanDBHelper.CancelConfirm(ID));

                //回写采购申请中已计划数量
                if (ProductMList != null)
                {
                    foreach (ProductModel ProductM in ProductMList)
                    {
                        if (ProductM.FromType == "1")
                        {
                            SqlCommand DescPurApply = PurchasePlanDBHelper.WritePurchaseApplyDesc(ProductM);
                            lstCancelConfirm.Add(DescPurApply);
                        }
                        else if (ProductM.FromType == "2")
                        {
                            SqlCommand DesePurRequire = PurchasePlanDBHelper.WritePurchaseRequireDesc(ProductM);
                            lstCancelConfirm.Add(DesePurRequire);
                        }
                    }
                }
                //获取登陆用户信息
                UserInfoUtil userInfo = (UserInfoUtil)SessionUtil.Session["UserInfo"];

                //撤销审批
                string    CompanyCD    = userInfo.CompanyCD;
                string    BillTypeFlag = ConstUtil.CODING_RULE_PURCHASE;
                string    BillTypeCode = ConstUtil.CODING_RULE_PURCHASE_PLAN;
                string    strUserID    = userInfo.UserID;;
                DataTable dt           = FlowDBHelper.GetFlowInstanceInfo(CompanyCD, Convert.ToInt32(BillTypeFlag), Convert.ToInt32(BillTypeCode), Convert.ToInt32(ID));
                if (dt.Rows.Count > 0)
                {
                    string FlowInstanceID = dt.Rows[0]["FlowInstanceID"].ToString();
                    string FlowStatus     = dt.Rows[0]["FlowStatus"].ToString();
                    string FlowNo         = dt.Rows[0]["FlowNo"].ToString();

                    lstCancelConfirm.Add(FlowDBHelper.CancelConfirmHis(CompanyCD, FlowInstanceID, FlowNo, BillTypeFlag, BillTypeCode, strUserID));
                    lstCancelConfirm.Add(FlowDBHelper.CancelConfirmTsk(CompanyCD, FlowInstanceID, strUserID));
                    lstCancelConfirm.Add(FlowDBHelper.CancelConfirmIns(CompanyCD, FlowNo, BillTypeFlag, BillTypeCode, ID, strUserID));
                }

                //定义返回变量
                bool isSucc = false;

                /*
                 * 定义日志内容变量
                 * 增删改相关的日志,需要输出操作日志,该类型日志插入到数据库
                 * 其他的 如出现异常时,需要输出系统日志,该类型日志保存到日志文件
                 */

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

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

                //登陆日志
                LogDBHelper.InsertLog(logModel);
                return(isSucc);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }