public void GenOrdersByShiftPlanScheduleId(int ShiftPlanScheduleId, string userCode) { ShiftPlanSchedule sps = this.LoadShiftPlanSchedule(ShiftPlanScheduleId); if (sps == null || sps.Shift == null) { return; } OrderHead oh = OrderMgr.TransferFlow2Order(sps.FlowDetail.Flow); oh.StartTime = ShiftMgr.GetShiftStartTime(sps.ReqDate, sps.Shift); oh.WindowTime = ShiftMgr.GetShiftEndTime(sps.ReqDate, sps.Shift); oh.Priority = BusinessConstants.CODE_MASTER_ORDER_PRIORITY_VALUE_NORMAL; if (oh.OrderDetails != null && oh.OrderDetails.Count > 0) { foreach (OrderDetail od in oh.OrderDetails) { if (od.FlowDetail.Equals(sps.FlowDetail)) { od.RequiredQty = sps.PlanQty; od.OrderedQty = sps.PlanQty; } } } LeanEngineMgr.CreateOrder(oh, userCode); }
public void Save() { Shift shift = TheShiftMgr.LoadShift(ShiftCode); decimal planQty = this.tbPlanQty.Text.Trim() != string.Empty ? decimal.Parse(this.tbPlanQty.Text) : 0; ShiftPlanSchedule sps = new ShiftPlanSchedule(); if (ShiftPlanScheduleId > 0) { //Update sps = TheShiftPlanScheduleMgr.LoadShiftPlanSchedule(ShiftPlanScheduleId); if (sps.Shift == null) sps.Shift = shift; sps.PlanQty = planQty; TheShiftPlanScheduleMgr.UpdateShiftPlanSchedule(sps); } else { if (planQty > 0) { //Create sps.FlowDetail = TheFlowDetailMgr.LoadFlowDetail(FlowDetailId); sps.ReqDate = ReqDate; sps.Shift = shift; sps.Sequence = 0;//todo sps.PlanQty = planQty; sps.LastModifyDate = DateTime.Now; sps.LastModifyUser = this.CurrentUser; TheShiftPlanScheduleMgr.CreateShiftPlanSchedule(sps); } } }
public void Save() { Shift shift = TheShiftMgr.LoadShift(ShiftCode); decimal planQty = this.tbPlanQty.Text.Trim() != string.Empty ? decimal.Parse(this.tbPlanQty.Text) : 0; ShiftPlanSchedule sps = new ShiftPlanSchedule(); if (ShiftPlanScheduleId > 0) { //Update sps = TheShiftPlanScheduleMgr.LoadShiftPlanSchedule(ShiftPlanScheduleId); if (sps.Shift == null) { sps.Shift = shift; } sps.PlanQty = planQty; TheShiftPlanScheduleMgr.UpdateShiftPlanSchedule(sps); } else { if (planQty > 0) { //Create sps.FlowDetail = TheFlowDetailMgr.LoadFlowDetail(FlowDetailId); sps.ReqDate = ReqDate; sps.Shift = shift; sps.Sequence = 0;//todo sps.PlanQty = planQty; sps.LastModifyDate = DateTime.Now; sps.LastModifyUser = this.CurrentUser; TheShiftPlanScheduleMgr.CreateShiftPlanSchedule(sps); } } }
public void Control_DataBind() { if (ShiftPlanScheduleId > 0) { ShiftPlanSchedule sps = TheShiftPlanScheduleMgr.LoadShiftPlanSchedule(ShiftPlanScheduleId); this.tbPlanQty.Text = sps.PlanQty.ToString("0.########"); } }
public void ClearOldShiftPlanSchedule(ShiftPlanSchedule shiftPlanSchedule) { DetachedCriteria criteria = DetachedCriteria.For(typeof(ShiftPlanSchedule)); criteria.Add(Expression.Eq("FlowDetail.Id", shiftPlanSchedule.FlowDetail.Id)); criteria.Add(Expression.Eq("ReqDate", shiftPlanSchedule.ReqDate)); criteria.Add(Expression.Eq("Shift.Code", shiftPlanSchedule.Shift.Code)); IList<ShiftPlanSchedule> spsList = criteriaMgr.FindAll<ShiftPlanSchedule>(criteria); if (spsList != null && spsList.Count > 0) { foreach (ShiftPlanSchedule sps in spsList) { this.DeleteShiftPlanSchedule(sps); } } }
public void ClearOldShiftPlanSchedule(ShiftPlanSchedule shiftPlanSchedule) { DetachedCriteria criteria = DetachedCriteria.For(typeof(ShiftPlanSchedule)); criteria.Add(Expression.Eq("FlowDetail.Id", shiftPlanSchedule.FlowDetail.Id)); criteria.Add(Expression.Eq("ReqDate", shiftPlanSchedule.ReqDate)); criteria.Add(Expression.Eq("Shift.Code", shiftPlanSchedule.Shift.Code)); IList <ShiftPlanSchedule> spsList = criteriaMgr.FindAll <ShiftPlanSchedule>(criteria); if (spsList != null && spsList.Count > 0) { foreach (ShiftPlanSchedule sps in spsList) { this.DeleteShiftPlanSchedule(sps); } } }
public void SaveShiftPlanSchedule(ShiftPlanSchedule shiftPlanSchedule, User user) { //this.ClearOldShiftPlanSchedule(shiftPlanSchedule); //shiftPlanSchedule.LastModifyDate = DateTime.Now; //shiftPlanSchedule.LastModifyUser = user; //this.CreateShiftPlanSchedule(shiftPlanSchedule); ShiftPlanSchedule sps = this.GetShiftPlanSchedule(shiftPlanSchedule.FlowDetail.Id, shiftPlanSchedule.ReqDate, shiftPlanSchedule.Shift.Code, shiftPlanSchedule.Sequence); if (sps == null) { shiftPlanSchedule.LastModifyDate = DateTime.Now; shiftPlanSchedule.LastModifyUser = user; this.CreateShiftPlanSchedule(shiftPlanSchedule); } else { sps.PlanQty = shiftPlanSchedule.PlanQty; sps.LastModifyUser = shiftPlanSchedule.LastModifyUser; sps.LastModifyDate = DateTime.Now; this.UpdateShiftPlanSchedule(sps); } }
public void SaveShiftPlanSchedule(ShiftPlanSchedule shiftPlanSchedule, User user) { //this.ClearOldShiftPlanSchedule(shiftPlanSchedule); //shiftPlanSchedule.LastModifyDate = DateTime.Now; //shiftPlanSchedule.LastModifyUser = user; //this.CreateShiftPlanSchedule(shiftPlanSchedule); ShiftPlanSchedule sps = this.GetShiftPlanSchedule(shiftPlanSchedule.FlowDetail.Id, shiftPlanSchedule.ReqDate, shiftPlanSchedule.Shift.Code, shiftPlanSchedule.Sequence); if (sps == null) { shiftPlanSchedule.LastModifyDate = DateTime.Now; shiftPlanSchedule.LastModifyUser = user; this.CreateShiftPlanSchedule(shiftPlanSchedule); } else { sps.PlanQty = shiftPlanSchedule.PlanQty; sps.LastModifyUser = shiftPlanSchedule.LastModifyUser; sps.LastModifyDate = DateTime.Now; this.UpdateShiftPlanSchedule(sps); } }
public IList<ShiftPlanSchedule> ReadPSModelFromXls(Stream inputStream, User user, string regionCode, string flowCode, DateTime date, string shiftCode) { IList<ShiftPlanSchedule> spsList = new List<ShiftPlanSchedule>(); Shift shift = shiftMgr.LoadShift(shiftCode); if (inputStream.Length == 0) throw new BusinessErrorException("Import.Stream.Empty"); if (shift == null) throw new BusinessErrorException("Import.PSModel.ShiftNotExist"); HSSFWorkbook workbook = new HSSFWorkbook(inputStream); Sheet sheet = workbook.GetSheetAt(0); IEnumerator rows = sheet.GetRowEnumerator(); ImportHelper.JumpRows(rows, 4); int colIndex = this.GetPlanColumnIndexToRead((HSSFRow)rows.Current, shift.ShiftName, date); if (colIndex < 0) throw new BusinessErrorException("Import.PSModel.Shift.Not.Exist", shift.ShiftName); ImportHelper.JumpRows(rows, 2); while (rows.MoveNext()) { Row row = (HSSFRow)rows.Current; if (!this.CheckValidDataRow(row, 1, 4)) { break;//边界 } //string regCode=row.GetCell( string fCode = string.Empty; string itemCode = string.Empty; int seq = 0; decimal planQty = 0; Cell cell = null; #region 读取生产线 fCode = row.GetCell(1).StringCellValue; if (fCode.Trim() == string.Empty) throw new BusinessErrorException("Import.PSModel.Empty.Error.Flow", (row.RowNum + 1).ToString()); if (flowCode != null && flowCode.Trim() != string.Empty) { if (fCode.Trim().ToUpper() != flowCode.Trim().ToUpper()) continue;//生产线过滤 } #endregion #region 读取序号 try { string seqStr = row.GetCell(2).StringCellValue; seq = row.GetCell(2).StringCellValue.Trim() != string.Empty ? int.Parse(row.GetCell(2).StringCellValue) : 0; } catch { throw new BusinessErrorException("Import.PSModel.Read.Error.Seq", (row.RowNum + 1).ToString()); } #endregion #region 读取成品代码 try { itemCode = row.GetCell(3).StringCellValue; if (itemCode == string.Empty) throw new BusinessErrorException("Import.PSModel.Empty.Error.ItemCode", (row.RowNum + 1).ToString()); } catch { throw new BusinessErrorException("Import.PSModel.Read.Error.ItemCode", (row.RowNum + 1).ToString()); } #endregion #region 读取计划量 try { cell = row.GetCell(colIndex); if (cell == null || cell.CellType == NPOI.SS.UserModel.CellType.BLANK) continue; planQty = Convert.ToDecimal(row.GetCell(colIndex).NumericCellValue); } catch { throw new BusinessErrorException("Import.PSModel.Read.Error.PlanQty", (row.RowNum + 1).ToString()); } #endregion FlowDetail flowDetail = flowDetailMgr.LoadFlowDetail(fCode, itemCode, seq); if (flowDetail == null) throw new BusinessErrorException("Import.PSModel.FlowDetail.Not.Exist", (row.RowNum + 1).ToString()); //区域权限过滤 if (regionCode != null && regionCode.Trim() != string.Empty) { if (regionCode.Trim().ToUpper() != flowDetail.Flow.PartyTo.Code.ToUpper()) continue; } if (!user.HasPermission(flowDetail.Flow.PartyTo.Code)) continue; ShiftPlanSchedule sps = new ShiftPlanSchedule(); sps.FlowDetail = flowDetail; sps.ReqDate = date; sps.Shift = shift; sps.PlanQty = planQty; sps.LastModifyUser = user; sps.LastModifyDate = DateTime.Now; spsList.Add(sps); } if (spsList.Count == 0) throw new BusinessErrorException("Import.Result.Error.ImportNothing"); return spsList; }
public virtual void DeleteShiftPlanSchedule(ShiftPlanSchedule entity) { Delete(entity); }
public virtual void UpdateShiftPlanSchedule(ShiftPlanSchedule entity) { Update(entity); }
public virtual void CreateShiftPlanSchedule(ShiftPlanSchedule entity) { Create(entity); }
public virtual void DeleteShiftPlanSchedule(ShiftPlanSchedule entity) { Delete(entity); }
public virtual void UpdateShiftPlanSchedule(ShiftPlanSchedule entity) { Update(entity); }
public virtual void CreateShiftPlanSchedule(ShiftPlanSchedule entity) { Create(entity); }