Example #1
0
        /// <summary>
        /// 从IIS缓存中获取指定Id记录
        /// </summary>
        /// <param name="id">主键Id</param>
        /// <returns>DataAccess.Model.OUT00</returns>
        public DataAccess.Model.OUT00 GetModelForCache(long id)
        {
            try
            {
                //从缓存中读取指定Id记录
                var model = GetModelForCache(x => x.Id == id);

                if (model == null)
                {
                    //从数据库中读取
                    var tem = OUT00.SingleOrDefault(x => x.Id == id);
                    if (tem == null)
                    {
                        return(null);
                    }
                    else
                    {
                        //对查询出来的实体进行转换
                        model = Transform(tem);
                        return(model);
                    }
                }
                else
                {
                    return(model);
                }
            }
            catch (Exception e)
            {
                //记录日志
                CommonBll.WriteLog("从IIS缓存中获取OUT00表记录时出现异常", e);

                return(null);
            }
        }
Example #2
0
 /// <summary>
 /// 获取指定Id记录
 /// </summary>
 /// <param name="id">主键Id</param>
 /// <param name="isCache">是否从缓存中读取</param>
 /// <returns>DataAccess.Model.OUT00</returns>
 public DataAccess.Model.OUT00 GetModel(long id, bool isCache = true)
 {
     //判断是否使用缓存
     if (CommonBll.IsUseCache() && isCache)
     {
         //从缓存中获取List
         var list = GetList();
         if (list == null)
         {
             return(null);
         }
         else
         {
             //在List查询指定主键Id的记录
             return(list.SingleOrDefault(x => x.Id == id));
         }
     }
     else
     {
         //从数据库中直接读取
         var model = OUT00.SingleOrDefault(x => x.Id == id);
         if (model == null)
         {
             return(null);
         }
         else
         {
             //对查询出来的实体进行转换
             return(Transform(model));
         }
     }
 }
        /// <summary>
        /// 作废按钮
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void Btn_MainCancel(Object sender, EventArgs e)
        {
            string _OUT_ID = tbxOUT_ID.Text.ToString();
            var    model   = OUT00.SingleOrDefault(x => x.OUT_ID == _OUT_ID);

            if (model == null)
            {
                FineUI.Alert.ShowInParent("订单单号不存在", FineUI.MessageBoxIcon.Information);
            }
            //1 = 存档 2 = 核准 3 = 作废 4 = 已引入(供应商进货)
            switch (model.STATUS)
            {
            case 1: model.STATUS = 3; break;

            case 2: FineUI.Alert.ShowInParent("订单已核准,无法进行作废", FineUI.MessageBoxIcon.Information); return;

            case 3: model.STATUS = 1; break;

            case 4: FineUI.Alert.ShowInParent("订单已引入,无法进行作废", FineUI.MessageBoxIcon.Information); return;

            default: FineUI.Alert.ShowInParent("订单状态有误,无法进行作废", FineUI.MessageBoxIcon.Information); return;
            }
            ddlStatus.SelectedValue = model.STATUS.ToString();

            string result = DetailEdit();

            if (String.IsNullOrEmpty(result))
            {
                result = MAINEdit();
            }
            if (!String.IsNullOrEmpty(result))
            {
                FineUI.Alert.ShowInParent(result, FineUI.MessageBoxIcon.Error);
            }
            else
            {
                string alterMssage = ButtonCancel.Text;
                if (alterMssage == "取消作废")
                {
                    FineUI.Alert.ShowInParent("作废成功", FineUI.MessageBoxIcon.Error);
                }
                else
                {
                    FineUI.Alert.ShowInParent("取消作废成功", FineUI.MessageBoxIcon.Error);
                }
            }

            //LoadMAIN();
            //LoadDETAIL();
            //FineUI.Alert.ShowInParent("核准成功", FineUI.MessageBoxIcon.Information);
        }
Example #4
0
        /// <summary>
        /// 从IIS缓存中获取指定Id记录
        /// </summary>
        /// <param name="conditionColName">条件列名</param>
        /// <param name="value">条件值</param>
        /// <returns>DataAccess.Model.OUT00</returns>
        public DataAccess.Model.OUT00 GetModelForCache(string conditionColName, object value)
        {
            try
            {
                //从缓存中获取List
                var list = GetList();
                DataAccess.Model.OUT00           model      = null;
                Expression <Func <OUT00, bool> > expression = null;

                //返回指定条件的实体
                switch (conditionColName)
                {
                case "Id":
                    model      = list.SingleOrDefault(x => x.Id == (int)value);
                    expression = x => x.Id == (int)value;
                    break;

                case "SHOP_ID":
                    model      = list.SingleOrDefault(x => x.SHOP_ID == (string)value);
                    expression = x => x.SHOP_ID == (string)value;
                    break;

                case "OUT_ID":
                    model      = list.SingleOrDefault(x => x.OUT_ID == (string)value);
                    expression = x => x.OUT_ID == (string)value;
                    break;

                case "STATUS":
                    model      = list.SingleOrDefault(x => x.STATUS == (int)value);
                    expression = x => x.STATUS == (int)value;
                    break;

                case "INPUT_DATE":
                    model      = list.SingleOrDefault(x => x.INPUT_DATE == (DateTime)value);
                    expression = x => x.INPUT_DATE == (DateTime)value;
                    break;

                case "IN_SHOP":
                    model      = list.SingleOrDefault(x => x.IN_SHOP == (string)value);
                    expression = x => x.IN_SHOP == (string)value;
                    break;

                case "STOCK_ID":
                    model      = list.SingleOrDefault(x => x.STOCK_ID == (string)value);
                    expression = x => x.STOCK_ID == (string)value;
                    break;

                case "USER_ID":
                    model      = list.SingleOrDefault(x => x.USER_ID == (string)value);
                    expression = x => x.USER_ID == (string)value;
                    break;

                case "APP_USER":
                    model      = list.SingleOrDefault(x => x.APP_USER == (string)value);
                    expression = x => x.APP_USER == (string)value;
                    break;

                case "APP_DATETIME":
                    model      = list.SingleOrDefault(x => x.APP_DATETIME == (DateTime)value);
                    expression = x => x.APP_DATETIME == (DateTime)value;
                    break;

                case "EXPECT_DATE":
                    model      = list.SingleOrDefault(x => x.EXPECT_DATE == (DateTime)value);
                    expression = x => x.EXPECT_DATE == (DateTime)value;
                    break;

                case "Exported":
                    model      = list.SingleOrDefault(x => x.Exported == (byte)value);
                    expression = x => x.Exported == (byte)value;
                    break;

                case "Exported_ID":
                    model      = list.SingleOrDefault(x => x.Exported_ID == (string)value);
                    expression = x => x.Exported_ID == (string)value;
                    break;

                case "RELATE_ID":
                    model      = list.SingleOrDefault(x => x.RELATE_ID == (string)value);
                    expression = x => x.RELATE_ID == (string)value;
                    break;

                case "Memo":
                    model      = list.SingleOrDefault(x => x.Memo == (string)value);
                    expression = x => x.Memo == (string)value;
                    break;

                case "LOCKED":
                    model      = list.SingleOrDefault(x => x.LOCKED == (byte)value);
                    expression = x => x.LOCKED == (byte)value;
                    break;

                case "CRT_DATETIME":
                    model      = list.SingleOrDefault(x => x.CRT_DATETIME == (DateTime)value);
                    expression = x => x.CRT_DATETIME == (DateTime)value;
                    break;

                case "CRT_USER_ID":
                    model      = list.SingleOrDefault(x => x.CRT_USER_ID == (string)value);
                    expression = x => x.CRT_USER_ID == (string)value;
                    break;

                case "MOD_DATETIME":
                    model      = list.SingleOrDefault(x => x.MOD_DATETIME == (DateTime)value);
                    expression = x => x.MOD_DATETIME == (DateTime)value;
                    break;

                case "MOD_USER_ID":
                    model      = list.SingleOrDefault(x => x.MOD_USER_ID == (string)value);
                    expression = x => x.MOD_USER_ID == (string)value;
                    break;

                case "LAST_UPDATE":
                    model      = list.SingleOrDefault(x => x.LAST_UPDATE == (DateTime)value);
                    expression = x => x.LAST_UPDATE == (DateTime)value;
                    break;

                case "Trans_STATUS":
                    model      = list.SingleOrDefault(x => x.Trans_STATUS == (byte)value);
                    expression = x => x.Trans_STATUS == (byte)value;
                    break;

                default:
                    return(null);
                }

                if (model == null)
                {
                    //从数据库中读取
                    var tem = OUT00.SingleOrDefault(expression);
                    if (tem == null)
                    {
                        return(null);
                    }
                    else
                    {
                        //对查询出来的实体进行转换
                        model = Transform(tem);

                        return(model);
                    }
                }
                else
                {
                    return(model);
                }
            }
            catch (Exception e)
            {
                //记录日志
                CommonBll.WriteLog("从IIS缓存中获取OUT00表记录时出现异常", e);

                return(null);
            }
        }
        /// <summary>
        /// 修改按钮
        /// </summary>
        //public void Btn_MainEdit(Object sender, EventArgs e)
        //{
        //    string result = DetailEdit();
        //    if (String.IsNullOrEmpty(result))
        //    {
        //        result = MAINEdit();
        //    }
        //    if (!String.IsNullOrEmpty(result))
        //    {
        //        FineUI.Alert.ShowInParent(result, FineUI.MessageBoxIcon.Error);
        //    }
        //    else
        //    {
        //        FineUI.Alert.ShowInParent("保存成功", FineUI.MessageBoxIcon.Error);
        //    }
        //    //ClearConten();
        //    //LoadMAIN();
        //    //LoadDETAIL();
        //}

        /// <summary>
        /// 核准按钮
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void Btn_MainCheck(Object sender, EventArgs e)
        {
            string _OUT_ID    = tbxOUT_ID.Text.ToString();
            var    model      = OUT00.SingleOrDefault(x => x.OUT_ID == _OUT_ID);
            int    out_status = model.STATUS;

            if (model == null)
            {
                FineUI.Alert.ShowInParent("订单单号不存在", FineUI.MessageBoxIcon.Information);
                return;
            }

            if (model.STATUS == 1)
            {
                DataTable dsCom   = (DataTable)SPs.Get_MAX_Inventory_DATE().ExecuteDataTable();
                DateTime  dtInput = DateTime.Parse(dsCom.Rows[0]["INPUT_DATE"].ToString());
                if (model.INPUT_DATE.CompareTo(dtInput) <= 0)
                {
                    FineUI.Alert.ShowInParent("单据小于盘点日期,不允许盘点。盘点日期为:" + dsCom.Rows[0]["INPUT_DATE"].ToString() + "", FineUI.MessageBoxIcon.Information);
                    return;
                }
            }

            DataTable stockDatatable = (DataTable)SPs.GET_OUT00_STOCK_INFO(_OUT_ID).ExecuteDataTable();

            if (stockDatatable.Rows.Count > 0)
            {
                FineUI.Alert.ShowInParent("库存不足,不允许核准", FineUI.MessageBoxIcon.Information);
                return;
            }
            //1 = 存档 2 = 核准 3 = 作废 4 = 已引入(供应商进货)
            switch (model.STATUS)
            {
            case 1: model.STATUS = 2; break;

            case 2: model.STATUS = 1; break;

            case 3: FineUI.Alert.ShowInParent("订单已作废,无法进行核准", FineUI.MessageBoxIcon.Information); return;

            case 4: FineUI.Alert.ShowInParent("订单已引入,无法进行核准", FineUI.MessageBoxIcon.Information); return;

            default: FineUI.Alert.ShowInParent("订单状态有误,无法核准", FineUI.MessageBoxIcon.Information); return;
            }

            ddlStatus.SelectedValue = model.STATUS.ToString();

            string result = DetailEdit();

            if (String.IsNullOrEmpty(result))
            {
                tbxAPP_DATETIME.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                result = MAINEdit();
            }

            if (String.IsNullOrEmpty(result))
            {
                //dsCom = (DataSet)SPs.Get_Purchase00(st, et, type).ExecuteDataSet();
                //计算库存
                if (out_status == 2)
                {
                    SPs.Update_out00_stock01(_OUT_ID).Execute();
                }
                else
                {
                    SPs.Update_out00_stock01_cancel(_OUT_ID).Execute();
                }
            }

            if (!String.IsNullOrEmpty(result))
            {
                FineUI.Alert.ShowInParent(result, FineUI.MessageBoxIcon.Error);
            }
            else
            {
                string alterMssage = ButtonCheck.Text;
                if (alterMssage == "反核准")
                {
                    FineUI.Alert.ShowInParent("核准成功", FineUI.MessageBoxIcon.Error);
                }
                else
                {
                    FineUI.Alert.ShowInParent("取消核准成功", FineUI.MessageBoxIcon.Error);
                }
            }



            //LoadMAIN();
            //LoadDETAIL();
            //FineUI.Alert.ShowInParent(result, FineUI.MessageBoxIcon.Error);
            //FineUI.Alert.ShowInParent("核准成功", FineUI.MessageBoxIcon.Information);
        }
Example #6
0
        /// <summary>
        /// 核准按钮
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void Btn_MainCheck(Object sender, EventArgs e)
        {
            string _OUT_ID = tbxOUT_ID.Text.ToString();
            var    model   = OUT00.SingleOrDefault(x => x.OUT_ID == _OUT_ID);

            if (model == null)
            {
                FineUI.Alert.ShowInParent("订单单号不存在", FineUI.MessageBoxIcon.Information);
                return;
            }

            if (model.STATUS == 1)
            {
                DataTable dsCom   = (DataTable)SPs.Get_MAX_Inventory_DATE().ExecuteDataTable();
                DateTime  dtInput = DateTime.Parse(dsCom.Rows[0]["INPUT_DATE"].ToString());
                if (model.INPUT_DATE.CompareTo(dtInput) <= 0)
                {
                    FineUI.Alert.ShowInParent("单据小于盘点日期,不允许盘点。盘点日期为:" + dsCom.Rows[0]["INPUT_DATE"].ToString() + "", FineUI.MessageBoxIcon.Information);
                    return;
                }
            }

            DataTable stockDatatable = (DataTable)SPs.GET_OUT00_STOCK_INFO(_OUT_ID).ExecuteDataTable();

            if (stockDatatable.Rows.Count > 0)
            {
                FineUI.Alert.ShowInParent("库存不足,不允许核准", FineUI.MessageBoxIcon.Information);
                return;
            }
            //1 = 存档 2 = 核准 3 = 作废 4 = 已引入(供应商进货)
            switch (model.STATUS)
            {
            case 1: model.STATUS = 2; break;

            case 2: model.STATUS = 1; break;

            case 3: FineUI.Alert.ShowInParent("订单已作废,无法进行核准", FineUI.MessageBoxIcon.Information); return;

            case 4: FineUI.Alert.ShowInParent("订单已引入,无法进行核准", FineUI.MessageBoxIcon.Information); return;

            default: FineUI.Alert.ShowInParent("订单状态有误,无法核准", FineUI.MessageBoxIcon.Information); return;
            }

            ddlStatus.SelectedValue = model.STATUS.ToString();

            string result = DetailEdit();

            if (String.IsNullOrEmpty(result))
            {
                result = MAINEdit();
            }
            if (!String.IsNullOrEmpty(result))
            {
                FineUI.Alert.ShowInParent(result, FineUI.MessageBoxIcon.Error);
            }
            else
            {
                FineUI.Alert.ShowInParent("保存成功", FineUI.MessageBoxIcon.Error);
            }

            LoadMAIN();
            LoadDETAIL();
            //FineUI.Alert.ShowInParent(result, FineUI.MessageBoxIcon.Error);
            //FineUI.Alert.ShowInParent("核准成功", FineUI.MessageBoxIcon.Information);
        }