/// <summary> /// 根据编号查询入库批次表 /// </summary> /// <returns></returns> public static Msg QueryStorageById(int BuildBunchId) { Msg msg = null; try { using (var en = new LingYunEntities()) { Tbl_SiteStorage lBunch = en.Tbl_SiteStorage.Where(a => a.BuildBatchID == BuildBunchId).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); }
protected void Ensure_Click(object sender, EventArgs e) { Tbl_SiteStorage oBunch = new Tbl_SiteStorage(); oBunch.PlanID = int.Parse(txbPlanId.Value); oBunch.Time = DateTime.Now; oBunch.MateriesID = int.Parse(txbMateriesID.Value); oBunch.BuildBatchID = int.Parse(txbBuildBunchID.Value); oBunch.BuildID = txbBuildID.Value; oBunch.BuildName = txbBuildName.Value.ToString(); oBunch.MateriesType = txbMetriesType.Value.ToString(); oBunch.PreAdmTime = DateTime.Now; oBunch.PreAdmStatus = 128; oBunch.InCount = int.Parse(txbCount.Value); oBunch.NowAdmStatus = 1; oBunch.NowAdmTime = DateTime.Now; oBunch.MateriesTasbleID = 1; oBunch.ProjectName = txbProjectName.Value; oBunch.WorkMapID = txbProductNum.Value; Msg msg = SiteStorageModel.EnsureInBunch(int.Parse(txbBuildBunchID.Value), oBunch); if (msg.Status) { PageHelper.ShowAlertMsg(this, "确认成功"); } else { PageHelper.ShowAlertMsg(this, msg.Message); } }
/// <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 Msg EnsureInBunch(int iBuildBunch, Tbl_SiteStorage oStorage) { Msg msg = null; try { using (var en = new LingYunEntities()) { Tbl_OutCenterStorage oCenterBunch = en.Tbl_OutCenterStorage.Where(a => a.BuildBatchID == iBuildBunch).FirstOrDefault(); if (oCenterBunch != null) { oCenterBunch.NowAdmStatus = 128; oCenterBunch.NowAdmTime = DateTime.Now; } Tbl_SiteStorageBatch oSiteInBunch = en.Tbl_SiteStorageBatch.Where(a => a.BuildBatchID == iBuildBunch).FirstOrDefault(); if (oCenterBunch != null) { oSiteInBunch.NowAdmStatus = 128; oCenterBunch.NowAdmTime = DateTime.Now; } en.Tbl_SiteStorage.AddObject(oStorage); en.SaveChanges(); msg = Msg.Default; } } catch (Exception ex) { msg = new Msg(false) { Message = ex.Message }; } return(msg); }
public static Msg AndroidInEnsure(int iBatchId) { Msg msg = null; try { using (var en = new LingYunEntities()) { var last = en.Tbl_OutCenterStorage.Where(a => a.BuildBatchID == iBatchId).FirstOrDefault(); last.NowAdmStatus = 128; last.NowAdmTime = DateTime.Now; var obj = en.Tbl_SiteStorageBatch.Where(a => a.BuildBatchID == iBatchId).FirstOrDefault(); obj.NowAdmStatus = 128; obj.NowAdmTime = DateTime.Now; Tbl_SiteStorage oStorage = new Tbl_SiteStorage(); oStorage.PlanID = obj.PlanID; oStorage.Time = DateTime.Now; oStorage.MateriesID = obj.MateriesID; oStorage.BuildID = obj.BuildID; oStorage.BuildName = obj.BuildName; oStorage.MateriesType = obj.MateriesType; oStorage.PreAdmTime = DateTime.Now; oStorage.PreAdmStatus = 128; oStorage.NowAdmStatus = 1; oStorage.NowAdmTime = DateTime.Now; oStorage.ProjectName = obj.ProjectName; oStorage.WorkMapID = obj.WorkMapID; oStorage.InCount = obj.Count; en.Tbl_SiteStorage.AddObject(oStorage); en.SaveChanges(); msg = Msg.Default; } } catch (Exception ex) { msg = new Msg() { Status = false, Message = ex.Message }; } return(msg); }
protected void Page_Load(object sender, EventArgs e) { string BuildBunchId = this.Request["BuildBunchId"]; Msg msg = SiteStorageModel.QueryStorageById(int.Parse(BuildBunchId)); Tbl_SiteStorage oStorage = msg.UserData as Tbl_SiteStorage; if (oStorage != null) { txbPlanId.Value = oStorage.PlanID.ToString(); txbMateriesID.Value = oStorage.MateriesID.ToString(); txbBuildID.Value = oStorage.BuildID.ToString(); txbBuildName.Value = oStorage.BuildName; txbCount.Value = oStorage.InCount.ToString(); txbMetriesType.Value = oStorage.MateriesType; txbProjectName.Value = oStorage.ProjectName; txbBuildBunchID.Value = oStorage.BuildBatchID.ToString(); txbProductNum.Value = oStorage.WorkMapID.ToString(); } }
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); } } }