Пример #1
0
        public ServiceResponseData SaveBill()
        {
            string  belongSys = requestData.GetData <string>(0);
            string  busiType  = requestData.GetData <string>(1);
            IMwBill iProcess  = NewObject <MwBillFactory>().GetBillProcess(busiType);

            MW_CheckHead          head          = requestData.GetData <MW_CheckHead>(2);
            List <MW_CheckDetail> details       = requestData.GetData <List <MW_CheckDetail> >(3);
            List <int>            deleteDetails = requestData.GetData <List <int> >(4);

            oleDb.BeginTransaction();
            try
            {
                foreach (int detailID in deleteDetails)
                {
                    NewObject <MW_CheckDetail>().delete(detailID);
                }

                iProcess.SaveBill(head, details);
                oleDb.CommitTransaction();
                responseData.AddData(true);
            }
            catch (Exception error)
            {
                oleDb.RollbackTransaction();
                responseData.AddData(false);
                responseData.AddData(error.Message);
            }

            return(responseData);
        }
        public ServiceResponseData SaveBill()
        {
            string  belongSys = requestData.GetData <string>(0);
            string  busiType  = requestData.GetData <string>(1);
            IMwBill iProcess  = NewObject <MwBillFactory>().GetBillProcess(busiType);

            MWBillResult result = new MWBillResult();

            MW_InStoreHead          head    = requestData.GetData <MW_InStoreHead>(2);
            List <MW_InStoreDetail> details = requestData.GetData <List <MW_InStoreDetail> >(3);
            List <int> deleteDetails        = requestData.GetData <List <int> >(4);

            oleDb.BeginTransaction();
            try
            {
                foreach (int detailID in deleteDetails)
                {
                    NewObject <MW_InStoreDetail>().delete(detailID);
                }

                iProcess.SaveBill(head, details);
                Basic_SystemConfig config = NewObject <IMWDao>().GetDeptParameters(head.DeptID, "AutoAuditInstore");
                if (config != null)
                {
                    if (config.Value == "1")
                    {
                        result = iProcess.AuditBill(head.InHeadID, LoginUserInfo.EmpId, LoginUserInfo.EmpName);
                    }
                }

                if (result.Result == 0)
                {
                    oleDb.CommitTransaction();
                }
                else
                {
                    oleDb.RollbackTransaction();
                }

                responseData.AddData(result);
            }
            catch (Exception error)
            {
                oleDb.RollbackTransaction();
                result.Result = 1;
                result.ErrMsg = error.Message;
            }

            responseData.AddData(result);
            return(responseData);
        }