Exemplo n.º 1
0
        /// <summary>
        /// 事物处理"删除标本"
        /// </summary>
        /// <returns></returns>
        public bool BillDeleteSample(string ids, string testitemids, string ordernum, string billheadid, string flag)
        {
            try
            {
                SortedList SQLlist = new SortedList(new MySort());
                SQLlist.Add(new Hashtable()
                {
                    { "DELETE", "Bill.DeleteBilldetail" }
                }, ids);

                if (!string.IsNullOrEmpty(billheadid) && int.Parse(billheadid) > 0)
                {
                    string[] testitemidsArray = testitemids.Split(',');
                    //修改ordergouptest表状态
                    for (int i = 0; i < testitemidsArray.Length; i++)
                    {
                        Hashtable ht1 = new Hashtable();
                        ht1["flag"]           = flag;
                        ht1["ordernum"]       = ordernum;
                        ht1["dicttestitemid"] = testitemidsArray[i];
                        SQLlist.Add(new Hashtable()
                        {
                            { "UPDATE", "Order.UpdateOrdergrouptestStatus" }
                        }, ht1);
                    }

                    //修改billheader表汇总价格
                    BilldetailService detailservice = new BilldetailService();
                    Hashtable         ht            = new Hashtable();
                    ht["billdetailids"] = ids;
                    ht["billheadid"]    = billheadid;
                    IList <Billdetail> detailList = detailservice.GetBilldetailStatisticsByOrdernum("Out", ht);

                    Hashtable hthead = new Hashtable();
                    hthead["Billheadid"]         = billheadid;
                    hthead["Totalstandardprice"] = detailList.Sum(c => c.Standardprice);
                    hthead["Totalgrouprprice"]   = detailList.Sum(c => c.Groupprice);
                    hthead["Totalcontractprice"] = detailList.Sum(c => c.Contractprice);
                    hthead["Totalfinalprice"]    = detailList.Sum(c => c.Finalprice);
                    SQLlist.Add(new Hashtable()
                    {
                        { "UPDATE", "Bill.UpdateBillheadTotalPrice" }
                    }, hthead);
                }
                bool result = this.ExecuteSqlTran(SQLlist);
                if (result)
                {
                    //写入日志记录
                    this.AddOperationLog(ordernum, "", "财务管理", "删除标本", "节点信息", "");
                }
                return(result);
            }
            catch (Exception ex)
            {
                return(false);

                throw new Exception(ex.Message);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 事物处理"预出账"操作
        /// </summary>
        /// <returns></returns>
        public bool BillPrepareOutOperation(Billhead billhead, Hashtable ht, string flag)
        {
            try
            {
                BilldetailService  service    = new BilldetailService();
                IList <Billdetail> detailList = service.SelectBilldetailList(ht);
                SortedList         SQLlist    = new SortedList(new MySort());
                billhead.Billheadid = this.getSeqID("SEQ_BILLHEAD");
                billhead.Invoiceno  = billhead.Billheadid.ToString();
                SQLlist.Add(new Hashtable()
                {
                    { "INSERT", "Bill.InsertBillhead" }
                }, billhead);

                foreach (Billdetail detail in detailList)
                {
                    //更新BILLDETAIL 表
                    Hashtable htdetail = new Hashtable();
                    htdetail["Billdetailids"] = detail.Billdetailid;
                    htdetail["Billheadid"]    = billhead.Billheadid;
                    SQLlist.Add(new Hashtable()
                    {
                        { "UPDATE", "Bill.UpdateBilldetailHeadId" }
                    }, htdetail);

                    //更新ordergrouptest表
                    Hashtable htgrouptest = new Hashtable();
                    htgrouptest["flag"]           = flag;
                    htgrouptest["billdetailid"]   = detail.Billdetailid;
                    htgrouptest["ordernum"]       = detail.Ordernum;
                    htgrouptest["dicttestitemid"] = detail.Dicttestitemid;
                    SQLlist.Add(new Hashtable()
                    {
                        { "UPDATE", "Order.UpdateOrdergrouptestPrice" }
                    }, htgrouptest);
                }
                bool result = this.ExecuteSqlTran(SQLlist);
                if (result)
                {
                    IEnumerator <Billdetail> ordernumList = (from a in detailList
                                                             group a by new { a.Ordernum } into g
                                                             select new Billdetail
                    {
                        Ordernum = g.Key.Ordernum
                    }).ToList().GetEnumerator();

                    //预出账日志
                    while (ordernumList.MoveNext())
                    {
                        this.AddOperationLog(ordernumList.Current.Ordernum, "", "财务管理", "预出账", "节点信息", "");
                    }
                }
                return(result);
            }
            catch (Exception ex)
            {
                return(false);

                throw new Exception(ex.Message);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// 事物处理billhead表数据操作:"接收"、"反接收"、"作废"
        /// </summary>
        /// <returns></returns>
        public bool BillheadDataOperation(string ids, int status, string operationtype, string flag)
        {
            try
            {
                string[]   id      = ids.Split(',');
                SortedList SQLlist = new SortedList(new MySort());
                for (int i = 0; i < id.Length; i++)
                {
                    Hashtable ht = new Hashtable();
                    ht["status"]     = status;
                    ht["billheadid"] = id[i];
                    ht["duedate"]    = System.DateTime.Now;
                    SQLlist.Add(new Hashtable()
                    {
                        { "UPDATE", "Bill.UpdateBillheadStatus" }
                    }, ht);
                }

                #region 作废

                int value = (int)ParamStatus.BillheadStatus.Invalid;
                if (status == value)
                {
                    //根据billhead表 ids获得billdetail数据集
                    BilldetailService  detailservice = new BilldetailService();
                    IList <Billdetail> detailList    = detailservice.GetBilldetailListByHeadid(ids);

                    //将作废数据插入billdetailcancel表
                    foreach (Billdetail detail in detailList)
                    {
                        Billdetailcancel billdetailcancel = new Billdetailcancel();
                        billdetailcancel.Billheadid         = detail.Billheadid;
                        billdetailcancel.Ordernum           = detail.Ordernum;
                        billdetailcancel.Dicttestitemid     = detail.Dicttestitemid;
                        billdetailcancel.Standardprice      = detail.Standardprice;
                        billdetailcancel.Groupprice         = detail.Groupprice;
                        billdetailcancel.Contractprice      = detail.Contractprice;
                        billdetailcancel.Finalprice         = detail.Finalprice;
                        billdetailcancel.Status             = detail.Status;
                        billdetailcancel.Remark             = detail.Remark;
                        billdetailcancel.Selfremark         = detail.Selfremark;
                        billdetailcancel.Createdate         = System.DateTime.Now;
                        billdetailcancel.Enterby            = detail.Enterby;
                        billdetailcancel.Enterdate          = detail.Enterdate;
                        billdetailcancel.Dictproductid      = detail.Dictproductid;
                        billdetailcancel.Testname           = detail.Testname;
                        billdetailcancel.Productname        = detail.Productname;
                        billdetailcancel.Billdetailcancelid = this.getSeqID("SEQ_BILLDETAILCANCEL");
                        SQLlist.Add(new Hashtable()
                        {
                            { "INSERT", "Bill.InsertBilldetailcancel" }
                        }, billdetailcancel);

                        //修改ordergrouptest表状态
                        Hashtable grouptest = new Hashtable();
                        grouptest["ordernum"]       = detail.Ordernum;
                        grouptest["dicttestitemid"] = detail.Dicttestitemid;
                        grouptest["flag"]           = flag;
                        SQLlist.Add(new Hashtable()
                        {
                            { "UPDATE", "Order.UpdateOrdergrouptestStatus" }
                        }, grouptest);
                    }
                    //删除billdetail表记录
                    SQLlist.Add(new Hashtable()
                    {
                        { "DELETE", "Bill.DeleteBilldetailByHeadid" }
                    }, ids);
                }

                #endregion


                bool result = this.ExecuteSqlTran(SQLlist);

                if (result)  //日志操作
                {
                    BilldetailService service = new BilldetailService();
                    Hashtable         ht      = new Hashtable();
                    ht["billheadids"] = ids;
                    IList <Billdetail> detailList = service.SelectBilldetailList(ht);

                    var ordernumList = (from a in detailList
                                        group a by new { a.Ordernum } into g
                                        select new
                    {
                        g.Key.Ordernum
                    }).ToArray();
                    for (int j = 0; j < ordernumList.Length; j++)
                    {
                        AddOperationLog(ordernumList[j].Ordernum, "", "财务管理", operationtype, "节点信息", "");
                    }
                }
                return(result);
            }
            catch (Exception ex)
            {
                return(false);

                throw new Exception(ex.Message);
            }
        }