Пример #1
0
        public void InsertMachineCallMaterial(MachineCallMaterial info)
        {
            string strSql = @"INSERT INTO MachineCallMaterials (DateCreate,MachineId,MachineNumber,MachineName,RoomId,RoomNumber,RoomName,
                                    OrderId,OrderNumber,ScheduleId,SchueduleNumber,MaterialInfo,[Status]) 
                              VALUES (@DateCreate,@MachineId,@MachineNumber,@MachineName,@RoomId,@RoomNumber,@RoomName,
                                    @OrderId,@OrderNumber,@ScheduleId,@SchueduleNumber,@MaterialInfo,@Status)";

            using (SqlCommand cmd = new SqlCommand(strSql, conn))
            {
                cmd.Parameters.AddWithValue("@DateCreate", info.DateCreate);
                cmd.Parameters.AddWithValue("@MachineId", info.MachineId);
                cmd.Parameters.AddWithValue("@MachineNumber", info.MachineNumber);
                cmd.Parameters.AddWithValue("@MachineName", info.MachineName);
                cmd.Parameters.AddWithValue("@RoomId", info.RoomId);
                cmd.Parameters.AddWithValue("@RoomNumber", info.RoomNumber);
                cmd.Parameters.AddWithValue("@RoomName", info.RoomName);
                cmd.Parameters.AddWithValue("@OrderId", info.OrderId);
                cmd.Parameters.AddWithValue("@OrderNumber", info.OrderNumber);
                cmd.Parameters.AddWithValue("@ScheduleId", info.ScheduleId);
                cmd.Parameters.AddWithValue("@SchueduleNumber", info.SchueduleNumber);
                cmd.Parameters.AddWithValue("@MaterialInfo", info.MaterialInfo);
                cmd.Parameters.AddWithValue("@Status", info.Status);

                cmd.ExecuteNonQuery();
            }
        }
Пример #2
0
        public byte[] HandlerClientData(byte[] buff)
        {
            byte[]    buffResp = { 1 };
            DbHandler db       = new DbHandler();

            NetStructure.DeviceMaterial outInfo = this.DecodeData(buff);
            Machines            machine         = db.SelectMachine(outInfo.MachineId);
            Schedules           schedule        = db.SelectSchedule(outInfo.ScheduleNumber);
            MachineCallMaterial innerInfo       = this.exchangeData(machine, schedule);

            //记录原始数据
            db.InsertMachineCallMaterial(innerInfo);

            buffResp[0] = 0;

            return(buffResp);
        }