Esempio n. 1
0
        /// <summary>
        /// 物理删除生产计划信息
        /// </summary>
        /// <param name="ids"></param>
        /// <returns></returns>
        public async Task <OperationResult> Delete(params Guid[] ids)
        {
            ids.CheckNotNull("ids");
            foreach (var id in ids)
            {
                int count = PlanProductionProcessRequirementInfoRepository.Entities.Where(m => m.ProductionSchedule.Id == id).Count();
                if (count > 0)
                {
                    return(new OperationResult(OperationResultType.Error, "生产计划数据关联工序需求信息,不能被删除。"));
                }
            }
            PlanProductionScheduleInfoRepository.UnitOfWork.BeginTransaction();
            foreach (var id in ids)
            {
                PlanProductionScheduleInfo info = PlanProductionScheduleInfoRepository.TrackEntities.Where(m => m.Id == id).FirstOrDefault();
                if (info.OrderItem.OrderQuantity >= info.OrderItem.RemainQuantity + info.Quantity)
                {
                    info.OrderItem.RemainQuantity += info.Quantity;
                }
            }
            var result = await PlanProductionScheduleInfoRepository.DeleteAsync(ids);

            PlanProductionScheduleInfoRepository.UnitOfWork.Commit();
            return(result);
        }
Esempio n. 2
0
 public IHttpActionResult GetEquipmentRequireInfoListByScheduleID(PlanProductionScheduleInfo info)
 {
     try
     {
         var page = GetPageResult(PlanEquipmentRequirementInfoContract.PlanEquipmentRequirementInfos.Where(m => m.ProductionProcessRequirement.ProductionSchedule.Id == info.Id).OrderByDescending(m => m.ProductionProcessRequirement.ProductionProcessOrder), m => new
         {
             m.Id,
             ProcessRequirement_Id = m.ProductionProcessRequirement.Id,
             ProductionProcess_Id  = m.ProductionProcessRequirement.ProductionProcess.Id,
             m.ProductionProcessRequirement.ProductionProcess.ProductionProcessName,
             m.ProductionProcessRequirement.ProductionProcess.ProductionProcessCode,
             Equipment_Id = m.Equipment.Id,
             m.Equipment.EquipmentName,
             m.Equipment.EquipmentCode,
             ProductionRule_Id = m.ProductionProcessRequirement.ProductionSchedule.ProductionRule.Id,
             m.ProductionProcessRequirement.ProductionSchedule.ProductionRule.ProductionRuleName,
             m.ProductionProcessRequirement.ProductionSchedule.ProductionRule.ProductionRuleVersion,
             m.ProductionProcessRequirement.ProductionSchedule.ProductionRule.ProductionRuleStatus.ProductionRuleStatusName,
             m.RequireQuantity,
             m.ActualQuantity,
             m.Description,
             m.Remark,
             m.CreatedTime,
             m.CreatorUserId,
             m.LastUpdatedTime,
             m.LastUpdatorUserId
         });
         return(Json(new OperationResult(OperationResultType.Success, "读取某一生产计划下的设备需求列表数据成功!", page)));
     }
     catch (Exception ex)
     {
         return(Json(new OperationResult(OperationResultType.Error, "读取某一生产计划下的设备需求列表数据失败!", ex.ToString())));
     }
 }
        public IHttpActionResult GetPlanProductionScheduleInfo(PlanProductionScheduleInfo info)
        {
            PlanProductionScheduleInfo Info = PlanProductionScheduleInfoContract.PlanProductionScheduleInfos.ToList().Find(s =>
            {
                return(s.Id == info.Id);
            });

            return(Json(new OperationResult(OperationResultType.Success, "读取生产计划数据成功!", Info)));
        }
Esempio n. 4
0
 public IHttpActionResult GetProcessRequireInfoListByScheduleID(PlanProductionScheduleInfo info)
 {
     try
     {
         var page = GetPageResult(PlanProductionProcessRequirementInfoContract.PlanProductionProcessRequirementInfos.Where(m => m.ProductionSchedule.Id == info.Id), m => new
         {
             m.Id,
             ProductionSchedule_Id = m.ProductionSchedule.Id,
             m.ProductionSchedule.ScheduleName,
             m.ProductionSchedule.ScheduleCode,
             m.ProductionSchedule.ScheduleStatus,
             ProductionProcess_Id = m.ProductionProcess.Id,
             m.ProductionProcess.ProductionProcessName,
             m.ProductionProcess.ProductionProcessCode,
             ProductionRule_Id = m.ProductionSchedule.ProductionRule.Id,
             m.ProductionSchedule.ProductionRule.ProductionRuleName,
             m.ProductionSchedule.ProductionRule.ProductionRuleVersion,
             m.ProductionSchedule.ProductionRule.ProductionRuleStatus.ProductionRuleStatusName,
             m.StartTime,
             m.EndTime,
             m.Duration,
             m.DurationUnit,
             m.ProductionProcessOrder,
             m.ActualStartTime,
             m.ActualFinishTime,
             m.Description,
             m.Remark,
             m.CreatedTime,
             m.CreatorUserId,
             m.LastUpdatedTime,
             m.LastUpdatorUserId
         });
         return(Json(new OperationResult(OperationResultType.Success, "读取某一生产计划下的工序需求列表数据成功!", page)));
     }
     catch (Exception ex)
     {
         return(Json(new OperationResult(OperationResultType.Error, "读取某一生产计划下的工序需求列表数据失败!", ex.ToString())));
     }
 }