/// <summary> /// /// </summary> /// <param name="SchedulingId">产线信息</param> /// <returns></returns> public ActionResult Edit(DateTime?SDate, string SchedulingProNo, int SchedulingId = 0, int PSId = 0) { IList <Pro_PSDetail> PSDetail = new List <Pro_PSDetail>(); Pro_SchedulingLine fristLine = new Pro_SchedulingLine(); Pro_PS model = new Pro_PS(); if (PSId > 0) { //编辑 model = Smart.Instance.Pro_PSBizService.GetAllDomain(QueryCondition.Instance.AddEqual("Id", PSId.ToString()))[0]; //只加载一个产线,即 不能修改其他产线,下拉框只能选择一个 List <Pro_SchedulingLine> scheduList = new List <Pro_SchedulingLine>(); scheduList.Add(new Pro_SchedulingLine { Id = model.LineId, ProLineNo = model.ProLineNo }); ViewBag.AllLine = new SelectList(scheduList, "Id", "ProLineNo", fristLine.Id); //获取明细 PSDetail = Smart.Instance.Pro_PSDetailBizService.GetAllDomain(QueryCondition.Instance.AddOrderBy("Id", true).AddEqual("MainId", PSId.ToString())); } else { //新增 if (SDate == null) { SDate = DateTime.Now; } //1.获取所有产线信息 var allLineList = Smart.Instance.Pro_SchedulingLineBizService.GetAllDomain(QueryCondition.Instance.AddOrderBy("Id", true).AddEqual("MainId", SchedulingId.ToString())); if (allLineList.Count > 0) { fristLine = allLineList[0]; model = new Pro_PS { FinalEveningNum = fristLine.EveningShift, FinalMiddleNum = fristLine.MiddleShift, FinalMorningNum = fristLine.MorningShift, ProLineNo = fristLine.ProLineNo, ProDate = DateTime.Now, }; } model.SchedulingProNo = SchedulingProNo; model.ProDate = SDate.Value; ViewBag.AllLine = new SelectList(allLineList, "Id", "ProLineNo", fristLine.Id); PSDetail = Smart.Instance.Pro_PSDetailBizService.GetPSDetailBySchedulingLineId(model, fristLine, SDate.Value); } ViewBag.PSModel = model; return(View(PSDetail)); }
public JsonResult GetGoodList(int LineId, DateTime SDate) { //1.获取所有产线信息 Pro_SchedulingLine fristLine = Smart.Instance.Pro_SchedulingLineBizService.GetAllDomain(QueryCondition.Instance.AddOrderBy("Id", true).AddEqual("Id", LineId.ToString()))[0]; Pro_PS model = new Pro_PS(); model = new Pro_PS { FinalEveningNum = fristLine.EveningShift, FinalMiddleNum = fristLine.MiddleShift, FinalMorningNum = fristLine.MorningShift, ProLineNo = fristLine.ProLineNo, ProDate = DateTime.Now, }; ViewBag.PSModel = model; var pSDetail = Smart.Instance.Pro_PSDetailBizService.GetPSDetailBySchedulingLineId(model, fristLine, SDate); return(Json(new { PSModel = model, PSDetail = pSDetail })); }
public IList <Pro_PSDetail> GetPSDetailBySchedulingLineId(Pro_PS psModel, Pro_SchedulingLine fristLine, DateTime SDate) { IList <Pro_PSDetail> psDetail = new List <Pro_PSDetail>(); //产线对应的产品信息 IList <Pro_SchedulingGoods> schedulingGoods = new Pro_SchedulingGoodsDao().GetListBySchedulingLineId(Util.QueryCondition.Instance.AddEqual("Id", fristLine.Id.ToString()) .AddEqual("SDate", SDate.ToString("yyyy-MM-dd"))); int classNum = 0; //计算班次 if (psModel.FinalEveningNum != null) { classNum++; } if (psModel.FinalMiddleNum != null) { classNum++; } if (psModel.FinalMorningNum > 0) { classNum++; } //每天开始时间为8:00 修改成 7:30 //1班次 8:00~08:00 //2班次 8:00~ 12:45 12:45~08:00 //3班次 8:00 ~ 16:00 16:00~00:00 00:00~08:00 DateTime time = Convert.ToDateTime(SDate.ToString("yyyy-MM-dd") + " 07:30:00"); int i = 1; foreach (var good in schedulingGoods) { Pro_PSDetail model = new Pro_PSDetail { GoodNo = good.GoodNo, GoodName = good.GoodName, ShipTo = good.ShipTo, ShipToName = good.ShipToName, PackNum = good.PackNum, Qty = good.SNum, ProOrderIndex = i, SType = good.SType, STypeString = EnumOperate.GetEnumDesc((VisualSmart.Util.Menus.ClassType)good.SType) }; //产能 根据早中晚判断产能基本参数 decimal channeng = 0; if (model.SType == 2 && good.MorningNum != null) { channeng = good.MorningNum > 0 ? (Convert.ToDecimal(good.SNum) / good.MorningNum.Value) : 0; model.ChanNeng = good.MorningNum.Value; } else if (model.SType == 3 && good.MiddleNum != null) { channeng = good.MiddleNum > 0 ? (Convert.ToDecimal(good.SNum) / good.MiddleNum.Value) : 0; model.ChanNeng = good.MiddleNum.Value; } else if (model.SType == 4 && good.EveningNum != null) { channeng = good.EveningNum > 0 ? (Convert.ToDecimal(good.SNum) / good.EveningNum.Value) : 0; model.ChanNeng = good.EveningNum.Value; } channeng = channeng * 60 * 60; //1班次 8:00~08:00 model.StartTime = time; time = time.AddSeconds(Convert.ToDouble(channeng)); model.EndTime = time; //if (classNum == 1) //{ // //1班次 8:00~08:00 // model.StartTime = time; // time = time.AddSeconds(channeng); // model.EndTime = time; //} //else if (classNum == 2) //{ // //2班次 8:00~ 12:45 12:45~08:00 // if (model.SType > 2) // { // } // else // { // model.StartTime = time; // time = time.AddSeconds(channeng); // model.EndTime = time; // } //} //else if (classNum == 3) //{ // //3班次 8:00 ~ 16:00 16:00~00:00 00:00~08:00 // model.StartTime = time; // time = time.AddSeconds(channeng); // model.EndTime = time; //} psDetail.Add(model); i++; } return(psDetail); }
public ActionResult Index(string proLineNosList, string StockId, string ShipMainProNo, int ShipPlanMainId = 0, int Id = 0, int MainId = 0, int page = 1) { List <Pro_ShipPlan> shipPlanList = new List <Pro_ShipPlan>(); List <Pro_ShipPlans> _shipPlansList = new List <Pro_ShipPlans>(); List <Pro_SchedulingLine> pro_SchedulingLineList = new List <Pro_SchedulingLine>(); var lingHourList = new List <Base_LineHour>(); if (MainId == 0) { ViewBag.Id = MainId; //1.发运计划时间段 var mainDate = Smart.Instance.Pro_ShipPlanMainBizService.GetAllDomain(QueryCondition.Instance.AddOrderBy("Id", false).AddEqual("Id", ShipPlanMainId.ToString()))[0]; ViewBag.MainDate = mainDate; var query = QueryCondition.Instance.AddEqual("LineNos", proLineNosList).AddEqual("StockMainId", StockId) .AddEqual("MainId", ShipPlanMainId.ToString()); //2.发运计划产品信息 shipPlanList = Smart.Instance.Pro_ShipPlanBizService.GetAllDomainByLineNos(query).ToList(); //3.发运时间明细 _shipPlansList = Smart.Instance.Pro_ShipPlansBizService.GetAllDomainByLineNos(query).ToList(); ViewBag.ShipPlansList = _shipPlansList; //4 获取每条产线最大的工时 lingHourList = Smart.Instance.Base_LineHourBizService.GetLineHourList(proLineNosList).ToList(); //生产线 var ProLineNos = proLineNosList.Replace("'", "").Split(',').ToList(); foreach (var line in ProLineNos) { var lineModel = new Pro_SchedulingLine(); lineModel.ProLineNo = line; var hourModel = lingHourList.Find(t => t.ProLineNo == line); if (hourModel != null) { lineModel.MaxHour = hourModel.MaxHours; } pro_SchedulingLineList.Add(lineModel); } ViewBag.ShipMainProNo = ShipMainProNo; ViewBag.SchedulingList = pro_SchedulingLineList; return(View(shipPlanList)); } ViewBag.Id = MainId; //发运计划产品信息 var schedulingModel = Smart.Instance.Pro_SchedulingBizService.GetAllDomain(QueryCondition.Instance.AddEqual("Id", MainId.ToString())).ToList()[0]; Pro_ShipPlanMain model = new Pro_ShipPlanMain { PlanFromDate = schedulingModel.PlanFromDate, PlanFromTo = schedulingModel.PlanToDate }; ViewBag.MainDate = model; //获取所有产线信息 pro_SchedulingLineList = Smart.Instance.Pro_SchedulingLineBizService.GetAllDomain(QueryCondition.Instance.AddEqual("MainId", MainId.ToString())).ToList(); var temp_proLineNosList = ""; foreach (var line in pro_SchedulingLineList) { temp_proLineNosList += string.Format("'{0}',", line.ProLineNo); } //4 获取每条产线最大的工时 lingHourList = Smart.Instance.Base_LineHourBizService.GetLineHourList(temp_proLineNosList.Trim(',')).ToList(); foreach (var line in pro_SchedulingLineList) { var hourModel = lingHourList.Find(t => t.ProLineNo == line.ProLineNo); if (hourModel != null) { line.MaxHour = hourModel.MaxHours; } } ViewBag.SchedulingList = pro_SchedulingLineList; //发运计划产品信息 shipPlanList = Smart.Instance.Pro_ShipPlanBizService.GetPro_SchedulingByEdit(MainId).ToList(); //发运时间明细 _shipPlansList = Smart.Instance.Pro_ShipPlansBizService.GetPro_SchedulingGoodsNumByEdit(MainId).ToList(); ViewBag.ShipPlansList = _shipPlansList; ViewBag.ShipMainProNo = schedulingModel.ShipMainProNo; return(View(shipPlanList)); }
public JsonResult AddPro_SchedulingLine(Pro_SchedulingLine model) { model.RowState = 1; return(Json(new { Mess = "success", Id = Smart.Instance.Pro_SchedulingLineBizService.AddGetId(model) })); }