Пример #1
0
        /// <summary>
        ///     作废
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnBatchDelete_Click(object sender, EventArgs e)
        {
            IEnumerable <string> selectIds = GetSelectIds();

            try
            {
                Log(string.Format(@"作废单据号:{0}成功。", selectIds));

                //
                foreach (var ids in selectIds)
                {
                    var status = new LHBillStatus();
                    status.FCompanyId  = CurrentUser.AccountComId;
                    status.FDeptId     = CurrentUser.AccountOrgId;
                    status.FDate       = DateTime.Now;
                    status.FOperator   = CurrentUser.AccountName;
                    status.FActionName = EnumDescription.GetFieldText(GasEnumBillStauts.Voided);
                    status.KeyId       = ids;
                    status.FMemo       = string.Format("单据号{0}被{1}作废处理。", ids, CurrentUser.AccountName);

                    GasHelper.AddBillStatus(status);


                    var parms = new Dictionary <string, object>();
                    parms.Clear();
                    parms.Add("@KeyId", ids);
                    parms.Add("@companyId", CurrentUser.AccountComId);
                    parms.Add("@Bill", 6);
                    SqlService.ExecuteProcedureNonQuery("proc_DeleteFlag", parms);
                }

                StockInService.Update(p => p.FCompanyId == CurrentUser.AccountComId && selectIds.Contains(p.KeyId), p => new LHStockIn
                {
                    FFlag     = 0,                                         //
                    FStatus   = Convert.ToInt32(GasEnumBillStauts.Voided), //
                    FProgress = Convert.ToInt32(GasEnumBillStauts.Voided)
                });


                Alert.Show("作废成功!", MessageBoxIcon.Information);
                BindDataGrid();
            }
            catch (Exception)
            {
                Alert.Show("作废失败!", MessageBoxIcon.Warning);
            }
        }