안녕하세요~~
너무나 존경스런 루비개발자님들에게 도움이 필요하여 이렇게 소스랑 같이 글을 남기게 되었습니다.
우선 아래보시면 resource_select_tag 옆에 mo 라고 시작되는 부분이 있는데 이 mo 는 대체 무슨 용도인지를 전혀 모르겠습니다. 책을 뒤적거려봐도 모르겠고 인터넷을 찾아봐도 안나와있던데...
아시는분은 좀 알려주셨으면 좋겟습니다. 너무 간절합니다. ----------------- 이게 첫번째 질문입니다. 두번째 질문은 또다른 소스와 같이 하겠습니다.
1번째 질문 소스
<% @material_name.each do |temp|%>
<tr name= "tr_id">
<td><%= temp.material_id.split(@
domain.id+"-")[1] %></td>
<td><%= temp.default_qty %></td>
<td><%= (@qty.to_f*temp.default_qty.to_f)/100.00%></td>
<td><%= text_field_tag "mo[#{temp.material_id}][real_amount]", (@qty.to_f*temp.default_qty.to_f)/100.00 , :Onkeydown => "real_total_set();" %></td>
<td><%= resource_select_tag "mo[#{temp.material_id}][raw_name]", 'Lot' ,"" , :search_conditions => {:qty_1 => '>=0.001' ,:material_id=>temp.material_id.gsub("1000-","") } %></td>
<td><%= resource_select_tag "mo[#{temp.material_id}][raw_name2]", 'Lot' ,"", :search_conditions => {:qty_1 => '>=0.001' ,:material_id=>temp.material_id.gsub("1000-","") }%></td>
<td><%= resource_select_tag "mo[#{temp.material_id}][raw_name3]", 'Lot' ,"", :search_conditions => {:qty_1 => '>=0.001' ,:material_id=>temp.material_id.gsub("1000-","") }%></td>
<% real_total += (@qty.to_f*temp.default_qty.to_f)/100.00%>
<% bom_total += temp.default_qty.to_f%>
2.번째 질문소스
지금 밑에보시면 @domain.lots.create!(:name => @lot_type+"_"
+@date+"_"+@seq_num , :seq_num=> @seq_num <---- 요부분뒤에 :description => xxxxxxx 를 넣어 db에있는 description 열에 데이터를 넣고싶은데요 데이터는 위에 1번째 소스에
mo[#{temp.material_id}][raw_name]", 'Lot' ,"" , :search_conditions => {:qty_1 => '>=0.001' ,:material_id=>temp.material_id.gsub("1000-","") } %> 이분분에서 데이터가 들어옵니다 이 데이터를 description 에 넣고싶어서 그러는데 저기
xxxxxxx 라고 한부분에 어떻게 설정값을 넣어줘야하는지를 모르겠습니다. mo 자체가 뭔지를 몰라서 이리저리 해도 에러만 뜨네요... ㅠㅠ
@date = Time.now.strftime("%Y%m%d")
@lot_type = 'MX'
@temp_seq = @domain.lots.find_by_sql "select max(seq_num) as seq_num from lots where name like '"
+@lot_type +"'+'_'+'"
+@date+"' +'_'+ seq_num"
@temp_seq.each do |temp|
@seq_num =temp.seq_num
end
if(@seq_num == nil)
@seq_num = 0
end
@seq_num = "%03d"%(@seq_num.to_i+1)
@domain.lots.create!(:name => @lot_type+"_"
+@date+"_"+@seq_num , :seq_num=> @seq_num ,:material_id => params[:dg_lot][:material_id] ,:qty_1 => params[:dg_lot][:qty_1] , :lot_type => @lot_type ,:equipment_id => params[:dg_lot][:equipment], :status_flag=> "started" ,:status =>'START', :start_flag => true, :start_time => Time.now)
flash[:notice] = t(:'notice.temp_notice', :input_name=>@lot_type+"_"
+@date+"_"+@seq_num)
else
flash[:error] = t(:'notice.qty_shortage')
end
혹시몰라서 전체소스도 같이 올려드리겠습니다. 제발 도와주십시요 꾸벅~~