Exemplo n.º 1
0
        public static int AddIronMeltSuppMaterial(IronMeltSuppMaterial ironMeltSuppMaterial)
        {
            int result = 0;

            try
            {
                result = DataFactory.UpdateEntity(ironMeltSuppMaterial, "GroupSID,IronMeltTranSID,MaterialSID,IronMeltSuppMaterialWeight,IronMeltSuppMaterialTime", "MW_IronMeltSuppMaterial_INS");
            }
            catch (Exception)
            {
                result = 0;
            }
            return(result);
        }
Exemplo n.º 2
0
        //铁水转运线程
        private void ThreadReadServer1()
        {
            IronMeltTrans ironMeltTrans = new IronMeltTrans();
            int           result;

            while (true) //持续执行
            {
                result = 0;

                //根据标志上升沿写入数据库
                if (Convert.ToInt16(siemensTcpNet.ReadBool("DB1.826.4").Content) - Convert.ToInt16(ironWriteSQL) == 1)
                {
                    int groupinfo = siemensTcpNet.ReadInt16("DB1.540").Content;   //班次
                    if (groupinfo == 2)
                    {
                        ironMeltTrans.GroupSID = 6;
                    }
                    if (groupinfo == 3)
                    {
                        ironMeltTrans.GroupSID = 5;
                    }
                    try
                    {
                        ironMeltTrans.ProductionScheduleSID = ProductionScheduleDAL.GetProductionScheduleSID(); //订单
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                    }

                    ironMeltTrans.EmployeeSID          = siemensTcpNet.ReadInt16("DB1.540").Content; //员工(测试)
                    ironMeltTrans.EquipmentSID         = siemensTcpNet.ReadInt16("DB1.4").Content;   //炉号
                    ironMeltTrans.ElectricFurnaceCount = siemensTcpNet.ReadInt16("DB1.6").Content;   //炉次
                    ironMeltTrans.IronMeltTransNum     = siemensTcpNet.ReadInt16("DB1.8").Content;   //包次
                    ironMeltTrans.IronMeltTransWeight  = siemensTcpNet.ReadInt16("DB1.0").Content;   //铁水重量
                    ironMeltTrans.IronMeltTransTime    = DateTime.Now;                               //铁水转运时间
                    if (siemensTcpNet.ReadBool("DB1.552").Content == true)
                    {
                        ironMeltTrans.BackWeight = siemensTcpNet.ReadInt16("DB1.550").Content;                                                       //行车吊装
                    }
                    try
                    {
                        result = IronMeltTransDAL.AddIronMeltTransInfo(ironMeltTrans);
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("铁水转运出现问题" + ex.Message);
                        return;
                    }

                    if (result == 1)
                    {
                        listBox2.Items.Add("铁水转运写入数据库成功  " + DateTime.Now);
                        int result2 = 0;
                        IronMeltSuppMaterial ironMeltSuppMaterial = new IronMeltSuppMaterial();
                        int groupSID;
                        ironMeltSuppMaterial.IronMeltTranSID            = IronMeltTransDAL.GetIronMeltTransSID(out groupSID);
                        ironMeltSuppMaterial.GroupSID                   = groupSID;
                        ironMeltSuppMaterial.MaterialSID                = 77;                                       //暂定这种孕育剂
                        ironMeltSuppMaterial.IronMeltSuppMaterialWeight = siemensTcpNet.ReadInt16("DB1.2").Content; //加料(孕育剂)重量
                        ironMeltSuppMaterial.IronMeltSuppMaterialTime   = DateTime.Now;
                        try
                        {
                            result2 = IronMeltSuppMaterialDAL.AddIronMeltSuppMaterial(ironMeltSuppMaterial);
                        }
                        catch (Exception ex)
                        {
                            MessageBox.Show("铁水转运加料出现问题:" + ex.Message);
                        }
                        if (result2 == 1)
                        {
                            listBox2.Items.Add("铁水转运加料写入数据库成功  " + DateTime.Now);
                        }
                        else
                        {
                            listBox2.Items.Add("铁水转运加料写入数据库失败  " + DateTime.Now);
                        }
                    }
                    else
                    {
                        listBox2.Items.Add("铁水转运写入数据库失败  " + DateTime.Now);
                    }
                }

                ironWriteSQL = siemensTcpNet.ReadBool("DB1.826.4").Content; //更新标志
            }
        }