コード例 #1
0
ファイル: BomV1.cs プロジェクト: suifengsigan/TEST_1
        /// <summary>
        /// 上传取点记录
        /// </summary>
        public void UploadAutoCMMRecord(EACT_AUTOCMM_RECORD record)
        {
            if (record == null || string.IsNullOrEmpty(record.MODELNO) || string.IsNullOrEmpty(record.PARTNO) || string.IsNullOrEmpty(record.PARTNAME))
            {
                throw new Exception("取点记录异常");
            }

            using (var conn = DAL.GetConn())
            {
                conn.Open();
                var _tran = conn.BeginTransaction();
                try
                {
                    var select_mould_sql    = string.Format("select ID from EACT_AUTOCMM_RECORD where MODELNO+PARTNO+PARTNAME=@SN");
                    var insert_mould_sql    = string.Format("insert into EACT_AUTOCMM_RECORD(MODELNO,PARTNO,PARTNAME,CMMRESULT,CMMINFO,CMMDATE) output inserted.ID values(@MODELNO,@PARTNO,@PARTNAME,@CMMRESULT,@CMMINFO,@CMMDATE)");
                    var update_cuprum_d_sql = string.Format("update EACT_AUTOCMM_RECORD set CMMRESULT=@CMMRESULT,CMMINFO=@CMMINFO,CMMDATE=@CMMDATE where MODELNO+PARTNO+PARTNAME=@SN");

                    object mouldId = conn.ExecuteScalar(select_mould_sql, new { SN = record.MODELNO + record.PARTNO + record.PARTNAME }, _tran, null, null);
                    if (mouldId == null)
                    {
                        mouldId = conn.ExecuteScalar(insert_mould_sql, record, _tran, null, null).ToString();
                    }
                    else
                    {
                        conn.Execute(update_cuprum_d_sql, new {
                            SN        = record.MODELNO + record.PARTNO + record.PARTNAME,
                            CMMRESULT = record.CMMRESULT,
                            CMMDATE   = record.CMMDATE,
                            CMMINFO   = record.CMMINFO
                        }, _tran, null, null);
                    }
                    _tran.Commit();
                }
                catch (Exception ex)
                {
                    _tran.Rollback();
                    throw ex;
                }
            }
        }
コード例 #2
0
 /// <summary>
 /// 上传取点记录
 /// </summary>
 public static void UploadAutoCMMRecord(EACT_AUTOCMM_RECORD record)
 {
     GetBomDal().UploadAutoCMMRecord(record);
 }
コード例 #3
0
ファイル: BomV2.cs プロジェクト: suifengsigan/TEST_1
 public void UploadAutoCMMRecord(EACT_AUTOCMM_RECORD record)
 {
 }