/// <summary> /// 查询出库批次表 /// </summary> /// <returns></returns> public static Msg QueryOutBunch(int iBuildBunch) { Msg msg = null; try { using (var en = new LingYunEntities()) { Tbl_OutSiteStorage lBunch = en.Tbl_OutSiteStorage.Where(a => a.BuildBatchID == iBuildBunch).FirstOrDefault(); if (lBunch != null) { msg = new Msg(true) { UserData = lBunch }; } else { msg = new Msg(false) { Message = "您当前没有待确认的入库批次记录" }; } } } catch (Exception ex) { msg = new Msg(false) { Message = ex.Message }; } return(msg); }
/// <summary> /// 更新出库批次表 /// </summary> /// <returns></returns> public static Msg UpdateOutBunch(int BuildBunchId, int count) { Msg msg = null; try { using (var en = new LingYunEntities()) { Tbl_OutSiteStorage oBunch = en.Tbl_OutSiteStorage.Where(a => a.BuildBatchID == BuildBunchId).FirstOrDefault(); if (oBunch != null) { oBunch.Count = count; } en.SaveChanges(); msg = Msg.Default; } } catch (Exception ex) { msg = new Msg(false) { Message = ex.Message }; } return(msg); }
/// <summary> /// 确认出库批次表 /// </summary> /// <returns></returns> public static Msg EnsureOutBunch(int iBuildBunch, int count) { Msg msg = null; try { using (var en = new LingYunEntities()) { Tbl_SiteStorage oSiteStorage = en.Tbl_SiteStorage.Where(a => a.BuildBatchID == iBuildBunch).FirstOrDefault(); if (oSiteStorage != null) { oSiteStorage.NowAdmStatus = 128; oSiteStorage.NowAdmTime = DateTime.Now; } Tbl_OutSiteStorage oSiteBunch = en.Tbl_OutSiteStorage.Where(a => a.BuildBatchID == iBuildBunch).FirstOrDefault(); if (oSiteStorage != null) { oSiteBunch.PreAdmStatus = 128; oSiteBunch.PreAdmTime = DateTime.Now; oSiteBunch.Count = count; } en.SaveChanges(); msg = Msg.Default; } } catch (Exception ex) { msg = new Msg(false) { Message = ex.Message }; } return(msg); }
/// <summary> /// 根据编号查询入库批次表 /// </summary> /// <returns></returns> public static bool QueryIsHaveOutBunch(int BuildBunchId) { using (var en = new LingYunEntities()) { Tbl_OutSiteStorage oBunch = en.Tbl_OutSiteStorage.Where(a => a.BuildBatchID == BuildBunchId).FirstOrDefault(); if (oBunch != null) { return(true); } else { return(false); } } }
protected void ensure_Click(object sender, EventArgs e) { bool isHave = SiteStorageModel.QueryOutBunchById(int.Parse(txbBuildBunchID.Value)); if (isHave) { Msg msg = SiteStorageModel.UpdateOutBunch(int.Parse(txbBuildBunchID.Value), int.Parse(txbCount.Value)); if (msg.Status) { PageHelper.ShowAlertMsg(this, "编辑成功"); } else { PageHelper.ShowAlertMsg(this, msg.Message); } } else { Tbl_OutSiteStorage oBunch = new Tbl_OutSiteStorage(); oBunch.PlanID = int.Parse(txbPlanId.Value); oBunch.Time = DateTime.Now; oBunch.MateriesID = int.Parse(txbMateriesID.Value); oBunch.BuildID = txbBuildID.Value; oBunch.BuildName = txbBuildName.Value.ToString(); oBunch.MateriesType = txbMetriesType.Value.ToString(); oBunch.PreAdmTime = DateTime.Now; oBunch.Count = int.Parse(txbCount.Value); oBunch.BuildBatchID = int.Parse(txbBuildBunchID.Value); oBunch.ProjectName = txbProjectName.Value; oBunch.MateriesTasbleID = 0; oBunch.Time = DateTime.Now; oBunch.WorkMapID = txbProductNum.Value; Msg msg = SiteStorageModel.EditOutBunch(oBunch); if (msg.Status) { PageHelper.ShowAlertMsg(this, "编辑成功"); } else { PageHelper.ShowAlertMsg(this, msg.Message); } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string sBuildBunchId = this.Request["BuildBunchId"]; Msg msg = SiteStorageModel.QueryOutBunch(int.Parse(sBuildBunchId)); if (msg.Status) { Tbl_OutSiteStorage oBunch = msg.UserData as Tbl_OutSiteStorage; txbPlanId.Value = oBunch.PlanID.ToString(); txbMateriesID.Value = oBunch.MateriesID.ToString(); txbBuildID.Value = oBunch.BuildID.ToString(); txbBuildName.Value = oBunch.BuildName; txbCount.Value = oBunch.Count.ToString(); txbMetriesType.Value = oBunch.MateriesType; txbProjectName.Value = oBunch.ProjectName; txbBuildBunchID.Value = oBunch.BuildBatchID.ToString(); txbProductNum.Value = oBunch.WorkMapID; } } }
/// <summary> /// 插入出库批次表 /// </summary> /// <returns></returns> public static Msg EditOutBunch(Tbl_OutSiteStorage oBunch) { Msg msg = null; try { using (var en = new LingYunEntities()) { en.Tbl_OutSiteStorage.AddObject(oBunch); en.SaveChanges(); msg = Msg.Default; } } catch (Exception ex) { msg = new Msg(false) { Message = ex.Message }; } return(msg); }
public static TrackMsg TrackByBatchId(int iBatchId) { TrackMsg track = null; string list = string.Empty; // List<string> list = new List<string>(); try { track = new TrackMsg(); int res = 0; using (var en = new LingYunEntities()) { Tbl_ProductBatch oProIn = en.Tbl_ProductBatch.Where(a => a.BuildBatchID == iBatchId && a.NowAdmStatus == 128).FirstOrDefault(); if (oProIn != null) { list += oProIn.NowAdmTime.Value.ToString(); Tbl_OutProductBatch oProOut = en.Tbl_OutProductBatch.Where(a => a.BuildBatchID == iBatchId && a.PreAdmStatus == 128).FirstOrDefault(); if (oProOut != null) { list += ";" + oProOut.PreAdmTime.Value.ToString(); Tbl_CenterStorageBatch oCenIn = en.Tbl_CenterStorageBatch.Where(a => a.BuildBatchID == iBatchId && a.NowAdmStatus == 128).FirstOrDefault(); if (oCenIn != null) { list += ";" + oCenIn.NowAdmTime.Value.ToString(); Tbl_OutCenterStorage oCenOut = en.Tbl_OutCenterStorage.Where(a => a.BuildBatchID == iBatchId && a.PreAdmStatus == 128).FirstOrDefault(); if (oCenOut != null) { list += ";" + oCenOut.PreAdmTime.Value.ToString(); Tbl_SiteStorageBatch oSiteIn = en.Tbl_SiteStorageBatch.Where(a => a.BuildBatchID == iBatchId && a.NowAdmStatus == 128).FirstOrDefault(); if (oSiteIn != null) { list += ";" + oSiteIn.NowAdmTime.Value.ToString(); Tbl_OutSiteStorage oSiteOut = en.Tbl_OutSiteStorage.Where(a => a.BuildBatchID == iBatchId && a.PreAdmStatus == 128).FirstOrDefault(); if (oSiteOut != null) { list += ";" + oSiteOut.PreAdmTime.Value.ToString(); res = (int)BatchStatus.待领料; } else { res = (int)BatchStatus.现场仓库待出库审批; } } else { res = (int)BatchStatus.现场仓库入库待审批; } } else { res = (int)BatchStatus.中心仓库待出库审批; } } else { res = (int)BatchStatus.中心仓库入库待审批; } } else { res = (int)BatchStatus.加工仓库待出库审批; } } else { res = (int)BatchStatus.加工仓库入库待审批; } //Tbl_SiteStorage oSite = en.Tbl_SiteStorage.Where(a => a.BuildBatchID == iBatchId).FirstOrDefault(); //Tbl_CenterStorage oCenter = en.Tbl_CenterStorage.Where(a => a.BuildBatchID == iBatchId).FirstOrDefault(); //Tbl_ProductStorage oPro = en.Tbl_ProductStorage.Where(a => a.BuildBatchID == iBatchId).FirstOrDefault(); //if (oSite != null) //{ // Tbl_OutSiteStorage oOut = en.Tbl_OutSiteStorage.Where(a => a.BuildBatchID == iBatchId).FirstOrDefault(); // if (oOut ==null) // res = (int)BatchStatus.现场仓库待出库审批; // else // res = (int)BatchStatus.待领料; //} //else if (oCenter != null) //{ // Tbl_OutCenterStorage oOut = en.Tbl_OutCenterStorage.Where(a => a.BuildBatchID == iBatchId).FirstOrDefault(); // if (oOut==null) // res = (int)BatchStatus.中心仓库待出库审批; // else // res = (int)BatchStatus.现场仓库入库待审批; //} //else if (oPro != null) //{ // Tbl_OutProductBatch oOut = en.Tbl_OutProductBatch.Where(a => a.BuildBatchID == iBatchId).FirstOrDefault(); // if (oOut==null) // res = (int)BatchStatus.加工仓库待出库审批; // else // res = (int)BatchStatus.中心仓库入库待审批; //} //else //{ // //} track.STime = list; track.Status = res; } } catch (Exception ex) { track = new TrackMsg() { Status = -1 }; } return(track); }
private void Save(object data, int identify) { if (identify == (int)CurrentType.加工登录入库) { List <Tbl_Materies> lMa = data as List <Tbl_Materies>; List <Tbl_ProductBatch> lObj = new List <Tbl_ProductBatch>(); foreach (Tbl_Materies oPro in lMa) { Tbl_ProductBatch oSto = new Tbl_ProductBatch(); oSto.BuildID = oPro.BuildNum; oSto.BuildName = oPro.BuildName; oSto.Count = oPro.TotalNum; oSto.MateriesID = oPro.MateriesID; oSto.MateriesTasbleID = 0; oSto.MateriesType = oPro.MateriesType; oSto.PlanID = oPro.PlanID; oSto.PreAdmStatus = 1; oSto.PreAdmTime = DateTime.Now; oSto.NowAdmStatus = 1; oSto.NowAdmTime = DateTime.Now; oSto.ProjectName = oPro.ProjectName; oSto.Time = DateTime.Now; oSto.WorkMapID = oPro.ProcessingNum; lObj.Add(oSto); } Msg msg = ProductModel.NEditInBunch(lObj); if (msg.Status) { PageHelper.ShowAlertMsg(this, "编辑成功"); } // CallBack call = ReturnMsg; // Thread thread = new Thread(() => GetBarCode(lObj, call)); // thread.IsBackground = true; // thread.Start(); } else if (identify == (int)CurrentType.加工确认入库) { List <Tbl_ProductBatch> lMa = data as List <Tbl_ProductBatch>; List <Tbl_ProductStorage> lObj = new List <Tbl_ProductStorage>(); foreach (Tbl_ProductBatch oPro in lMa) { Tbl_ProductStorage oSto = new Tbl_ProductStorage(); oSto.BuildBatchID = (int)oPro.BuildBatchID; oSto.BuildID = oPro.BuildID; oSto.BuildName = oPro.BuildName; oSto.InCount = oPro.Count; oSto.MateriesID = oPro.MateriesID; oSto.MateriesTasbleID = oPro.MateriesTasbleID; oSto.MateriesType = oPro.MateriesType; oSto.PlanID = oPro.PlanID; oSto.PreAdmStatus = 128; oSto.PreAdmTime = DateTime.Now; oSto.NowAdmStatus = 1; oSto.NowAdmTime = DateTime.Now; oSto.ProjectName = oPro.ProjectName; oSto.Time = DateTime.Now; oSto.WorkMapID = oPro.WorkMapID; lObj.Add(oSto); } Msg msg = ProductModel.NEnsureInBunch(lObj); if (msg.Status) { PageHelper.ShowAlertMsg(this, "确认成功"); } else { PageHelper.ShowAlertMsg(this, "确认失败:" + msg.Message); } } else if (identify == (int)CurrentType.加工登录出库) { List <Tbl_ProductStorage> lMa = data as List <Tbl_ProductStorage>; List <Tbl_OutProductBatch> lObj = new List <Tbl_OutProductBatch>(); foreach (Tbl_ProductStorage oPro in lMa) { Tbl_OutProductBatch oSto = new Tbl_OutProductBatch(); oSto.BuildBatchID = (int)oPro.BuildBatchID; oSto.BuildID = oPro.BuildID; oSto.BuildName = oPro.BuildName; oSto.Count = oPro.InCount == null?0:(int)oPro.InCount; oSto.MateriesID = oPro.MateriesID; oSto.MateriesTasbleID = oPro.MateriesTasbleID; oSto.MateriesType = oPro.MateriesType; oSto.PlanID = oPro.PlanID; oSto.PreAdmStatus = 1; oSto.PreAdmTime = DateTime.Now; oSto.NowAdmStatus = 1; oSto.NowAdmTime = DateTime.Now; oSto.ProjectName = oPro.ProjectName; oSto.Time = DateTime.Now; oSto.WorkMapID = oPro.WorkMapID; lObj.Add(oSto); } Msg msg = ProductModel.NEditOurBunch(lObj); if (msg.Status) { PageHelper.ShowAlertMsg(this, "确认成功"); } else { PageHelper.ShowAlertMsg(this, "确认失败:" + msg.Message); } } else if (identify == (int)CurrentType.加工确认出库) { List <Tbl_OutProductBatch> lMa = data as List <Tbl_OutProductBatch>; List <Tbl_CenterStorageBatch> lObj = new List <Tbl_CenterStorageBatch>(); foreach (Tbl_OutProductBatch oPro in lMa) { Tbl_CenterStorageBatch oSto = new Tbl_CenterStorageBatch(); oSto.BuildBatchID = (int)oPro.BuildBatchID; oSto.BuildID = oPro.BuildID; oSto.BuildName = oPro.BuildName; oSto.Count = oPro.Count; oSto.MateriesID = oPro.MateriesID; oSto.MateriesTasbleID = oPro.MateriesTasbleID; oSto.MateriesType = oPro.MateriesType; oSto.PlanID = oPro.PlanID; oSto.PreAdmStatus = 128; oSto.PreAdmTime = DateTime.Now; oSto.NowAdmStatus = 1; oSto.NowAdmTime = DateTime.Now; oSto.ProjectName = oPro.ProjectName; oSto.Time = DateTime.Now; oSto.WorkMapID = oPro.WorkMapID; lObj.Add(oSto); } Msg msg = ProductModel.NEnsureOutBunch(lObj); if (msg.Status) { PageHelper.ShowAlertMsg(this, "确认成功"); } else { PageHelper.ShowAlertMsg(this, "确认失败:" + msg.Message); } } else if (identify == (int)CurrentType.中心确认入库) { List <Tbl_CenterStorageBatch> lMa = data as List <Tbl_CenterStorageBatch>; List <Tbl_CenterStorage> lObj = new List <Tbl_CenterStorage>(); foreach (Tbl_CenterStorageBatch oPro in lMa) { Tbl_CenterStorage oSto = new Tbl_CenterStorage(); oSto.BuildBatchID = (int)oPro.BuildBatchID; oSto.BuildID = oPro.BuildID; oSto.BuildName = oPro.BuildName; oSto.InCount = oPro.Count; oSto.MateriesID = oPro.MateriesID; oSto.MateriesTasbleID = oPro.MateriesTasbleID; oSto.MateriesType = oPro.MateriesType; oSto.PlanID = oPro.PlanID; oSto.PreAdmStatus = 128; oSto.PreAdmTime = DateTime.Now; oSto.NowAdmStatus = 1; oSto.NowAdmTime = DateTime.Now; oSto.ProjectName = oPro.ProjectName; oSto.Time = DateTime.Now; oSto.WorkMapID = oPro.WorkMapID; lObj.Add(oSto); } Msg msg = Center.NEnsureInBunch(lObj); if (msg.Status) { PageHelper.ShowAlertMsg(this, "确认成功"); } else { PageHelper.ShowAlertMsg(this, "确认失败:" + msg.Message); } } else if (identify == (int)CurrentType.中心登录出库) { List <Tbl_CenterStorage> lMa = data as List <Tbl_CenterStorage>; List <Tbl_OutCenterStorage> lObj = new List <Tbl_OutCenterStorage>(); foreach (Tbl_CenterStorage oPro in lMa) { Tbl_OutCenterStorage oSto = new Tbl_OutCenterStorage(); oSto.BuildBatchID = (int)oPro.BuildBatchID; oSto.BuildID = oPro.BuildID; oSto.BuildName = oPro.BuildName; oSto.Count = oPro.Count; oSto.MateriesID = oPro.MateriesID; oSto.MateriesTasbleID = oPro.MateriesTasbleID; oSto.MateriesType = oPro.MateriesType; oSto.PlanID = oPro.PlanID; oSto.PreAdmStatus = 1; oSto.PreAdmTime = DateTime.Now; oSto.ProjectName = oPro.ProjectName; oSto.Time = DateTime.Now; oSto.WorkMapID = oPro.WorkMapID; lObj.Add(oSto); } Msg msg = Center.NEditOutBunch(lObj); if (msg.Status) { PageHelper.ShowAlertMsg(this, "确认成功"); } else { PageHelper.ShowAlertMsg(this, "确认失败:" + msg.Message); } } else if (identify == (int)CurrentType.中心确认出库) { List <Tbl_OutCenterStorage> lMa = data as List <Tbl_OutCenterStorage>; List <Tbl_SiteStorageBatch> lObj = new List <Tbl_SiteStorageBatch>(); foreach (Tbl_OutCenterStorage oPro in lMa) { Tbl_SiteStorageBatch oSto = new Tbl_SiteStorageBatch(); oSto.BuildBatchID = (int)oPro.BuildBatchID; oSto.BuildID = oPro.BuildID; oSto.BuildName = oPro.BuildName; oSto.Count = oPro.Count; oSto.MateriesID = oPro.MateriesID; oSto.MateriesTasbleID = oPro.MateriesTasbleID; oSto.MateriesType = oPro.MateriesType; oSto.PlanID = oPro.PlanID; oSto.PreAdmStatus = 128; oSto.PreAdmTime = DateTime.Now; oSto.ProjectName = oPro.ProjectName; oSto.Time = DateTime.Now; oSto.WorkMapID = oPro.WorkMapID; lObj.Add(oSto); } Msg msg = Center.NEnsureOutBunch(lObj); if (msg.Status) { PageHelper.ShowAlertMsg(this, "确认成功"); } else { PageHelper.ShowAlertMsg(this, "确认失败:" + msg.Message); } } else if (identify == (int)CurrentType.现场确认入库) { List <Tbl_SiteStorageBatch> lMa = data as List <Tbl_SiteStorageBatch>; List <Tbl_SiteStorage> lObj = new List <Tbl_SiteStorage>(); foreach (Tbl_SiteStorageBatch oPro in lMa) { Tbl_SiteStorage oSto = new Tbl_SiteStorage(); oSto.BuildBatchID = (int)oPro.BuildBatchID; oSto.BuildID = oPro.BuildID; oSto.BuildName = oPro.BuildName; oSto.InCount = oPro.Count; oSto.MateriesID = oPro.MateriesID; oSto.MateriesTasbleID = oPro.MateriesTasbleID; oSto.MateriesType = oPro.MateriesType; oSto.PlanID = oPro.PlanID; oSto.PreAdmStatus = 128; oSto.PreAdmTime = DateTime.Now; oSto.ProjectName = oPro.ProjectName; oSto.Time = DateTime.Now; oSto.WorkMapID = oPro.WorkMapID; lObj.Add(oSto); } Msg msg = SiteStorageModel.NEnsureInBunch(lObj); if (msg.Status) { PageHelper.ShowAlertMsg(this, "确认成功"); } else { PageHelper.ShowAlertMsg(this, "确认失败:" + msg.Message); } } else if (identify == (int)CurrentType.现场登录出库) { List <Tbl_SiteStorage> lMa = data as List <Tbl_SiteStorage>; List <Tbl_OutSiteStorage> lObj = new List <Tbl_OutSiteStorage>(); foreach (Tbl_SiteStorage oPro in lMa) { Tbl_OutSiteStorage oSto = new Tbl_OutSiteStorage(); oSto.BuildBatchID = (int)oPro.BuildBatchID; oSto.BuildID = oPro.BuildID; oSto.BuildName = oPro.BuildName; oSto.Count = oPro.Count; oSto.MateriesID = oPro.MateriesID; oSto.MateriesTasbleID = oPro.MateriesTasbleID; oSto.MateriesType = oPro.MateriesType; oSto.PlanID = oPro.PlanID; oSto.PreAdmStatus = 1; oSto.PreAdmTime = DateTime.Now; oSto.ProjectName = oPro.ProjectName; oSto.Time = DateTime.Now; oSto.WorkMapID = oPro.WorkMapID; lObj.Add(oSto); } Msg msg = SiteStorageModel.NEditOutBunch(lObj); if (msg.Status) { PageHelper.ShowAlertMsg(this, "确认成功"); } else { PageHelper.ShowAlertMsg(this, "确认失败:" + msg.Message); } } else if (identify == (int)CurrentType.现场确认出库) { List <Tbl_OutSiteStorage> lMa = data as List <Tbl_OutSiteStorage>; Msg msg = SiteStorageModel.EnsureOutBunch(lMa); if (msg.Status) { PageHelper.ShowAlertMsg(this, "确认成功"); } else { PageHelper.ShowAlertMsg(this, "确认失败:" + msg.Message); } } }