using Aborlen.Model; using FrameWork.Log; using SqlSugar; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using WorkStationBase; namespace Aborlen.WorkStation { public partial class WorkStation12 : StationBase { /// /// 扫描条码 /// /// /// /// public void BarCode(string stationCode, object value, DateTime triggerTime) { //try //{ // string barcode = value.ToString(); // if (barcode.Contains(PresentOrder.yfas_rule)) // { // //判断数据库是否存在当前条码 如果存在 则不放行提示手动打印 // if (Deploy_Data.Query().Where(p => p.print_pid == barcode).Count() > 0) // { // SendMsg.SendMsgToStation("OP110", "AlarmMsg", "不合格下线工位扫描的条码系统中已存在!"); // return; // } // //已存在,更新上线时间 // string sql = $" update Deploy_Data set print_pid ='{barcode}',ng_pid='{barcode}',print_time='{DateTime.Now}',process_state=4 where tuopan_id ='{Read(2180, triggerTime)}' and process_state<4 and plan_id='{PresentOrder.plan_id}'"; // SqlSugarAdo.ExecuteCommand(sql); // //更新合格数量 // int NokAccount = Deploy_Data.Query().Where(p => p.plan_id == PresentOrder.plan_id &&p.all_result==2&& p.process_state == 4).Count(); // sql = $" update ProductOrder set nok_account ='{NokAccount}'where plan_id='{PresentOrder.plan_id}'"; // SqlSugarAdo.ExecuteCommand(sql); // //产品合格 修改序列号状态 // SqlSugarAdo.ExecuteCommand($"update ProductSerialCodeRecord set WorkComplete=2 where PalletNum='{Read(2180, triggerTime)}' and WorkComplete <2"); // //写入扫描完成 // Write(1080, (byte)1); // NgProductCode = barcode; // SendMsg.SendMsgToStation("OP110", "NgProductCode", NgProductCode); // SendMsg.SendMsgToStation("OP110", "AlarmMsg", ""); // } //} //catch (Exception ex) //{ // LogHelper.WriteLog(LogHelper.GetMethodInfo(), ex); //} } } }