/// <summary> /// 作业号 /// </summary> /// <param name="id"></param> /// <returns></returns> public ActionResult LoadWipDiscreteJobsList(YnBaseDal.YnPage page,string ids) { List<AscmWipDiscreteJobs> list = null; JsonDataGridResult jsonDataGridResult = new JsonDataGridResult(); try { list = AscmWipDiscreteJobsService.GetInstance().GetWipDiscreteJobsSumListI(page, ids); if (list != null && list.Count > 0) { foreach (AscmWipDiscreteJobs ascmWipDiscreteJobs in list) { ascmWipDiscreteJobs.wipEntityIdentification = ascmWipDiscreteJobs.wipEntityId.ToString() +"_"+ ascmWipDiscreteJobs.mtlCategoryStatus; jsonDataGridResult.rows.Add(ascmWipDiscreteJobs); } jsonDataGridResult.total = page.GetRecordCount(); } jsonDataGridResult.result = true; jsonDataGridResult.message = ""; } catch (Exception ex) { jsonDataGridResult.result = false; jsonDataGridResult.message = ex.Message; } return Json(jsonDataGridResult, JsonRequestBehavior.AllowGet); }
//加载领料任务的作业 /// <summary> /// 2015年3月15日重写 /// 覃小华 /// </summary> /// <param name="taskIds"></param> /// <returns></returns> public List<AscmWipDiscreteJobs> GetWipDiscreteJobsSumListI(YnBaseDal.YnPage page, string taskIds) { List<AscmWipDiscreteJobs> list = new List<AscmWipDiscreteJobs>(); try { string hql = "select distinct a.wipEntityId, b.mtlCategoryStatus from AscmWipRequirementOperations a, AscmGetMaterialTask b where a.taskId=b.id and a.taskId in (" + taskIds + ") "; object rowsCount = YnDaoHelper.GetInstance().nHibernateHelper.GetObjectBySQL("select count(*) from (SELECT distinct t.wipentityid, b.mtlcategorystatus FROM ASCM_WIP_REQUIRE_OPERAT T, ASCM_GETMATERIAL_TASK B WHERE T.TASKID = B.ID AND B.id in (" + taskIds.Replace("AscmGetMaterialTask", "ASCM_GETMATERIAL_TASK") + "))"); IList<object[]> ilist = YnDaoHelper.GetInstance().nHibernateHelper.Find<object[]>(hql, Convert.ToInt32(rowsCount), page); string ids = string.Empty; // List<AscmWipRequirementOperations> listAscmWipRequirementOperations = null; if (ilist != null && ilist.Count > 0) { foreach (object[] wipEntityId in ilist) { list.Add(new AscmWipDiscreteJobs(Convert.ToInt32(wipEntityId[0]), wipEntityId[1] != null ? wipEntityId[1].ToString() : "")); if (!string.IsNullOrEmpty(ids) && Convert.ToInt32(wipEntityId[0]) > 0) ids += ","; if (Convert.ToInt32(wipEntityId[0]) > 0) ids += wipEntityId[0]; } } string whereOther = "", whereQueryWord = ""; if (!string.IsNullOrEmpty(ids)) { whereQueryWord = AscmCommonHelperService.GetInstance().IsJudgeListCount(ids, "wipEntityId"); whereOther = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereOther, whereQueryWord); } if (!string.IsNullOrEmpty(whereOther)) { foreach (AscmWipDiscreteJobs ascmWipDiscreteJobs in AscmWipDiscreteJobsService.GetInstance().GetList(null, "", "", "", whereOther)) { if (list.FindAll(g => g.wipEntityId == ascmWipDiscreteJobs.wipEntityId).Count > 0) { foreach (AscmWipDiscreteJobs ascmWipdiscreteJob in list.FindAll(g => g.wipEntityId == ascmWipDiscreteJobs.wipEntityId)) { ascmWipdiscreteJob.organizationId = ascmWipDiscreteJobs.organizationId; ascmWipdiscreteJob.createUser = ascmWipDiscreteJobs.createUser; ascmWipdiscreteJob.createTime = ascmWipDiscreteJobs.createTime; ascmWipdiscreteJob.modifyUser = ascmWipDiscreteJobs.modifyUser; ascmWipdiscreteJob.modifyTime = ascmWipDiscreteJobs.modifyTime; ascmWipdiscreteJob.requestId = ascmWipDiscreteJobs.requestId; ascmWipdiscreteJob.programId = ascmWipDiscreteJobs.programId; ascmWipdiscreteJob.statusType = ascmWipDiscreteJobs.statusType; ascmWipdiscreteJob.primaryItemId = ascmWipDiscreteJobs.primaryItemId; ascmWipdiscreteJob.jobType = ascmWipDiscreteJobs.jobType; ascmWipdiscreteJob.wipSupplyType = ascmWipDiscreteJobs.wipSupplyType; ascmWipdiscreteJob.description = ascmWipDiscreteJobs.description; ascmWipdiscreteJob.classCode = ascmWipDiscreteJobs.classCode; ascmWipdiscreteJob.materialAccount = ascmWipDiscreteJobs.materialAccount; ascmWipdiscreteJob.scheduledStartDate = ascmWipDiscreteJobs.scheduledStartDate; ascmWipdiscreteJob.scheduledCompletionDate = ascmWipDiscreteJobs.scheduledCompletionDate; ascmWipdiscreteJob.bomRevisionDate = ascmWipDiscreteJobs.bomRevisionDate; ascmWipdiscreteJob.routingRevisionDate = ascmWipDiscreteJobs.routingRevisionDate; ascmWipdiscreteJob.scheduleGroupId = ascmWipDiscreteJobs.scheduleGroupId; ascmWipdiscreteJob.productionLine = ascmWipDiscreteJobs.productionLine; ascmWipdiscreteJob.netQuantity = ascmWipDiscreteJobs.netQuantity; ascmWipdiscreteJob.startQuantity = ascmWipDiscreteJobs.startQuantity; ascmWipdiscreteJob.quantityCompleted = ascmWipDiscreteJobs.quantityCompleted; ascmWipdiscreteJob.dateReleased = ascmWipDiscreteJobs.dateReleased; ascmWipdiscreteJob.dateClosed = ascmWipDiscreteJobs.dateClosed; ascmWipdiscreteJob.tempBindContainSn = ascmWipDiscreteJobs.tempBindContainSn; ascmWipdiscreteJob.ascmStatus = ascmWipDiscreteJobs.ascmStatus; } } } AscmWipDiscreteJobsService.GetInstance().SetMaterialItem(list); AscmWipDiscreteJobsService.GetInstance().SetDiscreteJobs(list); AscmWipDiscreteJobsService.GetInstance().SetDutyPeple(list); AscmWipDiscreteJobsService.GetInstance().SetMarkTaskLog(taskIds, list); AscmWipDiscreteJobsService.GetInstance().SumQuantity(list); AscmWipDiscreteJobsService.GetInstance().starTimeAndEndTime(list); // AscmCommonHelperService.GetInstance().SetTotalSum(listAscmWipRequirementOperations, list); list = list.OrderBy(e => e.wipEntityId).ToList<AscmWipDiscreteJobs>(); } } catch (Exception ex) { YnBaseClass2.Helper.LogHelper.GetLog().Error("获取任务作业失败(Get AscmWipDiscreteJobs)", ex); throw ex; } return list; }