/// <summary>
        /// 通知失败时,要告知plc
        /// FrmMain.ERPAlarm(FrmMain.opcClient, FrmMain.opcParam, ERPAlarmNo.COMMUNICATION_ERROR);
        /// </summary>
        /// <param name="erpapi"></param>
        /// <param name="panelNo"></param>
        /// <param name="msg"></param>
        /// <param name="handwork"></param>
        /// <param name="realloc"></param>
        /// <returns></returns>
        public static bool NotifyPanelEnd(IErpApi erpapi, string panelNo, string realloc, out string msg, bool handwork = false)
        {
            if (string.IsNullOrEmpty(panelNo))
            {
                msg = $"!实际交地{realloc}/{panelNo}板号完成取消,板号为空。";
                return(false);
            }
            // 这个从数据库取似更合理。
            var data = LableCode.QueryLabelcodeByPanelNo(panelNo);

            if (data == null)
            {
                msg = $"!实际交地{realloc}/{panelNo}板号完成取消,未能查到数据库的标签。";
                return(false);
            }

            var erpParam = new Dictionary <string, string> {
                { "Board_No", panelNo },                           // first item.
                { "AllBarCode", string.Join(",", data.ToArray()) } // second item.
            };
            var re = erpapi.Post(clsSetting.PanelFinish, erpParam, clsSetting.ErpTimeout);

            var mode       = handwork ? "手工" : "自动";
            var paramJson  = JsonConvert.SerializeObject(erpParam);
            var resultJson = JsonConvert.SerializeObject(re);

            // show result.
            if (re["ERPState"] == "OK")
            {
                if (re["State"] == "Fail")
                {
                    msg = $"!{mode}板号{paramJson}完成失败, {re["ERR"]}";
                    return(false);
                }
                else
                {
                    msg = $"{mode}板号{paramJson}完成成功。{re["Data"]}";
                    return(true);
                }
            }
            else
            {
                msg = $"{mode}板号{paramJson}完成失败, {resultJson}";
                return(false);
            }
        }