using System; using System.Collections.Generic; using System.Linq; using System.Text; using MesServerWork; using bizFacade; using System.Data; //using SystemFramework; using System.Data.SqlClient; namespace MesServerFunctions { partial class Functions_BASE_01 { /// ///1、物料验证 ///2、MES生成总成编号 ///3、MES传递机型 /// 处理页面扫描条码 /// /// /// public void Barcode(object e) { try { DoWhatPlc.CustomeEvetnArgs msgEvent = (DoWhatPlc.CustomeEvetnArgs)e; string OpName = Convert.ToString(msgEvent.OpName); string barcode = Convert.ToString(msgEvent.TagValue); bool ispartload = false; bool IsSuccess = false; int IsAllowWork; int engineTypeID; string engineID; string engineType; BaseDataSystemMES.PartMaterial_DM_Update(OpName, barcode, out IsSuccess); MIS_BASE.Read_PartLoad(OpName, out ispartload); if (!ispartload && IsSuccess) { AsyncSendMessage_Notice(OpName,"PLC未申请上线,请确认"); return; } if (!IsSuccess) { AsyncSendMessage_Notice(OpName,"条码无效,请确认"); return; } Sendmessage("2", "1", OpName);//通知WEB前端更新零件信息 BaseDataSystemMES.MesServer_Judge_IsCanWork(OpName, out IsAllowWork); //扫描完成线首工位需要创建发动机号 if (IsAllowWork == 1) { CreateEngineID(OpName, out engineType,out engineTypeID, out engineID); if (engineType == "-1" || engineType == "" || engineTypeID == -1 || engineID == "") { AsyncSendMessage_Notice(OpName,"未选择订单或机型,请选择后重新到位"); return; } else { //将产品信息写入PLC MIS_BASE.Write_EngineTypeID_MES(OpName, engineTypeID); MIS_BASE.Write_EngineType_MES(OpName, engineType); MIS_BASE.Write_EngineID_MES(OpName, engineID); //获取订单号,发动机型号,发动机型号代码(在线首工位将选择的订单,机型等信息保存到监控表中) bizFacade.BaseDataSystemMES.OpName_MIS_CreateMoby_Select(OpName, out string orderForm, out engineTypeID, out engineType, out engineID, out string palletCode, out int isRepair, out string repairCode); MIS_BASE.Write_OrderForm_MES(OpName, orderForm); MIS_BASE.Write_EngineTypeGetOver_MES(OpName, true); } SendInfomation("ShowMobyMES", engineID + "&" + engineType, OpName); } } catch (Exception err) { ////ApplicationLog.WriteLog(err, "Function01:Barcode"); } } } }