/// <summary> /// 保存归批机样桶信息 /// </summary> /// <param name="coord"></param> /// <returns></returns> public bool SaveCoord(InfPackingBatchCoord coord) { InfPackingBatchCoord batchCoord = Dbers.GetInstance().SelfDber.Entity <InfPackingBatchCoord>("where Coord=:Coord and MachineCode=:MachineCode order by Coord", new { Coord = coord.Coord, MachineCode = coord.MachineCode }); if (batchCoord == null) { return(Dbers.GetInstance().SelfDber.Insert(coord) > 0); } else { batchCoord.UpdateTime = coord.UpdateTime; batchCoord.SampleCode = coord.SampleCode; batchCoord.State = coord.State; batchCoord.SyncFlag = 0; return(Dbers.GetInstance().SelfDber.Update(batchCoord) > 0); } }
/// <summary> /// 同步样桶信息 /// </summary> /// <param name="output"></param> /// <returns></returns> public void SyncCoord(Action <string, eOutputType> output) { int res = 0; // 集中管控 > 第三方 foreach (Coord_TB entity in this.EquDber.Entities <Coord_TB>("")) { bool isSuccess = false; InfPackingBatchCoord batchcoord = new InfPackingBatchCoord(); batchcoord.MachineCode = this.MachineCode; batchcoord.SampleCode = entity.SampleCode; batchcoord.State = entity.State; batchcoord.UpdateTime = entity.DateTime; batchcoord.Coord = entity.Coord; isSuccess = PackingBatchDAO.GetInstance().SaveCoord(batchcoord); if (isSuccess) { res++; } } output(string.Format("同步样桶信息 {0} 条(第三方 > 集中管控)", res), eOutputType.Normal); }