class ManufactureDetailsController < CommLogistics::Base::Controller::Detail
  def initialize
    @mcls = ManufactureDetail
    @pmcls = Manufacture
  end
  
  def child
    hrs = @mcls.child(params[:id]).find(:all).ext_hashfy
    hrs.each do |hr|
      hr['manufacture_product_details'] = ManufactureProductDetail.child(hr['id']).find(:all, :select => "id, product_set_id, product_id, lot_number, serial_number, location_number, ubd, price, quantity").only_hashfy
      #設定したロット／シリアル／ubdの加工製品の構成が自身以外にも定義があったら編集はできない。
      hr['manufacture_product_edit'] = params[:edit_mpd]==STR_TRUE ? 2 : ManufactureDetail.check_uniq(hr)
    end
    respond_to do |format|
      format.ext_json do
        render :json => hrs.to_ext_json(@table_name, nil)
      end
    end
  end
end
