Exemple #1
0
        public ServiceResult SaveWeldingDataL(WeldingInfo WeldingInfo)
        {
            ServiceResult result = new ServiceResult();

            string sqlUpdate = "UPDATE Product SET WeldPower=@WeldPower,WeldSpeed=@WeldSpeed,Flow=@Flow,FlowUp=@FlowUp,FlowDown=@flowDown," +
                               "Pressure=@Pressure,WeldDepth=@WeldDepth,WeldTime=@WeldTime,XPos=@XPos,YPos=@YPos,ZPos=@ZPos,RPos=@RPos,Coaxiality=@Coaxiality,CoaxUp=@CoaxUp," +
                               "CoaxDown=@CoaxDown,Surface=@Surface,LwmCheck=@LwmCheck,QCResult=@QCResult WHERE PNo=@PNo";

            SqlParameter[] sqlParameters =
            {
                new SqlParameter {
                    ParameterName = "@WeldPower", SqlDbType = SqlDbType.Decimal, SqlValue = WeldingInfo.AvgPower
                },
                new SqlParameter {
                    ParameterName = "@WeldSpeed", SqlDbType = SqlDbType.Int, SqlValue = WeldingInfo.AvgSpeed
                },
                new SqlParameter {
                    ParameterName = "@Pressure", SqlDbType = SqlDbType.Decimal, SqlValue = WeldingInfo.AvgPressure
                },
                new SqlParameter {
                    ParameterName = "@WeldDepth", SqlDbType = SqlDbType.Decimal, SqlValue = WeldingInfo.WeldDepth
                },

                new SqlParameter {
                    ParameterName = "@Flow", SqlDbType = SqlDbType.Decimal, SqlValue = WeldingInfo.AvgFlow
                },
                new SqlParameter {
                    ParameterName = "@FlowUp", SqlDbType = SqlDbType.Decimal, SqlValue = WeldingInfo.FlowUp
                },
                new SqlParameter {
                    ParameterName = "@FlowDown", SqlDbType = SqlDbType.Decimal, SqlValue = WeldingInfo.FlowDown
                },

                new SqlParameter {
                    ParameterName = "@Coaxiality", SqlDbType = SqlDbType.Decimal, SqlValue = WeldingInfo.Coaxiality
                },
                new SqlParameter {
                    ParameterName = "@CoaxUp", SqlDbType = SqlDbType.Decimal, SqlValue = WeldingInfo.CoaxialityUp
                },
                new SqlParameter {
                    ParameterName = "@CoaxDown", SqlDbType = SqlDbType.Decimal, SqlValue = WeldingInfo.CoaxialityDown
                },

                new SqlParameter {
                    ParameterName = "@XPos", SqlDbType = SqlDbType.Decimal, SqlValue = WeldingInfo.WeldXPos
                },
                new SqlParameter {
                    ParameterName = "@YPos", SqlDbType = SqlDbType.Decimal, SqlValue = WeldingInfo.WeldYPos
                },
                new SqlParameter {
                    ParameterName = "@ZPos", SqlDbType = SqlDbType.Decimal, SqlValue = WeldingInfo.WeldZPos
                },
                new SqlParameter {
                    ParameterName = "@RPos", SqlDbType = SqlDbType.Decimal, SqlValue = WeldingInfo.WeldRPos
                },

                new SqlParameter {
                    ParameterName = "@WeldTime", SqlDbType = SqlDbType.Decimal, SqlValue = WeldingInfo.WeldTime
                },
                new SqlParameter {
                    ParameterName = "@Surface", SqlDbType = SqlDbType.NVarChar, SqlValue = WeldingInfo.SurfaceInfo
                },
                new SqlParameter {
                    ParameterName = "@LwmCheck", SqlDbType = SqlDbType.NVarChar, SqlValue = WeldingInfo.LwmCheck == true ? "OK":"NG"
                },
                new SqlParameter {
                    ParameterName = "@QCResult", SqlDbType = SqlDbType.NVarChar, SqlValue = WeldingInfo.QCResult == true ? "OK":"NG"
                },
                new SqlParameter {
                    ParameterName = "@PNo", SqlDbType = SqlDbType.NVarChar, SqlValue = WeldingInfo.CurrentBarCode
                }
            };

            try
            {
                if (SqlHelper.IsConnection(SqlHelper.SQLServerConnectionString))
                {
                    int count = SqlHelper.ExecuteNonQuery(sqlUpdate, CommandType.Text);
                    if (count > 0)
                    {
                        result.IsSuccess = true;
                        result.Msg       = "更新成功";
                    }
                    else
                    {
                        result.IsSuccess = false;
                        result.Msg       = String.Format("更新失败:count={0}", count);
                    }
                }
            }
            catch (Exception ex)
            {
                result.IsSuccess = false;
                result.Msg       = string.Format("异常:{0}", ex.Message);
            }

            return(result);
        }
Exemple #2
0
 public ServiceResult SaveWeldingDataS(WeldingInfo weldingInfo)
 {
     return(idal.SaveWeldingDataS(weldingInfo));
 }