Beispiel #1
0
        public IActionResult Delete(string id)
        {
            if (string.IsNullOrEmpty(id))
            {
                return(toResponse(StatusCodeType.Error, "删除工序 Id 不能为空"));
            }

            if (_dataRelationService.Any(m => m.To == id))
            {
                return(toResponse(StatusCodeType.Error, "该工序已被关联,无法删除,若要请先删除关联"));
            }

            try
            {
                _dataRelationService.BeginTran();
                _dataRelationService.Delete(m => m.Form == id && m.Type == DataRelationType.Process_To_WorkShop.ToString());
                var response = _processService.Delete(id);
                _dataRelationService.CommitTran();

                return(toResponse(response));
            }
            catch (Exception ex)
            {
                _dataRelationService.RollbackTran();
                throw ex;
            }
        }
        public IActionResult Delete(string id)
        {
            if (string.IsNullOrEmpty(id))
            {
                return(toResponse(StatusCodeType.Error, "删除机台 Id 不能为空"));
            }

            if (_dataRelationService.Any(m => m.To == id))
            {
                return(toResponse(StatusCodeType.Error, "该机台已被关联,无法删除,若要请先删除关联"));
            }

            try
            {
                _dataRelationService.BeginTran();
                _dataRelationService.Delete(m => m.Form == id && m.Type == DataRelationType.Equipment_To_Line.ToString());
                var response = _equipmentService.Delete(id);
                _dataRelationService.CommitTran();

                return(toResponse(response));
            }
            catch (Exception)
            {
                _dataRelationService.RollbackTran();
                throw;
            }
        }
Beispiel #3
0
        public IActionResult Delete(string id)
        {
            if (string.IsNullOrEmpty(id))
            {
                return(toResponse(StatusCodeType.Error, "删除工厂 Id 不能为空"));
            }

            if (_dataRelationService.Any(m => m.To == id))
            {
                return(toResponse(StatusCodeType.Error, "该工厂已被关联,无法删除,若要请先删除关联"));
            }

            try
            {
                _unitOfWork.BeginTran();
                _dataRelationService.Delete(m => m.Form == id && m.Type == DataRelationType.Factory_To_Company.ToString());
                var response = _factoryService.Delete(id);
                _unitOfWork.CommitTran();

                return(toResponse(response));
            }
            catch (Exception)
            {
                _unitOfWork.RollbackTran();
                throw;
            }
        }
Beispiel #4
0
        public IActionResult Delete(string id)
        {
            if (string.IsNullOrEmpty(id))
            {
                return(toResponse(StatusCodeType.Error, "删除公司 Id 不能为空"));
            }

            if (_dataRelationService.Any(m => m.To == id))
            {
                return(toResponse(StatusCodeType.Error, "该公司已被关联,无法删除,若要请先删除关联"));
            }

            var response = _companyService.Delete(id);

            return(toResponse(response));
        }