/// <summary> /// 发送倒料命令 /// </summary> /// <param name="rCSamplingCode"></param> /// <returns></returns> public bool SendPackingBatch(string machineCode, string rCSamplingCode, out string currentMessage) { CmcsRCMake rcMake = AutoMakerDAO.GetInstance().GetRCMakeBySampleCode(rCSamplingCode); if (rcMake != null) { string fuelKindName = string.Empty; InfPackingBatchCmd packingbatch = new InfPackingBatchCmd() { InterfaceType = CommonDAO.GetInstance().GetMachineInterfaceTypeByCode(machineCode), MachineCode = machineCode, SampleCode = rCSamplingCode, MakeCode = rcMake.MakeCode, ResultCode = eEquInfCmdResultCode.默认.ToString(), SyncFlag = 0, DataFlag = 0 }; if (CommonDAO.GetInstance().SelfDber.Insert(packingbatch) > 0) { currentMessage = "倒料命令发送成功"; return(true); } else { currentMessage = "倒料命令发送失败"; return(false); } } else { currentMessage = "未找到制样主记录信息"; return(false); } }
/// <summary> /// 同步倒料命令 /// </summary> /// <param name="output"></param> /// <returns></returns> public void SyncCmd(Action <string, eOutputType> output) { int res = 0; // 集中管控 > 第三方 foreach (InfPackingBatchCmd entity in PackingBatchDAO.GetInstance().GetWaitForSyncJXCYPackingBatchCmd()) { bool isSuccess = false; isSuccess = this.EquDber.Insert(new HYGP_Cmd_Tb { Command = 1, SampleCode = entity.SampleCode, DateTime = DateTime.Now, DataStatus = 0 }) > 0; if (isSuccess) { entity.SyncFlag = 1; commonDAO.SelfDber.Update(entity); res++; } } output(string.Format("同步控制命令 {0} 条(集中管控 > 第三方)", res), eOutputType.Normal); res = 0; // 第三方 > 集中管控 foreach (HYGP_Cmd_Tb entity in this.EquDber.Entities <HYGP_Cmd_Tb>("where DataStatus=11 or DataStatus=12")) { InfPackingBatchCmd makerControlCmd = commonDAO.SelfDber.Entity <InfPackingBatchCmd>("where SampleCode=:SampleCode and DataFlag=0 order by CreateDate desc", new { SampleCode = entity.SampleCode }); if (makerControlCmd == null) { continue; } // 更新执行结果等 makerControlCmd.ResultCode = ((eDataStatus)entity.DataStatus).ToString(); makerControlCmd.DataFlag = 3; if (commonDAO.SelfDber.Update(makerControlCmd) > 0) { res++; } } output(string.Format("同步控制命令 {0} 条(第三方 > 集中管控)", res), eOutputType.Normal); }
/// <summary> /// 获取倒料状态 /// </summary> /// <param name="output"></param> /// <returns></returns> public eEquInfCmdResultCode GetQCJXPackingBatchState(string samplingCode) { eEquInfCmdResultCode eResult; InfPackingBatchCmd SampleUnloadCmd = Dbers.GetInstance().SelfDber.Entity <InfPackingBatchCmd>("where SampleCode=:SampleCode order by CreateDate desc", new { SampleCode = samplingCode }); if (SampleUnloadCmd != null) { if (Enum.TryParse(SampleUnloadCmd.ResultCode, out eResult)) { return(eResult); } else { return(eEquInfCmdResultCode.默认); } } else { return(eEquInfCmdResultCode.默认); } }