Example #1
0
 public cBillService(LoggingSessionInfo loggingSessionInfo)
 {
     base.loggingSessionInfo = loggingSessionInfo;
     billService             = new DataAccess.BillService(loggingSessionInfo);
 }
Example #2
0
        /// <summary>
        /// 盘点单保存
        /// </summary>
        /// <param name="ccInfo"></param>
        /// <param name="IsTrans"></param>
        /// <param name="strError"></param>
        /// <returns></returns>
        public bool SetCCInfo(CCInfo ccInfo, bool IsTrans, out string strError)
        {
            using (IDbTransaction tran = this.SQLHelper.CreateTransaction())
            {
                try
                {
                    if (ccInfo.CCInfoList != null)
                    {
                        foreach (CCInfo ccInfo1 in ccInfo.CCInfoList)
                        {
                            //1.判断重复
                            if (!IsExistOrderCode(ccInfo1.order_no, ccInfo1.order_id))
                            {
                                strError = "订单号码已经存在。";
                                throw (new System.Exception(strError));
                            }

                            if (ccInfo1.operate.Equals("Create"))
                            {
                                if (loggingSessionInfo.CurrentLoggingManager.IsApprove == null || loggingSessionInfo.CurrentLoggingManager.IsApprove.Equals("0"))
                                {
                                    ccInfo1.status      = "1";
                                    ccInfo1.status_desc = "未审批";
                                }
                                else
                                {
                                    //2.提交表单
                                    if (!SetInoutOrderInsertBill(ccInfo))
                                    {
                                        strError = "盘点单表单提交失败。";
                                        throw (new System.Exception(strError));
                                    }
                                    //3.更改状态
                                    DataSet ds = new BillService(loggingSessionInfo).GetBillById(ccInfo1.order_id);
                                    if (ds != null && ds.Tables[0].Rows.Count > 0)
                                    {
                                        ccInfo1.status     = ds.Tables[0].Rows[0]["Status"].ToString();
                                        ccInfo.status_desc = ds.Tables[0].Rows[0]["BillStatusDescription"].ToString();
                                    }
                                }
                            }

                            //4.提交cc与ccdetail信息
                            if (!SetCCTableInfo(ccInfo1))
                            {
                                strError = "提交主表失败";
                                throw (new System.Exception(strError));
                            }
                        }
                    }

                    tran.Commit();
                    strError = "成功";
                    return(true);
                }
                catch (Exception ex)
                {
                    tran.Rollback();
                    throw (ex);
                }
            }
        }