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