private bool JudgeIsLast(P5CentInfoList list) { //TODO 判断是否需要特殊放行 foreach (P5CentInfo centInfo in list.p5CentInfos) { if (String.IsNullOrEmpty(centInfo.BatchCode)) { return(false); } } return(true); }
public void OnEvent_P5_CentInfoReadDone(ApcmEventArgs evt) { P5CentInfoList p5CentInfoList = new P5CentInfoList(); p5CentInfoList = (P5CentInfoList)StructTransform.BytesToStruct((byte[])(((Dictionary <string, object>)evt.Data)[ApcmDevcieConfig.ACTION_P5_CENTINFO]), p5CentInfoList.GetType()); Set($"{ApcmKeyConf.DataCollection}:{ApcmDevcieConfig.ACTION_P5_CENTINFO}:DATA", p5CentInfoList); //生成批次号 p5CentInfoList = CreateBatch(p5CentInfoList); Write(ApcmDevcieConfig.ACTION_P5_CENTINFO, StructTransform.StructToBytes(p5CentInfoList)); Write(ApcmDevcieConfig.ACTION_P5_BSCADAWRITEDONE, 1); bool IsLast = JudgeIsLast(p5CentInfoList); if (!IsLast) { Write(ApcmDevcieConfig.ACTION_P5_SPETASK, 1); } }
private P5CentInfoList CreateBatch(P5CentInfoList centInfoList) { //TODO 生成新的批次号 String BatchCode = "Z19001 - DR" + DateTime.Now.Month + DateTime.Now.Day; ; if (!string.IsNullOrEmpty(centInfoList.p5CentInfos[0].BatchCode)) { centInfoList.p5CentInfos[0].BatchCode = BatchCode; } if (!string.IsNullOrEmpty(centInfoList.p5CentInfos[1].BatchCode)) { centInfoList.p5CentInfos[1].BatchCode = BatchCode; } if (!string.IsNullOrEmpty(centInfoList.p5CentInfos[2].BatchCode)) { centInfoList.p5CentInfos[2].BatchCode = BatchCode; } return(centInfoList); }